diff --git a/build/three.min.js b/build/three.min.js index 387671d73cd8da8fbff63c35193ace4abfa5f682..af90d5ca16e95777fc8ca593c75ae6644b5556c6 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,7 +1,7 @@ // three.min.js - http://github.com/mrdoob/three.js 'use strict';var THREE=THREE||{REVISION:"51dev"};void 0===self.console&&(self.console={info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}});void 0===self.Int32Array&&(self.Int32Array=Array,self.Float32Array=Array);String.prototype.startsWith||(String.prototype.startsWith=function(a){return this.slice(0,a.length)===a});String.prototype.endsWith||(String.prototype.endsWith=function(a){var a=String(a),b=this.lastIndexOf(a);return b>=0&&b===this.length-a.length}); String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}); -(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c>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 this.r*255<<16^this.g*255<<8^this.b*255<<0},getContextStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},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= @@ -19,189 +19,189 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a; a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y= this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())}, setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this, -a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],h=d[1],i=d[5],l=d[9],j=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(l));if(Math.abs(l)< -0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-j,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-j,d);this.z=Math.atan2(-e,i)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(h,f)}else{this.x=0;this.z=Math.atan2(-e,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-l,i);this.y=Math.atan2(-j, -f)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,i);this.y=Math.atan2(g,f)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}else if(b=== -"YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z* -a.y),g-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-f-e);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x= +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],l=d[9],j=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,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(l));if(Math.abs(l)< +0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-j,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-j,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(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(n,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(-l,i);this.y=Math.atan2(-j, +e)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(n,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* +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()<1E-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())}, lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},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<1E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(f+h+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;e= -(e+c)/4;i=(i+b)/4;if(f>h&&f>l)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(h>l)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(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=e/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+h+l-1)/2);return this}};THREE.Matrix3=function(){this.elements=new Float32Array(9)}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-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]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*f;j[4]=b*e;j[5]=b*g;j[6]=b*h;j[7]=b*i;j[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,h,i,l,j,n,m,q,p,o){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,h||0,i||0,l||0,j!==void 0?j:1,n||0,m||0,q||0,p||0,o!==void 0?o:1)}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,l,j,n,m,q,p,o){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=f;r[5]=e;r[9]=g;r[13]=h;r[2]=i;r[6]=l;r[10]=j;r[14]=n;r[3]=m;r[7]=q;r[11]=p;r[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, -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+1E-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],h=c[8],i=c[12],l=c[1],j=c[5],n=c[9],m=c[13],q=c[2],p=c[6],o=c[10],r=c[14],t=c[3],u=c[7],w=c[11],c=c[15],s=d[0],B=d[4], -v=d[8],A=d[12],D=d[1],z=d[5],M=d[9],G=d[13],H=d[2],E=d[6],O=d[10],F=d[14],J=d[3],I=d[7],K=d[11],d=d[15];f[0]=e*s+g*D+h*H+i*J;f[4]=e*B+g*z+h*E+i*I;f[8]=e*v+g*M+h*O+i*K;f[12]=e*A+g*G+h*F+i*d;f[1]=l*s+j*D+n*H+m*J;f[5]=l*B+j*z+n*E+m*I;f[9]=l*v+j*M+n*O+m*K;f[13]=l*A+j*G+n*F+m*d;f[2]=q*s+p*D+o*H+r*J;f[6]=q*B+p*z+o*E+r*I;f[10]=q*v+p*M+o*O+r*K;f[14]=q*A+p*G+o*F+r*d;f[3]=t*s+u*D+w*H+c*J;f[7]=t*B+u*z+w*E+c*I;f[11]=t*v+u*M+w*O+c*K;f[15]=t*A+u*G+w*F+c*d;return this},multiplySelf:function(a){return this.multiply(this, +Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var l=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+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;f= +(f+c)/4;i=(i+b)/4;if(e>h&&e>l)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>l)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(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+l-1)/2);return this}};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],i=-b[9]*b[0]+b[1]*b[8],l=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,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*e;j[4]=b*f;j[5]=b*g;j[6]=b*h;j[7]=b*i;j[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,e,f,g,h,i,l,j,n,m,q,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,h||0,i||0,l||0,j!==void 0?j:1,n||0,m||0,q||0,p||0,o!==void 0?o:1)}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,l,j,n,m,q,p,o){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=i;r[6]=l;r[10]=j;r[14]=n;r[3]=m;r[7]=q;r[11]=p;r[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+1E-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],l=c[1],j=c[5],n=c[9],m=c[13],q=c[2],p=c[6],o=c[10],r=c[14],t=c[3],u=c[7],w=c[11],c=c[15],s=d[0],B=d[4], +v=d[8],A=d[12],D=d[1],z=d[5],M=d[9],E=d[13],H=d[2],F=d[6],O=d[10],G=d[14],J=d[3],I=d[7],K=d[11],d=d[15];e[0]=f*s+g*D+h*H+i*J;e[4]=f*B+g*z+h*F+i*I;e[8]=f*v+g*M+h*O+i*K;e[12]=f*A+g*E+h*G+i*d;e[1]=l*s+j*D+n*H+m*J;e[5]=l*B+j*z+n*F+m*I;e[9]=l*v+j*M+n*O+m*K;e[13]=l*A+j*E+n*G+m*d;e[2]=q*s+p*D+o*H+r*J;e[6]=q*B+p*z+o*F+r*I;e[10]=q*v+p*M+o*O+r*K;e[14]=q*A+p*E+o*G+r*d;e[3]=t*s+u*D+w*H+c*J;e[7]=t*B+u*z+w*F+c*I;e[11]=t*v+u*M+w*O+c*K;e[15]=t*A+u*E+w*G+c*d;return this},multiplySelf:function(a){return this.multiply(this, a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]= -b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1, -c=0,d=a.length;c=0&&a>=0&&f+a<1},p=function(i,j,l){var n,o;if(i instanceof a.Particle){n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>i.scale.x)return l;o={distance:n,point:i.position,face:null,object:i};l.push(o)}else if(i instanceof a.Mesh){var p=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>p)return l;var v, -A,D=i.geometry,z=D.vertices,M,G,H;M=i.geometry.materials;G=i.material instanceof a.MeshFaceMaterial;var E,O=j.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(j.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(j.direction);h.rotateAxis(d).normalize();p=0;for(v=D.faces.length;p0))){g.add(c,d.multiplyScalar(A));if(o instanceof a.Face3){n=z[o.a];A=z[o.b];H=z[o.c];if(q(g,n,A,H)){A=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(A);if(!(nj.far)){o={distance:n,point:A,face:o,faceIndex:p,object:i};l.push(o)}}}else if(o instanceof a.Face4){n=z[o.a];A=z[o.b];H=z[o.c];E=z[o.d];if(q(g,n,A,E)||q(g,A,H,E)){A=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(A);if(!(nj.far)){o={distance:n,point:A,face:o,faceIndex:p, -object:i};l.push(o)}}}}}}}}},o=function(a,b,c){for(var a=a.getDescendants(),d=0,f=a.length;de?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,j,n,m,q){if(h===true){h=false;b=ej?e>m?e:m:j>m?j:m;f=g>n?g>q?g:q:n>q?n:q}else{b=ej?e>m?e>d?e:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;f=g>n?g>q?g>f?g:f:q>f?q:f:n>q?n>f?n:f:q>f?q:f}a()};this.addRectangle=function(e){if(h===true){h=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=be.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=da.getRight()||fa.getBottom()?false:true};this.empty=function(){h=true;f=d=c=b=0;a()};this.isEmpty=function(){return h}}; -THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a0?1:0}}; +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],l=c[7],j=c[8],n=c[9],m=c[10],q=c[11],p=c[12],o=c[13],r=c[14],c=c[15];b[0].set(f-a,l-g,q-j,c-p);b[1].set(f+a,l+g,q+j,c+p);b[2].set(f+d,l+h,q+n,c+o);b[3].set(f-d,l-h,q-n,c-o);b[4].set(f-e,l-i,q-m,c-r);b[5].set(f+e,l+i,q+m,c+r);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}}; +THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3; +(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3,f=new a.Vector3,g=new a.Vector3,h=new a.Matrix4,i=function(a,b){return a.distance-b.distance},l=new a.Vector3,j=new a.Vector3,n=new a.Vector3,m=function(a,b,c){l.sub(c,a);var d=l.dot(b),a=j.add(a,n.copy(b).multiplyScalar(d));return c.distanceTo(a)},q=function(a,b,c,d){l.sub(d,b);j.sub(c,b);n.sub(a, +b);var a=l.dot(l),b=l.dot(j),c=l.dot(n),e=j.dot(j),d=j.dot(n),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return e>=0&&a>=0&&e+a<1},p=function(i,j,l){var n,o;if(i instanceof a.Particle){n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>i.scale.x)return l;o={distance:n,point:i.position,face:null,object:i};l.push(o)}else if(i instanceof a.Mesh){var p=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>p)return l;var v, +A,D=i.geometry,z=D.vertices,M,E,H;M=i.geometry.materials;E=i.material instanceof a.MeshFaceMaterial;var F,O=j.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(j.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(j.direction);h.rotateAxis(d).normalize();p=0;for(v=D.faces.length;p0))){g.add(c,d.multiplyScalar(A));if(o instanceof a.Face3){n=z[o.a];A=z[o.b];H=z[o.c];if(q(g,n,A,H)){A=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(A);if(!(nj.far)){o={distance:n,point:A,face:o,faceIndex:p,object:i};l.push(o)}}}else if(o instanceof a.Face4){n=z[o.a];A=z[o.b];H=z[o.c];F=z[o.d];if(q(g,n,A,F)||q(g,A,H,F)){A=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(A);if(!(nj.far)){o={distance:n,point:A,face:o,faceIndex:p, +object:i};l.push(o)}}}}}}}}},o=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;df?d:f;e=e>g?e:g}a()};this.add3Points=function(f,g,j,n,m,q){if(h===true){h=false;b=fj?f>m?f:m:j>m?j:m;e=g>n?g>q?g:q:n>q?n:q}else{b=fj?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;e=g>n?g>q?g>e?g:e:q>e?q:e:n>q?n>e?n:e:q>e?q: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=bf.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=da.getRight()||ea.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 ac?c:a},clampBottom:function(a,b){return a0?1:0}}; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion= new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a, this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself."); -else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c=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(dba&&i.positionScreen.z0)){U=j[l-2];I.copy(N.positionScreen);K.copy(U.positionScreen);if(d(I,K)===true){I.multiplyScalar(1/I.w);K.multiplyScalar(1/K.w);if(s===v){Ja=new THREE.RenderableLine;B.push(Ja);v++;s++;w=Ja}else w=B[s++];w.v1.positionScreen.copy(I);w.v2.positionScreen.copy(K);w.z=Math.max(I.z,K.z); -w.material=pa.material;G.elements.push(w)}}}}}g=0;for(n=G.sprites.length;g0&&E.z<1){if(D===M){ba=new THREE.RenderableParticle;z.push(ba);M++;D++;A=ba}else A=z[D++];A.object=pa;A.x=E.x/E.w;A.y=E.y/E.w;A.z=E.z;A.rotation=pa.rotation.z;A.scale.x=pa.scale.x*Math.abs(A.x-(E.x+h.projectionMatrix.elements[0])/(E.w+h.projectionMatrix.elements[12])); -A.scale.y=pa.scale.y*Math.abs(A.y-(E.y+h.projectionMatrix.elements[5])/(E.w+h.projectionMatrix.elements[13]));A.material=pa.material;G.elements.push(A)}}}L===true&&G.elements.sort(c);return G}};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),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f-e*g*h}else if(b==="YXZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z= -c*d*h-e*g*f;this.w=c*d*f+e*g*h}else if(b==="ZXY"){this.x=e*d*f-c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f-e*g*h}else if(b==="ZYX"){this.x=e*d*f-c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h-e*g*f;this.w=c*d*f+e*g*h}else if(b==="YZX"){this.x=e*d*f+c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h-e*g*f;this.w=c*d*f-e*g*h}else if(b==="XZY"){this.x=e*d*f-c*g*h;this.y=c*g*f-e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f+e*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],f=b[1],e=b[5],g=b[9],h=b[2],i=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=(i-g)*c;this.y=(d-h)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+h)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-h)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x= +THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(l===n){var a=new THREE.RenderableVertex;j.push(a);n++;l++;return a}return j[l++]}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(dba&&i.positionScreen.z0)){U=j[l-2];I.copy(N.positionScreen);K.copy(U.positionScreen);if(d(I,K)===true){I.multiplyScalar(1/I.w);K.multiplyScalar(1/ +K.w);if(s===v){Ja=new THREE.RenderableLine;B.push(Ja);v++;s++;w=Ja}else w=B[s++];w.v1.positionScreen.copy(I);w.v2.positionScreen.copy(K);w.z=Math.max(I.z,K.z);w.material=pa.material;E.elements.push(w)}}}}}g=0;for(n=E.sprites.length;g0&&F.z<1){if(D===M){ba=new THREE.RenderableParticle;z.push(ba);M++;D++;A=ba}else A=z[D++]; +A.object=pa;A.x=F.x/F.w;A.y=F.y/F.w;A.z=F.z;A.rotation=pa.rotation.z;A.scale.x=pa.scale.x*Math.abs(A.x-(F.x+h.projectionMatrix.elements[0])/(F.w+h.projectionMatrix.elements[12]));A.scale.y=pa.scale.y*Math.abs(A.y-(F.y+h.projectionMatrix.elements[5])/(F.w+h.projectionMatrix.elements[13]));A.material=pa.material;E.elements.push(A)}}}L===true&&E.elements.sort(c);return E}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1}; +THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),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* +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],l=c+f+b;if(l>0){c=0.5/Math.sqrt(l+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){var c=a.x,d=a.y,f=a.z,e=a.w,g=b.x,h=b.y,i=b.z,l=b.w;this.x=c*l+d*i-f*h+e*g;this.y=-c*i+d*l+f*g+e*h;this.z=c*h-d*g+f*l+e*i;this.w=-c*g-d*h-f*i+e*l;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g= -this.y,h=this.z,i=this.w,l=i*c+g*f-h*d,j=i*d+h*c-e*f,n=i*f+e*d-g*c,c=-e*c-g*d-h*f;b.x=l*i+c*-e+j*-h-n*-g;b.y=j*i+c*-g+n*-e-l*-h;b.z=n*i+c*-h+l*-g-j*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);this.y=0.5* -(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=e*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=f*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 f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c}; -THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; +this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,l=b.w;this.x=c*l+d*i-e*h+f*g;this.y=-c*i+d*l+e*g+f*h;this.z=c*h-d*g+e*l+f*i;this.w=-c*g-d*h-e*i+f*l;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g= +this.y,h=this.z,i=this.w,l=i*c+g*e-h*d,j=i*d+h*c-f*e,n=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=l*i+c*-f+j*-h-n*-g;b.y=j*i+c*-g+n*-f-l*-h;b.z=n*i+c*-h+l*-g-j*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);this.y=0.5* +(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c}; +THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b0){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;dc.x)c.x= -a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){var a=0;if(this.boundingSphere===null)this.boundingSphere={radius:0};for(var b=0,c=this.vertices.length;ba&&(a=d)}this.boundingSphere.radius=Math.sqrt(a)},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,h,i;e=0;for(g=this.vertices.length;e0;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(h=this.faceVertexUvs.length;d0){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;dc.x)c.x= +a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){var a=0;if(this.boundingSphere===null)this.boundingSphere={radius:0};for(var b=0,c=this.vertices.length;ba&&(a=d)}this.boundingSphere.radius=Math.sqrt(a)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f0;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;db.max.x)b.max.x=c;if(db.max.y)b.max.y=d;if(fb.max.z)b.max.z=f}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,f,e=0,g=a.length;ec&&(c=b)}this.boundingSphere.radius=Math.sqrt(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;ab.max.x)b.max.x=c;if(db.max.y)b.max.y=d;if(eb.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;fc&&(c=b)}this.boundingSphere.radius=Math.sqrt(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;athis.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1: -e+2;l=this.points[c[0]];j=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,j.x,n.x,m.x,g,h,i);d.y=b(l.y,j.y,n.y,m.y,g,h,i);d.z=b(l.z,j.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;athis.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: +f+2;l=this.points[c[0]];j=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,j.x,n.x,m.x,g,h,i);d.y=b(l.y,j.y,n.y,m.y,g,h,i);d.z=b(l.z,j.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a1&&(z=new THREE.MeshFaceMaterial); -if(d.morph){e=new THREE.MorphAnimMesh(D,z);if(d.duration!==void 0)e.duration=d.duration;if(d.time!==void 0)e.time=d.time;if(d.mirroredLoop!==void 0)e.mirroredLoop=d.mirroredLoop;z.morphNormals&&D.computeMorphNormals()}else e=new THREE.Mesh(D,z);e.name=c;if(r){e.matrixAutoUpdate=false;e.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{e.position.set(u[0],u[1],u[2]);if(s){e.quaternion.set(s[0],s[1],s[2],s[3]);e.useQuaternion=true}else e.rotation.set(w[0], -w[1],w[2]);e.scale.set(B[0],B[1],B[2])}e.visible=d.visible;e.castShadow=d.castShadow;e.receiveShadow=d.receiveShadow;a.add(e);I.objects[c]=e}}else{u=d.position;w=d.rotation;s=d.quaternion;B=d.scale;s=0;e=new THREE.Object3D;e.name=c;e.position.set(u[0],u[1],u[2]);if(s){e.quaternion.set(s[0],s[1],s[2],s[3]);e.useQuaternion=true}else e.rotation.set(w[0],w[1],w[2]);e.scale.set(B[0],B[1],B[2]);e.visible=d.visible!==void 0?d.visible:false;a.add(e);I.objects[c]=e;I.empties[c]=e}if(e){if(d.properties!==void 0)for(var g in d.properties)e.properties[g]= -d.properties[g];d.children!==void 0&&f(e,d.children)}}}function e(a){return function(b){I.geometries[a]=b;f(I.scene,K.objects);E=E-1;i.onLoadComplete();h()}}function g(a){return function(b){I.geometries[a]=b}}function h(){i.callbackProgress({totalModels:F,totalTextures:J,loadedModels:F-E,loadedTextures:J-O},I);i.onLoadProgress();E===0&&O===0&&b(I)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,n,m,q,p,o,r,t,u,w,s,B,v,A,D,z,M,G,H,E,O,F,J,I,K=a;for(v in this.geometryHandlerMap)this.geometryHandlerMap[v].loaderObject= -new this.geometryHandlerMap[v].loaderClass;O=E=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(K.transform){a=K.transform.position;c=K.transform.rotation;v=K.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);c&&I.scene.rotation.set(c[0],c[1],c[2]);v&&I.scene.scale.set(v[0],v[1],v[2]);if(a||c||v){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(a){return function(){O=O-a;h();i.onLoadComplete()}};for(q in K.cameras){v= +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.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}}; +THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(a,b){for(var c in b)if(I.objects[c]===void 0){var d=b[c],f=null;if(d.geometry!==void 0){if(D=I.geometries[d.geometry]){f=false;z=I.materials[d.materials[0]];(f=z instanceof THREE.ShaderMaterial)&&D.computeTangents();u=d.position;w=d.rotation;s=d.quaternion;B=d.scale;r=d.matrix;s=0;d.materials.length===0&&(z=new THREE.MeshFaceMaterial);d.materials.length>1&&(z=new THREE.MeshFaceMaterial); +if(d.morph){f=new THREE.MorphAnimMesh(D,z);if(d.duration!==void 0)f.duration=d.duration;if(d.time!==void 0)f.time=d.time;if(d.mirroredLoop!==void 0)f.mirroredLoop=d.mirroredLoop;z.morphNormals&&D.computeMorphNormals()}else f=new THREE.Mesh(D,z);f.name=c;if(r){f.matrixAutoUpdate=false;f.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{f.position.set(u[0],u[1],u[2]);if(s){f.quaternion.set(s[0],s[1],s[2],s[3]);f.useQuaternion=true}else f.rotation.set(w[0], +w[1],w[2]);f.scale.set(B[0],B[1],B[2])}f.visible=d.visible;f.castShadow=d.castShadow;f.receiveShadow=d.receiveShadow;a.add(f);I.objects[c]=f}}else{u=d.position;w=d.rotation;s=d.quaternion;B=d.scale;s=0;f=new THREE.Object3D;f.name=c;f.position.set(u[0],u[1],u[2]);if(s){f.quaternion.set(s[0],s[1],s[2],s[3]);f.useQuaternion=true}else f.rotation.set(w[0],w[1],w[2]);f.scale.set(B[0],B[1],B[2]);f.visible=d.visible!==void 0?d.visible:false;a.add(f);I.objects[c]=f;I.empties[c]=f}if(f){if(d.properties!==void 0)for(var g in d.properties)f.properties[g]= +d.properties[g];d.children!==void 0&&e(f,d.children)}}}function f(a){return function(b){I.geometries[a]=b;e(I.scene,K.objects);F=F-1;i.onLoadComplete();h()}}function g(a){return function(b){I.geometries[a]=b}}function h(){i.callbackProgress({totalModels:G,totalTextures:J,loadedModels:G-F,loadedTextures:J-O},I);i.onLoadProgress();F===0&&O===0&&b(I)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,n,m,q,p,o,r,t,u,w,s,B,v,A,D,z,M,E,H,F,O,G,J,I,K=a;for(v in this.geometryHandlerMap)this.geometryHandlerMap[v].loaderObject= +new this.geometryHandlerMap[v].loaderClass;O=F=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(K.transform){a=K.transform.position;c=K.transform.rotation;v=K.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);c&&I.scene.rotation.set(c[0],c[1],c[2]);v&&I.scene.scale.set(v[0],v[1],v[2]);if(a||c||v){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(a){return function(){O=O-a;h();i.onLoadComplete()}};for(q in K.cameras){v= K.cameras[q];v.type==="perspective"?M=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type==="ortho"&&(M=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));u=v.position;c=v.target;v=v.up;M.position.set(u[0],u[1],u[2]);M.target=new THREE.Vector3(c[0],c[1],c[2]);v&&M.up.set(v[0],v[1],v[2]);I.cameras[q]=M}for(m in K.lights){c=K.lights[m];q=c.color!==void 0?c.color:16777215;M=c.intensity!==void 0?c.intensity:1;if(c.type==="directional"){u=c.direction;t=new THREE.DirectionalLight(q, -M);t.position.set(u[0],u[1],u[2]);t.position.normalize()}else if(c.type==="point"){u=c.position;t=c.distance;t=new THREE.PointLight(q,M,t);t.position.set(u[0],u[1],u[2])}else c.type==="ambient"&&(t=new THREE.AmbientLight(q));I.scene.add(t);I.lights[m]=t}for(p in K.fogs){m=K.fogs[p];m.type==="linear"?G=new THREE.Fog(0,m.near,m.far):m.type==="exp2"&&(G=new THREE.FogExp2(0,m.density));v=m.color;G.color.setRGB(v[0],v[1],v[2]);I.fogs[p]=G}if(I.cameras&&K.defaults.camera)I.currentCamera=I.cameras[K.defaults.camera]; -if(I.fogs&&K.defaults.fog)I.scene.fog=I.fogs[K.defaults.fog];v=K.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=K.defaults.bgalpha;for(j in K.geometries){p=K.geometries[j];if(p.type in this.geometryHandlerMap){E=E+1;i.onLoadStart()}}F=E;for(j in K.geometries){p=K.geometries[j];if(p.type==="cube"){D=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);I.geometries[j]=D}else if(p.type==="plane"){D= +M);t.position.set(u[0],u[1],u[2]);t.position.normalize()}else if(c.type==="point"){u=c.position;t=c.distance;t=new THREE.PointLight(q,M,t);t.position.set(u[0],u[1],u[2])}else c.type==="ambient"&&(t=new THREE.AmbientLight(q));I.scene.add(t);I.lights[m]=t}for(p in K.fogs){m=K.fogs[p];m.type==="linear"?E=new THREE.Fog(0,m.near,m.far):m.type==="exp2"&&(E=new THREE.FogExp2(0,m.density));v=m.color;E.color.setRGB(v[0],v[1],v[2]);I.fogs[p]=E}if(I.cameras&&K.defaults.camera)I.currentCamera=I.cameras[K.defaults.camera]; +if(I.fogs&&K.defaults.fog)I.scene.fog=I.fogs[K.defaults.fog];v=K.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=K.defaults.bgalpha;for(j in K.geometries){p=K.geometries[j];if(p.type in this.geometryHandlerMap){F=F+1;i.onLoadStart()}}G=F;for(j in K.geometries){p=K.geometries[j];if(p.type==="cube"){D=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);I.geometries[j]=D}else if(p.type==="plane"){D= new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight);I.geometries[j]=D}else if(p.type==="sphere"){D=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight);I.geometries[j]=D}else if(p.type==="cylinder"){D=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs);I.geometries[j]=D}else if(p.type==="torus"){D=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT);I.geometries[j]=D}else if(p.type==="icosahedron"){D=new THREE.IcosahedronGeometry(p.radius, -p.subdivisions);I.geometries[j]=D}else if(p.type in this.geometryHandlerMap){G={};for(H in p)H!=="type"&&H!=="url"&&(G[H]=p[H]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,K.urlBaseType),e(j),G)}else if(p.type==="embedded"){p=K.embeds[p.id];p.metadata=K.metadata;p&&this.geometryHandlerMap.ascii.loaderObject.createModel(p,g(j),"")}}for(o in K.textures){j=K.textures[o];if(j.url instanceof Array){O=O+j.url.length;for(H=0;H256?64:a>64?32:a>16?16:8;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType);this.boneTexture.minFilter=THREE.NearestFilter;this.boneTexture.magFilter= THREE.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else this.boneMatrices=new Float32Array(16*a);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a}; THREE.SkinnedMesh.prototype.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}for(var a=0,b=this.children.length;a1){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];if(fh.end)h.end=f;b||(b=g)}}a.firstAnimation=b}; +THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;if(!a.animations)a.animations={};for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;e1){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];if(eh.end)h.end=e;b||(b=g)}}a.firstAnimation=b}; THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){if(!this.geometry.animations)this.geometry.animations={};this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];if(c){this.setFrameRange(c.start,c.end);this.duration=1E3*((c.end-c.start)/b);this.time=0}else console.warn("animation["+a+"] undefined")}; THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time=this.time+this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction=this.direction*-1;if(this.time>this.duration){this.time=this.duration;this.directionBackwards=true}if(this.time<0){this.time=0;this.directionBackwards=false}}}else{this.time=this.time%this.duration;if(this.time<0)this.time=this.time+this.duration}a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/ b),0,this.length-1);if(a!==this.currentKeyframe){this.morphTargetInfluences[this.lastKeyframe]=0;this.morphTargetInfluences[this.currentKeyframe]=1;this.morphTargetInfluences[a]=0;this.lastKeyframe=this.currentKeyframe;this.currentKeyframe=a}b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b}; @@ -261,35 +261,35 @@ 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;b0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")");o.fillRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()))}Fa.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,f=i.length;d1?1:a}function sb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;if(f!==0){f=1/Math.sqrt(f);c=c*f;d=d*f;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}if(k instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{var Vb,Ec,B,X;this.autoClear=== -true?this.clear():o.setTransform(1,0,0,-1,q,p);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,k,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;xb=i.length>0;if(xb===true){Ga.setRGB(0,0,0);$a.setRGB(0,0,0);rb.setRGB(0,0,0);Vb=0;for(Ec=i.length;Vb0){c(THREE.NormalBlending);b(1);e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")");o.fillRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()))}Fa.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,e=i.length;d1?1:a}function sb(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}}if(k instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{var Vb,Ec,B,X;this.autoClear=== +true?this.clear():o.setTransform(1,0,0,-1,q,p);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;qb=i.length>0;if(qb===true){Ga.setRGB(0,0,0);$a.setRGB(0,0,0);rb.setRGB(0,0,0);Vb=0;for(Ec=i.length;Vb>1;Tc=Wb.height>>1;jb=oa.scale.x*q;kb=oa.scale.y*p;Ea=jb*B;tb=kb*Tc;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(fb.intersects(xa)!==false){o.save();o.translate(ca.x,ca.y);o.rotate(-oa.rotation);o.scale(jb,-kb);o.translate(-B,-Tc);o.drawImage(Wb,0,0);o.restore()}}else if(X instanceof THREE.ParticleCanvasMaterial){Ea= -oa.scale.x*q;tb=oa.scale.y*p;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(fb.intersects(xa)!==false){d(X.color.getContextStyle());f(X.color.getContextStyle());o.save();o.translate(ca.x,ca.y);o.rotate(-oa.rotation);o.scale(Ea,tb);X.program(o);o.restore()}}}else if(B instanceof THREE.RenderableLine){z=B.v1;M=B.v2;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;xa.addPoint(z.positionScreen.x, +kb,ca.x+jb,ca.y+kb);if(fb.intersects(xa)!==false){e(X.color.getContextStyle());o.save();o.translate(ca.x,ca.y);o.rotate(-oa.rotation);o.scale(jb,kb);o.fillRect(-1,-1,2,2);o.restore()}}else{Wb=X.map.image;B=Wb.width>>1;Tc=Wb.height>>1;jb=oa.scale.x*q;kb=oa.scale.y*p;Ea=jb*B;tb=kb*Tc;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(fb.intersects(xa)!==false){o.save();o.translate(ca.x,ca.y);o.rotate(-oa.rotation);o.scale(jb,-kb);o.translate(-B,-Tc);o.drawImage(Wb,0,0);o.restore()}}else if(X instanceof THREE.ParticleCanvasMaterial){Ea= +oa.scale.x*q;tb=oa.scale.y*p;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(fb.intersects(xa)!==false){d(X.color.getContextStyle());e(X.color.getContextStyle());o.save();o.translate(ca.x,ca.y);o.rotate(-oa.rotation);o.scale(Ea,tb);X.program(o);o.restore()}}}else if(B instanceof THREE.RenderableLine){z=B.v1;M=B.v2;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;xa.addPoint(z.positionScreen.x, z.positionScreen.y);xa.addPoint(M.positionScreen.x,M.positionScreen.y);if(fb.intersects(xa)===true){ca=z;oa=M;b(X.opacity);c(X.blending);o.beginPath();o.moveTo(ca.positionScreen.x,ca.positionScreen.y);o.lineTo(oa.positionScreen.x,oa.positionScreen.y);if(X instanceof THREE.LineBasicMaterial){ca=X.linewidth;if(v!==ca)v=o.lineWidth=ca;ca=X.linecap;if(A!==ca)A=o.lineCap=ca;ca=X.linejoin;if(D!==ca)D=o.lineJoin=ca;d(X.color.getContextStyle());o.stroke();xa.inflate(X.linewidth*2)}}}else if(B instanceof THREE.RenderableFace3){z= -B.v1;M=B.v2;G=B.v3;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;G.positionScreen.x=G.positionScreen.x*q;G.positionScreen.y=G.positionScreen.y*p;if(X.overdraw===true){sb(z.positionScreen,M.positionScreen);sb(M.positionScreen,G.positionScreen);sb(G.positionScreen,z.positionScreen)}xa.add3Points(z.positionScreen.x,z.positionScreen.y,M.positionScreen.x,M.positionScreen.y,G.positionScreen.x, -G.positionScreen.y);fb.intersects(xa)===true&&n(z,M,G,0,1,2,B,X,a)}else if(B instanceof THREE.RenderableFace4){z=B.v1;M=B.v2;G=B.v3;H=B.v4;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;G.positionScreen.x=G.positionScreen.x*q;G.positionScreen.y=G.positionScreen.y*p;H.positionScreen.x=H.positionScreen.x*q;H.positionScreen.y=H.positionScreen.y*p;E.positionScreen.copy(M.positionScreen);O.positionScreen.copy(H.positionScreen); -if(X.overdraw===true){sb(z.positionScreen,M.positionScreen);sb(M.positionScreen,H.positionScreen);sb(H.positionScreen,z.positionScreen);sb(G.positionScreen,E.positionScreen);sb(G.positionScreen,O.positionScreen)}xa.addPoint(z.positionScreen.x,z.positionScreen.y);xa.addPoint(M.positionScreen.x,M.positionScreen.y);xa.addPoint(G.positionScreen.x,G.positionScreen.y);xa.addPoint(H.positionScreen.x,H.positionScreen.y);if(fb.intersects(xa)===true){oa=z;Ea=M;tb=G;jb=H;kb=E;Wb=O;ca=B;B=a;e.info.render.vertices= -e.info.render.vertices+4;e.info.render.faces++;b(X.opacity);c(X.blending);if(X.map!==void 0&&X.map!==null||X.envMap!==void 0&&X.envMap!==null){n(oa,Ea,jb,0,1,3,ca,X,B);n(kb,tb,Wb,1,2,3,ca,X,B)}else{F=oa.positionScreen.x;J=oa.positionScreen.y;I=Ea.positionScreen.x;K=Ea.positionScreen.y;V=tb.positionScreen.x;Y=tb.positionScreen.y;$=jb.positionScreen.x;L=jb.positionScreen.y;ba=kb.positionScreen.x;Q=kb.positionScreen.y;fa=Wb.positionScreen.x;ta=Wb.positionScreen.y;if(X instanceof THREE.MeshLambertMaterial|| -X instanceof THREE.MeshPhongMaterial)if(xb===true){oa=X.color;Ea=X.emissive;if(X.wireframe===false&&X.shading==THREE.SmoothShading&&ca.vertexNormalsLength==4){ga.r=N.r=U.r=ia.r=Ga.r;ga.g=N.g=U.g=ia.g=Ga.g;ga.b=N.b=U.b=ia.b=Ga.b;j(ca.v1.positionWorld,ca.vertexNormalsWorld[0],ga);j(ca.v2.positionWorld,ca.vertexNormalsWorld[1],N);j(ca.v4.positionWorld,ca.vertexNormalsWorld[3],U);j(ca.v3.positionWorld,ca.vertexNormalsWorld[2],ia);ga.r=oa.r*ga.r+Ea.r;ga.g=oa.g*ga.g+Ea.g;ga.b=oa.b*ga.b+Ea.b;N.r=oa.r*N.r+ -Ea.r;N.g=oa.g*N.g+Ea.g;N.b=oa.b*N.b+Ea.b;U.r=oa.r*U.r+Ea.r;U.g=oa.g*U.g+Ea.g;U.b=oa.b*U.b+Ea.b;ia.r=oa.r*ia.r+Ea.r;ia.g=oa.g*ia.g+Ea.g;ia.b=oa.b*ia.b+Ea.b;Ja=va(ga,N,U,ia);m(F,J,I,K,$,L);w(F,J,I,K,$,L,0,0,1,0,0,1,Ja);m(ba,Q,V,Y,fa,ta);w(ba,Q,V,Y,fa,ta,1,0,1,1,0,1,Ja)}else{da.r=Ga.r;da.g=Ga.g;da.b=Ga.b;j(ca.centroidWorld,ca.normalWorld,da);da.r=oa.r*da.r+Ea.r;da.g=oa.g*da.g+Ea.g;da.b=oa.b*da.b+Ea.b;r(F,J,I,K,V,Y,$,L);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin): -t(da)}}else{r(F,J,I,K,V,Y,$,L);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshBasicMaterial){r(F,J,I,K,V,Y,$,L);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshNormalMaterial){da.r=jc(ca.normalWorld.x);da.g=jc(ca.normalWorld.y);da.b=jc(ca.normalWorld.z);r(F,J,I,K,V,Y,$,L);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap, -X.wireframeLinejoin):t(da)}else if(X instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;ga.r=ga.g=ga.b=1-fc(oa.positionScreen.z,ua,Ca);N.r=N.g=N.b=1-fc(Ea.positionScreen.z,ua,Ca);U.r=U.g=U.b=1-fc(jb.positionScreen.z,ua,Ca);ia.r=ia.g=ia.b=1-fc(tb.positionScreen.z,ua,Ca);Ja=va(ga,N,U,ia);m(F,J,I,K,$,L);w(F,J,I,K,$,L,0,0,1,0,0,1,Ja);m(ba,Q,V,Y,fa,ta);w(ba,Q,V,Y,fa,ta,1,0,1,1,0,1,Ja)}}}}Fa.addRectangle(xa)}}o.setTransform(1,0,0,1,0,0)}}}; +B.v1;M=B.v2;E=B.v3;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;E.positionScreen.x=E.positionScreen.x*q;E.positionScreen.y=E.positionScreen.y*p;if(X.overdraw===true){sb(z.positionScreen,M.positionScreen);sb(M.positionScreen,E.positionScreen);sb(E.positionScreen,z.positionScreen)}xa.add3Points(z.positionScreen.x,z.positionScreen.y,M.positionScreen.x,M.positionScreen.y,E.positionScreen.x, +E.positionScreen.y);fb.intersects(xa)===true&&n(z,M,E,0,1,2,B,X,a)}else if(B instanceof THREE.RenderableFace4){z=B.v1;M=B.v2;E=B.v3;H=B.v4;z.positionScreen.x=z.positionScreen.x*q;z.positionScreen.y=z.positionScreen.y*p;M.positionScreen.x=M.positionScreen.x*q;M.positionScreen.y=M.positionScreen.y*p;E.positionScreen.x=E.positionScreen.x*q;E.positionScreen.y=E.positionScreen.y*p;H.positionScreen.x=H.positionScreen.x*q;H.positionScreen.y=H.positionScreen.y*p;F.positionScreen.copy(M.positionScreen);O.positionScreen.copy(H.positionScreen); +if(X.overdraw===true){sb(z.positionScreen,M.positionScreen);sb(M.positionScreen,H.positionScreen);sb(H.positionScreen,z.positionScreen);sb(E.positionScreen,F.positionScreen);sb(E.positionScreen,O.positionScreen)}xa.addPoint(z.positionScreen.x,z.positionScreen.y);xa.addPoint(M.positionScreen.x,M.positionScreen.y);xa.addPoint(E.positionScreen.x,E.positionScreen.y);xa.addPoint(H.positionScreen.x,H.positionScreen.y);if(fb.intersects(xa)===true){oa=z;Ea=M;tb=E;jb=H;kb=F;Wb=O;ca=B;B=a;f.info.render.vertices= +f.info.render.vertices+4;f.info.render.faces++;b(X.opacity);c(X.blending);if(X.map!==void 0&&X.map!==null||X.envMap!==void 0&&X.envMap!==null){n(oa,Ea,jb,0,1,3,ca,X,B);n(kb,tb,Wb,1,2,3,ca,X,B)}else{G=oa.positionScreen.x;J=oa.positionScreen.y;I=Ea.positionScreen.x;K=Ea.positionScreen.y;V=tb.positionScreen.x;Y=tb.positionScreen.y;$=jb.positionScreen.x;L=jb.positionScreen.y;ba=kb.positionScreen.x;Q=kb.positionScreen.y;fa=Wb.positionScreen.x;ta=Wb.positionScreen.y;if(X instanceof THREE.MeshLambertMaterial|| +X instanceof THREE.MeshPhongMaterial)if(qb===true){oa=X.color;Ea=X.emissive;if(X.wireframe===false&&X.shading==THREE.SmoothShading&&ca.vertexNormalsLength==4){ga.r=N.r=U.r=ia.r=Ga.r;ga.g=N.g=U.g=ia.g=Ga.g;ga.b=N.b=U.b=ia.b=Ga.b;j(ca.v1.positionWorld,ca.vertexNormalsWorld[0],ga);j(ca.v2.positionWorld,ca.vertexNormalsWorld[1],N);j(ca.v4.positionWorld,ca.vertexNormalsWorld[3],U);j(ca.v3.positionWorld,ca.vertexNormalsWorld[2],ia);ga.r=oa.r*ga.r+Ea.r;ga.g=oa.g*ga.g+Ea.g;ga.b=oa.b*ga.b+Ea.b;N.r=oa.r*N.r+ +Ea.r;N.g=oa.g*N.g+Ea.g;N.b=oa.b*N.b+Ea.b;U.r=oa.r*U.r+Ea.r;U.g=oa.g*U.g+Ea.g;U.b=oa.b*U.b+Ea.b;ia.r=oa.r*ia.r+Ea.r;ia.g=oa.g*ia.g+Ea.g;ia.b=oa.b*ia.b+Ea.b;Ja=va(ga,N,U,ia);m(G,J,I,K,$,L);w(G,J,I,K,$,L,0,0,1,0,0,1,Ja);m(ba,Q,V,Y,fa,ta);w(ba,Q,V,Y,fa,ta,1,0,1,1,0,1,Ja)}else{da.r=Ga.r;da.g=Ga.g;da.b=Ga.b;j(ca.centroidWorld,ca.normalWorld,da);da.r=oa.r*da.r+Ea.r;da.g=oa.g*da.g+Ea.g;da.b=oa.b*da.b+Ea.b;r(G,J,I,K,V,Y,$,L);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin): +t(da)}}else{r(G,J,I,K,V,Y,$,L);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshBasicMaterial){r(G,J,I,K,V,Y,$,L);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshNormalMaterial){da.r=jc(ca.normalWorld.x);da.g=jc(ca.normalWorld.y);da.b=jc(ca.normalWorld.z);r(G,J,I,K,V,Y,$,L);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap, +X.wireframeLinejoin):t(da)}else if(X instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;ga.r=ga.g=ga.b=1-fc(oa.positionScreen.z,ua,Ca);N.r=N.g=N.b=1-fc(Ea.positionScreen.z,ua,Ca);U.r=U.g=U.b=1-fc(jb.positionScreen.z,ua,Ca);ia.r=ia.g=ia.b=1-fc(tb.positionScreen.z,ua,Ca);Ja=va(ga,N,U,ia);m(G,J,I,K,$,L);w(G,J,I,K,$,L,0,0,1,0,0,1,Ja);m(ba,Q,V,Y,fa,ta);w(ba,Q,V,Y,fa,ta,1,0,1,1,0,1,Ja)}}}}Fa.addRectangle(xa)}}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\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.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, specularStrength * reflectivity );\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif", envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 mPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif", @@ -311,7 +311,7 @@ default_vertex:"vec4 mvPosition;\n#ifdef USE_SKINNING\nmvPosition = modelViewMat skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix \t+= skinWeight.y * boneMatY;\n#ifdef USE_MORPHNORMALS\nvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n#else\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif\n#endif",defaultnormal_vertex:"vec3 objectNormal;\n#ifdef USE_SKINNING\nobjectNormal = skinnedNormal.xyz;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\nobjectNormal = morphedNormal;\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\nobjectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\nobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;", shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * mPosition;\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"}; -THREE.UniformsUtils={merge:function(a){var b,c,d,f={};for(b=0;b=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 f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?true:false}function e(a){var b, -c,d;for(b in a.attributes){d=b==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;c=a.attributes[b];c.buffer=k.createBuffer();k.bindBuffer(d,c.buffer);k.bufferData(d,c.array,k.STATIC_DRAW)}}function g(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){gb.copy(bb);gb.multiplySelf(c.matrixWorld);for(d=0;d=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.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?true:false}function f(a){var b, +c,d;for(b in a.attributes){d=b==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;c=a.attributes[b];c.buffer=k.createBuffer();k.bindBuffer(d,c.buffer);k.bufferData(d,c.array,k.STATIC_DRAW)}}function g(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){gb.copy(bb);gb.multiplySelf(c.matrixWorld);for(d=0;d=0;c--)a[c].object===b&&a.splice(c,1)}function t(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){pa=0;if(d.needsUpdate){d.program&&Q.deallocateMaterial(d);Q.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==da){k.useProgram(g);da=g;e=true}if(d.id!==N){N=d.id; e=true}if(e||a!==ia){k.uniformMatrix4fv(h.projectionMatrix,false,a._projectionMatrixArray);a!==ia&&(ia=a)}if(d.skinning)if(ec&&f.useVertexTexture){if(h.boneTexture!==null){var j=w();k.uniform1i(h.boneTexture,j);Q.setTexture(f.boneTexture,j)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);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(hb){for(var l=0,m=0,n=0,o,p,q,r,s=qc,t=s.directional.colors,u=s.directional.positions,z=s.point.colors,A=s.point.positions,D=s.point.distances,G=s.spot.colors,H=s.spot.positions,I=s.spot.distances,F=s.spot.directions,J=s.spot.angles,K=s.spot.exponents,L=s.hemi.skyColors,U=s.hemi.groundColors,ga=s.hemi.positions,V=0,$=0,ba=0,Y=0,c=o=q=q=p=0,e=b.length;c=Dc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+Dc);pa=pa+1;return a}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix); -a._normalMatrix.transpose()}function B(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function v(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a,b,c){if(qb!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);qb=a}if(a&&(wb!==b||fb!==c)){k.polygonOffset(b,c);wb=b;fb=c}}function D(a){for(var a=a.split("\n"),b=0,c=a.length;b1||b.__oldAnisotropy)){k.texParameterf(a,Pb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,rc));b.__oldAnisotropy=b.anisotropy}}function G(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 H(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function E(a){if(a===THREE.RepeatWrapping)return k.REPEAT;if(a=== +a._normalMatrix.transpose()}function B(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function v(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a,b,c){if(wb!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);wb=a}if(a&&(xb!==b||fb!==c)){k.polygonOffset(b,c);xb=b;fb=c}}function D(a){for(var a=a.split("\n"),b=0,c=a.length;b1||b.__oldAnisotropy)){k.texParameterf(a,Pb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,rc));b.__oldAnisotropy=b.anisotropy}}function E(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 H(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function F(a){if(a===THREE.RepeatWrapping)return k.REPEAT;if(a=== THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return k.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return k.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return k.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return k.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return k.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return k.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return k.UNSIGNED_BYTE; if(a===THREE.UnsignedShort4444Type)return k.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return k.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return k.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return k.BYTE;if(a===THREE.ShortType)return k.SHORT;if(a===THREE.UnsignedShortType)return k.UNSIGNED_SHORT;if(a===THREE.IntType)return k.INT;if(a===THREE.UnsignedIntType)return k.UNSIGNED_INT;if(a===THREE.FloatType)return k.FLOAT;if(a===THREE.AlphaFormat)return k.ALPHA;if(a===THREE.RGBFormat)return k.RGB; if(a===THREE.RGBAFormat)return k.RGBA;if(a===THREE.LuminanceFormat)return k.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return k.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return k.FUNC_ADD;if(a===THREE.SubtractEquation)return k.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return k.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a===THREE.SrcColorFactor)return k.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a=== THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(yb!==void 0){if(a===THREE.RGB_S3TC_DXT1_Format)return yb.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return yb.COMPRESSED_RGBA_S3TC_DXT1_EXT; -if(a===THREE.RGBA_S3TC_DXT3_Format)return yb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return yb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},O=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.precision!==void 0?a.precision:"highp",J=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,K=a.antialias!==void 0?a.antialias:false,V=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!== +if(a===THREE.RGBA_S3TC_DXT3_Format)return yb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return yb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},O=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.precision!==void 0?a.precision:"highp",J=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,K=a.antialias!==void 0?a.antialias:false,V=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!== void 0?a.preserveDrawingBuffer:false,$=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),L=a.clearAlpha!==void 0?a.clearAlpha:0,ba=a.maxLights!==void 0?a.maxLights:4;this.domElement=O;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}};var Q=this,fa=[],ta=0,da=null,ga=null,N=-1,U=null,ia=null,Ia=0,pa=0,ua=-1,Ca=-1,Ja=-1,Xa=-1,ja=-1,pb=-1,Oa=-1,Ya=-1,qb=null,wb=null,fb=null,Fa=null,xa=0,xb=0,Ga=0,$a=0,rb=0,Da=0,ab=new THREE.Frustum, +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 Q=this,fa=[],ta=0,da=null,ga=null,N=-1,U=null,ia=null,Ia=0,pa=0,ua=-1,Ca=-1,Ja=-1,Xa=-1,ja=-1,pb=-1,Oa=-1,Ya=-1,wb=null,xb=null,fb=null,Fa=null,xa=0,qb=0,Ga=0,$a=0,rb=0,Da=0,ab=new THREE.Frustum, bb=new THREE.Matrix4,gb=new THREE.Matrix4,Pa=new THREE.Vector4,Qa=new THREE.Vector3,hb=true,qc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Pb,yb;try{if(!(k=O.getContext("experimental-webgl",{alpha:J,premultipliedAlpha:I,antialias:K,stencil:V,preserveDrawingBuffer:Y})))throw"Error creating WebGL context."; }catch(Rc){console.error(Rc)}a=k.getExtension("OES_texture_float");J=k.getExtension("OES_standard_derivatives");Pb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");yb=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");a||console.log("THREE.WebGLRenderer: Float textures not supported."); J||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Pb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");yb||console.log("THREE.WebGLRenderer: S3TC compressed textures 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($.r, $.g,$.b,L);this.context=k;var Dc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),J=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Sc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),rc=Pb?k.getParameter(Pb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,ic=J>0,ec=ic&&a;yb&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);this.getContext=function(){return k};this.supportsVertexTextures=function(){return ic};this.getMaxAnisotropy=function(){return rc};this.setSize=function(a,b){O.width= -a;O.height=b;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(a,b,c,d){xa=a!==void 0?a:0;xb=b!==void 0?b:0;Ga=c!==void 0?c:O.width;$a=d!==void 0?d:O.height;k.viewport(xa,xb,Ga,$a)};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){$.setHex(a);L=b;k.clearColor($.r,$.g,$.b,L)};this.setClearColor=function(a,b){$.copy(a);L=b;k.clearColor($.r,$.g,$.b,L)};this.getClearColor= +a;O.height=b;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(a,b,c,d){xa=a!==void 0?a:0;qb=b!==void 0?b:0;Ga=c!==void 0?c:O.width;$a=d!==void 0?d:O.height;k.viewport(xa,qb,Ga,$a)};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){$.setHex(a);L=b;k.clearColor($.r,$.g,$.b,L)};this.setClearColor=function(a,b){$.copy(a);L=b;k.clearColor($.r,$.g,$.b,L)};this.getClearColor= function(){return $};this.getClearAlpha=function(){return L};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._modelMatrixArray;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.__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;d65535){E[B].counter=E[B].counter+1;D=E[B].hash+"_"+E[B].counter;s.geometryGroups[D]===void 0&&(s.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H})}w instanceof THREE.Face3?s.geometryGroups[D].faces3.push(u): -s.geometryGroups[D].faces4.push(u);s.geometryGroups[D].vertices=s.geometryGroups[D].vertices+A}s.geometryGroupsList=[];var I=void 0;for(I in s.geometryGroups){s.geometryGroups[I].id=Ia++;s.geometryGroupsList.push(s.geometryGroups[I])}}for(l in m.geometryGroups){n=m.geometryGroups[l];if(!n.__webglVertexBuffer){var F=n;F.__webglVertexBuffer=k.createBuffer();F.__webglNormalBuffer=k.createBuffer();F.__webglTangentBuffer=k.createBuffer();F.__webglColorBuffer=k.createBuffer();F.__webglUVBuffer=k.createBuffer(); -F.__webglUV2Buffer=k.createBuffer();F.__webglSkinIndicesBuffer=k.createBuffer();F.__webglSkinWeightsBuffer=k.createBuffer();F.__webglFaceBuffer=k.createBuffer();F.__webglLineBuffer=k.createBuffer();var L=void 0,J=void 0;if(F.numMorphTargets){F.__webglMorphTargetsBuffers=[];L=0;for(J=F.numMorphTargets;L0||M.faceVertexUvs.length>0)N.__uvArray=new Float32Array(U*2);if(M.faceUvs.length>1||M.faceVertexUvs.length> +a.__objectsAdded[0],j=a,l=void 0,m=void 0,n=void 0;if(!i.__webglInit){i.__webglInit=true;i._modelViewMatrix=new THREE.Matrix4;i._normalMatrix=new THREE.Matrix3;if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.Geometry){if(m.geometryGroups===void 0){var s=m,u=void 0,v=void 0,w=void 0,z=void 0,A=void 0,B=void 0,D=void 0,F={},E=s.morphTargets.length,H=s.morphNormals.length;s.geometryGroups={};u=0;for(v=s.faces.length;u65535){F[B].counter=F[B].counter+1;D=F[B].hash+"_"+F[B].counter;s.geometryGroups[D]===void 0&&(s.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:E,numMorphNormals:H})}w instanceof THREE.Face3?s.geometryGroups[D].faces3.push(u): +s.geometryGroups[D].faces4.push(u);s.geometryGroups[D].vertices=s.geometryGroups[D].vertices+A}s.geometryGroupsList=[];var I=void 0;for(I in s.geometryGroups){s.geometryGroups[I].id=Ia++;s.geometryGroupsList.push(s.geometryGroups[I])}}for(l in m.geometryGroups){n=m.geometryGroups[l];if(!n.__webglVertexBuffer){var G=n;G.__webglVertexBuffer=k.createBuffer();G.__webglNormalBuffer=k.createBuffer();G.__webglTangentBuffer=k.createBuffer();G.__webglColorBuffer=k.createBuffer();G.__webglUVBuffer=k.createBuffer(); +G.__webglUV2Buffer=k.createBuffer();G.__webglSkinIndicesBuffer=k.createBuffer();G.__webglSkinWeightsBuffer=k.createBuffer();G.__webglFaceBuffer=k.createBuffer();G.__webglLineBuffer=k.createBuffer();var L=void 0,J=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];L=0;for(J=G.numMorphTargets;L0||M.faceVertexUvs.length>0)N.__uvArray=new Float32Array(U*2);if(M.faceUvs.length>1||M.faceVertexUvs.length> 1)N.__uv2Array=new Float32Array(U*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){N.__skinIndexArray=new Float32Array(U*4);N.__skinWeightArray=new Float32Array(U*4)}N.__faceArray=new Uint16Array(ga*3);N.__lineArray=new Uint16Array(V*2);var Y=void 0,pa=void 0;if(N.numMorphTargets){N.__morphTargetsArrays=[];Y=0;for(pa=N.numMorphTargets;Y=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(j in a.attributes)r[j]!==void 0&&r[j]>=0&&k.enableVertexAttribArray(r[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;s="morphTarget";for(j=0;j=0){k.enableVertexAttribArray(r[t]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;s="morphNormal";for(j=0;j=0){k.enableVertexAttribArray(r[t]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ua!==b){b?k.disable(k.CULL_FACE): k.enable(k.CULL_FACE);ua=b}if(Ca!==a){a?k.frontFace(k.CW):k.frontFace(k.CCW);Ca=a}};this.setDepthTest=function(a){if(Oa!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);Oa=a}};this.setDepthWrite=function(a){if(Ya!==a){k.depthMask(a);Ya=a}};this.setBlending=function(a,b,c,d){if(a!==Ja){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)}Ja=a}if(a===THREE.CustomBlending){if(b!==Xa){k.blendEquation(E(b));Xa=b}if(c!==ja||d!==pb){k.blendFunc(E(c),E(d)); -ja=c;pb=d}}else pb=ja=Xa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();Q.info.memory.textures++}k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=E(a.format),f=E(a.type);M(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var f= +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)}Ja=a}if(a===THREE.CustomBlending){if(b!==Xa){k.blendEquation(F(b));Xa=b}if(c!==ja||d!==pb){k.blendFunc(F(c),F(d)); +ja=c;pb=d}}else pb=ja=Xa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();Q.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=F(a.format),f=F(a.type);M(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var f= a.mipmaps,g=0,h=f.length;g1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;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.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,l=e.faces,j=a.faceVertexUvs[0],n=e.faceVertexUvs[0],m={},q=0;q1){d=1-d;f=1-f}e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof -THREE.Face3){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,f,e)}if(a instanceof THREE.Face4){d=b.vertices[a.a];f=b.vertices[a.b];e=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,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b)}return THREE.GeometryUtils.random()* -(c+g)a?b(c,e-1):l[e] -b||p>b||m>b){i=a.vertices.length;w=f.clone();s=f.clone();if(q>=p&&q>=m){l=l.clone();l.lerpSelf(j,0.5);w.a=e;w.b=i;w.c=h;s.a=i;s.b=g;s.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);w.vertexNormals[1].copy(e);s.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);w.vertexColors[1].copy(e);s.vertexColors[0].copy(e)}f=0}else if(p>=q&&p>=m){l=j.clone();l.lerpSelf(n,0.5);w.a=e;w.b=g;w.c= -i;s.a=i;s.b=h;s.c=e;if(f.vertexNormals.length===3){e=f.vertexNormals[1].clone();e.lerpSelf(f.vertexNormals[2],0.5);w.vertexNormals[2].copy(e);s.vertexNormals[0].copy(e);s.vertexNormals[1].copy(f.vertexNormals[2]);s.vertexNormals[2].copy(f.vertexNormals[0])}if(f.vertexColors.length===3){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);w.vertexColors[2].copy(e);s.vertexColors[0].copy(e);s.vertexColors[1].copy(f.vertexColors[2]);s.vertexColors[2].copy(f.vertexColors[0])}f=1}else{l=l.clone(); -l.lerpSelf(n,0.5);w.a=e;w.b=g;w.c=i;s.a=i;s.b=g;s.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[2],0.5);w.vertexNormals[2].copy(e);s.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[2],0.5);w.vertexColors[2].copy(e);s.vertexColors[0].copy(e)}f=2}B.push(w,s);a.vertices.push(l);e=0;for(g=a.faceVertexUvs.length;eb||p>b||o>b||r>b){t=a.vertices.length;u=a.vertices.length+1;w=f.clone();s=f.clone();if(q>=p&&q>=o&&q>=r||o>=p&&o>=q&&o>=r){q=l.clone();q.lerpSelf(j,0.5);j=n.clone();j.lerpSelf(m,0.5);w.a=e;w.b=t;w.c=u;w.d=i;s.a=t;s.b=g;s.c=h;s.d=u;if(f.vertexNormals.length===4){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);g=f.vertexNormals[2].clone();g.lerpSelf(f.vertexNormals[3],0.5);w.vertexNormals[1].copy(e); -w.vertexNormals[2].copy(g);s.vertexNormals[0].copy(e);s.vertexNormals[3].copy(g)}if(f.vertexColors.length===4){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);g=f.vertexColors[2].clone();g.lerpSelf(f.vertexColors[3],0.5);w.vertexColors[1].copy(e);w.vertexColors[2].copy(g);s.vertexColors[0].copy(e);s.vertexColors[3].copy(g)}f=0}else{q=j.clone();q.lerpSelf(n,0.5);j=m.clone();j.lerpSelf(l,0.5);w.a=e;w.b=g;w.c=t;w.d=u;s.a=u;s.b=t;s.c=h;s.d=i;if(f.vertexNormals.length===4){e=f.vertexNormals[1].clone(); -e.lerpSelf(f.vertexNormals[2],0.5);g=f.vertexNormals[3].clone();g.lerpSelf(f.vertexNormals[0],0.5);w.vertexNormals[2].copy(e);w.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(e)}if(f.vertexColors.length===4){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);g=f.vertexColors[3].clone();g.lerpSelf(f.vertexColors[0],0.5);w.vertexColors[2].copy(e);w.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(e)}f=1}B.push(w,s);a.vertices.push(q,j); -e=0;for(g=a.faceVertexUvs.length;e1){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()* +(c+g)a?b(c,e-1):l[e] +b||p>b||m>b){i=a.vertices.length;w=e.clone();s=e.clone();if(q>=p&&q>=m){l=l.clone();l.lerpSelf(j,0.5);w.a=f;w.b=i;w.c=h;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);w.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);w.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(p>=q&&p>=m){l=j.clone();l.lerpSelf(n,0.5);w.a=f;w.b=g;w.c= +i;s.a=i;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{l=l.clone(); +l.lerpSelf(n,0.5);w.a=f;w.b=g;w.c=i;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}B.push(w,s);a.vertices.push(l);f=0;for(g=a.faceVertexUvs.length;fb||p>b||o>b||r>b){t=a.vertices.length;u=a.vertices.length+1;w=e.clone();s=e.clone();if(q>=p&&q>=o&&q>=r||o>=p&&o>=q&&o>=r){q=l.clone();q.lerpSelf(j,0.5);j=n.clone();j.lerpSelf(m,0.5);w.a=f;w.b=t;w.c=u;w.d=i;s.a=t;s.b=g;s.c=h;s.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);w.vertexNormals[1].copy(f); +w.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.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);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{q=j.clone();q.lerpSelf(n,0.5);j=m.clone();j.lerpSelf(l,0.5);w.a=f;w.b=g;w.c=t;w.d=u;s.a=u;s.b=t;s.c=h;s.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);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.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);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}B.push(w,s);a.vertices.push(q,j); +f=0;for(g=a.faceVertexUvs.length;f>8&255,i>>16&255,i>>24&255));return d}d.mipmapCount=1;if(h[2]&131072&&b!==false)d.mipmapCount=Math.max(1,h[7]);d.width=h[4];d.height=h[3];h=h[1]+4;e=d.width;g=d.height;for(i=0;if-1?f-1:n+1,p=j-1<0?0:j-1, +THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=true;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);return f},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>8&255,i>>16&255,i>>24&255));return d}d.mipmapCount=1;if(h[2]&131072&&b!==false)d.mipmapCount=Math.max(1,h[7]);d.width=h[4];d.height=h[3];h=h[1]+4;f=d.width;g=d.height;for(i=0;ie-1?e-1:n+1,p=j-1<0?0:j-1, o=j+1>d-1?d-1:j+1,r=[],t=[0,0,h[(n*d+j)*4]/255*b];r.push([-1,0,h[(n*d+p)*4]/255*b]);r.push([-1,-1,h[(m*d+p)*4]/255*b]);r.push([0,-1,h[(m*d+j)*4]/255*b]);r.push([1,-1,h[(m*d+o)*4]/255*b]);r.push([1,0,h[(n*d+o)*4]/255*b]);r.push([1,1,h[(q*d+o)*4]/255*b]);r.push([0,1,h[(q*d+j)*4]/255*b]);r.push([-1,1,h[(q*d+p)*4]/255*b]);m=[];p=r.length;for(q=0;q0)for(l=0;l2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;f<=i&&(i=0);l=i+1;f<=l&&(l=0);j=l+1;f<=j&&(j=0);var m;a:{m=a;var q=i,p=l,o=j,r=f,t=g,u=void 0,w=void 0,s=void 0,B=void 0,v=void 0, -A=void 0,D=void 0,z=void 0,M=void 0,w=m[t[q]].x,s=m[t[q]].y,B=m[t[p]].x,v=m[t[p]].y,A=m[t[o]].x,D=m[t[o]].y;if(1E-10>(B-w)*(D-s)-(v-s)*(A-w))m=false;else{for(u=0;u=0&&E>=0&&F>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]], -a[g[l]],a[g[j]]]);h.push([g[i],g[l],g[j]]);i=l;for(j=l+1;j0)for(l=0;l2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);j=l+1;e<=j&&(j=0);var m;a:{m=a;var q=i,p=l,o=j,r=e,t=g,u=void 0,w=void 0,s=void 0,B=void 0,v=void 0, +A=void 0,D=void 0,z=void 0,M=void 0,w=m[t[q]].x,s=m[t[q]].y,B=m[t[p]].x,v=m[t[p]].y,A=m[t[o]].x,D=m[t[o]].y;if(1E-10>(B-w)*(D-s)-(v-s)*(A-w))m=false;else{for(u=0;u=0&&F>=0&&G>=0){m=false;break a}}m=true}}if(m){f.push([a[g[i]], +a[g[l]],a[g[j]]]);h.push([g[i],g[l],g[j]]);i=l;for(j=l+1;j0)h=d-1;else{h=d;break}}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; +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,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-1E-4,a=a+1E-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){a=this.getUtoTmapping(a);return this.getTangent(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.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.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)}; THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.SplineCurve=function(a){this.points=a==void 0?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype); -THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f=f-a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);return b}; -THREE.EllipseCurve=function(a,b,c,d,f,e,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=f;this.aEndAngle=e;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)}; -THREE.ArcCurve=function(a,b,c,d,f,e){THREE.EllipseCurve.call(this,a,b,c,c,d,f,e)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype); -THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,f){var a=(c-a)*0.5,d=(d-b)*0.5,e=f*f;return(2*b-2*c+a+d)*f*e+(-3*b+3*c-2*a-d)*e+a*f+b}}; +THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e=e-a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b}; +THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)}; +THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype); +THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){var a=(c-a)*0.5,d=(d-b)*0.5,f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}}; THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(this.v2,this.v1);b.multiplyScalar(a);b.addSelf(this.v1);return b}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)}); THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)}); -THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f,a=(d.length-1)*a;f=Math.floor(a);a=a-f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>d.length-2?d.length-1:f+1;c[3]=f>d.length-3?d.length-1:f+2;f=d[c[0]];var e=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(f.x,e.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(f.y,e.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(f.z,e.z,g.z,c.z,a);return b}); -THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f;f=(d.length-0)*a;a=Math.floor(f);f=f-a;a=a+(a>0?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length);c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z, -d[c[1]].z,d[c[2]].z,d[c[3]].z,f);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.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a=a-e;c[0]=e==0?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,g.z,c.z,a);return b}); +THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e=e-a;a=a+(a>0?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length);c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z, +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=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;cb)b=h.x;else if(h.xc)c=h.y;else if(h.yd)d=h.z;else if(h.zb)b=h.x;else if(h.xc)c=h.y;else if(h.yd)d=h.z;else if(h.z0){g=c[c.length-1]; -q=g.x;p=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];p=g[g.length-1]}for(e=1;e<=a;e++){o=e/a;g=THREE.Shape.Utils.b2(o,q,n,h);o=THREE.Shape.Utils.b2(o,p,m,i);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];m=e[1];l=e[2];j=e[3];if(c.length>0){g=c[c.length-1];q=g.x;p=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];p=g[g.length-1]}for(e=1;e<=a;e++){o=e/a;g=THREE.Shape.Utils.b3(o,q,n,l,h);o=THREE.Shape.Utils.b3(o,p,m,j,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*e[0].length;o=o.concat(e[0]);o=new THREE.SplineCurve(o);for(e=1;e<=g;e++)c.push(o.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];m=e[2];l=e[3];g=e[4];n=!!e[5];q=g-l;p=a*2;for(e=1;e<=p;e++){o=e/p;n||(o=1-o);o=l+o*q;g=h+m*Math.cos(o);o=i+m*Math.sin(o);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.ELLIPSE:h=e[0];i=e[1];m=e[2];j=e[3];l=e[4];g=e[5]; -n=!!e[6];q=g-l;p=a*2;for(e=1;e<=p;e++){o=e/p;n||(o=1-o);o=l+o*q;g=h+m*Math.cos(o);o=i+j*Math.sin(o);c.push(new THREE.Vector2(g,o))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; -THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;for(b=this.actions.length;a0){g=c[c.length-1]; +q=g.x;p=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];p=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b2(o,q,n,h);o=THREE.Shape.Utils.b2(o,p,m,i);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];l=f[2];j=f[3];if(c.length>0){g=c[c.length-1];q=g.x;p=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];p=g[g.length-1]}for(f=1;f<=a;f++){o=f/a;g=THREE.Shape.Utils.b3(o,q,n,l,h);o=THREE.Shape.Utils.b3(o,p,m,j,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];m=f[2];l=f[3];g=f[4];n=!!f[5];q=g-l;p=a*2;for(f=1;f<=p;f++){o=f/p;n||(o=1-o);o=l+o*q;g=h+m*Math.cos(o);o=i+m*Math.sin(o);c.push(new THREE.Vector2(g,o))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];j=f[3];l=f[4];g=f[5]; +n=!!f[6];q=g-l;p=a*2;for(f=1;f<=p;f++){o=f/p;n||(o=1-o);o=l+o*q;g=h+m*Math.cos(o);o=i+j*Math.sin(o);c.push(new THREE.Vector2(g,o))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-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=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;var o=[l[g],c[h],c[f]];n=THREE.FontUtils.Triangulate.area(o);var r=[l[g],l[e],c[h]];m=THREE.FontUtils.Triangulate.area(r);q=h;j=g;h=h+1;g=g+ --1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;o=[l[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(o);r=[l[g],l[e],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(n+m>o+r){h=q;g=j;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1}n=c.slice(0,h);m=c.slice(h);q=l.slice(g);j=l.slice(0,g);e=[l[g],l[e],c[h]];p.push([l[g],c[h],c[f]]);p.push(e);c=n.concat(q).concat(j).concat(m)}return{shape:c, -isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,l={};e=0;for(g=d.length;e=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1;var o=[l[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(o);var r=[l[g],l[f],c[h]];m=THREE.FontUtils.Triangulate.area(r);q=h;j=g;h=h+1;g=g+ +-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1;o=[l[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(n+m>o+r){h=q;g=j;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1}n=c.slice(0,h);m=c.slice(h);q=l.slice(g);j=l.slice(0,g);f=[l[g],l[f],c[h]];p.push([l[g],c[h],c[e]]);p.push(f);c=n.concat(q).concat(j).concat(m)}return{shape:c, +isolatedPts:p,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,l={};f=0;for(g=d.length;f1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+ -(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[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(f,e,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}}}}}; -THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,e,g,h,i,l;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],l[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],l[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],l[2],f,c,g);return d}; -THREE.Animation.prototype.interpolate=function(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};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?c1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);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",n,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",n,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}}}}}; +THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,l;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]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],l[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?c0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]}; -THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true); -for(a=0;a=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=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 f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new THREE.Vector3(-1,0,0));this.add(f);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,0,1);e.lookAt(new THREE.Vector3(0,1,0));this.add(e);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 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,m=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,f,c);c.activeCubeFace= -2;a.render(b,e,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,f,e,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,e,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()}; +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 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,m=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=m;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.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()}}; @@ -625,14 +625,14 @@ this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi, 0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup", c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()}; -THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,t=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)}; this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}), -b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a= -this.debugPath,b=this.spline,g=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),q=0;q0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);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.y0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);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.y1?c.normalize():c.z=Math.sqrt(1-e*e);h.copy(d.object.position).subSelf(d.target); e=d.object.up.clone().setLength(c.y);e.addSelf(d.object.up.clone().crossSelf(h).setLength(c.x));e.addSelf(h.setLength(c.z));return e};this.rotateCamera=function(){var a=Math.acos(i.dot(l)/i.length()/l.length());if(a){var b=(new THREE.Vector3).cross(i,l).normalize(),c=new THREE.Quaternion,a=a*d.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(h);c.multiplyVector3(d.object.up);c.multiplyVector3(l);if(d.staticMoving)i.copy(l);else{c.setFromAxisAngle(b,a*(d.dynamicDampingFactor-1));c.multiplyVector3(i)}}}; this.zoomCamera=function(){var a=1+(n.y-j.y)*d.zoomSpeed;if(a!==1&&a>0){h.multiplyScalar(a);d.staticMoving?j.copy(n):j.y=j.y+(n.y-j.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=q.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(h.length()*d.panSpeed);var b=h.clone().crossSelf(d.object.up).setLength(a.x);b.addSelf(d.object.up.clone().setLength(a.y));d.object.position.addSelf(b);d.target.addSelf(b);d.staticMoving?m=q:m.addSelf(a.sub(q,m).multiplyScalar(d.dynamicDampingFactor))}}; -this.checkDistances=function(){if(!d.noZoom||!d.noPan){d.object.position.lengthSq()>d.maxDistance*d.maxDistance&&d.object.position.setLength(d.maxDistance);h.lengthSq() -0){d.dispatchEvent(p);f.copy(d.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(d.enabled){if(e){i=l=d.getMouseProjectionOnBall(a.clientX,a.clientY);j=n=d.getMouseOnScreen(a.clientX,a.clientY);m=q=d.getMouseOnScreen(a.clientX,a.clientY);e=false}g!==-1&&(g===0&&!d.noRotate?l=d.getMouseProjectionOnBall(a.clientX,a.clientY):g===1&&!d.noZoom?n=d.getMouseOnScreen(a.clientX,a.clientY):g=== +this.checkDistances=function(){if(!d.noZoom||!d.noPan){d.object.position.lengthSq()>d.maxDistance*d.maxDistance&&d.object.position.setLength(d.maxDistance);h.lengthSq() +0){d.dispatchEvent(p);e.copy(d.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(d.enabled){if(f){i=l=d.getMouseProjectionOnBall(a.clientX,a.clientY);j=n=d.getMouseOnScreen(a.clientX,a.clientY);m=q=d.getMouseOnScreen(a.clientX,a.clientY);f=false}g!==-1&&(g===0&&!d.noRotate?l=d.getMouseProjectionOnBall(a.clientX,a.clientY):g===1&&!d.noZoom?n=d.getMouseOnScreen(a.clientX,a.clientY):g=== 2&&!d.noPan&&(q=d.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(d.enabled){a.preventDefault();a.stopPropagation();if(g===-1){g=a.button;g===0&&!d.noRotate?i=l=d.getMouseProjectionOnBall(a.clientX,a.clientY):g===1&&!d.noZoom?j=n=d.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=q=d.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(d.enabled){a.preventDefault();a.stopPropagation(); -g=-1}},false);this.domElement.addEventListener("DOMMouseScroll",c,false);this.domElement.addEventListener("mousewheel",c,false);window.addEventListener("keydown",function(a){if(d.enabled&&g===-1){a.keyCode===d.keys[0]&&!d.noRotate?g=0:a.keyCode===d.keys[1]&&!d.noZoom?g=1:a.keyCode===d.keys[2]&&!d.noPan&&(g=2);g!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){d.enabled&&g!==-1&&(g=-1)},false);this.handleResize()}; -THREE.OrbitControls=function(a,b){function c(){return 2*Math.PI/60/60*e.autoRotateSpeed}function d(a){a.preventDefault();if(u===t.ROTATE){i.set(a.clientX,a.clientY);l.sub(i,h);e.rotateLeft(2*Math.PI*l.x/g*e.userRotateSpeed);e.rotateUp(2*Math.PI*l.y/g*e.userRotateSpeed);h.copy(i)}else if(u===t.ZOOM){n.set(a.clientX,a.clientY);m.sub(n,j);m.y>0?e.zoomIn():e.zoomOut();j.copy(n)}}function f(){if(e.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",f,false); -u=t.NONE}}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 e=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,q=0,p=0,o=1,r=new THREE.Vector3,t={NONE:-1,ROTATE:0,ZOOM:1},u=t.NONE,w={type:"change"};this.rotateLeft=function(a){a=== -void 0&&(a=c());p=p-a};this.rotateRight=function(a){a===void 0&&(a=c());p=p+a};this.rotateUp=function(a){a===void 0&&(a=c());q=q-a};this.rotateDown=function(a){a===void 0&&(a=c());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));o=o/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));o=o*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),d=Math.atan2(b.x,b.z),e=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&& -this.rotateLeft(c());var d=d+p,e=e+q,e=Math.max(1E-6,Math.min(Math.PI-1E-6,e)),f=b.length();b.x=f*Math.sin(e)*Math.sin(d);b.y=f*Math.cos(e);b.z=f*Math.sin(e)*Math.cos(d);b.multiplyScalar(o);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=p=0;o=1;if(r.distanceTo(this.object.position)>0){this.dispatchEvent(w);r.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(e.userRotate){a.preventDefault(); -if(a.button===0||a.button===2){u=t.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=t.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",f,false)}},false);this.domElement.addEventListener("mousewheel",function(a){e.userZoom&&(a.wheelDelta>0?e.zoomOut():e.zoomIn())},false)}; -THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=c!==void 0?c:0,d=d!==void 0?d:Math.PI*2,b=b!==void 0?Math.max(3,b):8,f,e=[];f=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(f);e.push(g);for(f=0;f<=b;f++){var h=new THREE.Vector3;h.x=a*Math.cos(c+f/b*d);h.y=a*Math.sin(c+f/b*d);this.vertices.push(h);e.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(f=1;f<=b;f++){this.faces.push(new THREE.Face3(f,f+1,0,[c,c,c]));this.faceVertexUvs[0].push([e[f], -e[f+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype); -THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=f||1,q=h/2,r=i/2,t=l.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=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=e||1}var u=o+1,w=p+1,Y=h/o,$=i/p,L=new THREE.Vector3;L[n]=j>0?1:-1;for(h=0;h0?f.zoomIn():f.zoomOut();j.copy(n)}}function e(){if(f.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",e,false); +u=t.NONE}}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 f=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,q=0,p=0,o=1,r=new THREE.Vector3,t={NONE:-1,ROTATE:0,ZOOM:1},u=t.NONE,w={type:"change"};this.rotateLeft=function(a){a=== +void 0&&(a=c());p=p-a};this.rotateRight=function(a){a===void 0&&(a=c());p=p+a};this.rotateUp=function(a){a===void 0&&(a=c());q=q-a};this.rotateDown=function(a){a===void 0&&(a=c());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,f.userZoomSpeed));o=o/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,f.userZoomSpeed));o=o*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),d=Math.atan2(b.x,b.z),e=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&& +this.rotateLeft(c());var d=d+p,e=e+q,e=Math.max(1E-6,Math.min(Math.PI-1E-6,e)),f=b.length();b.x=f*Math.sin(e)*Math.sin(d);b.y=f*Math.cos(e);b.z=f*Math.sin(e)*Math.cos(d);b.multiplyScalar(o);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=p=0;o=1;if(r.distanceTo(this.object.position)>0){this.dispatchEvent(w);r.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(f.userRotate){a.preventDefault(); +if(a.button===0||a.button===2){u=t.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=t.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",e,false)}},false);this.domElement.addEventListener("mousewheel",function(a){f.userZoom&&(a.wheelDelta>0?f.zoomOut():f.zoomIn())},false)}; +THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=c!==void 0?c:0,d=d!==void 0?d:Math.PI*2,b=b!==void 0?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++){this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c]));this.faceVertexUvs[0].push([f[e], +f[e+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype); +THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=l.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 u=o+1,w=p+1,Y=h/o,$=i/p,L=new THREE.Vector3;L[n]=j>0?1:-1;for(h=0;h -0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h +0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;ha&&(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 f(c,d){var e,f;for(L=c.length;--L>=0;){e=L;f=L-1;f<0&&(f= -c.length-1);for(var g=0,h=m+j*2,g=0;ga&&(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(L=c.length;--L>=0;){e=L;f=L-1;f<0&&(f= +c.length-1);for(var g=0,h=m+j*2,g=0;g=0;F--){A=F/j;I=i*(1-A);J=l*Math.sin(A*Math.PI/2);L=0;for(ba=E.length;L=0;G--){A=G/j;I=i*(1-A);J=l*Math.sin(A*Math.PI/2);L=0;for(ba=F.length;L1E-4){h.normalize();d=Math.acos(f[l-1].dot(f[l]));i.makeRotationAxis(h,d).multiplyVector3(e[l])}g[l].cross(f[l],e[l])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(l=1;l1E-4){h.normalize();d=Math.acos(e[l-1].dot(e[l]));i.makeRotationAxis(h,d).multiplyVector3(f[l])}g[l].cross(e[l],f[l])}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(l=1;l=j){for(l=0;l<3;l++){j=[i[l],i[(l+1)%3]];n=true;for(m=0;m=j){for(l=0;l<3;l++){j=[i[l],i[(l+1)%3]];n=true;for(m=0;m0;)this.smooth(a)}; -THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){j.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,m){var n=new THREE.Face4(a,c,d,f,null,g.color,g.materialIndex);if(j.useOldVertexColors){n.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=t&&a=t&&a1){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(eh.end)h.end=e;c||(c=i)}}for(i in d){h=d[i];this.createAnimation(i,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;f1){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(fh.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.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.update=function(a){for(var b=0,c=this.animationsList.length;bd.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 e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/ -f),0,d.length-1),g=d.weight;if(e!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[e]=0;d.lastFrame=d.currentFrame;d.currentFrame=e}f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*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,f,e,g,h,i,l,j,n,m,q;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);f=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]= -0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;f[p++]=0;f[p++]=1;f[p++]=2;f[p++]=0;f[p++]=2;f[p++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,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, +THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;bd.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}}}; +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,l,j,n,m,q;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);e=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]= +0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;e[p++]=0;e[p++]=1;e[p++]=2;e[p++]=0;e[p++]=2;e[p++]=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){l=false;j=a(THREE.ShaderFlares.lensFlare)}else{l=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j, -"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");q=false};this.render=function(a,d,f,t){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,s=t/f,B=f*0.5,v=t*0.5,A=16/t,D=new THREE.Vector2(A*s,A),z=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),G=m,A=n;b.useProgram(j);if(!q){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);q=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map, -1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var H,E,O,F,J;for(H=0;H0&&M.x0&& -M.y0.001&&J.scale>0.001){z.x=J.x;z.y=J.y;z.z=J.z;A=J.size*J.scale/t;D.x=A*s;D.y=A;b.uniform3f(G.screenPosition,z.x,z.y,z.z);b.uniform2f(G.scale,D.x,D.y);b.uniform1f(G.rotation,J.rotation);b.uniform1f(G.opacity,J.opacity); -b.uniform3f(G.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,f,e,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader, -vertexShader:g.vertexShader,uniforms:h,skinning:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,n){var m,q,p,o,r,t,u,w,s,B=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces? +"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");q=false};this.render=function(a,d,e,t){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,s=t/e,B=e*0.5,v=t*0.5,A=16/t,D=new THREE.Vector2(A*s,A),z=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),E=m,A=n;b.useProgram(j);if(!q){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);q=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map, +1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var H,F,O,G,J;for(H=0;H0&&M.x0&& +M.y0.001&&J.scale>0.001){z.x=J.x;z.y=J.y;z.z=J.z;A=J.size*J.scale/t;D.x=A*s;D.y=A;b.uniform3f(E.screenPosition,z.x,z.y,z.z);b.uniform2f(E.scale,D.x,D.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,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader, +vertexShader:g.vertexShader,uniforms:h,skinning:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true;f._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,n){var m,q,p,o,r,t,u,w,s,B=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces? a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(q=j.__lights.length;ml.x)l.x=w.x;if(w.yl.y)l.y=w.y;if(w.z l.z)l.z=w.z}o.left=i.x;o.right=l.x;o.top=l.y;o.bottom=i.y;o.updateProjectionMatrix()}o=p.shadowMap;t=p.shadowMatrix;r=p.shadowCamera;r.position.copy(p.matrixWorld.getPosition());r.lookAt(p.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(p.cameraHelper)p.cameraHelper.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(r.projectionMatrix);t.multiplySelf(r.matrixWorldInverse); if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);h.multiply(r.projectionMatrix,r.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(o);b.clear();s=j.__webglObjects;p=0;for(o=s.length;p + + + + + + + + + + + diff --git a/utils/includes/css3d.json b/utils/includes/css3d.json new file mode 100644 index 0000000000000000000000000000000000000000..560726f41556dd82e7fa5638c5a897260e49cbcb --- /dev/null +++ b/utils/includes/css3d.json @@ -0,0 +1,30 @@ +[ + "../src/Three.js", + "../src/core/Vector2.js", + "../src/core/Vector3.js", + "../src/core/Vector4.js", + "../src/core/Matrix3.js", + "../src/core/Matrix4.js", + "../src/core/EventTarget.js", + "../src/core/Frustum.js", + "../src/core/Ray.js", + "../src/core/Object3D.js", + "../src/core/Projector.js", + "../src/core/Quaternion.js", + "../src/cameras/Camera.js", + "../src/cameras/PerspectiveCamera.js", + "../src/lights/Light.js", + "../src/objects/Particle.js", + "../src/objects/Line.js", + "../src/objects/Mesh.js", + "../src/objects/Bone.js", + "../src/objects/Sprite.js", + "../src/scenes/Scene.js", + "../src/renderers/renderables/RenderableVertex.js", + "../src/renderers/renderables/RenderableFace3.js", + "../src/renderers/renderables/RenderableFace4.js", + "../src/renderers/renderables/RenderableObject.js", + "../src/renderers/renderables/RenderableParticle.js", + "../src/renderers/renderables/RenderableLine.js", + "../examples/js/renderers/CSS3DRenderer.js" +]