Browse Source

Merge remote-tracking branch 'remotes/mrdoob/dev' into unflip

alteredq 13 years ago
parent
commit
9cc7b75a89

+ 407 - 407
build/Three.js

@@ -17,55 +17,55 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],j=d[5],i=d[9],l=d[2],o=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-i,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,j);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(i));if(Math.abs(i)<
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,j)}else{this.y=Math.atan2(-l,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,j)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,j)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-i,j);this.y=Math.atan2(-l,
-e)}else{this.x=0;this.y=Math.atan2(l,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,j);this.y=Math.atan2(g,e)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}else if(b===
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],m=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(j));if(Math.abs(j)<
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-l,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(m));if(Math.abs(m)<0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(m,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-j,i);this.y=Math.atan2(-l,
+e)}else{this.x=0;this.y=Math.atan2(l,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(m,i);this.y=Math.atan2(g,e)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
 a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
 b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 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=
 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],j=a[9];c=a[2];b=a[6];var i=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(j-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(j+b)<0.1&&Math.abs(e+h+i-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;i=(i+1)/2;d=(d+g)/4;f=(f+c)/4;j=(j+b)/4;if(e>h&&e>i)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
-i)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=j/c}else if(i<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(i);b=f/d;c=j/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-j)*(b-j)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-j)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+i-1)/2);return this}};
+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}};
 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.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],j=c[6],i=c[7],l=c[8],o=c[9],n=c[10],p=c[11],r=c[12],m=c[13],q=c[14],c=c[15];b[0].set(f-a,i-g,p-l,c-r);b[1].set(f+a,i+g,p+l,c+r);b[2].set(f+d,i+h,p+o,c+m);b[3].set(f-d,i-h,p-o,c-m);b[4].set(f-e,i-j,p-n,c-q);b[5].set(f+e,i+j,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.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;
 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;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,s,u,t,v=function(a,b,c){r.sub(c,a);s=r.dot(b);u=m.add(a,q.copy(b).multiplyScalar(s));
-return t=c.distanceTo(u)},x,F,C,z,w,H,E,O,Q=function(a,b,c,d){r.sub(d,b);m.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(m);C=r.dot(q);z=m.dot(m);w=m.dot(q);H=1/(x*z-F*F);E=(z*C-F*w)*H;O=(x*w-F*C)*H;return E>=0&&O>=0&&E+O<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var m=0,r=a.children.length;m<r;m++)Array.prototype.push.apply(d,this.intersectObject(a.children[m],b));if(a instanceof THREE.Particle){t=v(this.origin,this.direction,a.matrixWorld.getPosition());
-if(t>a.scale.x)return[];c={distance:t,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){m=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());m=a.geometry.boundingSphere.radius*Math.max(m.x,Math.max(m.y,m.z));t=v(this.origin,this.direction,a.matrixWorld.getPosition());if(t>m)return d;var q,s,w=a.geometry,u=w.vertices,x;a.matrixRotationWorld.extractRotation(a.matrixWorld);m=0;for(r=w.faces.length;m<
-r;m++){c=w.faces[m];j.copy(this.origin);i.copy(this.direction);x=a.matrixWorld;l=x.multiplyVector3(l.copy(c.centroid)).subSelf(j);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));q=i.dot(o);if(!(Math.abs(q)<Y)){s=o.dot(l)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){n.add(j,i.multiplyScalar(s));t=j.distanceTo(n);if(!(t<this.near)&&!(t>this.far))if(c instanceof THREE.Face3){e=x.multiplyVector3(e.copy(u[c.a]));f=x.multiplyVector3(f.copy(u[c.b]));g=x.multiplyVector3(g.copy(u[c.c]));
-if(Q(n,e,f,g)){c={distance:t,point:n.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=x.multiplyVector3(e.copy(u[c.a]));f=x.multiplyVector3(f.copy(u[c.b]));g=x.multiplyVector3(g.copy(u[c.c]));h=x.multiplyVector3(h.copy(u[c.d]));if(Q(n,e,f,h)||Q(n,f,g,h)){c={distance:t,point:n.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(p);
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s,w,t,v=function(a,b,c){r.sub(c,a);s=r.dot(b);w=o.add(a,q.copy(b).multiplyScalar(s));
+return t=c.distanceTo(w)},x,C,D,z,u,G,J,M,O=function(a,b,c,d){r.sub(d,b);o.sub(c,b);q.sub(a,b);x=r.dot(r);C=r.dot(o);D=r.dot(q);z=o.dot(o);u=o.dot(q);G=1/(x*z-C*C);J=(z*D-C*u)*G;M=(x*u-C*D)*G;return J>=0&&M>=0&&J+M<1},X=1.0E-4;this.setPrecision=function(a){X=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var o=0,r=a.children.length;o<r;o++)Array.prototype.push.apply(d,this.intersectObject(a.children[o],b));if(a instanceof THREE.Particle){t=v(this.origin,this.direction,a.matrixWorld.getPosition());
+if(t>a.scale.x)return[];c={distance:t,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){o=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());o=a.geometry.boundingSphere.radius*Math.max(o.x,Math.max(o.y,o.z));t=v(this.origin,this.direction,a.matrixWorld.getPosition());if(t>o)return d;var q,s,u=a.geometry,w=u.vertices,x;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(r=u.faces.length;o<
+r;o++){c=u.faces[o];i.copy(this.origin);j.copy(this.direction);x=a.matrixWorld;l=x.multiplyVector3(l.copy(c.centroid)).subSelf(i);m=a.matrixRotationWorld.multiplyVector3(m.copy(c.normal));q=j.dot(m);if(!(Math.abs(q)<X)){s=m.dot(l)/q;if(!(s<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){n.add(i,j.multiplyScalar(s));t=i.distanceTo(n);if(!(t<this.near)&&!(t>this.far))if(c instanceof THREE.Face3){e=x.multiplyVector3(e.copy(w[c.a]));f=x.multiplyVector3(f.copy(w[c.b]));g=x.multiplyVector3(g.copy(w[c.c]));
+if(O(n,e,f,g)){c={distance:t,point:n.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=x.multiplyVector3(e.copy(w[c.a]));f=x.multiplyVector3(f.copy(w[c.b]));g=x.multiplyVector3(g.copy(w[c.c]));h=x.multiplyVector3(h.copy(w[c.d]));if(O(n,e,f,h)||O(n,f,g,h)){c={distance:t,point:n.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(p);
 return c}};
 return c}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h===true){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:
-g;d=d>f?d:f;e=e>g?e:g}a()};this.add3Points=function(f,g,l,o,n,p){if(h===true){h=false;b=f<l?f<n?f:n:l<n?l:n;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>n?f:n:l>n?l:n;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===true){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,m){h=false;b=f;c=g;d=l;e=m;a()};this.addPoint=function(f,g){if(h===true){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:
+g;d=d>f?d:f;e=e>g?e:g}a()};this.add3Points=function(f,g,l,m,n,p){if(h===true){h=false;b=f<l?f<n?f:n:l<n?l:n;c=g<m?g<p?g:p:m<p?m:p;d=f>l?f>n?f:n:l>n?l:n;e=g>m?g>p?g:p:m>p?m:p}else{b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b;c=g<m?g<p?g<c?g:c:p<c?p:c:m<p?m<c?m:c:p<c?p:c;d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d;e=g>m?g>p?g>e?g:e:p>e?p:e:m>p?m>e?m:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===true){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
 c=c<f.getTop()?c:f.getTop();d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 c=c<f.getTop()?c:f.getTop();d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],i=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*j;l[8]=b*i;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,j,i,l,o,n,p,r,m){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,i||0,l!==void 0?l:1,o||0,n||0,p||0,r||0,m!==void 0?m:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,i,l,o,n,p,r,m){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=j;q[6]=i;q[10]=l;q[14]=o;q[3]=n;q[7]=p;q[11]=r;q[15]=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],j=c[12],i=c[1],l=c[5],o=c[9],n=c[13],p=c[2],r=c[6],m=c[10],q=c[14],s=c[3],u=c[7],t=c[11],c=c[15],v=d[0],x=d[4],
-F=d[8],C=d[12],z=d[1],w=d[5],H=d[9],E=d[13],O=d[2],Q=d[6],Y=d[10],B=d[14],J=d[3],P=d[7],D=d[11],d=d[15];e[0]=f*v+g*z+h*O+j*J;e[4]=f*x+g*w+h*Q+j*P;e[8]=f*F+g*H+h*Y+j*D;e[12]=f*C+g*E+h*B+j*d;e[1]=i*v+l*z+o*O+n*J;e[5]=i*x+l*w+o*Q+n*P;e[9]=i*F+l*H+o*Y+n*D;e[13]=i*C+l*E+o*B+n*d;e[2]=p*v+r*z+m*O+q*J;e[6]=p*x+r*w+m*Q+q*P;e[10]=p*F+r*H+m*Y+q*D;e[14]=p*C+r*E+m*B+q*d;e[3]=s*v+u*z+t*O+c*J;e[7]=s*x+u*w+t*Q+c*P;e[11]=s*F+u*H+t*Y+c*D;e[15]=s*C+u*E+t*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,m,n,p,r,o){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,j||0,l!==void 0?l:1,m||0,n||0,p||0,r||0,o!==void 0?o:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,m,n,p,r,o){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=l;q[14]=m;q[3]=n;q[7]=p;q[11]=r;q[15]=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],r=c[6],o=c[10],q=c[14],s=c[3],w=c[7],t=c[11],c=c[15],v=d[0],x=d[4],
+C=d[8],D=d[12],z=d[1],u=d[5],G=d[9],J=d[13],M=d[2],O=d[6],X=d[10],B=d[14],F=d[3],Q=d[7],E=d[11],d=d[15];e[0]=f*v+g*z+h*M+i*F;e[4]=f*x+g*u+h*O+i*Q;e[8]=f*C+g*G+h*X+i*E;e[12]=f*D+g*J+h*B+i*d;e[1]=j*v+l*z+m*M+n*F;e[5]=j*x+l*u+m*O+n*Q;e[9]=j*C+l*G+m*X+n*E;e[13]=j*D+l*J+m*B+n*d;e[2]=p*v+r*z+o*M+q*F;e[6]=p*x+r*u+o*O+q*Q;e[10]=p*C+r*G+o*X+q*E;e[14]=p*D+r*J+o*B+q*d;e[3]=s*v+w*z+t*M+c*F;e[7]=s*x+w*u+t*O+c*Q;e[11]=s*C+w*G+t*X+c*E;e[15]=s*D+w*J+t*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
-a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],j=a[13],i=a[2],l=a[6],o=a[10],n=a[14],p=a[3],r=a[7],m=a[11],a=a[15];return e*h*l*p-d*j*l*p-e*g*o*p+c*j*o*p+d*g*n*p-c*h*n*p-e*h*i*r+d*j*i*r+e*f*o*r-b*j*o*r-d*f*n*r+b*h*n*r+e*g*i*m-c*j*i*m-e*f*l*m+b*j*l*m+c*f*n*m-b*g*n*m-d*g*i*a+c*h*i*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
+a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],l=a[6],m=a[10],n=a[14],p=a[3],r=a[7],o=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*m*p+c*i*m*p+d*g*n*p-c*h*n*p-e*h*j*r+d*i*j*r+e*f*m*r-b*i*m*r-d*f*n*r+b*h*n*r+e*g*j*o-c*i*j*o-e*f*l*o+b*i*l*o+c*f*n*o-b*g*n*o-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*m*a+b*g*m*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
 b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
 b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
 c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
 c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
-a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],j=c[5],i=c[9],l=c[13],o=c[2],n=c[6],p=c[10],r=c[14],m=c[3],q=c[7],s=c[11],c=c[15];b[0]=i*r*q-l*p*q+l*n*s-j*r*s-i*n*c+j*p*c;b[4]=g*p*q-f*r*q-g*n*s+e*r*s+f*n*c-e*p*c;b[8]=f*l*q-g*i*q+g*j*s-e*l*s-f*j*c+e*i*c;b[12]=g*i*n-f*l*n-g*j*p+e*l*p+f*j*r-e*i*r;b[1]=l*p*m-i*r*m-l*o*s+h*r*s+i*o*c-h*p*c;b[5]=f*r*m-g*p*m+g*o*s-d*r*s-f*o*c+d*p*c;b[9]=g*i*m-f*l*m-g*h*s+d*l*s+f*h*c-d*i*c;b[13]=f*l*o-g*i*o+g*h*p-d*
-l*p-f*h*r+d*i*r;b[2]=j*r*m-l*n*m+l*o*q-h*r*q-j*o*c+h*n*c;b[6]=g*n*m-e*r*m-g*o*q+d*r*q+e*o*c-d*n*c;b[10]=e*l*m-g*j*m+g*h*q-d*l*q-e*h*c+d*j*c;b[14]=g*j*o-e*l*o-g*h*n+d*l*n+e*h*r-d*j*r;b[3]=i*n*m-j*p*m-i*o*q+h*p*q+j*o*s-h*n*s;b[7]=e*p*m-f*n*m+f*o*q-d*p*q-e*o*s+d*n*s;b[11]=f*j*m-e*i*m-f*h*q+d*i*q+e*h*s-d*j*s;b[15]=e*i*o-f*j*o+f*h*n-d*i*n-e*h*p+d*j*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),
-h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var i=g*j,l=g*f,o=d*j,n=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=i-n*e;c[9]=-d*h;c[2]=n-i*e;c[6]=o+l*e;c[10]=g*h}else if(b==="YXZ"){i=h*j;l=h*f;o=e*j;n=e*f;c[0]=i+n*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*j;c[9]=-d;c[2]=l*d-o;c[6]=n+i*d;c[10]=g*h}else if(b==="ZXY"){i=h*j;l=h*f;o=e*j;n=e*f;c[0]=i-n*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*j;c[9]=n-i*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){i=g*j;l=g*f;o=d*j;
-n=d*f;c[0]=h*j;c[4]=o*e-l;c[8]=i*e+n;c[1]=h*f;c[5]=n*e+i;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){i=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*j;c[4]=n-i*f;c[8]=o*f+l;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=l*f+o;c[10]=i-n*f}else if(b==="XZY"){i=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;c[1]=i*f+n;c[5]=g*j;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*j;c[10]=n*f+i}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,j=e+e,a=c*g,i=c*h,c=c*j,l=d*h,d=d*
-j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(l+e);b[4]=i-f;b[8]=c+h;b[1]=i+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],j=c[9],l=c[13],m=c[2],n=c[6],p=c[10],r=c[14],o=c[3],q=c[7],s=c[11],c=c[15];b[0]=j*r*q-l*p*q+l*n*s-i*r*s-j*n*c+i*p*c;b[4]=g*p*q-f*r*q-g*n*s+e*r*s+f*n*c-e*p*c;b[8]=f*l*q-g*j*q+g*i*s-e*l*s-f*i*c+e*j*c;b[12]=g*j*n-f*l*n-g*i*p+e*l*p+f*i*r-e*j*r;b[1]=l*p*o-j*r*o-l*m*s+h*r*s+j*m*c-h*p*c;b[5]=f*r*o-g*p*o+g*m*s-d*r*s-f*m*c+d*p*c;b[9]=g*j*o-f*l*o-g*h*s+d*l*s+f*h*c-d*j*c;b[13]=f*l*m-g*j*m+g*h*p-d*
+l*p-f*h*r+d*j*r;b[2]=i*r*o-l*n*o+l*m*q-h*r*q-i*m*c+h*n*c;b[6]=g*n*o-e*r*o-g*m*q+d*r*q+e*m*c-d*n*c;b[10]=e*l*o-g*i*o+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*m-e*l*m-g*h*n+d*l*n+e*h*r-d*i*r;b[3]=j*n*o-i*p*o-j*m*q+h*p*q+i*m*s-h*n*s;b[7]=e*p*o-f*n*o+f*m*q-d*p*q-e*m*s+d*n*s;b[11]=f*i*o-e*j*o-f*h*q+d*j*q+e*h*s-d*i*s;b[15]=e*j*m-f*i*m+f*h*n-d*j*n-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),
+h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var j=g*i,l=g*f,m=d*i,n=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+m*e;c[5]=j-n*e;c[9]=-d*h;c[2]=n-j*e;c[6]=m+l*e;c[10]=g*h}else if(b==="YXZ"){j=h*i;l=h*f;m=e*i;n=e*f;c[0]=j+n*d;c[4]=m*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=l*d-m;c[6]=n+j*d;c[10]=g*h}else if(b==="ZXY"){j=h*i;l=h*f;m=e*i;n=e*f;c[0]=j-n*d;c[4]=-g*f;c[8]=m+l*d;c[1]=l+m*d;c[5]=g*i;c[9]=n-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){j=g*i;l=g*f;m=d*i;
+n=d*f;c[0]=h*i;c[4]=m*e-l;c[8]=j*e+n;c[1]=h*f;c[5]=n*e+j;c[9]=l*e-m;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){j=g*h;l=g*e;m=d*h;n=d*e;c[0]=h*i;c[4]=n-j*f;c[8]=m*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+m;c[10]=j-n*f}else if(b==="XZY"){j=g*h;l=g*e;m=d*h;n=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;c[1]=j*f+n;c[5]=g*i;c[9]=l*f-m;c[2]=m*f-l;c[6]=d*i;c[10]=n*f+j}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,l=d*h,d=d*
+i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
 g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
 g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
 c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*
 c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*
-c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],j=b[10],i=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*j;b[7]=l*f+a*i;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*j-a*e;b[11]=l*i-a*f;return this},rotateY:function(a){var b=
-this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],j=b[10],i=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*j;b[3]=l*f-a*i;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*j+a*e;b[11]=l*i+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],j=b[6],i=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*j;b[3]=l*f+a*i;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*j-a*e;b[7]=l*i-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
-if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,j=f*f,i=Math.cos(b),l=Math.sin(b),o=1-i,n=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*i,g=n+l,e=p-r,n=n-l,h=h+(1-h)*i,l=o+d,p=p+r,o=o-d,j=j+(1-j)*i,i=c[0],d=c[1],r=c[2],m=c[3],q=c[4],s=c[5],u=c[6],t=c[7],v=c[8],x=c[9],F=c[10],C=c[11];c[0]=f*i+g*q+e*v;c[1]=f*d+g*
-s+e*x;c[2]=f*r+g*u+e*F;c[3]=f*m+g*t+e*C;c[4]=n*i+h*q+l*v;c[5]=n*d+h*s+l*x;c[6]=n*r+h*u+l*F;c[7]=n*m+h*t+l*C;c[8]=p*i+o*q+j*v;c[9]=p*d+o*s+j*x;c[10]=p*r+o*u+j*F;c[11]=p*m+o*t+j*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
+c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=
+this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
+if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*e*m,p=d*f*m,m=e*f*m,d=d*l,r=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=p-r,n=n-l,h=h+(1-h)*j,l=m+d,p=p+r,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],o=c[3],q=c[4],s=c[5],w=c[6],t=c[7],v=c[8],x=c[9],C=c[10],D=c[11];c[0]=f*j+g*q+e*v;c[1]=f*d+g*
+s+e*x;c[2]=f*r+g*w+e*C;c[3]=f*o+g*t+e*D;c[4]=n*j+h*q+l*v;c[5]=n*d+h*s+l*x;c[6]=n*r+h*w+l*C;c[7]=n*o+h*t+l*D;c[8]=p*j+m*q+i*v;c[9]=p*d+m*s+i*x;c[10]=p*r+m*w+i*C;c[11]=p*o+m*t+i*D;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);
 a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);
-return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,i=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,i*g+c,i*h-d*f,0,j*h-d*g,i*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=
-0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,j=c-d,i=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/i;g[14]=-((f+e)/i);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
+return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=
+0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
@@ -74,26 +74,26 @@ this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.s
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(j===i.length){a=new THREE.RenderableVertex;i.push(a)}else a=i[j];j++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,
-g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,j,i=[],l,o,n=[],p,r=[],m,q,s=[],u,t,v=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,w=new THREE.Matrix4,H=new THREE.Frustum,E=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
-function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
-THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
-f,e){var g=f.near,F=f.far,D=false,W,R,N,ba,U,I,ca,ha,L,X,S,T,ia,ma,za;t=q=p=o=0;x.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);z.multiply(f.projectionMatrix,f.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(W=x.objects.length;a<W;a++){L=x.objects[a].object;X=L.matrixWorld;j=0;if(L instanceof THREE.Mesh){S=L.geometry;T=L.geometry.materials;
-ba=S.vertices;ia=S.faces;ma=S.faceVertexUvs;S=L.matrixRotationWorld.extractRotation(X);R=0;for(N=ba.length;R<N;R++){h=b();h.positionWorld.copy(ba[R]);X.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}ba=0;for(R=ia.length;ba<R;ba++){N=ia[ba];if(N instanceof THREE.Face3){U=i[N.a];
-I=i[N.b];ca=i[N.c];if(U.visible===true&&I.visible===true&&ca.visible===true){D=(ca.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){ha=void 0;if(o===n.length){ha=new THREE.RenderableFace3;n.push(ha)}else ha=n[o];o++;l=ha;l.v1.copy(U);l.v2.copy(I);l.v3.copy(ca)}else continue}else continue}else if(N instanceof THREE.Face4){U=i[N.a];I=i[N.b];ca=i[N.c];
-ha=i[N.d];if(U.visible===true&&I.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-U.positionScreen.x)*(I.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(I.positionScreen.x-U.positionScreen.x)<0||(I.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(I.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(L.doubleSided===true||D!==L.flipSided){za=void 0;if(p===r.length){za=new THREE.RenderableFace4;
-r.push(za)}else za=r[p];p++;l=za;l.v1.copy(U);l.v2.copy(I);l.v3.copy(ca);l.v4.copy(ha)}else continue}else continue}l.normalWorld.copy(N.normal);D===false&&(L.flipSided===true||L.doubleSided===true)&&l.normalWorld.negate();S.multiplyVector3(l.normalWorld);l.centroidWorld.copy(N.centroid);X.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);z.multiplyVector3(l.centroidScreen);ca=N.vertexNormals;U=0;for(I=ca.length;U<I;U++){ha=l.vertexNormalsWorld[U];ha.copy(ca[U]);D===false&&(L.flipSided===
-true||L.doubleSided===true)&&ha.negate();S.multiplyVector3(ha)}U=0;for(I=ma.length;U<I;U++){za=ma[U][ba];if(za!==void 0){ca=0;for(ha=za.length;ca<ha;ca++)l.uvs[U][ca]=za[ca]}}l.material=L.material;l.faceMaterial=N.materialIndex!==null?T[N.materialIndex]:null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(L instanceof THREE.Line){w.multiply(z,X);ba=L.geometry.vertices;U=b();U.positionScreen.copy(ba[0]);w.multiplyVector4(U.positionScreen);X=L.type===THREE.LinePieces?2:1;R=1;for(N=ba.length;R<N;R++){U=
-b();U.positionScreen.copy(ba[R]);w.multiplyVector4(U.positionScreen);if(!((R+1)%X>0)){I=i[j-2];E.copy(U.positionScreen);O.copy(I.positionScreen);if(d(E,O)===true){E.multiplyScalar(1/E.w);O.multiplyScalar(1/O.w);T=void 0;if(q===s.length){T=new THREE.RenderableLine;s.push(T)}else T=s[q];q++;m=T;m.v1.positionScreen.copy(E);m.v2.positionScreen.copy(O);m.z=Math.max(E.z,O.z);m.material=L.material;x.elements.push(m)}}}}}a=0;for(W=x.sprites.length;a<W;a++){L=x.sprites[a].object;X=L.matrixWorld;if(L instanceof
-THREE.Particle){C.set(X.elements[12],X.elements[13],X.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(t===v.length){g=new THREE.RenderableParticle;v.push(g)}else g=v[t];t++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=L.rotation.z;u.scale.x=L.scale.x*Math.abs(u.x-(C.x+f.projectionMatrix.elements[0])/(C.w+f.projectionMatrix.elements[12]));u.scale.y=L.scale.y*Math.abs(u.y-(C.y+f.projectionMatrix.elements[5])/(C.w+f.projectionMatrix.elements[13]));u.material=L.material;
-x.elements.push(u)}}}e&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.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)){D.copy(a.matrixWorld.getPosition());u.multiplyVector3(D);f=b();f.object=a;f.z=D.z;C.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){D.copy(a.matrixWorld.getPosition());u.multiplyVector3(D);f=b();f.object=a;f.z=D.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,w=[],t,v,x=[],C={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,z=new THREE.Vector4,u=new THREE.Matrix4,G=new THREE.Matrix4,J=new THREE.Frustum,M=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);u.multiply(b.projectionMatrix,
+b.matrixWorldInverse);u.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);u.multiply(b.matrixWorld,b.projectionMatrixInverse);u.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,f,g){var h=f.near,E=f.far,D=false,T,N,W,ba,H,ca,ia,S,R,P,U,fa,ma,Ga,
+na;v=s=r=n=0;C.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");b.add(f)}b.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);u.multiply(f.projectionMatrix,f.matrixWorldInverse);J.setFromMatrix(u);C=a(b,false);b=0;for(T=C.objects.length;b<T;b++){R=C.objects[b].object;P=R.matrixWorld;j=0;if(R instanceof THREE.Mesh){U=R.geometry;fa=R.geometry.materials;ba=U.vertices;ma=U.faces;Ga=U.faceVertexUvs;U=R.matrixRotationWorld.extractRotation(P);
+N=0;for(W=ba.length;N<W;N++){i=c();i.positionWorld.copy(ba[N]);P.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);u.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<E}ba=0;for(N=ma.length;ba<N;ba++){W=ma[ba];if(W instanceof THREE.Face3){H=l[W.a];ca=l[W.b];ia=l[W.c];if(H.visible===true&&ca.visible===true&&ia.visible===true){D=(ia.positionScreen.x-
+H.positionScreen.x)*(ca.positionScreen.y-H.positionScreen.y)-(ia.positionScreen.y-H.positionScreen.y)*(ca.positionScreen.x-H.positionScreen.x)<0;if(R.doubleSided===true||D!==R.flipSided){S=void 0;if(n===p.length){S=new THREE.RenderableFace3;p.push(S)}else S=p[n];n++;m=S;m.v1.copy(H);m.v2.copy(ca);m.v3.copy(ia)}else continue}else continue}else if(W instanceof THREE.Face4){H=l[W.a];ca=l[W.b];ia=l[W.c];S=l[W.d];if(H.visible===true&&ca.visible===true&&ia.visible===true&&S.visible===true){D=(S.positionScreen.x-
+H.positionScreen.x)*(ca.positionScreen.y-H.positionScreen.y)-(S.positionScreen.y-H.positionScreen.y)*(ca.positionScreen.x-H.positionScreen.x)<0||(ca.positionScreen.x-ia.positionScreen.x)*(S.positionScreen.y-ia.positionScreen.y)-(ca.positionScreen.y-ia.positionScreen.y)*(S.positionScreen.x-ia.positionScreen.x)<0;if(R.doubleSided===true||D!==R.flipSided){na=void 0;if(r===o.length){na=new THREE.RenderableFace4;o.push(na)}else na=o[r];r++;m=na;m.v1.copy(H);m.v2.copy(ca);m.v3.copy(ia);m.v4.copy(S)}else continue}else continue}m.normalWorld.copy(W.normal);
+D===false&&(R.flipSided===true||R.doubleSided===true)&&m.normalWorld.negate();U.multiplyVector3(m.normalWorld);m.centroidWorld.copy(W.centroid);P.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);ia=W.vertexNormals;H=0;for(ca=ia.length;H<ca;H++){S=m.vertexNormalsWorld[H];S.copy(ia[H]);D===false&&(R.flipSided===true||R.doubleSided===true)&&S.negate();U.multiplyVector3(S)}H=0;for(ca=Ga.length;H<ca;H++){na=Ga[H][ba];if(na!==void 0){ia=0;for(S=
+na.length;ia<S;ia++)m.uvs[H][ia]=na[ia]}}m.material=R.material;m.faceMaterial=W.materialIndex!==null?fa[W.materialIndex]:null;m.z=m.centroidScreen.z;C.elements.push(m)}}else if(R instanceof THREE.Line){G.multiply(u,P);ba=R.geometry.vertices;H=c();H.positionScreen.copy(ba[0]);G.multiplyVector4(H.positionScreen);P=R.type===THREE.LinePieces?2:1;N=1;for(W=ba.length;N<W;N++){H=c();H.positionScreen.copy(ba[N]);G.multiplyVector4(H.positionScreen);if(!((N+1)%P>0)){ca=l[j-2];M.copy(H.positionScreen);O.copy(ca.positionScreen);
+if(e(M,O)===true){M.multiplyScalar(1/M.w);O.multiplyScalar(1/O.w);fa=void 0;if(s===w.length){fa=new THREE.RenderableLine;w.push(fa)}else fa=w[s];s++;q=fa;q.v1.positionScreen.copy(M);q.v2.positionScreen.copy(O);q.z=Math.max(M.z,O.z);q.material=R.material;C.elements.push(q)}}}}}b=0;for(T=C.sprites.length;b<T;b++){R=C.sprites[b].object;P=R.matrixWorld;if(R instanceof THREE.Particle){z.set(P.elements[12],P.elements[13],P.elements[14],1);u.multiplyVector4(z);z.z=z.z/z.w;if(z.z>0&&z.z<1){h=void 0;if(v===
+x.length){h=new THREE.RenderableParticle;x.push(h)}else h=x[v];v++;t=h;t.x=z.x/z.w;t.y=z.y/z.w;t.z=z.z;t.rotation=R.rotation.z;t.scale.x=R.scale.x*Math.abs(t.x-(z.x+f.projectionMatrix.elements[0])/(z.w+f.projectionMatrix.elements[12]));t.scale.y=R.scale.y*Math.abs(t.y-(z.y+f.projectionMatrix.elements[5])/(z.w+f.projectionMatrix.elements[13]));t.material=R.material;C.elements.push(t)}}}g&&C.elements.sort(d);return C}};
+THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
 c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
 c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
-d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],j=b[6],b=b[10],i=c+f+b;if(i>0){c=0.5/Math.sqrt(i+1);this.w=0.25/c;this.x=(j-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=(j-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+j)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
-(d+h)/c;this.y=(g+j)/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=
+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,
 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,j=this.w,i=j*c+g*e-h*d,l=j*d+h*c-f*e,o=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*j+c*-f+l*-h-o*-g;b.y=l*j+c*-g+o*-f-i*-h;b.z=o*j+c*-h+i*-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),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
-this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/j;h=Math.sin(b*h)/j;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)}};
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,m=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-m*-g;b.y=l*i+c*-g+m*-f-j*-h;b.z=m*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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=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();
 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();
@@ -107,18 +107,18 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,i;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(i)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-j=g.faceNormals[c];i=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2])}else{i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2]);i.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,z){h=a.vertices[b];j=a.vertices[c];
-i=a.vertices[d];l=g[f];o=g[e];n=g[z];p=j.x-h.x;r=i.x-h.x;m=j.y-h.y;q=i.y-h.y;s=j.z-h.z;u=i.z-h.z;t=o.u-l.u;v=n.u-l.u;x=o.v-l.v;F=n.v-l.v;C=1/(t*F-v*x);E.set((F*p-x*r)*C,(F*m-x*q)*C,(F*s-x*u)*C);O.set((t*r-v*p)*C,(t*q-v*m)*C,(t*u-v*s)*C);w[b].addSelf(E);w[c].addSelf(E);w[d].addSelf(E);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,j,i,l,o,n,p,r,m,q,s,u,t,v,x,F,C,z,w=[],H=[],E=new THREE.Vector3,O=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){w[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var J=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[J[d]];z=w[e];Q.copy(z);Q.subSelf(B.multiplyScalar(B.dot(z))).normalize();
-Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
-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,j;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+i=g.faceNormals[c];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,z){h=a.vertices[b];i=a.vertices[c];
+j=a.vertices[d];l=g[f];m=g[e];n=g[z];p=i.x-h.x;r=j.x-h.x;o=i.y-h.y;q=j.y-h.y;s=i.z-h.z;w=j.z-h.z;t=m.u-l.u;v=n.u-l.u;x=m.v-l.v;C=n.v-l.v;D=1/(t*C-v*x);J.set((C*p-x*r)*D,(C*o-x*q)*D,(C*s-x*w)*D);M.set((t*r-v*p)*D,(t*q-v*o)*D,(t*w-v*s)*D);u[b].addSelf(J);u[c].addSelf(J);u[d].addSelf(J);G[b].addSelf(M);G[c].addSelf(M);G[d].addSelf(M)}var b,c,d,e,f,g,h,i,j,l,m,n,p,r,o,q,s,w,t,v,x,C,D,z,u=[],G=[],J=new THREE.Vector3,M=new THREE.Vector3,O=new THREE.Vector3,X=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){u[b]=new THREE.Vector3;G[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var F=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[F[d]];z=u[e];O.copy(z);O.subSelf(B.multiplyScalar(B.dot(z))).normalize();
+X.cross(f.vertexNormals[d],z);e=X.dot(G[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);
 [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++)(j=this.faceVertexUvs[d][f])&&j.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,j,i,l,o,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;i=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];n=this.points[c[3]];h=g*g;j=g*h;d.x=b(i.x,l.x,o.x,n.x,g,h,j);d.y=b(i.y,l.y,o.y,n.y,g,h,j);d.z=b(i.z,l.z,o.z,n.z,g,h,j);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=[],j=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);j=j+g.distanceTo(e);e.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){h[b]=j;f=b}}h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,e,g,h=[],j=new THREE.Vector3,i=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=i.chunks[b]-i.chunks[b-1];g=Math.ceil(a*c/i.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++){d=f+c*(1/g)*(e-f);d=this.getPoint(d);
-h.push(j.copy(d).clone())}h.push(j.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
+d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,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);
+h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
@@ -131,63 +131,63 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,j="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?j="MeshPhongMaterial":l==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=i.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(i.map){l.tDiffuse.texture=i.map;l.enableDiffuse.value=true}if(i.specularMap){l.tSpecular.texture=i.specularMap;l.enableSpecular.value=true}if(i.lightMap){l.tAO.texture=i.lightMap;
-l.enableAO.value=true}l.uDiffuseColor.value.setHex(i.color);l.uSpecularColor.value.setHex(i.specular);l.uAmbientColor.value.setHex(i.ambient);l.uShininess.value=i.shininess;if(i.opacity!==void 0)l.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else i=new THREE[j](i);if(a.DbgName!==void 0)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=h.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,i,l,o,n,p,r,m,q,s,u,t,v;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,j,i,l,o=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=o[d*3];e=o[d*3+1];g=o[d*3+2];h=P[f*2];f=P[f*2+1];j=P[e*2];i=P[e*2+1];e=P[g*2];l=P[g*2+1];g=Y.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(j,i));m.push(new THREE.UV(e,
-l));g.push(m)}}function w(b,c){var d,f,e,g,h,j,i,l,m,o,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=P[f*2];f=P[f*2+1];i=P[e*2];m=P[e*2+1];l=P[g*2];o=P[g*2+1];g=P[h*2];e=P[h*2+1];h=Y.faceVertexUvs[0];var p=[];p.push(new THREE.UV(j,f));p.push(new THREE.UV(i,m));p.push(new THREE.UV(l,o));p.push(new THREE.UV(g,e));h.push(p)}}function H(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=j[d];
-Y.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function E(b,c,d){for(var f,e,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];Y.faces.push(new THREE.Face4(f,e,g,h,null,null,j))}}function O(b,c,d,f){for(var e,g,h,j,i,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];i=d[f*3];l=d[f*3+1];m=d[f*3+2];j=o[f];var n=J[l*3],p=J[l*3+1];l=J[l*3+2];var r=J[m*3],
-q=J[m*3+1];m=J[m*3+2];Y.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(J[i*3],J[i*3+1],J[i*3+2]),new THREE.Vector3(n,p,l),new THREE.Vector3(r,q,m)],null,j))}}function Q(b,c,d,f){for(var e,g,h,j,i,l,m,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];j=c[f*4+3];l=d[f*4];m=d[f*4+1];o=d[f*4+2];n=d[f*4+3];i=p[f];var r=J[m*3],q=J[m*3+1];m=J[m*3+2];var s=J[o*3],v=J[o*3+1];o=J[o*3+2];var w=J[n*3],t=J[n*3+1];n=J[n*3+2];Y.faces.push(new THREE.Face4(e,
-g,h,j,[new THREE.Vector3(J[l*3],J[l*3+1],J[l*3+2]),new THREE.Vector3(r,q,m),new THREE.Vector3(s,v,o),new THREE.Vector3(w,t,n)],null,i))}}var Y=this,B=0,J=[],P=[],D,W,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);j=F(a,B+17);i=F(a,B+18);l=F(a,B+19);o=C(a,B+20);n=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
-C(a,B+20+16);m=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);t=C(a,B+20+36);v=C(a,B+20+40);B=B+c;c=e*3+l;R=e*4+l;D=b*c;W=r*(c+j*3);e=m*(c+i*3);l=q*(c+j*3+i*3);c=s*R;j=u*(R+j*4);i=t*(R+i*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];Y.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];J.push(d/
-127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(n*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];P.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);W=D+W+x(r*2);e=W+e+x(m*2);l=e+l+x(q*2);c=l+c+x(s*2);j=c+j+x(u*2);i=j+i+x(t*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;H(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);z(m,b)}})(W);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-q*Uint32Array.BYTES_PER_ELEMENT*3;O(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);w(t,b)}})(j);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4,c=b+v*Uint32Array.BYTES_PER_ELEMENT*4;Q(v,a,b,c+v*Uint32Array.BYTES_PER_ELEMENT*4);w(v,c)}})(i);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;O(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(D);s&&E(s,l,l+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;Q(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,m,n,p,r,o,q,s,w,t,v;function x(a){return a%4?4-a%4:0}function C(a,b){return(new Uint8Array(a,b,1))[0]}function D(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,i,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=m[d*3];e=m[d*3+1];g=m[d*3+2];h=Q[f*2];f=Q[f*2+1];i=Q[e*2];j=Q[e*2+1];e=Q[g*2];l=Q[g*2+1];g=X.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(i,j));n.push(new THREE.UV(e,
+l));g.push(n)}}function u(b,c){var d,f,e,g,h,i,j,l,m,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=Q[f*2];f=Q[f*2+1];j=Q[e*2];m=Q[e*2+1];l=Q[g*2];n=Q[g*2+1];g=Q[h*2];e=Q[h*2+1];h=X.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,m));p.push(new THREE.UV(l,n));p.push(new THREE.UV(g,e));h.push(p)}}function G(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
+X.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function J(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];X.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function M(b,c,d,f){for(var e,g,h,i,j,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];l=d[f*3+1];m=d[f*3+2];i=n[f];var o=F[l*3],p=F[l*3+1];l=F[l*3+2];var r=F[m*3],
+q=F[m*3+1];m=F[m*3+2];X.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(F[j*3],F[j*3+1],F[j*3+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(r,q,m)],null,i))}}function O(b,c,d,f){for(var e,g,h,i,j,l,m,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];m=d[f*4+1];n=d[f*4+2];o=d[f*4+3];j=p[f];var r=F[m*3],q=F[m*3+1];m=F[m*3+2];var s=F[n*3],u=F[n*3+1];n=F[n*3+2];var t=F[o*3],v=F[o*3+1];o=F[o*3+2];X.faces.push(new THREE.Face4(e,
+g,h,i,[new THREE.Vector3(F[l*3],F[l*3+1],F[l*3+2]),new THREE.Vector3(r,q,m),new THREE.Vector3(s,u,n),new THREE.Vector3(t,v,o)],null,j))}}var X=this,B=0,F=[],Q=[],E,aa,T;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(X,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,B,12);c=C(a,B+12);C(a,B+13);C(a,B+14);C(a,B+15);e=C(a,B+16);i=C(a,B+17);j=C(a,B+18);l=C(a,B+19);m=D(a,B+20);n=D(a,B+20+4);p=D(a,B+20+8);b=D(a,B+20+12);
+r=D(a,B+20+16);o=D(a,B+20+20);q=D(a,B+20+24);s=D(a,B+20+28);w=D(a,B+20+32);t=D(a,B+20+36);v=D(a,B+20+40);B=B+c;c=e*3+l;T=e*4+l;E=b*c;aa=r*(c+i*3);e=o*(c+j*3);l=q*(c+i*3+j*3);c=s*T;i=w*(T+i*4);j=t*(T+j*4);B=B+function(b){var b=new Float32Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];X.vertices.push(new THREE.Vector3(d,f,e))}return m*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];
+F.push(d/127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(n*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];Q.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);E=B+E+x(b*2);aa=E+aa+x(r*2);e=aa+e+x(o*2);l=e+l+x(q*2);c=l+c+x(s*2);i=c+i+x(w*2);j=i+j+x(t*2);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;G(o,a,b+o*Uint32Array.BYTES_PER_ELEMENT*3);z(o,b)}})(aa);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
+3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;M(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;J(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);u(t,b)}})(i);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4,c=b+v*Uint32Array.BYTES_PER_ELEMENT*4;O(v,a,b,c+v*Uint32Array.BYTES_PER_ELEMENT*4);u(v,c)}})(j);b&&G(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;M(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(E);s&&J(s,l,l+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;O(w,a,b,b+w*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,i,l,o,n,p,r,m,q,s,u,t,v=a.faces;o=a.vertices;var x=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}i=0;for(l=o.length;i<l;){n=new THREE.Vector3;n.x=o[i++]*b;n.y=o[i++]*b;n.z=o[i++]*b;d.vertices.push(n)}i=0;for(l=v.length;i<l;){b=v[i++];o=b&1;j=b&2;c=b&
-4;e=b&8;p=b&16;n=b&32;m=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=v[i++];q.b=v[i++];q.c=v[i++];q.d=v[i++];o=4}else{q=new THREE.Face3;q.a=v[i++];q.b=v[i++];q.c=v[i++];o=3}if(j){j=v[i++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<C;c++){s=a.uvs[c];r=v[i++];t=s[r*2];r=s[r*2+1];d.faceUvs[c][j]=new THREE.UV(t,r)}if(e)for(c=0;c<C;c++){s=a.uvs[c];u=[];for(e=0;e<o;e++){r=v[i++];t=s[r*2];r=s[r*2+1];u[e]=new THREE.UV(t,r)}d.faceVertexUvs[c][j]=u}if(p){p=v[i++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
-e.z=x[p];q.normal=e}if(n)for(c=0;c<o;c++){p=v[i++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(m){n=v[i++];n=new THREE.Color(F[n]);q.color=n}if(b)for(c=0;c<o;c++){n=v[i++];n=new THREE.Color(F[n]);q.vertexColors.push(n)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,i,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;j=0;for(i=o.length;j<i;j=j+3){var n=new THREE.Vector3;n.x=o[j]*b;n.y=o[j+1]*b;n.z=o[j+2]*b;l.push(n)}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);i.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,l,m,n,p,r,o,q,s,w,t,v=a.faces;m=a.vertices;var x=a.normals,C=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(l=m.length;j<l;){n=new THREE.Vector3;n.x=m[j++]*b;n.y=m[j++]*b;n.z=m[j++]*b;d.vertices.push(n)}j=0;for(l=v.length;j<l;){b=v[j++];m=b&1;i=b&2;c=b&
+4;e=b&8;p=b&16;n=b&32;o=b&64;b=b&128;if(m){q=new THREE.Face4;q.a=v[j++];q.b=v[j++];q.c=v[j++];q.d=v[j++];m=4}else{q=new THREE.Face3;q.a=v[j++];q.b=v[j++];q.c=v[j++];m=3}if(i){i=v[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<D;c++){s=a.uvs[c];r=v[j++];t=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(t,r)}if(e)for(c=0;c<D;c++){s=a.uvs[c];w=[];for(e=0;e<m;e++){r=v[j++];t=s[r*2];r=s[r*2+1];w[e]=new THREE.UV(t,r)}d.faceVertexUvs[c][i]=w}if(p){p=v[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
+e.z=x[p];q.normal=e}if(n)for(c=0;c<m;c++){p=v[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(o){n=v[j++];n=new THREE.Color(C[n]);q.color=n}if(b)for(c=0;c<m;c++){n=v[j++];n=new THREE.Color(C[n]);q.vertexColors.push(n)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,l,m;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;m=a.morphTargets[c].vertices;i=0;for(j=m.length;i<j;i=i+3){var n=new THREE.Vector3;n.x=m[i]*b;n.y=m[i+1]*b;n.z=m[i+2]*b;l.push(n)}}}if(a.morphColors!==
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){m=new THREE.Color(16755200);m.setRGB(l[b],l[b+1],l[b+2]);j.push(m)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},j=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},i=function(a,d,e,f,g,i){a[d]=new THREE.Texture;a[d].sourceFile=
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(i){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[i[0]]!==void 0)a[d].wrapS=f[i[0]];if(f[i[1]]!==void 0)a[d].wrapT=f[i[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=j(a.width),c=j(a.height);l.image=document.createElement("canvas");l.image.width=
-b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},l=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)n.blending=
+a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},j=function(a,d,e,f,g,j){a[d]=new THREE.Texture;a[d].sourceFile=
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[d].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[d].wrapT=f[j[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=i(a.height);l.image=document.createElement("canvas");l.image.width=
+b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},l=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},m="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?m="MeshPhongMaterial":p==="basic"&&(m="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)n.blending=
 THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)n.transparent=g.transparent;if(g.depthTest!==void 0)n.depthTest=g.depthTest;if(g.depthWrite!==void 0)n.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")n.vertexColors=THREE.FaceColors;else if(g.vertexColors)n.vertexColors=THREE.VertexColors;if(g.colorDiffuse)n.color=l(g.colorDiffuse);else if(g.DbgColor)n.color=g.DbgColor;if(g.colorSpecular)n.specular=l(g.colorSpecular);if(g.colorAmbient)n.ambient=l(g.colorAmbient);
 THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)n.transparent=g.transparent;if(g.depthTest!==void 0)n.depthTest=g.depthTest;if(g.depthWrite!==void 0)n.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")n.vertexColors=THREE.FaceColors;else if(g.vertexColors)n.vertexColors=THREE.VertexColors;if(g.colorDiffuse)n.color=l(g.colorDiffuse);else if(g.DbgColor)n.color=g.DbgColor;if(g.colorSpecular)n.specular=l(g.colorSpecular);if(g.colorAmbient)n.ambient=l(g.colorAmbient);
-if(g.transparency)n.opacity=g.transparency;if(g.specularCoef)n.shininess=g.specularCoef;g.mapDiffuse&&i(n,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&i(n,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&i(n,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&i(n,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){i=THREE.ShaderUtils.lib.normal;
-l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=n.normalMap;if(g.mapNormalFactor)l.uNormalScale.value=g.mapNormalFactor;if(n.map){l.tDiffuse.texture=n.map;l.enableDiffuse.value=true}if(n.specularMap){l.tSpecular.texture=n.specularMap;l.enableSpecular.value=true}if(n.lightMap){l.tAO.texture=n.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(n.color);l.uSpecularColor.value.setHex(n.specular);l.uAmbientColor.value.setHex(n.ambient);l.uShininess.value=n.shininess;if(n.opacity!==void 0)l.uOpacity.value=
-n.opacity;n=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else n=new THREE[o](n);if(g.DbgName!==void 0)n.name=g.DbgName;d.materials[f]=n}}var g=a.faces,r=a.vertices,n=a.normals,i=a.colors,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=r.length;o<p;){var m=new THREE.Vector3;m.x=r[o++]*e;m.y=r[o++]*e;m.z=r[o++]*e;d.vertices.push(m)}o=0;for(p=g.length;o<
-p;){var q=g[o++],s=q&2,f=q&4,u=q&8,t=q&16,r=q&32,v=q&64,m=q&128;if(q&1){q=new THREE.Face4;q.a=g[o++];q.b=g[o++];q.c=g[o++];q.d=g[o++];var x=4}else{q=new THREE.Face3;q.a=g[o++];q.b=g[o++];q.c=g[o++];x=3}if(s){s=g[o++];q.materialIndex=s}var F=d.faces.length;if(f)for(f=0;f<l;f++){var C=a.uvs[f],s=g[o++],z=C[s*2],s=C[s*2+1];d.faceUvs[f][F]=new THREE.UV(z,s)}if(u)for(f=0;f<l;f++){for(var C=a.uvs[f],u=[],w=0;w<x;w++){s=g[o++];z=C[s*2];s=C[s*2+1];u[w]=new THREE.UV(z,s)}d.faceVertexUvs[f][F]=u}if(t){t=g[o++]*
-3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.normal=s}if(r)for(f=0;f<x;f++){t=g[o++]*3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.vertexNormals.push(s)}if(v){r=g[o++];q.color=new THREE.Color(i[r])}if(m)for(f=0;f<x;f++){r=g[o++];q.vertexColors.push(new THREE.Color(i[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+
-2){n=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],n,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];n=d.morphTargets[f].vertices;i=a.morphTargets[f].vertices;s=0;for(l=i.length;s<l;s=s+3){m=new THREE.Vector3;m.x=i[s]*e;m.y=i[s+1]*e;m.z=i[s+2]*e;n.push(m)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]=
-{};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;i=a.morphColors[f].colors;n=0;for(l=i.length;n<l;n=n+3){o=new THREE.Color(16755200);o.setRGB(i[n],i[n+1],i[n+2]);e.push(o)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+if(g.transparency)n.opacity=g.transparency;if(g.specularCoef)n.shininess=g.specularCoef;g.mapDiffuse&&j(n,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(n,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&j(n,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(n,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){j=THREE.ShaderUtils.lib.normal;
+l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=n.normalMap;if(g.mapNormalFactor)l.uNormalScale.value=g.mapNormalFactor;if(n.map){l.tDiffuse.texture=n.map;l.enableDiffuse.value=true}if(n.specularMap){l.tSpecular.texture=n.specularMap;l.enableSpecular.value=true}if(n.lightMap){l.tAO.texture=n.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(n.color);l.uSpecularColor.value.setHex(n.specular);l.uAmbientColor.value.setHex(n.ambient);l.uShininess.value=n.shininess;if(n.opacity!==void 0)l.uOpacity.value=
+n.opacity;n=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else n=new THREE[m](n);if(g.DbgName!==void 0)n.name=g.DbgName;d.materials[f]=n}}var g=a.faces,r=a.vertices,n=a.normals,j=a.colors,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}m=0;for(p=r.length;m<p;){var o=new THREE.Vector3;o.x=r[m++]*e;o.y=r[m++]*e;o.z=r[m++]*e;d.vertices.push(o)}m=0;for(p=g.length;m<
+p;){var q=g[m++],s=q&2,f=q&4,w=q&8,t=q&16,r=q&32,v=q&64,o=q&128;if(q&1){q=new THREE.Face4;q.a=g[m++];q.b=g[m++];q.c=g[m++];q.d=g[m++];var x=4}else{q=new THREE.Face3;q.a=g[m++];q.b=g[m++];q.c=g[m++];x=3}if(s){s=g[m++];q.materialIndex=s}var C=d.faces.length;if(f)for(f=0;f<l;f++){var D=a.uvs[f],s=g[m++],z=D[s*2],s=D[s*2+1];d.faceUvs[f][C]=new THREE.UV(z,s)}if(w)for(f=0;f<l;f++){for(var D=a.uvs[f],w=[],u=0;u<x;u++){s=g[m++];z=D[s*2];s=D[s*2+1];w[u]=new THREE.UV(z,s)}d.faceVertexUvs[f][C]=w}if(t){t=g[m++]*
+3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.normal=s}if(r)for(f=0;f<x;f++){t=g[m++]*3;s=new THREE.Vector3;s.x=n[t++];s.y=n[t++];s.z=n[t];q.vertexNormals.push(s)}if(v){r=g[m++];q.color=new THREE.Color(j[r])}if(o)for(f=0;f<x;f++){r=g[m++];q.vertexColors.push(new THREE.Color(j[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+
+2){n=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],n,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];n=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;s=0;for(l=j.length;s<l;s=s+3){o=new THREE.Vector3;o.x=j[s]*e;o.y=j[s+1]*e;o.z=j[s+2]*e;n.push(o)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]=
+{};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;j=a.morphColors[f].colors;n=0;for(l=j.length;n<l;n=n+3){m=new THREE.Color(16755200);m.setRGB(j[n],j[n+1],j[n+2]);e.push(m)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:i+"/"+a}function e(){var a;for(n in B.objects)if(!N.objects[n]){s=B.objects[n];if(s.geometry!==void 0){if(E=N.geometries[s.geometry]){a=false;O=N.materials[s.materials[0]];(a=O instanceof THREE.ShaderMaterial)&&E.computeTangents();x=s.position;F=s.rotation;C=s.quaternion;z=s.scale;u=s.matrix;C=0;s.materials.length==0&&(O=new THREE.MeshFaceMaterial);s.materials.length>1&&(O=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(E,O);a.name=n;if(u){a.matrixAutoUpdate=false;a.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[n]=a}}else{x=s.position;F=s.rotation;C=s.quaternion;
-z=s.scale;C=0;a=new THREE.Object3D;a.name=n;a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[n]=a;N.empties[n]=a}}}function f(a){return function(b){N.geometries[a]=b;e();P=P-1;j.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){j.callbackProgress({totalModels:W,totalTextures:R,loadedModels:W-
-P,loadedTextures:R-D},N);j.onLoadProgress();P===0&&D===0&&b(N)}var j=this,i=THREE.Loader.prototype.extractUrlBase(c),l,o,n,p,r,m,q,s,u,t,v,x,F,C,z,w,H,E,O,Q,Y,B,J,P,D,W,R,N;B=a;c=new THREE.BinaryLoader;J=new THREE.JSONLoader;D=P=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;t=B.transform.rotation;w=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);t&&N.scene.rotation.set(t[0],t[1],
-t[2]);w&&N.scene.scale.set(w[0],w[1],w[2]);if(a||t||w){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){D=D-a;h();j.onLoadComplete()}};for(r in B.cameras){w=B.cameras[r];w.type==="perspective"?Q=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):w.type==="ortho"&&(Q=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far));x=w.position;t=w.target;w=w.up;Q.position.set(x[0],x[1],x[2]);Q.target=new THREE.Vector3(t[0],t[1],t[2]);w&&Q.up.set(w[0],
-w[1],w[2]);N.cameras[r]=Q}for(p in B.lights){t=B.lights[p];r=t.color!==void 0?t.color:16777215;Q=t.intensity!==void 0?t.intensity:1;if(t.type==="directional"){x=t.direction;v=new THREE.DirectionalLight(r,Q);v.position.set(x[0],x[1],x[2]);v.position.normalize()}else if(t.type==="point"){x=t.position;v=t.distance;v=new THREE.PointLight(r,Q,v);v.position.set(x[0],x[1],x[2])}else t.type==="ambient"&&(v=new THREE.AmbientLight(r));N.scene.add(v);N.lights[p]=v}for(m in B.fogs){p=B.fogs[m];p.type==="linear"?
-Y=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(Y=new THREE.FogExp2(0,p.density));w=p.color;Y.color.setRGB(w[0],w[1],w[2]);N.fogs[m]=Y}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];w=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(w[0],w[1],w[2]);N.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){m=B.geometries[l];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){P=P+1;j.onLoadStart()}}W=P;
-for(l in B.geometries){m=B.geometries[l];if(m.type==="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);N.geometries[l]=E}else if(m.type==="plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);N.geometries[l]=E}else if(m.type==="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);N.geometries[l]=E}else if(m.type==="cylinder"){E=new THREE.CylinderGeometry(m.topRad,
-m.botRad,m.height,m.radSegs,m.heightSegs);N.geometries[l]=E}else if(m.type==="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);N.geometries[l]=E}else if(m.type==="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);N.geometries[l]=E}else if(m.type==="bin_mesh")c.load(d(m.url,B.urlBaseType),f(l));else if(m.type==="ascii_mesh")J.load(d(m.url,B.urlBaseType),f(l));else if(m.type==="embedded_mesh"){m=B.embeds[m.id];m.metadata=B.metadata;m&&J.createModel(m,g(l),
-"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof Array){D=D+l.url.length;for(m=0;m<l.url.length;m++)j.onLoadStart()}else{D=D+1;j.onLoadStart()}}R=D;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=l.url.length;Y=[];for(c=0;c<m;c++)Y[c]=d(l.url[c],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(Y,l.mapping,a(m))}else{m=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==
-void 0)m.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!==void 0)m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!==1)m.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!==1)m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[l.wrap[0]]!==void 0)m.wrapS=Y[l.wrap[0]];if(Y[l.wrap[1]]!==void 0)m.wrapT=Y[l.wrap[1]]}}N.textures[q]=m}for(o in B.materials){u=
-B.materials[o];for(H in u.parameters)if(H==="envMap"||H==="map"||H==="lightMap")u.parameters[H]=N.textures[u.parameters[H]];else if(H==="shading")u.parameters[H]=u.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H==="blending")u.parameters[H]=u.parameters[H]in THREE?THREE[u.parameters[H]]:THREE.NormalBlending;else if(H==="combine")u.parameters[H]=u.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==="vertexColors")if(u.parameters[H]=="face")u.parameters[H]=
-THREE.FaceColors;else if(u.parameters[H])u.parameters[H]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=u.parameters.color;m=u.parameters.specular;Y=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=N.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=
-u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=N.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(Y);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
-uniforms:a,lights:true,fog:true})}else O=new THREE[u.type](u.parameters);N.materials[o]=O}e();j.callbackSync(N);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(n in B.objects)if(!N.objects[n]){s=B.objects[n];if(s.geometry!==void 0){if(J=N.geometries[s.geometry]){a=false;M=N.materials[s.materials[0]];(a=M instanceof THREE.ShaderMaterial)&&J.computeTangents();x=s.position;C=s.rotation;D=s.quaternion;z=s.scale;w=s.matrix;D=0;s.materials.length==0&&(M=new THREE.MeshFaceMaterial);s.materials.length>1&&(M=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(J,M);a.name=n;if(w){a.matrixAutoUpdate=false;a.matrix.set(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15])}else{a.position.set(x[0],x[1],x[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(z[0],z[1],z[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;N.scene.add(a);N.objects[n]=a}}else{x=s.position;C=s.rotation;D=s.quaternion;
+z=s.scale;D=0;a=new THREE.Object3D;a.name=n;a.position.set(x[0],x[1],x[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(C[0],C[1],C[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;N.scene.add(a);N.objects[n]=a;N.empties[n]=a}}}function f(a){return function(b){N.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){N.geometries[a]=b}}function h(){i.callbackProgress({totalModels:aa,totalTextures:T,loadedModels:aa-
+Q,loadedTextures:T-E},N);i.onLoadProgress();Q===0&&E===0&&b(N)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,m,n,p,r,o,q,s,w,t,v,x,C,D,z,u,G,J,M,O,X,B,F,Q,E,aa,T,N;B=a;c=new THREE.BinaryLoader;F=new THREE.JSONLoader;E=Q=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;t=B.transform.rotation;u=B.transform.scale;a&&N.scene.position.set(a[0],a[1],a[2]);t&&N.scene.rotation.set(t[0],t[1],
+t[2]);u&&N.scene.scale.set(u[0],u[1],u[2]);if(a||t||u){N.scene.updateMatrix();N.scene.updateMatrixWorld()}}a=function(a){return function(){E=E-a;h();i.onLoadComplete()}};for(r in B.cameras){u=B.cameras[r];u.type==="perspective"?O=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type==="ortho"&&(O=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));x=u.position;t=u.target;u=u.up;O.position.set(x[0],x[1],x[2]);O.target=new THREE.Vector3(t[0],t[1],t[2]);u&&O.up.set(u[0],
+u[1],u[2]);N.cameras[r]=O}for(p in B.lights){t=B.lights[p];r=t.color!==void 0?t.color:16777215;O=t.intensity!==void 0?t.intensity:1;if(t.type==="directional"){x=t.direction;v=new THREE.DirectionalLight(r,O);v.position.set(x[0],x[1],x[2]);v.position.normalize()}else if(t.type==="point"){x=t.position;v=t.distance;v=new THREE.PointLight(r,O,v);v.position.set(x[0],x[1],x[2])}else t.type==="ambient"&&(v=new THREE.AmbientLight(r));N.scene.add(v);N.lights[p]=v}for(o in B.fogs){p=B.fogs[o];p.type==="linear"?
+X=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(X=new THREE.FogExp2(0,p.density));u=p.color;X.color.setRGB(u[0],u[1],u[2]);N.fogs[o]=X}if(N.cameras&&B.defaults.camera)N.currentCamera=N.cameras[B.defaults.camera];if(N.fogs&&B.defaults.fog)N.scene.fog=N.fogs[B.defaults.fog];u=B.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(u[0],u[1],u[2]);N.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){o=B.geometries[l];if(o.type=="bin_mesh"||o.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}aa=
+Q;for(l in B.geometries){o=B.geometries[l];if(o.type==="cube"){J=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);N.geometries[l]=J}else if(o.type==="plane"){J=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="sphere"){J=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight);N.geometries[l]=J}else if(o.type==="cylinder"){J=new THREE.CylinderGeometry(o.topRad,
+o.botRad,o.height,o.radSegs,o.heightSegs);N.geometries[l]=J}else if(o.type==="torus"){J=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);N.geometries[l]=J}else if(o.type==="icosahedron"){J=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);N.geometries[l]=J}else if(o.type==="bin_mesh")c.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="ascii_mesh")F.load(d(o.url,B.urlBaseType),f(l));else if(o.type==="embedded_mesh"){o=B.embeds[o.id];o.metadata=B.metadata;o&&F.createModel(o,g(l),
+"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof Array){E=E+l.url.length;for(o=0;o<l.url.length;o++)i.onLoadStart()}else{E=E+1;i.onLoadStart()}}T=E;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){o=l.url.length;X=[];for(c=0;c<o;c++)X[c]=d(l.url[c],B.urlBaseType);o=THREE.ImageUtils.loadTextureCube(X,l.mapping,a(o))}else{o=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==
+void 0)o.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!==void 0)o.magFilter=THREE[l.magFilter];if(l.repeat){o.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!==1)o.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!==1)o.wrapT=THREE.RepeatWrapping}l.offset&&o.offset.set(l.offset[0],l.offset[1]);if(l.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[l.wrap[0]]!==void 0)o.wrapS=X[l.wrap[0]];if(X[l.wrap[1]]!==void 0)o.wrapT=X[l.wrap[1]]}}N.textures[q]=o}for(m in B.materials){w=
+B.materials[m];for(G in w.parameters)if(G==="envMap"||G==="map"||G==="lightMap")w.parameters[G]=N.textures[w.parameters[G]];else if(G==="shading")w.parameters[G]=w.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G==="blending")w.parameters[G]=w.parameters[G]in THREE?THREE[w.parameters[G]]:THREE.NormalBlending;else if(G==="combine")w.parameters[G]=w.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G==="vertexColors")if(w.parameters[G]=="face")w.parameters[G]=
+THREE.FaceColors;else if(w.parameters[G])w.parameters[G]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=true;if(w.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=w.parameters.color;o=w.parameters.specular;X=w.parameters.ambient;c=w.parameters.shininess;a.tNormal.texture=N.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=w.parameters.normalMapFactor;if(w.parameters.map){a.tDiffuse.texture=
+w.parameters.map;a.enableDiffuse.value=true}if(w.parameters.lightMap){a.tAO.texture=w.parameters.lightMap;a.enableAO.value=true}if(w.parameters.specularMap){a.tSpecular.texture=N.textures[w.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(o);a.uAmbientColor.value.setHex(X);a.uShininess.value=c;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;M=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
+uniforms:a,lights:true,fog:true})}else M=new THREE[w.type](w.parameters);N.materials[m]=M}e();i.callbackSync(N);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;
@@ -207,9 +207,9 @@ THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
 a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
 a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
-THREE.Texture=function(a,b,c,d,e,f,g,h,j){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.anisotropy=j!==void 0?j:1;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
+THREE.Texture=function(a,b,c,d,e,f,g,h,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.anisotropy=i!==void 0?i:1;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
 new THREE.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;
 new THREE.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;
-THREE.DataTexture=function(a,b,c,d,e,f,g,h,j,i){THREE.Texture.call(this,null,f,g,h,j,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};
+THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j){THREE.Texture.call(this,null,f,g,h,i,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};
 THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};
 THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};
 THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
 THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
@@ -239,36 +239,36 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=m.globalAlpha=a}function c(a){if(t!==a){if(a===THREE.NormalBlending)m.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)m.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)m.globalCompositeOperation="darker";t=a}}function d(a){if(v!==a)v=m.strokeStyle=a}function e(a){if(x!==a)x=m.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,i=new THREE.Projector,l=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),o,n,p,r,m=l.getContext("2d"),q=new THREE.Color(0),s=0,u=1,t=0,v=null,x=null,F=null,C=null,z=null,w,H,E,O,Q=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,B,J,P,D,W,R,N,ba,U,I,ca,ha,L=new THREE.Color,X=new THREE.Color,S=new THREE.Color,T=new THREE.Color,ia=new THREE.Color,ma=[],za=[],Ga,Oa,Pa,Ua,nb,gb,Ob,ob,kb,ec,Va=new THREE.Rectangle,Da=new THREE.Rectangle,Aa=new THREE.Rectangle,hb=false,pa=new THREE.Color,Fa=new THREE.Color,Ra=new THREE.Color,
-ra=new THREE.Vector3,k,Za,Gb,Wa,cb,pb,a=16;k=document.createElement("canvas");k.width=k.height=2;Za=k.getContext("2d");Za.fillStyle="rgba(0,0,0,1)";Za.fillRect(0,0,2,2);Gb=Za.getImageData(0,0,2,2);Wa=Gb.data;cb=document.createElement("canvas");cb.width=cb.height=a;pb=cb.getContext("2d");pb.translate(-a/2,-a/2);pb.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){o=a;n=b;p=Math.floor(o/2);r=Math.floor(n/
-2);l.width=o;l.height=n;Va.set(-p,-r,p,r);Da.set(-p,-r,p,r);u=1;t=0;z=C=F=x=v=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.clear=function(){m.setTransform(1,0,0,-1,p,r);if(Da.isEmpty()===false){Da.minSelf(Va);Da.inflate(2);s<1&&m.clearRect(Math.floor(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.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+")");m.fillRect(Math.floor(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.getHeight()))}Da.empty()}};this.render=function(a,l){function o(a){var b,c,d,e;pa.setRGB(0,0,0);Fa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){pa.r=pa.r+e.r;pa.g=pa.g+e.g;pa.b=pa.b+e.b}else if(d instanceof THREE.DirectionalLight){Fa.r=Fa.r+e.r;Fa.g=
-Fa.g+e.g;Fa.b=Fa.b+e.b}else if(d instanceof THREE.PointLight){Ra.r=Ra.r+e.r;Ra.g=Ra.g+e.g;Ra.b=Ra.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(ra.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 q(a,f,g){b(g.opacity);c(g.blending);var h,k,j,i,l,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map!==null){i=g.map.image;l=i.width>>1;n=i.height>>1;g=f.scale.x*p;j=f.scale.y*r;h=g*l;k=j*n;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Va.intersects(Aa)!==false){m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(g,-j);m.translate(-l,-n);m.drawImage(i,0,0);m.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
-f.scale.x*p;k=f.scale.y*r;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Va.intersects(Aa)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(h,k);g.program(m);m.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!==a)F=m.lineWidth=a;a=g.linecap;
-if(C!==a)C=m.lineCap=a;a=g.linejoin;if(z!==a)z=m.lineJoin=a;d(g.color.getContextStyle());m.stroke();Aa.inflate(g.linewidth*2)}}function v(a,d,e,g,h,k,i,m){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(m.opacity);c(m.blending);B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;u(B,J,P,D,W,R);if(m instanceof THREE.MeshBasicMaterial)if(m.map!==null){if(m.map.mapping instanceof THREE.UVMapping){Ua=i.uvs[0];
-kd(B,J,P,D,W,R,Ua[g].u,Ua[g].v,Ua[h].u,Ua[h].v,Ua[k].u,Ua[k].v,m.map)}}else if(m.envMap!==null){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ra.copy(i.vertexNormalsWorld[g]);nb=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;gb=-(ra.x*a.elements[1]+ra.y*a.elements[5]+ra.z*a.elements[9])*0.5+0.5;ra.copy(i.vertexNormalsWorld[h]);Ob=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;ob=-(ra.x*a.elements[1]+ra.y*a.elements[5]+
-ra.z*a.elements[9])*0.5+0.5;ra.copy(i.vertexNormalsWorld[k]);kb=(ra.x*a.elements[0]+ra.y*a.elements[4]+ra.z*a.elements[8])*0.5+0.5;ec=-(ra.x*a.elements[1]+ra.y*a.elements[5]+ra.z*a.elements[9])*0.5+0.5;kd(B,J,P,D,W,R,nb,gb,Ob,ob,kb,ec,m.envMap)}}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color);else if(m instanceof THREE.MeshLambertMaterial)if(hb===true)if(m.wireframe===false&&m.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3){X.r=
-S.r=T.r=pa.r;X.g=S.g=T.g=pa.g;X.b=S.b=T.b=pa.b;n(j,i.v1.positionWorld,i.vertexNormalsWorld[0],X);n(j,i.v2.positionWorld,i.vertexNormalsWorld[1],S);n(j,i.v3.positionWorld,i.vertexNormalsWorld[2],T);X.r=Math.max(0,Math.min(m.color.r*X.r,1));X.g=Math.max(0,Math.min(m.color.g*X.g,1));X.b=Math.max(0,Math.min(m.color.b*X.b,1));S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));T.r=Math.max(0,Math.min(m.color.r*T.r,1));T.g=Math.max(0,
-Math.min(m.color.g*T.g,1));T.b=Math.max(0,Math.min(m.color.b*T.b,1));ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Pa=Ic(X,S,T,ia);mc(B,J,P,D,W,R,0,0,1,0,0,1,Pa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;n(j,i.centroidWorld,i.normalWorld,L);L.r=Math.max(0,Math.min(m.color.r*L.r,1));L.g=Math.max(0,Math.min(m.color.g*L.g,1));L.b=Math.max(0,Math.min(m.color.b*L.b,1));m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(L)}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,
-m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color);else if(m instanceof THREE.MeshDepthMaterial){Ga=l.near;Oa=l.far;X.r=X.g=X.b=1-gc(a.positionScreen.z,Ga,Oa);S.r=S.g=S.b=1-gc(d.positionScreen.z,Ga,Oa);T.r=T.g=T.b=1-gc(e.positionScreen.z,Ga,Oa);ia.r=(S.r+T.r)*0.5;ia.g=(S.g+T.g)*0.5;ia.b=(S.b+T.b)*0.5;Pa=Ic(X,S,T,ia);mc(B,J,P,D,W,R,0,0,1,0,0,1,Pa)}else if(m instanceof THREE.MeshNormalMaterial){L.r=nc(i.normalWorld.x);L.g=nc(i.normalWorld.y);L.b=nc(i.normalWorld.z);m.wireframe===true?Pb(L,m.wireframeLinewidth,
-m.wireframeLinecap,m.wireframeLinejoin):Hb(L)}}function t(a,d,e,g,h,k,i,m,o){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map!==null||m.envMap!==null){v(a,d,g,0,1,3,i,m,o);v(h,e,k,1,2,3,i,m,o)}else{B=a.positionScreen.x;J=a.positionScreen.y;P=d.positionScreen.x;D=d.positionScreen.y;W=e.positionScreen.x;R=e.positionScreen.y;N=g.positionScreen.x;ba=g.positionScreen.y;U=h.positionScreen.x;I=h.positionScreen.y;ca=k.positionScreen.x;ha=k.positionScreen.y;
-if(m instanceof THREE.MeshBasicMaterial){x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if(hb===true)if(!m.wireframe&&m.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4){X.r=S.r=T.r=ia.r=pa.r;X.g=S.g=T.g=ia.g=pa.g;X.b=S.b=T.b=ia.b=pa.b;n(j,i.v1.positionWorld,i.vertexNormalsWorld[0],X);n(j,i.v2.positionWorld,i.vertexNormalsWorld[1],S);n(j,i.v4.positionWorld,i.vertexNormalsWorld[3],
-T);n(j,i.v3.positionWorld,i.vertexNormalsWorld[2],ia);X.r=Math.max(0,Math.min(m.color.r*X.r,1));X.g=Math.max(0,Math.min(m.color.g*X.g,1));X.b=Math.max(0,Math.min(m.color.b*X.b,1));S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));T.r=Math.max(0,Math.min(m.color.r*T.r,1));T.g=Math.max(0,Math.min(m.color.g*T.g,1));T.b=Math.max(0,Math.min(m.color.b*T.b,1));ia.r=Math.max(0,Math.min(m.color.r*ia.r,1));ia.g=Math.max(0,Math.min(m.color.g*
-ia.g,1));ia.b=Math.max(0,Math.min(m.color.b*ia.b,1));Pa=Ic(X,S,T,ia);u(B,J,P,D,N,ba);mc(B,J,P,D,N,ba,0,0,1,0,0,1,Pa);u(U,I,W,R,ca,ha);mc(U,I,W,R,ca,ha,1,0,1,1,0,1,Pa)}else{L.r=pa.r;L.g=pa.g;L.b=pa.b;n(j,i.centroidWorld,i.normalWorld,L);L.r=Math.max(0,Math.min(m.color.r*L.r,1));L.g=Math.max(0,Math.min(m.color.g*L.g,1));L.b=Math.max(0,Math.min(m.color.b*L.b,1));x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(L)}else{x(B,J,P,D,W,R,N,ba);m.wireframe===
-true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){L.r=nc(i.normalWorld.x);L.g=nc(i.normalWorld.y);L.b=nc(i.normalWorld.z);x(B,J,P,D,W,R,N,ba);m.wireframe===true?Pb(L,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(L)}else if(m instanceof THREE.MeshDepthMaterial){Ga=l.near;Oa=l.far;X.r=X.g=X.b=1-gc(a.positionScreen.z,Ga,Oa);S.r=S.g=S.b=1-gc(d.positionScreen.z,Ga,Oa);T.r=T.g=T.b=1-gc(g.positionScreen.z,
-Ga,Oa);ia.r=ia.g=ia.b=1-gc(e.positionScreen.z,Ga,Oa);Pa=Ic(X,S,T,ia);u(B,J,P,D,N,ba);mc(B,J,P,D,N,ba,0,0,1,0,0,1,Pa);u(U,I,W,R,ca,ha);mc(U,I,W,R,ca,ha,1,0,1,1,0,1,Pa)}}}function u(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,h);m.lineTo(a,b)}function Pb(a,b,c,e){if(F!==b)F=m.lineWidth=b;if(C!==c)C=m.lineCap=c;if(z!==e)z=m.lineJoin=e;d(a.getContextStyle());m.stroke();
-Aa.inflate(b*2)}function Hb(a){e(a.getContextStyle());m.fill()}function kd(a,b,c,d,f,g,h,k,i,j,l,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ma[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,fc=o.wrapT==THREE.RepeatWrapping;ma[o.id]=m.createPattern(o.image,p===true&&fc===true?"repeat":p===true&&fc===false?"repeat-x":p===false&&fc===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ma[o.id]);var p=o.offset.x/o.repeat.x,fc=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
-q=o.image.height*o.repeat.y,h=(h+p)*r,k=(k+fc)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*r-h,j=(j+fc)*q-k,l=(l+p)*r-h,n=(n+fc)*q-k,p=i*n-l*j;if(p===0){if(za[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);za[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=za[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;L.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Hb(L)}else{p=1/p;o=(n*c-j*f)*p;j=(n*d-j*g)*p;c=
-(i*f-l*c)*p;d=(i*g-l*d)*p;a=a-o*h-c*k;h=b-j*h-d*k;m.save();m.transform(o,j,c,d,a,h);m.fill();m.restore()}}}function mc(a,b,c,d,e,f,g,h,k,j,i,l,o){var n,p;n=o.width-1;p=o.height-1;g=g*n;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*n-g;j=j*p-h;i=i*n-g;l=l*p-h;p=1/(k*l-i*j);n=(l*c-j*e)*p;j=(l*d-j*f)*p;c=(k*e-i*c)*p;d=(k*f-i*d)*p;a=a-n*g-c*h;b=b-j*g-d*h;m.save();m.transform(n,j,c,d,a,b);m.clip();m.drawImage(o,0,0);m.restore()}function Ic(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*
-255),b=~~(b.b*255),j=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);Wa[0]=e<0?0:e>255?255:e;Wa[1]=f<0?0:f>255?255:f;Wa[2]=a<0?0:a>255?255:a;Wa[4]=g<0?0:g>255?255:g;Wa[5]=h<0?0:h>255?255:h;Wa[6]=b<0?0:b>255?255:b;Wa[8]=j<0?0:j>255?255:j;Wa[9]=i<0?0:i>255?255:i;Wa[10]=c<0?0:c>255?255:c;Wa[12]=l<0?0:l>255?255:l;Wa[13]=m<0?0:m>255?255:m;Wa[14]=d<0?0:d>255?255:d;Za.putImageData(Gb,0,0);pb.drawImage(k,0,0);return cb}function gc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}
-function nc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Jc,ld,Ma,ib;this.autoClear===true?this.clear():m.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=i.projectScene(a,l,this.sortElements);h=g.elements;j=g.lights;hb=j.length>0;hb===true&&o(j);Jc=0;for(ld=h.length;Jc<ld;Jc++){Ma=h[Jc];ib=Ma.material;ib=ib instanceof THREE.MeshFaceMaterial?Ma.faceMaterial:
-ib;if(!(ib===void 0||ib.visible===false)){Aa.empty();if(Ma instanceof THREE.RenderableParticle){w=Ma;w.x=w.x*p;w.y=w.y*r;q(w,Ma,ib,a)}else if(Ma instanceof THREE.RenderableLine){w=Ma.v1;H=Ma.v2;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;Aa.addPoint(w.positionScreen.x,w.positionScreen.y);Aa.addPoint(H.positionScreen.x,H.positionScreen.y);Va.intersects(Aa)===true&&s(w,H,Ma,ib,a)}else if(Ma instanceof
-THREE.RenderableFace3){w=Ma.v1;H=Ma.v2;E=Ma.v3;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;if(ib.overdraw===true){Qb(w.positionScreen,H.positionScreen);Qb(H.positionScreen,E.positionScreen);Qb(E.positionScreen,w.positionScreen)}Aa.add3Points(w.positionScreen.x,w.positionScreen.y,H.positionScreen.x,H.positionScreen.y,
-E.positionScreen.x,E.positionScreen.y);Va.intersects(Aa)===true&&v(w,H,E,0,1,2,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace4){w=Ma.v1;H=Ma.v2;E=Ma.v3;O=Ma.v4;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;E.positionScreen.x=E.positionScreen.x*p;E.positionScreen.y=E.positionScreen.y*r;O.positionScreen.x=O.positionScreen.x*p;O.positionScreen.y=O.positionScreen.y*r;Q.positionScreen.copy(H.positionScreen);
-Y.positionScreen.copy(O.positionScreen);if(ib.overdraw===true){Qb(w.positionScreen,H.positionScreen);Qb(H.positionScreen,O.positionScreen);Qb(O.positionScreen,w.positionScreen);Qb(E.positionScreen,Q.positionScreen);Qb(E.positionScreen,Y.positionScreen)}Aa.addPoint(w.positionScreen.x,w.positionScreen.y);Aa.addPoint(H.positionScreen.x,H.positionScreen.y);Aa.addPoint(E.positionScreen.x,E.positionScreen.y);Aa.addPoint(O.positionScreen.x,O.positionScreen.y);Va.intersects(Aa)===true&&t(w,H,E,O,Q,Y,Ma,ib,
-a)}Da.addRectangle(Aa)}}m.setTransform(1,0,0,1,0,0)}};
+THREE.CanvasRenderer=function(a){function b(a){if(w!==a)w=o.globalAlpha=a}function c(a){if(t!==a){if(a===THREE.NormalBlending)o.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)o.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)o.globalCompositeOperation="darker";t=a}}function d(a){if(v!==a)v=o.strokeStyle=a}function e(a){if(x!==a)x=o.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),m,n,p,r,o=l.getContext("2d"),q=new THREE.Color(0),s=0,w=1,t=0,v=null,x=null,C=null,D=null,z=null,u,G,J,M,O=new THREE.RenderableVertex,X=new THREE.RenderableVertex,B,F,Q,E,aa,T,N,W,ba,H,ca,ia,S=new THREE.Color,R=new THREE.Color,P=new THREE.Color,U=new THREE.Color,fa=new THREE.Color,ma=[],Ga=[],na,Oa,Pa,bb,nb,gb,Ob,ob,kb,ec,Ua=new THREE.Rectangle,Da=new THREE.Rectangle,Aa=new THREE.Rectangle,hb=false,qa=new THREE.Color,Fa=new THREE.Color,Ra=new THREE.Color,
+sa=new THREE.Vector3,k,Ya,Gb,Va,cb,pb,a=16;k=document.createElement("canvas");k.width=k.height=2;Ya=k.getContext("2d");Ya.fillStyle="rgba(0,0,0,1)";Ya.fillRect(0,0,2,2);Gb=Ya.getImageData(0,0,2,2);Va=Gb.data;cb=document.createElement("canvas");cb.width=cb.height=a;pb=cb.getContext("2d");pb.translate(-a/2,-a/2);pb.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;Ua.set(-p,-r,p,r);Da.set(-p,-r,p,r);w=1;t=0;z=D=C=x=v=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Da.set(-p,-r,p,r)};this.clear=function(){o.setTransform(1,0,0,-1,p,r);if(Da.isEmpty()===false){Da.minSelf(Ua);Da.inflate(2);s<1&&o.clearRect(Math.floor(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.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(Da.getX()),Math.floor(Da.getY()),Math.floor(Da.getWidth()),Math.floor(Da.getHeight()))}Da.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;qa.setRGB(0,0,0);Fa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){qa.r=qa.r+e.r;qa.g=qa.g+e.g;qa.b=qa.b+e.b}else if(d instanceof THREE.DirectionalLight){Fa.r=Fa.r+e.r;Fa.g=
+Fa.g+e.g;Fa.b=Fa.b+e.b}else if(d instanceof THREE.PointLight){Ra.r=Ra.r+e.r;Ra.g=Ra.g+e.g;Ra.b=Ra.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(sa.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){j=g.map.image;l=j.width>>1;m=j.height>>1;g=f.scale.x*p;i=f.scale.y*r;h=g*l;k=i*m;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Ua.intersects(Aa)!==false){o.save();o.translate(a.x,a.y);o.rotate(-f.rotation);o.scale(g,-i);o.translate(-l,-m);o.drawImage(j,0,0);o.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
+f.scale.x*p;k=f.scale.y*r;Aa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(Ua.intersects(Aa)!==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(D!==a)D=o.lineCap=a;a=g.linejoin;if(z!==a)z=o.lineJoin=a;d(g.color.getContextStyle());o.stroke();Aa.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++;b(m.opacity);c(m.blending);B=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;E=d.positionScreen.y;aa=e.positionScreen.x;T=e.positionScreen.y;w(B,F,Q,E,aa,T);if(m instanceof THREE.MeshBasicMaterial)if(m.map!==null){if(m.map.mapping instanceof THREE.UVMapping){bb=j.uvs[0];
+kd(B,F,Q,E,aa,T,bb[g].u,bb[g].v,bb[h].u,bb[h].v,bb[k].u,bb[k].v,m.map)}}else if(m.envMap!==null){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;sa.copy(j.vertexNormalsWorld[g]);nb=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;gb=(sa.x*a.elements[1]+sa.y*a.elements[5]+sa.z*a.elements[9])*0.5+0.5;sa.copy(j.vertexNormalsWorld[h]);Ob=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;ob=(sa.x*a.elements[1]+sa.y*a.elements[5]+
+sa.z*a.elements[9])*0.5+0.5;sa.copy(j.vertexNormalsWorld[k]);kb=(sa.x*a.elements[0]+sa.y*a.elements[4]+sa.z*a.elements[8])*0.5+0.5;ec=(sa.x*a.elements[1]+sa.y*a.elements[5]+sa.z*a.elements[9])*0.5+0.5;kd(B,F,Q,E,aa,T,nb,gb,Ob,ob,kb,ec,m.envMap)}}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color);else if(m instanceof THREE.MeshLambertMaterial)if(hb===true)if(m.wireframe===false&&m.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3){R.r=
+P.r=U.r=qa.r;R.g=P.g=U.g=qa.g;R.b=P.b=U.b=qa.b;n(i,j.v1.positionWorld,j.vertexNormalsWorld[0],R);n(i,j.v2.positionWorld,j.vertexNormalsWorld[1],P);n(i,j.v3.positionWorld,j.vertexNormalsWorld[2],U);R.r=Math.max(0,Math.min(m.color.r*R.r,1));R.g=Math.max(0,Math.min(m.color.g*R.g,1));R.b=Math.max(0,Math.min(m.color.b*R.b,1));P.r=Math.max(0,Math.min(m.color.r*P.r,1));P.g=Math.max(0,Math.min(m.color.g*P.g,1));P.b=Math.max(0,Math.min(m.color.b*P.b,1));U.r=Math.max(0,Math.min(m.color.r*U.r,1));U.g=Math.max(0,
+Math.min(m.color.g*U.g,1));U.b=Math.max(0,Math.min(m.color.b*U.b,1));fa.r=(P.r+U.r)*0.5;fa.g=(P.g+U.g)*0.5;fa.b=(P.b+U.b)*0.5;Pa=Ic(R,P,U,fa);mc(B,F,Q,E,aa,T,0,0,1,0,0,1,Pa)}else{S.r=qa.r;S.g=qa.g;S.b=qa.b;n(i,j.centroidWorld,j.normalWorld,S);S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));m.wireframe===true?Pb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(S)}else m.wireframe===true?Pb(m.color,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color);else if(m instanceof THREE.MeshDepthMaterial){na=l.near;Oa=l.far;R.r=R.g=R.b=1-gc(a.positionScreen.z,na,Oa);P.r=P.g=P.b=1-gc(d.positionScreen.z,na,Oa);U.r=U.g=U.b=1-gc(e.positionScreen.z,na,Oa);fa.r=(P.r+U.r)*0.5;fa.g=(P.g+U.g)*0.5;fa.b=(P.b+U.b)*0.5;Pa=Ic(R,P,U,fa);mc(B,F,Q,E,aa,T,0,0,1,0,0,1,Pa)}else if(m instanceof THREE.MeshNormalMaterial){S.r=nc(j.normalWorld.x);S.g=nc(j.normalWorld.y);S.b=nc(j.normalWorld.z);m.wireframe===true?Pb(S,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):Hb(S)}}function v(a,d,e,g,h,k,j,m,o){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map!==void 0&&m.map!==null||m.envMap!==void 0&&m.envMap!==null){t(a,d,g,0,1,3,j,m,o);t(h,e,k,1,2,3,j,m,o)}else{B=a.positionScreen.x;F=a.positionScreen.y;Q=d.positionScreen.x;E=d.positionScreen.y;aa=e.positionScreen.x;T=e.positionScreen.y;N=g.positionScreen.x;W=g.positionScreen.y;ba=h.positionScreen.x;H=h.positionScreen.y;
+ca=k.positionScreen.x;ia=k.positionScreen.y;if(m instanceof THREE.MeshBasicMaterial){x(B,F,Q,E,aa,T,N,W);m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if(hb===true)if(!m.wireframe&&m.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4){R.r=P.r=U.r=fa.r=qa.r;R.g=P.g=U.g=fa.g=qa.g;R.b=P.b=U.b=fa.b=qa.b;n(i,j.v1.positionWorld,j.vertexNormalsWorld[0],R);n(i,j.v2.positionWorld,j.vertexNormalsWorld[1],
+P);n(i,j.v4.positionWorld,j.vertexNormalsWorld[3],U);n(i,j.v3.positionWorld,j.vertexNormalsWorld[2],fa);R.r=Math.max(0,Math.min(m.color.r*R.r,1));R.g=Math.max(0,Math.min(m.color.g*R.g,1));R.b=Math.max(0,Math.min(m.color.b*R.b,1));P.r=Math.max(0,Math.min(m.color.r*P.r,1));P.g=Math.max(0,Math.min(m.color.g*P.g,1));P.b=Math.max(0,Math.min(m.color.b*P.b,1));U.r=Math.max(0,Math.min(m.color.r*U.r,1));U.g=Math.max(0,Math.min(m.color.g*U.g,1));U.b=Math.max(0,Math.min(m.color.b*U.b,1));fa.r=Math.max(0,Math.min(m.color.r*
+fa.r,1));fa.g=Math.max(0,Math.min(m.color.g*fa.g,1));fa.b=Math.max(0,Math.min(m.color.b*fa.b,1));Pa=Ic(R,P,U,fa);w(B,F,Q,E,N,W);mc(B,F,Q,E,N,W,0,0,1,0,0,1,Pa);w(ba,H,aa,T,ca,ia);mc(ba,H,aa,T,ca,ia,1,0,1,1,0,1,Pa)}else{S.r=qa.r;S.g=qa.g;S.b=qa.b;n(i,j.centroidWorld,j.normalWorld,S);S.r=Math.max(0,Math.min(m.color.r*S.r,1));S.g=Math.max(0,Math.min(m.color.g*S.g,1));S.b=Math.max(0,Math.min(m.color.b*S.b,1));x(B,F,Q,E,aa,T,N,W);m.wireframe===true?Pb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):
+Hb(S)}else{x(B,F,Q,E,aa,T,N,W);m.wireframe===true?Pb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){S.r=nc(j.normalWorld.x);S.g=nc(j.normalWorld.y);S.b=nc(j.normalWorld.z);x(B,F,Q,E,aa,T,N,W);m.wireframe===true?Pb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Hb(S)}else if(m instanceof THREE.MeshDepthMaterial){na=l.near;Oa=l.far;R.r=R.g=R.b=1-gc(a.positionScreen.z,na,Oa);P.r=P.g=P.b=1-gc(d.positionScreen.z,
+na,Oa);U.r=U.g=U.b=1-gc(g.positionScreen.z,na,Oa);fa.r=fa.g=fa.b=1-gc(e.positionScreen.z,na,Oa);Pa=Ic(R,P,U,fa);w(B,F,Q,E,N,W);mc(B,F,Q,E,N,W,0,0,1,0,0,1,Pa);w(ba,H,aa,T,ca,ia);mc(ba,H,aa,T,ca,ia,1,0,1,1,0,1,Pa)}}}function w(a,b,c,d,e,f){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(g,h);o.lineTo(a,b)}function Pb(a,b,c,e){if(C!==b)C=o.lineWidth=b;if(D!==c)D=o.lineCap=c;if(z!==e)z=o.lineJoin=
+e;d(a.getContextStyle());o.stroke();Aa.inflate(b*2)}function Hb(a){e(a.getContextStyle());o.fill()}function kd(a,b,c,d,f,g,h,k,i,j,m,l,n){if(!(n.image===void 0||n.image.width===0)){if(n.needsUpdate===true||ma[n.id]===void 0){var p=n.wrapS==THREE.RepeatWrapping,fc=n.wrapT==THREE.RepeatWrapping;ma[n.id]=o.createPattern(n.image,p===true&&fc===true?"repeat":p===true&&fc===false?"repeat-x":p===false&&fc===true?"repeat-y":"no-repeat");n.needsUpdate=false}e(ma[n.id]);var p=n.offset.x/n.repeat.x,fc=n.offset.y/
+n.repeat.y,r=n.image.width*n.repeat.x,q=n.image.height*n.repeat.y,h=(h+p)*r,k=(1-k+fc)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*r-h,j=(1-j+fc)*q-k,m=(m+p)*r-h,l=(1-l+fc)*q-k,p=i*l-m*j;if(p===0){if(Ga[n.id]===void 0){b=document.createElement("canvas");b.width=n.image.width;b.height=n.image.height;b=b.getContext("2d");b.drawImage(n.image,0,0);Ga[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data}b=Ga[n.id];h=(Math.floor(h)+Math.floor(k)*n.image.width)*4;S.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Hb(S)}else{p=
+1/p;n=(l*c-j*f)*p;j=(l*d-j*g)*p;c=(i*f-m*c)*p;d=(i*g-m*d)*p;a=a-n*h-c*k;h=b-j*h-d*k;o.save();o.transform(n,j,c,d,a,h);o.fill();o.restore()}}}function mc(a,b,c,d,e,f,g,h,k,i,j,m,l){var n,p;n=l.width-1;p=l.height-1;g=g*n;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*n-g;i=i*p-h;j=j*n-g;m=m*p-h;p=1/(k*m-j*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-n*g-c*h;b=b-i*g-d*h;o.save();o.transform(n,i,c,d,a,b);o.clip();o.drawImage(l,0,0);o.restore()}function Ic(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),
+a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);Va[0]=e<0?0:e>255?255:e;Va[1]=f<0?0:f>255?255:f;Va[2]=a<0?0:a>255?255:a;Va[4]=g<0?0:g>255?255:g;Va[5]=h<0?0:h>255?255:h;Va[6]=b<0?0:b>255?255:b;Va[8]=i<0?0:i>255?255:i;Va[9]=j<0?0:j>255?255:j;Va[10]=c<0?0:c>255?255:c;Va[12]=m<0?0:m>255?255:m;Va[13]=l<0?0:l>255?255:l;Va[14]=d<0?0:d>255?255:d;Ya.putImageData(Gb,0,0);pb.drawImage(k,0,0);return cb}function gc(a,b,
+c){a=(a-b)/(c-b);return a*a*(3-2*a)}function nc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Qb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Jc,ld,Ma,ib;this.autoClear===true?this.clear():o.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;hb=i.length>0;hb===true&&m(i);Jc=0;for(ld=h.length;Jc<ld;Jc++){Ma=h[Jc];ib=Ma.material;ib=ib instanceof
+THREE.MeshFaceMaterial?Ma.faceMaterial:ib;if(!(ib===void 0||ib.visible===false)){Aa.empty();if(Ma instanceof THREE.RenderableParticle){u=Ma;u.x=u.x*p;u.y=u.y*r;q(u,Ma,ib,a)}else if(Ma instanceof THREE.RenderableLine){u=Ma.v1;G=Ma.v2;u.positionScreen.x=u.positionScreen.x*p;u.positionScreen.y=u.positionScreen.y*r;G.positionScreen.x=G.positionScreen.x*p;G.positionScreen.y=G.positionScreen.y*r;Aa.addPoint(u.positionScreen.x,u.positionScreen.y);Aa.addPoint(G.positionScreen.x,G.positionScreen.y);Ua.intersects(Aa)===
+true&&s(u,G,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace3){u=Ma.v1;G=Ma.v2;J=Ma.v3;u.positionScreen.x=u.positionScreen.x*p;u.positionScreen.y=u.positionScreen.y*r;G.positionScreen.x=G.positionScreen.x*p;G.positionScreen.y=G.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;if(ib.overdraw===true){Qb(u.positionScreen,G.positionScreen);Qb(G.positionScreen,J.positionScreen);Qb(J.positionScreen,u.positionScreen)}Aa.add3Points(u.positionScreen.x,u.positionScreen.y,
+G.positionScreen.x,G.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Ua.intersects(Aa)===true&&t(u,G,J,0,1,2,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace4){u=Ma.v1;G=Ma.v2;J=Ma.v3;M=Ma.v4;u.positionScreen.x=u.positionScreen.x*p;u.positionScreen.y=u.positionScreen.y*r;G.positionScreen.x=G.positionScreen.x*p;G.positionScreen.y=G.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;M.positionScreen.x=M.positionScreen.x*p;M.positionScreen.y=
+M.positionScreen.y*r;O.positionScreen.copy(G.positionScreen);X.positionScreen.copy(M.positionScreen);if(ib.overdraw===true){Qb(u.positionScreen,G.positionScreen);Qb(G.positionScreen,M.positionScreen);Qb(M.positionScreen,u.positionScreen);Qb(J.positionScreen,O.positionScreen);Qb(J.positionScreen,X.positionScreen)}Aa.addPoint(u.positionScreen.x,u.positionScreen.y);Aa.addPoint(G.positionScreen.x,G.positionScreen.y);Aa.addPoint(J.positionScreen.x,J.positionScreen.y);Aa.addPoint(M.positionScreen.x,M.positionScreen.y);
+Ua.intersects(Aa)===true&&v(u,G,J,M,O,X,Ma,ib,a)}Da.addRectangle(Aa)}}o.setTransform(1,0,0,1,0,0)}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -309,141 +309,141 @@ THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment
 THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var j=a.colors,i=j.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){hb.copy(Aa);hb.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];pa.copy(e);hb.multiplyVector3(pa);o[d]=[pa.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[o[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<i;d++){f=d*3;e=j[o[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(i=r.length;j<i;j++){h=r[j];
-if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=o[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=o[d][1];
-g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(n)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<i;d++){e=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(i=r.length;j<i;j++){h=r[j];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
-3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(n||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
-m,b)}if(r){j=0;for(i=r.length;j<i;j++){h=r[j];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function j(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ca=N=null;U=I=X=L=Ga=za=S=-1;Ra=true;a[d].render(b,c,ec,Va);ca=N=null;U=I=X=L=Ga=za=S=-1;Ra=true}}function i(a,b,c,d,f,e,g,h){var k,j,i,l;if(b){j=a.length-1;l=b=-1}else{j=0;b=a.length;l=1}for(var m=j;m!==b;m=m+l){k=
-a[m];if(k.render){j=k.object;i=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&D.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);D.setDepthTest(k.depthTest);D.setDepthWrite(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}D.setObjectFaces(j);i instanceof THREE.BufferGeometry?D.renderBufferDirect(d,f,e,k,i,j):D.renderBuffer(d,f,e,k,i,j)}}}function l(a,b,c,d,f,e,g){for(var h,k,j=0,i=a.length;j<i;j++){h=a[j];k=h.object;if(k.visible){if(g)h=g;else{h=h[b];if(!h)continue;
-e&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,f,h,k)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function m(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,j=d.uniforms;if(g!==N){k.useProgram(g);N=g;e=true}if(d.id!==U){U=d.id;e=true}if(e||a!==ca){k.uniformMatrix4fv(h.projectionMatrix,
-false,a._projectionMatrixArray);a!==ca&&(ca=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ra){for(var i,l=0,m=0,o=0,n,p,r,q=ra,s=q.directional.colors,w=q.directional.positions,t=q.point.colors,u=q.point.positions,x=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
-I=q.spot.directions,X=q.spot.angles,E=q.spot.exponents,J=0,O=0,T=0,L=r=0,c=L=0,e=b.length;c<e;c++){i=b[c];if(!i.onlyShadow&&i.visible){n=i.color;p=i.intensity;r=i.distance;if(i instanceof THREE.AmbientLight)if(D.gammaInput){l=l+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{l=l+n.r;m=m+n.g;o=o+n.b}else if(i instanceof THREE.DirectionalLight){r=J*3;if(D.gammaInput){s[r]=n.r*n.r*p*p;s[r+1]=n.g*n.g*p*p;s[r+2]=n.b*n.b*p*p}else{s[r]=n.r*p;s[r+1]=n.g*p;s[r+2]=n.b*p}Fa.copy(i.matrixWorld.getPosition());Fa.subSelf(i.target.matrixWorld.getPosition());
-Fa.normalize();w[r]=Fa.x;w[r+1]=Fa.y;w[r+2]=Fa.z;J=J+1}else if(i instanceof THREE.PointLight){L=O*3;if(D.gammaInput){t[L]=n.r*n.r*p*p;t[L+1]=n.g*n.g*p*p;t[L+2]=n.b*n.b*p*p}else{t[L]=n.r*p;t[L+1]=n.g*p;t[L+2]=n.b*p}n=i.matrixWorld.getPosition();u[L]=n.x;u[L+1]=n.y;u[L+2]=n.z;x[O]=r;O=O+1}else if(i instanceof THREE.SpotLight){L=T*3;if(D.gammaInput){F[L]=n.r*n.r*p*p;F[L+1]=n.g*n.g*p*p;F[L+2]=n.b*n.b*p*p}else{F[L]=n.r*p;F[L+1]=n.g*p;F[L+2]=n.b*p}n=i.matrixWorld.getPosition();B[L]=n.x;B[L+1]=n.y;B[L+2]=
-n.z;H[T]=r;Fa.copy(n);Fa.subSelf(i.target.matrixWorld.getPosition());Fa.normalize();I[L]=Fa.x;I[L+1]=Fa.y;I[L+2]=Fa.z;X[T]=Math.cos(i.angle);E[T]=i.exponent;T=T+1}}}c=J*3;for(e=s.length;c<e;c++)s[c]=0;c=O*3;for(e=t.length;c<e;c++)t[c]=0;c=T*3;for(e=F.length;c<e;c++)F[c]=0;q.directional.length=J;q.point.length=O;q.spot.length=T;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=o;Ra=false}c=ra;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
-c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=
-d.opacity;D.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
-THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=z.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(D.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;
-j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(D.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=
-d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){e=c=0;for(i=b.length;e<i;e++){l=b[e];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){j.shadowMap.texture[c]=l.shadowMap;j.shadowMapSize.value[c]=l.shadowMapSize;j.shadowMatrix.value[c]=l.shadowMatrix;j.shadowDarkness.value[c]=l.shadowDarkness;j.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(l=g.uniforms[b[j][1]]){e=b[j][0];m=e.type;i=e.value;
-if(m==="i")k.uniform1i(l,i);else if(m==="f")k.uniform1f(l,i);else if(m==="v2")k.uniform2f(l,i.x,i.y);else if(m==="v3")k.uniform3f(l,i.x,i.y,i.z);else if(m==="v4")k.uniform4f(l,i.x,i.y,i.z,i.w);else if(m==="c")k.uniform3f(l,i.r,i.g,i.b);else if(m==="iv1")k.uniform1iv(l,i);else if(m==="iv")k.uniform3iv(l,i);else if(m==="fv1")k.uniform1fv(l,i);else if(m==="fv")k.uniform3fv(l,i);else if(m==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*i.length);m=0;for(o=i.length;m<o;m++){q=m*2;e._array[q]=
-i[m].x;e._array[q+1]=i[m].y}k.uniform2fv(l,e._array)}else if(m==="v3v"){if(e._array===void 0)e._array=new Float32Array(3*i.length);m=0;for(o=i.length;m<o;m++){q=m*3;e._array[q]=i[m].x;e._array[q+1]=i[m].y;e._array[q+2]=i[m].z}k.uniform3fv(l,e._array)}else if(m==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*i.length);m=0;for(o=i.length;m<o;m++){q=m*4;e._array[q]=i[m].x;e._array[q+1]=i[m].y;e._array[q+2]=i[m].z;e._array[q+3]=i[m].w}k.uniform4fv(l,e._array)}else if(m==="m4"){if(e._array===
-void 0)e._array=new Float32Array(16);i.flattenToArray(e._array);k.uniformMatrix4fv(l,false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*i.length);m=0;for(o=i.length;m<o;m++)i[m].flattenToArrayOffset(e._array,m*16);k.uniformMatrix4fv(l,false,e._array)}else if(m==="t"){k.uniform1i(l,i);if(l=e.texture)if(l.image instanceof Array&&l.image.length===6){e=l;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=k.createTexture();
-k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,e.flipY);i=[];for(l=0;l<6;l++){m=i;o=l;if(D.autoScaleCubemaps){q=e.image[l];w=Wa;if(!(q.width<=w&&q.height<=w)){t=Math.max(q.width,q.height);s=Math.floor(q.width*w/t);w=Math.floor(q.height*w/t);t=document.createElement("canvas");t.width=s;t.height=w;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,w);q=t}}else q=e.image[l];m[o]=q}l=i[0];m=(l.width&l.width-1)===0&&
-(l.height&l.height-1)===0;o=C(e.format);q=C(e.type);v(k.TEXTURE_CUBE_MAP,e,m);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o,o,q,i[l]);e.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){e=l;k.activeTexture(k.TEXTURE0+i);k.bindTexture(k.TEXTURE_CUBE_MAP,e.__webglTexture)}else D.setTexture(l,
-i)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=i+m}k.uniform1iv(l,e._array);m=0;for(o=e.texture.length;m<o;m++)(l=e.texture[m])&&D.setTexture(l,e._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
-d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(dc&&f.useVertexTexture){if(h.boneTexture!==null){k.uniform1i(h.boneTexture,12);D.setTexture(f.boneTexture,12)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,
-false,f.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Oa!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);Oa=a}if(a&&(Pa!==b||Ua!==c)){k.polygonOffset(b,c);Pa=b;Ua=c}}function t(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);
-if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(b);return null}return c}function v(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,C(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,C(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,C(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter));
-k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter))}Za&&k.texParameterf(a,Za.TEXTURE_MAX_ANISOTROPY_EXT,b.anisotropy)}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,
-k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function C(a){return a===THREE.RepeatWrapping?k.REPEAT:a===THREE.ClampToEdgeWrapping?k.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?k.MIRRORED_REPEAT:a===THREE.NearestFilter?k.NEAREST:a===THREE.NearestMipMapNearestFilter?k.NEAREST_MIPMAP_NEAREST:a===
+var i=a.colors,j=i.length,m=a.__vertexArray,l=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){hb.copy(Aa);hb.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];qa.copy(e);hb.multiplyVector3(qa);n[d]=[qa.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;m[f]=e.x;m[f+1]=e.y;m[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=i[n[d][1]];l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];
+if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=n[d][1];
+g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;m[f]=e.x;m[f+1]=e.y;m[f+2]=e.z}if(p)for(d=0;d<j;d++){e=i[d];f=d*3;l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
+3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
+l,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ca=N=null;ba=H=R=S=na=Ga=P=-1;Ra=true;a[d].render(b,c,ec,Ua);ca=N=null;ba=H=R=S=na=Ga=P=-1;Ra=true}}function j(a,b,c,d,f,e,g,h){var i,k,j,m;if(b){k=a.length-1;m=b=-1}else{k=0;b=a.length;m=1}for(var l=k;l!==b;l=l+m){i=
+a[l];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(k);j instanceof THREE.BufferGeometry?E.renderBufferDirect(d,f,e,i,j,k):E.renderBuffer(d,f,e,i,j,k)}}}function l(a,b,c,d,f,e,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+e&&E.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);w(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,d,f,h,i)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
+1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&E.deallocateMaterial(d);E.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==N){k.useProgram(g);N=g;e=true}if(d.id!==ba){ba=d.id;e=true}if(e||a!==ca){k.uniformMatrix4fv(h.projectionMatrix,
+false,a._projectionMatrixArray);a!==ca&&(ca=a)}if(e){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ra){for(var j,m=0,l=0,n=0,o,p,r,q=sa,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,w=q.point.positions,x=q.point.distances,C=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
+R=q.spot.directions,G=q.spot.angles,J=q.spot.exponents,F=0,M=0,U=0,P=r=0,c=P=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(E.gammaInput){m=m+o.r*o.r;l=l+o.g*o.g;n=n+o.b*o.b}else{m=m+o.r;l=l+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=F*3;if(E.gammaInput){s[r]=o.r*o.r*p*p;s[r+1]=o.g*o.g*p*p;s[r+2]=o.b*o.b*p*p}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}Fa.copy(j.matrixWorld.getPosition());Fa.subSelf(j.target.matrixWorld.getPosition());
+Fa.normalize();u[r]=Fa.x;u[r+1]=Fa.y;u[r+2]=Fa.z;F=F+1}else if(j instanceof THREE.PointLight){P=M*3;if(E.gammaInput){t[P]=o.r*o.r*p*p;t[P+1]=o.g*o.g*p*p;t[P+2]=o.b*o.b*p*p}else{t[P]=o.r*p;t[P+1]=o.g*p;t[P+2]=o.b*p}o=j.matrixWorld.getPosition();w[P]=o.x;w[P+1]=o.y;w[P+2]=o.z;x[M]=r;M=M+1}else if(j instanceof THREE.SpotLight){P=U*3;if(E.gammaInput){C[P]=o.r*o.r*p*p;C[P+1]=o.g*o.g*p*p;C[P+2]=o.b*o.b*p*p}else{C[P]=o.r*p;C[P+1]=o.g*p;C[P+2]=o.b*p}o=j.matrixWorld.getPosition();B[P]=o.x;B[P+1]=o.y;B[P+2]=
+o.z;H[U]=r;Fa.copy(o);Fa.subSelf(j.target.matrixWorld.getPosition());Fa.normalize();R[P]=Fa.x;R[P+1]=Fa.y;R[P+2]=Fa.z;G[U]=Math.cos(j.angle);J[U]=j.exponent;U=U+1}}}c=F*3;for(e=s.length;c<e;c++)s[c]=0;c=M*3;for(e=t.length;c<e;c++)t[c]=0;c=U*3;for(e=C.length;c<e;c++)C[c]=0;q.directional.length=F;q.point.length=M;q.spot.length=U;q.ambient[0]=m;q.ambient[1]=l;q.ambient[2]=n;Ra=false}c=sa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=
+c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
+d.opacity;E.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);i.lightMap.texture=d.lightMap;i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
+THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=d.size;i.scale.value=z.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(E.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;
+i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(E.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=
+d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){e=c=0;for(j=b.length;e<j;e++){m=b[e];if(m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&!m.shadowCascade)){i.shadowMap.texture[c]=m.shadowMap;i.shadowMapSize.value[c]=m.shadowMapSize;i.shadowMatrix.value[c]=m.shadowMatrix;i.shadowDarkness.value[c]=m.shadowDarkness;i.shadowBias.value[c]=m.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(m=g.uniforms[b[i][1]]){e=b[i][0];l=e.type;j=e.value;
+if(l==="i")k.uniform1i(m,j);else if(l==="f")k.uniform1f(m,j);else if(l==="v2")k.uniform2f(m,j.x,j.y);else if(l==="v3")k.uniform3f(m,j.x,j.y,j.z);else if(l==="v4")k.uniform4f(m,j.x,j.y,j.z,j.w);else if(l==="c")k.uniform3f(m,j.r,j.g,j.b);else if(l==="iv1")k.uniform1iv(m,j);else if(l==="iv")k.uniform3iv(m,j);else if(l==="fv1")k.uniform1fv(m,j);else if(l==="fv")k.uniform3fv(m,j);else if(l==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*j.length);l=0;for(n=j.length;l<n;l++){q=l*2;e._array[q]=
+j[l].x;e._array[q+1]=j[l].y}k.uniform2fv(m,e._array)}else if(l==="v3v"){if(e._array===void 0)e._array=new Float32Array(3*j.length);l=0;for(n=j.length;l<n;l++){q=l*3;e._array[q]=j[l].x;e._array[q+1]=j[l].y;e._array[q+2]=j[l].z}k.uniform3fv(m,e._array)}else if(l==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*j.length);l=0;for(n=j.length;l<n;l++){q=l*4;e._array[q]=j[l].x;e._array[q+1]=j[l].y;e._array[q+2]=j[l].z;e._array[q+3]=j[l].w}k.uniform4fv(m,e._array)}else if(l==="m4"){if(e._array===
+void 0)e._array=new Float32Array(16);j.flattenToArray(e._array);k.uniformMatrix4fv(m,false,e._array)}else if(l==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*j.length);l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(e._array,l*16);k.uniformMatrix4fv(m,false,e._array)}else if(l==="t"){k.uniform1i(m,j);if(m=e.texture)if(m.image instanceof Array&&m.image.length===6){e=m;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=k.createTexture();
+k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,e.flipY);j=[];for(m=0;m<6;m++){l=j;n=m;if(E.autoScaleCubemaps){q=e.image[m];u=Va;if(!(q.width<=u&&q.height<=u)){t=Math.max(q.width,q.height);s=Math.floor(q.width*u/t);u=Math.floor(q.height*u/t);t=document.createElement("canvas");t.width=s;t.height=u;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=t}}else q=e.image[m];l[n]=q}m=j[0];l=(m.width&m.width-1)===0&&
+(m.height&m.height-1)===0;n=D(e.format);q=D(e.type);v(k.TEXTURE_CUBE_MAP,e,l);for(m=0;m<6;m++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n,n,q,j[m]);e.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(m instanceof THREE.WebGLRenderTargetCube){e=m;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.__webglTexture)}else E.setTexture(m,
+j)}else if(l==="tv"){if(e._array===void 0){e._array=[];l=0;for(n=e.texture.length;l<n;l++)e._array[l]=j+l}k.uniform1iv(m,e._array);l=0;for(n=e.texture.length;l<n;l++)(m=e.texture[l])&&E.setTexture(m,e._array[l])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
+d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(dc&&f.useVertexTexture){if(h.boneTexture!==null){k.uniform1i(h.boneTexture,12);E.setTexture(f.boneTexture,12)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,
+false,f.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(a,b,c){if(Oa!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);Oa=a}if(a&&(Pa!==b||bb!==c)){k.polygonOffset(b,c);Pa=b;bb=c}}function t(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);
+if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(b);return null}return c}function v(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,D(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,D(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,D(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,D(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,C(b.magFilter));
+k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter))}Ya&&k.texParameterf(a,Ya.TEXTURE_MAX_ANISOTROPY_EXT,b.anisotropy)}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,
+k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function D(a){return a===THREE.RepeatWrapping?k.REPEAT:a===THREE.ClampToEdgeWrapping?k.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?k.MIRRORED_REPEAT:a===THREE.NearestFilter?k.NEAREST:a===THREE.NearestMipMapNearestFilter?k.NEAREST_MIPMAP_NEAREST:a===
 THREE.NearestMipMapLinearFilter?k.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?k.LINEAR:a===THREE.LinearMipMapNearestFilter?k.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?k.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?k.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?k.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?k.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?k.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?k.BYTE:a===THREE.ShortType?k.SHORT:a===THREE.UnsignedShortType?k.UNSIGNED_SHORT:
 THREE.NearestMipMapLinearFilter?k.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?k.LINEAR:a===THREE.LinearMipMapNearestFilter?k.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?k.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?k.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?k.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?k.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?k.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?k.BYTE:a===THREE.ShortType?k.SHORT:a===THREE.UnsignedShortType?k.UNSIGNED_SHORT:
 a===THREE.IntType?k.INT:a===THREE.UnsignedIntType?k.UNSIGNED_INT:a===THREE.FloatType?k.FLOAT:a===THREE.AlphaFormat?k.ALPHA:a===THREE.RGBFormat?k.RGB:a===THREE.RGBAFormat?k.RGBA:a===THREE.LuminanceFormat?k.LUMINANCE:a===THREE.LuminanceAlphaFormat?k.LUMINANCE_ALPHA:a===THREE.AddEquation?k.FUNC_ADD:a===THREE.SubtractEquation?k.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?k.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?k.ZERO:a===THREE.OneFactor?k.ONE:a===THREE.SrcColorFactor?k.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?
 a===THREE.IntType?k.INT:a===THREE.UnsignedIntType?k.UNSIGNED_INT:a===THREE.FloatType?k.FLOAT:a===THREE.AlphaFormat?k.ALPHA:a===THREE.RGBFormat?k.RGB:a===THREE.RGBAFormat?k.RGBA:a===THREE.LuminanceFormat?k.LUMINANCE:a===THREE.LuminanceAlphaFormat?k.LUMINANCE_ALPHA:a===THREE.AddEquation?k.FUNC_ADD:a===THREE.SubtractEquation?k.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?k.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?k.ZERO:a===THREE.OneFactor?k.ONE:a===THREE.SrcColorFactor?k.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?
-k.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?k.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?k.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?k.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?k.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?k.DST_COLOR:a===THREE.OneMinusDstColorFactor?k.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?k.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),w=a.precision!==void 0?
-a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,E=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,O=a.antialias!==void 0?a.antialias:false,Q=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),J=a.clearAlpha!==void 0?a.clearAlpha:0,P=a.maxLights!==void 0?a.maxLights:4;this.domElement=z;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+k.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?k.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?k.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?k.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?k.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?k.DST_COLOR:a===THREE.OneMinusDstColorFactor?k.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?k.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),u=a.precision!==void 0?
+a.precision:"highp",G=a.alpha!==void 0?a.alpha:true,J=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,M=a.antialias!==void 0?a.antialias:false,O=a.stencil!==void 0?a.stencil:true,X=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),F=a.clearAlpha!==void 0?a.clearAlpha:0,Q=a.maxLights!==void 0?a.maxLights:4;this.domElement=z;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
 this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};
 this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};
-var D=this,W=[],R=0,N=null,ba=null,U=-1,I=null,ca=null,ha=0,L=-1,X=-1,S=-1,T=-1,ia=-1,ma=-1,za=-1,Ga=-1,Oa=null,Pa=null,Ua=null,nb=null,gb=0,Ob=0,ob=0,kb=0,ec=0,Va=0,Da=new THREE.Frustum,Aa=new THREE.Matrix4,hb=new THREE.Matrix4,pa=new THREE.Vector4,Fa=new THREE.Vector3,Ra=true,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},k,Za;try{if(!(k=
-z.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:E,antialias:O,stencil:Q,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";}catch(Gb){console.error(Gb)}a=k.getExtension("OES_texture_float");H=k.getExtension("OES_standard_derivatives");Za=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");a||console.log("THREE.WebGLRenderer: Float textures not supported.");H||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
-Za||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(B.r,B.g,B.b,J);this.context=k;H=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Wa=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),
-cb=Za?k.getParameter(Za.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,pb=H>0,dc=pb&&a;this.getContext=function(){return k};this.supportsVertexTextures=function(){return pb};this.getMaxAnisotropy=function(){return cb};this.setSize=function(a,b){z.width=a;z.height=b;this.setViewport(0,0,z.width,z.height)};this.setViewport=function(a,b,c,d){gb=a;Ob=b;ob=c;kb=d;k.viewport(gb,Ob,ob,kb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};
-this.setClearColorHex=function(a,b){B.setHex(a);J=b;k.clearColor(B.r,B.g,B.b,J)};this.setClearColor=function(a,b){B.copy(a);J=b;k.clearColor(B.r,B.g,B.b,J)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return J};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=
-function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);
-k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=
-0;for(e=c.numMorphNormals;d<e;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}D.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);
-D.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;k.deleteTexture(a.__webglTexture);D.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);
-k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=W.length;a<c;a++){d=W[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=W.length;a<c;a++){d=W[a];d.program!==b&&e.push(d)}W=e;k.deleteProgram(b);D.info.memory.programs--}}};this.updateShadowMap=function(a,b){N=null;U=I=Ga=
-za=S=-1;Ra=true;X=L=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=k.createBuffer();if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,
-a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,j,i,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];j=n[o+4];l=n[o+5];h=n[o+6];i=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+j+i)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+
-7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);
-k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==I){I=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.attributes.position,
-j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,j,k.FLOAT,false,0,g*j*4);h=e.attributes.normal;if(a.normal>=0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,j,k.FLOAT,false,0,g*j*4)}h=e.attributes.uv;if(a.uv>=0&&h)if(h.buffer){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,j,k.FLOAT,false,0,g*j*4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=
-0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.color,j,k.FLOAT,false,0,g*j*4)}h=e.attributes.tangent;if(a.tangent>=0&&h){j=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.tangent,j,k.FLOAT,false,0,g*j*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.info.render.faces+
-f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,j,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==I){I=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,
-3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var i=0;j=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<j.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[i]]);k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[i]]);
-k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[i]=g[j[i]];i++}}else{j=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){i=g[l];i>0&&j.push([l,i])}if(j.length>d.numSupportedMorphTargets){j.sort(h);j.length=d.numSupportedMorphTargets}else j.length>d.numSupportedMorphNormals?j.sort(h):j.length===0&&j.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;){if(j[i]){l=j[i][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);k.vertexAttribPointer(c["morphTarget"+
-i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[i]=g[l]}else{k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[i]=0}i++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
-0;for(j=e.__webglCustomAttributesList.length;g<j;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,
-e.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=
-0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof
-THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==nb){k.lineWidth(d);nb=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+e.__webglFaceCount;D.info.render.faces=D.info.render.faces+e.__webglFaceCount/3}else if(f instanceof
-THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==nb){k.lineWidth(d);nb=d}k.drawArrays(f,0,e.__webglLineCount);D.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);D.info.render.calls++;D.info.render.points=D.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);D.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,o=a.__lights,
-n=a.fog;U=-1;Ra=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Aa.multiply(b.projectionMatrix,
-b.matrixWorldInverse);Da.setFromMatrix(Aa);this.autoUpdateObjects&&this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||
-Da.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=q.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{pa.copy(h.matrixWorld.getPosition());Aa.multiplyVector3(pa);f.z=pa.z}}}this.sortObjects&&
-m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);i(a.__webglObjects,false,"",b,o,n,true,d);l(a.__webglObjectsImmediate,
-"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);i(a.__webglObjects,true,"opaque",b,o,n,false);l(a.__webglObjectsImmediate,"opaque",b,o,n,false);i(a.__webglObjects,false,"transparent",b,o,n,true);l(a.__webglObjectsImmediate,"transparent",b,o,n,true)}j(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);
-k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);I=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Da):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=
-[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,j=void 0,i=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){i=g.geometry;if(i instanceof THREE.Geometry){if(i.geometryGroups===void 0){var q=i,s=void 0,t=void 0,w=void 0,v=void 0,u=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<
-t;s++){w=q.faces[s];v=w.materialIndex;x=v!==void 0?v:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B});u=w instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+u>65535){F[x].counter=F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,
-numMorphNormals:B})}w instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+u}q.geometryGroupsList=[];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=ha++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(j in i.geometryGroups){l=i.geometryGroups[j];if(!l.__webglVertexBuffer){var I=l;I.__webglVertexBuffer=k.createBuffer();I.__webglNormalBuffer=k.createBuffer();I.__webglTangentBuffer=k.createBuffer();
-I.__webglColorBuffer=k.createBuffer();I.__webglUVBuffer=k.createBuffer();I.__webglUV2Buffer=k.createBuffer();I.__webglSkinVertexABuffer=k.createBuffer();I.__webglSkinVertexBBuffer=k.createBuffer();I.__webglSkinIndicesBuffer=k.createBuffer();I.__webglSkinWeightsBuffer=k.createBuffer();I.__webglFaceBuffer=k.createBuffer();I.__webglLineBuffer=k.createBuffer();var X=void 0,L=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];X=0;for(L=I.numMorphTargets;X<L;X++)I.__webglMorphTargetsBuffers.push(k.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=
-[];X=0;for(L=I.numMorphNormals;X<L;X++)I.__webglMorphNormalsBuffers.push(k.createBuffer())}D.info.memory.geometries++;var E=l,J=g,T=J.geometry,O=E.faces3,N=E.faces4,S=O.length*3+N.length*4,U=O.length*1+N.length*2,P=O.length*3+N.length*4,Q=c(J,E),ba=e(Q),R=d(Q),Y=Q.vertexColors?Q.vertexColors:false;E.__vertexArray=new Float32Array(S*3);if(R)E.__normalArray=new Float32Array(S*3);if(T.hasTangents)E.__tangentArray=new Float32Array(S*4);if(Y)E.__colorArray=new Float32Array(S*3);if(ba){if(T.faceUvs.length>
-0||T.faceVertexUvs.length>0)E.__uvArray=new Float32Array(S*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)E.__uv2Array=new Float32Array(S*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){E.__skinVertexAArray=new Float32Array(S*4);E.__skinVertexBArray=new Float32Array(S*4);E.__skinIndexArray=new Float32Array(S*4);E.__skinWeightArray=new Float32Array(S*4)}E.__faceArray=new Uint16Array(U*3);E.__lineArray=new Uint16Array(P*2);var W=void 0,ca=void 0;if(E.numMorphTargets){E.__morphTargetsArrays=
-[];W=0;for(ca=E.numMorphTargets;W<ca;W++)E.__morphTargetsArrays.push(new Float32Array(S*3))}if(E.numMorphNormals){E.__morphNormalsArrays=[];W=0;for(ca=E.numMorphNormals;W<ca;W++)E.__morphNormalsArrays.push(new Float32Array(S*3))}E.__webglFaceCount=U*3;E.__webglLineCount=P*2;if(Q.attributes){if(E.__webglCustomAttributesList===void 0)E.__webglCustomAttributesList=[];var ia=void 0;for(ia in Q.attributes){var Ga=Q.attributes[ia],ma={},za;for(za in Ga)ma[za]=Ga[za];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=
-true;var Ua=1;ma.type==="v2"?Ua=2:ma.type==="v3"?Ua=3:ma.type==="v4"?Ua=4:ma.type==="c"&&(Ua=3);ma.size=Ua;ma.array=new Float32Array(S*Ua);ma.buffer=k.createBuffer();ma.buffer.belongsToAttribute=ia;Ga.needsUpdate=true;ma.__original=Ga}E.__webglCustomAttributesList.push(ma)}}E.__inittedArrays=true;i.verticesNeedUpdate=true;i.morphTargetsNeedUpdate=true;i.elementsNeedUpdate=true;i.uvsNeedUpdate=true;i.normalsNeedUpdate=true;i.tangentsNeedUpdate=true;i.colorsNeedUpdate=true}}}else if(i instanceof THREE.BufferGeometry){var Oa=
-i,Pa=void 0,pa=void 0,ra=void 0;for(Pa in Oa.attributes){ra=Pa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;pa=Oa.attributes[Pa];pa.buffer=k.createBuffer();k.bindBuffer(ra,pa.buffer);k.bufferData(ra,pa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){i=g.geometry;if(!i.__webglVertexBuffer){var Aa=i;Aa.__webglVertexBuffer=k.createBuffer();Aa.__webglColorBuffer=k.createBuffer();D.info.memory.geometries++;var Da=i,Fa=Da.vertices.length;Da.__vertexArray=new Float32Array(Fa*3);Da.__colorArray=
-new Float32Array(Fa*3);Da.__webglVertexCount=Fa;i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){i=g.geometry;if(!i.__webglVertexBuffer){var nb=i;nb.__webglVertexBuffer=k.createBuffer();nb.__webglColorBuffer=k.createBuffer();D.info.memory.geometries++;var gb=i,Wa=g,Ra=gb.vertices.length;gb.__vertexArray=new Float32Array(Ra*3);gb.__colorArray=new Float32Array(Ra*3);gb.__webglLineCount=Ra;b(gb,Wa);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}else if(g instanceof
-THREE.ParticleSystem){i=g.geometry;if(!i.__webglVertexBuffer){var Za=i;Za.__webglVertexBuffer=k.createBuffer();Za.__webglColorBuffer=k.createBuffer();D.info.geometries++;var Va=i,Ob=g,ob=Va.vertices.length;Va.__vertexArray=new Float32Array(ob*3);Va.__colorArray=new Float32Array(ob*3);Va.__sortArray=[];Va.__webglParticleCount=ob;b(Va,Ob);i.verticesNeedUpdate=true;i.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){i=g.geometry;if(i instanceof THREE.BufferGeometry)o(h.__webglObjects,
-i,g);else for(j in i.geometryGroups){l=i.geometryGroups[j];o(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){i=g.geometry;o(h.__webglObjects,i,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,
-1)}for(;a.__objectsRemoved.length;){var db=a.__objectsRemoved[0],kb=a;db instanceof THREE.Mesh||db instanceof THREE.ParticleSystem||db instanceof THREE.Ribbon||db instanceof THREE.Line?r(kb.__webglObjects,db):db instanceof THREE.Sprite?m(kb.__webglSprites,db):db instanceof THREE.LensFlare?m(kb.__webglFlares,db):(db instanceof THREE.ImmediateRenderObject||db.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,db);db.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,pb=a.__webglObjects.length;hb<
-pb;hb++){var lb=a.__webglObjects[hb].object,da=lb.geometry,cb=void 0,oc=void 0,Xa=void 0;if(lb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate){var Ib=da,pc=k.DYNAMIC_DRAW,ec=!da.dynamic,qc=Ib.attributes,Gb=qc.index,dc=qc.position,Yc=qc.normal,Zc=qc.uv,$c=qc.color,ad=qc.tangent;if(Ib.elementsNeedUpdate&&Gb!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Gb.buffer);
-k.bufferData(k.ELEMENT_ARRAY_BUFFER,Gb.array,pc)}if(Ib.verticesNeedUpdate&&dc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,dc.buffer);k.bufferData(k.ARRAY_BUFFER,dc.array,pc)}if(Ib.normalsNeedUpdate&&Yc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,pc)}if(Ib.uvsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,pc)}if(Ib.colorsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,
-$c.array,pc)}if(Ib.tangentsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,pc)}if(ec){var md=void 0;for(md in Ib.attributes)delete Ib.attributes[md].array}}da.verticesNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false}else{for(var bd=0,yd=da.geometryGroupsList.length;bd<yd;bd++){cb=da.geometryGroupsList[bd];Xa=c(lb,cb);oc=Xa.attributes&&n(Xa);if(da.verticesNeedUpdate||
-da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||oc){var fa=cb,zd=lb,$a=k.DYNAMIC_DRAW,Ad=!da.dynamic,hc=Xa;if(fa.__inittedArrays){var nd=d(hc),cd=hc.vertexColors?hc.vertexColors:false,od=e(hc),Kc=nd===THREE.SmoothShading,G=void 0,V=void 0,jb=void 0,M=void 0,rc=void 0,Rb=void 0,mb=void 0,Lc=void 0,Jb=void 0,sc=void 0,tc=void 0,Z=void 0,$=void 0,aa=void 0,na=void 0,qb=void 0,rb=void 0,sb=void 0,xc=void 0,tb=void 0,
-ub=void 0,vb=void 0,yc=void 0,wb=void 0,xb=void 0,yb=void 0,zc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Ac=void 0,Cb=void 0,Db=void 0,Eb=void 0,Bc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Mc=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Nc=void 0,ja=void 0,pd=void 0,Yb=void 0,uc=void 0,vc=void 0,Ja=void 0,qd=void 0,Ha=void 0,Ia=void 0,Zb=void 0,Kb=void 0,ya=0,Ea=0,Lb=0,Mb=0,eb=0,Qa=0,oa=0,Sa=0,Ba=0,K=0,ea=0,A=0,ab=void 0,Ka=fa.__vertexArray,Cc=fa.__uvArray,Dc=fa.__uv2Array,fb=fa.__normalArray,sa=fa.__tangentArray,
-La=fa.__colorArray,ta=fa.__skinVertexAArray,ua=fa.__skinVertexBArray,va=fa.__skinIndexArray,wa=fa.__skinWeightArray,dd=fa.__morphTargetsArrays,ed=fa.__morphNormalsArrays,fd=fa.__webglCustomAttributesList,y=void 0,Fb=fa.__faceArray,bb=fa.__lineArray,Ta=zd.geometry,Bd=Ta.elementsNeedUpdate,rd=Ta.uvsNeedUpdate,Cd=Ta.normalsNeedUpdate,Dd=Ta.tangentsNeedUpdate,Ed=Ta.colorsNeedUpdate,Fd=Ta.morphTargetsNeedUpdate,ic=Ta.vertices,ka=fa.faces3,la=fa.faces4,Ca=Ta.faces,gd=Ta.faceVertexUvs[0],hd=Ta.faceVertexUvs[1],
-jc=Ta.skinVerticesA,kc=Ta.skinVerticesB,lc=Ta.skinIndices,$b=Ta.skinWeights,ac=Ta.morphTargets,Oc=Ta.morphNormals;if(Ta.verticesNeedUpdate){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=ic[M.a];$=ic[M.b];aa=ic[M.c];Ka[Ea]=Z.x;Ka[Ea+1]=Z.y;Ka[Ea+2]=Z.z;Ka[Ea+3]=$.x;Ka[Ea+4]=$.y;Ka[Ea+5]=$.z;Ka[Ea+6]=aa.x;Ka[Ea+7]=aa.y;Ka[Ea+8]=aa.z;Ea=Ea+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=ic[M.a];$=ic[M.b];aa=ic[M.c];na=ic[M.d];Ka[Ea]=Z.x;Ka[Ea+1]=Z.y;Ka[Ea+2]=Z.z;Ka[Ea+3]=$.x;Ka[Ea+4]=$.y;Ka[Ea+5]=$.z;Ka[Ea+
-6]=aa.x;Ka[Ea+7]=aa.y;Ka[Ea+8]=aa.z;Ka[Ea+9]=na.x;Ka[Ea+10]=na.y;Ka[Ea+11]=na.z;Ea=Ea+12}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ka,$a)}if(Fd){Ja=0;for(qd=ac.length;Ja<qd;Ja++){G=ea=0;for(V=ka.length;G<V;G++){Zb=ka[G];M=Ca[Zb];Z=ac[Ja].vertices[M.a];$=ac[Ja].vertices[M.b];aa=ac[Ja].vertices[M.c];Ha=dd[Ja];Ha[ea]=Z.x;Ha[ea+1]=Z.y;Ha[ea+2]=Z.z;Ha[ea+3]=$.x;Ha[ea+4]=$.y;Ha[ea+5]=$.z;Ha[ea+6]=aa.x;Ha[ea+7]=aa.y;Ha[ea+8]=aa.z;if(hc.morphNormals){if(Kc){Kb=Oc[Ja].vertexNormals[Zb];
-tb=Kb.a;ub=Kb.b;vb=Kb.c}else vb=ub=tb=Oc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z}ea=ea+9}G=0;for(V=la.length;G<V;G++){Zb=la[G];M=Ca[Zb];Z=ac[Ja].vertices[M.a];$=ac[Ja].vertices[M.b];aa=ac[Ja].vertices[M.c];na=ac[Ja].vertices[M.d];Ha=dd[Ja];Ha[ea]=Z.x;Ha[ea+1]=Z.y;Ha[ea+2]=Z.z;Ha[ea+3]=$.x;Ha[ea+4]=$.y;Ha[ea+5]=$.z;Ha[ea+6]=aa.x;Ha[ea+7]=aa.y;Ha[ea+8]=aa.z;Ha[ea+9]=na.x;Ha[ea+10]=na.y;
-Ha[ea+11]=na.z;if(hc.morphNormals){if(Kc){Kb=Oc[Ja].vertexNormals[Zb];tb=Kb.a;ub=Kb.b;vb=Kb.c;yc=Kb.d}else yc=vb=ub=tb=Oc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z;Ia[ea+9]=yc.x;Ia[ea+10]=yc.y;Ia[ea+11]=yc.z}ea=ea+12}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[Ja]);k.bufferData(k.ARRAY_BUFFER,dd[Ja],$a);if(hc.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[Ja]);
-k.bufferData(k.ARRAY_BUFFER,ed[Ja],$a)}}}if($b.length){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];wa[K]=zb.x;wa[K+1]=zb.y;wa[K+2]=zb.z;wa[K+3]=zb.w;wa[K+4]=Ab.x;wa[K+5]=Ab.y;wa[K+6]=Ab.z;wa[K+7]=Ab.w;wa[K+8]=Bb.x;wa[K+9]=Bb.y;wa[K+10]=Bb.z;wa[K+11]=Bb.w;Cb=lc[M.a];Db=lc[M.b];Eb=lc[M.c];va[K]=Cb.x;va[K+1]=Cb.y;va[K+2]=Cb.z;va[K+3]=Cb.w;va[K+4]=Db.x;va[K+5]=Db.y;va[K+6]=Db.z;va[K+7]=Db.w;va[K+8]=Eb.x;va[K+9]=Eb.y;va[K+10]=Eb.z;va[K+11]=Eb.w;Sb=jc[M.a];Tb=jc[M.b];Ub=jc[M.c];
-ta[K]=Sb.x;ta[K+1]=Sb.y;ta[K+2]=Sb.z;ta[K+3]=1;ta[K+4]=Tb.x;ta[K+5]=Tb.y;ta[K+6]=Tb.z;ta[K+7]=1;ta[K+8]=Ub.x;ta[K+9]=Ub.y;ta[K+10]=Ub.z;ta[K+11]=1;Vb=kc[M.a];Wb=kc[M.b];Xb=kc[M.c];ua[K]=Vb.x;ua[K+1]=Vb.y;ua[K+2]=Vb.z;ua[K+3]=1;ua[K+4]=Wb.x;ua[K+5]=Wb.y;ua[K+6]=Wb.z;ua[K+7]=1;ua[K+8]=Xb.x;ua[K+9]=Xb.y;ua[K+10]=Xb.z;ua[K+11]=1;K=K+12}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];zb=$b[M.a];Ab=$b[M.b];Bb=$b[M.c];Ac=$b[M.d];wa[K]=zb.x;wa[K+1]=zb.y;wa[K+2]=zb.z;wa[K+3]=zb.w;wa[K+4]=Ab.x;wa[K+5]=Ab.y;wa[K+6]=
-Ab.z;wa[K+7]=Ab.w;wa[K+8]=Bb.x;wa[K+9]=Bb.y;wa[K+10]=Bb.z;wa[K+11]=Bb.w;wa[K+12]=Ac.x;wa[K+13]=Ac.y;wa[K+14]=Ac.z;wa[K+15]=Ac.w;Cb=lc[M.a];Db=lc[M.b];Eb=lc[M.c];Bc=lc[M.d];va[K]=Cb.x;va[K+1]=Cb.y;va[K+2]=Cb.z;va[K+3]=Cb.w;va[K+4]=Db.x;va[K+5]=Db.y;va[K+6]=Db.z;va[K+7]=Db.w;va[K+8]=Eb.x;va[K+9]=Eb.y;va[K+10]=Eb.z;va[K+11]=Eb.w;va[K+12]=Bc.x;va[K+13]=Bc.y;va[K+14]=Bc.z;va[K+15]=Bc.w;Sb=jc[M.a];Tb=jc[M.b];Ub=jc[M.c];Mc=jc[M.d];ta[K]=Sb.x;ta[K+1]=Sb.y;ta[K+2]=Sb.z;ta[K+3]=1;ta[K+4]=Tb.x;ta[K+5]=Tb.y;
-ta[K+6]=Tb.z;ta[K+7]=1;ta[K+8]=Ub.x;ta[K+9]=Ub.y;ta[K+10]=Ub.z;ta[K+11]=1;ta[K+12]=Mc.x;ta[K+13]=Mc.y;ta[K+14]=Mc.z;ta[K+15]=1;Vb=kc[M.a];Wb=kc[M.b];Xb=kc[M.c];Nc=kc[M.d];ua[K]=Vb.x;ua[K+1]=Vb.y;ua[K+2]=Vb.z;ua[K+3]=1;ua[K+4]=Wb.x;ua[K+5]=Wb.y;ua[K+6]=Wb.z;ua[K+7]=1;ua[K+8]=Xb.x;ua[K+9]=Xb.y;ua[K+10]=Xb.z;ua[K+11]=1;ua[K+12]=Nc.x;ua[K+13]=Nc.y;ua[K+14]=Nc.z;ua[K+15]=1;K=K+16}if(K>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinVertexABuffer);k.bufferData(k.ARRAY_BUFFER,ta,$a);k.bindBuffer(k.ARRAY_BUFFER,
-fa.__webglSkinVertexBBuffer);k.bufferData(k.ARRAY_BUFFER,ua,$a);k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,va,$a);k.bindBuffer(k.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,wa,$a)}}if(Ed&&cd){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];mb=M.vertexColors;Lc=M.color;if(mb.length===3&&cd===THREE.VertexColors){wb=mb[0];xb=mb[1];yb=mb[2]}else yb=xb=wb=Lc;La[Ba]=wb.r;La[Ba+1]=wb.g;La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+
-6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;Ba=Ba+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];mb=M.vertexColors;Lc=M.color;if(mb.length===4&&cd===THREE.VertexColors){wb=mb[0];xb=mb[1];yb=mb[2];zc=mb[3]}else zc=yb=xb=wb=Lc;La[Ba]=wb.r;La[Ba+1]=wb.g;La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;La[Ba+9]=zc.r;La[Ba+10]=zc.g;La[Ba+11]=zc.b;Ba=Ba+12}if(Ba>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,La,$a)}}if(Dd&&Ta.hasTangents){G=
-0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Jb=M.vertexTangents;qb=Jb[0];rb=Jb[1];sb=Jb[2];sa[oa]=qb.x;sa[oa+1]=qb.y;sa[oa+2]=qb.z;sa[oa+3]=qb.w;sa[oa+4]=rb.x;sa[oa+5]=rb.y;sa[oa+6]=rb.z;sa[oa+7]=rb.w;sa[oa+8]=sb.x;sa[oa+9]=sb.y;sa[oa+10]=sb.z;sa[oa+11]=sb.w;oa=oa+12}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Jb=M.vertexTangents;qb=Jb[0];rb=Jb[1];sb=Jb[2];xc=Jb[3];sa[oa]=qb.x;sa[oa+1]=qb.y;sa[oa+2]=qb.z;sa[oa+3]=qb.w;sa[oa+4]=rb.x;sa[oa+5]=rb.y;sa[oa+6]=rb.z;sa[oa+7]=rb.w;sa[oa+8]=sb.x;sa[oa+9]=sb.y;sa[oa+
-10]=sb.z;sa[oa+11]=sb.w;sa[oa+12]=xc.x;sa[oa+13]=xc.y;sa[oa+14]=xc.z;sa[oa+15]=xc.w;oa=oa+16}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,sa,$a)}if(Cd&&nd){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];rc=M.vertexNormals;Rb=M.normal;if(rc.length===3&&Kc)for(ja=0;ja<3;ja++){Yb=rc[ja];fb[Qa]=Yb.x;fb[Qa+1]=Yb.y;fb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<3;ja++){fb[Qa]=Rb.x;fb[Qa+1]=Rb.y;fb[Qa+2]=Rb.z;Qa=Qa+3}}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];rc=M.vertexNormals;Rb=M.normal;
-if(rc.length===4&&Kc)for(ja=0;ja<4;ja++){Yb=rc[ja];fb[Qa]=Yb.x;fb[Qa+1]=Yb.y;fb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<4;ja++){fb[Qa]=Rb.x;fb[Qa+1]=Rb.y;fb[Qa+2]=Rb.z;Qa=Qa+3}}k.bindBuffer(k.ARRAY_BUFFER,fa.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,fb,$a)}if(rd&&gd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Ca[jb];sc=gd[jb];if(sc!==void 0)for(ja=0;ja<3;ja++){uc=sc[ja];Cc[Lb]=uc.u;Cc[Lb+1]=uc.v;Lb=Lb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Ca[jb];sc=gd[jb];if(sc!==void 0)for(ja=0;ja<4;ja++){uc=
-sc[ja];Cc[Lb]=uc.u;Cc[Lb+1]=uc.v;Lb=Lb+2}}if(Lb>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,Cc,$a)}}if(rd&&hd&&od){G=0;for(V=ka.length;G<V;G++){jb=ka[G];M=Ca[jb];tc=hd[jb];if(tc!==void 0)for(ja=0;ja<3;ja++){vc=tc[ja];Dc[Mb]=vc.u;Dc[Mb+1]=vc.v;Mb=Mb+2}}G=0;for(V=la.length;G<V;G++){jb=la[G];M=Ca[jb];tc=hd[jb];if(tc!==void 0)for(ja=0;ja<4;ja++){vc=tc[ja];Dc[Mb]=vc.u;Dc[Mb+1]=vc.v;Mb=Mb+2}}if(Mb>0){k.bindBuffer(k.ARRAY_BUFFER,fa.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,
-Dc,$a)}}if(Bd){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Fb[eb]=ya;Fb[eb+1]=ya+1;Fb[eb+2]=ya+2;eb=eb+3;bb[Sa]=ya;bb[Sa+1]=ya+1;bb[Sa+2]=ya;bb[Sa+3]=ya+2;bb[Sa+4]=ya+1;bb[Sa+5]=ya+2;Sa=Sa+6;ya=ya+3}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Fb[eb]=ya;Fb[eb+1]=ya+1;Fb[eb+2]=ya+3;Fb[eb+3]=ya+1;Fb[eb+4]=ya+2;Fb[eb+5]=ya+3;eb=eb+6;bb[Sa]=ya;bb[Sa+1]=ya+1;bb[Sa+2]=ya;bb[Sa+3]=ya+3;bb[Sa+4]=ya+1;bb[Sa+5]=ya+2;bb[Sa+6]=ya+2;bb[Sa+7]=ya+3;Sa=Sa+8;ya=ya+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);
-k.bufferData(k.ELEMENT_ARRAY_BUFFER,Fb,$a);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,bb,$a)}if(fd){ja=0;for(pd=fd.length;ja<pd;ja++){y=fd[ja];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];A=A+3}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];
-y.array[A+2]=y.value[M.c];y.array[A+3]=y.value[M.d];A=A+4}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){ab=y.value[ka[G]];y.array[A]=ab;y.array[A+1]=ab;y.array[A+2]=ab;A=A+3}G=0;for(V=la.length;G<V;G++){ab=y.value[la[G]];y.array[A]=ab;y.array[A+1]=ab;y.array[A+2]=ab;y.array[A+3]=ab;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=
-$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}else{if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=ab=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;A=A+6}G=
-0;for(V=la.length;G<V;G++){na=aa=$=Z=ab=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=$.x;y.array[A+3]=$.y;y.array[A+4]=aa.x;y.array[A+5]=aa.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}}else if(y.size===3){var ga;ga=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+
-4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){M=Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}else if(y.boundTo===
-"faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=ab=y.value[ka[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];y.array[A+8]=aa[ga[2]];A=A+9}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=ab=y.value[la[G]];y.array[A]=Z[ga[0]];y.array[A+1]=Z[ga[1]];y.array[A+2]=Z[ga[2]];y.array[A+3]=$[ga[0]];y.array[A+4]=$[ga[1]];y.array[A+5]=$[ga[2]];y.array[A+6]=aa[ga[0]];y.array[A+7]=aa[ga[1]];
-y.array[A+8]=aa[ga[2]];y.array[A+9]=na[ga[0]];y.array[A+10]=na[ga[1]];y.array[A+11]=na[ga[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){G=0;for(V=ka.length;G<V;G++){M=Ca[ka[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){M=
-Ca[la[G]];Z=y.value[M.a];$=y.value[M.b];aa=y.value[M.c];na=y.value[M.d];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}else if(y.boundTo==="faces"){G=0;for(V=ka.length;G<V;G++){aa=$=Z=ab=y.value[ka[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+
-3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;A=A+12}G=0;for(V=la.length;G<V;G++){na=aa=$=Z=ab=y.value[la[G]];y.array[A]=Z.x;y.array[A+1]=Z.y;y.array[A+2]=Z.z;y.array[A+3]=Z.w;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=$.z;y.array[A+7]=$.w;y.array[A+8]=aa.x;y.array[A+9]=aa.y;y.array[A+10]=aa.z;y.array[A+11]=aa.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+
-16}}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,$a)}}}if(Ad){delete fa.__inittedArrays;delete fa.__colorArray;delete fa.__normalArray;delete fa.__tangentArray;delete fa.__uvArray;delete fa.__uv2Array;delete fa.__faceArray;delete fa.__vertexArray;delete fa.__lineArray;delete fa.__skinVertexAArray;delete fa.__skinVertexBArray;delete fa.__skinIndexArray;delete fa.__skinWeightArray}}}}da.verticesNeedUpdate=false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;
-da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false;Xa.attributes&&p(Xa)}else if(lb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var bc=da,sd=k.DYNAMIC_DRAW,Ec=void 0,Fc=void 0,Pc=void 0,cc=void 0,Qc=void 0,td=bc.vertices,ud=bc.colors,Gd=td.length,Hd=ud.length,Rc=bc.__vertexArray,Sc=bc.__colorArray,Id=bc.colorsNeedUpdate;if(bc.verticesNeedUpdate){for(Ec=0;Ec<Gd;Ec++){Pc=td[Ec];cc=Ec*3;Rc[cc]=Pc.x;Rc[cc+1]=Pc.y;Rc[cc+2]=
-Pc.z}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Rc,sd)}if(Id){for(Fc=0;Fc<Hd;Fc++){Qc=ud[Fc];cc=Fc*3;Sc[cc]=Qc.r;Sc[cc+1]=Qc.g;Sc[cc+2]=Qc.b}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Sc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false}else if(lb instanceof THREE.Line){Xa=c(lb,cb);oc=Xa.attributes&&n(Xa);if(da.verticesNeedUpdate||da.colorsNeedUpdate||oc){var Nb=da,id=k.DYNAMIC_DRAW,Gc=void 0,Hc=void 0,Tc=void 0,xa=
-void 0,Uc=void 0,vd=Nb.vertices,wd=Nb.colors,Jd=vd.length,Kd=wd.length,Vc=Nb.__vertexArray,Wc=Nb.__colorArray,Ld=Nb.colorsNeedUpdate,jd=Nb.__webglCustomAttributesList,Xc=void 0,xd=void 0,Na=void 0,wc=void 0,Ya=void 0,qa=void 0;if(Nb.verticesNeedUpdate){for(Gc=0;Gc<Jd;Gc++){Tc=vd[Gc];xa=Gc*3;Vc[xa]=Tc.x;Vc[xa+1]=Tc.y;Vc[xa+2]=Tc.z}k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Vc,id)}if(Ld){for(Hc=0;Hc<Kd;Hc++){Uc=wd[Hc];xa=Hc*3;Wc[xa]=Uc.r;Wc[xa+1]=Uc.g;Wc[xa+2]=Uc.b}k.bindBuffer(k.ARRAY_BUFFER,
-Nb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Wc,id)}if(jd){Xc=0;for(xd=jd.length;Xc<xd;Xc++){qa=jd[Xc];if(qa.needsUpdate&&(qa.boundTo===void 0||qa.boundTo==="vertices")){xa=0;wc=qa.value.length;if(qa.size===1)for(Na=0;Na<wc;Na++)qa.array[Na]=qa.value[Na];else if(qa.size===2)for(Na=0;Na<wc;Na++){Ya=qa.value[Na];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;xa=xa+2}else if(qa.size===3)if(qa.type==="c")for(Na=0;Na<wc;Na++){Ya=qa.value[Na];qa.array[xa]=Ya.r;qa.array[xa+1]=Ya.g;qa.array[xa+2]=Ya.b;xa=xa+
-3}else for(Na=0;Na<wc;Na++){Ya=qa.value[Na];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;qa.array[xa+2]=Ya.z;xa=xa+3}else if(qa.size===4)for(Na=0;Na<wc;Na++){Ya=qa.value[Na];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;qa.array[xa+2]=Ya.z;qa.array[xa+3]=Ya.w;xa=xa+4}k.bindBuffer(k.ARRAY_BUFFER,qa.buffer);k.bufferData(k.ARRAY_BUFFER,qa.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}else if(lb instanceof THREE.ParticleSystem){Xa=c(lb,cb);oc=Xa.attributes&&n(Xa);(da.verticesNeedUpdate||
-da.colorsNeedUpdate||lb.sortParticles||oc)&&f(da,k.DYNAMIC_DRAW,lb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof
-THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var n,p;n=g=e=o=0;for(f=b.length;n<f;n++){p=b[n];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&g++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&o++}}if(e+o+g<=P){n=g;f=e}else{n=Math.ceil(P*g/(e+g));o=f=P-n}e=n;g=o;o=l=0;for(n=b.length;o<n;o++){p=b[o];if(p.castShadow){p instanceof
-THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(dc&&d&&d.useVertexTexture)j=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}j=b}var r;a:{p=a.fragmentShader;n=a.vertexShader;var o=a.uniforms,b=a.attributes,c={map:!!a.map,
-envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:j,useVertexTexture:dc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&
-d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(m)d.push(m);else{d.push(p);d.push(n)}for(q in c){d.push(q);d.push(c[q])}m=d.join();q=0;for(d=W.length;q<d;q++){e=W[q];if(e.code===m){e.usedTimes++;r=e.program;break a}}q=k.createProgram();d=["precision "+w+" float;",pb?"#define VERTEX_TEXTURES":"",D.gammaInput?
-"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?
-"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
-"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e=["precision "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
+var E=this,aa=[],T=0,N=null,W=null,ba=-1,H=null,ca=null,ia=0,S=-1,R=-1,P=-1,U=-1,fa=-1,ma=-1,Ga=-1,na=-1,Oa=null,Pa=null,bb=null,nb=null,gb=0,Ob=0,ob=0,kb=0,ec=0,Ua=0,Da=new THREE.Frustum,Aa=new THREE.Matrix4,hb=new THREE.Matrix4,qa=new THREE.Vector4,Fa=new THREE.Vector3,Ra=true,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},k,Ya;try{if(!(k=
+z.getContext("experimental-webgl",{alpha:G,premultipliedAlpha:J,antialias:M,stencil:O,preserveDrawingBuffer:X})))throw"Error creating WebGL context.";}catch(Gb){console.error(Gb)}a=k.getExtension("OES_texture_float");G=k.getExtension("OES_standard_derivatives");Ya=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");a||console.log("THREE.WebGLRenderer: Float textures not supported.");G||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
+Ya||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(B.r,B.g,B.b,F);this.context=k;G=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Va=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),
+cb=Ya?k.getParameter(Ya.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,pb=G>0,dc=pb&&a;this.getContext=function(){return k};this.supportsVertexTextures=function(){return pb};this.getMaxAnisotropy=function(){return cb};this.setSize=function(a,b){z.width=a;z.height=b;this.setViewport(0,0,z.width,z.height)};this.setViewport=function(a,b,c,d){gb=a!==void 0?a:0;Ob=b!==void 0?b:0;ob=c!==void 0?c:z.width;kb=d!==void 0?d:z.height;k.viewport(gb,Ob,ob,kb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=
+function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);F=b;k.clearColor(B.r,B.g,B.b,F)};this.setClearColor=function(a,b){B.copy(a);F=b;k.clearColor(B.r,B.g,B.b,F)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return F};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,
+c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];
+k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=
+0;for(e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}E.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof
+THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;k.deleteTexture(a.__webglTexture);E.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);
+if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=aa.length;a<c;a++){d=aa[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=aa.length;a<c;a++){d=aa[a];d.program!==
+b&&e.push(d)}aa=e;k.deleteProgram(b);E.info.memory.programs--}}};this.updateShadowMap=function(a,b){N=null;ba=H=na=Ga=P=-1;Ra=true;R=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=
+k.createBuffer();if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,m,l,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];i=n[o+4];m=n[o+5];h=n[o+6];j=n[o+
+7];l=n[o+8];d=(d+g+h)/3;e=(e+i+j)/3;f=(f+m+l)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,
+false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==H){H=d;b=true}if(f instanceof
+THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,g*i*4);h=e.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,i,k.FLOAT,false,0,g*i*4)}h=e.attributes.uv;if(a.uv>=0&&h)if(h.buffer){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,
+i,k.FLOAT,false,0,g*i*4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.color,i,k.FLOAT,false,0,g*i*4)}h=e.attributes.tangent;if(a.tangent>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.tangent,i,k.FLOAT,false,0,g*i*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,
+f[d].start*2);E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+f[d].count;E.info.render.faces=E.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==H){H=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;
+if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<i.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[j]]);k.vertexAttribPointer(c["morphTarget"+
+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[j]]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[i[j]];j++}}else{i=[];g=f.morphTargetInfluences;var m,l=g.length;for(m=0;m<l;m++){j=g[m];j>0&&i.push([m,j])}if(i.length>d.numSupportedMorphTargets){i.sort(h);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(h):i.length===0&&i.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(i[j]){m=
+i[j][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[m]}else{k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==
+null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=
+0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);
+k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,
+4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==nb){k.lineWidth(d);nb=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}E.info.render.calls++;
+E.info.render.vertices=E.info.render.vertices+e.__webglFaceCount;E.info.render.faces=E.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==nb){k.lineWidth(d);nb=d}k.drawArrays(f,0,e.__webglLineCount);E.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);E.info.render.calls++;E.info.render.points=E.info.render.points+e.__webglParticleCount}else if(f instanceof
+THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);E.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;ba=-1;Ra=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);
+b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);Da.setFromMatrix(Aa);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;
+for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Da.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=q.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=
+null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{qa.copy(h.matrixWorld.getPosition());Aa.multiplyVector3(qa);f.z=qa.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);
+this.setDepthWrite(d.depthWrite);w(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
+c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);H=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,
+k,Da):e.render(function(a){E.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=
+j,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,z=void 0,C={},D=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];v=u.materialIndex;x=v!==void 0?v:-1;C[x]===void 0&&(C[x]={hash:x,counter:0});z=C[x].hash+"_"+C[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:D,numMorphNormals:B});w=u instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+w>65535){C[x].counter=
+C[x].counter+1;z=C[x].hash+"_"+C[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:D,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+w}q.geometryGroupsList=[];var R=void 0;for(R in q.geometryGroups){q.geometryGroups[R].id=ia++;q.geometryGroupsList.push(q.geometryGroups[R])}}for(i in j.geometryGroups){l=
+j.geometryGroups[i];if(!l.__webglVertexBuffer){var H=l;H.__webglVertexBuffer=k.createBuffer();H.__webglNormalBuffer=k.createBuffer();H.__webglTangentBuffer=k.createBuffer();H.__webglColorBuffer=k.createBuffer();H.__webglUVBuffer=k.createBuffer();H.__webglUV2Buffer=k.createBuffer();H.__webglSkinVertexABuffer=k.createBuffer();H.__webglSkinVertexBBuffer=k.createBuffer();H.__webglSkinIndicesBuffer=k.createBuffer();H.__webglSkinWeightsBuffer=k.createBuffer();H.__webglFaceBuffer=k.createBuffer();H.__webglLineBuffer=
+k.createBuffer();var G=void 0,P=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];G=0;for(P=H.numMorphTargets;G<P;G++)H.__webglMorphTargetsBuffers.push(k.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];G=0;for(P=H.numMorphNormals;G<P;G++)H.__webglMorphNormalsBuffers.push(k.createBuffer())}E.info.memory.geometries++;var F=l,J=g,U=J.geometry,M=F.faces3,N=F.faces4,O=M.length*3+N.length*4,W=M.length*1+N.length*2,S=M.length*3+N.length*4,Q=c(J,F),X=e(Q),T=d(Q),ba=Q.vertexColors?
+Q.vertexColors:false;F.__vertexArray=new Float32Array(O*3);if(T)F.__normalArray=new Float32Array(O*3);if(U.hasTangents)F.__tangentArray=new Float32Array(O*4);if(ba)F.__colorArray=new Float32Array(O*3);if(X){if(U.faceUvs.length>0||U.faceVertexUvs.length>0)F.__uvArray=new Float32Array(O*2);if(U.faceUvs.length>1||U.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(O*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){F.__skinVertexAArray=new Float32Array(O*4);F.__skinVertexBArray=
+new Float32Array(O*4);F.__skinIndexArray=new Float32Array(O*4);F.__skinWeightArray=new Float32Array(O*4)}F.__faceArray=new Uint16Array(W*3);F.__lineArray=new Uint16Array(S*2);var fa=void 0,ca=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];fa=0;for(ca=F.numMorphTargets;fa<ca;fa++)F.__morphTargetsArrays.push(new Float32Array(O*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];fa=0;for(ca=F.numMorphNormals;fa<ca;fa++)F.__morphNormalsArrays.push(new Float32Array(O*3))}F.__webglFaceCount=W*3;
+F.__webglLineCount=S*2;if(Q.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];var aa=void 0;for(aa in Q.attributes){var na=Q.attributes[aa],ma={},bb;for(bb in na)ma[bb]=na[bb];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Ga=1;ma.type==="v2"?Ga=2:ma.type==="v3"?Ga=3:ma.type==="v4"?Ga=4:ma.type==="c"&&(Ga=3);ma.size=Ga;ma.array=new Float32Array(O*Ga);ma.buffer=k.createBuffer();ma.buffer.belongsToAttribute=aa;na.needsUpdate=true;
+ma.__original=na}F.__webglCustomAttributesList.push(ma)}}F.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangentsNeedUpdate=true;j.colorsNeedUpdate=true}}}else if(j instanceof THREE.BufferGeometry){var Oa=j,Pa=void 0,qa=void 0,sa=void 0;for(Pa in Oa.attributes){sa=Pa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;qa=Oa.attributes[Pa];qa.buffer=k.createBuffer();k.bindBuffer(sa,qa.buffer);k.bufferData(sa,
+qa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Aa=j;Aa.__webglVertexBuffer=k.createBuffer();Aa.__webglColorBuffer=k.createBuffer();E.info.memory.geometries++;var Da=j,Fa=Da.vertices.length;Da.__vertexArray=new Float32Array(Fa*3);Da.__colorArray=new Float32Array(Fa*3);Da.__webglVertexCount=Fa;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var nb=j;nb.__webglVertexBuffer=
+k.createBuffer();nb.__webglColorBuffer=k.createBuffer();E.info.memory.geometries++;var gb=j,Va=g,Ra=gb.vertices.length;gb.__vertexArray=new Float32Array(Ra*3);gb.__colorArray=new Float32Array(Ra*3);gb.__webglLineCount=Ra;b(gb,Va);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Ya=j;Ya.__webglVertexBuffer=k.createBuffer();Ya.__webglColorBuffer=k.createBuffer();E.info.geometries++;var Ua=j,Ob=g,ob=Ua.vertices.length;
+Ua.__vertexArray=new Float32Array(ob*3);Ua.__colorArray=new Float32Array(ob*3);Ua.__sortArray=[];Ua.__webglParticleCount=ob;b(Ua,Ob);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)m(h.__webglObjects,j,g);else for(i in j.geometryGroups){l=j.geometryGroups[i];m(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;m(h.__webglObjects,
+j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var db=a.__objectsRemoved[0],kb=a;db instanceof THREE.Mesh||db instanceof THREE.ParticleSystem||db instanceof THREE.Ribbon||db instanceof THREE.Line?r(kb.__webglObjects,
+db):db instanceof THREE.Sprite?o(kb.__webglSprites,db):db instanceof THREE.LensFlare?o(kb.__webglFlares,db):(db instanceof THREE.ImmediateRenderObject||db.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,db);db.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,pb=a.__webglObjects.length;hb<pb;hb++){var lb=a.__webglObjects[hb].object,da=lb.geometry,cb=void 0,oc=void 0,Wa=void 0;if(lb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||da.elementsNeedUpdate||
+da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate){var Ib=da,pc=k.DYNAMIC_DRAW,ec=!da.dynamic,qc=Ib.attributes,Gb=qc.index,dc=qc.position,Yc=qc.normal,Zc=qc.uv,$c=qc.color,ad=qc.tangent;if(Ib.elementsNeedUpdate&&Gb!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Gb.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Gb.array,pc)}if(Ib.verticesNeedUpdate&&dc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,dc.buffer);k.bufferData(k.ARRAY_BUFFER,dc.array,pc)}if(Ib.normalsNeedUpdate&&Yc!==
+void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,pc)}if(Ib.uvsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,pc)}if(Ib.colorsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,pc)}if(Ib.tangentsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,pc)}if(ec){var md=void 0;for(md in Ib.attributes)delete Ib.attributes[md].array}}da.verticesNeedUpdate=
+false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false}else{for(var bd=0,yd=da.geometryGroupsList.length;bd<yd;bd++){cb=da.geometryGroupsList[bd];Wa=c(lb,cb);oc=Wa.attributes&&n(Wa);if(da.verticesNeedUpdate||da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||oc){var ga=cb,zd=lb,Za=k.DYNAMIC_DRAW,Ad=!da.dynamic,hc=Wa;if(ga.__inittedArrays){var nd=
+d(hc),cd=hc.vertexColors?hc.vertexColors:false,od=e(hc),Kc=nd===THREE.SmoothShading,I=void 0,V=void 0,jb=void 0,L=void 0,rc=void 0,Rb=void 0,mb=void 0,Lc=void 0,Jb=void 0,sc=void 0,tc=void 0,Y=void 0,Z=void 0,$=void 0,oa=void 0,qb=void 0,rb=void 0,sb=void 0,xc=void 0,tb=void 0,ub=void 0,vb=void 0,yc=void 0,wb=void 0,xb=void 0,yb=void 0,zc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Ac=void 0,Cb=void 0,Db=void 0,Eb=void 0,Bc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Mc=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Nc=
+void 0,ja=void 0,pd=void 0,Yb=void 0,uc=void 0,vc=void 0,Ja=void 0,qd=void 0,Ha=void 0,Ia=void 0,Zb=void 0,Kb=void 0,za=0,Ea=0,Lb=0,Mb=0,eb=0,Qa=0,pa=0,Sa=0,Ba=0,K=0,ea=0,A=0,$a=void 0,Ka=ga.__vertexArray,Cc=ga.__uvArray,Dc=ga.__uv2Array,fb=ga.__normalArray,ta=ga.__tangentArray,La=ga.__colorArray,ua=ga.__skinVertexAArray,va=ga.__skinVertexBArray,wa=ga.__skinIndexArray,xa=ga.__skinWeightArray,dd=ga.__morphTargetsArrays,ed=ga.__morphNormalsArrays,fd=ga.__webglCustomAttributesList,y=void 0,Fb=ga.__faceArray,
+ab=ga.__lineArray,Ta=zd.geometry,Bd=Ta.elementsNeedUpdate,rd=Ta.uvsNeedUpdate,Cd=Ta.normalsNeedUpdate,Dd=Ta.tangentsNeedUpdate,Ed=Ta.colorsNeedUpdate,Fd=Ta.morphTargetsNeedUpdate,ic=Ta.vertices,ka=ga.faces3,la=ga.faces4,Ca=Ta.faces,gd=Ta.faceVertexUvs[0],hd=Ta.faceVertexUvs[1],jc=Ta.skinVerticesA,kc=Ta.skinVerticesB,lc=Ta.skinIndices,$b=Ta.skinWeights,ac=Ta.morphTargets,Oc=Ta.morphNormals;if(Ta.verticesNeedUpdate){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Y=ic[L.a];Z=ic[L.b];$=ic[L.c];Ka[Ea]=Y.x;Ka[Ea+
+1]=Y.y;Ka[Ea+2]=Y.z;Ka[Ea+3]=Z.x;Ka[Ea+4]=Z.y;Ka[Ea+5]=Z.z;Ka[Ea+6]=$.x;Ka[Ea+7]=$.y;Ka[Ea+8]=$.z;Ea=Ea+9}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];Y=ic[L.a];Z=ic[L.b];$=ic[L.c];oa=ic[L.d];Ka[Ea]=Y.x;Ka[Ea+1]=Y.y;Ka[Ea+2]=Y.z;Ka[Ea+3]=Z.x;Ka[Ea+4]=Z.y;Ka[Ea+5]=Z.z;Ka[Ea+6]=$.x;Ka[Ea+7]=$.y;Ka[Ea+8]=$.z;Ka[Ea+9]=oa.x;Ka[Ea+10]=oa.y;Ka[Ea+11]=oa.z;Ea=Ea+12}k.bindBuffer(k.ARRAY_BUFFER,ga.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ka,Za)}if(Fd){Ja=0;for(qd=ac.length;Ja<qd;Ja++){I=ea=0;for(V=ka.length;I<
+V;I++){Zb=ka[I];L=Ca[Zb];Y=ac[Ja].vertices[L.a];Z=ac[Ja].vertices[L.b];$=ac[Ja].vertices[L.c];Ha=dd[Ja];Ha[ea]=Y.x;Ha[ea+1]=Y.y;Ha[ea+2]=Y.z;Ha[ea+3]=Z.x;Ha[ea+4]=Z.y;Ha[ea+5]=Z.z;Ha[ea+6]=$.x;Ha[ea+7]=$.y;Ha[ea+8]=$.z;if(hc.morphNormals){if(Kc){Kb=Oc[Ja].vertexNormals[Zb];tb=Kb.a;ub=Kb.b;vb=Kb.c}else vb=ub=tb=Oc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z}ea=ea+9}I=0;for(V=la.length;I<V;I++){Zb=
+la[I];L=Ca[Zb];Y=ac[Ja].vertices[L.a];Z=ac[Ja].vertices[L.b];$=ac[Ja].vertices[L.c];oa=ac[Ja].vertices[L.d];Ha=dd[Ja];Ha[ea]=Y.x;Ha[ea+1]=Y.y;Ha[ea+2]=Y.z;Ha[ea+3]=Z.x;Ha[ea+4]=Z.y;Ha[ea+5]=Z.z;Ha[ea+6]=$.x;Ha[ea+7]=$.y;Ha[ea+8]=$.z;Ha[ea+9]=oa.x;Ha[ea+10]=oa.y;Ha[ea+11]=oa.z;if(hc.morphNormals){if(Kc){Kb=Oc[Ja].vertexNormals[Zb];tb=Kb.a;ub=Kb.b;vb=Kb.c;yc=Kb.d}else yc=vb=ub=tb=Oc[Ja].faceNormals[Zb];Ia=ed[Ja];Ia[ea]=tb.x;Ia[ea+1]=tb.y;Ia[ea+2]=tb.z;Ia[ea+3]=ub.x;Ia[ea+4]=ub.y;Ia[ea+5]=ub.z;Ia[ea+
+6]=vb.x;Ia[ea+7]=vb.y;Ia[ea+8]=vb.z;Ia[ea+9]=yc.x;Ia[ea+10]=yc.y;Ia[ea+11]=yc.z}ea=ea+12}k.bindBuffer(k.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Ja]);k.bufferData(k.ARRAY_BUFFER,dd[Ja],Za);if(hc.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Ja]);k.bufferData(k.ARRAY_BUFFER,ed[Ja],Za)}}}if($b.length){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];zb=$b[L.a];Ab=$b[L.b];Bb=$b[L.c];xa[K]=zb.x;xa[K+1]=zb.y;xa[K+2]=zb.z;xa[K+3]=zb.w;xa[K+4]=Ab.x;xa[K+5]=Ab.y;xa[K+6]=Ab.z;xa[K+7]=Ab.w;
+xa[K+8]=Bb.x;xa[K+9]=Bb.y;xa[K+10]=Bb.z;xa[K+11]=Bb.w;Cb=lc[L.a];Db=lc[L.b];Eb=lc[L.c];wa[K]=Cb.x;wa[K+1]=Cb.y;wa[K+2]=Cb.z;wa[K+3]=Cb.w;wa[K+4]=Db.x;wa[K+5]=Db.y;wa[K+6]=Db.z;wa[K+7]=Db.w;wa[K+8]=Eb.x;wa[K+9]=Eb.y;wa[K+10]=Eb.z;wa[K+11]=Eb.w;Sb=jc[L.a];Tb=jc[L.b];Ub=jc[L.c];ua[K]=Sb.x;ua[K+1]=Sb.y;ua[K+2]=Sb.z;ua[K+3]=1;ua[K+4]=Tb.x;ua[K+5]=Tb.y;ua[K+6]=Tb.z;ua[K+7]=1;ua[K+8]=Ub.x;ua[K+9]=Ub.y;ua[K+10]=Ub.z;ua[K+11]=1;Vb=kc[L.a];Wb=kc[L.b];Xb=kc[L.c];va[K]=Vb.x;va[K+1]=Vb.y;va[K+2]=Vb.z;va[K+3]=
+1;va[K+4]=Wb.x;va[K+5]=Wb.y;va[K+6]=Wb.z;va[K+7]=1;va[K+8]=Xb.x;va[K+9]=Xb.y;va[K+10]=Xb.z;va[K+11]=1;K=K+12}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];zb=$b[L.a];Ab=$b[L.b];Bb=$b[L.c];Ac=$b[L.d];xa[K]=zb.x;xa[K+1]=zb.y;xa[K+2]=zb.z;xa[K+3]=zb.w;xa[K+4]=Ab.x;xa[K+5]=Ab.y;xa[K+6]=Ab.z;xa[K+7]=Ab.w;xa[K+8]=Bb.x;xa[K+9]=Bb.y;xa[K+10]=Bb.z;xa[K+11]=Bb.w;xa[K+12]=Ac.x;xa[K+13]=Ac.y;xa[K+14]=Ac.z;xa[K+15]=Ac.w;Cb=lc[L.a];Db=lc[L.b];Eb=lc[L.c];Bc=lc[L.d];wa[K]=Cb.x;wa[K+1]=Cb.y;wa[K+2]=Cb.z;wa[K+3]=Cb.w;wa[K+
+4]=Db.x;wa[K+5]=Db.y;wa[K+6]=Db.z;wa[K+7]=Db.w;wa[K+8]=Eb.x;wa[K+9]=Eb.y;wa[K+10]=Eb.z;wa[K+11]=Eb.w;wa[K+12]=Bc.x;wa[K+13]=Bc.y;wa[K+14]=Bc.z;wa[K+15]=Bc.w;Sb=jc[L.a];Tb=jc[L.b];Ub=jc[L.c];Mc=jc[L.d];ua[K]=Sb.x;ua[K+1]=Sb.y;ua[K+2]=Sb.z;ua[K+3]=1;ua[K+4]=Tb.x;ua[K+5]=Tb.y;ua[K+6]=Tb.z;ua[K+7]=1;ua[K+8]=Ub.x;ua[K+9]=Ub.y;ua[K+10]=Ub.z;ua[K+11]=1;ua[K+12]=Mc.x;ua[K+13]=Mc.y;ua[K+14]=Mc.z;ua[K+15]=1;Vb=kc[L.a];Wb=kc[L.b];Xb=kc[L.c];Nc=kc[L.d];va[K]=Vb.x;va[K+1]=Vb.y;va[K+2]=Vb.z;va[K+3]=1;va[K+4]=Wb.x;
+va[K+5]=Wb.y;va[K+6]=Wb.z;va[K+7]=1;va[K+8]=Xb.x;va[K+9]=Xb.y;va[K+10]=Xb.z;va[K+11]=1;va[K+12]=Nc.x;va[K+13]=Nc.y;va[K+14]=Nc.z;va[K+15]=1;K=K+16}if(K>0){k.bindBuffer(k.ARRAY_BUFFER,ga.__webglSkinVertexABuffer);k.bufferData(k.ARRAY_BUFFER,ua,Za);k.bindBuffer(k.ARRAY_BUFFER,ga.__webglSkinVertexBBuffer);k.bufferData(k.ARRAY_BUFFER,va,Za);k.bindBuffer(k.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,wa,Za);k.bindBuffer(k.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,
+xa,Za)}}if(Ed&&cd){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];mb=L.vertexColors;Lc=L.color;if(mb.length===3&&cd===THREE.VertexColors){wb=mb[0];xb=mb[1];yb=mb[2]}else yb=xb=wb=Lc;La[Ba]=wb.r;La[Ba+1]=wb.g;La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;Ba=Ba+9}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];mb=L.vertexColors;Lc=L.color;if(mb.length===4&&cd===THREE.VertexColors){wb=mb[0];xb=mb[1];yb=mb[2];zc=mb[3]}else zc=yb=xb=wb=Lc;La[Ba]=wb.r;La[Ba+1]=wb.g;
+La[Ba+2]=wb.b;La[Ba+3]=xb.r;La[Ba+4]=xb.g;La[Ba+5]=xb.b;La[Ba+6]=yb.r;La[Ba+7]=yb.g;La[Ba+8]=yb.b;La[Ba+9]=zc.r;La[Ba+10]=zc.g;La[Ba+11]=zc.b;Ba=Ba+12}if(Ba>0){k.bindBuffer(k.ARRAY_BUFFER,ga.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,La,Za)}}if(Dd&&Ta.hasTangents){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Jb=L.vertexTangents;qb=Jb[0];rb=Jb[1];sb=Jb[2];ta[pa]=qb.x;ta[pa+1]=qb.y;ta[pa+2]=qb.z;ta[pa+3]=qb.w;ta[pa+4]=rb.x;ta[pa+5]=rb.y;ta[pa+6]=rb.z;ta[pa+7]=rb.w;ta[pa+8]=sb.x;ta[pa+9]=sb.y;ta[pa+
+10]=sb.z;ta[pa+11]=sb.w;pa=pa+12}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];Jb=L.vertexTangents;qb=Jb[0];rb=Jb[1];sb=Jb[2];xc=Jb[3];ta[pa]=qb.x;ta[pa+1]=qb.y;ta[pa+2]=qb.z;ta[pa+3]=qb.w;ta[pa+4]=rb.x;ta[pa+5]=rb.y;ta[pa+6]=rb.z;ta[pa+7]=rb.w;ta[pa+8]=sb.x;ta[pa+9]=sb.y;ta[pa+10]=sb.z;ta[pa+11]=sb.w;ta[pa+12]=xc.x;ta[pa+13]=xc.y;ta[pa+14]=xc.z;ta[pa+15]=xc.w;pa=pa+16}k.bindBuffer(k.ARRAY_BUFFER,ga.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,ta,Za)}if(Cd&&nd){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];
+rc=L.vertexNormals;Rb=L.normal;if(rc.length===3&&Kc)for(ja=0;ja<3;ja++){Yb=rc[ja];fb[Qa]=Yb.x;fb[Qa+1]=Yb.y;fb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<3;ja++){fb[Qa]=Rb.x;fb[Qa+1]=Rb.y;fb[Qa+2]=Rb.z;Qa=Qa+3}}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];rc=L.vertexNormals;Rb=L.normal;if(rc.length===4&&Kc)for(ja=0;ja<4;ja++){Yb=rc[ja];fb[Qa]=Yb.x;fb[Qa+1]=Yb.y;fb[Qa+2]=Yb.z;Qa=Qa+3}else for(ja=0;ja<4;ja++){fb[Qa]=Rb.x;fb[Qa+1]=Rb.y;fb[Qa+2]=Rb.z;Qa=Qa+3}}k.bindBuffer(k.ARRAY_BUFFER,ga.__webglNormalBuffer);
+k.bufferData(k.ARRAY_BUFFER,fb,Za)}if(rd&&gd&&od){I=0;for(V=ka.length;I<V;I++){jb=ka[I];L=Ca[jb];sc=gd[jb];if(sc!==void 0)for(ja=0;ja<3;ja++){uc=sc[ja];Cc[Lb]=uc.u;Cc[Lb+1]=uc.v;Lb=Lb+2}}I=0;for(V=la.length;I<V;I++){jb=la[I];L=Ca[jb];sc=gd[jb];if(sc!==void 0)for(ja=0;ja<4;ja++){uc=sc[ja];Cc[Lb]=uc.u;Cc[Lb+1]=uc.v;Lb=Lb+2}}if(Lb>0){k.bindBuffer(k.ARRAY_BUFFER,ga.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,Cc,Za)}}if(rd&&hd&&od){I=0;for(V=ka.length;I<V;I++){jb=ka[I];L=Ca[jb];tc=hd[jb];if(tc!==void 0)for(ja=
+0;ja<3;ja++){vc=tc[ja];Dc[Mb]=vc.u;Dc[Mb+1]=vc.v;Mb=Mb+2}}I=0;for(V=la.length;I<V;I++){jb=la[I];L=Ca[jb];tc=hd[jb];if(tc!==void 0)for(ja=0;ja<4;ja++){vc=tc[ja];Dc[Mb]=vc.u;Dc[Mb+1]=vc.v;Mb=Mb+2}}if(Mb>0){k.bindBuffer(k.ARRAY_BUFFER,ga.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,Dc,Za)}}if(Bd){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Fb[eb]=za;Fb[eb+1]=za+1;Fb[eb+2]=za+2;eb=eb+3;ab[Sa]=za;ab[Sa+1]=za+1;ab[Sa+2]=za;ab[Sa+3]=za+2;ab[Sa+4]=za+1;ab[Sa+5]=za+2;Sa=Sa+6;za=za+3}I=0;for(V=la.length;I<V;I++){L=
+Ca[la[I]];Fb[eb]=za;Fb[eb+1]=za+1;Fb[eb+2]=za+3;Fb[eb+3]=za+1;Fb[eb+4]=za+2;Fb[eb+5]=za+3;eb=eb+6;ab[Sa]=za;ab[Sa+1]=za+1;ab[Sa+2]=za;ab[Sa+3]=za+3;ab[Sa+4]=za+1;ab[Sa+5]=za+2;ab[Sa+6]=za+2;ab[Sa+7]=za+3;Sa=Sa+8;za=za+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Fb,Za);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ga.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ab,Za)}if(fd){ja=0;for(pd=fd.length;ja<pd;ja++){y=fd[ja];if(y.__original.needsUpdate){A=
+0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];y.array[A]=y.value[L.a];y.array[A+1]=y.value[L.b];y.array[A+2]=y.value[L.c];A=A+3}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];y.array[A]=y.value[L.a];y.array[A+1]=y.value[L.b];y.array[A+2]=y.value[L.c];y.array[A+3]=y.value[L.d];A=A+4}}else{if(y.boundTo==="faces"){I=0;for(V=ka.length;I<V;I++){$a=y.value[ka[I]];y.array[A]=$a;y.array[A+1]=$a;y.array[A+2]=$a;A=A+3}I=0;for(V=la.length;I<V;I++){$a=y.value[la[I]];
+y.array[A]=$a;y.array[A+1]=$a;y.array[A+2]=$a;y.array[A+3]=$a;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Z.x;y.array[A+3]=Z.y;y.array[A+4]=$.x;y.array[A+5]=$.y;A=A+6}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];oa=y.value[L.d];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Z.x;y.array[A+3]=Z.y;y.array[A+
+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=oa.x;y.array[A+7]=oa.y;A=A+8}}else{if(y.boundTo==="faces"){I=0;for(V=ka.length;I<V;I++){$=Z=Y=$a=y.value[ka[I]];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Z.x;y.array[A+3]=Z.y;y.array[A+4]=$.x;y.array[A+5]=$.y;A=A+6}I=0;for(V=la.length;I<V;I++){oa=$=Z=Y=$a=y.value[la[I]];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Z.x;y.array[A+3]=Z.y;y.array[A+4]=$.x;y.array[A+5]=$.y;y.array[A+6]=oa.x;y.array[A+7]=oa.y;A=A+8}}}else if(y.size===3){var ha;ha=y.type==="c"?["r",
+"g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];y.array[A]=Y[ha[0]];y.array[A+1]=Y[ha[1]];y.array[A+2]=Y[ha[2]];y.array[A+3]=Z[ha[0]];y.array[A+4]=Z[ha[1]];y.array[A+5]=Z[ha[2]];y.array[A+6]=$[ha[0]];y.array[A+7]=$[ha[1]];y.array[A+8]=$[ha[2]];A=A+9}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];oa=y.value[L.d];y.array[A]=Y[ha[0]];y.array[A+1]=Y[ha[1]];
+y.array[A+2]=Y[ha[2]];y.array[A+3]=Z[ha[0]];y.array[A+4]=Z[ha[1]];y.array[A+5]=Z[ha[2]];y.array[A+6]=$[ha[0]];y.array[A+7]=$[ha[1]];y.array[A+8]=$[ha[2]];y.array[A+9]=oa[ha[0]];y.array[A+10]=oa[ha[1]];y.array[A+11]=oa[ha[2]];A=A+12}}else if(y.boundTo==="faces"){I=0;for(V=ka.length;I<V;I++){$=Z=Y=$a=y.value[ka[I]];y.array[A]=Y[ha[0]];y.array[A+1]=Y[ha[1]];y.array[A+2]=Y[ha[2]];y.array[A+3]=Z[ha[0]];y.array[A+4]=Z[ha[1]];y.array[A+5]=Z[ha[2]];y.array[A+6]=$[ha[0]];y.array[A+7]=$[ha[1]];y.array[A+8]=
+$[ha[2]];A=A+9}I=0;for(V=la.length;I<V;I++){oa=$=Z=Y=$a=y.value[la[I]];y.array[A]=Y[ha[0]];y.array[A+1]=Y[ha[1]];y.array[A+2]=Y[ha[2]];y.array[A+3]=Z[ha[0]];y.array[A+4]=Z[ha[1]];y.array[A+5]=Z[ha[2]];y.array[A+6]=$[ha[0]];y.array[A+7]=$[ha[1]];y.array[A+8]=$[ha[2]];y.array[A+9]=oa[ha[0]];y.array[A+10]=oa[ha[1]];y.array[A+11]=oa[ha[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=ka.length;I<V;I++){L=Ca[ka[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];y.array[A]=
+Y.x;y.array[A+1]=Y.y;y.array[A+2]=Y.z;y.array[A+3]=Y.w;y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=Z.z;y.array[A+7]=Z.w;y.array[A+8]=$.x;y.array[A+9]=$.y;y.array[A+10]=$.z;y.array[A+11]=$.w;A=A+12}I=0;for(V=la.length;I<V;I++){L=Ca[la[I]];Y=y.value[L.a];Z=y.value[L.b];$=y.value[L.c];oa=y.value[L.d];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Y.z;y.array[A+3]=Y.w;y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=Z.z;y.array[A+7]=Z.w;y.array[A+8]=$.x;y.array[A+9]=$.y;y.array[A+10]=$.z;y.array[A+11]=
+$.w;y.array[A+12]=oa.x;y.array[A+13]=oa.y;y.array[A+14]=oa.z;y.array[A+15]=oa.w;A=A+16}}else if(y.boundTo==="faces"){I=0;for(V=ka.length;I<V;I++){$=Z=Y=$a=y.value[ka[I]];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Y.z;y.array[A+3]=Y.w;y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=Z.z;y.array[A+7]=Z.w;y.array[A+8]=$.x;y.array[A+9]=$.y;y.array[A+10]=$.z;y.array[A+11]=$.w;A=A+12}I=0;for(V=la.length;I<V;I++){oa=$=Z=Y=$a=y.value[la[I]];y.array[A]=Y.x;y.array[A+1]=Y.y;y.array[A+2]=Y.z;y.array[A+3]=Y.w;
+y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=Z.z;y.array[A+7]=Z.w;y.array[A+8]=$.x;y.array[A+9]=$.y;y.array[A+10]=$.z;y.array[A+11]=$.w;y.array[A+12]=oa.x;y.array[A+13]=oa.y;y.array[A+14]=oa.z;y.array[A+15]=oa.w;A=A+16}}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,Za)}}}if(Ad){delete ga.__inittedArrays;delete ga.__colorArray;delete ga.__normalArray;delete ga.__tangentArray;delete ga.__uvArray;delete ga.__uv2Array;delete ga.__faceArray;delete ga.__vertexArray;delete ga.__lineArray;
+delete ga.__skinVertexAArray;delete ga.__skinVertexBArray;delete ga.__skinIndexArray;delete ga.__skinWeightArray}}}}da.verticesNeedUpdate=false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false;Wa.attributes&&p(Wa)}else if(lb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var bc=da,sd=k.DYNAMIC_DRAW,Ec=void 0,Fc=void 0,Pc=void 0,cc=void 0,Qc=void 0,td=bc.vertices,
+ud=bc.colors,Gd=td.length,Hd=ud.length,Rc=bc.__vertexArray,Sc=bc.__colorArray,Id=bc.colorsNeedUpdate;if(bc.verticesNeedUpdate){for(Ec=0;Ec<Gd;Ec++){Pc=td[Ec];cc=Ec*3;Rc[cc]=Pc.x;Rc[cc+1]=Pc.y;Rc[cc+2]=Pc.z}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Rc,sd)}if(Id){for(Fc=0;Fc<Hd;Fc++){Qc=ud[Fc];cc=Fc*3;Sc[cc]=Qc.r;Sc[cc+1]=Qc.g;Sc[cc+2]=Qc.b}k.bindBuffer(k.ARRAY_BUFFER,bc.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Sc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=
+false}else if(lb instanceof THREE.Line){Wa=c(lb,cb);oc=Wa.attributes&&n(Wa);if(da.verticesNeedUpdate||da.colorsNeedUpdate||oc){var Nb=da,id=k.DYNAMIC_DRAW,Gc=void 0,Hc=void 0,Tc=void 0,ya=void 0,Uc=void 0,vd=Nb.vertices,wd=Nb.colors,Jd=vd.length,Kd=wd.length,Vc=Nb.__vertexArray,Wc=Nb.__colorArray,Ld=Nb.colorsNeedUpdate,jd=Nb.__webglCustomAttributesList,Xc=void 0,xd=void 0,Na=void 0,wc=void 0,Xa=void 0,ra=void 0;if(Nb.verticesNeedUpdate){for(Gc=0;Gc<Jd;Gc++){Tc=vd[Gc];ya=Gc*3;Vc[ya]=Tc.x;Vc[ya+1]=
+Tc.y;Vc[ya+2]=Tc.z}k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Vc,id)}if(Ld){for(Hc=0;Hc<Kd;Hc++){Uc=wd[Hc];ya=Hc*3;Wc[ya]=Uc.r;Wc[ya+1]=Uc.g;Wc[ya+2]=Uc.b}k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Wc,id)}if(jd){Xc=0;for(xd=jd.length;Xc<xd;Xc++){ra=jd[Xc];if(ra.needsUpdate&&(ra.boundTo===void 0||ra.boundTo==="vertices")){ya=0;wc=ra.value.length;if(ra.size===1)for(Na=0;Na<wc;Na++)ra.array[Na]=ra.value[Na];else if(ra.size===2)for(Na=
+0;Na<wc;Na++){Xa=ra.value[Na];ra.array[ya]=Xa.x;ra.array[ya+1]=Xa.y;ya=ya+2}else if(ra.size===3)if(ra.type==="c")for(Na=0;Na<wc;Na++){Xa=ra.value[Na];ra.array[ya]=Xa.r;ra.array[ya+1]=Xa.g;ra.array[ya+2]=Xa.b;ya=ya+3}else for(Na=0;Na<wc;Na++){Xa=ra.value[Na];ra.array[ya]=Xa.x;ra.array[ya+1]=Xa.y;ra.array[ya+2]=Xa.z;ya=ya+3}else if(ra.size===4)for(Na=0;Na<wc;Na++){Xa=ra.value[Na];ra.array[ya]=Xa.x;ra.array[ya+1]=Xa.y;ra.array[ya+2]=Xa.z;ra.array[ya+3]=Xa.w;ya=ya+4}k.bindBuffer(k.ARRAY_BUFFER,ra.buffer);
+k.bufferData(k.ARRAY_BUFFER,ra.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Wa.attributes&&p(Wa)}else if(lb instanceof THREE.ParticleSystem){Wa=c(lb,cb);oc=Wa.attributes&&n(Wa);(da.verticesNeedUpdate||da.colorsNeedUpdate||lb.sortParticles||oc)&&f(da,k.DYNAMIC_DRAW,lb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Wa.attributes&&p(Wa)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,m,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?
+l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,p;o=g=e=n=0;for(f=b.length;o<f;o++){p=b[o];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&
+g++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&n++}}if(e+n+g<=Q){o=g;f=e}else{o=Math.ceil(Q*g/(e+g));n=f=Q-o}e=o;g=n;n=m=0;for(o=b.length;n<o;n++){p=b[n];if(p.castShadow){p instanceof THREE.SpotLight&&m++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&m++}}if(dc&&d&&d.useVertexTexture)j=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+
+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}j=b}var r;a:{p=a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:j,useVertexTexture:dc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,
+maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(l)d.push(l);else{d.push(p);d.push(o)}for(q in c){d.push(q);d.push(c[q])}l=d.join();
+q=0;for(d=aa.length;q<d;q++){e=aa[q];if(e.code===l){e.usedTimes++;r=e.program;break a}}q=k.createProgram();d=["precision "+u+" float;",pb?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,
+c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":
+"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+e=["precision "+u+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-e=t("fragment",e+p);d=t("vertex",d+n);k.attachShader(q,d);k.attachShader(q,e);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(e);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
-d.push("boneGlobalMatrices");for(s in o)d.push(s);s=d;d=0;for(o=s.length;d<o;d++){e=s[d];q.uniforms[e]=k.getUniformLocation(q,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];q.attributes[d]=k.getAttribLocation(q,d)}q.id=R++;W.push({program:q,code:m,usedTimes:1});D.info.memory.programs=
-W.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(i in a.attributes)r[i]!==
+e=t("fragment",e+p);d=t("vertex",d+o);k.attachShader(q,d);k.attachShader(q,e);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(e);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
+d.push("boneGlobalMatrices");for(s in n)d.push(s);s=d;d=0;for(n=s.length;d<n;d++){e=s[d];q.uniforms[e]=k.getUniformLocation(q,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];q.attributes[d]=k.getAttribLocation(q,d)}q.id=T++;aa.push({program:q,code:l,usedTimes:1});E.info.memory.programs=
+aa.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(i in a.attributes)r[i]!==
 void 0&&r[i]>=0&&k.enableVertexAttribArray(r[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(i=0;i<this.maxMorphTargets;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=
 void 0&&r[i]>=0&&k.enableVertexAttribArray(r[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(i=0;i<this.maxMorphTargets;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=
-function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);L=a.doubleSided}if(X!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);X=a.flipSided}};this.setDepthTest=function(a){if(za!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
-za=a}};this.setDepthWrite=function(a){if(Ga!==a){k.depthMask(a);Ga=a}};this.setBlending=function(a,b,c,d){if(a!==S){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===
-THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}S=a}if(a===THREE.CustomBlending){if(b!==T){k.blendEquation(C(b));T=b}if(c!==ia||d!==ma){k.blendFunc(C(c),C(d));ia=c;ma=d}}else ma=ia=T=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();D.info.memory.textures++}k.activeTexture(k.TEXTURE0+
-b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=C(a.format),f=C(a.type);v(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+
-b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=C(a.format),e=C(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);v(k.TEXTURE_CUBE_MAP,a,c);
+function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(S!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);S=a.doubleSided}if(R!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);R=a.flipSided}};this.setDepthTest=function(a){if(Ga!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
+Ga=a}};this.setDepthWrite=function(a){if(na!==a){k.depthMask(a);na=a}};this.setBlending=function(a,b,c,d){if(a!==P){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===
+THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}P=a}if(a===THREE.CustomBlending){if(b!==U){k.blendEquation(D(b));U=b}if(c!==fa||d!==ma){k.blendFunc(D(c),D(d));fa=c;ma=d}}else ma=fa=U=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();E.info.memory.textures++}k.activeTexture(k.TEXTURE0+
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=D(a.format),f=D(a.type);v(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);v(k.TEXTURE_CUBE_MAP,a,c);
 for(var f=0;f<6;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=
 for(var f=0;f<6;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=
 k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);v(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
 k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);v(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
-null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=ob;a=kb;d=gb;e=Ob}if(b!==ba){k.bindFramebuffer(k.FRAMEBUFFER,b);k.viewport(d,e,c,a);ba=b}ec=c;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=ob;a=kb;d=gb;e=Ob}if(b!==W){k.bindFramebuffer(k.FRAMEBUFFER,b);k.viewport(d,e,c,a);W=b}ec=c;Ua=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -453,31 +453,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,i=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var m=h[p].clone();c&&c.multiplyVector3(m);g.push(m)}p=0;for(r=i.length;p<r;p++){var g=
-i[p],q,s,u=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=u.length;h<m;h++){s=u[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(m=t.length;h<m;h++){s=t[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];m=h.id;t=n[m];if(t===void 0){t=
-a.materials.length;n[m]=t;a.materials.push(h)}q.materialIndex=t}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,l=a.faceVertexUvs[0],m=f.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var o=h[p].clone();c&&c.multiplyVector3(o);g.push(o)}p=0;for(r=j.length;p<r;p++){var g=
+j[p],q,s,w=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(o=w.length;h<o;h++){s=w[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(o=t.length;h<o;h++){s=t[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];o=h.id;t=n[o];if(t===void 0){t=
+a.materials.length;n[o]=t;a.materials.push(h)}q.materialIndex=t}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=m.length;p<r;p++){c=m[p];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
 for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
 for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
 THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
 THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return i[e]>a?b(c,e-1):i[e]<a?b(e+1,d):e}return b(0,i.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,j=0,i=[],l,o,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,n)}else if(d instanceof THREE.Face4){l=
-g[d.a];o=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,n,p);d._area=d._area1+d._area2}j=j+d._area;i[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],l,m,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];m=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,m,n)}else if(d instanceof THREE.Face4){l=
+g[d.a];m=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,m,p);d._area2=THREE.GeometryUtils.triangleArea(m,n,p);d._area=d._area1+d._area2}i=i+d._area;j[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
 var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
 var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,i=d.c,l=d.d,o=new THREE.Face3,n=new THREE.Face3;o.color.copy(d.color);n.color.copy(d.color);o.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;o.a=e;o.b=j;o.c=l;n.a=j;n.b=i;n.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();n.vertexColors[0]=d.vertexColors[1].clone();
-n.vertexColors[1]=d.vertexColors[2].clone();n.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];j=o[1];i=o[2];l=o[3];o=[o[0].clone(),j.clone(),l.clone()];j=[j.clone(),i.clone(),l.clone()];h[d].push(o,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
-e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],i=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
-h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,i,l,o,n,p,r,m,q,s,u,t,v,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;i=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=i.distanceTo(l);r=l.distanceTo(o);n=i.distanceTo(o);if(p>
-b||r>b||n>b){j=a.vertices.length;t=e.clone();v=e.clone();if(p>=r&&p>=n){i=i.clone();i.lerpSelf(l,0.5);t.a=f;t.b=j;t.c=h;v.a=j;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);t.vertexNormals[1].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);t.vertexColors[1].copy(f);v.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){i=l.clone();i.lerpSelf(o,0.5);t.a=f;t.b=g;t.c=
-j;v.a=j;v.b=h;v.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f);v.vertexNormals[1].copy(e.vertexNormals[2]);v.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f);v.vertexColors[1].copy(e.vertexColors[2]);v.vertexColors[2].copy(e.vertexColors[0])}e=1}else{i=i.clone();
-i.lerpSelf(o,0.5);t.a=f;t.b=g;t.c=j;v.a=j;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f)}e=2}x.push(t,v);a.vertices.push(i);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){i=a.faceVertexUvs[f][c];v=i[0];h=i[1];t=i[2];if(e===
-0){l=v.clone();l.lerpSelf(h,0.5);i=[v.clone(),l.clone(),t.clone()];h=[l.clone(),h.clone(),t.clone()]}else if(e===1){l=h.clone();l.lerpSelf(t,0.5);i=[v.clone(),h.clone(),l.clone()];h=[l.clone(),t.clone(),v.clone()]}else{l=v.clone();l.lerpSelf(t,0.5);i=[v.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),t.clone()]}F[f].push(i,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;i=a.vertices[f];l=a.vertices[g];o=a.vertices[h];n=
-a.vertices[j];p=i.distanceTo(l);r=l.distanceTo(o);m=o.distanceTo(n);q=i.distanceTo(n);if(p>b||r>b||m>b||q>b){s=a.vertices.length;u=a.vertices.length+1;t=e.clone();v=e.clone();if(p>=r&&p>=m&&p>=q||m>=r&&m>=p&&m>=q){p=i.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(n,0.5);t.a=f;t.b=s;t.c=u;t.d=j;v.a=s;v.b=g;v.c=h;v.d=u;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);t.vertexNormals[1].copy(f);
-t.vertexNormals[2].copy(g);v.vertexNormals[0].copy(f);v.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);t.vertexColors[1].copy(f);t.vertexColors[2].copy(g);v.vertexColors[0].copy(f);v.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=n.clone();l.lerpSelf(i,0.5);t.a=f;t.b=g;t.c=s;t.d=u;v.a=u;v.b=s;v.c=h;v.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,m=new THREE.Face3,n=new THREE.Face3;m.color.copy(d.color);n.color.copy(d.color);m.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;m.a=e;m.b=i;m.c=l;n.a=i;n.b=j;n.c=l;if(d.vertexColors.length===4){m.vertexColors[0]=d.vertexColors[0].clone();m.vertexColors[1]=d.vertexColors[1].clone();m.vertexColors[2]=d.vertexColors[3].clone();n.vertexColors[0]=d.vertexColors[1].clone();
+n.vertexColors[1]=d.vertexColors[2].clone();n.vertexColors[2]=d.vertexColors[3].clone()}f.push(m,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){m=a.faceVertexUvs[d][b];i=m[1];j=m[2];l=m[3];m=[m[0].clone(),i.clone(),l.clone()];i=[i.clone(),j.clone(),l.clone()];h[d].push(m,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
+h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,m,n,p,r,o,q,s,w,t,v,x=[],C=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)C[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];l=a.vertices[g];m=a.vertices[h];p=j.distanceTo(l);r=l.distanceTo(m);n=j.distanceTo(m);if(p>
+b||r>b||n>b){i=a.vertices.length;t=e.clone();v=e.clone();if(p>=r&&p>=n){j=j.clone();j.lerpSelf(l,0.5);t.a=f;t.b=i;t.c=h;v.a=i;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);t.vertexNormals[1].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);t.vertexColors[1].copy(f);v.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){j=l.clone();j.lerpSelf(m,0.5);t.a=f;t.b=g;t.c=
+i;v.a=i;v.b=h;v.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f);v.vertexNormals[1].copy(e.vertexNormals[2]);v.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f);v.vertexColors[1].copy(e.vertexColors[2]);v.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
+j.lerpSelf(m,0.5);t.a=f;t.b=g;t.c=i;v.a=i;v.b=g;v.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);t.vertexNormals[2].copy(f);v.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);t.vertexColors[2].copy(f);v.vertexColors[0].copy(f)}e=2}x.push(t,v);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];v=j[0];h=j[1];t=j[2];if(e===
+0){l=v.clone();l.lerpSelf(h,0.5);j=[v.clone(),l.clone(),t.clone()];h=[l.clone(),h.clone(),t.clone()]}else if(e===1){l=h.clone();l.lerpSelf(t,0.5);j=[v.clone(),h.clone(),l.clone()];h=[l.clone(),t.clone(),v.clone()]}else{l=v.clone();l.lerpSelf(t,0.5);j=[v.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),t.clone()]}C[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)C[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];l=a.vertices[g];m=a.vertices[h];n=
+a.vertices[i];p=j.distanceTo(l);r=l.distanceTo(m);o=m.distanceTo(n);q=j.distanceTo(n);if(p>b||r>b||o>b||q>b){s=a.vertices.length;w=a.vertices.length+1;t=e.clone();v=e.clone();if(p>=r&&p>=o&&p>=q||o>=r&&o>=p&&o>=q){p=j.clone();p.lerpSelf(l,0.5);l=m.clone();l.lerpSelf(n,0.5);t.a=f;t.b=s;t.c=w;t.d=i;v.a=s;v.b=g;v.c=h;v.d=w;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);t.vertexNormals[1].copy(f);
+t.vertexNormals[2].copy(g);v.vertexNormals[0].copy(f);v.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);t.vertexColors[1].copy(f);t.vertexColors[2].copy(g);v.vertexColors[0].copy(f);v.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(m,0.5);l=n.clone();l.lerpSelf(j,0.5);t.a=f;t.b=g;t.c=s;t.d=w;v.a=w;v.b=s;v.c=h;v.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
 f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);t.vertexNormals[2].copy(f);t.vertexNormals[3].copy(g);v.vertexNormals[0].copy(g);v.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);t.vertexColors[2].copy(f);t.vertexColors[3].copy(g);v.vertexColors[0].copy(g);v.vertexColors[1].copy(f)}e=1}x.push(t,v);a.vertices.push(p,l);
 f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);t.vertexNormals[2].copy(f);t.vertexNormals[3].copy(g);v.vertexNormals[0].copy(g);v.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);t.vertexColors[2].copy(f);t.vertexColors[3].copy(g);v.vertexColors[0].copy(g);v.vertexColors[1].copy(f)}e=1}x.push(t,v);a.vertices.push(p,l);
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){i=a.faceVertexUvs[f][c];v=i[0];h=i[1];t=i[2];i=i[3];if(e===0){l=v.clone();l.lerpSelf(h,0.5);o=t.clone();o.lerpSelf(i,0.5);v=[v.clone(),l.clone(),o.clone(),i.clone()];h=[l.clone(),h.clone(),t.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(t,0.5);o=i.clone();o.lerpSelf(v,0.5);v=[v.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),t.clone(),i.clone()]}F[f].push(v,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
-x;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];v=j[0];h=j[1];t=j[2];j=j[3];if(e===0){l=v.clone();l.lerpSelf(h,0.5);m=t.clone();m.lerpSelf(j,0.5);v=[v.clone(),l.clone(),m.clone(),j.clone()];h=[l.clone(),h.clone(),t.clone(),m.clone()]}else{l=h.clone();l.lerpSelf(t,0.5);m=j.clone();m.lerpSelf(v,0.5);v=[v.clone(),h.clone(),l.clone(),m.clone()];h=[m.clone(),l.clone(),t.clone(),j.clone()]}C[f].push(v,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)C[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+x;a.faceVertexUvs=C}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);f.flipY=false;b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);f.flipY=false;b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+
-1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,j=g.createImageData(d,e),i=j.data,l=0;l<d;l++)for(var o=0;o<e;o++){var n=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=
-l-1<0?0:l-1,m=l+1>d-1?d-1:l+1,q=[],s=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,h[(n*d+l)*4]/255*b]);q.push([1,-1,h[(n*d+m)*4]/255*b]);q.push([1,0,h[(o*d+m)*4]/255*b]);q.push([1,1,h[(p*d+m)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);n=[];r=q.length;for(p=0;p<r;p++){var m=q[p],u=q[(p+1)%r],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];n.push(c([m[1]*u[2]-m[2]*u[1],m[2]*u[0]-m[0]*
-u[2],m[0]*u[1]-m[1]*u[0]]))}q=[0,0,0];for(p=0;p<n.length;p++){q[0]=q[0]+n[p][0];q[1]=q[1]+n[p][1];q[2]=q[2]+n[p][2]}q[0]=q[0]/n.length;q[1]=q[1]/n.length;q[2]=q[2]/n.length;s=(o*d+l)*4;i[s]=(q[0]+1)/2*255|0;i[s+1]=(q[1]+1)/2*255|0;i[s+2]=q[2]*255|0;i[s+3]=255}g.putImageData(j,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,
+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var m=0;m<e;m++){var n=m-1<0?0:m-1,p=m+1>e-1?e-1:m+1,r=
+l-1<0?0:l-1,o=l+1>d-1?d-1:l+1,q=[],s=[0,0,h[(m*d+l)*4]/255*b];q.push([-1,0,h[(m*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,h[(n*d+l)*4]/255*b]);q.push([1,-1,h[(n*d+o)*4]/255*b]);q.push([1,0,h[(m*d+o)*4]/255*b]);q.push([1,1,h[(p*d+o)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);n=[];r=q.length;for(p=0;p<r;p++){var o=q[p],w=q[(p+1)%r],o=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],w=[w[0]-s[0],w[1]-s[1],w[2]-s[2]];n.push(c([o[1]*w[2]-o[2]*w[1],o[2]*w[0]-o[0]*
+w[2],o[0]*w[1]-o[1]*w[0]]))}q=[0,0,0];for(p=0;p<n.length;p++){q[0]=q[0]+n[p][0];q[1]=q[1]+n[p][1];q[2]=q[2]+n[p][2]}q[0]=q[0]/n.length;q[1]=q[1]/n.length;q[2]=q[2]/n.length;s=(m*d+l)*4;j[s]=(q[0]+1)/2*255|0;j[s+1]=(q[1]+1)/2*255|0;j[s+2]=q[2]*255|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,
 b,THREE.RGBFormat);a.needsUpdate=true;return a}};
 b,THREE.RGBFormat);a.needsUpdate=true;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(a instanceof THREE.MorphAnimMesh){b=new THREE.MorphAnimMesh(a.geometry,a.material);
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(a instanceof THREE.MorphAnimMesh){b=new THREE.MorphAnimMesh(a.geometry,a.material);
 b.duration=a.duration;b.mirroredLoop=a.mirroredLoop;b.time=a.time;b.lastKeyframe=a.lastKeyframe;b.currentKeyframe=a.currentKeyframe;b.direction=a.direction;b.directionBackwards=a.directionBackwards}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
 b.duration=a.duration;b.mirroredLoop=a.mirroredLoop;b.time=a.time;b.lastKeyframe=a.lastKeyframe;b.currentKeyframe=a.currentKeyframe;b.direction=a.direction;b.directionBackwards=a.directionBackwards}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
@@ -495,24 +495,24 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvWorldPosition = mPosition.xyz;\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,j,i,l,o,n,p,r,m,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));i=b.length;for(a=0;a<i;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;l=b[a++]*c;e.moveTo(j,l);break;case "l":j=b[a++]*c+d;l=b[a++]*c;e.lineTo(j,l);break;case "q":j=b[a++]*
-c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,j,l);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,o,p,j);THREE.Shape.Utils.b2(u,n,r,l)}}break;case "b":j=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(j,l,p,r,m,q);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,o,p,m,j);THREE.Shape.Utils.b3(u,n,r,q,l)}}}}}return{offset:s.ha*c,path:e}}}};
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,m,n,p,r,o,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
+c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var w=g/h;THREE.Shape.Utils.b2(w,m,p,i);THREE.Shape.Utils.b2(w,n,r,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;o=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,l,p,r,o,q);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){w=g/h;THREE.Shape.Utils.b3(w,m,p,o,i);THREE.Shape.Utils.b3(w,n,r,q,l)}}}}}return{offset:s.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],j,i,l;if(b(a)>0)for(i=0;i<e;i++)g[i]=i;else for(i=0;i<e;i++)g[i]=e-1-i;var o=2*e;for(i=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}j=i;e<=j&&(j=0);i=j+1;e<=i&&(i=0);l=i+1;e<=l&&(l=0);var n;a:{n=a;var p=j,r=i,m=l,q=e,s=g,u=void 0,t=void 0,v=void 0,x=void 0,F=void 0,
-C=void 0,z=void 0,w=void 0,H=void 0,t=n[s[p]].x,v=n[s[p]].y,x=n[s[r]].x,F=n[s[r]].y,C=n[s[m]].x,z=n[s[m]].y;if(1.0E-10>(x-t)*(z-v)-(F-v)*(C-t))n=false;else{for(u=0;u<q;u++)if(!(u==p||u==r||u==m)){var w=n[s[u]].x,H=n[s[u]].y,E=void 0,O=void 0,Q=void 0,Y=void 0,B=void 0,J=void 0,P=void 0,D=void 0,W=void 0,R=void 0,N=void 0,ba=void 0,E=Q=B=void 0,E=C-x,O=z-F,Q=t-C,Y=v-z,B=x-t,J=F-v,P=w-t,D=H-v,W=w-x,R=H-F,N=w-C,ba=H-z,E=E*R-O*W,B=B*D-J*P,Q=Q*ba-Y*N;if(E>=0&&Q>=0&&B>=0){n=false;break a}}n=true}}if(n){f.push([a[g[j]],
-a[g[i]],a[g[l]]]);h.push([g[j],g[i],g[l]]);j=i;for(l=i+1;l<e;j++,l++)g[j]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;e>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var p=i,r=j,o=l,q=e,s=g,w=void 0,t=void 0,v=void 0,x=void 0,C=void 0,
+D=void 0,z=void 0,u=void 0,G=void 0,t=n[s[p]].x,v=n[s[p]].y,x=n[s[r]].x,C=n[s[r]].y,D=n[s[o]].x,z=n[s[o]].y;if(1.0E-10>(x-t)*(z-v)-(C-v)*(D-t))n=false;else{for(w=0;w<q;w++)if(!(w==p||w==r||w==o)){var u=n[s[w]].x,G=n[s[w]].y,J=void 0,M=void 0,O=void 0,X=void 0,B=void 0,F=void 0,Q=void 0,E=void 0,aa=void 0,T=void 0,N=void 0,W=void 0,J=O=B=void 0,J=D-x,M=z-C,O=t-D,X=v-z,B=x-t,F=C-v,Q=u-t,E=G-v,aa=u-x,T=G-C,N=u-D,W=G-z,J=J*T-M*aa,B=B*E-F*Q,O=O*W-X*N;if(J>=0&&O>=0&&B>=0){n=false;break a}}n=true}}if(n){f.push([a[g[i]],
+a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;m=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
-0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,j,i,l,o,n,p,r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;j=e[c].count;var t=e[c].index;a=b;for(b=b+j;a<b;a=a+3){j=t+f[a];i=t+f[a+1];l=t+f[a+2];o=g[j*3];n=g[j*3+1];p=g[j*3+2];r.set(o,n,p);o=g[i*3];n=g[i*3+1];p=g[i*3+2];m.set(o,n,p);o=g[l*3];n=g[l*3+1];p=g[l*3+2];q.set(o,n,p);s.sub(q,m);u.sub(r,
-m);s.crossSelf(u);h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z;h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){o=h[a];n=h[a+1];p=h[a+2];c=1/Math.sqrt(o*o+n*n+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){o=d[a*3];n=d[a*3+1];p=d[a*3+2];r=d[b*3];m=d[b*3+1];q=d[b*3+2];s=d[c*3];u=d[c*3+1];t=d[c*3+2];v=
-f[a*2];x=f[a*2+1];F=f[b*2];C=f[b*2+1];z=f[c*2];w=f[c*2+1];H=r-o;E=s-o;O=m-n;Q=u-n;Y=q-p;B=t-p;J=F-v;P=z-v;D=C-x;W=w-x;R=1/(J*W-P*D);N.set((W*H-D*E)*R,(W*O-D*Q)*R,(W*Y-D*B)*R);ba.set((J*E-P*H)*R,(J*Q-P*O)*R,(J*B-P*Y)*R);i[a].addSelf(N);i[b].addSelf(N);i[c].addSelf(N);l[a].addSelf(ba);l[b].addSelf(ba);l[c].addSelf(ba)}function b(a){ma.x=e[a*3];ma.y=e[a*3+1];ma.z=e[a*3+2];za.copy(ma);Oa=i[a];T.copy(Oa);T.subSelf(ma.multiplyScalar(ma.dot(Oa))).normalize();ia.cross(za,Oa);Pa=ia.dot(l[a]);Ga=Pa<0?-1:1;
-j[a*4]=T.x;j[a*4+1]=T.y;j[a*4+2]=T.z;j[a*4+3]=Ga}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;if(this.attributes.tangent===void 0){var h=4*g;this.attributes.tangent=
-{itemSize:4,array:new Float32Array(h),numItems:h}}for(var j=this.attributes.tangent.array,i=[],l=[],h=0;h<g;h++){i[h]=new THREE.Vector3;l[h]=new THREE.Vector3}var o,n,p,r,m,q,s,u,t,v,x,F,C,z,w,H,E,O,Q,Y,B,J,P,D,W,R,N=new THREE.Vector3,ba=new THREE.Vector3,U,I,ca,ha,L,X=this.offsets,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;var S=X[h].index,g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];a(ca,ha,L)}}var T=new THREE.Vector3,ia=new THREE.Vector3,ma=new THREE.Vector3,za=new THREE.Vector3,
-Ga,Oa,Pa,h=0;for(I=X.length;h<I;++h){U=X[h].start;ca=X[h].count;S=X[h].index;g=U;for(U=U+ca;g<U;g=g+3){ca=S+c[g];ha=S+c[g+1];L=S+c[g+2];b(ca);b(ha);b(L)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,p,r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,w=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var t=e[c].index;a=b;for(b=b+i;a<b;a=a+3){i=t+f[a];j=t+f[a+1];l=t+f[a+2];m=g[i*3];n=g[i*3+1];p=g[i*3+2];r.set(m,n,p);m=g[j*3];n=g[j*3+1];p=g[j*3+2];o.set(m,n,p);m=g[l*3];n=g[l*3+1];p=g[l*3+2];q.set(m,n,p);s.sub(q,o);w.sub(r,
+o);s.crossSelf(w);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){m=h[a];n=h[a+1];p=h[a+2];c=1/Math.sqrt(m*m+n*n+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){m=d[a*3];n=d[a*3+1];p=d[a*3+2];r=d[b*3];o=d[b*3+1];q=d[b*3+2];s=d[c*3];w=d[c*3+1];t=d[c*3+2];v=
+f[a*2];x=f[a*2+1];C=f[b*2];D=f[b*2+1];z=f[c*2];u=f[c*2+1];G=r-m;J=s-m;M=o-n;O=w-n;X=q-p;B=t-p;F=C-v;Q=z-v;E=D-x;aa=u-x;T=1/(F*aa-Q*E);N.set((aa*G-E*J)*T,(aa*M-E*O)*T,(aa*X-E*B)*T);W.set((F*J-Q*G)*T,(F*O-Q*M)*T,(F*B-Q*X)*T);j[a].addSelf(N);j[b].addSelf(N);j[c].addSelf(N);l[a].addSelf(W);l[b].addSelf(W);l[c].addSelf(W)}function b(a){ma.x=e[a*3];ma.y=e[a*3+1];ma.z=e[a*3+2];Ga.copy(ma);Oa=j[a];U.copy(Oa);U.subSelf(ma.multiplyScalar(ma.dot(Oa))).normalize();fa.cross(Ga,Oa);Pa=fa.dot(l[a]);na=Pa<0?-1:1;
+i[a*4]=U.x;i[a*4+1]=U.y;i[a*4+2]=U.z;i[a*4+3]=na}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;if(this.attributes.tangent===void 0){var h=4*g;this.attributes.tangent=
+{itemSize:4,array:new Float32Array(h),numItems:h}}for(var i=this.attributes.tangent.array,j=[],l=[],h=0;h<g;h++){j[h]=new THREE.Vector3;l[h]=new THREE.Vector3}var m,n,p,r,o,q,s,w,t,v,x,C,D,z,u,G,J,M,O,X,B,F,Q,E,aa,T,N=new THREE.Vector3,W=new THREE.Vector3,ba,H,ca,ia,S,R=this.offsets,h=0;for(H=R.length;h<H;++h){ba=R[h].start;ca=R[h].count;var P=R[h].index,g=ba;for(ba=ba+ca;g<ba;g=g+3){ca=P+c[g];ia=P+c[g+1];S=P+c[g+2];a(ca,ia,S)}}var U=new THREE.Vector3,fa=new THREE.Vector3,ma=new THREE.Vector3,Ga=
+new THREE.Vector3,na,Oa,Pa,h=0;for(H=R.length;h<H;++h){ba=R[h].start;ca=R[h].count;P=R[h].index;g=ba;for(ba=ba+ca;g<ba;g=g+3){ca=P+c[g];ia=P+c[g+1];S=P+c[g+2];b(ca);b(ia);b(S)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};
 THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
 THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
 THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
 THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,j;g<=h;){d=Math.floor(g+(h-g)/2);j=c[d]-f;if(j<0)g=d+1;else if(j>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-f;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};
 THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};
 THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().subSelf(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);
 THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().subSelf(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
@@ -530,10 +530,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
 THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return a.getPointAt(b)}a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return a.getPointAt(b)}a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++){b=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++){b=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,j;j=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<e)e=f.y;j.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<e)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,j;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else this.matrixWorld.copy(this.matrix);
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else 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)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
 this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
 THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
 THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
@@ -541,34 +541,34 @@ THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(argum
 THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
 THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+a,h.y+b,c,d,e,f,g)};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+a,h.y+b,c,d,e,f,g)};
-THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+a,g.y+b,c,d,e,f)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),j=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(j);j=j.getPoint(g?1:0);h.push(j.x);h.push(j.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};
+THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+a,g.y+b,c,d,e,f)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,j,i,l,o,n,p,r,m;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];j=f[3];o=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
-p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b2(m,p,o,h);m=THREE.Shape.Utils.b2(m,r,n,j);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];j=f[5];o=f[0];n=f[1];i=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b3(m,p,o,i,h);m=THREE.Shape.Utils.b3(m,r,n,l,j);c.push(new THREE.Vector2(g,
-m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;m=m.concat(f[0]);m=new THREE.SplineCurve(m);for(f=1;f<=g;f++)c.push(m.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];j=f[1];n=f[2];i=f[3];g=f[4];o=!!f[5];p=g-i;r=a*2;for(f=1;f<=r;f++){m=f/r;o||(m=1-m);m=i+m*p;g=h+n*Math.cos(m);m=j+n*Math.sin(m);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.ELLIPSE:h=f[0];j=f[1];n=f[2];l=f[3];i=f[4];g=f[5];
-o=!!f[6];p=g-i;r=a*2;for(f=1;f<=r;f++){m=f/r;o||(m=1-m);m=i+m*p;g=h+n*Math.cos(m);m=j+l*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,j,l,m,n,p,r,o;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];m=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b2(o,p,m,h);o=THREE.Shape.Utils.b2(o,r,n,i);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];m=f[0];n=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b3(o,p,m,j,h);o=THREE.Shape.Utils.b3(o,r,n,l,i);c.push(new THREE.Vector2(g,
+o))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;o=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;o=o.concat(f[0]);o=new THREE.SplineCurve(o);for(f=1;f<=g;f++)c.push(o.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];n=f[2];j=f[3];g=f[4];m=!!f[5];p=g-j;r=a*2;for(f=1;f<=r;f++){o=f/r;m||(o=1-o);o=j+o*p;g=h+n*Math.cos(o);o=i+n*Math.sin(o);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];n=f[2];l=f[3];j=f[4];g=f[5];
+m=!!f[6];p=g-j;r=a*2;for(f=1;f<=r;f++){o=f/r;m||(o=1-o);o=j+o*p;g=h+n*Math.cos(o);o=i+l*Math.sin(o);c.push(new THREE.Vector2(g,o))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
 b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
 THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,j,i,l,o,n,p,r=[];for(j=0;j<b.length;j++){i=b[j];Array.prototype.push.apply(d,i);f=Number.POSITIVE_INFINITY;for(e=0;e<i.length;e++){n=i[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=n.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1;var m=[i[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[i[g],i[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1;m=[i[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[i[g],i[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+n>m+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:i.length-1}o=c.slice(0,h);n=c.slice(h);p=i.slice(g);l=i.slice(0,g);f=[i[g],i[f],c[h]];r.push([i[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(n)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,j,i={};f=0;for(g=d.length;f<g;f++){j=d[f].x+":"+d[f].y;i[j]!==void 0&&console.log("Duplicate point",j);i[j]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,m,n,p,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){n=j[e];p=[];for(m=0;m<c.length;m++){l=c[m];l=n.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=m}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var o=[j[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(o);var q=[j[g],j[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;o=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(m+n>o+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}m=c.slice(0,h);n=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=m.concat(p).concat(l).concat(n)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};
 this.b3p3(a,e)}};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<0)a.hierarchy[c].keys[d].time=
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<0)a.hierarchy[c].keys[d].time=
-0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var i=a.hierarchy[c].keys[d].morphTargets[j];h[i]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l=
-{};for(i in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===i){l[i]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(l[i]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l=
+{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(this.isPlaying===false){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(this.isPlaying===false){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused===true?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused===true?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this)};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,e,f,g,h,j,i,l;l=this.currentTime=this.currentTime+a*this.timeScale;i=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(i*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,n=this.hierarchy.length;o<n;o++){a=this.hierarchy[o];j=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=l){if(i<l)if(this.loop){g=this.data.hierarchy[o].keys[0];
-for(h=this.getNextKeyWith(c,o,1);h.time<i;){g=h;h=this.getNextKeyWith(c,o,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,o,h.index+1)}while(h.time<i)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(i-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+
-(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,l;l=this.currentTime=this.currentTime+a*this.timeScale;j=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,n=this.hierarchy.length;m<n;m++){a=this.hierarchy[m];i=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(j<l)if(this.loop){g=this.data.hierarchy[m].keys[0];
+for(h=this.getNextKeyWith(c,m,1);h.time<j;){g=h;h=this.getNextKeyWith(c,m,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,m,h.index+1)}while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(j-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+
+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
 this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}};
 this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,j,i;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]];j=a[c[2]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],j[0],i[0],e,c,g);d[1]=this.interpolate(f[1],h[1],j[1],i[1],e,c,g);d[2]=this.interpolate(f[2],h[2],j[2],i[2],e,c,g);return d};
+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.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.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.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=
@@ -576,14 +576,14 @@ 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?
 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};
 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};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((j=g<h)&&!this.loop){for(var a=0,i=this.hierarchy.length;a<i;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
-this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
-true}else if(l.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(j&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!j)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,m=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
+true}else if(l.length){if(this.JITCompile&&m)d instanceof THREE.Bone?d.skinMatrix=m.originalMatrix:d.matrix=m.originalMatrix;b=m.prevKey;c=m.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[b.index+1]}m.prevKey=b;m.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
 for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var j=new THREE.PerspectiveCamera(90,1,a,b);j.up.set(0,-1,0);j.lookAt(new THREE.Vector3(0,0,-1));this.add(j);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
-2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,j,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
+2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};
 THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=true;this.inOrthographicMode=false};
 THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=true;this.inOrthographicMode=false};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=false;this.inOrthographicMode=true};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=false;this.inOrthographicMode=true};
 THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
 THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
@@ -617,78 +617,78 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 this.object.matrixWorldNeedsUpdate=true};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,j=0,i=0,l=0,o=0,n=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
-function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*i);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,j=0,l=0,m=0,n=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
+function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*m);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;n=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
-1;break;case 37:case 65:i=-1;break;case 40:case 83:j=-1;break;case 39:case 68:i=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:i=0;break;case 40:case 83:j=0;break;case 39:case 68:i=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false);this.handleResize()};
+false);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-p)/window.innerWidth;n=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false);this.handleResize()};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;this.screen={width:0,height:0,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3;var d=
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;this.screen={width:0,height:0,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3;var d=
-new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
+new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
 b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};
 b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};
-this.rotateCamera=function(){var a=Math.acos(h.dot(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-i.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?i=l:i.y=i.y+(l.y-i.y)*
-this.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=n:o.addSelf(a.sub(n,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
+this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*
+this.dynamicDampingFactor}};this.panCamera=function(){var a=n.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?m=n:m.addSelf(a.sub(n,m).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
 g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
 g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
-this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);i=l=c.getMouseOnScreen(a.clientX,a.clientY);o=n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
-a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?i=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=n=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?
+this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=l=c.getMouseOnScreen(a.clientX,a.clientY);m=n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
+a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=n=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?
 f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false);this.handleResize()};
 f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false);this.handleResize()};
-THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*j.autoRotateSpeed}function g(a){a.preventDefault();if(v===c){o.set(a.clientX,a.clientY);n.sub(o,l);j.rotateLeft(2*Math.PI*n.x/i*j.userRotateSpeed);j.rotateUp(2*Math.PI*n.y/i*j.userRotateSpeed);l.copy(o)}else if(v===d){r.set(a.clientX,a.clientY);m.sub(r,p);m.y>0?j.zoomIn():j.zoomOut();p.copy(r)}}function h(){if(j.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
-v=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var j=this,i=1800,l=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,m=new THREE.Vector2,q=0,s=0,u=1,t=new THREE.Vector3;e=-1;c=0;d=1;var v=e,x={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
-s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());q=q-a};this.rotateDown=function(a){a===void 0&&(a=f());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,j.userZoomSpeed));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,j.userZoomSpeed));u=u*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
-var c=c+s,d=d+q,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;u=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(x);t.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(j.userRotate){a.preventDefault();
-if(a.button===0||a.button===2){v=c;l.set(a.clientX,a.clientY)}else if(a.button===1){v=d;p.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){j.userZoom&&(a.wheelDelta>0?j.zoomOut():j.zoomIn())},false)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,q=h/2,r=j/2,s=i.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var t=o+1,u=p+1,R=h/o,N=j/p,ba=new THREE.Vector3;ba[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<t;j++){var U=new THREE.Vector3;U[a]=(j*R-q)*c;U[b]=(h*N-r)*g;U[n]=l;i.vertices.push(U)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
-t*h+s,j+t*(h+1)+s,j+1+t*(h+1)+s,j+1+t*h+s);a.normal.copy(ba);a.vertexNormals.push(ba.clone(),ba.clone(),ba.clone(),ba.clone());a.materialIndex=m;i.faces.push(a);i.faceVertexUvs[0].push([new THREE.UV(j/o,1-h/p),new THREE.UV(j/o,1-(h+1)/p),new THREE.UV((j+1)/o,1-(h+1)/p),new THREE.UV((j+1)/o,1-h/p)])}}THREE.Geometry.call(this);var i=this,l=a/2,o=b/2,n=c/2,p,r,m,q,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;s=3;m=
-4;u=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&j("z","y",-1,-1,c,b,l,p);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,o,r);this.sides.ny&&j("x","z",1,-1,a,c,-o,s);this.sides.pz&&j("x","y",1,-1,a,b,n,m);this.sides.nz&&j("x","y",-1,-1,a,b,-n,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,i=[],l=[];for(j=0;j<=e;j++){var o=[],n=[],p=j/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=new THREE.Vector3;q.x=r*Math.sin(m*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(m*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);n.push(new THREE.UV(m,p))}i.push(o);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[i[0][h]].clone();n=this.vertices[i[0][h+
-1]].clone()}else{o=this.vertices[i[1][h]].clone();n=this.vertices[i[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(j=0;j<e;j++){var p=i[j][h],r=i[j+1][h],m=i[j+1][h+1],q=i[j][h+1],s=o.clone(),u=o.clone(),t=n.clone(),v=n.clone(),x=l[j][h].clone(),F=l[j+1][h].clone(),C=l[j+1][h+1].clone(),z=l[j][h+1].clone();this.faces.push(new THREE.Face4(p,r,m,q,[s,u,t,v]));this.faceVertexUvs[0].push([x,F,C,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
-g,0));for(h=0;h<d;h++){p=i[0][h];r=i[0][h+1];m=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);x=l[0][h].clone();F=l[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,m,[s,u,t]));this.faceVertexUvs[0].push([x,F,C])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=i[j][h+1];r=i[j][h];m=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);
-x=l[j][h+1].clone();F=l[j][h].clone();C=new THREE.UV(F.u,1);this.faces.push(new THREE.Face3(p,r,m,[s,u,t]));this.faceVertexUvs[0].push([x,F,C])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};
+THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(v===c){m.set(a.clientX,a.clientY);n.sub(m,l);i.rotateLeft(2*Math.PI*n.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*n.y/j*i.userRotateSpeed);l.copy(m)}else if(v===d){r.set(a.clientX,a.clientY);o.sub(r,p);o.y>0?i.zoomIn():i.zoomOut();p.copy(r)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
+v=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var i=this,j=1800,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,o=new THREE.Vector2,q=0,s=0,w=1,t=new THREE.Vector3;e=-1;c=0;d=1;var v=e,x={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
+s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());q=q-a};this.rotateDown=function(a){a===void 0&&(a=f());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));w=w/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));w=w*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
+var c=c+s,d=d+q,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(w);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;w=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(x);t.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(i.userRotate){a.preventDefault();
+if(a.button===0||a.button===2){v=c;l.set(a.clientX,a.clientY)}else if(a.button===1){v=d;p.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){i.userZoom&&(a.wheelDelta>0?i.zoomOut():i.zoomIn())},false)};
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,p=d||1,o=e||1,q=h/2,r=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";o=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";p=f||1}var t=p+1,w=o+1,T=h/p,N=i/o,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<w;h++)for(i=0;i<t;i++){var ba=new THREE.Vector3;ba[a]=(i*T-q)*c;ba[b]=(h*N-r)*g;ba[n]=l;j.vertices.push(ba)}for(h=0;h<o;h++)for(i=0;i<p;i++){a=new THREE.Face4(i+
+t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(W);a.vertexNormals.push(W.clone(),W.clone(),W.clone(),W.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/p,1-h/o),new THREE.UV(i/p,1-(h+1)/o),new THREE.UV((i+1)/p,1-(h+1)/o),new THREE.UV((i+1)/p,1-h/o)])}}THREE.Geometry.call(this);var j=this,l=a/2,m=b/2,n=c/2,p,r,o,q,s,w;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;s=3;o=4;w=
+5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,m,r);this.sides.ny&&i("x","z",1,-1,a,c,-m,s);this.sides.pz&&i("x","y",1,-1,a,b,n,o);this.sides.nz&&i("x","y",-1,-1,a,b,-n,w);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var o=h/d,q=new THREE.Vector3;q.x=r*Math.sin(o*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(o*Math.PI*2);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.UV(o,p))}j.push(m);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){m=this.vertices[j[0][h]].clone();n=this.vertices[j[0][h+
+1]].clone()}else{m=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],r=j[i+1][h],o=j[i+1][h+1],q=j[i][h+1],s=m.clone(),w=m.clone(),t=n.clone(),v=n.clone(),x=l[i][h].clone(),C=l[i+1][h].clone(),D=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,o,q,[s,w,t,v]));this.faceVertexUvs[0].push([x,C,D,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
+g,0));for(h=0;h<d;h++){p=j[0][h];r=j[0][h+1];o=this.vertices.length-1;s=new THREE.Vector3(0,1,0);w=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);x=l[0][h].clone();C=l[0][h+1].clone();D=new THREE.UV(C.u,0);this.faces.push(new THREE.Face3(p,r,o,[s,w,t]));this.faceVertexUvs[0].push([x,C,D])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=j[i][h+1];r=j[i][h];o=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);w=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);
+x=l[i][h+1].clone();C=l[i][h].clone();D=new THREE.UV(C.u,1);this.faces.push(new THREE.Face3(p,r,o,[s,w,t]));this.faceVertexUvs[0].push([x,C,D])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};
 THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(I=c.length;--I>=0;){e=I;f=I-1;f<0&&(f=
-c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var i=N*g,j=N*(g+1),m=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,q=g,r=h,s=e,v=f,m=m+O,i=i+O,o=o+O,j=j+O;E.faces.push(new THREE.Face4(m,i,o,j,null,null,u));m=t.generateSideWallUV(E,a,p,b,m,i,o,j,q,r,s,v);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+O;d=d+O;e=e+O;E.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?t.generateBottomUV(E,a,b,c,d,e):t.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}
-var h=b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,i=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,m,q=false,s=b.material,u=b.extrudeMaterial,t=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,x,F,C;if(r){m=r.getSpacedPoints(n);q=true;o=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
-n,false);x=new THREE.Vector3;F=new THREE.Vector3;C=new THREE.Vector3}if(!o)i=j=l=0;var z,w,H,E=this,O=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,Q=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();w=0;for(H=Q.length;w<H;w++){z=Q[w];THREE.Shape.Utils.isClockWise(z)&&(Q[w]=z.reverse())}r=false}var Y=THREE.Shape.Utils.triangulateShape(p,Q),B=p;w=0;for(H=Q.length;w<H;w++){z=Q[w];p=p.concat(z)}var J,P,D,W,R,N=p.length,ba,U=Y.length,r=[],I=0;D=B.length;J=D-1;
-for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);r[I]=d(B[I],B[J],B[P])}var ca=[],ha,L=r.concat();w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=[];I=0;D=z.length;J=D-1;for(P=I+1;I<D;I++,J++,P++){J===D&&(J=0);P===D&&(P=0);ha[I]=d(z[I],z[J],z[P])}ca.push(ha);L=L.concat(ha)}for(J=0;J<l;J++){D=J/l;W=j*(1-D);P=i*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=c(B[I],r[I],P);f(R.x,R.y,-W)}w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=ca[w];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);f(R.x,R.y,-W)}}}P=i;for(I=
-0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(v.normals[0]).multiplyScalar(R.x);x.copy(v.binormals[0]).multiplyScalar(R.y);C.copy(m[0]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,0)}for(D=1;D<=n;D++)for(I=0;I<N;I++){R=o?c(p[I],L[I],P):p[I];if(q){F.copy(v.normals[D]).multiplyScalar(R.x);x.copy(v.binormals[D]).multiplyScalar(R.y);C.copy(m[D]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(R.x,R.y,h/n*D)}for(J=l-1;J>=0;J--){D=J/l;W=j*(1-D);P=i*Math.sin(D*Math.PI/2);I=0;for(D=B.length;I<D;I++){R=
-c(B[I],r[I],P);f(R.x,R.y,h+W)}w=0;for(H=Q.length;w<H;w++){z=Q[w];ha=ca[w];I=0;for(D=z.length;I<D;I++){R=c(z[I],ha[I],P);q?f(R.x,R.y+m[n-1].y,m[n-1].x+W):f(R.x,R.y,h+W)}}}(function(){if(o){var a;a=N*0;for(I=0;I<U;I++){ba=Y[I];g(ba[2]+a,ba[1]+a,ba[0]+a,true)}a=n+l*2;a=N*a;for(I=0;I<U;I++){ba=Y[I];g(ba[0]+a,ba[1]+a,ba[2]+a,false)}}else{for(I=0;I<U;I++){ba=Y[I];g(ba[2],ba[1],ba[0],true)}for(I=0;I<U;I++){ba=Y[I];g(ba[0]+N*n,ba[1]+N*n,ba[2]+N*n,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;w=0;for(H=
-Q.length;w<H;w++){z=Q[w];e(z,a);a=a+z.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,j=a.vertices[f].y,f=a.vertices[f].z,i=a.vertices[g].x,l=
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(i,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(n,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(H=c.length;--H>=0;){e=H;f=H-1;f<0&&(f=
+c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var i=N*g,j=N*(g+1),m=d+e+i,i=d+f+i,p=d+f+j,j=d+e+j,o=c,q=g,r=h,s=e,u=f,m=m+M,i=i+M,p=p+M,j=j+M;J.faces.push(new THREE.Face4(m,i,p,j,null,null,w));m=t.generateSideWallUV(J,a,o,b,m,i,p,j,q,r,s,u);J.faceVertexUvs[0].push(m)}}}function f(a,b,c){J.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+M;d=d+M;e=e+M;J.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?t.generateBottomUV(J,a,b,c,d,e):t.generateTopUV(J,a,b,c,d,e);J.faceVertexUvs[0].push(c)}
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,m=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,o,q=false,s=b.material,w=b.extrudeMaterial,t=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,x,C,D;if(r){o=r.getSpacedPoints(n);q=true;m=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
+n,false);x=new THREE.Vector3;C=new THREE.Vector3;D=new THREE.Vector3}if(!m)j=i=l=0;var z,u,G,J=this,M=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,O=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();u=0;for(G=O.length;u<G;u++){z=O[u];THREE.Shape.Utils.isClockWise(z)&&(O[u]=z.reverse())}r=false}var X=THREE.Shape.Utils.triangulateShape(p,O),B=p;u=0;for(G=O.length;u<G;u++){z=O[u];p=p.concat(z)}var F,Q,E,aa,T,N=p.length,W,ba=X.length,r=[],H=0;E=B.length;F=E-1;
+for(Q=H+1;H<E;H++,F++,Q++){F===E&&(F=0);Q===E&&(Q=0);r[H]=d(B[H],B[F],B[Q])}var ca=[],ia,S=r.concat();u=0;for(G=O.length;u<G;u++){z=O[u];ia=[];H=0;E=z.length;F=E-1;for(Q=H+1;H<E;H++,F++,Q++){F===E&&(F=0);Q===E&&(Q=0);ia[H]=d(z[H],z[F],z[Q])}ca.push(ia);S=S.concat(ia)}for(F=0;F<l;F++){E=F/l;aa=i*(1-E);Q=j*Math.sin(E*Math.PI/2);H=0;for(E=B.length;H<E;H++){T=c(B[H],r[H],Q);f(T.x,T.y,-aa)}u=0;for(G=O.length;u<G;u++){z=O[u];ia=ca[u];H=0;for(E=z.length;H<E;H++){T=c(z[H],ia[H],Q);f(T.x,T.y,-aa)}}}Q=j;for(H=
+0;H<N;H++){T=m?c(p[H],S[H],Q):p[H];if(q){C.copy(v.normals[0]).multiplyScalar(T.x);x.copy(v.binormals[0]).multiplyScalar(T.y);D.copy(o[0]).addSelf(C).addSelf(x);f(D.x,D.y,D.z)}else f(T.x,T.y,0)}for(E=1;E<=n;E++)for(H=0;H<N;H++){T=m?c(p[H],S[H],Q):p[H];if(q){C.copy(v.normals[E]).multiplyScalar(T.x);x.copy(v.binormals[E]).multiplyScalar(T.y);D.copy(o[E]).addSelf(C).addSelf(x);f(D.x,D.y,D.z)}else f(T.x,T.y,h/n*E)}for(F=l-1;F>=0;F--){E=F/l;aa=i*(1-E);Q=j*Math.sin(E*Math.PI/2);H=0;for(E=B.length;H<E;H++){T=
+c(B[H],r[H],Q);f(T.x,T.y,h+aa)}u=0;for(G=O.length;u<G;u++){z=O[u];ia=ca[u];H=0;for(E=z.length;H<E;H++){T=c(z[H],ia[H],Q);q?f(T.x,T.y+o[n-1].y,o[n-1].x+aa):f(T.x,T.y,h+aa)}}}(function(){if(m){var a;a=N*0;for(H=0;H<ba;H++){W=X[H];g(W[2]+a,W[1]+a,W[0]+a,true)}a=n+l*2;a=N*a;for(H=0;H<ba;H++){W=X[H];g(W[0]+a,W[1]+a,W[2]+a,false)}}else{for(H=0;H<ba;H++){W=X[H];g(W[2],W[1],W[0],true)}for(H=0;H<ba;H++){W=X[H];g(W[0]+N*n,W[1]+N*n,W[2]+N*n,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;u=0;for(G=O.length;u<
+G;u++){z=O[u];e(z,a);a=a+z.length}})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,m=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(m,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(n,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
 (c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
 (c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,i=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*j-e,0,a*i-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*j-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
 1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
 1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,i=[],l=[];for(j=0;j<=c;j++){var o=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=j/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);m.y=a*Math.cos(f+r*g);m.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(m);o.push(this.vertices.length-1);n.push(new THREE.UV(p,
-1-r))}i.push(o);l.push(n)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=i[j][h+1],e=i[j][h],f=i[j+1][h],g=i[j+1][h+1],o=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),m=l[j][h+1].clone(),q=l[j][h].clone(),s=l[j+1][h].clone(),u=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([m,s,u])}else if(Math.abs(this.vertices[f].y)==
-a){this.faces.push(new THREE.Face3(d,e,f,[o,n,p]));this.faceVertexUvs[0].push([m,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,n,p,r]));this.faceVertexUvs[0].push([m,q,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,o=new THREE.Vector3;o.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);o.y=a*Math.cos(f+r*g);o.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(o);m.push(this.vertices.length-1);n.push(new THREE.UV(p,
+1-r))}j.push(m);l.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),o=l[i][h+1].clone(),q=l[i][h].clone(),s=l[i+1][h].clone(),w=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[m,p,r]));this.faceVertexUvs[0].push([o,s,w])}else if(Math.abs(this.vertices[f].y)==
+a){this.faces.push(new THREE.Face3(d,e,f,[m,n,p]));this.faceVertexUvs[0].push([o,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[m,n,p,r]));this.faceVertexUvs[0].push([o,q,s,w])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
 THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
-this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
+this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
-this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,j,i,l])}this.computeCentroids();this.computeFaceNormals();
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
+this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,j,i,l,o=new THREE.Vector3,n,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);n=b.tangents;p=b.normals;r=b.binormals;this.tangents=n;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;i=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);o.copy(l);o.x=o.x+(i*g.x+j*h.x);o.y=o.y+(i*g.y+j*h.y);o.z=o.z+(i*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];n=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,i,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(i=0;i<b;i++){l=i/(b-1);e[i]=a.getTangentAt(l);e[i].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(i<=a){a=i;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(i=1;i<b;i++){f[i]=f[i-1].clone();g[i]=g[i-1].clone();h.cross(e[i-1],e[i]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[i-1].dot(e[i]));j.makeRotationAxis(h,d).multiplyVector3(f[i])}g[i].cross(e[i],f[i])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(i=1;i<b;i++){j.makeRotationAxis(e[i],d*i).multiplyVector3(f[i]);g[i].cross(e[i],f[i])}}};
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
-j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,j=this,i=0,l=a.length;i<l;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var o=[],a=this.vertices,i=0,l=b.length;i<l;i++)f(a[b[i][0]],a[b[i][1]],a[b[i][2]],d);this.mergeVertices();i=0;for(l=this.vertices.length;i<l;i++)this.vertices[i].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,j,l,m=new THREE.Vector3,n,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);n=b.tangents;p=b.normals;r=b.binormals;this.tangents=n;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);m.copy(l);m.x=m.x+(j*g.x+i*h.x);m.y=m.y+(j*g.y+i*h.y);m.z=m.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(m.x,m.y,m.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;m=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][m];m=this.grid[b][m];n=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,m));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,m;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);m=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}m<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
+i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){m[a.index]||(m[a.index]=[]);m[b.index]||(m[b.index]=[]);var c=m[a.index][b.index];c===void 0&&(m[a.index][b.index]=m[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var m=[],a=this.vertices,j=0,l=b.length;j<l;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,j,i,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(j=0;j<=b;j++){i=j/b;i=a(i,l);e.push(i)}}var n,p,r,m;for(h=0;h<c;h++)for(j=0;j<b;j++){a=h*o+j;e=h*o+j+1;l=(h+1)*o+j;i=(h+1)*o+j+1;n=new THREE.UV(j/b,h/c);p=new THREE.UV((j+1)/b,h/c);r=new THREE.UV(j/b,(h+1)/c);m=new THREE.UV((j+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,i,l));g.push([n,
-p,r]);g.push([p,m,r])}else{f.push(new THREE.Face4(a,e,i,l));g.push([n,p,m,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,j=a[h[0]],s;s=j;var u=a[h[1]],t=a[h[2]],v=new THREE.Vector3,x=new THREE.Vector3;v.sub(t,u);x.sub(s,u);v.crossSelf(x);v.isZero()||v.normalize();s=v;j=s.dot(j);if(s.dot(i)>=j){for(i=0;i<3;i++){j=[h[i],h[(i+1)%3]];s=true;for(u=0;u<f.length;u++)if(f[u][0]===j[1]&&f[u][1]===j[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
-e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var j=e[f],i=0;i<3;i++){if(h[j[i]]===void 0){h[j[i]]=g++;this.vertices.push(a[j[i]])}j[i]=h[j[i]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
-for(f=0;f<this.faces.length;f++){j=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[j.a]),d(this.vertices[j.b]),d(this.vertices[j.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,l,m=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);e.push(j)}}var n,p,r,o;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*m+i;e=h*m+i+1;l=(h+1)*m+i;j=(h+1)*m+i+1;n=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);r=new THREE.UV(i/b,(h+1)/c);o=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,j,l));g.push([n,
+p,r]);g.push([p,o,r])}else{f.push(new THREE.Face4(a,e,j,l));g.push([n,p,o,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,j=a[h[0]],s;s=j;var w=a[h[1]],t=a[h[2]],v=new THREE.Vector3,x=new THREE.Vector3;v.sub(t,w);x.sub(s,w);v.crossSelf(x);v.isZero()||v.normalize();s=v;j=s.dot(j);if(s.dot(i)>=j){for(i=0;i<3;i++){j=[h[i],h[(i+1)%3]];s=true;for(w=0;w<f.length;w++)if(f[w][0]===j[1]&&f[w][1]===j[0]){f[w]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
+e[e.length-1];e.pop()}else g++}for(w=0;w<f.length;w++)e.push([f[w][0],f[w][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var i=e[f],j=0;j<3;j++){if(h[i[j]]===void 0){h[i[j]]=g++;this.vertices.push(a[i[j]])}i[j]=h[i[j]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
+for(f=0;f<this.faces.length;f++){i=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[i.a]),d(this.vertices[i.b]),d(this.vertices[i.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(new THREE.Vector3(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(new THREE.Vector3(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=Object.create(THREE.Object3D.prototype);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=Object.create(THREE.Object3D.prototype);
 THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(b instanceof THREE.Vector3)this.position=
 THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(b instanceof THREE.Vector3)this.position=
@@ -700,58 +700,58 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(n.useOldVertexColors){j.vertexColors=[];for(var m,p,q,r=0;r<4;r++){q=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];m.r=m.r+p.r;m.g=m.g+p.g;m.b=m.b+p.b}m.r=m.r/q.length;m.g=m.g/q.length;m.b=m.b/
-q.length;j.vertexColors[r]=m}}l.push(j);if(n.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=u[e];if(!f){a>=t&&a<t+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in u?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,u[e]):u[e]=d}function h(a,
-b){Q[a]===void 0&&(Q[a]=[]);Q[a].push(b)}function j(a,b,c){Y[a]===void 0&&(Y[a]={});Y[a][b]=c}var i=[],l=[],o=[],n=this,p=a.vertices,r=a.faces,i=p.concat(),m=[],q={},s={},u={},t=p.length,v,x,F,C,z,w=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,t);if(n.supportUVs){v=0;for(x=w.length;v<x;v++){F=0;for(C=w[v].length;F<C;F++){H=r[v]["abcd".charAt(F)];g(H,v,w[v][F])}}}if(w.length==0)n.supportUVs=false;v=0;for(z in u)v++;if(!v){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-u,"vs",w.length);v=0;for(x=r.length;v<x;v++){z=r[v];m.push(z.centroid);i.push(z.centroid);if(n.supportUVs){w=new THREE.UV;if(z instanceof THREE.Face3){w.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u;w.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v;w.u=w.u/3;w.v=w.v/3}else if(z instanceof THREE.Face4){w.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u+f(z.d,v).u;w.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v+f(z.d,v).v;w.u=w.u/4;w.v=w.v/4}g(t+v,"",w)}}b("-- added UVs for new Faces",u);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var E,O,Q={},Y={};for(v in x){w=x[v];E=v.split("_");O=E[0];E=E[1];h(O,[O,E]);h(E,[O,E]);F=0;for(C=w.length;F<C;F++){z=w[F];j(O,z,v);j(E,z,v)}w.length<2&&(s[v]=true)}b("vertexEdgeMap",Q,"vertexFaceMap",Y);for(v in x){w=
-x[v];z=w[0];C=w[1];E=v.split("_");O=E[0];E=E[1];w=new THREE.Vector3;if(s[v]){w.addSelf(p[O]);w.addSelf(p[E]);w.multiplyScalar(0.5)}else{w.addSelf(m[z]);w.addSelf(m[C]);w.addSelf(p[O]);w.addSelf(p[E]);w.multiplyScalar(0.25)}q[v]=t+r.length+H;i.push(w);H++;if(n.supportUVs){w=new THREE.UV;w.u=f(O,z).u+f(E,z).u;w.v=f(O,z).v+f(E,z).v;w.u=w.u/2;w.v=w.v/2;g(q[v],z,w);if(!s[v]){w=new THREE.UV;w.u=f(O,C).u+f(E,C).u;w.v=f(O,C).v+f(E,C).v;w.u=w.u/2;w.v=w.v/2;g(q[v],C,w)}}}b("-- Step 2 done");var B,J;C=["123",
-"12","2","23"];E=["123","23","3","31"];var P=["123","31","1","12"],D=["1234","12","2","23"],W=["1234","23","3","34"],R=["1234","34","4","41"],N=["1234","41","1","12"];v=0;for(x=m.length;v<x;v++){z=r[v];w=t+v;if(z instanceof THREE.Face3){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.a);d(w,q[H],z.b,q[O],z,C,v);d(w,q[O],z.c,q[B],z,E,v);d(w,q[B],z.a,q[H],z,P,v)}else if(z instanceof THREE.Face4){H=e(z.a,z.b);O=e(z.b,z.c);B=e(z.c,z.d);J=e(z.d,z.a);d(w,q[H],z.b,q[O],z,D,v);d(w,q[O],z.c,q[B],z,W,v);d(w,q[B],z.d,q[J],
-z,R,v);d(w,q[J],z.a,q[H],z,N,v)}else b("face should be a face!",z)}q=new THREE.Vector3;z=new THREE.Vector3;v=0;for(x=p.length;v<x;v++)if(Q[v]!==void 0){q.set(0,0,0);z.set(0,0,0);O=new THREE.Vector3(0,0,0);w=0;for(F in Y[v]){q.addSelf(m[F]);w++}C=0;H=Q[v].length;for(F=0;F<H;F++)s[e(Q[v][F][0],Q[v][F][1])]&&C++;if(C!=2){q.divideScalar(w);for(F=0;F<H;F++){w=Q[v][F];w=p[w[0]].clone().addSelf(p[w[1]]).divideScalar(2);z.addSelf(w)}z.divideScalar(H);O.addSelf(p[v]);O.multiplyScalar(H-3);O.addSelf(q);O.addSelf(z.multiplyScalar(2));
-O.divideScalar(H);i[v]=O}}a.vertices=i;a.faces=l;a.faceVertexUvs[0]=o;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(n.useOldVertexColors){j.vertexColors=[];for(var o,p,q,r=0;r<4;r++){q=h[r];o=new THREE.Color;o.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];o.r=o.r+p.r;o.g=o.g+p.g;o.b=o.b+p.b}o.r=o.r/q.length;o.g=o.g/q.length;o.b=o.b/
+q.length;j.vertexColors[r]=o}}l.push(j);if(n.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?m.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=w[e];if(!f){a>=t&&a<t+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in w?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,w[e]):w[e]=d}function h(a,
+b){O[a]===void 0&&(O[a]=[]);O[a].push(b)}function i(a,b,c){X[a]===void 0&&(X[a]={});X[a][b]=c}var j=[],l=[],m=[],n=this,p=a.vertices,r=a.faces,j=p.concat(),o=[],q={},s={},w={},t=p.length,v,x,C,D,z,u=a.faceVertexUvs[0],G;b("originalFaces, uvs, originalVerticesLength",r.length,u.length,t);if(n.supportUVs){v=0;for(x=u.length;v<x;v++){C=0;for(D=u[v].length;C<D;C++){G=r[v]["abcd".charAt(C)];g(G,v,u[v][C])}}}if(u.length==0)n.supportUVs=false;v=0;for(z in w)v++;if(!v){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+w,"vs",u.length);v=0;for(x=r.length;v<x;v++){z=r[v];o.push(z.centroid);j.push(z.centroid);if(n.supportUVs){u=new THREE.UV;if(z instanceof THREE.Face3){u.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u;u.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v;u.u=u.u/3;u.v=u.v/3}else if(z instanceof THREE.Face4){u.u=f(z.a,v).u+f(z.b,v).u+f(z.c,v).u+f(z.d,v).u;u.v=f(z.a,v).v+f(z.b,v).v+f(z.c,v).v+f(z.d,v).v;u.u=u.u/4;u.v=u.v/4}g(t+v,"",u)}}b("-- added UVs for new Faces",w);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
+var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);G=0;var J,M,O={},X={};for(v in x){u=x[v];J=v.split("_");M=J[0];J=J[1];h(M,[M,J]);h(J,[M,J]);C=0;for(D=u.length;C<D;C++){z=u[C];i(M,z,v);i(J,z,v)}u.length<2&&(s[v]=true)}b("vertexEdgeMap",O,"vertexFaceMap",X);for(v in x){u=
+x[v];z=u[0];D=u[1];J=v.split("_");M=J[0];J=J[1];u=new THREE.Vector3;if(s[v]){u.addSelf(p[M]);u.addSelf(p[J]);u.multiplyScalar(0.5)}else{u.addSelf(o[z]);u.addSelf(o[D]);u.addSelf(p[M]);u.addSelf(p[J]);u.multiplyScalar(0.25)}q[v]=t+r.length+G;j.push(u);G++;if(n.supportUVs){u=new THREE.UV;u.u=f(M,z).u+f(J,z).u;u.v=f(M,z).v+f(J,z).v;u.u=u.u/2;u.v=u.v/2;g(q[v],z,u);if(!s[v]){u=new THREE.UV;u.u=f(M,D).u+f(J,D).u;u.v=f(M,D).v+f(J,D).v;u.u=u.u/2;u.v=u.v/2;g(q[v],D,u)}}}b("-- Step 2 done");var B,F;D=["123",
+"12","2","23"];J=["123","23","3","31"];var Q=["123","31","1","12"],E=["1234","12","2","23"],aa=["1234","23","3","34"],T=["1234","34","4","41"],N=["1234","41","1","12"];v=0;for(x=o.length;v<x;v++){z=r[v];u=t+v;if(z instanceof THREE.Face3){G=e(z.a,z.b);M=e(z.b,z.c);B=e(z.c,z.a);d(u,q[G],z.b,q[M],z,D,v);d(u,q[M],z.c,q[B],z,J,v);d(u,q[B],z.a,q[G],z,Q,v)}else if(z instanceof THREE.Face4){G=e(z.a,z.b);M=e(z.b,z.c);B=e(z.c,z.d);F=e(z.d,z.a);d(u,q[G],z.b,q[M],z,E,v);d(u,q[M],z.c,q[B],z,aa,v);d(u,q[B],z.d,
+q[F],z,T,v);d(u,q[F],z.a,q[G],z,N,v)}else b("face should be a face!",z)}q=new THREE.Vector3;z=new THREE.Vector3;v=0;for(x=p.length;v<x;v++)if(O[v]!==void 0){q.set(0,0,0);z.set(0,0,0);M=new THREE.Vector3(0,0,0);u=0;for(C in X[v]){q.addSelf(o[C]);u++}D=0;G=O[v].length;for(C=0;C<G;C++)s[e(O[v][C][0],O[v][C][1])]&&D++;if(D!=2){q.divideScalar(u);for(C=0;C<G;C++){u=O[v][C];u=p[u[0]].clone().addSelf(p[u[1]]).divideScalar(2);z.addSelf(u)}z.divideScalar(G);M.addSelf(p[v]);M.multiplyScalar(G-3);M.addSelf(q);
+M.addSelf(z.multiplyScalar(2));M.divideScalar(G);j[v]=M}}a.vertices=j;a.faces=l;a.faceVertexUvs[0]=m;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[a]=b;this.animationsList.push(b)};
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[a]=b;this.animationsList.push(b)};
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&h.length>1){var j=h[1];d[j]||(d[j]={start:Infinity,end:-Infinity});h=d[j];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=j)}}for(j in d){h=d[j];this.createAnimation(j,h.start,h.end,a)}this.firstAnimation=c};
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&h.length>1){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=i)}}for(i in d){h=d[i];this.createAnimation(i,h.start,h.end,a)}this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a]){a.direction=1;a.directionBackwards=false}};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a]){a.direction=-1;a.directionBackwards=true}};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c){c.fps=b;c.duration=(c.end-c.start)/c.fps}};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a]){a.direction=1;a.directionBackwards=false}};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a]){a.direction=-1;a.directionBackwards=true}};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c){c.fps=b;c.duration=(c.end-c.start)/c.fps}};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c){c.duration=b;c.fps=(c.end-c.start)/c.duration}};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c){c.duration=b;c.fps=(c.end-c.start)/c.duration}};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
 e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,j,i,l,o,n,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){i=false;l=a(THREE.ShaderFlares.lensFlare)}else{i=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};n={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
-"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,u=a.length;if(u){var t=new THREE.Vector3,v=s/e,x=e*0.5,F=s*0.5,C=16/s,z=new THREE.Vector2(C*v,C),w=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),E=n,C=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(C.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var O,Q,Y,B,J;for(O=0;O<u;O++){C=16/s;z.set(C*v,C);B=a[O];t.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);w.copy(t);H.x=w.x*x+x;H.y=w.y*F+F;if(i||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(E.renderType,0);b.uniform2f(E.scale,z.x,z.y);b.uniform3f(E.screenPosition,w.x,w.y,w.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(E.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(w);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);Q=0;for(Y=B.lensFlares.length;Q<Y;Q++){J=B.lensFlares[Q];if(J.opacity>0.0010&&J.scale>0.0010){w.x=J.x;w.y=J.y;w.z=J.z;C=J.size*J.scale/s;z.x=C*v;z.y=C;b.uniform3f(E.screenPosition,w.x,w.y,w.z);b.uniform2f(E.scale,z.x,z.y);b.uniform1f(E.rotation,J.rotation);b.uniform1f(E.opacity,J.opacity);
-b.uniform3f(E.color,J.color.r,J.color.g,J.color.b);c.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);c.setTexture(J.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,j=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(i,l){var o,n,p,r,m,q,s,u,t,v=[];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);o=0;for(n=i.__lights.length;o<n;o++){p=i.__lights[o];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
-p.shadowCascade)for(m=0;m<p.shadowCascadeCount;m++){var x;if(p.shadowCascadeArray[m])x=p.shadowCascadeArray[m];else{t=p;s=m;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=t.shadowCameraNear;x.shadowCameraFar=t.shadowCameraFar;x.shadowCameraLeft=t.shadowCameraLeft;x.shadowCameraRight=t.shadowCameraRight;x.shadowCameraBottom=t.shadowCameraBottom;x.shadowCameraTop=t.shadowCameraTop;x.shadowCameraVisible=t.shadowCameraVisible;x.shadowDarkness=t.shadowDarkness;
-x.shadowBias=t.shadowCascadeBias[s];x.shadowMapWidth=t.shadowCascadeWidth[s];x.shadowMapHeight=t.shadowCascadeHeight[s];x.pointsWorld=[];x.pointsFrustum=[];u=x.pointsWorld;q=x.pointsFrustum;for(var F=0;F<8;F++){u[F]=new THREE.Vector3;q[F]=new THREE.Vector3}u=t.shadowCascadeNearZ[s];t=t.shadowCascadeFarZ[s];q[0].set(-1,-1,u);q[1].set(1,-1,u);q[2].set(-1,1,u);q[3].set(1,1,u);q[4].set(-1,-1,t);q[5].set(1,-1,t);q[6].set(-1,1,t);q[7].set(1,1,t);x.originalCamera=l;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
-q.add(x);q.add(x.target);l.add(q);p.shadowCascadeArray[m]=x;console.log("Created virtualLight",x)}s=p;u=m;t=s.shadowCascadeArray[u];t.position.copy(s.position);t.target.position.copy(s.target.position);t.lookAt(t.target);t.shadowCameraVisible=s.shadowCameraVisible;t.shadowDarkness=s.shadowDarkness;t.shadowBias=s.shadowCascadeBias[u];q=s.shadowCascadeNearZ[u];s=s.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=q;t[1].z=q;t[2].z=q;t[3].z=q;t[4].z=s;t[5].z=s;t[6].z=s;t[7].z=s;v[r]=x;r++}else{v[r]=p;r++}}o=
-0;for(n=v.length;o<n;o++){p=v[o];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
-THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(p.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&x.originalCamera==l){m=l;r=p.shadowCamera;
-q=p.pointsFrustum;t=p.pointsWorld;h.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){u=t[s];u.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,m);r.matrixWorldInverse.multiplyVector3(u);if(u.x<h.x)h.x=u.x;if(u.x>j.x)j.x=u.x;if(u.y<h.y)h.y=u.y;if(u.y>j.y)j.y=u.y;if(u.z<h.z)h.z=u.z;if(u.z>j.z)j.z=u.z}r.left=h.x;r.right=j.x;r.top=j.y;r.bottom=h.y;r.updateProjectionMatrix()}r=p.shadowMap;q=p.shadowMatrix;m=p.shadowCamera;m.position.copy(p.matrixWorld.getPosition());
-m.lookAt(p.target.matrixWorld.getPosition());m.updateMatrixWorld();m.matrixWorldInverse.getInverse(m.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(m.projectionMatrix);q.multiplySelf(m.matrixWorldInverse);if(!m._viewMatrixArray)m._viewMatrixArray=new Float32Array(16);if(!m._projectionMatrixArray)m._projectionMatrixArray=new Float32Array(16);m.matrixWorldInverse.flattenToArray(m._viewMatrixArray);
-m.projectionMatrix.flattenToArray(m._projectionMatrixArray);g.multiply(m.projectionMatrix,m.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(r);b.clear();t=i.__webglObjects;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(m.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(r=t.length;p<r;p++){s=t[p];if(s.render){q=s.object;s=s.buffer;u=q.customDepthMaterial?
-q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(m,i.__lights,null,u,s,q):b.renderBuffer(m,i.__lights,null,u,s,q)}}t=i.__webglObjectsImmediate;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(m.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(m,i.__lights,null,c,q)}}}o=b.getClearColor();n=b.getClearAlpha();a.clearColor(o.r,o.g,o.b,n);a.enable(a.BLEND);
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,j,l,m,n,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}m={};n={};m.vertex=b.getAttribLocation(l,"position");m.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
+"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,w=a.length;if(w){var t=new THREE.Vector3,v=s/e,x=e*0.5,C=s*0.5,D=16/s,z=new THREE.Vector2(D*v,D),u=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),J=n,D=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(D.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(D.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,X,B,F;for(M=0;M<w;M++){D=16/s;z.set(D*v,D);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);G.x=u.x*x+x;G.y=u.y*C+C;if(j||G.x>0&&G.x<e&&G.y>0&&
+G.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,z.x,z.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,G.x-8,G.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(X=B.lensFlares.length;O<X;O++){F=B.lensFlares[O];if(F.opacity>0.0010&&F.scale>0.0010){u.x=F.x;u.y=F.y;u.z=F.z;D=F.size*F.scale/s;z.x=D*v;z.y=D;b.uniform3f(J.screenPosition,u.x,u.y,u.z);b.uniform2f(J.scale,z.x,z.y);b.uniform1f(J.rotation,F.rotation);b.uniform1f(J.opacity,F.opacity);
+b.uniform3f(J.color,F.color.r,F.color.g,F.color.b);c.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst);c.setTexture(F.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,w,t,v=[];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&&
+p.shadowCascade)for(o=0;o<p.shadowCascadeCount;o++){var x;if(p.shadowCascadeArray[o])x=p.shadowCascadeArray[o];else{t=p;s=o;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=t.shadowCameraNear;x.shadowCameraFar=t.shadowCameraFar;x.shadowCameraLeft=t.shadowCameraLeft;x.shadowCameraRight=t.shadowCameraRight;x.shadowCameraBottom=t.shadowCameraBottom;x.shadowCameraTop=t.shadowCameraTop;x.shadowCameraVisible=t.shadowCameraVisible;x.shadowDarkness=t.shadowDarkness;
+x.shadowBias=t.shadowCascadeBias[s];x.shadowMapWidth=t.shadowCascadeWidth[s];x.shadowMapHeight=t.shadowCascadeHeight[s];x.pointsWorld=[];x.pointsFrustum=[];w=x.pointsWorld;q=x.pointsFrustum;for(var C=0;C<8;C++){w[C]=new THREE.Vector3;q[C]=new THREE.Vector3}w=t.shadowCascadeNearZ[s];t=t.shadowCascadeFarZ[s];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,1,w);q[3].set(1,1,w);q[4].set(-1,-1,t);q[5].set(1,-1,t);q[6].set(-1,1,t);q[7].set(1,1,t);x.originalCamera=l;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
+q.add(x);q.add(x.target);l.add(q);p.shadowCascadeArray[o]=x;console.log("Created virtualLight",x)}s=p;w=o;t=s.shadowCascadeArray[w];t.position.copy(s.position);t.target.position.copy(s.target.position);t.lookAt(t.target);t.shadowCameraVisible=s.shadowCameraVisible;t.shadowDarkness=s.shadowDarkness;t.shadowBias=s.shadowCascadeBias[w];q=s.shadowCascadeNearZ[w];s=s.shadowCascadeFarZ[w];t=t.pointsFrustum;t[0].z=q;t[1].z=q;t[2].z=q;t[3].z=q;t[4].z=s;t[5].z=s;t[6].z=s;t[7].z=s;v[r]=x;r++}else{v[r]=p;r++}}m=
+0;for(n=v.length;m<n;m++){p=v[m];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
+THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(p.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&x.originalCamera==l){o=l;r=p.shadowCamera;
+q=p.pointsFrustum;t=p.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(s=0;s<8;s++){w=t[s];w.copy(q[s]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,o);r.matrixWorldInverse.multiplyVector3(w);if(w.x<h.x)h.x=w.x;if(w.x>i.x)i.x=w.x;if(w.y<h.y)h.y=w.y;if(w.y>i.y)i.y=w.y;if(w.z<h.z)h.z=w.z;if(w.z>i.z)i.z=w.z}r.left=h.x;r.right=i.x;r.top=i.y;r.bottom=h.y;r.updateProjectionMatrix()}r=p.shadowMap;q=p.shadowMatrix;o=p.shadowCamera;o.position.copy(p.matrixWorld.getPosition());
+o.lookAt(p.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(o.projectionMatrix);q.multiplySelf(o.matrixWorldInverse);if(!o._viewMatrixArray)o._viewMatrixArray=new Float32Array(16);if(!o._projectionMatrixArray)o._projectionMatrixArray=new Float32Array(16);o.matrixWorldInverse.flattenToArray(o._viewMatrixArray);
+o.projectionMatrix.flattenToArray(o._projectionMatrixArray);g.multiply(o.projectionMatrix,o.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(r);b.clear();t=j.__webglObjects;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;s.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);s.render=true}}p=0;for(r=t.length;p<r;p++){s=t[p];if(s.render){q=s.object;s=s.buffer;w=q.customDepthMaterial?
+q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;s instanceof THREE.BufferGeometry?b.renderBufferDirect(o,j.__lights,null,w,s,q):b.renderBuffer(o,j.__lights,null,w,s,q)}}t=j.__webglObjectsImmediate;p=0;for(r=t.length;p<r;p++){s=t[p];q=s.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(o.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(o,j.__lights,null,c,q)}}}m=b.getClearColor();n=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,n);a.enable(a.BLEND);
 b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
 b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,j,i,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(n,p);b.attachShader(n,r);b.linkProgram(n);h=n;j={};i={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
-"uvScale");i.rotation=b.getUniformLocation(h,"rotation");i.scale=b.getUniformLocation(h,"scale");i.alignment=b.getUniformLocation(h,"alignment");i.color=b.getUniformLocation(h,"color");i.map=b.getUniformLocation(h,"map");i.opacity=b.getUniformLocation(h,"opacity");i.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");i.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");i.screenPosition=b.getUniformLocation(h,"screenPosition");i.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,m=d.length;if(m){var q=j,s=i,u=r/p,p=p*0.5,t=r*0.5,v=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var x,F=[],q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
-b.uniform3f(s.screenPosition,(x.position.x-p)/p,(t-x.position.y)/t,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);F[0]=e*u*x.scale.x;F[1]=e*x.scale.y;b.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(s.alignment,x.alignment.x,x.alignment.y);
-b.uniform1f(s.opacity,x.opacity);b.uniform3f(s.color,x.color.r,x.color.g,x.color.b);b.uniform1f(s.rotation,x.rotation);b.uniform2fv(s.scale,F);if(x.mergeWith3D&&!v){b.enable(b.DEPTH_TEST);v=true}else if(!x.mergeWith3D&&v){b.disable(b.DEPTH_TEST);v=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,j,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(n,p);b.attachShader(n,r);b.linkProgram(n);h=n;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,o=d.length;if(o){var q=i,s=j,w=r/p,p=p*0.5,t=r*0.5,v=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var x,C=[],q=0;q<o;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<o;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
+b.uniform3f(s.screenPosition,(x.position.x-p)/p,(t-x.position.y)/t,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);C[0]=e*w*x.scale.x;C[1]=e*x.scale.y;b.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(s.alignment,x.alignment.x,x.alignment.y);
+b.uniform1f(s.opacity,x.opacity);b.uniform3f(s.color,x.color.r,x.color.g,x.color.b);b.uniform1f(s.rotation,x.rotation);b.uniform2fv(s.scale,C);if(x.mergeWith3D&&!v){b.enable(b.DEPTH_TEST);v=true}else if(!x.mergeWith3D&&v){b.disable(b.DEPTH_TEST);v=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,i,l,o,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;j=0;for(i=p.length;j<i;j++){l=p[j];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}j=0;for(i=p.length;j<i;j++){l=p[j];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);o=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,n):b.renderBuffer(h,g.__lights,null,o,l,n)}}p=g.__webglObjectsImmediate;j=0;for(i=p.length;j<i;j++){l=p[j];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}j=b.getClearColor();i=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,i);a.enable(a.BLEND)}};
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,m,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,m,l,n):b.renderBuffer(h,g.__lights,null,m,l,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 83 - 84
build/custom/ThreeCanvas.js

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

+ 0 - 5100
build/custom/ThreeDOM.js

@@ -1,5100 +0,0 @@
-<<<<<<< HEAD
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-var THREE = THREE || { REVISION: '49dev' };
-
-if ( ! self.Int32Array ) {
-
-	self.Int32Array = Array;
-	self.Float32Array = Array;
-
-}
-
-// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
-// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
-
-// requestAnimationFrame polyfill by Erik Möller
-// fixes from Paul Irish and Tino Zijdel
-
-( function () {
-
-	var lastTime = 0;
-	var vendors = [ 'ms', 'moz', 'webkit', 'o' ];
-
-	for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++ x ) {
-
-		window.requestAnimationFrame = window[ vendors[ x ] + 'RequestAnimationFrame' ];
-		window.cancelAnimationFrame = window[ vendors[ x ] + 'CancelAnimationFrame' ] || window[ vendors[ x ] + 'CancelRequestAnimationFrame' ];
-
-	}
-
-	if ( !window.requestAnimationFrame ) {
-
-		window.requestAnimationFrame = function ( callback, element ) {
-
-			var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );
-			var id = window.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall );
-			lastTime = currTime + timeToCall;
-			return id;
-
-		};
-
-	}
-
-
-	if ( !window.cancelAnimationFrame ) {
-
-		window.cancelAnimationFrame = function ( id ) { clearTimeout( id ); };
-
-	}
-
-}() );
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Color = function ( hex ) {
-
-	if ( hex !== undefined ) this.setHex( hex );
-	return this;
-
-};
-
-THREE.Color.prototype = {
-
-	constructor: THREE.Color,
-
-	r: 1, g: 1, b: 1,
-
-	copy: function ( color ) {
-
-		this.r = color.r;
-		this.g = color.g;
-		this.b = color.b;
-
-		return this;
-
-	},
-
-	copyGammaToLinear: function ( color ) {
-
-		this.r = color.r * color.r;
-		this.g = color.g * color.g;
-		this.b = color.b * color.b;
-
-		return this;
-
-	},
-
-	copyLinearToGamma: function ( color ) {
-
-		this.r = Math.sqrt( color.r );
-		this.g = Math.sqrt( color.g );
-		this.b = Math.sqrt( color.b );
-
-		return this;
-
-	},
-
-	convertGammaToLinear: function () {
-
-		var r = this.r, g = this.g, b = this.b;
-
-		this.r = r * r;
-		this.g = g * g;
-		this.b = b * b;
-
-		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 ( r, g, b ) {
-
-		this.r = r;
-		this.g = g;
-		this.b = b;
-
-		return this;
-
-	},
-
-	setHSV: function ( h, s, v ) {
-
-		// based on MochiKit implementation by Bob Ippolito
-		// h,s,v ranges are < 0.0 - 1.0 >
-
-		var i, f, p, q, t;
-
-		if ( v === 0 ) {
-
-			this.r = this.g = this.b = 0;
-
-		} else {
-
-			i = Math.floor( h * 6 );
-			f = ( h * 6 ) - i;
-			p = v * ( 1 - s );
-			q = v * ( 1 - ( s * f ) );
-			t = v * ( 1 - ( s * ( 1 - f ) ) );
-
-			switch ( i ) {
-
-				case 1: this.r = q; this.g = v; this.b = p; break;
-				case 2: this.r = p; this.g = v; this.b = t; break;
-				case 3: this.r = p; this.g = q; this.b = v; break;
-				case 4: this.r = t; this.g = p; this.b = v; break;
-				case 5: this.r = v; this.g = p; this.b = q; break;
-				case 6: // fall through
-				case 0: this.r = v; this.g = t; this.b = p; break;
-
-			}
-
-		}
-
-		return this;
-
-	},
-
-	setHex: function ( hex ) {
-
-		hex = Math.floor( hex );
-
-		this.r = ( hex >> 16 & 255 ) / 255;
-		this.g = ( hex >> 8 & 255 ) / 255;
-		this.b = ( hex & 255 ) / 255;
-
-		return this;
-
-	},
-
-	lerpSelf: function ( color, alpha ) {
-
-		this.r += ( color.r - this.r ) * alpha;
-		this.g += ( color.g - this.g ) * alpha;
-		this.b += ( color.b - this.b ) * alpha;
-
-		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 );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author philogb / http://blog.thejit.org/
- * @author egraether / http://egraether.com/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- */
-
-THREE.Vector2 = function ( x, y ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-
-};
-
-THREE.Vector2.prototype = {
-
-	constructor: THREE.Vector2,
-
-	set: function ( x, y ) {
-
-		this.x = x;
-		this.y = y;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-
-		} else {
-
-			this.set( 0, 0 );
-
-		}
-
-		return this;
-
-	},
-
-	negate: function() {
-
-		return this.multiplyScalar( - 1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y;
-
-	},
-
-	lengthSq: function () {
-
-		return this.x * this.x + this.y * this.y;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	distanceTo: function ( v ) {
-
-		return Math.sqrt( this.distanceToSquared( v ) );
-
-	},
-
-	distanceToSquared: function ( v ) {
-
-		var dx = this.x - v.x, dy = this.y - v.y;
-		return dx * dx + dy * dy;
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-
-		return this;
-
-	},
-
-	equals: function( v ) {
-
-		return ( ( v.x === this.x ) && ( v.y === this.y ) );
-
-	},
-
-	isZero: function () {
-
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector2( this.x, this.y );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author kile / http://kile.stravaganza.org/
- * @author philogb / http://blog.thejit.org/
- * @author mikael emtinger / http://gomo.se/
- * @author egraether / http://egraether.com/
- */
-
-THREE.Vector3 = function ( x, y, z ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-
-};
-
-
-THREE.Vector3.prototype = {
-
-	constructor: THREE.Vector3,
-
-	set: function ( x, y, z ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-
-		return this;
-
-	},
-
-	setX: function ( x ) {
-
-		this.x = x;
-
-		return this;
-
-	},
-
-	setY: function ( y ) {
-
-		this.y = y;
-
-		return this;
-
-	},
-
-	setZ: function ( z ) {
-
-		this.z = z;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-		this.z = v.z;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-		this.z = a.z + b.z;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-		this.z += v.z;
-
-		return this;
-
-	},
-
-	addScalar: function ( s ) {
-
-		this.x += s;
-		this.y += s;
-		this.z += s;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-		this.z = a.z - b.z;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-		this.z -= v.z;
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-
-		this.x = a.x * b.x;
-		this.y = a.y * b.y;
-		this.z = a.z * b.z;
-
-		return this;
-
-	},
-
-	multiplySelf: function ( v ) {
-
-		this.x *= v.x;
-		this.y *= v.y;
-		this.z *= v.z;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-		this.z *= s;
-
-		return this;
-
-	},
-
-	divideSelf: function ( v ) {
-
-		this.x /= v.x;
-		this.y /= v.y;
-		this.z /= v.z;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-			this.z /= s;
-
-		} else {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-
-		}
-
-		return this;
-
-	},
-
-
-	negate: function() {
-
-		return this.multiplyScalar( - 1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y + this.z * v.z;
-
-	},
-
-	lengthSq: function () {
-
-		return this.x * this.x + this.y * this.y + this.z * this.z;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	lengthManhattan: function () {
-
-		return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-		this.z += ( v.z - this.z ) * alpha;
-
-		return this;
-
-	},
-
-	cross: function ( a, b ) {
-
-		this.x = a.y * b.z - a.z * b.y;
-		this.y = a.z * b.x - a.x * b.z;
-		this.z = a.x * b.y - a.y * b.x;
-
-		return this;
-
-	},
-
-	crossSelf: function ( v ) {
-
-		var x = this.x, y = this.y, z = this.z;
-
-		this.x = y * v.z - z * v.y;
-		this.y = z * v.x - x * v.z;
-		this.z = x * v.y - y * v.x;
-
-		return this;
-
-	},
-
-	distanceTo: function ( v ) {
-
-		return Math.sqrt( this.distanceToSquared( v ) );
-
-	},
-
-	distanceToSquared: function ( v ) {
-
-		return new THREE.Vector3().sub( this, v ).lengthSq();
-
-	},
-
-	getPositionFromMatrix: function ( m ) {
-
-		this.x = m.elements[12];
-		this.y = m.elements[13];
-		this.z = m.elements[14];
-
-		return this;
-
-	},
-
-	getRotationFromMatrix: function ( m, scale ) {
-
-		var sx = scale ? scale.x : 1;
-		var sy = scale ? scale.y : 1;
-		var sz = scale ? scale.z : 1;
-
-		var m11 = m.elements[0] / sx, m12 = m.elements[4] / sy, m13 = m.elements[8] / sz;
-		var m21 = m.elements[1] / sx, m22 = m.elements[5] / sy, m23 = m.elements[9] / sz;
-		var m33 = m.elements[10] / sz;
-
-		this.y = Math.asin( m13 );
-
-		var cosY = Math.cos( this.y );
-
-		if ( Math.abs( cosY ) > 0.00001 ) {
-
-			this.x = Math.atan2( - m23 / cosY, m33 / cosY );
-			this.z = Math.atan2( - m12 / cosY, m11 / cosY );
-
-		} else {
-
-			this.x = 0;
-			this.z = Math.atan2( m21, m22 );
-
-		}
-
-		return this;
-
-	},
-
-	/*
-
-	// from http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
-	// order XYZ
-
-	getEulerXYZFromQuaternion: function ( q ) {
-
-		this.x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z ) );
-		this.y = Math.asin( 2 *  ( q.x * q.z + q.y * q.w ) );
-		this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z ) );
-
-	},
-
-	// from http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
-	// order YZX (assuming heading == y, attitude == z, bank == x)
-
-	getEulerYZXFromQuaternion: function ( q ) {
-
-		var sqw = q.w * q.w;
-		var sqx = q.x * q.x;
-		var sqy = q.y * q.y;
-		var sqz = q.z * q.z;
-		var unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor
-		var test = q.x * q.y + q.z * q.w;
-
-		if ( test > 0.499 * unit ) { // singularity at north pole
-
-			this.y = 2 * Math.atan2( q.x, q.w );
-			this.z = Math.PI / 2;
-			this.x = 0;
-
-			return;
-
-		}
-
-		if ( test < -0.499 * unit ) { // singularity at south pole
-
-			this.y = -2 * Math.atan2( q.x, q.w );
-			this.z = -Math.PI / 2;
-			this.x = 0;
-
-			return;
-
-		}
-
-		this.y = Math.atan2( 2 * q.y * q.w - 2 * q.x * q.z, sqx - sqy - sqz + sqw );
-		this.z = Math.asin( 2 * test / unit );
-		this.x = Math.atan2( 2 * q.x * q.w - 2 * q.y * q.z, -sqx + sqy - sqz + sqw );
-
-	},
-
-	*/
-
-	getScaleFromMatrix: function ( m ) {
-
-		var sx = this.set( m.elements[0], m.elements[1], m.elements[2] ).length();
-		var sy = this.set( m.elements[4], m.elements[5], m.elements[6] ).length();
-		var sz = this.set( m.elements[8], m.elements[9], m.elements[10] ).length();
-
-		this.x = sx;
-		this.y = sy;
-		this.z = sz;
-
-	},
-
-	equals: function ( v ) {
-
-		return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
-
-	},
-
-	isZero: function () {
-
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector3( this.x, this.y, this.z );
-
-	}
-
-};
-
-/**
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author philogb / http://blog.thejit.org/
- * @author mikael emtinger / http://gomo.se/
- * @author egraether / http://egraether.com/
- */
-
-THREE.Vector4 = function ( x, y, z, w ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-	this.w = ( w !== undefined ) ? w : 1;
-
-};
-
-THREE.Vector4.prototype = {
-
-	constructor: THREE.Vector4,
-
-	set: function ( x, y, z, w ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-		this.w = w;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-		this.z = v.z;
-		this.w = ( v.w !== undefined ) ? v.w : 1;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-		this.z = a.z + b.z;
-		this.w = a.w + b.w;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-		this.z += v.z;
-		this.w += v.w;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-		this.z = a.z - b.z;
-		this.w = a.w - b.w;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-		this.z -= v.z;
-		this.w -= v.w;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-		this.z *= s;
-		this.w *= s;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-			this.z /= s;
-			this.w /= s;
-
-		} else {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-			this.w = 1;
-
-		}
-
-		return this;
-
-	},
-
-
-	negate: function() {
-
-		return this.multiplyScalar( -1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
-
-	},
-
-	lengthSq: function () {
-
-		return this.dot( this );
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-		this.z += ( v.z - this.z ) * alpha;
-		this.w += ( v.w - this.w ) * alpha;
-
-		return this;
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector4( this.x, this.y, this.z, this.w );
-
-	}
-
-};
-/**
- * @author mrdoob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-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 ( m ) {
-
-	var i, plane, planes = this.planes;
-
-	var me = m.elements;
-	var me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3];
-	var me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7];
-	var me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11];
-	var me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15];
-
-	planes[ 0 ].set( me3 - me0, me7 - me4, me11 - me8, me15 - me12 );
-	planes[ 1 ].set( me3 + me0, me7 + me4, me11 + me8, me15 + me12 );
-	planes[ 2 ].set( me3 + me1, me7 + me5, me11 + me9, me15 + me13 );
-	planes[ 3 ].set( me3 - me1, me7 - me5, me11 - me9, me15 - me13 );
-	planes[ 4 ].set( me3 - me2, me7 - me6, me11 - me10, me15 - me14 );
-	planes[ 5 ].set( me3 + me2, me7 + me6, me11 + me10, me15 + me14 );
-
-	for ( i = 0; i < 6; i ++ ) {
-
-		plane = planes[ i ];
-		plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
-
-	}
-
-};
-
-THREE.Frustum.prototype.contains = function ( object ) {
-
-	var distance,
-	planes = this.planes,
-	matrix = object.matrixWorld,
-	me = matrix.elements,
-	radius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
-
-	for ( var i = 0; i < 6; i ++ ) {
-
-		distance = planes[ i ].x * me[12] + planes[ i ].y * me[13] + planes[ i ].z * me[14] + planes[ i ].w;
-		if ( distance <= radius ) return false;
-
-	}
-
-	return true;
-
-};
-
-THREE.Frustum.__v1 = new THREE.Vector3();
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Ray = function ( origin, direction ) {
-
-	this.origin = origin || new THREE.Vector3();
-	this.direction = direction || new THREE.Vector3();
-
-	var precision = 0.0001;
-
-	this.setPrecision = function ( value ) {
-
-		precision = value;
-
-	};
-
-	var a = new THREE.Vector3();
-	var b = new THREE.Vector3();
-	var c = new THREE.Vector3();
-	var d = new THREE.Vector3();
-
-	var originCopy = new THREE.Vector3();
-	var directionCopy = new THREE.Vector3();
-
-	var vector = new THREE.Vector3();
-	var normal = new THREE.Vector3();
-	var intersectPoint = new THREE.Vector3()
-
-	this.intersectObject = function ( object ) {
-
-		var intersect, intersects = [];
-
-		if ( object instanceof THREE.Particle ) {
-
-			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
-
-			if ( distance > object.scale.x ) {
-
-				return [];
-
-			}
-
-			intersect = {
-
-				distance: distance,
-				point: object.position,
-				face: null,
-				object: object
-
-			};
-
-			intersects.push( intersect );
-
-		} else if ( object instanceof THREE.Mesh ) {
-
-			// Checking boundingSphere
-
-			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
-			var scale = THREE.Frustum.__v1.set( object.matrixWorld.getColumnX().length(), object.matrixWorld.getColumnY().length(), object.matrixWorld.getColumnZ().length() );
-
-			if ( distance > object.geometry.boundingSphere.radius * Math.max( scale.x, Math.max( scale.y, scale.z ) ) ) {
-
-				return intersects;
-
-			}
-
-			// Checking faces
-
-			var f, fl, face, dot, scalar,
-			geometry = object.geometry,
-			vertices = geometry.vertices,
-			objMatrix;
-
-			object.matrixRotationWorld.extractRotation( object.matrixWorld );
-
-			for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
-
-				face = geometry.faces[ f ];
-
-				originCopy.copy( this.origin );
-				directionCopy.copy( this.direction );
-
-				objMatrix = object.matrixWorld;
-
-				// determine if ray intersects the plane of the face
-				// note: this works regardless of the direction of the face normal
-
-				vector = objMatrix.multiplyVector3( vector.copy( face.centroid ) ).subSelf( originCopy );
-				normal = object.matrixRotationWorld.multiplyVector3( normal.copy( face.normal ) );
-				dot = directionCopy.dot( normal );
-
-				// bail if ray and plane are parallel
-
-				if ( Math.abs( dot ) < precision ) continue;
-
-				// calc distance to plane
-
-				scalar = normal.dot( vector ) / dot;
-
-				// if negative distance, then plane is behind ray
-
-				if ( scalar < 0 ) continue;
-
-				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) {
-
-					intersectPoint.add( originCopy, directionCopy.multiplyScalar( scalar ) );
-
-					if ( face instanceof THREE.Face3 ) {
-
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
-
-						if ( pointInFace3( intersectPoint, a, b, c ) ) {
-
-							intersect = {
-
-								distance: originCopy.distanceTo( intersectPoint ),
-								point: intersectPoint.clone(),
-								face: face,
-								object: object
-
-							};
-
-							intersects.push( intersect );
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
-						d = objMatrix.multiplyVector3( d.copy( vertices[ face.d ] ) );
-
-						if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) {
-
-							intersect = {
-
-								distance: originCopy.distanceTo( intersectPoint ),
-								point: intersectPoint.clone(),
-								face: face,
-								object: object
-
-							};
-
-							intersects.push( intersect );
-
-						}
-
-					}
-
-				}
-
-			}
-
-		}
-
-		return intersects;
-
-	}
-
-	this.intersectObjects = function ( objects ) {
-
-		var intersects = [];
-
-		for ( var i = 0, l = objects.length; i < l; i ++ ) {
-
-			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
-
-		}
-
-		intersects.sort( function ( a, b ) { return a.distance - b.distance; } );
-
-		return intersects;
-
-	};
-
-	var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3();
-	var dot, intersect, distance;
-
-	function distanceFromIntersection( origin, direction, position ) {
-
-		v0.sub( position, origin );
-		dot = v0.dot( direction );
-
-		intersect = v1.add( origin, v2.copy( direction ).multiplyScalar( dot ) );
-		distance = position.distanceTo( intersect );
-
-		return distance;
-
-	}
-
-	// http://www.blackpawn.com/texts/pointinpoly/default.html
-
-	var dot00, dot01, dot02, dot11, dot12, invDenom, u, v;
-
-	function pointInFace3( p, a, b, c ) {
-
-		v0.sub( c, a );
-		v1.sub( b, a );
-		v2.sub( p, a );
-
-		dot00 = v0.dot( v0 );
-		dot01 = v0.dot( v1 );
-		dot02 = v0.dot( v2 );
-		dot11 = v1.dot( v1 );
-		dot12 = v1.dot( v2 );
-
-		invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 );
-		u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
-		v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
-
-		return ( u >= 0 ) && ( v >= 0 ) && ( u + v < 1 );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Rectangle = function () {
-
-	var _left, _top, _right, _bottom,
-	_width, _height, _isEmpty = true;
-
-	function resize() {
-
-		_width = _right - _left;
-		_height = _bottom - _top;
-
-	}
-
-	this.getX = function () {
-
-		return _left;
-
-	};
-
-	this.getY = function () {
-
-		return _top;
-
-	};
-
-	this.getWidth = function () {
-
-		return _width;
-
-	};
-
-	this.getHeight = function () {
-
-		return _height;
-
-	};
-
-	this.getLeft = function() {
-
-		return _left;
-
-	};
-
-	this.getTop = function() {
-
-		return _top;
-
-	};
-
-	this.getRight = function() {
-
-		return _right;
-
-	};
-
-	this.getBottom = function() {
-
-		return _bottom;
-
-	};
-
-	this.set = function ( left, top, right, bottom ) {
-
-		_isEmpty = false;
-
-		_left = left; _top = top;
-		_right = right; _bottom = bottom;
-
-		resize();
-
-	};
-
-	this.addPoint = function ( x, y ) {
-
-		if ( _isEmpty ) {
-
-			_isEmpty = false;
-			_left = x; _top = y;
-			_right = x; _bottom = y;
-
-			resize();
-
-		} else {
-
-			_left = _left < x ? _left : x; // Math.min( _left, x );
-			_top = _top < y ? _top : y; // Math.min( _top, y );
-			_right = _right > x ? _right : x; // Math.max( _right, x );
-			_bottom = _bottom > y ? _bottom : y; // Math.max( _bottom, y );
-
-			resize();
-		}
-
-	};
-
-	this.add3Points = function ( x1, y1, x2, y2, x3, y3 ) {
-
-		if (_isEmpty) {
-
-			_isEmpty = false;
-			_left = x1 < x2 ? ( x1 < x3 ? x1 : x3 ) : ( x2 < x3 ? x2 : x3 );
-			_top = y1 < y2 ? ( y1 < y3 ? y1 : y3 ) : ( y2 < y3 ? y2 : y3 );
-			_right = x1 > x2 ? ( x1 > x3 ? x1 : x3 ) : ( x2 > x3 ? x2 : x3 );
-			_bottom = y1 > y2 ? ( y1 > y3 ? y1 : y3 ) : ( y2 > y3 ? y2 : y3 );
-
-			resize();
-
-		} else {
-
-			_left = x1 < x2 ? ( x1 < x3 ? ( x1 < _left ? x1 : _left ) : ( x3 < _left ? x3 : _left ) ) : ( x2 < x3 ? ( x2 < _left ? x2 : _left ) : ( x3 < _left ? x3 : _left ) );
-			_top = y1 < y2 ? ( y1 < y3 ? ( y1 < _top ? y1 : _top ) : ( y3 < _top ? y3 : _top ) ) : ( y2 < y3 ? ( y2 < _top ? y2 : _top ) : ( y3 < _top ? y3 : _top ) );
-			_right = x1 > x2 ? ( x1 > x3 ? ( x1 > _right ? x1 : _right ) : ( x3 > _right ? x3 : _right ) ) : ( x2 > x3 ? ( x2 > _right ? x2 : _right ) : ( x3 > _right ? x3 : _right ) );
-			_bottom = y1 > y2 ? ( y1 > y3 ? ( y1 > _bottom ? y1 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) ) : ( y2 > y3 ? ( y2 > _bottom ? y2 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) );
-
-			resize();
-
-		};
-
-	};
-
-	this.addRectangle = function ( r ) {
-
-		if ( _isEmpty ) {
-
-			_isEmpty = false;
-			_left = r.getLeft(); _top = r.getTop();
-			_right = r.getRight(); _bottom = r.getBottom();
-
-			resize();
-
-		} else {
-
-			_left = _left < r.getLeft() ? _left : r.getLeft(); // Math.min(_left, r.getLeft() );
-			_top = _top < r.getTop() ? _top : r.getTop(); // Math.min(_top, r.getTop() );
-			_right = _right > r.getRight() ? _right : r.getRight(); // Math.max(_right, r.getRight() );
-			_bottom = _bottom > r.getBottom() ? _bottom : r.getBottom(); // Math.max(_bottom, r.getBottom() );
-
-			resize();
-
-		}
-
-	};
-
-	this.inflate = function ( v ) {
-
-		_left -= v; _top -= v;
-		_right += v; _bottom += v;
-
-		resize();
-
-	};
-
-	this.minSelf = function ( r ) {
-
-		_left = _left > r.getLeft() ? _left : r.getLeft(); // Math.max( _left, r.getLeft() );
-		_top = _top > r.getTop() ? _top : r.getTop(); // Math.max( _top, r.getTop() );
-		_right = _right < r.getRight() ? _right : r.getRight(); // Math.min( _right, r.getRight() );
-		_bottom = _bottom < r.getBottom() ? _bottom : r.getBottom(); // Math.min( _bottom, r.getBottom() );
-
-		resize();
-
-	};
-
-	this.intersects = function ( r ) {
-
-		// http://gamemath.com/2011/09/detecting-whether-two-boxes-overlap/
-
-		if ( _right < r.getLeft() ) return false;
-		if ( _left > r.getRight() ) return false;
-		if ( _bottom < r.getTop() ) return false;
-		if ( _top > r.getBottom() ) return false;
-
-		return true;
-
-	};
-
-	this.empty = function () {
-
-		_isEmpty = true;
-
-		_left = 0; _top = 0;
-		_right = 0; _bottom = 0;
-
-		resize();
-
-	};
-
-	this.isEmpty = function () {
-
-		return _isEmpty;
-
-	};
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Math = {
-
-	// Clamp value to range <a, b>
-
-	clamp: function ( x, a, b ) {
-
-		return ( x < a ) ? a : ( ( x > b ) ? b : x );
-
-	},
-
-	// Clamp value to range <a, inf)
-
-	clampBottom: function ( x, a ) {
-
-		return x < a ? a : x;
-
-	},
-
-	// Linear mapping from range <a1, a2> to range <b1, b2>
-
-	mapLinear: function ( x, a1, a2, b1, b2 ) {
-
-		return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );
-
-	},
-
-	// Random float from <0, 1> with 16 bits of randomness
-	// (standard Math.random() creates repetitive patterns when applied over larger space)
-
-	random16: function () {
-
-		return ( 65280 * Math.random() + 255 * Math.random() ) / 65535;
-
-	},
-
-	// Random integer from <low, high> interval
-
-	randInt: function ( low, high ) {
-
-		return low + Math.floor( Math.random() * ( high - low + 1 ) );
-
-	},
-
-	// Random float from <low, high> interval
-
-	randFloat: function ( low, high ) {
-
-		return low + Math.random() * ( high - low );
-
-	},
-
-	// Random float from <-range/2, range/2> interval
-
-	randFloatSpread: function ( range ) {
-
-		return range * ( 0.5 - Math.random() );
-
-	},
-
-	sign: function ( x ) {
-
-		return ( x < 0 ) ? -1 : ( ( x > 0 ) ? 1 : 0 );
-
-	}
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Matrix3 = function () {
-
-	this.elements = new Float32Array(9);
-
-};
-
-THREE.Matrix3.prototype = {
-
-	constructor: THREE.Matrix3,
-
-	getInverse: function ( matrix ) {
-
-		// input: THREE.Matrix4
-		// ( based on http://code.google.com/p/webgl-mjs/ )
-
-        var me = matrix.elements;
-        
-		var a11 =   me[10] * me[5] - me[6] * me[9];
-		var a21 = - me[10] * me[1] + me[2] * me[9];
-		var a31 =   me[6] * me[1] - me[2] * me[5];
-		var a12 = - me[10] * me[4] + me[6] * me[8];
-		var a22 =   me[10] * me[0] - me[2] * me[8];
-		var a32 = - me[6] * me[0] + me[2] * me[4];
-		var a13 =   me[9] * me[4] - me[5] * me[8];
-		var a23 = - me[9] * me[0] + me[1] * me[8];
-		var a33 =   me[5] * me[0] - me[1] * me[4];
-
-		var det = me[0] * a11 + me[1] * a12 + me[2] * a13;
-
-		// no inverse
-
-		if ( det === 0 ) {
-
-			console.warn( "Matrix3.getInverse(): determinant == 0" );
-
-		}
-
-		var idet = 1.0 / det;
-
-		var m = this.elements;
-
-		m[ 0 ] = idet * a11; m[ 1 ] = idet * a21; m[ 2 ] = idet * a31;
-		m[ 3 ] = idet * a12; m[ 4 ] = idet * a22; m[ 5 ] = idet * a32;
-		m[ 6 ] = idet * a13; m[ 7 ] = idet * a23; m[ 8 ] = idet * a33;
-
-		return this;
-
-	},
-
-	
-	transpose: function () {
-
-		var tmp, m = this.elements;
-
-		tmp = m[1]; m[1] = m[3]; m[3] = tmp;
-		tmp = m[2]; m[2] = m[6]; m[6] = tmp;
-		tmp = m[5]; m[5] = m[7]; m[7] = tmp;
-
-		return this;
-
-	},
-	
-
-	transposeIntoArray: function ( r ) {
-
-		var m = this.m;
-
-		r[ 0 ] = m[ 0 ];
-		r[ 1 ] = m[ 3 ];
-		r[ 2 ] = m[ 6 ];
-		r[ 3 ] = m[ 1 ];
-		r[ 4 ] = m[ 4 ];
-		r[ 5 ] = m[ 7 ];
-		r[ 6 ] = m[ 2 ];
-		r[ 7 ] = m[ 5 ];
-		r[ 8 ] = m[ 8 ];
-
-		return this;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author philogb / http://blog.thejit.org/
- * @author jordi_ros / http://plattsoft.com
- * @author D1plo1d / http://github.com/D1plo1d
- * @author alteredq / http://alteredqualia.com/
- * @author mikael emtinger / http://gomo.se/
- * @author timknip / http://www.floorplanner.com/
- */
-
-
-THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-
-    this.elements = new Float32Array(16);
-
-	this.set(
-
-		( n11 !== undefined ) ? n11 : 1, n12 || 0, n13 || 0, n14 || 0,
-		n21 || 0, ( n22 !== undefined ) ? n22 : 1, n23 || 0, n24 || 0,
-		n31 || 0, n32 || 0, ( n33 !== undefined ) ? n33 : 1, n34 || 0,
-		n41 || 0, n42 || 0, n43 || 0, ( n44 !== undefined ) ? n44 : 1
-
-	);
-
-};
-
-THREE.Matrix4.prototype = {
-
-	constructor: THREE.Matrix4,
-
-	set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-        var te = this.elements;
-        
-		te[0] = n11; te[4] = n12; te[8] = n13; te[12] = n14;
-		te[1] = n21; te[5] = n22; te[9] = n23; te[13] = n24;
-		te[2] = n31; te[6] = n32; te[10] = n33; te[14] = n34;
-		te[3] = n41; te[7] = n42; te[11] = n43; te[15] = n44;
-
-		return this;
-
-	},
-
-	identity: function () {
-
-		this.set(
-
-			1, 0, 0, 0,
-			0, 1, 0, 0,
-			0, 0, 1, 0,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	copy: function ( m ) {
-        
-        var me = m.elements;
-        
-		this.set(
-
-			me[0], me[4], me[8], me[12],
-			me[1], me[5], me[9], me[13],
-			me[2], me[6], me[10], me[14],
-			me[3], me[7], me[11], me[15]
-
-		);
-
-		return this;
-
-	},
-
-	lookAt: function ( eye, target, up ) {
-        var te = this.elements;
-        
-		var x = THREE.Matrix4.__v1;
-		var y = THREE.Matrix4.__v2;
-		var z = THREE.Matrix4.__v3;
-
-		z.sub( eye, target ).normalize();
-
-		if ( z.length() === 0 ) {
-
-			z.z = 1;
-
-		}
-
-		x.cross( up, z ).normalize();
-
-		if ( x.length() === 0 ) {
-
-			z.x += 0.0001;
-			x.cross( up, z ).normalize();
-
-		}
-
-		y.cross( z, x );
-
-
-		te[0] = x.x; te[4] = y.x; te[8] = z.x;
-		te[1] = x.y; te[5] = y.y; te[9] = z.y;
-		te[2] = x.z; te[6] = y.z; te[10] = z.z;
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-        
-        var ae = a.elements,
-            be = b.elements,
-            te = this.elements;
-
-		var a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12];
-		var a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13];
-		var a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14];
-		var a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15];
-
-		var b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12];
-		var b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13];
-		var b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14];
-		var b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15];
-
-		te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
-		te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
-		te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
-		te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-
-		te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
-		te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
-		te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
-		te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-
-        te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
-		te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
-		te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
-		te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-
-		te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
-		te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
-		te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
-		te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-
-		return this;
-
-	},
-
-	multiplySelf: function ( m ) {
-
-		return this.multiply( this, m );
-
-	},
-
-	multiplyToArray: function ( a, b, r ) {
-        
-        var te = this.elements;
-        
-		this.multiply( a, b );
-
-		r[ 0 ] = te[0]; r[ 1 ] = te[1]; r[ 2 ] = te[2]; r[ 3 ] = te[3];
-		r[ 4 ] = te[4]; r[ 5 ] = te[5]; r[ 6 ] = te[6]; r[ 7 ] = te[7];
-		r[ 8 ]  = te[8]; r[ 9 ]  = te[9]; r[ 10 ] = te[10]; r[ 11 ] = te[11];
-		r[ 12 ] = te[12]; r[ 13 ] = te[13]; r[ 14 ] = te[14]; r[ 15 ] = te[15];
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-        
-        var te = this.elements;
-        
-		te[0] *= s; te[4] *= s; te[8] *= s; te[12] *= s;
-		te[1] *= s; te[5] *= s; te[9] *= s; te[13] *= s;
-		te[2] *= s; te[6] *= s; te[10] *= s; te[14] *= s;
-		te[3] *= s; te[7] *= s; te[11] *= s; te[15] *= s;
-
-		return this;
-
-	},
-
-	multiplyVector3: function ( v ) {
-        var te = this.elements;
-        
-		var vx = v.x, vy = v.y, vz = v.z;
-		var d = 1 / ( te[3] * vx + te[7] * vy + te[11] * vz + te[15] );
-
-		v.x = ( te[0] * vx + te[4] * vy + te[8] * vz + te[12] ) * d;
-		v.y = ( te[1] * vx + te[5] * vy + te[9] * vz + te[13] ) * d;
-		v.z = ( te[2] * vx + te[6] * vy + te[10] * vz + te[14] ) * d;
-
-		return v;
-
-	},
-
-	multiplyVector4: function ( v ) {
-        
-        var te = this.elements;
-		var vx = v.x, vy = v.y, vz = v.z, vw = v.w;
-
-		v.x = te[0] * vx + te[4] * vy + te[8] * vz + te[12] * vw;
-		v.y = te[1] * vx + te[5] * vy + te[9] * vz + te[13] * vw;
-		v.z = te[2] * vx + te[6] * vy + te[10] * vz + te[14] * vw;
-		v.w = te[3] * vx + te[7] * vy + te[11] * vz + te[15] * vw;
-
-		return v;
-
-	},
-
-	rotateAxis: function ( v ) {
-        
-        var te = this.elements;
-		var vx = v.x, vy = v.y, vz = v.z;
-
-		v.x = vx * te[0] + vy * te[4] + vz * te[8];
-		v.y = vx * te[1] + vy * te[5] + vz * te[9];
-		v.z = vx * te[2] + vy * te[6] + vz * te[10];
-
-		v.normalize();
-
-		return v;
-
-	},
-
-	crossVector: function ( a ) {
-        
-        var te = this.elements;
-		var v = new THREE.Vector4();
-
-		v.x = te[0] * a.x + te[4] * a.y + te[8] * a.z + te[12] * a.w;
-		v.y = te[1] * a.x + te[5] * a.y + te[9] * a.z + te[13] * a.w;
-		v.z = te[2] * a.x + te[6] * a.y + te[10] * a.z + te[14] * a.w;
-
-		v.w = ( a.w ) ? te[3] * a.x + te[7] * a.y + te[11] * a.z + te[15] * a.w : 1;
-
-		return v;
-
-	},
-
-	determinant: function () {
-
-        var te = this.elements;
-        
-		var n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12];
-		var n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];
-		var n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];
-		var n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];
-
-		//TODO: make this more efficient
-		//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
-		return (
-			n14 * n23 * n32 * n41-
-			n13 * n24 * n32 * n41-
-			n14 * n22 * n33 * n41+
-			n12 * n24 * n33 * n41+
-
-			n13 * n22 * n34 * n41-
-			n12 * n23 * n34 * n41-
-			n14 * n23 * n31 * n42+
-			n13 * n24 * n31 * n42+
-
-			n14 * n21 * n33 * n42-
-			n11 * n24 * n33 * n42-
-			n13 * n21 * n34 * n42+
-			n11 * n23 * n34 * n42+
-
-			n14 * n22 * n31 * n43-
-			n12 * n24 * n31 * n43-
-			n14 * n21 * n32 * n43+
-			n11 * n24 * n32 * n43+
-
-			n12 * n21 * n34 * n43-
-			n11 * n22 * n34 * n43-
-			n13 * n22 * n31 * n44+
-			n12 * n23 * n31 * n44+
-
-			n13 * n21 * n32 * n44-
-			n11 * n23 * n32 * n44-
-			n12 * n21 * n33 * n44+
-			n11 * n22 * n33 * n44
-		);
-
-	},
-
-	transpose: function () {
-        var te = this.elements;
-        
-		var tmp;
-
-		tmp = te[1]; te[1] = te[4]; te[4] = tmp;
-		tmp = te[2]; te[2] = te[8]; te[8] = tmp;
-		tmp = te[6]; te[6] = te[9]; te[9] = tmp;
-
-		tmp = te[3]; te[3] = te[12]; te[12] = tmp;
-		tmp = te[7]; te[7] = te[13]; te[13] = tmp;
-		tmp = te[11]; te[11] = te[14]; te[14] = tmp;
-
-		return this;
-
-	},
-
-	flattenToArray: function ( flat ) {
-
-        var te = this.elements;
-		flat[ 0 ] = te[0]; flat[ 1 ] = te[1]; flat[ 2 ] = te[2]; flat[ 3 ] = te[3];
-		flat[ 4 ] = te[4]; flat[ 5 ] = te[5]; flat[ 6 ] = te[6]; flat[ 7 ] = te[7];
-		flat[ 8 ]  = te[8]; flat[ 9 ]  = te[9]; flat[ 10 ] = te[10]; flat[ 11 ] = te[11];
-		flat[ 12 ] = te[12]; flat[ 13 ] = te[13]; flat[ 14 ] = te[14]; flat[ 15 ] = te[15];
-
-		return flat;
-
-	},
-
-	flattenToArrayOffset: function( flat, offset ) {
-
-        var te = this.elements;
-		flat[ offset ] = te[0];
-		flat[ offset + 1 ] = te[1];
-		flat[ offset + 2 ] = te[2];
-		flat[ offset + 3 ] = te[3];
-
-		flat[ offset + 4 ] = te[4];
-		flat[ offset + 5 ] = te[5];
-		flat[ offset + 6 ] = te[6];
-		flat[ offset + 7 ] = te[7];
-
-		flat[ offset + 8 ]  = te[8];
-		flat[ offset + 9 ]  = te[9];
-		flat[ offset + 10 ] = te[10];
-		flat[ offset + 11 ] = te[11];
-
-		flat[ offset + 12 ] = te[12];
-		flat[ offset + 13 ] = te[13];
-		flat[ offset + 14 ] = te[14];
-		flat[ offset + 15 ] = te[15];
-
-		return flat;
-
-	},
-
-	getPosition: function () {
-        var te = this.elements;
-        
-		return THREE.Matrix4.__v1.set( te[12], te[13], te[14] );
-
-	},
-
-	setPosition: function ( v ) {
-        var te = this.elements;
-		te[12] = v.x;
-		te[13] = v.y;
-		te[14] = v.z;
-
-		return this;
-
-	},
-
-	getColumnX: function () {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[0], te[1], te[2] );
-
-	},
-
-	getColumnY: function () {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[4], te[5], te[6] );
-
-	},
-
-	getColumnZ: function() {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[8], te[9], te[10] );
-
-	},
-
-	getInverse: function ( m ) {
-
-		// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
-        var te = this.elements;
-        var me = m.elements;
-                
-		var n11 = me[0], n12 = me[4], n13 = me[8], n14 = me[12];
-		var n21 = me[1], n22 = me[5], n23 = me[9], n24 = me[13];
-		var n31 = me[2], n32 = me[6], n33 = me[10], n34 = me[14];
-		var n41 = me[3], n42 = me[7], n43 = me[11], n44 = me[15];
-
-		te[0] = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44;
-		te[4] = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44;
-		te[8] = n13*n24*n42 - n14*n23*n42 + n14*n22*n43 - n12*n24*n43 - n13*n22*n44 + n12*n23*n44;
-		te[12] = n14*n23*n32 - n13*n24*n32 - n14*n22*n33 + n12*n24*n33 + n13*n22*n34 - n12*n23*n34;
-		te[1] = n24*n33*n41 - n23*n34*n41 - n24*n31*n43 + n21*n34*n43 + n23*n31*n44 - n21*n33*n44;
-		te[5] = n13*n34*n41 - n14*n33*n41 + n14*n31*n43 - n11*n34*n43 - n13*n31*n44 + n11*n33*n44;
-		te[9] = n14*n23*n41 - n13*n24*n41 - n14*n21*n43 + n11*n24*n43 + n13*n21*n44 - n11*n23*n44;
-		te[13] = n13*n24*n31 - n14*n23*n31 + n14*n21*n33 - n11*n24*n33 - n13*n21*n34 + n11*n23*n34;
-		te[2] = n22*n34*n41 - n24*n32*n41 + n24*n31*n42 - n21*n34*n42 - n22*n31*n44 + n21*n32*n44;
-		te[6] = n14*n32*n41 - n12*n34*n41 - n14*n31*n42 + n11*n34*n42 + n12*n31*n44 - n11*n32*n44;
-		te[10] = n12*n24*n41 - n14*n22*n41 + n14*n21*n42 - n11*n24*n42 - n12*n21*n44 + n11*n22*n44;
-		te[14] = n14*n22*n31 - n12*n24*n31 - n14*n21*n32 + n11*n24*n32 + n12*n21*n34 - n11*n22*n34;
-		te[3] = n23*n32*n41 - n22*n33*n41 - n23*n31*n42 + n21*n33*n42 + n22*n31*n43 - n21*n32*n43;
-		te[7] = n12*n33*n41 - n13*n32*n41 + n13*n31*n42 - n11*n33*n42 - n12*n31*n43 + n11*n32*n43;
-		te[11] = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43;
-		te[15] = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33;
-		this.multiplyScalar( 1 / m.determinant() );
-
-		return this;
-
-	},
-
-	setRotationFromEuler: function( v, order ) {
-        var te = this.elements;
-        
-		var x = v.x, y = v.y, z = v.z;
-		var a = Math.cos( x ), b = Math.sin( x );
-		var c = Math.cos( y ), d = Math.sin( y );
-		var e = Math.cos( z ), f = Math.sin( z );
-
-		switch ( order ) {
-
-			case 'YXZ':
-
-				var ce = c * e, cf = c * f, de = d * e, df = d * f;
-
-				te[0] = ce + df * b;
-				te[4] = de * b - cf;
-				te[8] = a * d;
-
-				te[1] = a * f;
-				te[5] = a * e;
-				te[9] = - b;
-
-				te[2] = cf * b - de;
-				te[6] = df + ce * b;
-				te[10] = a * c;
-				break;
-
-			case 'ZXY':
-
-				var ce = c * e, cf = c * f, de = d * e, df = d * f;
-
-				te[0] = ce - df * b;
-				te[4] = - a * f;
-				te[8] = de + cf * b;
-
-				te[1] = cf + de * b;
-				te[5] = a * e;
-				te[9] = df - ce * b;
-
-				te[2] = - a * d;
-				te[6] = b;
-				te[10] = a * c;
-				break;
-
-			case 'ZYX':
-
-				var ae = a * e, af = a * f, be = b * e, bf = b * f;
-
-				te[0] = c * e;
-				te[4] = be * d - af;
-				te[8] = ae * d + bf;
-
-				te[1] = c * f;
-				te[5] = bf * d + ae;
-				te[9] = af * d - be;
-
-				te[2] = - d;
-				te[6] = b * c;
-				te[10] = a * c;
-				break;
-
-			case 'YZX':
-
-				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
-				te[0] = c * e;
-				te[4] = bd - ac * f;
-				te[8] = bc * f + ad;
-
-				te[1] = f;
-				te[5] = a * e;
-				te[9] = - b * e;
-
-				te[2] = - d * e;
-				te[6] = ad * f + bc;
-				te[10] = ac - bd * f;
-				break;
-
-			case 'XZY':
-
-				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
-				te[0] = c * e;
-				te[4] = - f;
-				te[8] = d * e;
-
-				te[1] = ac * f + bd;
-				te[5] = a * e;
-				te[9] = ad * f - bc;
-
-				te[2] = bc * f - ad;
-				te[6] = b * e;
-				te[10] = bd * f + ac;
-				break;
-
-			default: // 'XYZ'
-
-				var ae = a * e, af = a * f, be = b * e, bf = b * f;
-
-				te[0] = c * e;
-				te[4] = - c * f;
-				te[8] = d;
-
-				te[1] = af + be * d;
-				te[5] = ae - bf * d;
-				te[9] = - b * c;
-
-				te[2] = bf - ae * d;
-				te[6] = be + af * d;
-				te[10] = a * c;
-				break;
-
-		}
-
-		return this;
-
-	},
-
-
-	setRotationFromQuaternion: function( q ) {
-        var te = this.elements;
-        
-		var x = q.x, y = q.y, z = q.z, w = q.w;
-		var x2 = x + x, y2 = y + y, z2 = z + z;
-		var xx = x * x2, xy = x * y2, xz = x * z2;
-		var yy = y * y2, yz = y * z2, zz = z * z2;
-		var wx = w * x2, wy = w * y2, wz = w * z2;
-
-		te[0] = 1 - ( yy + zz );
-		te[4] = xy - wz;
-		te[8] = xz + wy;
-
-		te[1] = xy + wz;
-		te[5] = 1 - ( xx + zz );
-		te[9] = yz - wx;
-
-		te[2] = xz - wy;
-		te[6] = yz + wx;
-		te[10] = 1 - ( xx + yy );
-
-		return this;
-
-	},
-
-	compose: function ( translation, rotation, scale ) {
-        var te = this.elements;
-		var mRotation = THREE.Matrix4.__m1;
-		var mScale = THREE.Matrix4.__m2;
-
-		mRotation.identity();
-		mRotation.setRotationFromQuaternion( rotation );
-
-		mScale.makeScale( scale.x, scale.y, scale.z );
-
-		this.multiply( mRotation, mScale );
-
-		te[12] = translation.x;
-		te[13] = translation.y;
-		te[14] = translation.z;
-
-		return this;
-
-	},
-
-	decompose: function ( translation, rotation, scale ) {
-
-		// grab the axis vectors
-        var te = this.elements;
-		var x = THREE.Matrix4.__v1;
-		var y = THREE.Matrix4.__v2;
-		var z = THREE.Matrix4.__v3;
-
-		x.set( te[0], te[1], te[2] );
-		y.set( te[4], te[5], te[6] );
-		z.set( te[8], te[9], te[10] );
-
-		translation = ( translation instanceof THREE.Vector3 ) ? translation : new THREE.Vector3();
-		rotation = ( rotation instanceof THREE.Quaternion ) ? rotation : new THREE.Quaternion();
-		scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3();
-
-		scale.x = x.length();
-		scale.y = y.length();
-		scale.z = z.length();
-
-		translation.x = te[12];
-		translation.y = te[13];
-		translation.z = te[14];
-
-		// scale the rotation part
-
-		var matrix = THREE.Matrix4.__m1;
-
-		matrix.copy( this );
-
-		matrix.elements[0] /= scale.x;
-		matrix.elements[1] /= scale.x;
-		matrix.elements[2] /= scale.x;
-
-		matrix.elements[4] /= scale.y;
-		matrix.elements[5] /= scale.y;
-		matrix.elements[6] /= scale.y;
-
-		matrix.elements[8] /= scale.z;
-		matrix.elements[9] /= scale.z;
-		matrix.elements[10] /= scale.z;
-
-		rotation.setFromRotationMatrix( matrix );
-
-		return [ translation, rotation, scale ];
-
-	},
-
-	extractPosition: function ( m ) {
-        var te = this.elements;
-        var me = m.elements;
-		te[12] = me[12];
-		te[13] = me[13];
-		te[14] = me[14];
-
-		return this;
-
-	},
-
-	extractRotation: function ( m ) {
-        var te = this.elements;
-        var me = m.elements;
-        
-		var vector = THREE.Matrix4.__v1;
-
-		var scaleX = 1 / vector.set( me[0], me[1], me[2] ).length();
-		var scaleY = 1 / vector.set( me[4], me[5], me[6] ).length();
-		var scaleZ = 1 / vector.set( me[8], me[9], me[10] ).length();
-
-		te[0] = me[0] * scaleX;
-		te[1] = me[1] * scaleX;
-		te[2] = me[2] * scaleX;
-
-		te[4] = me[4] * scaleY;
-		te[5] = me[5] * scaleY;
-		te[6] = me[6] * scaleY;
-
-		te[8] = me[8] * scaleZ;
-		te[9] = me[9] * scaleZ;
-		te[10] = me[10] * scaleZ;
-
-		return this;
-
-	},
-
-	//
-
-	translate: function ( v ) {
-        var te = this.elements;
-		var x = v.x, y = v.y, z = v.z;
-
-		te[12] = te[0] * x + te[4] * y + te[8] * z + te[12];
-		te[13] = te[1] * x + te[5] * y + te[9] * z + te[13];
-		te[14] = te[2] * x + te[6] * y + te[10] * z + te[14];
-		te[15] = te[3] * x + te[7] * y + te[11] * z + te[15];
-
-		return this;
-
-	},
-
-	rotateX: function ( angle ) {
-        var te = this.elements;
-		var m12 = te[4];
-		var m22 = te[5];
-		var m32 = te[6];
-		var m42 = te[7];
-		var m13 = te[8];
-		var m23 = te[9];
-		var m33 = te[10];
-		var m43 = te[11];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[4] = c * m12 + s * m13;
-		te[5] = c * m22 + s * m23;
-		te[6] = c * m32 + s * m33;
-		te[7] = c * m42 + s * m43;
-
-		te[8] = c * m13 - s * m12;
-		te[9] = c * m23 - s * m22;
-		te[10] = c * m33 - s * m32;
-		te[11] = c * m43 - s * m42;
-
-		return this;
-
-  	},
-
-	rotateY: function ( angle ) {
-        var te = this.elements;
-		var m11 = te[0];
-		var m21 = te[1];
-		var m31 = te[2];
-		var m41 = te[3];
-		var m13 = te[8];
-		var m23 = te[9];
-		var m33 = te[10];
-		var m43 = te[11];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[0] = c * m11 - s * m13;
-		te[1] = c * m21 - s * m23;
-		te[2] = c * m31 - s * m33;
-		te[3] = c * m41 - s * m43;
-
-		te[8] = c * m13 + s * m11;
-		te[9] = c * m23 + s * m21;
-		te[10] = c * m33 + s * m31;
-		te[11] = c * m43 + s * m41;
-
-		return this;
-
-	},
-
-	rotateZ: function ( angle ) {
-        var te = this.elements;
-		var m11 = te[0];
-		var m21 = te[1];
-		var m31 = te[2];
-		var m41 = te[3];
-		var m12 = te[4];
-		var m22 = te[5];
-		var m32 = te[6];
-		var m42 = te[7];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[0] = c * m11 + s * m12;
-		te[1] = c * m21 + s * m22;
-		te[2] = c * m31 + s * m32;
-		te[3] = c * m41 + s * m42;
-
-		te[4] = c * m12 - s * m11;
-		te[5] = c * m22 - s * m21;
-		te[6] = c * m32 - s * m31;
-		te[7] = c * m42 - s * m41;
-
-		return this;
-
-	},
-
-	rotateByAxis: function ( axis, angle ) {
-        var te = this.elements;
-		// optimize by checking axis
-
-		if ( axis.x === 1 && axis.y === 0 && axis.z === 0 ) {
-
-			return this.rotateX( angle );
-
-		} else if ( axis.x === 0 && axis.y === 1 && axis.z === 0 ) {
-
-			return this.rotateY( angle );
-
-		} else if ( axis.x === 0 && axis.y === 0 && axis.z === 1 ) {
-
-			return this.rotateZ( angle );
-
-		}
-
-		var x = axis.x, y = axis.y, z = axis.z;
-		var n = Math.sqrt(x * x + y * y + z * z);
-
-		x /= n;
-		y /= n;
-		z /= n;
-
-		var xx = x * x, yy = y * y, zz = z * z;
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-		var oneMinusCosine = 1 - c;
-		var xy = x * y * oneMinusCosine;
-		var xz = x * z * oneMinusCosine;
-		var yz = y * z * oneMinusCosine;
-		var xs = x * s;
-		var ys = y * s;
-		var zs = z * s;
-
-		var r11 = xx + (1 - xx) * c;
-		var r21 = xy + zs;
-		var r31 = xz - ys;
-		var r12 = xy - zs;
-		var r22 = yy + (1 - yy) * c;
-		var r32 = yz + xs;
-		var r13 = xz + ys;
-		var r23 = yz - xs;
-		var r33 = zz + (1 - zz) * c;
-
-		var m11 = te[0], m21 = te[1], m31 = te[2], m41 = te[3];
-		var m12 = te[4], m22 = te[5], m32 = te[6], m42 = te[7];
-		var m13 = te[8], m23 = te[9], m33 = te[10], m43 = te[11];
-		var m14 = te[12], m24 = te[13], m34 = te[14], m44 = te[15];
-
-		te[0] = r11 * m11 + r21 * m12 + r31 * m13;
-		te[1] = r11 * m21 + r21 * m22 + r31 * m23;
-		te[2] = r11 * m31 + r21 * m32 + r31 * m33;
-		te[3] = r11 * m41 + r21 * m42 + r31 * m43;
-
-		te[4] = r12 * m11 + r22 * m12 + r32 * m13;
-		te[5] = r12 * m21 + r22 * m22 + r32 * m23;
-		te[6] = r12 * m31 + r22 * m32 + r32 * m33;
-		te[7] = r12 * m41 + r22 * m42 + r32 * m43;
-
-		te[8] = r13 * m11 + r23 * m12 + r33 * m13;
-		te[9] = r13 * m21 + r23 * m22 + r33 * m23;
-		te[10] = r13 * m31 + r23 * m32 + r33 * m33;
-		te[11] = r13 * m41 + r23 * m42 + r33 * m43;
-
-		return this;
-
-	},
-
-	scale: function ( v ) {
-
-		var te = this.elements;
-		var x = v.x, y = v.y, z = v.z;
-
-		te[0] *= x; te[4] *= y; te[8] *= z;
-		te[1] *= x; te[5] *= y; te[9] *= z;
-		te[2] *= x; te[6] *= y; te[10] *= z;
-		te[3] *= x; te[7] *= y; te[11] *= z;
-
-		return this;
-
-	},
-
-	getMaxScaleOnAxis: function () {
-
-		var te = this.elements;
-
-		var scaleXSq =  te[0] * te[0] + te[1] * te[1] + te[2] * te[2];
-		var scaleYSq =  te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
-		var scaleZSq =  te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
-
-		return Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) );
-
-	},
-
-	//
-
-	makeTranslation: function ( x, y, z ) {
-
-		this.set(
-
-			1, 0, 0, x,
-			0, 1, 0, y,
-			0, 0, 1, z,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationX: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			1, 0,  0, 0,
-			0, c, -s, 0,
-			0, s,  c, 0,
-			0, 0,  0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationY: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			 c, 0, s, 0,
-			 0, 1, 0, 0,
-			-s, 0, c, 0,
-			 0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationZ: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			c, -s, 0, 0,
-			s,  c, 0, 0,
-			0,  0, 1, 0,
-			0,  0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationAxis: function ( axis, angle ) {
-
-		// Based on http://www.gamedev.net/reference/articles/article1199.asp
-
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-		var t = 1 - c;
-		var x = axis.x, y = axis.y, z = axis.z;
-		var tx = t * x, ty = t * y;
-
-		this.set(
-
-		 	tx * x + c, tx * y - s * z, tx * z + s * y, 0,
-			tx * y + s * z, ty * y + c, ty * z - s * x, 0,
-			tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
-			0, 0, 0, 1
-
-		);
-
-		 return this;
-
-	},
-
-	makeScale: function ( x, y, z ) {
-
-		this.set(
-
-			x, 0, 0, 0,
-			0, y, 0, 0,
-			0, 0, z, 0,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeFrustum: function ( left, right, bottom, top, near, far ) {
-        var te = this.elements;
-		var x = 2 * near / ( right - left );
-		var y = 2 * near / ( top - bottom );
-
-		var a = ( right + left ) / ( right - left );
-		var b = ( top + bottom ) / ( top - bottom );
-		var c = - ( far + near ) / ( far - near );
-		var d = - 2 * far * near / ( far - near );
-
-		te[0] = x;  te[4] = 0;  te[8] = a;   te[12] = 0;
-		te[1] = 0;  te[5] = y;  te[9] = b;   te[13] = 0;
-		te[2] = 0;  te[6] = 0;  te[10] = c;   te[14] = d;
-		te[3] = 0;  te[7] = 0;  te[11] = - 1; te[15] = 0;
-
-		return this;
-
-	},
-
-	makePerspective: function ( fov, aspect, near, far ) {
-
-		var ymax = near * Math.tan( fov * Math.PI / 360 );
-		var ymin = - ymax;
-		var xmin = ymin * aspect;
-		var xmax = ymax * aspect;
-
-		return this.makeFrustum( xmin, xmax, ymin, ymax, near, far );
-
-	},
-
-	makeOrthographic: function ( left, right, top, bottom, near, far ) {
-        var te = this.elements;
-		var w = right - left;
-		var h = top - bottom;
-		var p = far - near;
-
-		var x = ( right + left ) / w;
-		var y = ( top + bottom ) / h;
-		var z = ( far + near ) / p;
-
-		te[0] = 2 / w; te[4] = 0;     te[8] = 0;      te[12] = -x;
-		te[1] = 0;     te[5] = 2 / h; te[9] = 0;      te[13] = -y;
-		te[2] = 0;     te[6] = 0;     te[10] = -2 / p; te[14] = -z;
-		te[3] = 0;     te[7] = 0;     te[11] = 0;      te[15] = 1;
-
-		return this;
-
-	},
-
-
-	clone: function () {
-        var te = this.elements;
-		return new THREE.Matrix4(
-
-			te[0], te[4], te[8], te[12],
-			te[1], te[5], te[9], te[13],
-			te[2], te[6], te[10], te[14],
-			te[3], te[7], te[11], te[15]
-
-		);
-
-	}
-
-};
-
-THREE.Matrix4.__v1 = new THREE.Vector3();
-THREE.Matrix4.__v2 = new THREE.Vector3();
-THREE.Matrix4.__v3 = new THREE.Vector3();
-
-THREE.Matrix4.__m1 = new THREE.Matrix4();
-THREE.Matrix4.__m2 = new THREE.Matrix4();
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Object3D = function () {
-
-	this.id = THREE.Object3DCount ++;
-
-	this.name = '';
-
-	this.parent = undefined;
-	this.children = [];
-
-	this.up = new THREE.Vector3( 0, 1, 0 );
-
-	this.position = new THREE.Vector3();
-	this.rotation = new THREE.Vector3();
-	this.eulerOrder = 'XYZ';
-	this.scale = new THREE.Vector3( 1, 1, 1 );
-
-	this.doubleSided = false;
-	this.flipSided = false;
-
-	this.renderDepth = null;
-
-	this.rotationAutoUpdate = true;
-
-	this.matrix = new THREE.Matrix4();
-	this.matrixWorld = new THREE.Matrix4();
-	this.matrixRotationWorld = new THREE.Matrix4();
-
-	this.matrixAutoUpdate = true;
-	this.matrixWorldNeedsUpdate = true;
-
-	this.quaternion = new THREE.Quaternion();
-	this.useQuaternion = false;
-
-	this.boundRadius = 0.0;
-	this.boundRadiusScale = 1.0;
-
-	this.visible = true;
-
-	this.castShadow = false;
-	this.receiveShadow = false;
-
-	this.frustumCulled = true;
-
-	this._vector = new THREE.Vector3();
-
-};
-
-
-THREE.Object3D.prototype = {
-
-	constructor: THREE.Object3D,
-
-	applyMatrix: function ( matrix ) {
-
-		this.matrix.multiply( matrix, this.matrix );
-
-		this.scale.getScaleFromMatrix( this.matrix );
-		this.rotation.getRotationFromMatrix( this.matrix, this.scale );
-		this.position.getPositionFromMatrix( this.matrix );
-
-	},
-
-	translate: function ( distance, axis ) {
-
-		this.matrix.rotateAxis( axis );
-		this.position.addSelf( axis.multiplyScalar( distance ) );
-
-	},
-
-	translateX: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 1, 0, 0 ) );
-
-	},
-
-	translateY: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 0, 1, 0 ) );
-
-	},
-
-	translateZ: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 0, 0, 1 ) );
-
-	},
-
-	lookAt: function ( vector ) {
-
-		// TODO: Add hierarchy support.
-
-		this.matrix.lookAt( vector, this.position, this.up );
-
-		if ( this.rotationAutoUpdate ) {
-
-			this.rotation.getRotationFromMatrix( this.matrix );
-
-		}
-
-	},
-
-	add: function ( object ) {
-
-		if ( object === this ) {
-
-			console.warn( 'THREE.Object3D.add: An object can\'t be added as a child of itself.' );
-			return;
-
-		}
-
-		if ( object instanceof THREE.Object3D ) { // && this.children.indexOf( object ) === - 1
-
-			if ( object.parent !== undefined ) {
-
-				object.parent.remove( object );
-
-			}
-
-			object.parent = this;
-			this.children.push( object );
-
-			// add to scene
-
-			var scene = this;
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene )  {
-
-				scene.__addObject( object );
-
-			}
-
-		}
-
-	},
-
-	remove: function ( object ) {
-
-		var index = this.children.indexOf( object );
-
-		if ( index !== - 1 ) {
-
-			object.parent = undefined;
-			this.children.splice( index, 1 );
-
-			// remove from scene
-
-			var scene = this;
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene ) {
-
-				scene.__removeObject( object );
-
-			}
-
-		}
-
-	},
-
-	getChildByName: function ( name, recursive ) {
-
-		var c, cl, child;
-
-		for ( c = 0, cl = this.children.length; c < cl; c ++ ) {
-
-			child = this.children[ c ];
-
-			if ( child.name === name ) {
-
-				return child;
-
-			}
-
-			if ( recursive ) {
-
-				child = child.getChildByName( name, recursive );
-
-				if ( child !== undefined ) {
-
-					return child;
-
-				}
-
-			}
-
-		}
-
-		return undefined;
-
-	},
-
-	updateMatrix: function () {
-
-		this.matrix.setPosition( this.position );
-
-		if ( this.useQuaternion )  {
-
-			this.matrix.setRotationFromQuaternion( this.quaternion );
-
-		} else {
-
-			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 ( force ) {
-
-		this.matrixAutoUpdate && this.updateMatrix();
-
-		// update matrixWorld
-
-		if ( this.matrixWorldNeedsUpdate || force ) {
-
-			if ( this.parent ) {
-
-				this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix );
-
-			} else {
-
-				this.matrixWorld.copy( this.matrix );
-
-			}
-
-			this.matrixWorldNeedsUpdate = false;
-
-			force = true;
-
-		}
-
-		// update children
-
-		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
-
-			this.children[ i ].updateMatrixWorld( force );
-
-		}
-
-	}
-
-};
-
-THREE.Object3DCount = 0;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author julianwa / https://github.com/julianwa
- */
-
-THREE.Projector = function() {
-
-	var _object, _objectCount, _objectPool = [],
-	_vertex, _vertexCount, _vertexPool = [],
-	_face, _face3Count, _face3Pool = [], _face4Count, _face4Pool = [],
-	_line, _lineCount, _linePool = [],
-	_particle, _particleCount, _particlePool = [],
-
-	_renderData = { objects: [], sprites: [], lights: [], elements: [] },
-
-	_vector3 = new THREE.Vector3(),
-	_vector4 = new THREE.Vector4(),
-
-	_projScreenMatrix = new THREE.Matrix4(),
-	_projScreenobjectMatrixWorld = new THREE.Matrix4(),
-
-	_frustum = new THREE.Frustum(),
-
-	_clippedVertex1PositionScreen = new THREE.Vector4(),
-	_clippedVertex2PositionScreen = new THREE.Vector4(),
-
-	_face3VertexNormals;
-
-	this.projectVector = function ( vector, camera ) {
-
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.unprojectVector = function ( vector, camera ) {
-
-		camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
-
-		_projScreenMatrix.multiply( camera.matrixWorld, camera.projectionMatrixInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.pickingRay = function ( vector, camera ) {
-
-		var end, ray, t;
-
-		// set two vectors with opposing z values
-		vector.z = -1.0;
-		end = new THREE.Vector3( vector.x, vector.y, 1.0 );
-
-		this.unprojectVector( vector, camera );
-		this.unprojectVector( end, camera );
-
-		// find direction from vector to end
-		end.subSelf( vector ).normalize();
-
-		return new THREE.Ray( vector, end );
-
-	};
-
-	this.projectGraph = function ( root, sort ) {
-
-		_objectCount = 0;
-
-		_renderData.objects.length = 0;
-		_renderData.sprites.length = 0;
-		_renderData.lights.length = 0;
-
-		var projectObject = function ( object ) {
-
-			if ( object.visible === false ) return;
-
-			if ( ( object instanceof THREE.Mesh || object instanceof THREE.Line ) &&
-			( object.frustumCulled === false || _frustum.contains( object ) ) ) {
-
-				_vector3.copy( object.matrixWorld.getPosition() );
-				_projScreenMatrix.multiplyVector3( _vector3 );
-
-				_object = getNextObjectInPool();
-				_object.object = object;
-				_object.z = _vector3.z;
-
-				_renderData.objects.push( _object );
-
-			} else if ( object instanceof THREE.Sprite || object instanceof THREE.Particle ) {
-
-				_vector3.copy( object.matrixWorld.getPosition() );
-				_projScreenMatrix.multiplyVector3( _vector3 );
-
-				_object = getNextObjectInPool();
-				_object.object = object;
-				_object.z = _vector3.z;
-
-				_renderData.sprites.push( _object );
-
-			} else if ( object instanceof THREE.Light ) {
-
-				_renderData.lights.push( object );
-
-			}
-
-			for ( var c = 0, cl = object.children.length; c < cl; c ++ ) {
-
-				projectObject( object.children[ c ] );
-
-			}
-
-		};
-
-		projectObject( root );
-
-		sort && _renderData.objects.sort( painterSort );
-
-		return _renderData;
-
-	};
-
-	this.projectScene = function ( scene, camera, sort ) {
-
-		var near = camera.near, far = camera.far, visible = false,
-		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, object,
-		objectMatrixWorld, objectMatrixWorldRotation,
-		geometry, geometryMaterials, vertices, vertex, vertexPositionScreen,
-		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
-		v1, v2, v3, v4;
-
-		_face3Count = 0;
-		_face4Count = 0;
-		_lineCount = 0;
-		_particleCount = 0;
-
-		_renderData.elements.length = 0;
-
-		if ( camera.parent === undefined ) {
-
-			console.warn( 'DEPRECATED: Camera hasn\'t been added to a Scene. Adding it...' );
-			scene.add( camera );
-
-		}
-
-		scene.updateMatrixWorld();
-
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-
-		_frustum.setFromMatrix( _projScreenMatrix );
-
-		_renderData = this.projectGraph( scene, false );
-
-		for ( o = 0, ol = _renderData.objects.length; o < ol; o++ ) {
-
-			object = _renderData.objects[ o ].object;
-
-			objectMatrixWorld = object.matrixWorld;
-
-			_vertexCount = 0;
-
-			if ( object instanceof THREE.Mesh ) {
-
-				geometry = object.geometry;
-				geometryMaterials = object.geometry.materials;
-				vertices = geometry.vertices;
-				faces = geometry.faces;
-				faceVertexUvs = geometry.faceVertexUvs;
-
-				objectMatrixWorldRotation = object.matrixRotationWorld.extractRotation( objectMatrixWorld );
-
-				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
-
-					_vertex = getNextVertexInPool();
-					_vertex.positionWorld.copy( vertices[ v ] );
-
-					objectMatrixWorld.multiplyVector3( _vertex.positionWorld );
-
-					_vertex.positionScreen.copy( _vertex.positionWorld );
-					_projScreenMatrix.multiplyVector4( _vertex.positionScreen );
-
-					_vertex.positionScreen.x /= _vertex.positionScreen.w;
-					_vertex.positionScreen.y /= _vertex.positionScreen.w;
-
-					_vertex.visible = _vertex.positionScreen.z > near && _vertex.positionScreen.z < far;
-
-				}
-
-				for ( f = 0, fl = faces.length; f < fl; f ++ ) {
-
-					face = faces[ f ];
-
-					if ( face instanceof THREE.Face3 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-
-						if ( v1.visible && v2.visible && v3.visible ) {
-
-							visible = ( ( v3.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-								( v3.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) ) < 0;
-
-							if ( object.doubleSided || visible != object.flipSided ) {
-
-								_face = getNextFace3InPool();
-
-								_face.v1.copy( v1 );
-								_face.v2.copy( v2 );
-								_face.v3.copy( v3 );
-
-							} else {
-
-								continue;
-
-							}
-
-						} else {
-
-							continue;
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-						v4 = _vertexPool[ face.d ];
-
-						if ( v1.visible && v2.visible && v3.visible && v4.visible ) {
-
-							visible = ( v4.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-								( v4.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ||
-								( v2.positionScreen.x - v3.positionScreen.x ) * ( v4.positionScreen.y - v3.positionScreen.y ) -
-								( v2.positionScreen.y - v3.positionScreen.y ) * ( v4.positionScreen.x - v3.positionScreen.x ) < 0;
-
-
-							if ( object.doubleSided || visible != object.flipSided ) {
-
-								_face = getNextFace4InPool();
-
-								_face.v1.copy( v1 );
-								_face.v2.copy( v2 );
-								_face.v3.copy( v3 );
-								_face.v4.copy( v4 );
-
-							} else {
-
-								continue;
-
-							}
-
-						} else {
-
-							continue;
-
-						}
-
-					}
-
-					_face.normalWorld.copy( face.normal );
-					if ( !visible && ( object.flipSided || object.doubleSided ) ) _face.normalWorld.negate();
-					objectMatrixWorldRotation.multiplyVector3( _face.normalWorld );
-
-					_face.centroidWorld.copy( face.centroid );
-					objectMatrixWorld.multiplyVector3( _face.centroidWorld );
-
-					_face.centroidScreen.copy( _face.centroidWorld );
-					_projScreenMatrix.multiplyVector3( _face.centroidScreen );
-
-					faceVertexNormals = face.vertexNormals;
-
-					for ( n = 0, nl = faceVertexNormals.length; n < nl; n ++ ) {
-
-						normal = _face.vertexNormalsWorld[ n ];
-						normal.copy( faceVertexNormals[ n ] );
-						if ( !visible && ( object.flipSided || object.doubleSided ) ) normal.negate();
-						objectMatrixWorldRotation.multiplyVector3( normal );
-
-					}
-
-					for ( c = 0, cl = faceVertexUvs.length; c < cl; c ++ ) {
-
-						uvs = faceVertexUvs[ c ][ f ];
-
-						if ( !uvs ) continue;
-
-						for ( u = 0, ul = uvs.length; u < ul; u ++ ) {
-
-							_face.uvs[ c ][ u ] = uvs[ u ];
-
-						}
-
-					}
-
-					_face.material = object.material;
-					_face.faceMaterial = face.materialIndex !== null ? geometryMaterials[ face.materialIndex ] : null;
-
-					_face.z = _face.centroidScreen.z;
-
-					_renderData.elements.push( _face );
-
-				}
-
-			} else if ( object instanceof THREE.Line ) {
-
-				_projScreenobjectMatrixWorld.multiply( _projScreenMatrix, objectMatrixWorld );
-
-				vertices = object.geometry.vertices;
-				
-				v1 = getNextVertexInPool();
-				v1.positionScreen.copy( vertices[ 0 ] );
-				_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
-
-				// Handle LineStrip and LinePieces
-				var step = object.type === THREE.LinePieces ? 2 : 1;
-
-				for ( v = 1, vl = vertices.length; v < vl; v ++ ) {
-
-					v1 = getNextVertexInPool();
-					v1.positionScreen.copy( vertices[ v ] );
-					_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
-
-					if ( ( v + 1 ) % step > 0 ) continue;
-
-					v2 = _vertexPool[ _vertexCount - 2 ];
-
-					_clippedVertex1PositionScreen.copy( v1.positionScreen );
-					_clippedVertex2PositionScreen.copy( v2.positionScreen );
-
-					if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) ) {
-
-						// Perform the perspective divide
-						_clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w );
-						_clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w );
-
-						_line = getNextLineInPool();
-						_line.v1.positionScreen.copy( _clippedVertex1PositionScreen );
-						_line.v2.positionScreen.copy( _clippedVertex2PositionScreen );
-
-						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
-
-						_line.material = object.material;
-
-						_renderData.elements.push( _line );
-
-					}
-
-				}
-
-			}
-
-		}
-
-		for ( o = 0, ol = _renderData.sprites.length; o < ol; o++ ) {
-
-			object = _renderData.sprites[ o ].object;
-
-			objectMatrixWorld = object.matrixWorld;
-
-			if ( object instanceof THREE.Particle ) {
-
-				_vector4.set( objectMatrixWorld.elements[12], objectMatrixWorld.elements[13], objectMatrixWorld.elements[14], 1 );
-				_projScreenMatrix.multiplyVector4( _vector4 );
-
-				_vector4.z /= _vector4.w;
-
-				if ( _vector4.z > 0 && _vector4.z < 1 ) {
-
-					_particle = getNextParticleInPool();
-					_particle.x = _vector4.x / _vector4.w;
-					_particle.y = _vector4.y / _vector4.w;
-					_particle.z = _vector4.z;
-
-					_particle.rotation = object.rotation.z;
-
-					_particle.scale.x = object.scale.x * Math.abs( _particle.x - ( _vector4.x + camera.projectionMatrix.elements[0] ) / ( _vector4.w + camera.projectionMatrix.elements[12] ) );
-					_particle.scale.y = object.scale.y * Math.abs( _particle.y - ( _vector4.y + camera.projectionMatrix.elements[5] ) / ( _vector4.w + camera.projectionMatrix.elements[13] ) );
-
-					_particle.material = object.material;
-
-					_renderData.elements.push( _particle );
-
-				}
-
-			}
-
-		}
-
-		sort && _renderData.elements.sort( painterSort );
-
-		return _renderData;
-
-	};
-
-	// Pools
-
-	function getNextObjectInPool() {
-
-		var object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject();
-
-		_objectCount ++;
-
-		return object;
-
-	}
-
-	function getNextVertexInPool() {
-
-		var vertex = _vertexPool[ _vertexCount ] = _vertexPool[ _vertexCount ] || new THREE.RenderableVertex();
-
-		_vertexCount ++;
-
-		return vertex;
-
-	}
-
-	function getNextFace3InPool() {
-
-		var face = _face3Pool[ _face3Count ] = _face3Pool[ _face3Count ] || new THREE.RenderableFace3();
-
-		_face3Count ++;
-
-		return face;
-
-	}
-
-	function getNextFace4InPool() {
-
-		var face = _face4Pool[ _face4Count ] = _face4Pool[ _face4Count ] || new THREE.RenderableFace4();
-
-		_face4Count ++;
-
-		return face;
-
-	}
-
-	function getNextLineInPool() {
-
-		var line = _linePool[ _lineCount ] = _linePool[ _lineCount ] || new THREE.RenderableLine();
-
-		_lineCount ++;
-
-		return line;
-
-	}
-
-	function getNextParticleInPool() {
-
-		var particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle();
-		_particleCount ++;
-		return particle;
-
-	}
-
-	//
-
-	function painterSort( a, b ) {
-
-		return b.z - a.z;
-
-	}
-
-	function clipLine( s1, s2 ) {
-
-		var alpha1 = 0, alpha2 = 1,
-
-		// Calculate the boundary coordinate of each vertex for the near and far clip planes,
-		// Z = -1 and Z = +1, respectively.
-		bc1near =  s1.z + s1.w,
-		bc2near =  s2.z + s2.w,
-		bc1far =  - s1.z + s1.w,
-		bc2far =  - s2.z + s2.w;
-
-		if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) {
-
-			// Both vertices lie entirely within all clip planes.
-			return true;
-
-		} else if ( ( bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0 ) ) {
-
-			// Both vertices lie entirely outside one of the clip planes.
-			return false;
-
-		} else {
-
-			// The line segment spans at least one clip plane.
-
-			if ( bc1near < 0 ) {
-
-				// v1 lies outside the near plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) );
-
-			} else if ( bc2near < 0 ) {
-
-				// v2 lies outside the near plane, v1 inside
-				alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) );
-
-			}
-
-			if ( bc1far < 0 ) {
-
-				// v1 lies outside the far plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) );
-
-			} else if ( bc2far < 0 ) {
-
-				// v2 lies outside the far plane, v2 inside
-				alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) );
-
-			}
-
-			if ( alpha2 < alpha1 ) {
-
-				// The line segment spans two boundaries, but is outside both of them.
-				// (This can't happen when we're only clipping against just near/far but good
-				//  to leave the check here for future usage if other clip planes are added.)
-				return false;
-
-			} else {
-
-				// Update the s1 and s2 vertices to match the clipped line segment.
-				s1.lerpSelf( s2, alpha1 );
-				s2.lerpSelf( s1, 1 - alpha2 );
-
-				return true;
-
-			}
-
-		}
-
-	}
-
-};
-/**
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Quaternion = function( x, y, z, w ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-	this.w = ( w !== undefined ) ? w : 1;
-
-};
-
-THREE.Quaternion.prototype = {
-
-	constructor: THREE.Quaternion,
-
-	set: function ( x, y, z, w ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-		this.w = w;
-
-		return this;
-
-	},
-
-	copy: function ( q ) {
-
-		this.x = q.x;
-		this.y = q.y;
-		this.z = q.z;
-		this.w = q.w;
-
-		return this;
-
-	},
-
-	setFromEuler: function ( vector ) {
-
-		var c = Math.PI / 360, // 0.5 * Math.PI / 360, // 0.5 is an optimization
-		x = vector.x * c,
-		y = vector.y * c,
-		z = vector.z * c,
-
-		c1 = Math.cos( y  ),
-		s1 = Math.sin( y  ),
-		c2 = Math.cos( -z ),
-		s2 = Math.sin( -z ),
-		c3 = Math.cos( x  ),
-		s3 = Math.sin( x  ),
-
-		c1c2 = c1 * c2,
-		s1s2 = s1 * s2;
-
-		this.w = c1c2 * c3  - s1s2 * s3;
-	  	this.x = c1c2 * s3  + s1s2 * c3;
-		this.y = s1 * c2 * c3 + c1 * s2 * s3;
-		this.z = c1 * s2 * c3 - s1 * c2 * s3;
-
-		return this;
-
-	},
-
-	setFromAxisAngle: function ( axis, angle ) {
-
-		// from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-		// axis have to be normalized
-
-		var halfAngle = angle / 2,
-			s = Math.sin( halfAngle );
-
-		this.x = axis.x * s;
-		this.y = axis.y * s;
-		this.z = axis.z * s;
-		this.w = Math.cos( halfAngle );
-
-		return this;
-
-	},
-
-	setFromRotationMatrix: function ( m ) {
-
-		// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-
-		function copySign( a, b ) {
-
-			return b < 0 ? -Math.abs( a ) : Math.abs( a );
-
-		}
-
-		var absQ = Math.pow( m.determinant(), 1.0 / 3.0 );
-		this.w = Math.sqrt( Math.max( 0, absQ + m.elements[0] + m.elements[5] + m.elements[10] ) ) / 2;
-		this.x = Math.sqrt( Math.max( 0, absQ + m.elements[0] - m.elements[5] - m.elements[10] ) ) / 2;
-		this.y = Math.sqrt( Math.max( 0, absQ - m.elements[0] + m.elements[5] - m.elements[10] ) ) / 2;
-		this.z = Math.sqrt( Math.max( 0, absQ - m.elements[0] - m.elements[5] + m.elements[10] ) ) / 2;
-		this.x = copySign( this.x, ( m.elements[6] - m.elements[9] ) );
-		this.y = copySign( this.y, ( m.elements[8] - m.elements[2] ) );
-		this.z = copySign( this.z, ( m.elements[1] - m.elements[4] ) );
-		this.normalize();
-
-		return this;
-
-	},
-
-	calculateW : function () {
-
-		this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );
-
-		return this;
-
-	},
-
-	inverse: function () {
-
-		this.x *= -1;
-		this.y *= -1;
-		this.z *= -1;
-
-		return this;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
-	},
-
-	normalize: function () {
-
-		var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
-		if ( l === 0 ) {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-			this.w = 0;
-
-		} else {
-
-			l = 1 / l;
-
-			this.x = this.x * l;
-			this.y = this.y * l;
-			this.z = this.z * l;
-			this.w = this.w * l;
-
-		}
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-
-		// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-
-		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 ( b ) {
-
-		var qax = this.x, qay = this.y, qaz = this.z, qaw = this.w,
-		qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;
-
-		this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
-		this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
-		this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
-		this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
-		return this;
-
-	},
-
-	multiplyVector3: function ( vector, dest ) {
-
-		if ( !dest ) { dest = vector; }
-
-		var x    = vector.x,  y  = vector.y,  z  = vector.z,
-			qx   = this.x, qy = this.y, qz = this.z, qw = this.w;
-
-		// calculate quat * vector
-
-		var ix =  qw * x + qy * z - qz * y,
-			iy =  qw * y + qz * x - qx * z,
-			iz =  qw * z + qx * y - qy * x,
-			iw = -qx * x - qy * y - qz * z;
-
-		// calculate result * inverse quat
-
-		dest.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
-		dest.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
-		dest.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
-
-		return dest;
-
-	},
-
-	clone: function () {
-
-		return new THREE.Quaternion( this.x, this.y, this.z, this.w );
-
-	}
-
-}
-
-THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
-
-	// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
-	var cosHalfTheta = qa.w * qb.w + qa.x * qb.x + qa.y * qb.y + qa.z * qb.z;
-
-	if (cosHalfTheta < 0) {
-		qm.w = -qb.w; qm.x = -qb.x; qm.y = -qb.y; qm.z = -qb.z;
-		cosHalfTheta = -cosHalfTheta;
-	} else {
-		qm.copy(qb);
-	}
-
-	if ( Math.abs( cosHalfTheta ) >= 1.0 ) {
-
-		qm.w = qa.w; qm.x = qa.x; qm.y = qa.y; qm.z = qa.z;
-		return qm;
-
-	}
-
-	var halfTheta = Math.acos( cosHalfTheta ),
-	sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
-
-	if ( Math.abs( sinHalfTheta ) < 0.001 ) {
-
-		qm.w = 0.5 * ( qa.w + qb.w );
-		qm.x = 0.5 * ( qa.x + qb.x );
-		qm.y = 0.5 * ( qa.y + qb.y );
-		qm.z = 0.5 * ( qa.z + qb.z );
-
-		return qm;
-
-	}
-
-	var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
-	ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
-
-	qm.w = ( qa.w * ratioA + qm.w * ratioB );
-	qm.x = ( qa.x * ratioA + qm.x * ratioB );
-	qm.y = ( qa.y * ratioA + qm.y * ratioB );
-	qm.z = ( qa.z * ratioA + qm.z * ratioB );
-
-	return qm;
-
-}
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Vertex = function () {
-
-	console.warn( 'THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.')
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
-
-	this.a = a;
-	this.b = b;
-	this.c = c;
-
-	this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
-	this.vertexNormals = normal instanceof Array ? normal : [ ];
-
-	this.color = color instanceof THREE.Color ? color : new THREE.Color();
-	this.vertexColors = color instanceof Array ? color : [];
-
-	this.vertexTangents = [];
-
-	this.materialIndex = materialIndex;
-
-	this.centroid = new THREE.Vector3();
-
-};
-
-THREE.Face3.prototype = {
-
-	constructor: THREE.Face3,
-
-	clone: function () {
-
-		var face = new THREE.Face3( this.a, this.b, this.c );
-
-		face.normal.copy( this.normal );
-		face.color.copy( this.color );
-		face.centroid.copy( this.centroid );
-
-		face.materialIndex = this.materialIndex;
-
-		var i, il;
-		for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
-		for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
-		for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
-
-		return face;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
-
-	this.a = a;
-	this.b = b;
-	this.c = c;
-	this.d = d;
-
-	this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
-	this.vertexNormals = normal instanceof Array ? normal : [ ];
-
-	this.color = color instanceof THREE.Color ? color : new THREE.Color();
-	this.vertexColors = color instanceof Array ? color : [];
-
-	this.vertexTangents = [];
-
-	this.materialIndex = materialIndex;
-
-	this.centroid = new THREE.Vector3();
-
-};
-
-THREE.Face4.prototype = {
-
-	constructor: THREE.Face4,
-
-	clone: function () {
-
-		var face = new THREE.Face4( this.a, this.b, this.c, this.d );
-
-		face.normal.copy( this.normal );
-		face.color.copy( this.color );
-		face.centroid.copy( this.centroid );
-
-		face.materialIndex = this.materialIndex;
-
-		var i, il;
-		for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
-		for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
-		for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
-
-		return face;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.UV = function ( u, v ) {
-
-	this.u = u || 0;
-	this.v = v || 0;
-
-};
-
-THREE.UV.prototype = {
-
-	constructor: THREE.UV,
-
-	set: function ( u, v ) {
-
-		this.u = u;
-		this.v = v;
-
-		return this;
-
-	},
-
-	copy: function ( uv ) {
-
-		this.u = uv.u;
-		this.v = uv.v;
-
-		return this;
-
-	},
-
-	lerpSelf: function ( uv, alpha ) {
-
-		this.u += ( uv.u - this.u ) * alpha;
-		this.v += ( uv.v - this.v ) * alpha;
-
-		return this;
-
-	},
-
-	clone: function () {
-
-		return new THREE.UV( this.u, this.v );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author mikael emtinger / http://gomo.se/
- */
-
-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 = new THREE.Object3D();
-THREE.Camera.prototype.constructor = THREE.Camera;
-
-THREE.Camera.prototype.lookAt = function ( vector ) {
-
-	// TODO: Add hierarchy support.
-
-	this.matrix.lookAt( this.position, vector, this.up );
-
-	if ( this.rotationAutoUpdate ) {
-
-		this.rotation.getRotationFromMatrix( this.matrix );
-
-	}
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {
-
-	THREE.Camera.call( this );
-
-	this.left = left;
-	this.right = right;
-	this.top = top;
-	this.bottom = bottom;
-
-	this.near = ( near !== undefined ) ? near : 0.1;
-	this.far = ( far !== undefined ) ? far : 2000;
-
-	this.updateProjectionMatrix();
-
-};
-
-THREE.OrthographicCamera.prototype = new THREE.Camera();
-THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;
-
-THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
-
-	this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far );
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author greggman / http://games.greggman.com/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- */
-
-THREE.PerspectiveCamera = function ( fov, aspect, near, far ) {
-
-	THREE.Camera.call( this );
-
-	this.fov = fov !== undefined ? fov : 50;
-	this.aspect = aspect !== undefined ? aspect : 1;
-	this.near = near !== undefined ? near : 0.1;
-	this.far = far !== undefined ? far : 2000;
-
-	this.updateProjectionMatrix();
-
-};
-
-THREE.PerspectiveCamera.prototype = new THREE.Camera();
-THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;
-
-
-/**
- * Uses Focal Length (in mm) to estimate and set FOV
- * 35mm (fullframe) camera is used if frame size is not specified;
- * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
- */
-
-THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {
-
-	frameHeight = frameHeight !== undefined ? frameHeight : 24;
-
-	this.fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );
-	this.updateProjectionMatrix();
-
-}
-
-
-/**
- * Sets an offset in a larger frustum. This is useful for multi-window or
- * multi-monitor/multi-machine setups.
- *
- * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
- * the monitors are in grid like this
- *
- *   +---+---+---+
- *   | A | B | C |
- *   +---+---+---+
- *   | D | E | F |
- *   +---+---+---+
- *
- * then for each monitor you would call it like this
- *
- *   var w = 1920;
- *   var h = 1080;
- *   var fullWidth = w * 3;
- *   var fullHeight = h * 2;
- *
- *   --A--
- *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
- *   --B--
- *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
- *   --C--
- *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
- *   --D--
- *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
- *   --E--
- *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
- *   --F--
- *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
- *
- *   Note there is no reason monitors have to be the same size or in a grid.
- */
-
-THREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) {
-
-	this.fullWidth = fullWidth;
-	this.fullHeight = fullHeight;
-	this.x = x;
-	this.y = y;
-	this.width = width;
-	this.height = height;
-
-	this.updateProjectionMatrix();
-
-};
-
-
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
-
-	if ( this.fullWidth ) {
-
-		var aspect = this.fullWidth / this.fullHeight;
-		var top = Math.tan( this.fov * Math.PI / 360 ) * this.near;
-		var bottom = -top;
-		var left = aspect * bottom;
-		var right = aspect * top;
-		var width = Math.abs( right - left );
-		var height = Math.abs( top - bottom );
-
-		this.projectionMatrix.makeFrustum(
-			left + this.x * width / this.fullWidth,
-			left + ( this.x + this.width ) * width / this.fullWidth,
-			top - ( this.y + this.height ) * height / this.fullHeight,
-			top - this.y * height / this.fullHeight,
-			this.near,
-			this.far
-		);
-
-	} else {
-
-		this.projectionMatrix.makePerspective( this.fov, this.aspect, this.near, this.far );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
- 
-THREE.Light = function ( hex ) {
-
-	THREE.Object3D.call( this );
-
-	this.color = new THREE.Color( hex );
-
-};
-
-THREE.Light.prototype = new THREE.Object3D();
-THREE.Light.prototype.constructor = THREE.Light;
-THREE.Light.prototype.supr = THREE.Object3D.prototype;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Material = function ( parameters ) {
-
-	parameters = parameters || {};
-
-	this.id = THREE.MaterialCount ++;
-
-	this.name = '';
-
-	this.opacity = parameters.opacity !== undefined ? parameters.opacity : 1;
-	this.transparent = parameters.transparent !== undefined ? parameters.transparent : false;
-
-	this.blending = parameters.blending !== undefined ? parameters.blending : THREE.NormalBlending;
-
-	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
-	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
-	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
-
-	this.depthTest = parameters.depthTest !== undefined ? parameters.depthTest : true;
-	this.depthWrite = parameters.depthWrite !== undefined ? parameters.depthWrite : true;
-
-	this.polygonOffset = parameters.polygonOffset !== undefined ? parameters.polygonOffset : false;
-	this.polygonOffsetFactor = parameters.polygonOffsetFactor !== undefined ? parameters.polygonOffsetFactor : 0;
-	this.polygonOffsetUnits = parameters.polygonOffsetUnits !== undefined ? parameters.polygonOffsetUnits : 0;
-
-	this.alphaTest = parameters.alphaTest !== undefined ? parameters.alphaTest : 0;
-
-	this.overdraw = parameters.overdraw !== undefined ? parameters.overdraw : false; // Boolean for fixing antialiasing gaps in CanvasRenderer
-
-	this.needsUpdate = true;
-
-}
-
-THREE.MaterialCount = 0;
-
-// shading
-
-THREE.NoShading = 0;
-THREE.FlatShading = 1;
-THREE.SmoothShading = 2;
-
-// colors
-
-THREE.NoColors = 0;
-THREE.FaceColors = 1;
-THREE.VertexColors = 2;
-
-// blending modes
-
-THREE.NoBlending = 0;
-THREE.NormalBlending = 1;
-THREE.AdditiveBlending = 2;
-THREE.SubtractiveBlending = 3;
-THREE.MultiplyBlending = 4;
-THREE.AdditiveAlphaBlending = 5;
-THREE.CustomBlending = 6;
-
-// custom blending equations
-// (numbers start from 100 not to clash with other
-//  mappings to OpenGL constants defined in Texture.js)
-
-THREE.AddEquation = 100;
-THREE.SubtractEquation = 101;
-THREE.ReverseSubtractEquation = 102;
-
-// custom blending destination factors
-
-THREE.ZeroFactor = 200;
-THREE.OneFactor = 201;
-THREE.SrcColorFactor = 202;
-THREE.OneMinusSrcColorFactor = 203;
-THREE.SrcAlphaFactor = 204;
-THREE.OneMinusSrcAlphaFactor = 205;
-THREE.DstAlphaFactor = 206;
-THREE.OneMinusDstAlphaFactor = 207;
-
-// custom blending source factors
-
-//THREE.ZeroFactor = 200;
-//THREE.OneFactor = 201;
-//THREE.SrcAlphaFactor = 204;
-//THREE.OneMinusSrcAlphaFactor = 205;
-//THREE.DstAlphaFactor = 206;
-//THREE.OneMinusDstAlphaFactor = 207;
-THREE.DstColorFactor = 208;
-THREE.OneMinusDstColorFactor = 209;
-THREE.SrcAlphaSaturateFactor = 210;
-
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  linewidth: <float>,
- *  linecap: "round",
- *  linejoin: "round",
- *
- *  vertexColors: <bool>
- *
- *  fog: <bool>
- * }
- */
-
-THREE.LineBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.linewidth = parameters.linewidth !== undefined ? parameters.linewidth : 1;
-	this.linecap = parameters.linecap !== undefined ? parameters.linecap : 'round';
-	this.linejoin = parameters.linejoin !== undefined ? parameters.linejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors ? parameters.vertexColors : false;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-};
-
-THREE.LineBasicMaterial.prototype = new THREE.Material();
-THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *  map: new THREE.Texture( <Image> ),
- *
- *  lightMap: new THREE.Texture( <Image> ),
- *
- *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
- *  combine: THREE.Multiply,
- *  reflectivity: <float>,
- *  refractionRatio: <float>,
- *
- *  shading: THREE.SmoothShading,
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
- *
- *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
- *
- *  skinning: <bool>,
- *  morphTargets: <bool>,
- *
- *	fog: <bool>
- * }
- */
-
-THREE.MeshBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	// color property represents emissive for MeshBasicMaterial
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
-
-	this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
-	this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
-	this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
-	this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
-
-	this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
-	this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
-	this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : THREE.NoColors;
-
-	this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
-	this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
-
-};
-
-THREE.MeshBasicMaterial.prototype = new THREE.Material();
-THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *  map: new THREE.Texture( <Image> ),
- *
- *  size: <float>,
- *
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  vertexColors: <bool>,
- *
- *  fog: <bool>
- * }
- */
-
-THREE.ParticleBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.size = parameters.size !== undefined ? parameters.size : 1;
-	this.sizeAttenuation = parameters.sizeAttenuation !== undefined ? parameters.sizeAttenuation : true;
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-};
-
-THREE.ParticleBasicMaterial.prototype = new THREE.Material();
-THREE.ParticleBasicMaterial.prototype.constructor = THREE.ParticleBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.ParticleDOMMaterial = function ( domElement ) {
-
-	THREE.Material.call( this );
-
-	this.domElement = domElement;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- * @author szimek / https://github.com/szimek/
- */
-
-THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type ) {
-
-	this.id = THREE.TextureCount ++;
-
-	this.image = image;
-
-	this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
-
-	this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;
-	this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;
-
-	this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
-	this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
-
-	this.format = format !== undefined ? format : THREE.RGBAFormat;
-	this.type = type !== undefined ? type : THREE.UnsignedByteType;
-
-	this.offset = new THREE.Vector2( 0, 0 );
-	this.repeat = new THREE.Vector2( 1, 1 );
-
-	this.generateMipmaps = true;
-	this.premultiplyAlpha = false;
-
-	this.needsUpdate = false;
-	this.onUpdate = null;
-
-};
-
-THREE.Texture.prototype = {
-
-	constructor: THREE.Texture,
-
-	clone: function () {
-
-		var clonedTexture = new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter, this.format, this.type );
-
-		clonedTexture.offset.copy( this.offset );
-		clonedTexture.repeat.copy( this.repeat );
-
-		return clonedTexture;
-
-	}
-
-};
-
-THREE.TextureCount = 0;
-
-THREE.MultiplyOperation = 0;
-THREE.MixOperation = 1;
-
-// Mapping modes
-
-THREE.UVMapping = function () {};
-
-THREE.CubeReflectionMapping = function () {};
-THREE.CubeRefractionMapping = function () {};
-
-THREE.SphericalReflectionMapping = function () {};
-THREE.SphericalRefractionMapping = function () {};
-
-// Wrapping modes
-
-THREE.RepeatWrapping = 0;
-THREE.ClampToEdgeWrapping = 1;
-THREE.MirroredRepeatWrapping = 2;
-
-// Filters
-
-THREE.NearestFilter = 3;
-THREE.NearestMipMapNearestFilter = 4;
-THREE.NearestMipMapLinearFilter = 5;
-THREE.LinearFilter = 6;
-THREE.LinearMipMapNearestFilter = 7;
-THREE.LinearMipMapLinearFilter = 8;
-
-// Types
-
-THREE.ByteType = 9;
-THREE.UnsignedByteType = 10;
-THREE.ShortType = 11;
-THREE.UnsignedShortType = 12;
-THREE.IntType = 13;
-THREE.UnsignedIntType = 14;
-THREE.FloatType = 15;
-
-// Formats
-
-THREE.AlphaFormat = 16;
-THREE.RGBFormat = 17;
-THREE.RGBAFormat = 18;
-THREE.LuminanceFormat = 19;
-THREE.LuminanceAlphaFormat = 20;
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter ) {
-
-	THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type );
-
-	this.image = { data: data, width: width, height: height };
-
-};
-
-THREE.DataTexture.prototype = new THREE.Texture();
-THREE.DataTexture.prototype.constructor = THREE.DataTexture;
-
-THREE.DataTexture.prototype.clone = function () {
-
-	var clonedTexture = new THREE.DataTexture( this.image.data,  this.image.width, this.image.height, this.format, this.type, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter );
-
-	clonedTexture.offset.copy( this.offset );
-	clonedTexture.repeat.copy( this.repeat );
-
-	return clonedTexture;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Particle = function ( material ) {
-
-	THREE.Object3D.call( this );
-
-	this.material = material;
-
-};
-
-THREE.Particle.prototype = new THREE.Object3D();
-THREE.Particle.prototype.constructor = THREE.Particle;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- * @author mikael emtinger / http://gomo.se/
- */
-
-THREE.Mesh = function ( geometry, material ) {
-
-	THREE.Object3D.call( this );
-
-	this.geometry = geometry;
-	this.material = ( material !== undefined ) ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
-
-	if ( this.geometry ) {
-
-		// calc bound radius
-
-		if( ! this.geometry.boundingSphere ) {
-
-			this.geometry.computeBoundingSphere();
-
-		}
-
-		this.boundRadius = geometry.boundingSphere.radius;
-
-
-		// setup morph targets
-
-		if( this.geometry.morphTargets.length ) {
-
-			this.morphTargetBase = -1;
-			this.morphTargetForcedOrder = [];
-			this.morphTargetInfluences = [];
-			this.morphTargetDictionary = {};
-
-			for( var m = 0; m < this.geometry.morphTargets.length; m ++ ) {
-
-				this.morphTargetInfluences.push( 0 );
-				this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m;
-
-			}
-
-		}
-
-	}
-
-}
-
-THREE.Mesh.prototype = new THREE.Object3D();
-THREE.Mesh.prototype.constructor = THREE.Mesh;
-THREE.Mesh.prototype.supr = THREE.Object3D.prototype;
-
-
-/*
- * Get Morph Target Index by Name
- */
-
-THREE.Mesh.prototype.getMorphTargetIndexByName = function( name ) {
-
-	if ( this.morphTargetDictionary[ name ] !== undefined ) {
-
-		return this.morphTargetDictionary[ name ];
-	}
-
-	console.log( "THREE.Mesh.getMorphTargetIndexByName: morph target " + name + " does not exist. Returning 0." );
-	return 0;
-
-}
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Line = function ( geometry, material, type ) {
-
-	THREE.Object3D.call( this );
-
-	this.geometry = geometry;
-	this.material = ( material !== undefined ) ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } );
-	this.type = ( type !== undefined ) ? type : THREE.LineStrip;
-
-	if ( this.geometry ) {
-
-		if ( ! this.geometry.boundingSphere ) {
-
-			this.geometry.computeBoundingSphere();
-
-		}
-
-	}
-
-};
-
-THREE.LineStrip = 0;
-THREE.LinePieces = 1;
-
-THREE.Line.prototype = new THREE.Object3D();
-THREE.Line.prototype.constructor = THREE.Line;
-/**
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Bone = function( belongsToSkin ) {
-
-	THREE.Object3D.call( this );
-
-	this.skin = belongsToSkin;
-	this.skinMatrix = new THREE.Matrix4();
-
-};
-
-THREE.Bone.prototype = new THREE.Object3D();
-THREE.Bone.prototype.constructor = THREE.Bone;
-THREE.Bone.prototype.supr = THREE.Object3D.prototype;
-
-
-THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate ) {
-
-	// update local
-
-	if ( this.matrixAutoUpdate ) {
-
-		forceUpdate |= this.updateMatrix();
-
-	}
-
-	// update skin matrix
-
-	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
-
-		if( parentSkinMatrix ) {
-
-			this.skinMatrix.multiply( parentSkinMatrix, this.matrix );
-
-		} else {
-
-			this.skinMatrix.copy( this.matrix );
-
-		}
-
-		this.matrixWorldNeedsUpdate = false;
-		forceUpdate = true;
-
-	}
-
-	// update children
-
-	var child, i, l = this.children.length;
-
-	for ( i = 0; i < l; i ++ ) {
-
-		this.children[ i ].update( this.skinMatrix, forceUpdate );
-
-	}
-
-};
-
-/**
- * @author mikael emtinger / http://gomo.se/
- */
-
-THREE.Sprite = function ( parameters ) {
-
-	THREE.Object3D.call( this );
-
-	this.color = ( parameters.color !== undefined ) ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-	this.map = ( parameters.map !== undefined ) ? parameters.map : new THREE.Texture();
-
-	this.blending = ( parameters.blending !== undefined ) ? parameters.blending : THREE.NormalBlending;
-
-	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
-	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
-	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
-
-	this.useScreenCoordinates = ( parameters.useScreenCoordinates !== undefined ) ? parameters.useScreenCoordinates : true;
-	this.mergeWith3D = ( parameters.mergeWith3D !== undefined ) ? parameters.mergeWith3D : !this.useScreenCoordinates;
-	this.affectedByDistance = ( parameters.affectedByDistance !== undefined ) ? parameters.affectedByDistance : !this.useScreenCoordinates;
-	this.scaleByViewport = ( parameters.scaleByViewport !== undefined ) ? parameters.scaleByViewport : !this.affectedByDistance;
-	this.alignment = ( parameters.alignment instanceof THREE.Vector2 ) ? parameters.alignment : THREE.SpriteAlignment.center;
-
-	this.rotation3d = this.rotation;
-	this.rotation = 0;
-	this.opacity = 1;
-
-	this.uvOffset = new THREE.Vector2( 0, 0 );
-	this.uvScale  = new THREE.Vector2( 1, 1 );
-
-};
-
-THREE.Sprite.prototype = new THREE.Object3D();
-THREE.Sprite.prototype.constructor = THREE.Sprite;
-
-
-/*
- * Custom update matrix
- */
-
-THREE.Sprite.prototype.updateMatrix = function () {
-
-	this.matrix.setPosition( this.position );
-
-	this.rotation3d.set( 0, 0, this.rotation );
-	this.matrix.setRotationFromEuler( this.rotation3d );
-
-	if ( this.scale.x !== 1 || this.scale.y !== 1 ) {
-
-		this.matrix.scale( this.scale );
-		this.boundRadiusScale = Math.max( this.scale.x, this.scale.y );
-
-	}
-
-	this.matrixWorldNeedsUpdate = true;
-
-};
-
-/*
- * Alignment
- */
-
-THREE.SpriteAlignment = {};
-THREE.SpriteAlignment.topLeft = new THREE.Vector2( 1, -1 );
-THREE.SpriteAlignment.topCenter = new THREE.Vector2( 0, -1 );
-THREE.SpriteAlignment.topRight = new THREE.Vector2( -1, -1 );
-THREE.SpriteAlignment.centerLeft = new THREE.Vector2( 1, 0 );
-THREE.SpriteAlignment.center = new THREE.Vector2( 0, 0 );
-THREE.SpriteAlignment.centerRight = new THREE.Vector2( -1, 0 );
-THREE.SpriteAlignment.bottomLeft = new THREE.Vector2( 1, 1 );
-THREE.SpriteAlignment.bottomCenter = new THREE.Vector2( 0, 1 );
-THREE.SpriteAlignment.bottomRight = new THREE.Vector2( -1, 1 );
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Scene = function () {
-
-	THREE.Object3D.call( this );
-
-	this.fog = null;
-	this.overrideMaterial = null;
-
-	this.matrixAutoUpdate = false;
-
-	this.__objects = [];
-	this.__lights = [];
-
-	this.__objectsAdded = [];
-	this.__objectsRemoved = [];
-
-};
-
-THREE.Scene.prototype = new THREE.Object3D();
-THREE.Scene.prototype.constructor = THREE.Scene;
-
-THREE.Scene.prototype.__addObject = function ( object ) {
-
-	if ( object instanceof THREE.Light ) {
-
-		if ( this.__lights.indexOf( object ) === - 1 ) {
-
-			this.__lights.push( object );
-
-		}
-
-	} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
-
-		if ( this.__objects.indexOf( object ) === - 1 ) {
-
-			this.__objects.push( object );
-			this.__objectsAdded.push( object );
-
-			// check if previously removed
-
-			var i = this.__objectsRemoved.indexOf( object );
-
-			if ( i !== -1 ) {
-
-				this.__objectsRemoved.splice( i, 1 );
-
-			}
-
-		}
-
-	}
-
-	for ( var c = 0; c < object.children.length; c ++ ) {
-
-		this.__addObject( object.children[ c ] );
-
-	}
-
-};
-
-THREE.Scene.prototype.__removeObject = function ( object ) {
-
-	if ( object instanceof THREE.Light ) {
-
-		var i = this.__lights.indexOf( object );
-
-		if ( i !== -1 ) {
-
-			this.__lights.splice( i, 1 );
-
-		}
-
-	} else if ( !( object instanceof THREE.Camera ) ) {
-
-		var i = this.__objects.indexOf( object );
-
-		if( i !== -1 ) {
-
-			this.__objects.splice( i, 1 );
-			this.__objectsRemoved.push( object );
-
-			// check if previously added
-
-			var ai = this.__objectsAdded.indexOf( object );
-
-			if ( ai !== -1 ) {
-
-				this.__objectsAdded.splice( ai, 1 );
-
-			}
-
-		}
-
-	}
-
-	for ( var c = 0; c < object.children.length; c ++ ) {
-
-		this.__removeObject( object.children[ c ] );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.DOMRenderer = function () {
-
-	console.log( 'THREE.DOMRenderer', THREE.REVISION );
-
-	var _renderData, _elements,
-	_width, _height, _widthHalf, _heightHalf, _transformProp,
-	_projector = new THREE.Projector();
-
-	var getSupportedProp = function ( proparray ) {
-
-		var root = document.documentElement
-
-		for ( var i = 0; i < proparray.length; i ++ ) {
-
-			if ( typeof root.style[ proparray[ i ] ] === "string" ) {
-
-				return proparray[i];
-
-			}
-
-		}
-
-		return null;
-
-	};
-
-	_transformProp = getSupportedProp( [ 'transform', 'MozTransform', 'WebkitTransform', 'msTransform', 'OTransform' ] );
-
-	this.domElement = document.createElement( 'div' );
-
-	this.setSize = function ( width, height ) {
-
-		_width = width;
-		_height = height;
-
-		_widthHalf = _width / 2;
-		_heightHalf = _height / 2;
-
-	};
-
-	this.render = function ( scene, camera ) {
-
-		var e, el, m, ml, element, material, dom, v1x, v1y;
-
-		_renderData = _projector.projectScene( scene, camera );
-		_elements = _renderData.elements;
-
-		for ( e = 0, el = _elements.length; e < el; e ++ ) {
-
-			element = _elements[ e ];
-
-			if ( element instanceof THREE.RenderableParticle && element.material instanceof THREE.ParticleDOMMaterial ) {
-
-				dom = element.material.domElement;
-
-				v1x = element.x * _widthHalf + _widthHalf - ( dom.offsetWidth >> 1 );
-				v1y = element.y * _heightHalf + _heightHalf - ( dom.offsetHeight >> 1 );
-
-				dom.style.left = v1x + 'px';
-				dom.style.top = v1y + 'px';
-				dom.style.zIndex = Math.abs( Math.floor( ( 1 - element.z ) * camera.far / camera.near ) )
-
-				if ( _transformProp ) {
-
-					var scaleX = element.scale.x * _widthHalf;
-					var scaleY = element.scale.y * _heightHalf;
-					var scaleVal = "scale(" + scaleX + "," + scaleY + ")";
-
-					dom.style[ _transformProp ] = scaleVal;
-
-				}
-
-			}
-
-		}
-
-	};
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableParticle = function () {
-
-	this.x = null;
-	this.y = null;
-	this.z = null;
-
-	this.rotation = null;
-	this.scale = new THREE.Vector2();
-
-	this.material = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableVertex = function () {
-
-	this.positionWorld = new THREE.Vector3();
-	this.positionScreen = new THREE.Vector4();
-
-	this.visible = true;
-
-};
-
-THREE.RenderableVertex.prototype.copy = function ( vertex ) {
-
-	this.positionWorld.copy( vertex.positionWorld );
-	this.positionScreen.copy( vertex.positionScreen );
-
-}
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableFace3 = function () {
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-	this.v3 = new THREE.RenderableVertex();
-
-	this.centroidWorld = new THREE.Vector3();
-	this.centroidScreen = new THREE.Vector3();
-
-	this.normalWorld = new THREE.Vector3();
-	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-	this.material = null;
-	this.faceMaterial = null;
-	this.uvs = [[]];
-
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableFace4 = function () {
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-	this.v3 = new THREE.RenderableVertex();
-	this.v4 = new THREE.RenderableVertex();
-
-	this.centroidWorld = new THREE.Vector3();
-	this.centroidScreen = new THREE.Vector3();
-
-	this.normalWorld = new THREE.Vector3();
-	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-	this.material = null;
-	this.faceMaterial = null;
-	this.uvs = [[]];
-
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableObject = function () {
-
-	this.object = null;
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableParticle = function () {
-
-	this.x = null;
-	this.y = null;
-	this.z = null;
-
-	this.rotation = null;
-	this.scale = new THREE.Vector2();
-
-	this.material = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableLine = function () {
-
-	this.z = null;
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-
-	this.material = null;
-
-};
-=======
-// ThreeDOM.js - http://github.com/mrdoob/three.js
-'use strict';var THREE=THREE||{REVISION:"49dev"};self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array);
-(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c){window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
-function(a){clearTimeout(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));switch(d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c;this.g=b;this.b=a}}return this},setHex:function(a){a=
-Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},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)}};
-THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
-this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
-THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
-a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
-this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
-setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,i=a.elements[9]/e,k=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-i/e,k/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
-this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
-this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};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,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],i=d[5],k=d[6],j=d[7],h=d[8],m=d[9],l=d[10],n=d[11],p=d[12],o=d[13],q=d[14],d=d[15];c[0].set(f-a,j-g,n-h,d-p);c[1].set(f+a,j+g,n+h,d+p);c[2].set(f+b,j+i,n+m,d+o);c[3].set(f-b,j-i,n-m,d-o);c[4].set(f-e,j-k,n-l,d-q);c[5].set(f+e,j+k,n+l,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
-THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);r=p.dot(b);x=o.add(a,q.copy(b).multiplyScalar(r));return D=c.distanceTo(x)}function d(a,b,c,d){p.sub(d,b);o.sub(c,b);q.sub(a,b);E=p.dot(p);s=p.dot(o);y=p.dot(q);t=o.dot(o);z=o.dot(q);H=1/(E*t-s*s);K=(t*y-s*z)*H;F=(E*z-s*y)*H;return K>=0&&F>=0&&K+F<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,
-j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,p=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};p.push(b)}else if(a instanceof THREE.Mesh){var o=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return p;var r,s,t=a.geometry,B=t.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(q=t.faces.length;o<q;o++){b=t.faces[o];j.copy(this.origin);h.copy(this.direction);v=a.matrixWorld;m=v.multiplyVector3(m.copy(b.centroid)).subSelf(j);l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal));r=h.dot(l);if(!(Math.abs(r)<e)){s=l.dot(m)/r;if(!(s<0)&&(a.doubleSided||(a.flipSided?
-r>0:r<0))){n.add(j,h.multiplyScalar(s));if(b instanceof THREE.Face3){f=v.multiplyVector3(f.copy(B[b.a]));g=v.multiplyVector3(g.copy(B[b.b]));i=v.multiplyVector3(i.copy(B[b.c]));if(d(n,f,g,i)){b={distance:j.distanceTo(n),point:n.clone(),face:b,object:a};p.push(b)}}else if(b instanceof THREE.Face4){f=v.multiplyVector3(f.copy(B[b.a]));g=v.multiplyVector3(g.copy(B[b.b]));i=v.multiplyVector3(i.copy(B[b.c]));k=v.multiplyVector3(k.copy(B[b.d]));if(d(n,f,g,k)||d(n,g,i,k)){b={distance:j.distanceTo(n),point:n.clone(),
-face:b,object:a};p.push(b)}}}}}}return p};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,r,x,D,E,s,y,t,z,H,K,F};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,h,m){i=false;b=f;c=g;d=h;e=m;a()};this.addPoint=function(f,g){if(i){i=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
-e:g}a()};this.add3Points=function(f,g,h,m,l,n){if(i){i=false;b=f<h?f<l?f:l:h<l?h:l;c=g<m?g<n?g:n:m<n?m:n;d=f>h?f>l?f:l:h>l?h:l;e=g>m?g>n?g:n:m>n?m:n}else{b=f<h?f<l?f<b?f:b:l<b?l:b:h<l?h<b?h:b:l<b?l:b;c=g<m?g<n?g<c?g:c:n<c?n:c:m<n?m<c?m:c:n<c?n:c;d=f>h?f>l?f>d?f:d:l>d?l:d:h>l?h>d?h:d:l>d?l:d;e=g>m?g>n?g>e?g:e:n>e?n:e:m>n?m>e?m:e:n>e?n:e}a()};this.addRectangle=function(f){if(i){i=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
-d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
-THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],i=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*i;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*e;h[4]=b*f;h[5]=b*g;h[6]=b*i;h[7]=b*k;h[8]=b*j;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,i,k,j,h,m,l,n,p,o){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,i||0,k||0,j||0,h!==void 0?h:1,m||0,l||0,n||0,p||0,o!==void 0?o:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,k,j,h,m,l,n,p,o){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=i;q[2]=k;q[6]=j;q[10]=h;q[14]=m;q[3]=l;q[7]=n;q[11]=p;q[15]=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],i=c[8],k=c[12],j=c[1],h=c[5],m=c[9],l=c[13],n=c[2],p=c[6],o=c[10],q=c[14],r=c[3],x=c[7],D=c[11],c=c[15],E=d[0],s=d[4],
-y=d[8],t=d[12],z=d[1],H=d[5],K=d[9],F=d[13],J=d[2],P=d[6],Q=d[10],R=d[14],S=d[3],T=d[7],L=d[11],d=d[15];e[0]=f*E+g*z+i*J+k*S;e[4]=f*s+g*H+i*P+k*T;e[8]=f*y+g*K+i*Q+k*L;e[12]=f*t+g*F+i*R+k*d;e[1]=j*E+h*z+m*J+l*S;e[5]=j*s+h*H+m*P+l*T;e[9]=j*y+h*K+m*Q+l*L;e[13]=j*t+h*F+m*R+l*d;e[2]=n*E+p*z+o*J+q*S;e[6]=n*s+p*H+o*P+q*T;e[10]=n*y+p*K+o*Q+q*L;e[14]=n*t+p*F+o*R+q*d;e[3]=r*E+x*z+D*J+c*S;e[7]=r*s+x*H+D*P+c*T;e[11]=r*y+x*K+D*Q+c*L;e[15]=r*t+x*F+D*R+c*d;return this},multiplySelf:function(a){return this.multiply(this,
-a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
-b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],i=a[9],k=a[13],j=a[2],h=a[6],m=a[10],l=a[14],n=a[3],p=a[7],
-o=a[11],a=a[15];return e*i*h*n-d*k*h*n-e*g*m*n+c*k*m*n+d*g*l*n-c*i*l*n-e*i*j*p+d*k*j*p+e*f*m*p-b*k*m*p-d*f*l*p+b*i*l*p+e*g*j*o-c*k*j*o-e*f*h*o+b*k*h*o+c*f*l*o-b*g*l*o-d*g*j*a+c*i*j*a+d*f*h*a-b*i*h*a-c*f*m*a+b*g*m*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
-a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],i=c[1],k=c[5],j=c[9],h=c[13],m=c[2],l=c[6],n=c[10],p=
-c[14],o=c[3],q=c[7],r=c[11],c=c[15];b[0]=j*p*q-h*n*q+h*l*r-k*p*r-j*l*c+k*n*c;b[4]=g*n*q-f*p*q-g*l*r+e*p*r+f*l*c-e*n*c;b[8]=f*h*q-g*j*q+g*k*r-e*h*r-f*k*c+e*j*c;b[12]=g*j*l-f*h*l-g*k*n+e*h*n+f*k*p-e*j*p;b[1]=h*n*o-j*p*o-h*m*r+i*p*r+j*m*c-i*n*c;b[5]=f*p*o-g*n*o+g*m*r-d*p*r-f*m*c+d*n*c;b[9]=g*j*o-f*h*o-g*i*r+d*h*r+f*i*c-d*j*c;b[13]=f*h*m-g*j*m+g*i*n-d*h*n-f*i*p+d*j*p;b[2]=k*p*o-h*l*o+h*m*q-i*p*q-k*m*c+i*l*c;b[6]=g*l*o-e*p*o-g*m*q+d*p*q+e*m*c-d*l*c;b[10]=e*h*o-g*k*o+g*i*q-d*h*q-e*i*c+d*k*c;b[14]=g*k*m-
-e*h*m-g*i*l+d*h*l+e*i*p-d*k*p;b[3]=j*l*o-k*n*o-j*m*q+i*n*q+k*m*r-i*l*r;b[7]=e*n*o-f*l*o+f*m*q-d*n*q-e*m*r+d*l*r;b[11]=f*k*o-e*j*o-f*i*q+d*j*q+e*i*r-d*k*r;b[15]=e*j*m-f*k*m+f*i*l-d*j*l-e*i*n+d*k*n;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var j=i*k,h=i*f,m=e*k,l=e*f;c[0]=j+l*d;c[4]=m*d-h;c[8]=g*e;c[1]=g*f;c[5]=g*
-k;c[9]=-d;c[2]=h*d-m;c[6]=l+j*d;c[10]=g*i;break;case "ZXY":j=i*k;h=i*f;m=e*k;l=e*f;c[0]=j-l*d;c[4]=-g*f;c[8]=m+h*d;c[1]=h+m*d;c[5]=g*k;c[9]=l-j*d;c[2]=-g*e;c[6]=d;c[10]=g*i;break;case "ZYX":j=g*k;h=g*f;m=d*k;l=d*f;c[0]=i*k;c[4]=m*e-h;c[8]=j*e+l;c[1]=i*f;c[5]=l*e+j;c[9]=h*e-m;c[2]=-e;c[6]=d*i;c[10]=g*i;break;case "YZX":j=g*i;h=g*e;m=d*i;l=d*e;c[0]=i*k;c[4]=l-j*f;c[8]=m*f+h;c[1]=f;c[5]=g*k;c[9]=-d*k;c[2]=-e*k;c[6]=h*f+m;c[10]=j-l*f;break;case "XZY":j=g*i;h=g*e;m=d*i;l=d*e;c[0]=i*k;c[4]=-f;c[8]=e*k;
-c[1]=j*f+l;c[5]=g*k;c[9]=h*f-m;c[2]=m*f-h;c[6]=d*k;c[10]=l*f+j;break;default:j=g*k;h=g*f;m=d*k;l=d*f;c[0]=i*k;c[4]=-i*f;c[8]=e;c[1]=h+m*e;c[5]=j-l*e;c[9]=-d*i;c[2]=l-j*e;c[6]=m+h*e;c[10]=g*i}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,i=d+d,k=e+e,a=c*g,j=c*i,c=c*k,h=d*i,d=d*k,e=e*k,g=f*g,i=f*i,f=f*k;b[0]=1-(h+e);b[4]=j-f;b[8]=c+i;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-i;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
-c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
-b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],i=b[9],k=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*i;b[6]=h*e+a*k;b[7]=h*f+a*j;b[8]=h*g-a*c;b[9]=h*i-a*d;b[10]=h*k-a*e;b[11]=h*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],i=b[9],k=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*i;b[2]=h*e-a*k;b[3]=h*f-a*j;b[8]=h*g+a*c;b[9]=
-h*i+a*d;b[10]=h*k+a*e;b[11]=h*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],j=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*i;b[2]=h*e+a*k;b[3]=h*f+a*j;b[4]=h*g-a*c;b[5]=h*i-a*d;b[6]=h*k-a*e;b[7]=h*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,i=e*e,k=f*f,j=Math.cos(b),h=Math.sin(b),m=1-j,l=d*e*m,n=d*f*m,m=e*f*m,d=d*h,p=e*h,h=f*h,f=g+(1-g)*j,g=l+h,e=n-p,l=l-h,i=i+(1-i)*j,h=m+d,n=n+p,m=m-d,k=k+(1-k)*j,j=c[0],d=c[1],p=c[2],o=c[3],q=c[4],r=c[5],x=c[6],D=c[7],E=c[8],s=c[9],y=c[10],t=c[11];c[0]=f*j+g*q+e*E;c[1]=f*d+g*r+e*s;c[2]=f*p+g*x+e*y;c[3]=f*o+g*D+e*t;c[4]=l*j+i*q+h*E;c[5]=l*d+i*r+h*s;c[6]=l*p+i*x+h*y;c[7]=l*o+i*D+h*t;c[8]=n*j+m*q+k*E;c[9]=n*d+m*r+k*s;c[10]=n*p+m*x+k*y;c[11]=
-n*o+m*D+k*t;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,k=e*f,j=e*g;this.set(k*f+c,k*g-d*i,k*i+d*g,0,k*g+d*i,j*g+c,j*i-d*f,0,k*i-
-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
-b,c,d,e,f){var g=this.elements,i=b-a,k=c-d,j=f-e;g[0]=2/i;g[4]=0;g[8]=0;g[12]=-((b+a)/i);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
-THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
-this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},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?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&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?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)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],i,k,j=[],h,m,l=[],n,p=[],o,q,r=[],x,D,E=[],s={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,t=new THREE.Vector4,z=new THREE.Matrix4,H=new THREE.Matrix4,K=new THREE.Frustum,F=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||K.contains(b))){y.copy(b.matrixWorld.getPosition());
-z.multiplyVector3(y);e=a();e.object=b;e.z=y.z;s.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){y.copy(b.matrixWorld.getPosition());z.multiplyVector3(y);e=a();e.object=b;e.z=y.z;s.sprites.push(e)}else b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,y=e.far,L=false,U,B,v,I,u,C,A,G,w,M,N,V,W,X,O;D=q=n=m=0;s.elements.length=0;if(e.parent===
-void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);K.setFromMatrix(z);s=this.projectGraph(a,false);a=0;for(U=s.objects.length;a<U;a++){w=s.objects[a].object;M=w.matrixWorld;k=0;if(w instanceof THREE.Mesh){N=w.geometry;V=w.geometry.materials;I=N.vertices;W=N.faces;X=N.faceVertexUvs;N=w.matrixRotationWorld.extractRotation(M);B=0;for(v=I.length;B<
-v;B++){i=b();i.positionWorld.copy(I[B]);M.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);z.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<y}I=0;for(B=W.length;I<B;I++){v=W[I];if(v instanceof THREE.Face3){u=j[v.a];C=j[v.b];A=j[v.c];if(u.visible&&C.visible&&A.visible){L=(A.positionScreen.x-u.positionScreen.x)*(C.positionScreen.y-
-u.positionScreen.y)-(A.positionScreen.y-u.positionScreen.y)*(C.positionScreen.x-u.positionScreen.x)<0;if(w.doubleSided||L!=w.flipSided){G=l[m]=l[m]||new THREE.RenderableFace3;m++;h=G;h.v1.copy(u);h.v2.copy(C);h.v3.copy(A)}else continue}else continue}else if(v instanceof THREE.Face4){u=j[v.a];C=j[v.b];A=j[v.c];G=j[v.d];if(u.visible&&C.visible&&A.visible&&G.visible){L=(G.positionScreen.x-u.positionScreen.x)*(C.positionScreen.y-u.positionScreen.y)-(G.positionScreen.y-u.positionScreen.y)*(C.positionScreen.x-
-u.positionScreen.x)<0||(C.positionScreen.x-A.positionScreen.x)*(G.positionScreen.y-A.positionScreen.y)-(C.positionScreen.y-A.positionScreen.y)*(G.positionScreen.x-A.positionScreen.x)<0;if(w.doubleSided||L!=w.flipSided){O=p[n]=p[n]||new THREE.RenderableFace4;n++;h=O;h.v1.copy(u);h.v2.copy(C);h.v3.copy(A);h.v4.copy(G)}else continue}else continue}h.normalWorld.copy(v.normal);!L&&(w.flipSided||w.doubleSided)&&h.normalWorld.negate();N.multiplyVector3(h.normalWorld);h.centroidWorld.copy(v.centroid);M.multiplyVector3(h.centroidWorld);
-h.centroidScreen.copy(h.centroidWorld);z.multiplyVector3(h.centroidScreen);A=v.vertexNormals;u=0;for(C=A.length;u<C;u++){G=h.vertexNormalsWorld[u];G.copy(A[u]);!L&&(w.flipSided||w.doubleSided)&&G.negate();N.multiplyVector3(G)}u=0;for(C=X.length;u<C;u++)if(O=X[u][I]){A=0;for(G=O.length;A<G;A++)h.uvs[u][A]=O[A]}h.material=w.material;h.faceMaterial=v.materialIndex!==null?V[v.materialIndex]:null;h.z=h.centroidScreen.z;s.elements.push(h)}}else if(w instanceof THREE.Line){H.multiply(z,M);I=w.geometry.vertices;
-u=b();u.positionScreen.copy(I[0]);H.multiplyVector4(u.positionScreen);M=w.type===THREE.LinePieces?2:1;B=1;for(v=I.length;B<v;B++){u=b();u.positionScreen.copy(I[B]);H.multiplyVector4(u.positionScreen);if(!((B+1)%M>0)){C=j[k-2];F.copy(u.positionScreen);J.copy(C.positionScreen);if(d(F,J)){F.multiplyScalar(1/F.w);J.multiplyScalar(1/J.w);V=r[q]=r[q]||new THREE.RenderableLine;q++;o=V;o.v1.positionScreen.copy(F);o.v2.positionScreen.copy(J);o.z=Math.max(F.z,J.z);o.material=w.material;s.elements.push(o)}}}}}a=
-0;for(U=s.sprites.length;a<U;a++){w=s.sprites[a].object;M=w.matrixWorld;if(w instanceof THREE.Particle){t.set(M.elements[12],M.elements[13],M.elements[14],1);z.multiplyVector4(t);t.z=t.z/t.w;if(t.z>0&&t.z<1){g=E[D]=E[D]||new THREE.RenderableParticle;D++;x=g;x.x=t.x/t.w;x.y=t.y/t.w;x.z=t.z;x.rotation=w.rotation.z;x.scale.x=w.scale.x*Math.abs(x.x-(t.x+e.projectionMatrix.elements[0])/(t.w+e.projectionMatrix.elements[12]));x.scale.y=w.scale.y*Math.abs(x.y-(t.y+e.projectionMatrix.elements[5])/(t.w+e.projectionMatrix.elements[13]));
-x.material=w.material;s.elements.push(x)}}}f&&s.elements.sort(c);return s}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
-this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
-Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=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,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=
-c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,k=this.w,j=k*c+g*e-i*d,h=k*d+i*c-f*e,m=k*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=j*k+c*-f+h*-i-m*-g;b.y=h*k+c*-g+m*-f-j*-i;b.z=m*k+c*-i+j*-g-h*-f;return b},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 f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
-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};
-THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
-THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};
-THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;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=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;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,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
-a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=i.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var i=this,k="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?k="MeshPhongMaterial":h==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){k=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=j.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(j.map){h.tDiffuse.texture=j.map;h.enableDiffuse.value=true}if(j.specularMap){h.tSpecular.texture=j.specularMap;h.enableSpecular.value=true}if(j.lightMap){h.tAO.texture=j.lightMap;
-h.enableAO.value=true}h.uDiffuseColor.value.setHex(j.color);h.uSpecularColor.value.setHex(j.specular);h.uAmbientColor.value.setHex(j.ambient);h.uShininess.value=j.shininess;if(j.opacity!==void 0)h.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else j=new THREE[k](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
-a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;
-THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;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.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
-THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
-true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
-void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
-THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.ParticleBasicMaterial.prototype=new THREE.Material;
-THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
-THREE.Texture=function(a,b,c,d,e,f,g,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=i!==void 0?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
-THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,i,k,j){THREE.Texture.call(this,null,f,g,i,k,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
-THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
-THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};
-THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=a.useScreenCoordinates!==
-void 0?a.useScreenCoordinates:true;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=
-new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=true};THREE.SpriteAlignment={};
-THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);
-THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,i=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var h,m,l,n,p,o;a=i.projectScene(c,d);b=a.elements;h=0;for(m=
-b.length;h<m;h++){l=b[h];if(l instanceof THREE.RenderableParticle&&l.material instanceof THREE.ParticleDOMMaterial){n=l.material.domElement;p=l.x*e+e-(n.offsetWidth>>1);o=l.y*f+f-(n.offsetHeight>>1);n.style.left=p+"px";n.style.top=o+"px";n.style.zIndex=Math.abs(Math.floor((1-l.z)*d.far/d.near));g&&(n.style[g]="scale("+l.scale.x*e+","+l.scale.y*f+")")}}}};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};
-THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
-THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
->>>>>>> dev

+ 0 - 6537
build/custom/ThreeSVG.js

@@ -1,6537 +0,0 @@
-<<<<<<< HEAD
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-var THREE = THREE || { REVISION: '49dev' };
-
-if ( ! self.Int32Array ) {
-
-	self.Int32Array = Array;
-	self.Float32Array = Array;
-
-}
-
-// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
-// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
-
-// requestAnimationFrame polyfill by Erik Möller
-// fixes from Paul Irish and Tino Zijdel
-
-( function () {
-
-	var lastTime = 0;
-	var vendors = [ 'ms', 'moz', 'webkit', 'o' ];
-
-	for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++ x ) {
-
-		window.requestAnimationFrame = window[ vendors[ x ] + 'RequestAnimationFrame' ];
-		window.cancelAnimationFrame = window[ vendors[ x ] + 'CancelAnimationFrame' ] || window[ vendors[ x ] + 'CancelRequestAnimationFrame' ];
-
-	}
-
-	if ( !window.requestAnimationFrame ) {
-
-		window.requestAnimationFrame = function ( callback, element ) {
-
-			var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );
-			var id = window.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall );
-			lastTime = currTime + timeToCall;
-			return id;
-
-		};
-
-	}
-
-
-	if ( !window.cancelAnimationFrame ) {
-
-		window.cancelAnimationFrame = function ( id ) { clearTimeout( id ); };
-
-	}
-
-}() );
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Color = function ( hex ) {
-
-	if ( hex !== undefined ) this.setHex( hex );
-	return this;
-
-};
-
-THREE.Color.prototype = {
-
-	constructor: THREE.Color,
-
-	r: 1, g: 1, b: 1,
-
-	copy: function ( color ) {
-
-		this.r = color.r;
-		this.g = color.g;
-		this.b = color.b;
-
-		return this;
-
-	},
-
-	copyGammaToLinear: function ( color ) {
-
-		this.r = color.r * color.r;
-		this.g = color.g * color.g;
-		this.b = color.b * color.b;
-
-		return this;
-
-	},
-
-	copyLinearToGamma: function ( color ) {
-
-		this.r = Math.sqrt( color.r );
-		this.g = Math.sqrt( color.g );
-		this.b = Math.sqrt( color.b );
-
-		return this;
-
-	},
-
-	convertGammaToLinear: function () {
-
-		var r = this.r, g = this.g, b = this.b;
-
-		this.r = r * r;
-		this.g = g * g;
-		this.b = b * b;
-
-		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 ( r, g, b ) {
-
-		this.r = r;
-		this.g = g;
-		this.b = b;
-
-		return this;
-
-	},
-
-	setHSV: function ( h, s, v ) {
-
-		// based on MochiKit implementation by Bob Ippolito
-		// h,s,v ranges are < 0.0 - 1.0 >
-
-		var i, f, p, q, t;
-
-		if ( v === 0 ) {
-
-			this.r = this.g = this.b = 0;
-
-		} else {
-
-			i = Math.floor( h * 6 );
-			f = ( h * 6 ) - i;
-			p = v * ( 1 - s );
-			q = v * ( 1 - ( s * f ) );
-			t = v * ( 1 - ( s * ( 1 - f ) ) );
-
-			switch ( i ) {
-
-				case 1: this.r = q; this.g = v; this.b = p; break;
-				case 2: this.r = p; this.g = v; this.b = t; break;
-				case 3: this.r = p; this.g = q; this.b = v; break;
-				case 4: this.r = t; this.g = p; this.b = v; break;
-				case 5: this.r = v; this.g = p; this.b = q; break;
-				case 6: // fall through
-				case 0: this.r = v; this.g = t; this.b = p; break;
-
-			}
-
-		}
-
-		return this;
-
-	},
-
-	setHex: function ( hex ) {
-
-		hex = Math.floor( hex );
-
-		this.r = ( hex >> 16 & 255 ) / 255;
-		this.g = ( hex >> 8 & 255 ) / 255;
-		this.b = ( hex & 255 ) / 255;
-
-		return this;
-
-	},
-
-	lerpSelf: function ( color, alpha ) {
-
-		this.r += ( color.r - this.r ) * alpha;
-		this.g += ( color.g - this.g ) * alpha;
-		this.b += ( color.b - this.b ) * alpha;
-
-		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 );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author philogb / http://blog.thejit.org/
- * @author egraether / http://egraether.com/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- */
-
-THREE.Vector2 = function ( x, y ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-
-};
-
-THREE.Vector2.prototype = {
-
-	constructor: THREE.Vector2,
-
-	set: function ( x, y ) {
-
-		this.x = x;
-		this.y = y;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-
-		} else {
-
-			this.set( 0, 0 );
-
-		}
-
-		return this;
-
-	},
-
-	negate: function() {
-
-		return this.multiplyScalar( - 1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y;
-
-	},
-
-	lengthSq: function () {
-
-		return this.x * this.x + this.y * this.y;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	distanceTo: function ( v ) {
-
-		return Math.sqrt( this.distanceToSquared( v ) );
-
-	},
-
-	distanceToSquared: function ( v ) {
-
-		var dx = this.x - v.x, dy = this.y - v.y;
-		return dx * dx + dy * dy;
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-
-		return this;
-
-	},
-
-	equals: function( v ) {
-
-		return ( ( v.x === this.x ) && ( v.y === this.y ) );
-
-	},
-
-	isZero: function () {
-
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector2( this.x, this.y );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author kile / http://kile.stravaganza.org/
- * @author philogb / http://blog.thejit.org/
- * @author mikael emtinger / http://gomo.se/
- * @author egraether / http://egraether.com/
- */
-
-THREE.Vector3 = function ( x, y, z ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-
-};
-
-
-THREE.Vector3.prototype = {
-
-	constructor: THREE.Vector3,
-
-	set: function ( x, y, z ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-
-		return this;
-
-	},
-
-	setX: function ( x ) {
-
-		this.x = x;
-
-		return this;
-
-	},
-
-	setY: function ( y ) {
-
-		this.y = y;
-
-		return this;
-
-	},
-
-	setZ: function ( z ) {
-
-		this.z = z;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-		this.z = v.z;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-		this.z = a.z + b.z;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-		this.z += v.z;
-
-		return this;
-
-	},
-
-	addScalar: function ( s ) {
-
-		this.x += s;
-		this.y += s;
-		this.z += s;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-		this.z = a.z - b.z;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-		this.z -= v.z;
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-
-		this.x = a.x * b.x;
-		this.y = a.y * b.y;
-		this.z = a.z * b.z;
-
-		return this;
-
-	},
-
-	multiplySelf: function ( v ) {
-
-		this.x *= v.x;
-		this.y *= v.y;
-		this.z *= v.z;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-		this.z *= s;
-
-		return this;
-
-	},
-
-	divideSelf: function ( v ) {
-
-		this.x /= v.x;
-		this.y /= v.y;
-		this.z /= v.z;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-			this.z /= s;
-
-		} else {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-
-		}
-
-		return this;
-
-	},
-
-
-	negate: function() {
-
-		return this.multiplyScalar( - 1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y + this.z * v.z;
-
-	},
-
-	lengthSq: function () {
-
-		return this.x * this.x + this.y * this.y + this.z * this.z;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	lengthManhattan: function () {
-
-		return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-		this.z += ( v.z - this.z ) * alpha;
-
-		return this;
-
-	},
-
-	cross: function ( a, b ) {
-
-		this.x = a.y * b.z - a.z * b.y;
-		this.y = a.z * b.x - a.x * b.z;
-		this.z = a.x * b.y - a.y * b.x;
-
-		return this;
-
-	},
-
-	crossSelf: function ( v ) {
-
-		var x = this.x, y = this.y, z = this.z;
-
-		this.x = y * v.z - z * v.y;
-		this.y = z * v.x - x * v.z;
-		this.z = x * v.y - y * v.x;
-
-		return this;
-
-	},
-
-	distanceTo: function ( v ) {
-
-		return Math.sqrt( this.distanceToSquared( v ) );
-
-	},
-
-	distanceToSquared: function ( v ) {
-
-		return new THREE.Vector3().sub( this, v ).lengthSq();
-
-	},
-
-	getPositionFromMatrix: function ( m ) {
-
-		this.x = m.elements[12];
-		this.y = m.elements[13];
-		this.z = m.elements[14];
-
-		return this;
-
-	},
-
-	getRotationFromMatrix: function ( m, scale ) {
-
-		var sx = scale ? scale.x : 1;
-		var sy = scale ? scale.y : 1;
-		var sz = scale ? scale.z : 1;
-
-		var m11 = m.elements[0] / sx, m12 = m.elements[4] / sy, m13 = m.elements[8] / sz;
-		var m21 = m.elements[1] / sx, m22 = m.elements[5] / sy, m23 = m.elements[9] / sz;
-		var m33 = m.elements[10] / sz;
-
-		this.y = Math.asin( m13 );
-
-		var cosY = Math.cos( this.y );
-
-		if ( Math.abs( cosY ) > 0.00001 ) {
-
-			this.x = Math.atan2( - m23 / cosY, m33 / cosY );
-			this.z = Math.atan2( - m12 / cosY, m11 / cosY );
-
-		} else {
-
-			this.x = 0;
-			this.z = Math.atan2( m21, m22 );
-
-		}
-
-		return this;
-
-	},
-
-	/*
-
-	// from http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
-	// order XYZ
-
-	getEulerXYZFromQuaternion: function ( q ) {
-
-		this.x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z ) );
-		this.y = Math.asin( 2 *  ( q.x * q.z + q.y * q.w ) );
-		this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z ) );
-
-	},
-
-	// from http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
-	// order YZX (assuming heading == y, attitude == z, bank == x)
-
-	getEulerYZXFromQuaternion: function ( q ) {
-
-		var sqw = q.w * q.w;
-		var sqx = q.x * q.x;
-		var sqy = q.y * q.y;
-		var sqz = q.z * q.z;
-		var unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor
-		var test = q.x * q.y + q.z * q.w;
-
-		if ( test > 0.499 * unit ) { // singularity at north pole
-
-			this.y = 2 * Math.atan2( q.x, q.w );
-			this.z = Math.PI / 2;
-			this.x = 0;
-
-			return;
-
-		}
-
-		if ( test < -0.499 * unit ) { // singularity at south pole
-
-			this.y = -2 * Math.atan2( q.x, q.w );
-			this.z = -Math.PI / 2;
-			this.x = 0;
-
-			return;
-
-		}
-
-		this.y = Math.atan2( 2 * q.y * q.w - 2 * q.x * q.z, sqx - sqy - sqz + sqw );
-		this.z = Math.asin( 2 * test / unit );
-		this.x = Math.atan2( 2 * q.x * q.w - 2 * q.y * q.z, -sqx + sqy - sqz + sqw );
-
-	},
-
-	*/
-
-	getScaleFromMatrix: function ( m ) {
-
-		var sx = this.set( m.elements[0], m.elements[1], m.elements[2] ).length();
-		var sy = this.set( m.elements[4], m.elements[5], m.elements[6] ).length();
-		var sz = this.set( m.elements[8], m.elements[9], m.elements[10] ).length();
-
-		this.x = sx;
-		this.y = sy;
-		this.z = sz;
-
-	},
-
-	equals: function ( v ) {
-
-		return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
-
-	},
-
-	isZero: function () {
-
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector3( this.x, this.y, this.z );
-
-	}
-
-};
-
-/**
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author philogb / http://blog.thejit.org/
- * @author mikael emtinger / http://gomo.se/
- * @author egraether / http://egraether.com/
- */
-
-THREE.Vector4 = function ( x, y, z, w ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-	this.w = ( w !== undefined ) ? w : 1;
-
-};
-
-THREE.Vector4.prototype = {
-
-	constructor: THREE.Vector4,
-
-	set: function ( x, y, z, w ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-		this.w = w;
-
-		return this;
-
-	},
-
-	copy: function ( v ) {
-
-		this.x = v.x;
-		this.y = v.y;
-		this.z = v.z;
-		this.w = ( v.w !== undefined ) ? v.w : 1;
-
-		return this;
-
-	},
-
-	add: function ( a, b ) {
-
-		this.x = a.x + b.x;
-		this.y = a.y + b.y;
-		this.z = a.z + b.z;
-		this.w = a.w + b.w;
-
-		return this;
-
-	},
-
-	addSelf: function ( v ) {
-
-		this.x += v.x;
-		this.y += v.y;
-		this.z += v.z;
-		this.w += v.w;
-
-		return this;
-
-	},
-
-	sub: function ( a, b ) {
-
-		this.x = a.x - b.x;
-		this.y = a.y - b.y;
-		this.z = a.z - b.z;
-		this.w = a.w - b.w;
-
-		return this;
-
-	},
-
-	subSelf: function ( v ) {
-
-		this.x -= v.x;
-		this.y -= v.y;
-		this.z -= v.z;
-		this.w -= v.w;
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-
-		this.x *= s;
-		this.y *= s;
-		this.z *= s;
-		this.w *= s;
-
-		return this;
-
-	},
-
-	divideScalar: function ( s ) {
-
-		if ( s ) {
-
-			this.x /= s;
-			this.y /= s;
-			this.z /= s;
-			this.w /= s;
-
-		} else {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-			this.w = 1;
-
-		}
-
-		return this;
-
-	},
-
-
-	negate: function() {
-
-		return this.multiplyScalar( -1 );
-
-	},
-
-	dot: function ( v ) {
-
-		return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
-
-	},
-
-	lengthSq: function () {
-
-		return this.dot( this );
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.lengthSq() );
-
-	},
-
-	normalize: function () {
-
-		return this.divideScalar( this.length() );
-
-	},
-
-	setLength: function ( l ) {
-
-		return this.normalize().multiplyScalar( l );
-
-	},
-
-	lerpSelf: function ( v, alpha ) {
-
-		this.x += ( v.x - this.x ) * alpha;
-		this.y += ( v.y - this.y ) * alpha;
-		this.z += ( v.z - this.z ) * alpha;
-		this.w += ( v.w - this.w ) * alpha;
-
-		return this;
-
-	},
-
-	clone: function () {
-
-		return new THREE.Vector4( this.x, this.y, this.z, this.w );
-
-	}
-
-};
-/**
- * @author mrdoob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-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 ( m ) {
-
-	var i, plane, planes = this.planes;
-
-	var me = m.elements;
-	var me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3];
-	var me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7];
-	var me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11];
-	var me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15];
-
-	planes[ 0 ].set( me3 - me0, me7 - me4, me11 - me8, me15 - me12 );
-	planes[ 1 ].set( me3 + me0, me7 + me4, me11 + me8, me15 + me12 );
-	planes[ 2 ].set( me3 + me1, me7 + me5, me11 + me9, me15 + me13 );
-	planes[ 3 ].set( me3 - me1, me7 - me5, me11 - me9, me15 - me13 );
-	planes[ 4 ].set( me3 - me2, me7 - me6, me11 - me10, me15 - me14 );
-	planes[ 5 ].set( me3 + me2, me7 + me6, me11 + me10, me15 + me14 );
-
-	for ( i = 0; i < 6; i ++ ) {
-
-		plane = planes[ i ];
-		plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
-
-	}
-
-};
-
-THREE.Frustum.prototype.contains = function ( object ) {
-
-	var distance,
-	planes = this.planes,
-	matrix = object.matrixWorld,
-	me = matrix.elements,
-	radius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
-
-	for ( var i = 0; i < 6; i ++ ) {
-
-		distance = planes[ i ].x * me[12] + planes[ i ].y * me[13] + planes[ i ].z * me[14] + planes[ i ].w;
-		if ( distance <= radius ) return false;
-
-	}
-
-	return true;
-
-};
-
-THREE.Frustum.__v1 = new THREE.Vector3();
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Ray = function ( origin, direction ) {
-
-	this.origin = origin || new THREE.Vector3();
-	this.direction = direction || new THREE.Vector3();
-
-	var precision = 0.0001;
-
-	this.setPrecision = function ( value ) {
-
-		precision = value;
-
-	};
-
-	var a = new THREE.Vector3();
-	var b = new THREE.Vector3();
-	var c = new THREE.Vector3();
-	var d = new THREE.Vector3();
-
-	var originCopy = new THREE.Vector3();
-	var directionCopy = new THREE.Vector3();
-
-	var vector = new THREE.Vector3();
-	var normal = new THREE.Vector3();
-	var intersectPoint = new THREE.Vector3()
-
-	this.intersectObject = function ( object ) {
-
-		var intersect, intersects = [];
-
-		if ( object instanceof THREE.Particle ) {
-
-			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
-
-			if ( distance > object.scale.x ) {
-
-				return [];
-
-			}
-
-			intersect = {
-
-				distance: distance,
-				point: object.position,
-				face: null,
-				object: object
-
-			};
-
-			intersects.push( intersect );
-
-		} else if ( object instanceof THREE.Mesh ) {
-
-			// Checking boundingSphere
-
-			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
-			var scale = THREE.Frustum.__v1.set( object.matrixWorld.getColumnX().length(), object.matrixWorld.getColumnY().length(), object.matrixWorld.getColumnZ().length() );
-
-			if ( distance > object.geometry.boundingSphere.radius * Math.max( scale.x, Math.max( scale.y, scale.z ) ) ) {
-
-				return intersects;
-
-			}
-
-			// Checking faces
-
-			var f, fl, face, dot, scalar,
-			geometry = object.geometry,
-			vertices = geometry.vertices,
-			objMatrix;
-
-			object.matrixRotationWorld.extractRotation( object.matrixWorld );
-
-			for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
-
-				face = geometry.faces[ f ];
-
-				originCopy.copy( this.origin );
-				directionCopy.copy( this.direction );
-
-				objMatrix = object.matrixWorld;
-
-				// determine if ray intersects the plane of the face
-				// note: this works regardless of the direction of the face normal
-
-				vector = objMatrix.multiplyVector3( vector.copy( face.centroid ) ).subSelf( originCopy );
-				normal = object.matrixRotationWorld.multiplyVector3( normal.copy( face.normal ) );
-				dot = directionCopy.dot( normal );
-
-				// bail if ray and plane are parallel
-
-				if ( Math.abs( dot ) < precision ) continue;
-
-				// calc distance to plane
-
-				scalar = normal.dot( vector ) / dot;
-
-				// if negative distance, then plane is behind ray
-
-				if ( scalar < 0 ) continue;
-
-				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) {
-
-					intersectPoint.add( originCopy, directionCopy.multiplyScalar( scalar ) );
-
-					if ( face instanceof THREE.Face3 ) {
-
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
-
-						if ( pointInFace3( intersectPoint, a, b, c ) ) {
-
-							intersect = {
-
-								distance: originCopy.distanceTo( intersectPoint ),
-								point: intersectPoint.clone(),
-								face: face,
-								object: object
-
-							};
-
-							intersects.push( intersect );
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
-						d = objMatrix.multiplyVector3( d.copy( vertices[ face.d ] ) );
-
-						if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) {
-
-							intersect = {
-
-								distance: originCopy.distanceTo( intersectPoint ),
-								point: intersectPoint.clone(),
-								face: face,
-								object: object
-
-							};
-
-							intersects.push( intersect );
-
-						}
-
-					}
-
-				}
-
-			}
-
-		}
-
-		return intersects;
-
-	}
-
-	this.intersectObjects = function ( objects ) {
-
-		var intersects = [];
-
-		for ( var i = 0, l = objects.length; i < l; i ++ ) {
-
-			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
-
-		}
-
-		intersects.sort( function ( a, b ) { return a.distance - b.distance; } );
-
-		return intersects;
-
-	};
-
-	var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3();
-	var dot, intersect, distance;
-
-	function distanceFromIntersection( origin, direction, position ) {
-
-		v0.sub( position, origin );
-		dot = v0.dot( direction );
-
-		intersect = v1.add( origin, v2.copy( direction ).multiplyScalar( dot ) );
-		distance = position.distanceTo( intersect );
-
-		return distance;
-
-	}
-
-	// http://www.blackpawn.com/texts/pointinpoly/default.html
-
-	var dot00, dot01, dot02, dot11, dot12, invDenom, u, v;
-
-	function pointInFace3( p, a, b, c ) {
-
-		v0.sub( c, a );
-		v1.sub( b, a );
-		v2.sub( p, a );
-
-		dot00 = v0.dot( v0 );
-		dot01 = v0.dot( v1 );
-		dot02 = v0.dot( v2 );
-		dot11 = v1.dot( v1 );
-		dot12 = v1.dot( v2 );
-
-		invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 );
-		u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
-		v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
-
-		return ( u >= 0 ) && ( v >= 0 ) && ( u + v < 1 );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Rectangle = function () {
-
-	var _left, _top, _right, _bottom,
-	_width, _height, _isEmpty = true;
-
-	function resize() {
-
-		_width = _right - _left;
-		_height = _bottom - _top;
-
-	}
-
-	this.getX = function () {
-
-		return _left;
-
-	};
-
-	this.getY = function () {
-
-		return _top;
-
-	};
-
-	this.getWidth = function () {
-
-		return _width;
-
-	};
-
-	this.getHeight = function () {
-
-		return _height;
-
-	};
-
-	this.getLeft = function() {
-
-		return _left;
-
-	};
-
-	this.getTop = function() {
-
-		return _top;
-
-	};
-
-	this.getRight = function() {
-
-		return _right;
-
-	};
-
-	this.getBottom = function() {
-
-		return _bottom;
-
-	};
-
-	this.set = function ( left, top, right, bottom ) {
-
-		_isEmpty = false;
-
-		_left = left; _top = top;
-		_right = right; _bottom = bottom;
-
-		resize();
-
-	};
-
-	this.addPoint = function ( x, y ) {
-
-		if ( _isEmpty ) {
-
-			_isEmpty = false;
-			_left = x; _top = y;
-			_right = x; _bottom = y;
-
-			resize();
-
-		} else {
-
-			_left = _left < x ? _left : x; // Math.min( _left, x );
-			_top = _top < y ? _top : y; // Math.min( _top, y );
-			_right = _right > x ? _right : x; // Math.max( _right, x );
-			_bottom = _bottom > y ? _bottom : y; // Math.max( _bottom, y );
-
-			resize();
-		}
-
-	};
-
-	this.add3Points = function ( x1, y1, x2, y2, x3, y3 ) {
-
-		if (_isEmpty) {
-
-			_isEmpty = false;
-			_left = x1 < x2 ? ( x1 < x3 ? x1 : x3 ) : ( x2 < x3 ? x2 : x3 );
-			_top = y1 < y2 ? ( y1 < y3 ? y1 : y3 ) : ( y2 < y3 ? y2 : y3 );
-			_right = x1 > x2 ? ( x1 > x3 ? x1 : x3 ) : ( x2 > x3 ? x2 : x3 );
-			_bottom = y1 > y2 ? ( y1 > y3 ? y1 : y3 ) : ( y2 > y3 ? y2 : y3 );
-
-			resize();
-
-		} else {
-
-			_left = x1 < x2 ? ( x1 < x3 ? ( x1 < _left ? x1 : _left ) : ( x3 < _left ? x3 : _left ) ) : ( x2 < x3 ? ( x2 < _left ? x2 : _left ) : ( x3 < _left ? x3 : _left ) );
-			_top = y1 < y2 ? ( y1 < y3 ? ( y1 < _top ? y1 : _top ) : ( y3 < _top ? y3 : _top ) ) : ( y2 < y3 ? ( y2 < _top ? y2 : _top ) : ( y3 < _top ? y3 : _top ) );
-			_right = x1 > x2 ? ( x1 > x3 ? ( x1 > _right ? x1 : _right ) : ( x3 > _right ? x3 : _right ) ) : ( x2 > x3 ? ( x2 > _right ? x2 : _right ) : ( x3 > _right ? x3 : _right ) );
-			_bottom = y1 > y2 ? ( y1 > y3 ? ( y1 > _bottom ? y1 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) ) : ( y2 > y3 ? ( y2 > _bottom ? y2 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) );
-
-			resize();
-
-		};
-
-	};
-
-	this.addRectangle = function ( r ) {
-
-		if ( _isEmpty ) {
-
-			_isEmpty = false;
-			_left = r.getLeft(); _top = r.getTop();
-			_right = r.getRight(); _bottom = r.getBottom();
-
-			resize();
-
-		} else {
-
-			_left = _left < r.getLeft() ? _left : r.getLeft(); // Math.min(_left, r.getLeft() );
-			_top = _top < r.getTop() ? _top : r.getTop(); // Math.min(_top, r.getTop() );
-			_right = _right > r.getRight() ? _right : r.getRight(); // Math.max(_right, r.getRight() );
-			_bottom = _bottom > r.getBottom() ? _bottom : r.getBottom(); // Math.max(_bottom, r.getBottom() );
-
-			resize();
-
-		}
-
-	};
-
-	this.inflate = function ( v ) {
-
-		_left -= v; _top -= v;
-		_right += v; _bottom += v;
-
-		resize();
-
-	};
-
-	this.minSelf = function ( r ) {
-
-		_left = _left > r.getLeft() ? _left : r.getLeft(); // Math.max( _left, r.getLeft() );
-		_top = _top > r.getTop() ? _top : r.getTop(); // Math.max( _top, r.getTop() );
-		_right = _right < r.getRight() ? _right : r.getRight(); // Math.min( _right, r.getRight() );
-		_bottom = _bottom < r.getBottom() ? _bottom : r.getBottom(); // Math.min( _bottom, r.getBottom() );
-
-		resize();
-
-	};
-
-	this.intersects = function ( r ) {
-
-		// http://gamemath.com/2011/09/detecting-whether-two-boxes-overlap/
-
-		if ( _right < r.getLeft() ) return false;
-		if ( _left > r.getRight() ) return false;
-		if ( _bottom < r.getTop() ) return false;
-		if ( _top > r.getBottom() ) return false;
-
-		return true;
-
-	};
-
-	this.empty = function () {
-
-		_isEmpty = true;
-
-		_left = 0; _top = 0;
-		_right = 0; _bottom = 0;
-
-		resize();
-
-	};
-
-	this.isEmpty = function () {
-
-		return _isEmpty;
-
-	};
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Math = {
-
-	// Clamp value to range <a, b>
-
-	clamp: function ( x, a, b ) {
-
-		return ( x < a ) ? a : ( ( x > b ) ? b : x );
-
-	},
-
-	// Clamp value to range <a, inf)
-
-	clampBottom: function ( x, a ) {
-
-		return x < a ? a : x;
-
-	},
-
-	// Linear mapping from range <a1, a2> to range <b1, b2>
-
-	mapLinear: function ( x, a1, a2, b1, b2 ) {
-
-		return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );
-
-	},
-
-	// Random float from <0, 1> with 16 bits of randomness
-	// (standard Math.random() creates repetitive patterns when applied over larger space)
-
-	random16: function () {
-
-		return ( 65280 * Math.random() + 255 * Math.random() ) / 65535;
-
-	},
-
-	// Random integer from <low, high> interval
-
-	randInt: function ( low, high ) {
-
-		return low + Math.floor( Math.random() * ( high - low + 1 ) );
-
-	},
-
-	// Random float from <low, high> interval
-
-	randFloat: function ( low, high ) {
-
-		return low + Math.random() * ( high - low );
-
-	},
-
-	// Random float from <-range/2, range/2> interval
-
-	randFloatSpread: function ( range ) {
-
-		return range * ( 0.5 - Math.random() );
-
-	},
-
-	sign: function ( x ) {
-
-		return ( x < 0 ) ? -1 : ( ( x > 0 ) ? 1 : 0 );
-
-	}
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Matrix3 = function () {
-
-	this.elements = new Float32Array(9);
-
-};
-
-THREE.Matrix3.prototype = {
-
-	constructor: THREE.Matrix3,
-
-	getInverse: function ( matrix ) {
-
-		// input: THREE.Matrix4
-		// ( based on http://code.google.com/p/webgl-mjs/ )
-
-        var me = matrix.elements;
-        
-		var a11 =   me[10] * me[5] - me[6] * me[9];
-		var a21 = - me[10] * me[1] + me[2] * me[9];
-		var a31 =   me[6] * me[1] - me[2] * me[5];
-		var a12 = - me[10] * me[4] + me[6] * me[8];
-		var a22 =   me[10] * me[0] - me[2] * me[8];
-		var a32 = - me[6] * me[0] + me[2] * me[4];
-		var a13 =   me[9] * me[4] - me[5] * me[8];
-		var a23 = - me[9] * me[0] + me[1] * me[8];
-		var a33 =   me[5] * me[0] - me[1] * me[4];
-
-		var det = me[0] * a11 + me[1] * a12 + me[2] * a13;
-
-		// no inverse
-
-		if ( det === 0 ) {
-
-			console.warn( "Matrix3.getInverse(): determinant == 0" );
-
-		}
-
-		var idet = 1.0 / det;
-
-		var m = this.elements;
-
-		m[ 0 ] = idet * a11; m[ 1 ] = idet * a21; m[ 2 ] = idet * a31;
-		m[ 3 ] = idet * a12; m[ 4 ] = idet * a22; m[ 5 ] = idet * a32;
-		m[ 6 ] = idet * a13; m[ 7 ] = idet * a23; m[ 8 ] = idet * a33;
-
-		return this;
-
-	},
-
-	
-	transpose: function () {
-
-		var tmp, m = this.elements;
-
-		tmp = m[1]; m[1] = m[3]; m[3] = tmp;
-		tmp = m[2]; m[2] = m[6]; m[6] = tmp;
-		tmp = m[5]; m[5] = m[7]; m[7] = tmp;
-
-		return this;
-
-	},
-	
-
-	transposeIntoArray: function ( r ) {
-
-		var m = this.m;
-
-		r[ 0 ] = m[ 0 ];
-		r[ 1 ] = m[ 3 ];
-		r[ 2 ] = m[ 6 ];
-		r[ 3 ] = m[ 1 ];
-		r[ 4 ] = m[ 4 ];
-		r[ 5 ] = m[ 7 ];
-		r[ 6 ] = m[ 2 ];
-		r[ 7 ] = m[ 5 ];
-		r[ 8 ] = m[ 8 ];
-
-		return this;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author philogb / http://blog.thejit.org/
- * @author jordi_ros / http://plattsoft.com
- * @author D1plo1d / http://github.com/D1plo1d
- * @author alteredq / http://alteredqualia.com/
- * @author mikael emtinger / http://gomo.se/
- * @author timknip / http://www.floorplanner.com/
- */
-
-
-THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-
-    this.elements = new Float32Array(16);
-
-	this.set(
-
-		( n11 !== undefined ) ? n11 : 1, n12 || 0, n13 || 0, n14 || 0,
-		n21 || 0, ( n22 !== undefined ) ? n22 : 1, n23 || 0, n24 || 0,
-		n31 || 0, n32 || 0, ( n33 !== undefined ) ? n33 : 1, n34 || 0,
-		n41 || 0, n42 || 0, n43 || 0, ( n44 !== undefined ) ? n44 : 1
-
-	);
-
-};
-
-THREE.Matrix4.prototype = {
-
-	constructor: THREE.Matrix4,
-
-	set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-        var te = this.elements;
-        
-		te[0] = n11; te[4] = n12; te[8] = n13; te[12] = n14;
-		te[1] = n21; te[5] = n22; te[9] = n23; te[13] = n24;
-		te[2] = n31; te[6] = n32; te[10] = n33; te[14] = n34;
-		te[3] = n41; te[7] = n42; te[11] = n43; te[15] = n44;
-
-		return this;
-
-	},
-
-	identity: function () {
-
-		this.set(
-
-			1, 0, 0, 0,
-			0, 1, 0, 0,
-			0, 0, 1, 0,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	copy: function ( m ) {
-        
-        var me = m.elements;
-        
-		this.set(
-
-			me[0], me[4], me[8], me[12],
-			me[1], me[5], me[9], me[13],
-			me[2], me[6], me[10], me[14],
-			me[3], me[7], me[11], me[15]
-
-		);
-
-		return this;
-
-	},
-
-	lookAt: function ( eye, target, up ) {
-        var te = this.elements;
-        
-		var x = THREE.Matrix4.__v1;
-		var y = THREE.Matrix4.__v2;
-		var z = THREE.Matrix4.__v3;
-
-		z.sub( eye, target ).normalize();
-
-		if ( z.length() === 0 ) {
-
-			z.z = 1;
-
-		}
-
-		x.cross( up, z ).normalize();
-
-		if ( x.length() === 0 ) {
-
-			z.x += 0.0001;
-			x.cross( up, z ).normalize();
-
-		}
-
-		y.cross( z, x );
-
-
-		te[0] = x.x; te[4] = y.x; te[8] = z.x;
-		te[1] = x.y; te[5] = y.y; te[9] = z.y;
-		te[2] = x.z; te[6] = y.z; te[10] = z.z;
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-        
-        var ae = a.elements,
-            be = b.elements,
-            te = this.elements;
-
-		var a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12];
-		var a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13];
-		var a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14];
-		var a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15];
-
-		var b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12];
-		var b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13];
-		var b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14];
-		var b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15];
-
-		te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
-		te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
-		te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
-		te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-
-		te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
-		te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
-		te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
-		te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-
-        te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
-		te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
-		te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
-		te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-
-		te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
-		te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
-		te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
-		te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-
-		return this;
-
-	},
-
-	multiplySelf: function ( m ) {
-
-		return this.multiply( this, m );
-
-	},
-
-	multiplyToArray: function ( a, b, r ) {
-        
-        var te = this.elements;
-        
-		this.multiply( a, b );
-
-		r[ 0 ] = te[0]; r[ 1 ] = te[1]; r[ 2 ] = te[2]; r[ 3 ] = te[3];
-		r[ 4 ] = te[4]; r[ 5 ] = te[5]; r[ 6 ] = te[6]; r[ 7 ] = te[7];
-		r[ 8 ]  = te[8]; r[ 9 ]  = te[9]; r[ 10 ] = te[10]; r[ 11 ] = te[11];
-		r[ 12 ] = te[12]; r[ 13 ] = te[13]; r[ 14 ] = te[14]; r[ 15 ] = te[15];
-
-		return this;
-
-	},
-
-	multiplyScalar: function ( s ) {
-        
-        var te = this.elements;
-        
-		te[0] *= s; te[4] *= s; te[8] *= s; te[12] *= s;
-		te[1] *= s; te[5] *= s; te[9] *= s; te[13] *= s;
-		te[2] *= s; te[6] *= s; te[10] *= s; te[14] *= s;
-		te[3] *= s; te[7] *= s; te[11] *= s; te[15] *= s;
-
-		return this;
-
-	},
-
-	multiplyVector3: function ( v ) {
-        var te = this.elements;
-        
-		var vx = v.x, vy = v.y, vz = v.z;
-		var d = 1 / ( te[3] * vx + te[7] * vy + te[11] * vz + te[15] );
-
-		v.x = ( te[0] * vx + te[4] * vy + te[8] * vz + te[12] ) * d;
-		v.y = ( te[1] * vx + te[5] * vy + te[9] * vz + te[13] ) * d;
-		v.z = ( te[2] * vx + te[6] * vy + te[10] * vz + te[14] ) * d;
-
-		return v;
-
-	},
-
-	multiplyVector4: function ( v ) {
-        
-        var te = this.elements;
-		var vx = v.x, vy = v.y, vz = v.z, vw = v.w;
-
-		v.x = te[0] * vx + te[4] * vy + te[8] * vz + te[12] * vw;
-		v.y = te[1] * vx + te[5] * vy + te[9] * vz + te[13] * vw;
-		v.z = te[2] * vx + te[6] * vy + te[10] * vz + te[14] * vw;
-		v.w = te[3] * vx + te[7] * vy + te[11] * vz + te[15] * vw;
-
-		return v;
-
-	},
-
-	rotateAxis: function ( v ) {
-        
-        var te = this.elements;
-		var vx = v.x, vy = v.y, vz = v.z;
-
-		v.x = vx * te[0] + vy * te[4] + vz * te[8];
-		v.y = vx * te[1] + vy * te[5] + vz * te[9];
-		v.z = vx * te[2] + vy * te[6] + vz * te[10];
-
-		v.normalize();
-
-		return v;
-
-	},
-
-	crossVector: function ( a ) {
-        
-        var te = this.elements;
-		var v = new THREE.Vector4();
-
-		v.x = te[0] * a.x + te[4] * a.y + te[8] * a.z + te[12] * a.w;
-		v.y = te[1] * a.x + te[5] * a.y + te[9] * a.z + te[13] * a.w;
-		v.z = te[2] * a.x + te[6] * a.y + te[10] * a.z + te[14] * a.w;
-
-		v.w = ( a.w ) ? te[3] * a.x + te[7] * a.y + te[11] * a.z + te[15] * a.w : 1;
-
-		return v;
-
-	},
-
-	determinant: function () {
-
-        var te = this.elements;
-        
-		var n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12];
-		var n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];
-		var n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];
-		var n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];
-
-		//TODO: make this more efficient
-		//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
-		return (
-			n14 * n23 * n32 * n41-
-			n13 * n24 * n32 * n41-
-			n14 * n22 * n33 * n41+
-			n12 * n24 * n33 * n41+
-
-			n13 * n22 * n34 * n41-
-			n12 * n23 * n34 * n41-
-			n14 * n23 * n31 * n42+
-			n13 * n24 * n31 * n42+
-
-			n14 * n21 * n33 * n42-
-			n11 * n24 * n33 * n42-
-			n13 * n21 * n34 * n42+
-			n11 * n23 * n34 * n42+
-
-			n14 * n22 * n31 * n43-
-			n12 * n24 * n31 * n43-
-			n14 * n21 * n32 * n43+
-			n11 * n24 * n32 * n43+
-
-			n12 * n21 * n34 * n43-
-			n11 * n22 * n34 * n43-
-			n13 * n22 * n31 * n44+
-			n12 * n23 * n31 * n44+
-
-			n13 * n21 * n32 * n44-
-			n11 * n23 * n32 * n44-
-			n12 * n21 * n33 * n44+
-			n11 * n22 * n33 * n44
-		);
-
-	},
-
-	transpose: function () {
-        var te = this.elements;
-        
-		var tmp;
-
-		tmp = te[1]; te[1] = te[4]; te[4] = tmp;
-		tmp = te[2]; te[2] = te[8]; te[8] = tmp;
-		tmp = te[6]; te[6] = te[9]; te[9] = tmp;
-
-		tmp = te[3]; te[3] = te[12]; te[12] = tmp;
-		tmp = te[7]; te[7] = te[13]; te[13] = tmp;
-		tmp = te[11]; te[11] = te[14]; te[14] = tmp;
-
-		return this;
-
-	},
-
-	flattenToArray: function ( flat ) {
-
-        var te = this.elements;
-		flat[ 0 ] = te[0]; flat[ 1 ] = te[1]; flat[ 2 ] = te[2]; flat[ 3 ] = te[3];
-		flat[ 4 ] = te[4]; flat[ 5 ] = te[5]; flat[ 6 ] = te[6]; flat[ 7 ] = te[7];
-		flat[ 8 ]  = te[8]; flat[ 9 ]  = te[9]; flat[ 10 ] = te[10]; flat[ 11 ] = te[11];
-		flat[ 12 ] = te[12]; flat[ 13 ] = te[13]; flat[ 14 ] = te[14]; flat[ 15 ] = te[15];
-
-		return flat;
-
-	},
-
-	flattenToArrayOffset: function( flat, offset ) {
-
-        var te = this.elements;
-		flat[ offset ] = te[0];
-		flat[ offset + 1 ] = te[1];
-		flat[ offset + 2 ] = te[2];
-		flat[ offset + 3 ] = te[3];
-
-		flat[ offset + 4 ] = te[4];
-		flat[ offset + 5 ] = te[5];
-		flat[ offset + 6 ] = te[6];
-		flat[ offset + 7 ] = te[7];
-
-		flat[ offset + 8 ]  = te[8];
-		flat[ offset + 9 ]  = te[9];
-		flat[ offset + 10 ] = te[10];
-		flat[ offset + 11 ] = te[11];
-
-		flat[ offset + 12 ] = te[12];
-		flat[ offset + 13 ] = te[13];
-		flat[ offset + 14 ] = te[14];
-		flat[ offset + 15 ] = te[15];
-
-		return flat;
-
-	},
-
-	getPosition: function () {
-        var te = this.elements;
-        
-		return THREE.Matrix4.__v1.set( te[12], te[13], te[14] );
-
-	},
-
-	setPosition: function ( v ) {
-        var te = this.elements;
-		te[12] = v.x;
-		te[13] = v.y;
-		te[14] = v.z;
-
-		return this;
-
-	},
-
-	getColumnX: function () {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[0], te[1], te[2] );
-
-	},
-
-	getColumnY: function () {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[4], te[5], te[6] );
-
-	},
-
-	getColumnZ: function() {
-        var te = this.elements;
-		return THREE.Matrix4.__v1.set( te[8], te[9], te[10] );
-
-	},
-
-	getInverse: function ( m ) {
-
-		// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
-        var te = this.elements;
-        var me = m.elements;
-                
-		var n11 = me[0], n12 = me[4], n13 = me[8], n14 = me[12];
-		var n21 = me[1], n22 = me[5], n23 = me[9], n24 = me[13];
-		var n31 = me[2], n32 = me[6], n33 = me[10], n34 = me[14];
-		var n41 = me[3], n42 = me[7], n43 = me[11], n44 = me[15];
-
-		te[0] = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44;
-		te[4] = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44;
-		te[8] = n13*n24*n42 - n14*n23*n42 + n14*n22*n43 - n12*n24*n43 - n13*n22*n44 + n12*n23*n44;
-		te[12] = n14*n23*n32 - n13*n24*n32 - n14*n22*n33 + n12*n24*n33 + n13*n22*n34 - n12*n23*n34;
-		te[1] = n24*n33*n41 - n23*n34*n41 - n24*n31*n43 + n21*n34*n43 + n23*n31*n44 - n21*n33*n44;
-		te[5] = n13*n34*n41 - n14*n33*n41 + n14*n31*n43 - n11*n34*n43 - n13*n31*n44 + n11*n33*n44;
-		te[9] = n14*n23*n41 - n13*n24*n41 - n14*n21*n43 + n11*n24*n43 + n13*n21*n44 - n11*n23*n44;
-		te[13] = n13*n24*n31 - n14*n23*n31 + n14*n21*n33 - n11*n24*n33 - n13*n21*n34 + n11*n23*n34;
-		te[2] = n22*n34*n41 - n24*n32*n41 + n24*n31*n42 - n21*n34*n42 - n22*n31*n44 + n21*n32*n44;
-		te[6] = n14*n32*n41 - n12*n34*n41 - n14*n31*n42 + n11*n34*n42 + n12*n31*n44 - n11*n32*n44;
-		te[10] = n12*n24*n41 - n14*n22*n41 + n14*n21*n42 - n11*n24*n42 - n12*n21*n44 + n11*n22*n44;
-		te[14] = n14*n22*n31 - n12*n24*n31 - n14*n21*n32 + n11*n24*n32 + n12*n21*n34 - n11*n22*n34;
-		te[3] = n23*n32*n41 - n22*n33*n41 - n23*n31*n42 + n21*n33*n42 + n22*n31*n43 - n21*n32*n43;
-		te[7] = n12*n33*n41 - n13*n32*n41 + n13*n31*n42 - n11*n33*n42 - n12*n31*n43 + n11*n32*n43;
-		te[11] = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43;
-		te[15] = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33;
-		this.multiplyScalar( 1 / m.determinant() );
-
-		return this;
-
-	},
-
-	setRotationFromEuler: function( v, order ) {
-        var te = this.elements;
-        
-		var x = v.x, y = v.y, z = v.z;
-		var a = Math.cos( x ), b = Math.sin( x );
-		var c = Math.cos( y ), d = Math.sin( y );
-		var e = Math.cos( z ), f = Math.sin( z );
-
-		switch ( order ) {
-
-			case 'YXZ':
-
-				var ce = c * e, cf = c * f, de = d * e, df = d * f;
-
-				te[0] = ce + df * b;
-				te[4] = de * b - cf;
-				te[8] = a * d;
-
-				te[1] = a * f;
-				te[5] = a * e;
-				te[9] = - b;
-
-				te[2] = cf * b - de;
-				te[6] = df + ce * b;
-				te[10] = a * c;
-				break;
-
-			case 'ZXY':
-
-				var ce = c * e, cf = c * f, de = d * e, df = d * f;
-
-				te[0] = ce - df * b;
-				te[4] = - a * f;
-				te[8] = de + cf * b;
-
-				te[1] = cf + de * b;
-				te[5] = a * e;
-				te[9] = df - ce * b;
-
-				te[2] = - a * d;
-				te[6] = b;
-				te[10] = a * c;
-				break;
-
-			case 'ZYX':
-
-				var ae = a * e, af = a * f, be = b * e, bf = b * f;
-
-				te[0] = c * e;
-				te[4] = be * d - af;
-				te[8] = ae * d + bf;
-
-				te[1] = c * f;
-				te[5] = bf * d + ae;
-				te[9] = af * d - be;
-
-				te[2] = - d;
-				te[6] = b * c;
-				te[10] = a * c;
-				break;
-
-			case 'YZX':
-
-				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
-				te[0] = c * e;
-				te[4] = bd - ac * f;
-				te[8] = bc * f + ad;
-
-				te[1] = f;
-				te[5] = a * e;
-				te[9] = - b * e;
-
-				te[2] = - d * e;
-				te[6] = ad * f + bc;
-				te[10] = ac - bd * f;
-				break;
-
-			case 'XZY':
-
-				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
-				te[0] = c * e;
-				te[4] = - f;
-				te[8] = d * e;
-
-				te[1] = ac * f + bd;
-				te[5] = a * e;
-				te[9] = ad * f - bc;
-
-				te[2] = bc * f - ad;
-				te[6] = b * e;
-				te[10] = bd * f + ac;
-				break;
-
-			default: // 'XYZ'
-
-				var ae = a * e, af = a * f, be = b * e, bf = b * f;
-
-				te[0] = c * e;
-				te[4] = - c * f;
-				te[8] = d;
-
-				te[1] = af + be * d;
-				te[5] = ae - bf * d;
-				te[9] = - b * c;
-
-				te[2] = bf - ae * d;
-				te[6] = be + af * d;
-				te[10] = a * c;
-				break;
-
-		}
-
-		return this;
-
-	},
-
-
-	setRotationFromQuaternion: function( q ) {
-        var te = this.elements;
-        
-		var x = q.x, y = q.y, z = q.z, w = q.w;
-		var x2 = x + x, y2 = y + y, z2 = z + z;
-		var xx = x * x2, xy = x * y2, xz = x * z2;
-		var yy = y * y2, yz = y * z2, zz = z * z2;
-		var wx = w * x2, wy = w * y2, wz = w * z2;
-
-		te[0] = 1 - ( yy + zz );
-		te[4] = xy - wz;
-		te[8] = xz + wy;
-
-		te[1] = xy + wz;
-		te[5] = 1 - ( xx + zz );
-		te[9] = yz - wx;
-
-		te[2] = xz - wy;
-		te[6] = yz + wx;
-		te[10] = 1 - ( xx + yy );
-
-		return this;
-
-	},
-
-	compose: function ( translation, rotation, scale ) {
-        var te = this.elements;
-		var mRotation = THREE.Matrix4.__m1;
-		var mScale = THREE.Matrix4.__m2;
-
-		mRotation.identity();
-		mRotation.setRotationFromQuaternion( rotation );
-
-		mScale.makeScale( scale.x, scale.y, scale.z );
-
-		this.multiply( mRotation, mScale );
-
-		te[12] = translation.x;
-		te[13] = translation.y;
-		te[14] = translation.z;
-
-		return this;
-
-	},
-
-	decompose: function ( translation, rotation, scale ) {
-
-		// grab the axis vectors
-        var te = this.elements;
-		var x = THREE.Matrix4.__v1;
-		var y = THREE.Matrix4.__v2;
-		var z = THREE.Matrix4.__v3;
-
-		x.set( te[0], te[1], te[2] );
-		y.set( te[4], te[5], te[6] );
-		z.set( te[8], te[9], te[10] );
-
-		translation = ( translation instanceof THREE.Vector3 ) ? translation : new THREE.Vector3();
-		rotation = ( rotation instanceof THREE.Quaternion ) ? rotation : new THREE.Quaternion();
-		scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3();
-
-		scale.x = x.length();
-		scale.y = y.length();
-		scale.z = z.length();
-
-		translation.x = te[12];
-		translation.y = te[13];
-		translation.z = te[14];
-
-		// scale the rotation part
-
-		var matrix = THREE.Matrix4.__m1;
-
-		matrix.copy( this );
-
-		matrix.elements[0] /= scale.x;
-		matrix.elements[1] /= scale.x;
-		matrix.elements[2] /= scale.x;
-
-		matrix.elements[4] /= scale.y;
-		matrix.elements[5] /= scale.y;
-		matrix.elements[6] /= scale.y;
-
-		matrix.elements[8] /= scale.z;
-		matrix.elements[9] /= scale.z;
-		matrix.elements[10] /= scale.z;
-
-		rotation.setFromRotationMatrix( matrix );
-
-		return [ translation, rotation, scale ];
-
-	},
-
-	extractPosition: function ( m ) {
-        var te = this.elements;
-        var me = m.elements;
-		te[12] = me[12];
-		te[13] = me[13];
-		te[14] = me[14];
-
-		return this;
-
-	},
-
-	extractRotation: function ( m ) {
-        var te = this.elements;
-        var me = m.elements;
-        
-		var vector = THREE.Matrix4.__v1;
-
-		var scaleX = 1 / vector.set( me[0], me[1], me[2] ).length();
-		var scaleY = 1 / vector.set( me[4], me[5], me[6] ).length();
-		var scaleZ = 1 / vector.set( me[8], me[9], me[10] ).length();
-
-		te[0] = me[0] * scaleX;
-		te[1] = me[1] * scaleX;
-		te[2] = me[2] * scaleX;
-
-		te[4] = me[4] * scaleY;
-		te[5] = me[5] * scaleY;
-		te[6] = me[6] * scaleY;
-
-		te[8] = me[8] * scaleZ;
-		te[9] = me[9] * scaleZ;
-		te[10] = me[10] * scaleZ;
-
-		return this;
-
-	},
-
-	//
-
-	translate: function ( v ) {
-        var te = this.elements;
-		var x = v.x, y = v.y, z = v.z;
-
-		te[12] = te[0] * x + te[4] * y + te[8] * z + te[12];
-		te[13] = te[1] * x + te[5] * y + te[9] * z + te[13];
-		te[14] = te[2] * x + te[6] * y + te[10] * z + te[14];
-		te[15] = te[3] * x + te[7] * y + te[11] * z + te[15];
-
-		return this;
-
-	},
-
-	rotateX: function ( angle ) {
-        var te = this.elements;
-		var m12 = te[4];
-		var m22 = te[5];
-		var m32 = te[6];
-		var m42 = te[7];
-		var m13 = te[8];
-		var m23 = te[9];
-		var m33 = te[10];
-		var m43 = te[11];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[4] = c * m12 + s * m13;
-		te[5] = c * m22 + s * m23;
-		te[6] = c * m32 + s * m33;
-		te[7] = c * m42 + s * m43;
-
-		te[8] = c * m13 - s * m12;
-		te[9] = c * m23 - s * m22;
-		te[10] = c * m33 - s * m32;
-		te[11] = c * m43 - s * m42;
-
-		return this;
-
-  	},
-
-	rotateY: function ( angle ) {
-        var te = this.elements;
-		var m11 = te[0];
-		var m21 = te[1];
-		var m31 = te[2];
-		var m41 = te[3];
-		var m13 = te[8];
-		var m23 = te[9];
-		var m33 = te[10];
-		var m43 = te[11];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[0] = c * m11 - s * m13;
-		te[1] = c * m21 - s * m23;
-		te[2] = c * m31 - s * m33;
-		te[3] = c * m41 - s * m43;
-
-		te[8] = c * m13 + s * m11;
-		te[9] = c * m23 + s * m21;
-		te[10] = c * m33 + s * m31;
-		te[11] = c * m43 + s * m41;
-
-		return this;
-
-	},
-
-	rotateZ: function ( angle ) {
-        var te = this.elements;
-		var m11 = te[0];
-		var m21 = te[1];
-		var m31 = te[2];
-		var m41 = te[3];
-		var m12 = te[4];
-		var m22 = te[5];
-		var m32 = te[6];
-		var m42 = te[7];
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-
-		te[0] = c * m11 + s * m12;
-		te[1] = c * m21 + s * m22;
-		te[2] = c * m31 + s * m32;
-		te[3] = c * m41 + s * m42;
-
-		te[4] = c * m12 - s * m11;
-		te[5] = c * m22 - s * m21;
-		te[6] = c * m32 - s * m31;
-		te[7] = c * m42 - s * m41;
-
-		return this;
-
-	},
-
-	rotateByAxis: function ( axis, angle ) {
-        var te = this.elements;
-		// optimize by checking axis
-
-		if ( axis.x === 1 && axis.y === 0 && axis.z === 0 ) {
-
-			return this.rotateX( angle );
-
-		} else if ( axis.x === 0 && axis.y === 1 && axis.z === 0 ) {
-
-			return this.rotateY( angle );
-
-		} else if ( axis.x === 0 && axis.y === 0 && axis.z === 1 ) {
-
-			return this.rotateZ( angle );
-
-		}
-
-		var x = axis.x, y = axis.y, z = axis.z;
-		var n = Math.sqrt(x * x + y * y + z * z);
-
-		x /= n;
-		y /= n;
-		z /= n;
-
-		var xx = x * x, yy = y * y, zz = z * z;
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-		var oneMinusCosine = 1 - c;
-		var xy = x * y * oneMinusCosine;
-		var xz = x * z * oneMinusCosine;
-		var yz = y * z * oneMinusCosine;
-		var xs = x * s;
-		var ys = y * s;
-		var zs = z * s;
-
-		var r11 = xx + (1 - xx) * c;
-		var r21 = xy + zs;
-		var r31 = xz - ys;
-		var r12 = xy - zs;
-		var r22 = yy + (1 - yy) * c;
-		var r32 = yz + xs;
-		var r13 = xz + ys;
-		var r23 = yz - xs;
-		var r33 = zz + (1 - zz) * c;
-
-		var m11 = te[0], m21 = te[1], m31 = te[2], m41 = te[3];
-		var m12 = te[4], m22 = te[5], m32 = te[6], m42 = te[7];
-		var m13 = te[8], m23 = te[9], m33 = te[10], m43 = te[11];
-		var m14 = te[12], m24 = te[13], m34 = te[14], m44 = te[15];
-
-		te[0] = r11 * m11 + r21 * m12 + r31 * m13;
-		te[1] = r11 * m21 + r21 * m22 + r31 * m23;
-		te[2] = r11 * m31 + r21 * m32 + r31 * m33;
-		te[3] = r11 * m41 + r21 * m42 + r31 * m43;
-
-		te[4] = r12 * m11 + r22 * m12 + r32 * m13;
-		te[5] = r12 * m21 + r22 * m22 + r32 * m23;
-		te[6] = r12 * m31 + r22 * m32 + r32 * m33;
-		te[7] = r12 * m41 + r22 * m42 + r32 * m43;
-
-		te[8] = r13 * m11 + r23 * m12 + r33 * m13;
-		te[9] = r13 * m21 + r23 * m22 + r33 * m23;
-		te[10] = r13 * m31 + r23 * m32 + r33 * m33;
-		te[11] = r13 * m41 + r23 * m42 + r33 * m43;
-
-		return this;
-
-	},
-
-	scale: function ( v ) {
-
-		var te = this.elements;
-		var x = v.x, y = v.y, z = v.z;
-
-		te[0] *= x; te[4] *= y; te[8] *= z;
-		te[1] *= x; te[5] *= y; te[9] *= z;
-		te[2] *= x; te[6] *= y; te[10] *= z;
-		te[3] *= x; te[7] *= y; te[11] *= z;
-
-		return this;
-
-	},
-
-	getMaxScaleOnAxis: function () {
-
-		var te = this.elements;
-
-		var scaleXSq =  te[0] * te[0] + te[1] * te[1] + te[2] * te[2];
-		var scaleYSq =  te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
-		var scaleZSq =  te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
-
-		return Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) );
-
-	},
-
-	//
-
-	makeTranslation: function ( x, y, z ) {
-
-		this.set(
-
-			1, 0, 0, x,
-			0, 1, 0, y,
-			0, 0, 1, z,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationX: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			1, 0,  0, 0,
-			0, c, -s, 0,
-			0, s,  c, 0,
-			0, 0,  0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationY: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			 c, 0, s, 0,
-			 0, 1, 0, 0,
-			-s, 0, c, 0,
-			 0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationZ: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			c, -s, 0, 0,
-			s,  c, 0, 0,
-			0,  0, 1, 0,
-			0,  0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeRotationAxis: function ( axis, angle ) {
-
-		// Based on http://www.gamedev.net/reference/articles/article1199.asp
-
-		var c = Math.cos( angle );
-		var s = Math.sin( angle );
-		var t = 1 - c;
-		var x = axis.x, y = axis.y, z = axis.z;
-		var tx = t * x, ty = t * y;
-
-		this.set(
-
-		 	tx * x + c, tx * y - s * z, tx * z + s * y, 0,
-			tx * y + s * z, ty * y + c, ty * z - s * x, 0,
-			tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
-			0, 0, 0, 1
-
-		);
-
-		 return this;
-
-	},
-
-	makeScale: function ( x, y, z ) {
-
-		this.set(
-
-			x, 0, 0, 0,
-			0, y, 0, 0,
-			0, 0, z, 0,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	makeFrustum: function ( left, right, bottom, top, near, far ) {
-        var te = this.elements;
-		var x = 2 * near / ( right - left );
-		var y = 2 * near / ( top - bottom );
-
-		var a = ( right + left ) / ( right - left );
-		var b = ( top + bottom ) / ( top - bottom );
-		var c = - ( far + near ) / ( far - near );
-		var d = - 2 * far * near / ( far - near );
-
-		te[0] = x;  te[4] = 0;  te[8] = a;   te[12] = 0;
-		te[1] = 0;  te[5] = y;  te[9] = b;   te[13] = 0;
-		te[2] = 0;  te[6] = 0;  te[10] = c;   te[14] = d;
-		te[3] = 0;  te[7] = 0;  te[11] = - 1; te[15] = 0;
-
-		return this;
-
-	},
-
-	makePerspective: function ( fov, aspect, near, far ) {
-
-		var ymax = near * Math.tan( fov * Math.PI / 360 );
-		var ymin = - ymax;
-		var xmin = ymin * aspect;
-		var xmax = ymax * aspect;
-
-		return this.makeFrustum( xmin, xmax, ymin, ymax, near, far );
-
-	},
-
-	makeOrthographic: function ( left, right, top, bottom, near, far ) {
-        var te = this.elements;
-		var w = right - left;
-		var h = top - bottom;
-		var p = far - near;
-
-		var x = ( right + left ) / w;
-		var y = ( top + bottom ) / h;
-		var z = ( far + near ) / p;
-
-		te[0] = 2 / w; te[4] = 0;     te[8] = 0;      te[12] = -x;
-		te[1] = 0;     te[5] = 2 / h; te[9] = 0;      te[13] = -y;
-		te[2] = 0;     te[6] = 0;     te[10] = -2 / p; te[14] = -z;
-		te[3] = 0;     te[7] = 0;     te[11] = 0;      te[15] = 1;
-
-		return this;
-
-	},
-
-
-	clone: function () {
-        var te = this.elements;
-		return new THREE.Matrix4(
-
-			te[0], te[4], te[8], te[12],
-			te[1], te[5], te[9], te[13],
-			te[2], te[6], te[10], te[14],
-			te[3], te[7], te[11], te[15]
-
-		);
-
-	}
-
-};
-
-THREE.Matrix4.__v1 = new THREE.Vector3();
-THREE.Matrix4.__v2 = new THREE.Vector3();
-THREE.Matrix4.__v3 = new THREE.Vector3();
-
-THREE.Matrix4.__m1 = new THREE.Matrix4();
-THREE.Matrix4.__m2 = new THREE.Matrix4();
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Object3D = function () {
-
-	this.id = THREE.Object3DCount ++;
-
-	this.name = '';
-
-	this.parent = undefined;
-	this.children = [];
-
-	this.up = new THREE.Vector3( 0, 1, 0 );
-
-	this.position = new THREE.Vector3();
-	this.rotation = new THREE.Vector3();
-	this.eulerOrder = 'XYZ';
-	this.scale = new THREE.Vector3( 1, 1, 1 );
-
-	this.doubleSided = false;
-	this.flipSided = false;
-
-	this.renderDepth = null;
-
-	this.rotationAutoUpdate = true;
-
-	this.matrix = new THREE.Matrix4();
-	this.matrixWorld = new THREE.Matrix4();
-	this.matrixRotationWorld = new THREE.Matrix4();
-
-	this.matrixAutoUpdate = true;
-	this.matrixWorldNeedsUpdate = true;
-
-	this.quaternion = new THREE.Quaternion();
-	this.useQuaternion = false;
-
-	this.boundRadius = 0.0;
-	this.boundRadiusScale = 1.0;
-
-	this.visible = true;
-
-	this.castShadow = false;
-	this.receiveShadow = false;
-
-	this.frustumCulled = true;
-
-	this._vector = new THREE.Vector3();
-
-};
-
-
-THREE.Object3D.prototype = {
-
-	constructor: THREE.Object3D,
-
-	applyMatrix: function ( matrix ) {
-
-		this.matrix.multiply( matrix, this.matrix );
-
-		this.scale.getScaleFromMatrix( this.matrix );
-		this.rotation.getRotationFromMatrix( this.matrix, this.scale );
-		this.position.getPositionFromMatrix( this.matrix );
-
-	},
-
-	translate: function ( distance, axis ) {
-
-		this.matrix.rotateAxis( axis );
-		this.position.addSelf( axis.multiplyScalar( distance ) );
-
-	},
-
-	translateX: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 1, 0, 0 ) );
-
-	},
-
-	translateY: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 0, 1, 0 ) );
-
-	},
-
-	translateZ: function ( distance ) {
-
-		this.translate( distance, this._vector.set( 0, 0, 1 ) );
-
-	},
-
-	lookAt: function ( vector ) {
-
-		// TODO: Add hierarchy support.
-
-		this.matrix.lookAt( vector, this.position, this.up );
-
-		if ( this.rotationAutoUpdate ) {
-
-			this.rotation.getRotationFromMatrix( this.matrix );
-
-		}
-
-	},
-
-	add: function ( object ) {
-
-		if ( object === this ) {
-
-			console.warn( 'THREE.Object3D.add: An object can\'t be added as a child of itself.' );
-			return;
-
-		}
-
-		if ( object instanceof THREE.Object3D ) { // && this.children.indexOf( object ) === - 1
-
-			if ( object.parent !== undefined ) {
-
-				object.parent.remove( object );
-
-			}
-
-			object.parent = this;
-			this.children.push( object );
-
-			// add to scene
-
-			var scene = this;
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene )  {
-
-				scene.__addObject( object );
-
-			}
-
-		}
-
-	},
-
-	remove: function ( object ) {
-
-		var index = this.children.indexOf( object );
-
-		if ( index !== - 1 ) {
-
-			object.parent = undefined;
-			this.children.splice( index, 1 );
-
-			// remove from scene
-
-			var scene = this;
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene ) {
-
-				scene.__removeObject( object );
-
-			}
-
-		}
-
-	},
-
-	getChildByName: function ( name, recursive ) {
-
-		var c, cl, child;
-
-		for ( c = 0, cl = this.children.length; c < cl; c ++ ) {
-
-			child = this.children[ c ];
-
-			if ( child.name === name ) {
-
-				return child;
-
-			}
-
-			if ( recursive ) {
-
-				child = child.getChildByName( name, recursive );
-
-				if ( child !== undefined ) {
-
-					return child;
-
-				}
-
-			}
-
-		}
-
-		return undefined;
-
-	},
-
-	updateMatrix: function () {
-
-		this.matrix.setPosition( this.position );
-
-		if ( this.useQuaternion )  {
-
-			this.matrix.setRotationFromQuaternion( this.quaternion );
-
-		} else {
-
-			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 ( force ) {
-
-		this.matrixAutoUpdate && this.updateMatrix();
-
-		// update matrixWorld
-
-		if ( this.matrixWorldNeedsUpdate || force ) {
-
-			if ( this.parent ) {
-
-				this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix );
-
-			} else {
-
-				this.matrixWorld.copy( this.matrix );
-
-			}
-
-			this.matrixWorldNeedsUpdate = false;
-
-			force = true;
-
-		}
-
-		// update children
-
-		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
-
-			this.children[ i ].updateMatrixWorld( force );
-
-		}
-
-	}
-
-};
-
-THREE.Object3DCount = 0;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author julianwa / https://github.com/julianwa
- */
-
-THREE.Projector = function() {
-
-	var _object, _objectCount, _objectPool = [],
-	_vertex, _vertexCount, _vertexPool = [],
-	_face, _face3Count, _face3Pool = [], _face4Count, _face4Pool = [],
-	_line, _lineCount, _linePool = [],
-	_particle, _particleCount, _particlePool = [],
-
-	_renderData = { objects: [], sprites: [], lights: [], elements: [] },
-
-	_vector3 = new THREE.Vector3(),
-	_vector4 = new THREE.Vector4(),
-
-	_projScreenMatrix = new THREE.Matrix4(),
-	_projScreenobjectMatrixWorld = new THREE.Matrix4(),
-
-	_frustum = new THREE.Frustum(),
-
-	_clippedVertex1PositionScreen = new THREE.Vector4(),
-	_clippedVertex2PositionScreen = new THREE.Vector4(),
-
-	_face3VertexNormals;
-
-	this.projectVector = function ( vector, camera ) {
-
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.unprojectVector = function ( vector, camera ) {
-
-		camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
-
-		_projScreenMatrix.multiply( camera.matrixWorld, camera.projectionMatrixInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.pickingRay = function ( vector, camera ) {
-
-		var end, ray, t;
-
-		// set two vectors with opposing z values
-		vector.z = -1.0;
-		end = new THREE.Vector3( vector.x, vector.y, 1.0 );
-
-		this.unprojectVector( vector, camera );
-		this.unprojectVector( end, camera );
-
-		// find direction from vector to end
-		end.subSelf( vector ).normalize();
-
-		return new THREE.Ray( vector, end );
-
-	};
-
-	this.projectGraph = function ( root, sort ) {
-
-		_objectCount = 0;
-
-		_renderData.objects.length = 0;
-		_renderData.sprites.length = 0;
-		_renderData.lights.length = 0;
-
-		var projectObject = function ( object ) {
-
-			if ( object.visible === false ) return;
-
-			if ( ( object instanceof THREE.Mesh || object instanceof THREE.Line ) &&
-			( object.frustumCulled === false || _frustum.contains( object ) ) ) {
-
-				_vector3.copy( object.matrixWorld.getPosition() );
-				_projScreenMatrix.multiplyVector3( _vector3 );
-
-				_object = getNextObjectInPool();
-				_object.object = object;
-				_object.z = _vector3.z;
-
-				_renderData.objects.push( _object );
-
-			} else if ( object instanceof THREE.Sprite || object instanceof THREE.Particle ) {
-
-				_vector3.copy( object.matrixWorld.getPosition() );
-				_projScreenMatrix.multiplyVector3( _vector3 );
-
-				_object = getNextObjectInPool();
-				_object.object = object;
-				_object.z = _vector3.z;
-
-				_renderData.sprites.push( _object );
-
-			} else if ( object instanceof THREE.Light ) {
-
-				_renderData.lights.push( object );
-
-			}
-
-			for ( var c = 0, cl = object.children.length; c < cl; c ++ ) {
-
-				projectObject( object.children[ c ] );
-
-			}
-
-		};
-
-		projectObject( root );
-
-		sort && _renderData.objects.sort( painterSort );
-
-		return _renderData;
-
-	};
-
-	this.projectScene = function ( scene, camera, sort ) {
-
-		var near = camera.near, far = camera.far, visible = false,
-		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, object,
-		objectMatrixWorld, objectMatrixWorldRotation,
-		geometry, geometryMaterials, vertices, vertex, vertexPositionScreen,
-		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
-		v1, v2, v3, v4;
-
-		_face3Count = 0;
-		_face4Count = 0;
-		_lineCount = 0;
-		_particleCount = 0;
-
-		_renderData.elements.length = 0;
-
-		if ( camera.parent === undefined ) {
-
-			console.warn( 'DEPRECATED: Camera hasn\'t been added to a Scene. Adding it...' );
-			scene.add( camera );
-
-		}
-
-		scene.updateMatrixWorld();
-
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-
-		_frustum.setFromMatrix( _projScreenMatrix );
-
-		_renderData = this.projectGraph( scene, false );
-
-		for ( o = 0, ol = _renderData.objects.length; o < ol; o++ ) {
-
-			object = _renderData.objects[ o ].object;
-
-			objectMatrixWorld = object.matrixWorld;
-
-			_vertexCount = 0;
-
-			if ( object instanceof THREE.Mesh ) {
-
-				geometry = object.geometry;
-				geometryMaterials = object.geometry.materials;
-				vertices = geometry.vertices;
-				faces = geometry.faces;
-				faceVertexUvs = geometry.faceVertexUvs;
-
-				objectMatrixWorldRotation = object.matrixRotationWorld.extractRotation( objectMatrixWorld );
-
-				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
-
-					_vertex = getNextVertexInPool();
-					_vertex.positionWorld.copy( vertices[ v ] );
-
-					objectMatrixWorld.multiplyVector3( _vertex.positionWorld );
-
-					_vertex.positionScreen.copy( _vertex.positionWorld );
-					_projScreenMatrix.multiplyVector4( _vertex.positionScreen );
-
-					_vertex.positionScreen.x /= _vertex.positionScreen.w;
-					_vertex.positionScreen.y /= _vertex.positionScreen.w;
-
-					_vertex.visible = _vertex.positionScreen.z > near && _vertex.positionScreen.z < far;
-
-				}
-
-				for ( f = 0, fl = faces.length; f < fl; f ++ ) {
-
-					face = faces[ f ];
-
-					if ( face instanceof THREE.Face3 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-
-						if ( v1.visible && v2.visible && v3.visible ) {
-
-							visible = ( ( v3.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-								( v3.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) ) < 0;
-
-							if ( object.doubleSided || visible != object.flipSided ) {
-
-								_face = getNextFace3InPool();
-
-								_face.v1.copy( v1 );
-								_face.v2.copy( v2 );
-								_face.v3.copy( v3 );
-
-							} else {
-
-								continue;
-
-							}
-
-						} else {
-
-							continue;
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-						v4 = _vertexPool[ face.d ];
-
-						if ( v1.visible && v2.visible && v3.visible && v4.visible ) {
-
-							visible = ( v4.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-								( v4.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ||
-								( v2.positionScreen.x - v3.positionScreen.x ) * ( v4.positionScreen.y - v3.positionScreen.y ) -
-								( v2.positionScreen.y - v3.positionScreen.y ) * ( v4.positionScreen.x - v3.positionScreen.x ) < 0;
-
-
-							if ( object.doubleSided || visible != object.flipSided ) {
-
-								_face = getNextFace4InPool();
-
-								_face.v1.copy( v1 );
-								_face.v2.copy( v2 );
-								_face.v3.copy( v3 );
-								_face.v4.copy( v4 );
-
-							} else {
-
-								continue;
-
-							}
-
-						} else {
-
-							continue;
-
-						}
-
-					}
-
-					_face.normalWorld.copy( face.normal );
-					if ( !visible && ( object.flipSided || object.doubleSided ) ) _face.normalWorld.negate();
-					objectMatrixWorldRotation.multiplyVector3( _face.normalWorld );
-
-					_face.centroidWorld.copy( face.centroid );
-					objectMatrixWorld.multiplyVector3( _face.centroidWorld );
-
-					_face.centroidScreen.copy( _face.centroidWorld );
-					_projScreenMatrix.multiplyVector3( _face.centroidScreen );
-
-					faceVertexNormals = face.vertexNormals;
-
-					for ( n = 0, nl = faceVertexNormals.length; n < nl; n ++ ) {
-
-						normal = _face.vertexNormalsWorld[ n ];
-						normal.copy( faceVertexNormals[ n ] );
-						if ( !visible && ( object.flipSided || object.doubleSided ) ) normal.negate();
-						objectMatrixWorldRotation.multiplyVector3( normal );
-
-					}
-
-					for ( c = 0, cl = faceVertexUvs.length; c < cl; c ++ ) {
-
-						uvs = faceVertexUvs[ c ][ f ];
-
-						if ( !uvs ) continue;
-
-						for ( u = 0, ul = uvs.length; u < ul; u ++ ) {
-
-							_face.uvs[ c ][ u ] = uvs[ u ];
-
-						}
-
-					}
-
-					_face.material = object.material;
-					_face.faceMaterial = face.materialIndex !== null ? geometryMaterials[ face.materialIndex ] : null;
-
-					_face.z = _face.centroidScreen.z;
-
-					_renderData.elements.push( _face );
-
-				}
-
-			} else if ( object instanceof THREE.Line ) {
-
-				_projScreenobjectMatrixWorld.multiply( _projScreenMatrix, objectMatrixWorld );
-
-				vertices = object.geometry.vertices;
-				
-				v1 = getNextVertexInPool();
-				v1.positionScreen.copy( vertices[ 0 ] );
-				_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
-
-				// Handle LineStrip and LinePieces
-				var step = object.type === THREE.LinePieces ? 2 : 1;
-
-				for ( v = 1, vl = vertices.length; v < vl; v ++ ) {
-
-					v1 = getNextVertexInPool();
-					v1.positionScreen.copy( vertices[ v ] );
-					_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
-
-					if ( ( v + 1 ) % step > 0 ) continue;
-
-					v2 = _vertexPool[ _vertexCount - 2 ];
-
-					_clippedVertex1PositionScreen.copy( v1.positionScreen );
-					_clippedVertex2PositionScreen.copy( v2.positionScreen );
-
-					if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) ) {
-
-						// Perform the perspective divide
-						_clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w );
-						_clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w );
-
-						_line = getNextLineInPool();
-						_line.v1.positionScreen.copy( _clippedVertex1PositionScreen );
-						_line.v2.positionScreen.copy( _clippedVertex2PositionScreen );
-
-						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
-
-						_line.material = object.material;
-
-						_renderData.elements.push( _line );
-
-					}
-
-				}
-
-			}
-
-		}
-
-		for ( o = 0, ol = _renderData.sprites.length; o < ol; o++ ) {
-
-			object = _renderData.sprites[ o ].object;
-
-			objectMatrixWorld = object.matrixWorld;
-
-			if ( object instanceof THREE.Particle ) {
-
-				_vector4.set( objectMatrixWorld.elements[12], objectMatrixWorld.elements[13], objectMatrixWorld.elements[14], 1 );
-				_projScreenMatrix.multiplyVector4( _vector4 );
-
-				_vector4.z /= _vector4.w;
-
-				if ( _vector4.z > 0 && _vector4.z < 1 ) {
-
-					_particle = getNextParticleInPool();
-					_particle.x = _vector4.x / _vector4.w;
-					_particle.y = _vector4.y / _vector4.w;
-					_particle.z = _vector4.z;
-
-					_particle.rotation = object.rotation.z;
-
-					_particle.scale.x = object.scale.x * Math.abs( _particle.x - ( _vector4.x + camera.projectionMatrix.elements[0] ) / ( _vector4.w + camera.projectionMatrix.elements[12] ) );
-					_particle.scale.y = object.scale.y * Math.abs( _particle.y - ( _vector4.y + camera.projectionMatrix.elements[5] ) / ( _vector4.w + camera.projectionMatrix.elements[13] ) );
-
-					_particle.material = object.material;
-
-					_renderData.elements.push( _particle );
-
-				}
-
-			}
-
-		}
-
-		sort && _renderData.elements.sort( painterSort );
-
-		return _renderData;
-
-	};
-
-	// Pools
-
-	function getNextObjectInPool() {
-
-		var object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject();
-
-		_objectCount ++;
-
-		return object;
-
-	}
-
-	function getNextVertexInPool() {
-
-		var vertex = _vertexPool[ _vertexCount ] = _vertexPool[ _vertexCount ] || new THREE.RenderableVertex();
-
-		_vertexCount ++;
-
-		return vertex;
-
-	}
-
-	function getNextFace3InPool() {
-
-		var face = _face3Pool[ _face3Count ] = _face3Pool[ _face3Count ] || new THREE.RenderableFace3();
-
-		_face3Count ++;
-
-		return face;
-
-	}
-
-	function getNextFace4InPool() {
-
-		var face = _face4Pool[ _face4Count ] = _face4Pool[ _face4Count ] || new THREE.RenderableFace4();
-
-		_face4Count ++;
-
-		return face;
-
-	}
-
-	function getNextLineInPool() {
-
-		var line = _linePool[ _lineCount ] = _linePool[ _lineCount ] || new THREE.RenderableLine();
-
-		_lineCount ++;
-
-		return line;
-
-	}
-
-	function getNextParticleInPool() {
-
-		var particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle();
-		_particleCount ++;
-		return particle;
-
-	}
-
-	//
-
-	function painterSort( a, b ) {
-
-		return b.z - a.z;
-
-	}
-
-	function clipLine( s1, s2 ) {
-
-		var alpha1 = 0, alpha2 = 1,
-
-		// Calculate the boundary coordinate of each vertex for the near and far clip planes,
-		// Z = -1 and Z = +1, respectively.
-		bc1near =  s1.z + s1.w,
-		bc2near =  s2.z + s2.w,
-		bc1far =  - s1.z + s1.w,
-		bc2far =  - s2.z + s2.w;
-
-		if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) {
-
-			// Both vertices lie entirely within all clip planes.
-			return true;
-
-		} else if ( ( bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0 ) ) {
-
-			// Both vertices lie entirely outside one of the clip planes.
-			return false;
-
-		} else {
-
-			// The line segment spans at least one clip plane.
-
-			if ( bc1near < 0 ) {
-
-				// v1 lies outside the near plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) );
-
-			} else if ( bc2near < 0 ) {
-
-				// v2 lies outside the near plane, v1 inside
-				alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) );
-
-			}
-
-			if ( bc1far < 0 ) {
-
-				// v1 lies outside the far plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) );
-
-			} else if ( bc2far < 0 ) {
-
-				// v2 lies outside the far plane, v2 inside
-				alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) );
-
-			}
-
-			if ( alpha2 < alpha1 ) {
-
-				// The line segment spans two boundaries, but is outside both of them.
-				// (This can't happen when we're only clipping against just near/far but good
-				//  to leave the check here for future usage if other clip planes are added.)
-				return false;
-
-			} else {
-
-				// Update the s1 and s2 vertices to match the clipped line segment.
-				s1.lerpSelf( s2, alpha1 );
-				s2.lerpSelf( s1, 1 - alpha2 );
-
-				return true;
-
-			}
-
-		}
-
-	}
-
-};
-/**
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Quaternion = function( x, y, z, w ) {
-
-	this.x = x || 0;
-	this.y = y || 0;
-	this.z = z || 0;
-	this.w = ( w !== undefined ) ? w : 1;
-
-};
-
-THREE.Quaternion.prototype = {
-
-	constructor: THREE.Quaternion,
-
-	set: function ( x, y, z, w ) {
-
-		this.x = x;
-		this.y = y;
-		this.z = z;
-		this.w = w;
-
-		return this;
-
-	},
-
-	copy: function ( q ) {
-
-		this.x = q.x;
-		this.y = q.y;
-		this.z = q.z;
-		this.w = q.w;
-
-		return this;
-
-	},
-
-	setFromEuler: function ( vector ) {
-
-		var c = Math.PI / 360, // 0.5 * Math.PI / 360, // 0.5 is an optimization
-		x = vector.x * c,
-		y = vector.y * c,
-		z = vector.z * c,
-
-		c1 = Math.cos( y  ),
-		s1 = Math.sin( y  ),
-		c2 = Math.cos( -z ),
-		s2 = Math.sin( -z ),
-		c3 = Math.cos( x  ),
-		s3 = Math.sin( x  ),
-
-		c1c2 = c1 * c2,
-		s1s2 = s1 * s2;
-
-		this.w = c1c2 * c3  - s1s2 * s3;
-	  	this.x = c1c2 * s3  + s1s2 * c3;
-		this.y = s1 * c2 * c3 + c1 * s2 * s3;
-		this.z = c1 * s2 * c3 - s1 * c2 * s3;
-
-		return this;
-
-	},
-
-	setFromAxisAngle: function ( axis, angle ) {
-
-		// from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-		// axis have to be normalized
-
-		var halfAngle = angle / 2,
-			s = Math.sin( halfAngle );
-
-		this.x = axis.x * s;
-		this.y = axis.y * s;
-		this.z = axis.z * s;
-		this.w = Math.cos( halfAngle );
-
-		return this;
-
-	},
-
-	setFromRotationMatrix: function ( m ) {
-
-		// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-
-		function copySign( a, b ) {
-
-			return b < 0 ? -Math.abs( a ) : Math.abs( a );
-
-		}
-
-		var absQ = Math.pow( m.determinant(), 1.0 / 3.0 );
-		this.w = Math.sqrt( Math.max( 0, absQ + m.elements[0] + m.elements[5] + m.elements[10] ) ) / 2;
-		this.x = Math.sqrt( Math.max( 0, absQ + m.elements[0] - m.elements[5] - m.elements[10] ) ) / 2;
-		this.y = Math.sqrt( Math.max( 0, absQ - m.elements[0] + m.elements[5] - m.elements[10] ) ) / 2;
-		this.z = Math.sqrt( Math.max( 0, absQ - m.elements[0] - m.elements[5] + m.elements[10] ) ) / 2;
-		this.x = copySign( this.x, ( m.elements[6] - m.elements[9] ) );
-		this.y = copySign( this.y, ( m.elements[8] - m.elements[2] ) );
-		this.z = copySign( this.z, ( m.elements[1] - m.elements[4] ) );
-		this.normalize();
-
-		return this;
-
-	},
-
-	calculateW : function () {
-
-		this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );
-
-		return this;
-
-	},
-
-	inverse: function () {
-
-		this.x *= -1;
-		this.y *= -1;
-		this.z *= -1;
-
-		return this;
-
-	},
-
-	length: function () {
-
-		return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
-	},
-
-	normalize: function () {
-
-		var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
-		if ( l === 0 ) {
-
-			this.x = 0;
-			this.y = 0;
-			this.z = 0;
-			this.w = 0;
-
-		} else {
-
-			l = 1 / l;
-
-			this.x = this.x * l;
-			this.y = this.y * l;
-			this.z = this.z * l;
-			this.w = this.w * l;
-
-		}
-
-		return this;
-
-	},
-
-	multiply: function ( a, b ) {
-
-		// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-
-		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 ( b ) {
-
-		var qax = this.x, qay = this.y, qaz = this.z, qaw = this.w,
-		qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;
-
-		this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
-		this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
-		this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
-		this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
-		return this;
-
-	},
-
-	multiplyVector3: function ( vector, dest ) {
-
-		if ( !dest ) { dest = vector; }
-
-		var x    = vector.x,  y  = vector.y,  z  = vector.z,
-			qx   = this.x, qy = this.y, qz = this.z, qw = this.w;
-
-		// calculate quat * vector
-
-		var ix =  qw * x + qy * z - qz * y,
-			iy =  qw * y + qz * x - qx * z,
-			iz =  qw * z + qx * y - qy * x,
-			iw = -qx * x - qy * y - qz * z;
-
-		// calculate result * inverse quat
-
-		dest.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
-		dest.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
-		dest.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
-
-		return dest;
-
-	},
-
-	clone: function () {
-
-		return new THREE.Quaternion( this.x, this.y, this.z, this.w );
-
-	}
-
-}
-
-THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
-
-	// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
-	var cosHalfTheta = qa.w * qb.w + qa.x * qb.x + qa.y * qb.y + qa.z * qb.z;
-
-	if (cosHalfTheta < 0) {
-		qm.w = -qb.w; qm.x = -qb.x; qm.y = -qb.y; qm.z = -qb.z;
-		cosHalfTheta = -cosHalfTheta;
-	} else {
-		qm.copy(qb);
-	}
-
-	if ( Math.abs( cosHalfTheta ) >= 1.0 ) {
-
-		qm.w = qa.w; qm.x = qa.x; qm.y = qa.y; qm.z = qa.z;
-		return qm;
-
-	}
-
-	var halfTheta = Math.acos( cosHalfTheta ),
-	sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
-
-	if ( Math.abs( sinHalfTheta ) < 0.001 ) {
-
-		qm.w = 0.5 * ( qa.w + qb.w );
-		qm.x = 0.5 * ( qa.x + qb.x );
-		qm.y = 0.5 * ( qa.y + qb.y );
-		qm.z = 0.5 * ( qa.z + qb.z );
-
-		return qm;
-
-	}
-
-	var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
-	ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
-
-	qm.w = ( qa.w * ratioA + qm.w * ratioB );
-	qm.x = ( qa.x * ratioA + qm.x * ratioB );
-	qm.y = ( qa.y * ratioA + qm.y * ratioB );
-	qm.z = ( qa.z * ratioA + qm.z * ratioB );
-
-	return qm;
-
-}
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Vertex = function () {
-
-	console.warn( 'THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.')
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
-
-	this.a = a;
-	this.b = b;
-	this.c = c;
-
-	this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
-	this.vertexNormals = normal instanceof Array ? normal : [ ];
-
-	this.color = color instanceof THREE.Color ? color : new THREE.Color();
-	this.vertexColors = color instanceof Array ? color : [];
-
-	this.vertexTangents = [];
-
-	this.materialIndex = materialIndex;
-
-	this.centroid = new THREE.Vector3();
-
-};
-
-THREE.Face3.prototype = {
-
-	constructor: THREE.Face3,
-
-	clone: function () {
-
-		var face = new THREE.Face3( this.a, this.b, this.c );
-
-		face.normal.copy( this.normal );
-		face.color.copy( this.color );
-		face.centroid.copy( this.centroid );
-
-		face.materialIndex = this.materialIndex;
-
-		var i, il;
-		for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
-		for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
-		for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
-
-		return face;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
-
-	this.a = a;
-	this.b = b;
-	this.c = c;
-	this.d = d;
-
-	this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
-	this.vertexNormals = normal instanceof Array ? normal : [ ];
-
-	this.color = color instanceof THREE.Color ? color : new THREE.Color();
-	this.vertexColors = color instanceof Array ? color : [];
-
-	this.vertexTangents = [];
-
-	this.materialIndex = materialIndex;
-
-	this.centroid = new THREE.Vector3();
-
-};
-
-THREE.Face4.prototype = {
-
-	constructor: THREE.Face4,
-
-	clone: function () {
-
-		var face = new THREE.Face4( this.a, this.b, this.c, this.d );
-
-		face.normal.copy( this.normal );
-		face.color.copy( this.color );
-		face.centroid.copy( this.centroid );
-
-		face.materialIndex = this.materialIndex;
-
-		var i, il;
-		for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
-		for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
-		for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
-
-		return face;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.UV = function ( u, v ) {
-
-	this.u = u || 0;
-	this.v = v || 0;
-
-};
-
-THREE.UV.prototype = {
-
-	constructor: THREE.UV,
-
-	set: function ( u, v ) {
-
-		this.u = u;
-		this.v = v;
-
-		return this;
-
-	},
-
-	copy: function ( uv ) {
-
-		this.u = uv.u;
-		this.v = uv.v;
-
-		return this;
-
-	},
-
-	lerpSelf: function ( uv, alpha ) {
-
-		this.u += ( uv.u - this.u ) * alpha;
-		this.v += ( uv.v - this.v ) * alpha;
-
-		return this;
-
-	},
-
-	clone: function () {
-
-		return new THREE.UV( this.u, this.v );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author kile / http://kile.stravaganza.org/
- * @author alteredq / http://alteredqualia.com/
- * @author mikael emtinger / http://gomo.se/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- */
-
-THREE.Geometry = function () {
-
-	this.id = THREE.GeometryCount ++;
-
-	this.vertices = [];
-	this.colors = []; // one-to-one vertex colors, used in ParticleSystem, Line and Ribbon
-
-	this.materials = [];
-
-	this.faces = [];
-
-	this.faceUvs = [[]];
-	this.faceVertexUvs = [[]];
-
-	this.morphTargets = [];
-	this.morphColors = [];
-	this.morphNormals = [];
-
-	this.skinWeights = [];
-	this.skinIndices = [];
-
-	this.boundingBox = null;
-	this.boundingSphere = null;
-
-	this.hasTangents = false;
-
-	this.dynamic = false; // unless set to true the *Arrays will be deleted once sent to a buffer.
-
-};
-
-THREE.Geometry.prototype = {
-
-	constructor : THREE.Geometry,
-
-	applyMatrix: function ( matrix ) {
-
-		var matrixRotation = new THREE.Matrix4();
-		matrixRotation.extractRotation( matrix );
-
-		for ( var i = 0, il = this.vertices.length; i < il; i ++ ) {
-
-			var vertex = this.vertices[ i ];
-
-			matrix.multiplyVector3( vertex );
-
-		}
-
-		for ( var i = 0, il = this.faces.length; i < il; i ++ ) {
-
-			var face = this.faces[ i ];
-
-			matrixRotation.multiplyVector3( face.normal );
-
-			for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {
-
-				matrixRotation.multiplyVector3( face.vertexNormals[ j ] );
-
-			}
-
-			matrix.multiplyVector3( face.centroid );
-
-		}
-
-	},
-
-	computeCentroids: function () {
-
-		var f, fl, face;
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-			face.centroid.set( 0, 0, 0 );
-
-			if ( face instanceof THREE.Face3 ) {
-
-				face.centroid.addSelf( this.vertices[ face.a ] );
-				face.centroid.addSelf( this.vertices[ face.b ] );
-				face.centroid.addSelf( this.vertices[ face.c ] );
-				face.centroid.divideScalar( 3 );
-
-			} else if ( face instanceof THREE.Face4 ) {
-
-				face.centroid.addSelf( this.vertices[ face.a ] );
-				face.centroid.addSelf( this.vertices[ face.b ] );
-				face.centroid.addSelf( this.vertices[ face.c ] );
-				face.centroid.addSelf( this.vertices[ face.d ] );
-				face.centroid.divideScalar( 4 );
-
-			}
-
-		}
-
-	},
-
-	computeFaceNormals: function () {
-
-		var n, nl, v, vl, vertex, f, fl, face, vA, vB, vC,
-		cb = new THREE.Vector3(), ab = new THREE.Vector3();
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			vA = this.vertices[ face.a ];
-			vB = this.vertices[ face.b ];
-			vC = this.vertices[ face.c ];
-
-			cb.sub( vC, vB );
-			ab.sub( vA, vB );
-			cb.crossSelf( ab );
-
-			if ( !cb.isZero() ) {
-
-				cb.normalize();
-
-			}
-
-			face.normal.copy( cb );
-
-		}
-
-	},
-
-	computeVertexNormals: function () {
-
-		var v, vl, f, fl, face, vertices;
-
-		// create internal buffers for reuse when calling this method repeatedly
-		// (otherwise memory allocation / deallocation every frame is big resource hog)
-
-		if ( this.__tmpVertices === undefined ) {
-
-			this.__tmpVertices = new Array( this.vertices.length );
-			vertices = this.__tmpVertices;
-
-			for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-				vertices[ v ] = new THREE.Vector3();
-
-			}
-
-			for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-				face = this.faces[ f ];
-
-				if ( face instanceof THREE.Face3 ) {
-
-					face.vertexNormals = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-				} else if ( face instanceof THREE.Face4 ) {
-
-					face.vertexNormals = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-				}
-
-			}
-
-		} else {
-
-			vertices = this.__tmpVertices;
-
-			for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-				vertices[ v ].set( 0, 0, 0 );
-
-			}
-
-		}
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			if ( face instanceof THREE.Face3 ) {
-
-				vertices[ face.a ].addSelf( face.normal );
-				vertices[ face.b ].addSelf( face.normal );
-				vertices[ face.c ].addSelf( face.normal );
-
-			} else if ( face instanceof THREE.Face4 ) {
-
-				vertices[ face.a ].addSelf( face.normal );
-				vertices[ face.b ].addSelf( face.normal );
-				vertices[ face.c ].addSelf( face.normal );
-				vertices[ face.d ].addSelf( face.normal );
-
-			}
-
-		}
-
-		for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-			vertices[ v ].normalize();
-
-		}
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			if ( face instanceof THREE.Face3 ) {
-
-				face.vertexNormals[ 0 ].copy( vertices[ face.a ] );
-				face.vertexNormals[ 1 ].copy( vertices[ face.b ] );
-				face.vertexNormals[ 2 ].copy( vertices[ face.c ] );
-
-			} else if ( face instanceof THREE.Face4 ) {
-
-				face.vertexNormals[ 0 ].copy( vertices[ face.a ] );
-				face.vertexNormals[ 1 ].copy( vertices[ face.b ] );
-				face.vertexNormals[ 2 ].copy( vertices[ face.c ] );
-				face.vertexNormals[ 3 ].copy( vertices[ face.d ] );
-
-			}
-
-		}
-
-	},
-
-	computeMorphNormals: function () {
-
-		var i, il, f, fl, face;
-
-		// save original normals
-		// - create temp variables on first access
-		//   otherwise just copy (for faster repeated calls)
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			if ( ! face.__originalFaceNormal ) {
-
-				face.__originalFaceNormal = face.normal.clone();
-
-			} else {
-
-				face.__originalFaceNormal.copy( face.normal );
-
-			}
-
-			if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = [];
-
-			for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {
-
-				if ( ! face.__originalVertexNormals[ i ] ) {
-
-					face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();
-
-				} else {
-
-					face.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] );
-
-				}
-
-			}
-
-		}
-
-		// use temp geometry to compute face and vertex normals for each morph
-
-		var tmpGeo = new THREE.Geometry();
-		tmpGeo.faces = this.faces;
-
-		for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) {
-
-			// create on first access
-
-			if ( ! this.morphNormals[ i ] ) {
-
-				this.morphNormals[ i ] = {};
-				this.morphNormals[ i ].faceNormals = [];
-				this.morphNormals[ i ].vertexNormals = [];
-
-				var dstNormalsFace = this.morphNormals[ i ].faceNormals;
-				var dstNormalsVertex = this.morphNormals[ i ].vertexNormals;
-
-				var faceNormal, vertexNormals;
-
-				for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-					face = this.faces[ f ];
-
-					faceNormal = new THREE.Vector3();
-
-					if ( face instanceof THREE.Face3 ) {
-
-						vertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3() };
-
-					} else {
-
-						vertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3(), d: new THREE.Vector3() };
-
-					}
-
-					dstNormalsFace.push( faceNormal );
-					dstNormalsVertex.push( vertexNormals );
-
-				}
-
-			}
-
-			var morphNormals = this.morphNormals[ i ];
-
-			// set vertices to morph target
-
-			tmpGeo.vertices = this.morphTargets[ i ].vertices;
-
-			// compute morph normals
-
-			tmpGeo.computeFaceNormals();
-			tmpGeo.computeVertexNormals();
-
-			// store morph normals
-
-			var faceNormal, vertexNormals;
-
-			for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-				face = this.faces[ f ];
-
-				faceNormal = morphNormals.faceNormals[ f ];
-				vertexNormals = morphNormals.vertexNormals[ f ];
-
-				faceNormal.copy( face.normal );
-
-				if ( face instanceof THREE.Face3 ) {
-
-					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
-					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
-					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
-
-				} else {
-
-					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
-					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
-					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
-					vertexNormals.d.copy( face.vertexNormals[ 3 ] );
-
-				}
-
-			}
-
-		}
-
-		// restore original normals
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			face.normal = face.__originalFaceNormal;
-			face.vertexNormals = face.__originalVertexNormals;
-
-		}
-
-	},
-
-	computeTangents: function () {
-
-		// based on http://www.terathon.com/code/tangent.html
-		// tangents go to vertices
-
-		var f, fl, v, vl, i, il, vertexIndex,
-			face, uv, vA, vB, vC, uvA, uvB, uvC,
-			x1, x2, y1, y2, z1, z2,
-			s1, s2, t1, t2, r, t, test,
-			tan1 = [], tan2 = [],
-			sdir = new THREE.Vector3(), tdir = new THREE.Vector3(),
-			tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(),
-			n = new THREE.Vector3(), w;
-
-		for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-			tan1[ v ] = new THREE.Vector3();
-			tan2[ v ] = new THREE.Vector3();
-
-		}
-
-		function handleTriangle( context, a, b, c, ua, ub, uc ) {
-
-			vA = context.vertices[ a ];
-			vB = context.vertices[ b ];
-			vC = context.vertices[ c ];
-
-			uvA = uv[ ua ];
-			uvB = uv[ ub ];
-			uvC = uv[ uc ];
-
-			x1 = vB.x - vA.x;
-			x2 = vC.x - vA.x;
-			y1 = vB.y - vA.y;
-			y2 = vC.y - vA.y;
-			z1 = vB.z - vA.z;
-			z2 = vC.z - vA.z;
-
-			s1 = uvB.u - uvA.u;
-			s2 = uvC.u - uvA.u;
-			t1 = uvB.v - uvA.v;
-			t2 = uvC.v - uvA.v;
-
-			r = 1.0 / ( s1 * t2 - s2 * t1 );
-			sdir.set( ( t2 * x1 - t1 * x2 ) * r,
-					  ( t2 * y1 - t1 * y2 ) * r,
-					  ( t2 * z1 - t1 * z2 ) * r );
-			tdir.set( ( s1 * x2 - s2 * x1 ) * r,
-					  ( s1 * y2 - s2 * y1 ) * r,
-					  ( s1 * z2 - s2 * z1 ) * r );
-
-			tan1[ a ].addSelf( sdir );
-			tan1[ b ].addSelf( sdir );
-			tan1[ c ].addSelf( sdir );
-
-			tan2[ a ].addSelf( tdir );
-			tan2[ b ].addSelf( tdir );
-			tan2[ c ].addSelf( tdir );
-
-		}
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-			uv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents
-
-			if ( face instanceof THREE.Face3 ) {
-
-				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
-
-			} else if ( face instanceof THREE.Face4 ) {
-
-				handleTriangle( this, face.a, face.b, face.d, 0, 1, 3 );
-				handleTriangle( this, face.b, face.c, face.d, 1, 2, 3 );
-
-			}
-
-		}
-
-		var faceIndex = [ 'a', 'b', 'c', 'd' ];
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			for ( i = 0; i < face.vertexNormals.length; i++ ) {
-
-				n.copy( face.vertexNormals[ i ] );
-
-				vertexIndex = face[ faceIndex[ i ] ];
-
-				t = tan1[ vertexIndex ];
-
-				// Gram-Schmidt orthogonalize
-
-				tmp.copy( t );
-				tmp.subSelf( n.multiplyScalar( n.dot( t ) ) ).normalize();
-
-				// Calculate handedness
-
-				tmp2.cross( face.vertexNormals[ i ], t );
-				test = tmp2.dot( tan2[ vertexIndex ] );
-				w = (test < 0.0) ? -1.0 : 1.0;
-
-				face.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w );
-
-			}
-
-		}
-
-		this.hasTangents = true;
-
-	},
-
-	computeBoundingBox: function () {
-
-		if ( ! this.boundingBox ) {
-
-			this.boundingBox = { min: new THREE.Vector3(), max: new THREE.Vector3() };
-
-		}
-
-		if ( this.vertices.length > 0 ) {
-
-			var position, firstPosition = this.vertices[ 0 ];
-
-			this.boundingBox.min.copy( firstPosition );
-			this.boundingBox.max.copy( firstPosition );
-
-			var min = this.boundingBox.min,
-				max = this.boundingBox.max;
-
-			for ( var v = 1, vl = this.vertices.length; v < vl; v ++ ) {
-
-				position = this.vertices[ v ];
-
-				if ( position.x < min.x ) {
-
-					min.x = position.x;
-
-				} else if ( position.x > max.x ) {
-
-					max.x = position.x;
-
-				}
-
-				if ( position.y < min.y ) {
-
-					min.y = position.y;
-
-				} else if ( position.y > max.y ) {
-
-					max.y = position.y;
-
-				}
-
-				if ( position.z < min.z ) {
-
-					min.z = position.z;
-
-				} else if ( position.z > max.z ) {
-
-					max.z = position.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 };
-
-		var radius, maxRadius = 0;
-
-		for ( var v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-			radius = this.vertices[ v ].length();
-			if ( radius > maxRadius ) maxRadius = radius;
-
-		}
-
-		this.boundingSphere.radius = maxRadius;
-
-	},
-
-	/*
-	 * Checks for duplicate vertices with hashmap.
-	 * Duplicated vertices are removed
-	 * and faces' vertices are updated.
-	 */
-
-	mergeVertices: function() {
-
-		var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique)
-		var unique = [], changes = [];
-
-		var v, key;
-		var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
-		var precision = Math.pow( 10, precisionPoints );
-		var i,il, face;
-
-		for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
-
-			v = this.vertices[ i ];
-			key = [ Math.round( v.x * precision ), Math.round( v.y * precision ), Math.round( v.z * precision ) ].join( '_' );
-
-			if ( verticesMap[ key ] === undefined ) {
-
-				verticesMap[ key ] = i;
-				unique.push( this.vertices[ i ] );
-				changes[ i ] = unique.length - 1;
-
-			} else {
-
-				//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
-				changes[ i ] = changes[ verticesMap[ key ] ];
-
-			}
-
-		};
-
-
-		// Start to patch face indices
-
-		for( i = 0, il = this.faces.length; i < il; i ++ ) {
-
-			face = this.faces[ i ];
-
-			if ( face instanceof THREE.Face3 ) {
-
-				face.a = changes[ face.a ];
-				face.b = changes[ face.b ];
-				face.c = changes[ face.c ];
-
-			} else if ( face instanceof THREE.Face4 ) {
-
-				face.a = changes[ face.a ];
-				face.b = changes[ face.b ];
-				face.c = changes[ face.c ];
-				face.d = changes[ face.d ];
-
-			}
-
-		}
-
-		// Use unique set of vertices
-
-		this.vertices = unique;
-
-	}
-
-};
-
-THREE.GeometryCount = 0;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author mikael emtinger / http://gomo.se/
- */
-
-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 = new THREE.Object3D();
-THREE.Camera.prototype.constructor = THREE.Camera;
-
-THREE.Camera.prototype.lookAt = function ( vector ) {
-
-	// TODO: Add hierarchy support.
-
-	this.matrix.lookAt( this.position, vector, this.up );
-
-	if ( this.rotationAutoUpdate ) {
-
-		this.rotation.getRotationFromMatrix( this.matrix );
-
-	}
-
-};
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {
-
-	THREE.Camera.call( this );
-
-	this.left = left;
-	this.right = right;
-	this.top = top;
-	this.bottom = bottom;
-
-	this.near = ( near !== undefined ) ? near : 0.1;
-	this.far = ( far !== undefined ) ? far : 2000;
-
-	this.updateProjectionMatrix();
-
-};
-
-THREE.OrthographicCamera.prototype = new THREE.Camera();
-THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;
-
-THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
-
-	this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far );
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author greggman / http://games.greggman.com/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- */
-
-THREE.PerspectiveCamera = function ( fov, aspect, near, far ) {
-
-	THREE.Camera.call( this );
-
-	this.fov = fov !== undefined ? fov : 50;
-	this.aspect = aspect !== undefined ? aspect : 1;
-	this.near = near !== undefined ? near : 0.1;
-	this.far = far !== undefined ? far : 2000;
-
-	this.updateProjectionMatrix();
-
-};
-
-THREE.PerspectiveCamera.prototype = new THREE.Camera();
-THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;
-
-
-/**
- * Uses Focal Length (in mm) to estimate and set FOV
- * 35mm (fullframe) camera is used if frame size is not specified;
- * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
- */
-
-THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {
-
-	frameHeight = frameHeight !== undefined ? frameHeight : 24;
-
-	this.fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );
-	this.updateProjectionMatrix();
-
-}
-
-
-/**
- * Sets an offset in a larger frustum. This is useful for multi-window or
- * multi-monitor/multi-machine setups.
- *
- * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
- * the monitors are in grid like this
- *
- *   +---+---+---+
- *   | A | B | C |
- *   +---+---+---+
- *   | D | E | F |
- *   +---+---+---+
- *
- * then for each monitor you would call it like this
- *
- *   var w = 1920;
- *   var h = 1080;
- *   var fullWidth = w * 3;
- *   var fullHeight = h * 2;
- *
- *   --A--
- *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
- *   --B--
- *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
- *   --C--
- *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
- *   --D--
- *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
- *   --E--
- *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
- *   --F--
- *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
- *
- *   Note there is no reason monitors have to be the same size or in a grid.
- */
-
-THREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) {
-
-	this.fullWidth = fullWidth;
-	this.fullHeight = fullHeight;
-	this.x = x;
-	this.y = y;
-	this.width = width;
-	this.height = height;
-
-	this.updateProjectionMatrix();
-
-};
-
-
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
-
-	if ( this.fullWidth ) {
-
-		var aspect = this.fullWidth / this.fullHeight;
-		var top = Math.tan( this.fov * Math.PI / 360 ) * this.near;
-		var bottom = -top;
-		var left = aspect * bottom;
-		var right = aspect * top;
-		var width = Math.abs( right - left );
-		var height = Math.abs( top - bottom );
-
-		this.projectionMatrix.makeFrustum(
-			left + this.x * width / this.fullWidth,
-			left + ( this.x + this.width ) * width / this.fullWidth,
-			top - ( this.y + this.height ) * height / this.fullHeight,
-			top - this.y * height / this.fullHeight,
-			this.near,
-			this.far
-		);
-
-	} else {
-
-		this.projectionMatrix.makePerspective( this.fov, this.aspect, this.near, this.far );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
- 
-THREE.Light = function ( hex ) {
-
-	THREE.Object3D.call( this );
-
-	this.color = new THREE.Color( hex );
-
-};
-
-THREE.Light.prototype = new THREE.Object3D();
-THREE.Light.prototype.constructor = THREE.Light;
-THREE.Light.prototype.supr = THREE.Object3D.prototype;
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.AmbientLight = function ( hex ) {
-
-	THREE.Light.call( this, hex );
-
-};
-
-THREE.AmbientLight.prototype = new THREE.Light();
-THREE.AmbientLight.prototype.constructor = THREE.AmbientLight; 
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.DirectionalLight = function ( hex, intensity, distance ) {
-
-	THREE.Light.call( this, hex );
-
-	this.position = new THREE.Vector3( 0, 1, 0 );
-	this.target = new THREE.Object3D();
-
-	this.intensity = ( intensity !== undefined ) ? intensity : 1;
-	this.distance = ( distance !== undefined ) ? distance : 0;
-
-	this.castShadow = false;
-	this.onlyShadow = false;
-
-	//
-
-	this.shadowCameraNear = 50;
-	this.shadowCameraFar = 5000;
-
-	this.shadowCameraLeft = -500;
-	this.shadowCameraRight = 500;
-	this.shadowCameraTop = 500;
-	this.shadowCameraBottom = -500;
-
-	this.shadowCameraVisible = false;
-
-	this.shadowBias = 0;
-	this.shadowDarkness = 0.5;
-
-	this.shadowMapWidth = 512;
-	this.shadowMapHeight = 512;
-
-	//
-
-	this.shadowCascade = false;
-
-	this.shadowCascadeOffset = new THREE.Vector3( 0, 0, -1000 );
-	this.shadowCascadeCount = 2;
-
-	this.shadowCascadeBias = [ 0, 0, 0 ];
-	this.shadowCascadeWidth = [ 512, 512, 512 ];
-	this.shadowCascadeHeight = [ 512, 512, 512 ];
-
-	this.shadowCascadeNearZ = [ -1.000, 0.990, 0.998 ];
-	this.shadowCascadeFarZ  = [  0.990, 0.998, 1.000 ];
-
-	this.shadowCascadeArray = [];
-
-	//
-
-	this.shadowMap = null;
-	this.shadowMapSize = null;
-	this.shadowCamera = null;
-	this.shadowMatrix = null;
-
-};
-
-THREE.DirectionalLight.prototype = new THREE.Light();
-THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight;
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.PointLight = function ( hex, intensity, distance ) {
-
-	THREE.Light.call( this, hex );
-
-	this.position = new THREE.Vector3( 0, 0, 0 );
-	this.intensity = ( intensity !== undefined ) ? intensity : 1;
-	this.distance = ( distance !== undefined ) ? distance : 0;
-
-};
-
-THREE.PointLight.prototype = new THREE.Light();
-THREE.PointLight.prototype.constructor = THREE.PointLight;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Material = function ( parameters ) {
-
-	parameters = parameters || {};
-
-	this.id = THREE.MaterialCount ++;
-
-	this.name = '';
-
-	this.opacity = parameters.opacity !== undefined ? parameters.opacity : 1;
-	this.transparent = parameters.transparent !== undefined ? parameters.transparent : false;
-
-	this.blending = parameters.blending !== undefined ? parameters.blending : THREE.NormalBlending;
-
-	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
-	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
-	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
-
-	this.depthTest = parameters.depthTest !== undefined ? parameters.depthTest : true;
-	this.depthWrite = parameters.depthWrite !== undefined ? parameters.depthWrite : true;
-
-	this.polygonOffset = parameters.polygonOffset !== undefined ? parameters.polygonOffset : false;
-	this.polygonOffsetFactor = parameters.polygonOffsetFactor !== undefined ? parameters.polygonOffsetFactor : 0;
-	this.polygonOffsetUnits = parameters.polygonOffsetUnits !== undefined ? parameters.polygonOffsetUnits : 0;
-
-	this.alphaTest = parameters.alphaTest !== undefined ? parameters.alphaTest : 0;
-
-	this.overdraw = parameters.overdraw !== undefined ? parameters.overdraw : false; // Boolean for fixing antialiasing gaps in CanvasRenderer
-
-	this.needsUpdate = true;
-
-}
-
-THREE.MaterialCount = 0;
-
-// shading
-
-THREE.NoShading = 0;
-THREE.FlatShading = 1;
-THREE.SmoothShading = 2;
-
-// colors
-
-THREE.NoColors = 0;
-THREE.FaceColors = 1;
-THREE.VertexColors = 2;
-
-// blending modes
-
-THREE.NoBlending = 0;
-THREE.NormalBlending = 1;
-THREE.AdditiveBlending = 2;
-THREE.SubtractiveBlending = 3;
-THREE.MultiplyBlending = 4;
-THREE.AdditiveAlphaBlending = 5;
-THREE.CustomBlending = 6;
-
-// custom blending equations
-// (numbers start from 100 not to clash with other
-//  mappings to OpenGL constants defined in Texture.js)
-
-THREE.AddEquation = 100;
-THREE.SubtractEquation = 101;
-THREE.ReverseSubtractEquation = 102;
-
-// custom blending destination factors
-
-THREE.ZeroFactor = 200;
-THREE.OneFactor = 201;
-THREE.SrcColorFactor = 202;
-THREE.OneMinusSrcColorFactor = 203;
-THREE.SrcAlphaFactor = 204;
-THREE.OneMinusSrcAlphaFactor = 205;
-THREE.DstAlphaFactor = 206;
-THREE.OneMinusDstAlphaFactor = 207;
-
-// custom blending source factors
-
-//THREE.ZeroFactor = 200;
-//THREE.OneFactor = 201;
-//THREE.SrcAlphaFactor = 204;
-//THREE.OneMinusSrcAlphaFactor = 205;
-//THREE.DstAlphaFactor = 206;
-//THREE.OneMinusDstAlphaFactor = 207;
-THREE.DstColorFactor = 208;
-THREE.OneMinusDstColorFactor = 209;
-THREE.SrcAlphaSaturateFactor = 210;
-
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  linewidth: <float>,
- *  linecap: "round",
- *  linejoin: "round",
- *
- *  vertexColors: <bool>
- *
- *  fog: <bool>
- * }
- */
-
-THREE.LineBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.linewidth = parameters.linewidth !== undefined ? parameters.linewidth : 1;
-	this.linecap = parameters.linecap !== undefined ? parameters.linecap : 'round';
-	this.linejoin = parameters.linejoin !== undefined ? parameters.linejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors ? parameters.vertexColors : false;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-};
-
-THREE.LineBasicMaterial.prototype = new THREE.Material();
-THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *  map: new THREE.Texture( <Image> ),
- *
- *  lightMap: new THREE.Texture( <Image> ),
- *
- *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
- *  combine: THREE.Multiply,
- *  reflectivity: <float>,
- *  refractionRatio: <float>,
- *
- *  shading: THREE.SmoothShading,
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
- *
- *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
- *
- *  skinning: <bool>,
- *  morphTargets: <bool>,
- *
- *	fog: <bool>
- * }
- */
-
-THREE.MeshBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	// color property represents emissive for MeshBasicMaterial
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
-
-	this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
-	this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
-	this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
-	this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
-
-	this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
-	this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
-	this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : THREE.NoColors;
-
-	this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
-	this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
-
-};
-
-THREE.MeshBasicMaterial.prototype = new THREE.Material();
-THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  ambient: <hex>,
- *  emissive: <hex>,
- *  opacity: <float>,
- *
- *  map: new THREE.Texture( <Image> ),
- *
- *  lightMap: new THREE.Texture( <Image> ),
- *
- *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
- *  combine: THREE.Multiply,
- *  reflectivity: <float>,
- *  refractionRatio: <float>,
- *
- *  shading: THREE.SmoothShading,
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
- *
- *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
- *
- *  skinning: <bool>,
- *  morphTargets: <bool>,
- *  morphNormals: <bool>,
- *
- *	fog: <bool>
- * }
- */
-
-THREE.MeshLambertMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	// color property represents diffuse for MeshLambertMaterial
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-	this.ambient = parameters.ambient !== undefined ? new THREE.Color( parameters.ambient ) : new THREE.Color( 0xffffff );
-	this.emissive = parameters.emissive !== undefined ? new THREE.Color( parameters.emissive ) : new THREE.Color( 0x000000 );
-
-	this.wrapAround = parameters.wrapAround !== undefined ? parameters.wrapAround: false;
-	this.wrapRGB = new THREE.Vector3( 1, 1, 1 );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
-
-	this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
-	this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
-	this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
-	this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
-
-	this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
-	this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
-	this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : THREE.NoColors;
-
-	this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
-	this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
-	this.morphNormals = parameters.morphNormals !== undefined ? parameters.morphNormals : false;
-
-};
-
-THREE.MeshLambertMaterial.prototype = new THREE.Material();
-THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  ambient: <hex>,
- *  emissive: <hex>,
- *  specular: <hex>,
- *  shininess: <float>,
- *  opacity: <float>,
- *
- *  map: new THREE.Texture( <Image> ),
- *
- *  lightMap: new THREE.Texture( <Image> ),
- *
- *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
- *  combine: THREE.Multiply,
- *  reflectivity: <float>,
- *  refractionRatio: <float>,
- *
- *  shading: THREE.SmoothShading,
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
- *
- *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
- *
- *  skinning: <bool>,
- *  morphTargets: <bool>,
- *  morphNormals: <bool>,
- *
- *	fog: <bool>
- * }
- */
-
-THREE.MeshPhongMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	// color property represents diffuse for MeshPhongMaterial
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-	this.ambient = parameters.ambient !== undefined ? new THREE.Color( parameters.ambient ) : new THREE.Color( 0xffffff );
-	this.emissive = parameters.emissive !== undefined ? new THREE.Color( parameters.emissive ) : new THREE.Color( 0x000000 );
-	this.specular = parameters.specular !== undefined ? new THREE.Color( parameters.specular ) : new THREE.Color( 0x111111 );
-	this.shininess = parameters.shininess !== undefined ? parameters.shininess : 30;
-
-	this.metal = parameters.metal !== undefined ? parameters.metal : false;
-	this.perPixel = parameters.perPixel !== undefined ? parameters.perPixel : false;
-
-	this.wrapAround = parameters.wrapAround !== undefined ? parameters.wrapAround: false;
-	this.wrapRGB = new THREE.Vector3( 1, 1, 1 );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
-
-	this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
-	this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
-	this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
-	this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
-
-	this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
-	this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
-	this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : THREE.NoColors;
-
-	this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
-	this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
-	this.morphNormals = parameters.morphNormals !== undefined ? parameters.morphNormals : false;
-
-};
-
-THREE.MeshPhongMaterial.prototype = new THREE.Material();
-THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  opacity: <float>,
- 
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- 
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>
- * } 
- */
-
-THREE.MeshDepthMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading; // doesn't really apply here, normals are not used
-
-	this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
-
-};
-
-THREE.MeshDepthMaterial.prototype = new THREE.Material();
-THREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- *
- * parameters = {
- *  opacity: <float>,
- 
- *  shading: THREE.FlatShading,
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- 
- *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>
- * }
- */
-
-THREE.MeshNormalMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.shading = parameters.shading ? parameters.shading : THREE.FlatShading;
-
-	this.wireframe = parameters.wireframe ? parameters.wireframe : false;
-	this.wireframeLinewidth = parameters.wireframeLinewidth ? parameters.wireframeLinewidth : 1;
-
-};
-
-THREE.MeshNormalMaterial.prototype = new THREE.Material();
-THREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.MeshFaceMaterial = function () {
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- *
- * parameters = {
- *  color: <hex>,
- *  opacity: <float>,
- *  map: new THREE.Texture( <Image> ),
- *
- *  size: <float>,
- *
- *  blending: THREE.NormalBlending,
- *  depthTest: <bool>,
- *
- *  vertexColors: <bool>,
- *
- *  fog: <bool>
- * }
- */
-
-THREE.ParticleBasicMaterial = function ( parameters ) {
-
-	THREE.Material.call( this, parameters );
-
-	parameters = parameters || {};
-
-	this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-
-	this.map = parameters.map !== undefined ? parameters.map : null;
-
-	this.size = parameters.size !== undefined ? parameters.size : 1;
-	this.sizeAttenuation = parameters.sizeAttenuation !== undefined ? parameters.sizeAttenuation : true;
-
-	this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
-
-	this.fog = parameters.fog !== undefined ? parameters.fog : true;
-
-};
-
-THREE.ParticleBasicMaterial.prototype = new THREE.Material();
-THREE.ParticleBasicMaterial.prototype.constructor = THREE.ParticleBasicMaterial;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- * @author szimek / https://github.com/szimek/
- */
-
-THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type ) {
-
-	this.id = THREE.TextureCount ++;
-
-	this.image = image;
-
-	this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
-
-	this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;
-	this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;
-
-	this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
-	this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
-
-	this.format = format !== undefined ? format : THREE.RGBAFormat;
-	this.type = type !== undefined ? type : THREE.UnsignedByteType;
-
-	this.offset = new THREE.Vector2( 0, 0 );
-	this.repeat = new THREE.Vector2( 1, 1 );
-
-	this.generateMipmaps = true;
-	this.premultiplyAlpha = false;
-
-	this.needsUpdate = false;
-	this.onUpdate = null;
-
-};
-
-THREE.Texture.prototype = {
-
-	constructor: THREE.Texture,
-
-	clone: function () {
-
-		var clonedTexture = new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter, this.format, this.type );
-
-		clonedTexture.offset.copy( this.offset );
-		clonedTexture.repeat.copy( this.repeat );
-
-		return clonedTexture;
-
-	}
-
-};
-
-THREE.TextureCount = 0;
-
-THREE.MultiplyOperation = 0;
-THREE.MixOperation = 1;
-
-// Mapping modes
-
-THREE.UVMapping = function () {};
-
-THREE.CubeReflectionMapping = function () {};
-THREE.CubeRefractionMapping = function () {};
-
-THREE.SphericalReflectionMapping = function () {};
-THREE.SphericalRefractionMapping = function () {};
-
-// Wrapping modes
-
-THREE.RepeatWrapping = 0;
-THREE.ClampToEdgeWrapping = 1;
-THREE.MirroredRepeatWrapping = 2;
-
-// Filters
-
-THREE.NearestFilter = 3;
-THREE.NearestMipMapNearestFilter = 4;
-THREE.NearestMipMapLinearFilter = 5;
-THREE.LinearFilter = 6;
-THREE.LinearMipMapNearestFilter = 7;
-THREE.LinearMipMapLinearFilter = 8;
-
-// Types
-
-THREE.ByteType = 9;
-THREE.UnsignedByteType = 10;
-THREE.ShortType = 11;
-THREE.UnsignedShortType = 12;
-THREE.IntType = 13;
-THREE.UnsignedIntType = 14;
-THREE.FloatType = 15;
-
-// Formats
-
-THREE.AlphaFormat = 16;
-THREE.RGBFormat = 17;
-THREE.RGBAFormat = 18;
-THREE.LuminanceFormat = 19;
-THREE.LuminanceAlphaFormat = 20;
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter ) {
-
-	THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type );
-
-	this.image = { data: data, width: width, height: height };
-
-};
-
-THREE.DataTexture.prototype = new THREE.Texture();
-THREE.DataTexture.prototype.constructor = THREE.DataTexture;
-
-THREE.DataTexture.prototype.clone = function () {
-
-	var clonedTexture = new THREE.DataTexture( this.image.data,  this.image.width, this.image.height, this.format, this.type, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter );
-
-	clonedTexture.offset.copy( this.offset );
-	clonedTexture.repeat.copy( this.repeat );
-
-	return clonedTexture;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Particle = function ( material ) {
-
-	THREE.Object3D.call( this );
-
-	this.material = material;
-
-};
-
-THREE.Particle.prototype = new THREE.Object3D();
-THREE.Particle.prototype.constructor = THREE.Particle;
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Line = function ( geometry, material, type ) {
-
-	THREE.Object3D.call( this );
-
-	this.geometry = geometry;
-	this.material = ( material !== undefined ) ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } );
-	this.type = ( type !== undefined ) ? type : THREE.LineStrip;
-
-	if ( this.geometry ) {
-
-		if ( ! this.geometry.boundingSphere ) {
-
-			this.geometry.computeBoundingSphere();
-
-		}
-
-	}
-
-};
-
-THREE.LineStrip = 0;
-THREE.LinePieces = 1;
-
-THREE.Line.prototype = new THREE.Object3D();
-THREE.Line.prototype.constructor = THREE.Line;
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- * @author mikael emtinger / http://gomo.se/
- */
-
-THREE.Mesh = function ( geometry, material ) {
-
-	THREE.Object3D.call( this );
-
-	this.geometry = geometry;
-	this.material = ( material !== undefined ) ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
-
-	if ( this.geometry ) {
-
-		// calc bound radius
-
-		if( ! this.geometry.boundingSphere ) {
-
-			this.geometry.computeBoundingSphere();
-
-		}
-
-		this.boundRadius = geometry.boundingSphere.radius;
-
-
-		// setup morph targets
-
-		if( this.geometry.morphTargets.length ) {
-
-			this.morphTargetBase = -1;
-			this.morphTargetForcedOrder = [];
-			this.morphTargetInfluences = [];
-			this.morphTargetDictionary = {};
-
-			for( var m = 0; m < this.geometry.morphTargets.length; m ++ ) {
-
-				this.morphTargetInfluences.push( 0 );
-				this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m;
-
-			}
-
-		}
-
-	}
-
-}
-
-THREE.Mesh.prototype = new THREE.Object3D();
-THREE.Mesh.prototype.constructor = THREE.Mesh;
-THREE.Mesh.prototype.supr = THREE.Object3D.prototype;
-
-
-/*
- * Get Morph Target Index by Name
- */
-
-THREE.Mesh.prototype.getMorphTargetIndexByName = function( name ) {
-
-	if ( this.morphTargetDictionary[ name ] !== undefined ) {
-
-		return this.morphTargetDictionary[ name ];
-	}
-
-	console.log( "THREE.Mesh.getMorphTargetIndexByName: morph target " + name + " does not exist. Returning 0." );
-	return 0;
-
-}
-/**
- * @author mikael emtinger / http://gomo.se/
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.Bone = function( belongsToSkin ) {
-
-	THREE.Object3D.call( this );
-
-	this.skin = belongsToSkin;
-	this.skinMatrix = new THREE.Matrix4();
-
-};
-
-THREE.Bone.prototype = new THREE.Object3D();
-THREE.Bone.prototype.constructor = THREE.Bone;
-THREE.Bone.prototype.supr = THREE.Object3D.prototype;
-
-
-THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate ) {
-
-	// update local
-
-	if ( this.matrixAutoUpdate ) {
-
-		forceUpdate |= this.updateMatrix();
-
-	}
-
-	// update skin matrix
-
-	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
-
-		if( parentSkinMatrix ) {
-
-			this.skinMatrix.multiply( parentSkinMatrix, this.matrix );
-
-		} else {
-
-			this.skinMatrix.copy( this.matrix );
-
-		}
-
-		this.matrixWorldNeedsUpdate = false;
-		forceUpdate = true;
-
-	}
-
-	// update children
-
-	var child, i, l = this.children.length;
-
-	for ( i = 0; i < l; i ++ ) {
-
-		this.children[ i ].update( this.skinMatrix, forceUpdate );
-
-	}
-
-};
-
-/**
- * @author mikael emtinger / http://gomo.se/
- */
-
-THREE.Sprite = function ( parameters ) {
-
-	THREE.Object3D.call( this );
-
-	this.color = ( parameters.color !== undefined ) ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
-	this.map = ( parameters.map !== undefined ) ? parameters.map : new THREE.Texture();
-
-	this.blending = ( parameters.blending !== undefined ) ? parameters.blending : THREE.NormalBlending;
-
-	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
-	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
-	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
-
-	this.useScreenCoordinates = ( parameters.useScreenCoordinates !== undefined ) ? parameters.useScreenCoordinates : true;
-	this.mergeWith3D = ( parameters.mergeWith3D !== undefined ) ? parameters.mergeWith3D : !this.useScreenCoordinates;
-	this.affectedByDistance = ( parameters.affectedByDistance !== undefined ) ? parameters.affectedByDistance : !this.useScreenCoordinates;
-	this.scaleByViewport = ( parameters.scaleByViewport !== undefined ) ? parameters.scaleByViewport : !this.affectedByDistance;
-	this.alignment = ( parameters.alignment instanceof THREE.Vector2 ) ? parameters.alignment : THREE.SpriteAlignment.center;
-
-	this.rotation3d = this.rotation;
-	this.rotation = 0;
-	this.opacity = 1;
-
-	this.uvOffset = new THREE.Vector2( 0, 0 );
-	this.uvScale  = new THREE.Vector2( 1, 1 );
-
-};
-
-THREE.Sprite.prototype = new THREE.Object3D();
-THREE.Sprite.prototype.constructor = THREE.Sprite;
-
-
-/*
- * Custom update matrix
- */
-
-THREE.Sprite.prototype.updateMatrix = function () {
-
-	this.matrix.setPosition( this.position );
-
-	this.rotation3d.set( 0, 0, this.rotation );
-	this.matrix.setRotationFromEuler( this.rotation3d );
-
-	if ( this.scale.x !== 1 || this.scale.y !== 1 ) {
-
-		this.matrix.scale( this.scale );
-		this.boundRadiusScale = Math.max( this.scale.x, this.scale.y );
-
-	}
-
-	this.matrixWorldNeedsUpdate = true;
-
-};
-
-/*
- * Alignment
- */
-
-THREE.SpriteAlignment = {};
-THREE.SpriteAlignment.topLeft = new THREE.Vector2( 1, -1 );
-THREE.SpriteAlignment.topCenter = new THREE.Vector2( 0, -1 );
-THREE.SpriteAlignment.topRight = new THREE.Vector2( -1, -1 );
-THREE.SpriteAlignment.centerLeft = new THREE.Vector2( 1, 0 );
-THREE.SpriteAlignment.center = new THREE.Vector2( 0, 0 );
-THREE.SpriteAlignment.centerRight = new THREE.Vector2( -1, 0 );
-THREE.SpriteAlignment.bottomLeft = new THREE.Vector2( 1, 1 );
-THREE.SpriteAlignment.bottomCenter = new THREE.Vector2( 0, 1 );
-THREE.SpriteAlignment.bottomRight = new THREE.Vector2( -1, 1 );
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Scene = function () {
-
-	THREE.Object3D.call( this );
-
-	this.fog = null;
-	this.overrideMaterial = null;
-
-	this.matrixAutoUpdate = false;
-
-	this.__objects = [];
-	this.__lights = [];
-
-	this.__objectsAdded = [];
-	this.__objectsRemoved = [];
-
-};
-
-THREE.Scene.prototype = new THREE.Object3D();
-THREE.Scene.prototype.constructor = THREE.Scene;
-
-THREE.Scene.prototype.__addObject = function ( object ) {
-
-	if ( object instanceof THREE.Light ) {
-
-		if ( this.__lights.indexOf( object ) === - 1 ) {
-
-			this.__lights.push( object );
-
-		}
-
-	} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
-
-		if ( this.__objects.indexOf( object ) === - 1 ) {
-
-			this.__objects.push( object );
-			this.__objectsAdded.push( object );
-
-			// check if previously removed
-
-			var i = this.__objectsRemoved.indexOf( object );
-
-			if ( i !== -1 ) {
-
-				this.__objectsRemoved.splice( i, 1 );
-
-			}
-
-		}
-
-	}
-
-	for ( var c = 0; c < object.children.length; c ++ ) {
-
-		this.__addObject( object.children[ c ] );
-
-	}
-
-};
-
-THREE.Scene.prototype.__removeObject = function ( object ) {
-
-	if ( object instanceof THREE.Light ) {
-
-		var i = this.__lights.indexOf( object );
-
-		if ( i !== -1 ) {
-
-			this.__lights.splice( i, 1 );
-
-		}
-
-	} else if ( !( object instanceof THREE.Camera ) ) {
-
-		var i = this.__objects.indexOf( object );
-
-		if( i !== -1 ) {
-
-			this.__objects.splice( i, 1 );
-			this.__objectsRemoved.push( object );
-
-			// check if previously added
-
-			var ai = this.__objectsAdded.indexOf( object );
-
-			if ( ai !== -1 ) {
-
-				this.__objectsAdded.splice( ai, 1 );
-
-			}
-
-		}
-
-	}
-
-	for ( var c = 0; c < object.children.length; c ++ ) {
-
-		this.__removeObject( object.children[ c ] );
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.SVGRenderer = function () {
-
-	console.log( 'THREE.SVGRenderer', THREE.REVISION );
-
-	var _this = this,
-	_renderData, _elements, _lights,
-	_projector = new THREE.Projector(),
-	_svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
-	_svgWidth, _svgHeight, _svgWidthHalf, _svgHeightHalf,
-
-	_v1, _v2, _v3, _v4,
-
-	_clipRect = new THREE.Rectangle(),
-	_bboxRect = new THREE.Rectangle(),
-
-	_enableLighting = false,
-	_color = new THREE.Color(),
-	_ambientLight = new THREE.Color(),
-	_directionalLights = new THREE.Color(),
-	_pointLights = new THREE.Color(),
-
-	_w, // z-buffer to w-buffer
-	_vector3 = new THREE.Vector3(), // Needed for PointLight
-
-	_svgPathPool = [], _svgCirclePool = [], _svgLinePool = [],
-	_svgNode, _pathCount, _circleCount, _lineCount,
-	_quality = 1;
-
-	this.domElement = _svg;
-
-	this.autoClear = true;
-	this.sortObjects = true;
-	this.sortElements = true;
-
-	this.info = {
-
-		render: {
-
-			vertices: 0,
-			faces: 0
-
-		}
-
-	}
-
-	this.setQuality = function( quality ) {
-
-		switch(quality) {
-
-			case "high": _quality = 1; break;
-			case "low": _quality = 0; break;
-
-		}
-
-	};
-
-	this.setSize = function( width, height ) {
-
-		_svgWidth = width; _svgHeight = height;
-		_svgWidthHalf = _svgWidth / 2; _svgHeightHalf = _svgHeight / 2;
-
-		_svg.setAttribute( 'viewBox', ( - _svgWidthHalf ) + ' ' + ( - _svgHeightHalf ) + ' ' + _svgWidth + ' ' + _svgHeight );
-		_svg.setAttribute( 'width', _svgWidth );
-		_svg.setAttribute( 'height', _svgHeight );
-
-		_clipRect.set( - _svgWidthHalf, - _svgHeightHalf, _svgWidthHalf, _svgHeightHalf );
-
-	};
-
-	this.clear = function () {
-
-		while ( _svg.childNodes.length > 0 ) {
-
-			_svg.removeChild( _svg.childNodes[ 0 ] );
-
-		}
-
-	};
-
-	this.render = function ( scene, camera ) {
-
-		var e, el, element, material;
-
-		this.autoClear && this.clear();
-
-		_this.info.render.vertices = 0;
-		_this.info.render.faces = 0;
-
-		_renderData = _projector.projectScene( scene, camera, this.sortElements );
-		_elements = _renderData.elements;
-		_lights = _renderData.lights;
-
-		_pathCount = 0; _circleCount = 0; _lineCount = 0;
-
-		_enableLighting = _lights.length > 0;
-
-		if ( _enableLighting ) {
-
-			 calculateLights( _lights );
-
-		}
-
-		for ( e = 0, el = _elements.length; e < el; e ++ ) {
-
-			element = _elements[ e ];
-
-			material = element.material;
-			material = material instanceof THREE.MeshFaceMaterial ? element.faceMaterial : material;
-
-			if ( material == null || material.opacity == 0 ) continue;
-
-			_bboxRect.empty();
-
-			if ( element instanceof THREE.RenderableParticle ) {
-
-				_v1 = element;
-				_v1.x *= _svgWidthHalf; _v1.y *= -_svgHeightHalf;
-
-				renderParticle( _v1, element, material, scene );
-
-			} else if ( element instanceof THREE.RenderableLine ) {
-
-				_v1 = element.v1; _v2 = element.v2;
-
-				_v1.positionScreen.x *= _svgWidthHalf; _v1.positionScreen.y *= - _svgHeightHalf;
-				_v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= - _svgHeightHalf;
-
-				_bboxRect.addPoint( _v1.positionScreen.x, _v1.positionScreen.y );
-				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
-
-				if ( !_clipRect.intersects( _bboxRect ) ) {
-
-					continue;
-
-				}
-
-				renderLine( _v1, _v2, element, material, scene );
-
-			} else if ( element instanceof THREE.RenderableFace3 ) {
-
-				_v1 = element.v1; _v2 = element.v2; _v3 = element.v3;
-
-				_v1.positionScreen.x *= _svgWidthHalf; _v1.positionScreen.y *= - _svgHeightHalf;
-				_v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= - _svgHeightHalf;
-				_v3.positionScreen.x *= _svgWidthHalf; _v3.positionScreen.y *= - _svgHeightHalf;
-
-				_bboxRect.addPoint( _v1.positionScreen.x, _v1.positionScreen.y );
-				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
-				_bboxRect.addPoint( _v3.positionScreen.x, _v3.positionScreen.y );
-
-				if ( !_clipRect.intersects( _bboxRect ) ) {
-
-					continue;
-
-				}
-
-				renderFace3( _v1, _v2, _v3, element, material, scene );
-
-			} else if ( element instanceof THREE.RenderableFace4 ) {
-
-				_v1 = element.v1; _v2 = element.v2; _v3 = element.v3; _v4 = element.v4;
-
-				_v1.positionScreen.x *= _svgWidthHalf; _v1.positionScreen.y *= -_svgHeightHalf;
-				_v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= -_svgHeightHalf;
-				_v3.positionScreen.x *= _svgWidthHalf; _v3.positionScreen.y *= -_svgHeightHalf;
-				_v4.positionScreen.x *= _svgWidthHalf; _v4.positionScreen.y *= -_svgHeightHalf;
-
-				_bboxRect.addPoint( _v1.positionScreen.x, _v1.positionScreen.y );
-				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
-				_bboxRect.addPoint( _v3.positionScreen.x, _v3.positionScreen.y );
-				_bboxRect.addPoint( _v4.positionScreen.x, _v4.positionScreen.y );
-
-				if ( !_clipRect.intersects( _bboxRect) ) {
-
-					continue;
-
-				}
-
-				renderFace4( _v1, _v2, _v3, _v4, element, material, scene );
-
-			}
-
-		}
-
-	};
-
-	function calculateLights( lights ) {
-
-		var l, ll, light, lightColor;
-
-		_ambientLight.setRGB( 0, 0, 0 );
-		_directionalLights.setRGB( 0, 0, 0 );
-		_pointLights.setRGB( 0, 0, 0 );
-
-		for ( l = 0, ll = lights.length; l < ll; l++ ) {
-
-			light = lights[ l ];
-			lightColor = light.color;
-
-			if ( light instanceof THREE.AmbientLight ) {
-
-				_ambientLight.r += lightColor.r;
-				_ambientLight.g += lightColor.g;
-				_ambientLight.b += lightColor.b;
-
-			} else if ( light instanceof THREE.DirectionalLight ) {
-
-				_directionalLights.r += lightColor.r;
-				_directionalLights.g += lightColor.g;
-				_directionalLights.b += lightColor.b;
-
-			} else if ( light instanceof THREE.PointLight ) {
-
-				_pointLights.r += lightColor.r;
-				_pointLights.g += lightColor.g;
-				_pointLights.b += lightColor.b;
-
-			}
-
-		}
-
-	}
-
-	function calculateLight( lights, position, normal, color ) {
-
-		var l, ll, light, lightColor, lightPosition, amount;
-
-		for ( l = 0, ll = lights.length; l < ll; l ++ ) {
-
-			light = lights[ l ];
-			lightColor = light.color;
-
-			if ( light instanceof THREE.DirectionalLight ) {
-
-				lightPosition = light.matrixWorld.getPosition();
-
-				amount = normal.dot( lightPosition );
-
-				if ( amount <= 0 ) continue;
-
-				amount *= light.intensity;
-
-				color.r += lightColor.r * amount;
-				color.g += lightColor.g * amount;
-				color.b += lightColor.b * amount;
-
-			} else if ( light instanceof THREE.PointLight ) {
-
-				lightPosition = light.matrixWorld.getPosition();
-
-				amount = normal.dot( _vector3.sub( lightPosition, position ).normalize() );
-
-				if ( amount <= 0 ) continue;
-
-				amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 );
-
-				if ( amount == 0 ) continue;
-
-				amount *= light.intensity;
-
-				color.r += lightColor.r * amount;
-				color.g += lightColor.g * amount;
-				color.b += lightColor.b * amount;
-
-			}
-
-		}
-
-	}
-
-	function renderParticle( v1, element, material, scene ) {
-
-		/*
-		_svgNode = getCircleNode( _circleCount++ );
-		_svgNode.setAttribute( 'cx', v1.x );
-		_svgNode.setAttribute( 'cy', v1.y );
-		_svgNode.setAttribute( 'r', element.scale.x * _svgWidthHalf );
-
-		if ( material instanceof THREE.ParticleCircleMaterial ) {
-
-			if ( _enableLighting ) {
-
-				_color.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
-				_color.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
-				_color.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
-
-				_color.r = material.color.r * _color.r;
-				_color.g = material.color.g * _color.g;
-				_color.b = material.color.b * _color.b;
-
-				_color.updateStyleString();
-
-			} else {
-
-				_color = material.color;
-
-			}
-
-			_svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString );
-
-		}
-
-		_svg.appendChild( _svgNode );
-		*/
-
-	}
-
-	function renderLine ( v1, v2, element, material, scene ) {
-
-		_svgNode = getLineNode( _lineCount ++ );
-
-		_svgNode.setAttribute( 'x1', v1.positionScreen.x );
-		_svgNode.setAttribute( 'y1', v1.positionScreen.y );
-		_svgNode.setAttribute( 'x2', v2.positionScreen.x );
-		_svgNode.setAttribute( 'y2', v2.positionScreen.y );
-
-		if ( material instanceof THREE.LineBasicMaterial ) {
-
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + material.color.getContextStyle() + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin );
-
-			_svg.appendChild( _svgNode );
-
-		}
-
-	}
-
-	function renderFace3( v1, v2, v3, element, material, scene ) {
-
-		_this.info.render.vertices += 3;
-		_this.info.render.faces ++;
-
-		_svgNode = getPathNode( _pathCount ++ );
-		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + 'z' );
-
-		if ( material instanceof THREE.MeshBasicMaterial ) {
-
-			_color.copy( material.color );
-
-		} else if ( material instanceof THREE.MeshLambertMaterial ) {
-
-			if ( _enableLighting ) {
-
-				_color.r = _ambientLight.r;
-				_color.g = _ambientLight.g;
-				_color.b = _ambientLight.b;
-
-				calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
-
-				_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
-				_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
-				_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
-
-			} else {
-
-				_color.copy( material.color );
-
-			}
-
-		} else if ( material instanceof THREE.MeshDepthMaterial ) {
-
-			_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
-			_color.setRGB( _w, _w, _w );
-
-		} else if ( material instanceof THREE.MeshNormalMaterial ) {
-
-			_color.setRGB( normalToComponent( element.normalWorld.x ), normalToComponent( element.normalWorld.y ), normalToComponent( element.normalWorld.z ) );
-
-		}
-
-		if ( material.wireframe ) {
-
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getContextStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
-
-		} else {
-
-			_svgNode.setAttribute( 'style', 'fill: ' + _color.getContextStyle() + '; fill-opacity: ' + material.opacity );
-
-		}
-
-		_svg.appendChild( _svgNode );
-
-	}
-
-	function renderFace4( v1, v2, v3, v4, element, material, scene ) {
-
-		_this.info.render.vertices += 4;
-		_this.info.render.faces ++;
-
-		_svgNode = getPathNode( _pathCount ++ );
-		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + ' L ' + v4.positionScreen.x + ',' + v4.positionScreen.y + 'z' );
-
-		if ( material instanceof THREE.MeshBasicMaterial ) {
-
-			_color.copy( material.color );
-
-		} else if ( material instanceof THREE.MeshLambertMaterial ) {
-
-			if ( _enableLighting ) {
-
-				_color.r = _ambientLight.r;
-				_color.g = _ambientLight.g;
-				_color.b = _ambientLight.b;
-
-				calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
-
-				_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
-				_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
-				_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
-
-			} else {
-
-				_color.copy( material.color );
-
-			}
-
-		} else if ( material instanceof THREE.MeshDepthMaterial ) {
-
-			_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
-			_color.setRGB( _w, _w, _w );
-
-		} else if ( material instanceof THREE.MeshNormalMaterial ) {
-
-			_color.setRGB( normalToComponent( element.normalWorld.x ), normalToComponent( element.normalWorld.y ), normalToComponent( element.normalWorld.z ) );
-
-		}
-
-		if ( material.wireframe ) {
-
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getContextStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
-
-		} else {
-
-			_svgNode.setAttribute( 'style', 'fill: ' + _color.getContextStyle() + '; fill-opacity: ' + material.opacity );
-
-		}
-
-		_svg.appendChild( _svgNode );
-
-	}
-
-	function getLineNode( id ) {
-
-		if ( _svgLinePool[ id ] == null ) {
-
-			_svgLinePool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'line' );
-
-			if ( _quality == 0 ) {
-
-				_svgLinePool[ id ].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed
-
-			}
-
-			return _svgLinePool[ id ];
-
-		}
-
-		return _svgLinePool[ id ];
-
-	}
-
-	function getPathNode( id ) {
-
-		if ( _svgPathPool[ id ] == null ) {
-
-			_svgPathPool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
-
-			if ( _quality == 0 ) {
-
-				_svgPathPool[ id ].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed
-
-			}
-
-			return _svgPathPool[ id ];
-
-		}
-
-		return _svgPathPool[ id ];
-
-	}
-
-	function getCircleNode( id ) {
-
-		if ( _svgCirclePool[id] == null ) {
-
-			_svgCirclePool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'circle' );
-
-			if ( _quality == 0 ) {
-
-				_svgCirclePool[id].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed
-
-			}
-
-			return _svgCirclePool[ id ];
-
-		}
-
-		return _svgCirclePool[ id ];
-
-	}
-
-	function normalToComponent( normal ) {
-
-		var component = ( normal + 1 ) * 0.5;
-		return component < 0 ? 0 : ( component > 1 ? 1 : component );
-
-	}
-
-	function pad( str ) {
-
-		while ( str.length < 6 ) str = '0' + str;
-		return str;
-
-	}
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableVertex = function () {
-
-	this.positionWorld = new THREE.Vector3();
-	this.positionScreen = new THREE.Vector4();
-
-	this.visible = true;
-
-};
-
-THREE.RenderableVertex.prototype.copy = function ( vertex ) {
-
-	this.positionWorld.copy( vertex.positionWorld );
-	this.positionScreen.copy( vertex.positionScreen );
-
-}
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableFace3 = function () {
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-	this.v3 = new THREE.RenderableVertex();
-
-	this.centroidWorld = new THREE.Vector3();
-	this.centroidScreen = new THREE.Vector3();
-
-	this.normalWorld = new THREE.Vector3();
-	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-	this.material = null;
-	this.faceMaterial = null;
-	this.uvs = [[]];
-
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableFace4 = function () {
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-	this.v3 = new THREE.RenderableVertex();
-	this.v4 = new THREE.RenderableVertex();
-
-	this.centroidWorld = new THREE.Vector3();
-	this.centroidScreen = new THREE.Vector3();
-
-	this.normalWorld = new THREE.Vector3();
-	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-
-	this.material = null;
-	this.faceMaterial = null;
-	this.uvs = [[]];
-
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableObject = function () {
-
-	this.object = null;
-	this.z = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableParticle = function () {
-
-	this.x = null;
-	this.y = null;
-	this.z = null;
-
-	this.rotation = null;
-	this.scale = new THREE.Vector2();
-
-	this.material = null;
-
-};
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableLine = function () {
-
-	this.z = null;
-
-	this.v1 = new THREE.RenderableVertex();
-	this.v2 = new THREE.RenderableVertex();
-
-	this.material = null;
-
-};
-=======
-// ThreeSVG.js - http://github.com/mrdoob/three.js
-'use strict';var THREE=THREE||{REVISION:"49dev"};self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array);
-(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c){window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
-function(a){clearTimeout(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));switch(d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c;this.g=b;this.b=a}}return this},setHex:function(a){a=
-Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},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)}};
-THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
-this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
-THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
-a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
-this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
-setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,j=a.elements[9]/e,k=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-j/e,k/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
-this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
-this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};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,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],j=d[5],k=d[6],i=d[7],h=d[8],n=d[9],m=d[10],o=d[11],q=d[12],l=d[13],s=d[14],d=d[15];c[0].set(f-a,i-g,o-h,d-q);c[1].set(f+a,i+g,o+h,d+q);c[2].set(f+b,i+j,o+n,d+l);c[3].set(f-b,i-j,o-n,d-l);c[4].set(f-e,i-k,o-m,d-s);c[5].set(f+e,i+k,o+m,d+s);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
-THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);w=q.dot(b);r=l.add(a,s.copy(b).multiplyScalar(w));return A=c.distanceTo(r)}function d(a,b,c,d){q.sub(d,b);l.sub(c,b);s.sub(a,b);u=q.dot(q);t=q.dot(l);B=q.dot(s);x=l.dot(l);D=l.dot(s);z=1/(u*x-t*t);C=(x*B-t*D)*z;F=(u*D-t*B)*z;return C>=0&&F>=0&&C+F<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,
-i=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,l=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};l.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),s=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(s.x,Math.max(s.y,s.z)))return l;var r,t,u=a.geometry,y=u.vertices,p;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(s=u.faces.length;q<s;q++){b=u.faces[q];i.copy(this.origin);h.copy(this.direction);p=a.matrixWorld;n=p.multiplyVector3(n.copy(b.centroid)).subSelf(i);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));r=h.dot(m);if(!(Math.abs(r)<e)){t=m.dot(n)/r;if(!(t<0)&&(a.doubleSided||(a.flipSided?
-r>0:r<0))){o.add(i,h.multiplyScalar(t));if(b instanceof THREE.Face3){f=p.multiplyVector3(f.copy(y[b.a]));g=p.multiplyVector3(g.copy(y[b.b]));j=p.multiplyVector3(j.copy(y[b.c]));if(d(o,f,g,j)){b={distance:i.distanceTo(o),point:o.clone(),face:b,object:a};l.push(b)}}else if(b instanceof THREE.Face4){f=p.multiplyVector3(f.copy(y[b.a]));g=p.multiplyVector3(g.copy(y[b.b]));j=p.multiplyVector3(j.copy(y[b.c]));k=p.multiplyVector3(k.copy(y[b.d]));if(d(o,f,g,k)||d(o,g,j,k)){b={distance:i.distanceTo(o),point:o.clone(),
-face:b,object:a};l.push(b)}}}}}}return l};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,l=new THREE.Vector3,s=new THREE.Vector3,w,r,A,u,t,B,x,D,z,C,F};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,h,n){j=false;b=f;c=g;d=h;e=n;a()};this.addPoint=function(f,g){if(j){j=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
-e:g}a()};this.add3Points=function(f,g,h,n,m,o){if(j){j=false;b=f<h?f<m?f:m:h<m?h:m;c=g<n?g<o?g:o:n<o?n:o;d=f>h?f>m?f:m:h>m?h:m;e=g>n?g>o?g:o:n>o?n:o}else{b=f<h?f<m?f<b?f:b:m<b?m:b:h<m?h<b?h:b:m<b?m:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=f>h?f>m?f>d?f:d:m>d?m:d:h>m?h>d?h:d:m>d?m:d;e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o:e}a()};this.addRectangle=function(f){if(j){j=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
-d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){j=true;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
-THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],i=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*e;h[4]=b*f;h[5]=b*g;h[6]=b*j;h[7]=b*k;h[8]=b*i;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,j,k,i,h,n,m,o,q,l){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,j||0,k||0,i||0,h!==void 0?h:1,n||0,m||0,o||0,q||0,l!==void 0?l:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,j,k,i,h,n,m,o,q,l){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=e;s[5]=f;s[9]=g;s[13]=j;s[2]=k;s[6]=i;s[10]=h;s[14]=n;s[3]=m;s[7]=o;s[11]=q;s[15]=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],j=c[8],k=c[12],i=c[1],h=c[5],n=c[9],m=c[13],o=c[2],q=c[6],l=c[10],s=c[14],w=c[3],r=c[7],A=c[11],c=c[15],u=d[0],t=d[4],
-B=d[8],x=d[12],D=d[1],z=d[5],C=d[9],F=d[13],E=d[2],L=d[6],H=d[10],v=d[14],I=d[3],J=d[7],K=d[11],d=d[15];e[0]=f*u+g*D+j*E+k*I;e[4]=f*t+g*z+j*L+k*J;e[8]=f*B+g*C+j*H+k*K;e[12]=f*x+g*F+j*v+k*d;e[1]=i*u+h*D+n*E+m*I;e[5]=i*t+h*z+n*L+m*J;e[9]=i*B+h*C+n*H+m*K;e[13]=i*x+h*F+n*v+m*d;e[2]=o*u+q*D+l*E+s*I;e[6]=o*t+q*z+l*L+s*J;e[10]=o*B+q*C+l*H+s*K;e[14]=o*x+q*F+l*v+s*d;e[3]=w*u+r*D+A*E+c*I;e[7]=w*t+r*z+A*L+c*J;e[11]=w*B+r*C+A*H+c*K;e[15]=w*x+r*F+A*v+c*d;return this},multiplySelf:function(a){return this.multiply(this,
-a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
-b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],j=a[9],k=a[13],i=a[2],h=a[6],n=a[10],m=a[14],o=a[3],q=a[7],
-l=a[11],a=a[15];return e*j*h*o-d*k*h*o-e*g*n*o+c*k*n*o+d*g*m*o-c*j*m*o-e*j*i*q+d*k*i*q+e*f*n*q-b*k*n*q-d*f*m*q+b*j*m*q+e*g*i*l-c*k*i*l-e*f*h*l+b*k*h*l+c*f*m*l-b*g*m*l-d*g*i*a+c*j*i*a+d*f*h*a-b*j*h*a-c*f*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
-a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],j=c[1],k=c[5],i=c[9],h=c[13],n=c[2],m=c[6],o=c[10],q=
-c[14],l=c[3],s=c[7],w=c[11],c=c[15];b[0]=i*q*s-h*o*s+h*m*w-k*q*w-i*m*c+k*o*c;b[4]=g*o*s-f*q*s-g*m*w+e*q*w+f*m*c-e*o*c;b[8]=f*h*s-g*i*s+g*k*w-e*h*w-f*k*c+e*i*c;b[12]=g*i*m-f*h*m-g*k*o+e*h*o+f*k*q-e*i*q;b[1]=h*o*l-i*q*l-h*n*w+j*q*w+i*n*c-j*o*c;b[5]=f*q*l-g*o*l+g*n*w-d*q*w-f*n*c+d*o*c;b[9]=g*i*l-f*h*l-g*j*w+d*h*w+f*j*c-d*i*c;b[13]=f*h*n-g*i*n+g*j*o-d*h*o-f*j*q+d*i*q;b[2]=k*q*l-h*m*l+h*n*s-j*q*s-k*n*c+j*m*c;b[6]=g*m*l-e*q*l-g*n*s+d*q*s+e*n*c-d*m*c;b[10]=e*h*l-g*k*l+g*j*s-d*h*s-e*j*c+d*k*c;b[14]=g*k*n-
-e*h*n-g*j*m+d*h*m+e*j*q-d*k*q;b[3]=i*m*l-k*o*l-i*n*s+j*o*s+k*n*w-j*m*w;b[7]=e*o*l-f*m*l+f*n*s-d*o*s-e*n*w+d*m*w;b[11]=f*k*l-e*i*l-f*j*s+d*i*s+e*j*w-d*k*w;b[15]=e*i*n-f*k*n+f*j*m-d*i*m-e*j*o+d*k*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=j*k,h=j*f,n=e*k,m=e*f;c[0]=i+m*d;c[4]=n*d-h;c[8]=g*e;c[1]=g*f;c[5]=g*
-k;c[9]=-d;c[2]=h*d-n;c[6]=m+i*d;c[10]=g*j;break;case "ZXY":i=j*k;h=j*f;n=e*k;m=e*f;c[0]=i-m*d;c[4]=-g*f;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*k;c[9]=m-i*d;c[2]=-g*e;c[6]=d;c[10]=g*j;break;case "ZYX":i=g*k;h=g*f;n=d*k;m=d*f;c[0]=j*k;c[4]=n*e-h;c[8]=i*e+m;c[1]=j*f;c[5]=m*e+i;c[9]=h*e-n;c[2]=-e;c[6]=d*j;c[10]=g*j;break;case "YZX":i=g*j;h=g*e;n=d*j;m=d*e;c[0]=j*k;c[4]=m-i*f;c[8]=n*f+h;c[1]=f;c[5]=g*k;c[9]=-d*k;c[2]=-e*k;c[6]=h*f+n;c[10]=i-m*f;break;case "XZY":i=g*j;h=g*e;n=d*j;m=d*e;c[0]=j*k;c[4]=-f;c[8]=e*k;
-c[1]=i*f+m;c[5]=g*k;c[9]=h*f-n;c[2]=n*f-h;c[6]=d*k;c[10]=m*f+i;break;default:i=g*k;h=g*f;n=d*k;m=d*f;c[0]=j*k;c[4]=-j*f;c[8]=e;c[1]=h+n*e;c[5]=i-m*e;c[9]=-d*j;c[2]=m-i*e;c[6]=n+h*e;c[10]=g*j}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,j=d+d,k=e+e,a=c*g,i=c*j,c=c*k,h=d*j,d=d*k,e=e*k,g=f*g,j=f*j,f=f*k;b[0]=1-(h+e);b[4]=i-f;b[8]=c+j;b[1]=i+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-j;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
-c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
-b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],j=b[9],k=b[10],i=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*j;b[6]=h*e+a*k;b[7]=h*f+a*i;b[8]=h*g-a*c;b[9]=h*j-a*d;b[10]=h*k-a*e;b[11]=h*i-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],j=b[9],k=b[10],i=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*j;b[2]=h*e-a*k;b[3]=h*f-a*i;b[8]=h*g+a*c;b[9]=
-h*j+a*d;b[10]=h*k+a*e;b[11]=h*i+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],j=b[5],k=b[6],i=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*j;b[2]=h*e+a*k;b[3]=h*f+a*i;b[4]=h*g-a*c;b[5]=h*j-a*d;b[6]=h*k-a*e;b[7]=h*i-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,j=e*e,k=f*f,i=Math.cos(b),h=Math.sin(b),n=1-i,m=d*e*n,o=d*f*n,n=e*f*n,d=d*h,q=e*h,h=f*h,f=g+(1-g)*i,g=m+h,e=o-q,m=m-h,j=j+(1-j)*i,h=n+d,o=o+q,n=n-d,k=k+(1-k)*i,i=c[0],d=c[1],q=c[2],l=c[3],s=c[4],w=c[5],r=c[6],A=c[7],u=c[8],t=c[9],B=c[10],x=c[11];c[0]=f*i+g*s+e*u;c[1]=f*d+g*w+e*t;c[2]=f*q+g*r+e*B;c[3]=f*l+g*A+e*x;c[4]=m*i+j*s+h*u;c[5]=m*d+j*w+h*t;c[6]=m*q+j*r+h*B;c[7]=m*l+j*A+h*x;c[8]=o*i+n*s+k*u;c[9]=o*d+n*w+k*t;c[10]=o*q+n*r+k*B;c[11]=
-o*l+n*A+k*x;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,k=e*f,i=e*g;this.set(k*f+c,k*g-d*j,k*j+d*g,0,k*g+d*j,i*g+c,i*j-d*f,0,k*j-
-d*g,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
-b,c,d,e,f){var g=this.elements,j=b-a,k=c-d,i=f-e;g[0]=2/j;g[4]=0;g[8]=0;g[12]=-((b+a)/j);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/i;g[14]=-((f+e)/i);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
-THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
-this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},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?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&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?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)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[k]=i[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],j,k,i=[],h,n,m=[],o,q=[],l,s,w=[],r,A,u=[],t={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,x=new THREE.Vector4,D=new THREE.Matrix4,z=new THREE.Matrix4,C=new THREE.Frustum,F=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||C.contains(b))){B.copy(b.matrixWorld.getPosition());
-D.multiplyVector3(B);e=a();e.object=b;e.z=B.z;t.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){B.copy(b.matrixWorld.getPosition());D.multiplyVector3(B);e=a();e.object=b;e.z=B.z;t.sprites.push(e)}else b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,f,e){var g=f.near,B=f.far,K=false,R,y,p,P,G,N,O,Q,M,S,T,V,W,X,U;A=s=o=n=0;t.elements.length=0;if(f.parent===
-void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);D.multiply(f.projectionMatrix,f.matrixWorldInverse);C.setFromMatrix(D);t=this.projectGraph(a,false);a=0;for(R=t.objects.length;a<R;a++){M=t.objects[a].object;S=M.matrixWorld;k=0;if(M instanceof THREE.Mesh){T=M.geometry;V=M.geometry.materials;P=T.vertices;W=T.faces;X=T.faceVertexUvs;T=M.matrixRotationWorld.extractRotation(S);y=0;for(p=P.length;y<
-p;y++){j=b();j.positionWorld.copy(P[y]);S.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);D.multiplyVector4(j.positionScreen);j.positionScreen.x=j.positionScreen.x/j.positionScreen.w;j.positionScreen.y=j.positionScreen.y/j.positionScreen.w;j.visible=j.positionScreen.z>g&&j.positionScreen.z<B}P=0;for(y=W.length;P<y;P++){p=W[P];if(p instanceof THREE.Face3){G=i[p.a];N=i[p.b];O=i[p.c];if(G.visible&&N.visible&&O.visible){K=(O.positionScreen.x-G.positionScreen.x)*(N.positionScreen.y-
-G.positionScreen.y)-(O.positionScreen.y-G.positionScreen.y)*(N.positionScreen.x-G.positionScreen.x)<0;if(M.doubleSided||K!=M.flipSided){Q=m[n]=m[n]||new THREE.RenderableFace3;n++;h=Q;h.v1.copy(G);h.v2.copy(N);h.v3.copy(O)}else continue}else continue}else if(p instanceof THREE.Face4){G=i[p.a];N=i[p.b];O=i[p.c];Q=i[p.d];if(G.visible&&N.visible&&O.visible&&Q.visible){K=(Q.positionScreen.x-G.positionScreen.x)*(N.positionScreen.y-G.positionScreen.y)-(Q.positionScreen.y-G.positionScreen.y)*(N.positionScreen.x-
-G.positionScreen.x)<0||(N.positionScreen.x-O.positionScreen.x)*(Q.positionScreen.y-O.positionScreen.y)-(N.positionScreen.y-O.positionScreen.y)*(Q.positionScreen.x-O.positionScreen.x)<0;if(M.doubleSided||K!=M.flipSided){U=q[o]=q[o]||new THREE.RenderableFace4;o++;h=U;h.v1.copy(G);h.v2.copy(N);h.v3.copy(O);h.v4.copy(Q)}else continue}else continue}h.normalWorld.copy(p.normal);!K&&(M.flipSided||M.doubleSided)&&h.normalWorld.negate();T.multiplyVector3(h.normalWorld);h.centroidWorld.copy(p.centroid);S.multiplyVector3(h.centroidWorld);
-h.centroidScreen.copy(h.centroidWorld);D.multiplyVector3(h.centroidScreen);O=p.vertexNormals;G=0;for(N=O.length;G<N;G++){Q=h.vertexNormalsWorld[G];Q.copy(O[G]);!K&&(M.flipSided||M.doubleSided)&&Q.negate();T.multiplyVector3(Q)}G=0;for(N=X.length;G<N;G++)if(U=X[G][P]){O=0;for(Q=U.length;O<Q;O++)h.uvs[G][O]=U[O]}h.material=M.material;h.faceMaterial=p.materialIndex!==null?V[p.materialIndex]:null;h.z=h.centroidScreen.z;t.elements.push(h)}}else if(M instanceof THREE.Line){z.multiply(D,S);P=M.geometry.vertices;
-G=b();G.positionScreen.copy(P[0]);z.multiplyVector4(G.positionScreen);S=M.type===THREE.LinePieces?2:1;y=1;for(p=P.length;y<p;y++){G=b();G.positionScreen.copy(P[y]);z.multiplyVector4(G.positionScreen);if(!((y+1)%S>0)){N=i[k-2];F.copy(G.positionScreen);E.copy(N.positionScreen);if(d(F,E)){F.multiplyScalar(1/F.w);E.multiplyScalar(1/E.w);V=w[s]=w[s]||new THREE.RenderableLine;s++;l=V;l.v1.positionScreen.copy(F);l.v2.positionScreen.copy(E);l.z=Math.max(F.z,E.z);l.material=M.material;t.elements.push(l)}}}}}a=
-0;for(R=t.sprites.length;a<R;a++){M=t.sprites[a].object;S=M.matrixWorld;if(M instanceof THREE.Particle){x.set(S.elements[12],S.elements[13],S.elements[14],1);D.multiplyVector4(x);x.z=x.z/x.w;if(x.z>0&&x.z<1){g=u[A]=u[A]||new THREE.RenderableParticle;A++;r=g;r.x=x.x/x.w;r.y=x.y/x.w;r.z=x.z;r.rotation=M.rotation.z;r.scale.x=M.scale.x*Math.abs(r.x-(x.x+f.projectionMatrix.elements[0])/(x.w+f.projectionMatrix.elements[12]));r.scale.y=M.scale.y*Math.abs(r.y-(x.y+f.projectionMatrix.elements[5])/(x.w+f.projectionMatrix.elements[13]));
-r.material=M.material;t.elements.push(r)}}}e&&t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
-this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
-Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=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,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=
-c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,k=this.w,i=k*c+g*e-j*d,h=k*d+j*c-f*e,n=k*e+f*d-g*c,c=-f*c-g*d-j*e;b.x=i*k+c*-f+h*-j-n*-g;b.y=h*k+c*-g+n*-f-i*-j;b.z=n*k+c*-j+i*-g-h*-f;return b},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 f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
-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};
-THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
-THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
-0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,j=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);j.sub(d,e);g.crossSelf(j);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
-else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
-for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
-e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,k,i;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];k=new THREE.Vector3;i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(k);j.push(i)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-k=g.faceNormals[c];i=g.vertexNormals[c];k.copy(e.normal);if(e instanceof THREE.Face3){i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2])}else{i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2]);i.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,G){j=a.vertices[b];k=a.vertices[c];
-i=a.vertices[d];h=g[f];n=g[e];m=g[G];o=k.x-j.x;q=i.x-j.x;l=k.y-j.y;s=i.y-j.y;w=k.z-j.z;r=i.z-j.z;A=n.u-h.u;u=m.u-h.u;t=n.v-h.v;B=m.v-h.v;x=1/(A*B-u*t);F.set((B*o-t*q)*x,(B*l-t*s)*x,(B*w-t*r)*x);E.set((A*q-u*o)*x,(A*s-u*l)*x,(A*r-u*w)*x);z[b].addSelf(F);z[c].addSelf(F);z[d].addSelf(F);C[b].addSelf(E);C[c].addSelf(E);C[d].addSelf(E)}var b,c,d,e,f,g,j,k,i,h,n,m,o,q,l,s,w,r,A,u,t,B,x,D,z=[],C=[],F=new THREE.Vector3,E=new THREE.Vector3,L=new THREE.Vector3,H=new THREE.Vector3,v=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){z[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){v.copy(f.vertexNormals[d]);e=f[I[d]];D=z[e];L.copy(D);L.subSelf(v.multiplyScalar(v.dot(D))).normalize();
-H.cross(f.vertexNormals[d],D);e=H.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.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,j;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(j=
-this.faceVertexUvs[e][f])&&j.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
-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=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
-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,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;
-this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
-THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
-a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=j.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,k="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?k="MeshPhongMaterial":h==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){k=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=i.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(i.map){h.tDiffuse.texture=i.map;h.enableDiffuse.value=true}if(i.specularMap){h.tSpecular.texture=i.specularMap;h.enableSpecular.value=true}if(i.lightMap){h.tAO.texture=i.lightMap;
-h.enableAO.value=true}h.uDiffuseColor.value.setHex(i.color);h.uSpecularColor.value.setHex(i.specular);h.uAmbientColor.value.setHex(i.ambient);h.uShininess.value=i.shininess;if(i.opacity!==void 0)h.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else i=new THREE[k](i);if(a.DbgName!==void 0)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
-THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var j=JSON.parse(g.responseText);a.loadAjaxBuffers(j,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,j=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};
-f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,k,i,h,n,m,o,q,l,s,w,r,A,u;function t(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,f,e,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];g=l[d*3+2];h=J[f*2];f=J[f*2+1];j=J[e*2];i=J[e*2+1];e=J[g*2];k=J[g*2+1];g=H.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(j,i));m.push(new THREE.UV(e,
-k));g.push(m)}}function z(b,c){var d,f,e,g,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=J[f*2];f=J[f*2+1];i=J[e*2];l=J[e*2+1];k=J[g*2];m=J[g*2+1];g=J[h*2];e=J[h*2+1];h=H.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,f));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,e));h.push(o)}}function C(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=j[d];
-H.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function F(b,c,d){for(var f,e,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];H.faces.push(new THREE.Face4(f,e,g,h,null,null,j))}}function E(b,c,d,f){for(var e,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];i=d[f*3];k=d[f*3+1];l=d[f*3+2];j=m[f];var n=I[k*3],o=I[k*3+1];k=I[k*3+2];var q=I[l*3],
-r=I[l*3+1];l=I[l*3+2];H.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(I[i*3],I[i*3+1],I[i*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(q,r,l)],null,j))}}function L(b,c,d,f){for(var e,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];j=c[f*4+3];k=d[f*4];l=d[f*4+1];m=d[f*4+2];n=d[f*4+3];i=o[f];var q=I[l*3],r=I[l*3+1];l=I[l*3+2];var s=I[m*3],t=I[m*3+1];m=I[m*3+2];var u=I[n*3],v=I[n*3+1];n=I[n*3+2];H.faces.push(new THREE.Face4(e,
-g,h,j,[new THREE.Vector3(I[k*3],I[k*3+1],I[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(s,t,m),new THREE.Vector3(u,v,n)],null,i))}}var H=this,v=0,I=[],J=[],K,R,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(H,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,v,12);c=B(a,v+12);B(a,v+13);B(a,v+14);B(a,v+15);e=B(a,v+16);k=B(a,v+17);i=B(a,v+18);h=B(a,v+19);n=x(a,v+20);m=x(a,v+20+4);o=x(a,v+20+8);b=x(a,v+20+12);q=
-x(a,v+20+16);l=x(a,v+20+20);s=x(a,v+20+24);w=x(a,v+20+28);r=x(a,v+20+32);A=x(a,v+20+36);u=x(a,v+20+40);v=v+c;c=e*3+h;y=e*4+h;K=b*c;R=q*(c+k*3);e=l*(c+i*3);h=s*(c+k*3+i*3);c=w*y;k=r*(y+k*4);i=A*(y+i*4);v=v+function(b){var b=new Float32Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];H.vertices.push(new THREE.Vector3(d,f,e))}return n*3*Float32Array.BYTES_PER_ELEMENT}(v);v=v+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];I.push(d/
-127,f/127,e/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(v);v=v+t(m*3);v=v+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,f;for(c=0;c<o;c++){d=b[c*2];f=b[c*2+1];J.push(d,f)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(v);K=v+K+t(b*2);R=K+R+t(q*2);e=R+e+t(l*2);h=e+h+t(s*2);c=h+c+t(w*2);k=c+k+t(r*2);i=k+i+t(A*2);(function(a){if(l){var b=a+l*Uint32Array.BYTES_PER_ELEMENT*3;C(l,a,b+l*Uint32Array.BYTES_PER_ELEMENT*3);D(l,b)}})(R);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-s*Uint32Array.BYTES_PER_ELEMENT*3;E(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*3);D(s,c)}})(e);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4;F(A,a,b+A*Uint32Array.BYTES_PER_ELEMENT*4);z(A,b)}})(k);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4,c=b+u*Uint32Array.BYTES_PER_ELEMENT*4;L(u,a,b,c+u*Uint32Array.BYTES_PER_ELEMENT*4);z(u,c)}})(i);b&&C(b,v,v+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;E(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(K);w&&F(w,h,h+w*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*4;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
-THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var j=JSON.parse(f.responseText);a.createModel(j,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
-e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,k,i,h,n,m,o,q,l,s,w,r,A,u=a.faces;n=a.vertices;var t=a.normals,B=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}i=0;for(h=n.length;i<h;){m=new THREE.Vector3;m.x=n[i++]*b;m.y=n[i++]*b;m.z=n[i++]*b;d.vertices.push(m)}i=0;for(h=u.length;i<h;){b=u[i++];n=b&1;k=b&2;c=b&
-4;e=b&8;o=b&16;m=b&32;l=b&64;b=b&128;if(n){s=new THREE.Face4;s.a=u[i++];s.b=u[i++];s.c=u[i++];s.d=u[i++];n=4}else{s=new THREE.Face3;s.a=u[i++];s.b=u[i++];s.c=u[i++];n=3}if(k){k=u[i++];s.materialIndex=k}k=d.faces.length;if(c)for(c=0;c<x;c++){w=a.uvs[c];q=u[i++];A=w[q*2];q=w[q*2+1];d.faceUvs[c][k]=new THREE.UV(A,q)}if(e)for(c=0;c<x;c++){w=a.uvs[c];r=[];for(e=0;e<n;e++){q=u[i++];A=w[q*2];q=w[q*2+1];r[e]=new THREE.UV(A,q)}d.faceVertexUvs[c][k]=r}if(o){o=u[i++]*3;e=new THREE.Vector3;e.x=t[o++];e.y=t[o++];
-e.z=t[o];s.normal=e}if(m)for(c=0;c<n;c++){o=u[i++]*3;e=new THREE.Vector3;e.x=t[o++];e.y=t[o++];e.z=t[o];s.vertexNormals.push(e)}if(l){m=u[i++];m=new THREE.Color(B[m]);s.color=m}if(b)for(c=0;c<n;c++){m=u[i++];m=new THREE.Color(B[m]);s.vertexColors.push(m)}d.faces.push(s)}})(e);(function(){var b,c,e,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];k=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,k,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];k=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,k,i,h,n;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;k=0;for(i=n.length;k<i;k=k+3){var m=new THREE.Vector3;m.x=n[k]*b;m.y=n[k+1]*b;m.z=n[k+2]*b;h.push(m)}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(k=h.length;b<k;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);i.push(n)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
-THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
-THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:i+"/"+a}function e(){var a;for(m in v.objects)if(!p.objects[m]){w=v.objects[m];if(w.geometry!==void 0){if(F=p.geometries[w.geometry]){a=false;E=p.materials[w.materials[0]];(a=E instanceof THREE.ShaderMaterial)&&F.computeTangents();t=w.position;B=w.rotation;x=w.quaternion;D=w.scale;r=w.matrix;x=0;w.materials.length==0&&(E=new THREE.MeshFaceMaterial);w.materials.length>1&&(E=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(F,E);a.name=m;if(r){a.matrixAutoUpdate=false;a.matrix.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}else{a.position.set(t[0],t[1],t[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(D[0],D[1],D[2])}a.visible=w.visible;a.doubleSided=w.doubleSided;a.castShadow=w.castShadow;a.receiveShadow=w.receiveShadow;p.scene.add(a);p.objects[m]=a}}else{t=w.position;B=w.rotation;x=w.quaternion;
-D=w.scale;x=0;a=new THREE.Object3D;a.name=m;a.position.set(t[0],t[1],t[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(D[0],D[1],D[2]);a.visible=w.visible!==void 0?w.visible:false;p.scene.add(a);p.objects[m]=a;p.empties[m]=a}}}function f(a){return function(b){p.geometries[a]=b;e();J=J-1;k.onLoadComplete();j()}}function g(a){return function(b){p.geometries[a]=b}}function j(){k.callbackProgress({totalModels:R,totalTextures:y,loadedModels:R-
-J,loadedTextures:y-K},p);k.onLoadProgress();J==0&&K==0&&b(p)}var k=this,i=THREE.Loader.prototype.extractUrlBase(c),h,n,m,o,q,l,s,w,r,A,u,t,B,x,D,z,C,F,E,L,H,v,I,J,K,R,y,p;v=a;c=new THREE.BinaryLoader;I=new THREE.JSONLoader;K=J=0;p={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(v.transform){a=v.transform.position;A=v.transform.rotation;z=v.transform.scale;a&&p.scene.position.set(a[0],a[1],a[2]);A&&p.scene.rotation.set(A[0],A[1],
-A[2]);z&&p.scene.scale.set(z[0],z[1],z[2]);if(a||A||z){p.scene.updateMatrix();p.scene.updateMatrixWorld()}}a=function(){K=K-1;j();k.onLoadComplete()};for(q in v.cameras){z=v.cameras[q];z.type=="perspective"?L=new THREE.PerspectiveCamera(z.fov,z.aspect,z.near,z.far):z.type=="ortho"&&(L=new THREE.OrthographicCamera(z.left,z.right,z.top,z.bottom,z.near,z.far));t=z.position;A=z.target;z=z.up;L.position.set(t[0],t[1],t[2]);L.target=new THREE.Vector3(A[0],A[1],A[2]);z&&L.up.set(z[0],z[1],z[2]);p.cameras[q]=
-L}for(o in v.lights){A=v.lights[o];q=A.color!==void 0?A.color:16777215;L=A.intensity!==void 0?A.intensity:1;if(A.type=="directional"){t=A.direction;u=new THREE.DirectionalLight(q,L);u.position.set(t[0],t[1],t[2]);u.position.normalize()}else if(A.type=="point"){t=A.position;u=A.distance;u=new THREE.PointLight(q,L,u);u.position.set(t[0],t[1],t[2])}else A.type=="ambient"&&(u=new THREE.AmbientLight(q));p.scene.add(u);p.lights[o]=u}for(l in v.fogs){o=v.fogs[l];o.type=="linear"?H=new THREE.Fog(0,o.near,
-o.far):o.type=="exp2"&&(H=new THREE.FogExp2(0,o.density));z=o.color;H.color.setRGB(z[0],z[1],z[2]);p.fogs[l]=H}if(p.cameras&&v.defaults.camera)p.currentCamera=p.cameras[v.defaults.camera];if(p.fogs&&v.defaults.fog)p.scene.fog=p.fogs[v.defaults.fog];z=v.defaults.bgcolor;p.bgColor=new THREE.Color;p.bgColor.setRGB(z[0],z[1],z[2]);p.bgColorAlpha=v.defaults.bgalpha;for(h in v.geometries){l=v.geometries[h];if(l.type=="bin_mesh"||l.type=="ascii_mesh"){J=J+1;k.onLoadStart()}}R=J;for(h in v.geometries){l=
-v.geometries[h];if(l.type=="cube"){F=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides);p.geometries[h]=F}else if(l.type=="plane"){F=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight);p.geometries[h]=F}else if(l.type=="sphere"){F=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight);p.geometries[h]=F}else if(l.type=="cylinder"){F=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,
-l.heightSegs);p.geometries[h]=F}else if(l.type=="torus"){F=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT);p.geometries[h]=F}else if(l.type=="icosahedron"){F=new THREE.IcosahedronGeometry(l.radius,l.subdivisions);p.geometries[h]=F}else if(l.type=="bin_mesh")c.load(d(l.url,v.urlBaseType),f(h));else if(l.type=="ascii_mesh")I.load(d(l.url,v.urlBaseType),f(h));else if(l.type=="embedded_mesh"){l=v.embeds[l.id];l.metadata=v.metadata;l&&I.createModel(l,g(h),"")}}for(s in v.textures){h=v.textures[s];
-if(h.url instanceof Array){K=K+h.url.length;for(l=0;l<h.url.length;l++)k.onLoadStart()}else{K=K+1;k.onLoadStart()}}y=K;for(s in v.textures){h=v.textures[s];if(h.mapping!=void 0&&THREE[h.mapping]!=void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){l=[];for(H=0;H<h.url.length;H++)l[H]=d(h.url[H],v.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,h.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(h.url,v.urlBaseType),h.mapping,a);if(THREE[h.minFilter]!=void 0)l.minFilter=THREE[h.minFilter];
-if(THREE[h.magFilter]!=void 0)l.magFilter=THREE[h.magFilter];if(h.repeat){l.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}h.offset&&l.offset.set(h.offset[0],h.offset[1]);if(h.wrap){H={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(H[h.wrap[0]]!==void 0)l.wrapS=H[h.wrap[0]];if(H[h.wrap[1]]!==void 0)l.wrapT=H[h.wrap[1]]}}p.textures[s]=l}for(n in v.materials){r=v.materials[n];for(C in r.parameters)if(C==
-"envMap"||C=="map"||C=="lightMap")r.parameters[C]=p.textures[r.parameters[C]];else if(C=="shading")r.parameters[C]=r.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if(C=="combine")r.parameters[C]=r.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(r.parameters[C]=="face")r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=
-THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=true;if(r.parameters.normalMap){s=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(s.uniforms);h=r.parameters.color;l=r.parameters.specular;H=r.parameters.ambient;c=r.parameters.shininess;a.tNormal.texture=p.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map){a.tDiffuse.texture=r.parameters.map;a.enableDiffuse.value=
-true}if(r.parameters.lightMap){a.tAO.texture=r.parameters.lightMap;a.enableAO.value=true}if(r.parameters.specularMap){a.tSpecular.texture=p.textures[r.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(l);a.uAmbientColor.value.setHex(H);a.uShininess.value=c;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:a,lights:true,fog:true})}else E=
-new THREE[r.type](r.parameters);p.materials[n]=E}e();k.callbackSync(p);j()};
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
-a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;
-THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;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.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
-THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
-true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
-void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
-THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=
-a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?
-a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
-THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:false;this.perPixel=
-a.perPixel!==void 0?a.perPixel:false;this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=
-a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?
-a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};
-THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;
-THREE.MeshFaceMaterial=function(){};THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.ParticleBasicMaterial.prototype=new THREE.Material;
-THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.Texture=function(a,b,c,d,e,f,g,j){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
-THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,j,k,i){THREE.Texture.call(this,null,f,g,j,k,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
-THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
-THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
-THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=a.useScreenCoordinates!==
-void 0?a.useScreenCoordinates:true;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=
-new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=true};THREE.SpriteAlignment={};
-THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);
-THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){i=g.matrixWorld.getPosition();j=c.dot(i);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){i=g.matrixWorld.getPosition();j=c.dot(z.sub(i,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(i)/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 b(a){if(C[a]==null){C[a]=document.createElementNS("http://www.w3.org/2000/svg","path");v==0&&C[a].setAttribute("shape-rendering","crispEdges")}return C[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,h,n,m,o,q,l,s,w=new THREE.Rectangle,r=new THREE.Rectangle,A=false,u=new THREE.Color,t=new THREE.Color,B=new THREE.Color,x=new THREE.Color,
-D,z=new THREE.Vector3,C=[],F=[],E,L,H,v=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":v=1;break;case "low":v=0}};this.setSize=function(a,b){i=a;h=b;n=i/2;m=h/2;k.setAttribute("viewBox",-n+" "+-m+" "+i+" "+h);k.setAttribute("width",i);k.setAttribute("height",h);w.set(-n,-m,n,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(h,
-i){var z,C,y,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=j.projectScene(h,i,this.sortElements);f=e.elements;g=e.lights;H=L=0;if(A=g.length>0){t.setRGB(0,0,0);B.setRGB(0,0,0);x.setRGB(0,0,0);z=0;for(C=g.length;z<C;z++){p=g[z];y=p.color;if(p instanceof THREE.AmbientLight){t.r=t.r+y.r;t.g=t.g+y.g;t.b=t.b+y.b}else if(p instanceof THREE.DirectionalLight){B.r=B.r+y.r;B.g=B.g+y.g;B.b=B.b+y.b}else if(p instanceof THREE.PointLight){x.r=x.r+y.r;x.g=x.g+y.g;x.b=x.b+y.b}}}z=
-0;for(C=f.length;z<C;z++){y=f[z];p=y.material;p=p instanceof THREE.MeshFaceMaterial?y.faceMaterial:p;if(!(p===void 0||p.visible===false)){r.empty();if(y instanceof THREE.RenderableParticle){o=y;o.x=o.x*n;o.y=o.y*-m}else if(y instanceof THREE.RenderableLine){o=y.v1;q=y.v2;o.positionScreen.x=o.positionScreen.x*n;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*n;q.positionScreen.y=q.positionScreen.y*-m;r.addPoint(o.positionScreen.x,o.positionScreen.y);r.addPoint(q.positionScreen.x,
-q.positionScreen.y);if(w.intersects(r)){y=o;var P=q,G=H++;if(F[G]==null){F[G]=document.createElementNS("http://www.w3.org/2000/svg","line");v==0&&F[G].setAttribute("shape-rendering","crispEdges")}E=F[G];E.setAttribute("x1",y.positionScreen.x);E.setAttribute("y1",y.positionScreen.y);E.setAttribute("x2",P.positionScreen.x);E.setAttribute("y2",P.positionScreen.y);if(p instanceof THREE.LineBasicMaterial){E.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+
-"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin);k.appendChild(E)}}}else if(y instanceof THREE.RenderableFace3){o=y.v1;q=y.v2;l=y.v3;o.positionScreen.x=o.positionScreen.x*n;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*n;q.positionScreen.y=q.positionScreen.y*-m;l.positionScreen.x=l.positionScreen.x*n;l.positionScreen.y=l.positionScreen.y*-m;r.addPoint(o.positionScreen.x,o.positionScreen.y);r.addPoint(q.positionScreen.x,
-q.positionScreen.y);r.addPoint(l.positionScreen.x,l.positionScreen.y);if(w.intersects(r)){var P=o,G=q,N=l;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;E=b(L++);E.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+"z");if(p instanceof THREE.MeshBasicMaterial)u.copy(p.color);else if(p instanceof THREE.MeshLambertMaterial)if(A){u.r=t.r;u.g=t.g;u.b=t.b;a(g,y.centroidWorld,
-y.normalWorld,u);u.r=Math.max(0,Math.min(p.color.r*u.r,1));u.g=Math.max(0,Math.min(p.color.g*u.g,1));u.b=Math.max(0,Math.min(p.color.b*u.b,1))}else u.copy(p.color);else if(p instanceof THREE.MeshDepthMaterial){D=1-p.__2near/(p.__farPlusNear-y.z*p.__farMinusNear);u.setRGB(D,D,D)}else p instanceof THREE.MeshNormalMaterial&&u.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));p.wireframe?E.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+
-"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):E.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(E)}}else if(y instanceof THREE.RenderableFace4){o=y.v1;q=y.v2;l=y.v3;s=y.v4;o.positionScreen.x=o.positionScreen.x*n;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*n;q.positionScreen.y=q.positionScreen.y*-m;l.positionScreen.x=l.positionScreen.x*n;l.positionScreen.y=
-l.positionScreen.y*-m;s.positionScreen.x=s.positionScreen.x*n;s.positionScreen.y=s.positionScreen.y*-m;r.addPoint(o.positionScreen.x,o.positionScreen.y);r.addPoint(q.positionScreen.x,q.positionScreen.y);r.addPoint(l.positionScreen.x,l.positionScreen.y);r.addPoint(s.positionScreen.x,s.positionScreen.y);if(w.intersects(r)){var P=o,G=q,N=l,O=s;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;E=b(L++);E.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+G.positionScreen.x+
-" "+G.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");if(p instanceof THREE.MeshBasicMaterial)u.copy(p.color);else if(p instanceof THREE.MeshLambertMaterial)if(A){u.r=t.r;u.g=t.g;u.b=t.b;a(g,y.centroidWorld,y.normalWorld,u);u.r=Math.max(0,Math.min(p.color.r*u.r,1));u.g=Math.max(0,Math.min(p.color.g*u.g,1));u.b=Math.max(0,Math.min(p.color.b*u.b,1))}else u.copy(p.color);else if(p instanceof THREE.MeshDepthMaterial){D=1-p.__2near/
-(p.__farPlusNear-y.z*p.__farMinusNear);u.setRGB(D,D,D)}else p instanceof THREE.MeshNormalMaterial&&u.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));p.wireframe?E.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):E.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+p.opacity);k.appendChild(E)}}}}}};
-THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
-THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
->>>>>>> dev

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


+ 13 - 3
docs/api/core/Projector.html

@@ -25,12 +25,22 @@
 
 
 		<h3>.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Ray]</h3>
 		<h3>.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Ray]</h3>
 		<div>
 		<div>
-		Translates a 2D point from NDC to a [page:Ray] that can be used for picking.
+		Translates a 2D point from NDC (<em>Normalized Device Coordinates</em>) to a [page:Ray] that can be used for picking. NDC range from [-1..1] in x (left to right) and [1.0 .. -1.0] in y (top to bottom).
 		</div>
 		</div>
 
 
-		<h3>.projectGraph( [page:Object3D root], [page:Boolean sort] ) [page:Object]</h3>
-
 		<h3>.projectScene( [page:Scene scene], [page:Camera camera], [page:Boolean sort] ) [page:Object]</h3>
 		<h3>.projectScene( [page:Scene scene], [page:Camera camera], [page:Boolean sort] ) [page:Object]</h3>
+		<div>
+		[page:Scene scene] — scene to project.<br />
+		[page:Camera camera] — camera to use in the projection.<br />
+		[page:Boolean sort] — select whether to sort elements using the <a href="http://en.wikipedia.org/wiki/Painter%27s_algorithm">Painter's algorithm</a>.
+		</div>
+		
+		<div>
+		Transforms a 3D [page:Scene scene] object into 2D render data that can be rendered in a screen with your renderer of choice, projecting and clipping things out according to the used camera.
+		</div>
+		<div>
+		If the <em>scene</em> were a real scene, this method would be the equivalent of taking a picture with the <em>camera</em> (and developing the film would be the next step, using a Renderer).
+		</div>
 
 
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 2 - 2
src/core/Projector.js

@@ -67,7 +67,7 @@ THREE.Projector = function() {
 
 
 	};
 	};
 
 
-	this.projectGraph = function ( root, sort ) {
+	function projectGraph( root, sort ) {
 
 
 		_objectCount = 0;
 		_objectCount = 0;
 
 
@@ -155,7 +155,7 @@ THREE.Projector = function() {
 
 
 		_frustum.setFromMatrix( _projScreenMatrix );
 		_frustum.setFromMatrix( _projScreenMatrix );
 
 
-		_renderData = this.projectGraph( scene, false );
+		_renderData = projectGraph( scene, false );
 
 
 		for ( o = 0, ol = _renderData.objects.length; o < ol; o++ ) {
 		for ( o = 0, ol = _renderData.objects.length; o < ol; o++ ) {
 
 

+ 7 - 7
src/renderers/CanvasRenderer.js

@@ -547,15 +547,15 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 						_vector3.copy( element.vertexNormalsWorld[ uv1 ] );
 						_vector3.copy( element.vertexNormalsWorld[ uv1 ] );
 						_uv1x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
 						_uv1x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
-						_uv1y = - ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
+						_uv1y = ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
 
 
 						_vector3.copy( element.vertexNormalsWorld[ uv2 ] );
 						_vector3.copy( element.vertexNormalsWorld[ uv2 ] );
 						_uv2x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
 						_uv2x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
-						_uv2y = - ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
+						_uv2y = ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
 
 
 						_vector3.copy( element.vertexNormalsWorld[ uv3 ] );
 						_vector3.copy( element.vertexNormalsWorld[ uv3 ] );
 						_uv3x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
 						_uv3x = ( _vector3.x * cameraMatrix.elements[0] + _vector3.y * cameraMatrix.elements[4] + _vector3.z * cameraMatrix.elements[8] ) * 0.5 + 0.5;
-						_uv3y = - ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
+						_uv3y = ( _vector3.x * cameraMatrix.elements[1] + _vector3.y * cameraMatrix.elements[5] + _vector3.z * cameraMatrix.elements[9] ) * 0.5 + 0.5;
 
 
 						patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap );
 						patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap );
 
 
@@ -665,7 +665,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 			setOpacity( material.opacity );
 			setOpacity( material.opacity );
 			setBlending( material.blending );
 			setBlending( material.blending );
 
 
-			if ( material.map !== null || material.envMap !== null ) {
+			if ( ( material.map !== undefined && material.map !== null ) || ( material.envMap !== undefined && material.envMap !== null ) ) {
 
 
 				// Let renderFace3() handle this
 				// Let renderFace3() handle this
 
 
@@ -859,13 +859,13 @@ THREE.CanvasRenderer = function ( parameters ) {
 			height = texture.image.height * texture.repeat.y;
 			height = texture.image.height * texture.repeat.y;
 
 
 			u0 = ( u0 + offsetX ) * width;
 			u0 = ( u0 + offsetX ) * width;
-			v0 = ( v0 + offsetY ) * height;
+			v0 = ( 1.0 - v0 + offsetY ) * height;
 
 
 			u1 = ( u1 + offsetX ) * width;
 			u1 = ( u1 + offsetX ) * width;
-			v1 = ( v1 + offsetY ) * height;
+			v1 = ( 1.0 - v1 + offsetY ) * height;
 
 
 			u2 = ( u2 + offsetX ) * width;
 			u2 = ( u2 + offsetX ) * width;
-			v2 = ( v2 + offsetY ) * height;
+			v2 = ( 1.0 - v2 + offsetY ) * height;
 
 
 			x1 -= x0; y1 -= y0;
 			x1 -= x0; y1 -= y0;
 			x2 -= x0; y2 -= y0;
 			x2 -= x0; y2 -= y0;

+ 4 - 4
src/renderers/WebGLRenderer.js

@@ -222,11 +222,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	this.setViewport = function ( x, y, width, height ) {
 	this.setViewport = function ( x, y, width, height ) {
 
 
-		_viewportX = x;
-		_viewportY = y;
+		_viewportX = x !== undefined ? x : 0;
+		_viewportY = y !== undefined ? y : 0;
 
 
-		_viewportWidth = width;
-		_viewportHeight = height;
+		_viewportWidth = width !== undefined ? width : _canvas.width;
+		_viewportHeight = height !== undefined ? height : _canvas.height;
 
 
 		_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );
 		_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );
 
 

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