123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- // ThreeWebGL.js - http://github.com/mrdoob/three.js
- 'use strict';var THREE=THREE||{REVISION:"50dev"};self.console||(self.console={info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}});self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array);
- (function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c){window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),h=window.setTimeout(function(){b(c+f)},f);a=c+f;return h};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
- function(a){clearTimeout(a)}})();THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;
- THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;
- THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;
- THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
- THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
- this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);f=c*(1-b*e);b=c*(1-b*(1-e));if(d===0){this.r=c;this.g=b;this.b=a}else if(d===1){this.r=f;this.g=c;this.b=a}else if(d===2){this.r=a;this.g=c;this.b=b}else if(d===3){this.r=a;this.g=f;this.b=c}else if(d===4){this.r=b;this.g=a;this.b=c}else if(d===5){this.r=c;this.g=a;this.b=f}}return this},setHex:function(a){a=
- Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
- THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
- this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
- lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
- a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
- this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
- setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
- a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},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],h=d[8],j=d[1],l=d[5],k=d[9],i=d[2],m=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(j,l);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
- 0.99999){this.y=Math.atan2(h,d);this.z=Math.atan2(j,l)}else{this.y=Math.atan2(-i,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(m));if(Math.abs(m)<0.99999){this.y=Math.atan2(-i,d);this.z=Math.atan2(-f,l)}else{this.y=0;this.z=Math.atan2(h,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(m,d);this.z=Math.atan2(j,e)}else{this.x=0;this.z=Math.atan2(-f,l)}}else if(b==="YZX"){this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-k,l);this.y=Math.atan2(-i,
- e)}else{this.x=0;this.y=Math.atan2(i,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(m,l);this.y=Math.atan2(h,e)}else{this.x=Math.atan2(-h,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,h=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-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),h+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),h-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-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),h-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-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),h+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
- a.y),h-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+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),h-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
- b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
- this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
- a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],j=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(l-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(l+b)<0.1&&Math.abs(e+j+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;j=(j+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;l=(l+b)/4;if(e>j&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(j>
- k)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+k-1)/2);return this}};
- THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
- THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],j=c[5],l=c[6],k=c[7],i=c[8],m=c[9],n=c[10],o=c[11],u=c[12],q=c[13],r=c[14],c=c[15];b[0].set(f-a,k-h,o-i,c-u);b[1].set(f+a,k+h,o+i,c+u);b[2].set(f+d,k+j,o+m,c+q);b[3].set(f-d,k-j,o-m,c-q);b[4].set(f-e,k-l,o-n,c-r);b[5].set(f+e,k+l,o+n,c+r);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
- THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
- THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},u=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3,p,x,w,H=function(a,b,c){u.sub(c,a);p=u.dot(b);x=q.add(a,r.copy(b).multiplyScalar(p));
- return w=c.distanceTo(x)},v,E,A,G,C,P,I,U,W=function(a,b,c,d){u.sub(d,b);q.sub(c,b);r.sub(a,b);v=u.dot(u);E=u.dot(q);A=u.dot(r);G=q.dot(q);C=q.dot(r);P=1/(v*G-E*E);I=(G*A-E*C)*P;U=(v*C-E*A)*P;return I>=0&&U>=0&&I+U<1},S=1.0E-4;this.setPrecision=function(a){S=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var q=0,r=a.children.length;q<r;q++)Array.prototype.push.apply(d,this.intersectObject(a.children[q],b));if(a instanceof THREE.Particle){w=H(this.origin,this.direction,a.matrixWorld.getPosition());
- if(w>a.scale.x)return[];c={distance:w,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());q=a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z));w=H(this.origin,this.direction,a.matrixWorld.getPosition());if(w>q)return d;var u,p,v=a.geometry,x=v.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(r=v.faces.length;q<
- r;q++){c=v.faces[q];l.copy(this.origin);k.copy(this.direction);A=a.matrixWorld;i=A.multiplyVector3(i.copy(c.centroid)).subSelf(l);m=a.matrixRotationWorld.multiplyVector3(m.copy(c.normal));u=k.dot(m);if(!(Math.abs(u)<S)){p=m.dot(i)/u;if(!(p<0)&&(a.doubleSided||(a.flipSided?u>0:u<0))){n.add(l,k.multiplyScalar(p));w=l.distanceTo(n);if(!(w<this.near)&&!(w>this.far))if(c instanceof THREE.Face3){e=A.multiplyVector3(e.copy(x[c.a]));f=A.multiplyVector3(f.copy(x[c.b]));h=A.multiplyVector3(h.copy(x[c.c]));
- if(W(n,e,f,h)){c={distance:w,point:n.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=A.multiplyVector3(e.copy(x[c.a]));f=A.multiplyVector3(f.copy(x[c.b]));h=A.multiplyVector3(h.copy(x[c.c]));j=A.multiplyVector3(j.copy(x[c.d]));if(W(n,e,f,j)||W(n,f,h,j)){c={distance:w,point:n.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(o);
- return c}};
- THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b=0,c=0,d=0,e=0,f=0,h=0,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,i,m){j=false;b=f;c=h;d=i;e=m;a()};this.addPoint=function(f,h){if(j===true){j=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:
- h;d=d>f?d:f;e=e>h?e:h}a()};this.add3Points=function(f,h,i,m,n,o){if(j===true){j=false;b=f<i?f<n?f:n:i<n?i:n;c=h<m?h<o?h:o:m<o?m:o;d=f>i?f>n?f:n:i>n?i:n;e=h>m?h>o?h:o:m>o?m:o}else{b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b;c=h<m?h<o?h<c?h:c:o<c?o:c:m<o?m<c?m:c:o<c?o:c;d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d;e=h>m?h>o?h>e?h:e:o>e?o:e:m>o?m>e?m:e:o>e?o:e}a()};this.addRectangle=function(f){if(j===true){j=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
- c=c<f.getTop()?c:f.getTop();d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){j=true;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
- THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],l=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,i=this.elements;i[0]=b*a;i[1]=b*c;i[2]=b*d;i[3]=b*e;i[4]=b*f;i[5]=b*h;i[6]=b*j;i[7]=b*l;i[8]=b*k;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,h,j,l,k,i,m,n,o,u,q){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,h||0,j||0,l||0,k||0,i!==void 0?i:1,m||0,n||0,o||0,u||0,q!==void 0?q:1)};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,j,l,k,i,m,n,o,u,q){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=h;r[13]=j;r[2]=l;r[6]=k;r[10]=i;r[14]=m;r[3]=n;r[7]=o;r[11]=u;r[15]=q;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,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();if(e.length()===0){h.x=h.x+1.0E-4;e.cross(c,h).normalize()}f.cross(h,e);d[0]=e.x;d[4]=f.x;d[8]=h.x;d[1]=e.y;d[5]=f.y;d[9]=h.y;d[2]=e.z;d[6]=f.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],j=c[8],l=c[12],k=c[1],i=c[5],m=c[9],n=c[13],o=c[2],u=c[6],q=c[10],r=c[14],p=c[3],x=c[7],w=c[11],c=c[15],H=d[0],v=d[4],
- E=d[8],A=d[12],G=d[1],C=d[5],P=d[9],I=d[13],U=d[2],W=d[6],S=d[10],z=d[14],O=d[3],V=d[7],F=d[11],d=d[15];e[0]=f*H+h*G+j*U+l*O;e[4]=f*v+h*C+j*W+l*V;e[8]=f*E+h*P+j*S+l*F;e[12]=f*A+h*I+j*z+l*d;e[1]=k*H+i*G+m*U+n*O;e[5]=k*v+i*C+m*W+n*V;e[9]=k*E+i*P+m*S+n*F;e[13]=k*A+i*I+m*z+n*d;e[2]=o*H+u*G+q*U+r*O;e[6]=o*v+u*C+q*W+r*V;e[10]=o*E+u*P+q*S+r*F;e[14]=o*A+u*I+q*z+r*d;e[3]=p*H+x*G+w*U+c*O;e[7]=p*v+x*C+w*W+c*V;e[11]=p*E+x*P+w*S+c*F;e[15]=p*A+x*I+w*z+c*d;return this},multiplySelf:function(a){return this.multiply(this,
- a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
- b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
- c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
- a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],j=a[9],l=a[13],k=a[2],i=a[6],m=a[10],n=a[14],o=a[3],u=a[7],q=a[11],a=a[15];return e*j*i*o-d*l*i*o-e*h*m*o+c*l*m*o+d*h*n*o-c*j*n*o-e*j*k*u+d*l*k*u+e*f*m*u-b*l*m*u-d*f*n*u+b*j*n*u+e*h*k*q-c*l*k*q-e*f*i*q+b*l*i*q+c*f*n*q-b*h*n*q-d*h*k*a+c*j*k*a+d*f*i*a-b*j*i*a-c*f*m*a+b*h*m*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
- b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
- c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
- a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],h=c[12],j=c[1],l=c[5],k=c[9],i=c[13],m=c[2],n=c[6],o=c[10],u=c[14],q=c[3],r=c[7],p=c[11],c=c[15];b[0]=k*u*r-i*o*r+i*n*p-l*u*p-k*n*c+l*o*c;b[4]=h*o*r-f*u*r-h*n*p+e*u*p+f*n*c-e*o*c;b[8]=f*i*r-h*k*r+h*l*p-e*i*p-f*l*c+e*k*c;b[12]=h*k*n-f*i*n-h*l*o+e*i*o+f*l*u-e*k*u;b[1]=i*o*q-k*u*q-i*m*p+j*u*p+k*m*c-j*o*c;b[5]=f*u*q-h*o*q+h*m*p-d*u*p-f*m*c+d*o*c;b[9]=h*k*q-f*i*q-h*j*p+d*i*p+f*j*c-d*k*c;b[13]=f*i*m-h*k*m+h*j*o-d*
- i*o-f*j*u+d*k*u;b[2]=l*u*q-i*n*q+i*m*r-j*u*r-l*m*c+j*n*c;b[6]=h*n*q-e*u*q-h*m*r+d*u*r+e*m*c-d*n*c;b[10]=e*i*q-h*l*q+h*j*r-d*i*r-e*j*c+d*l*c;b[14]=h*l*m-e*i*m-h*j*n+d*i*n+e*j*u-d*l*u;b[3]=k*n*q-l*o*q-k*m*r+j*o*r+l*m*p-j*n*p;b[7]=e*o*q-f*n*q+f*m*r-d*o*r-e*m*p+d*n*p;b[11]=f*l*q-e*k*q-f*j*r+d*k*r+e*j*p-d*l*p;b[15]=e*k*m-f*l*m+f*j*n-d*k*n-e*j*o+d*l*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,h=Math.cos(d),d=Math.sin(d),
- j=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var k=h*l,i=h*f,m=d*l,n=d*f;c[0]=j*l;c[4]=-j*f;c[8]=e;c[1]=i+m*e;c[5]=k-n*e;c[9]=-d*j;c[2]=n-k*e;c[6]=m+i*e;c[10]=h*j}else if(b==="YXZ"){k=j*l;i=j*f;m=e*l;n=e*f;c[0]=k+n*d;c[4]=m*d-i;c[8]=h*e;c[1]=h*f;c[5]=h*l;c[9]=-d;c[2]=i*d-m;c[6]=n+k*d;c[10]=h*j}else if(b==="ZXY"){k=j*l;i=j*f;m=e*l;n=e*f;c[0]=k-n*d;c[4]=-h*f;c[8]=m+i*d;c[1]=i+m*d;c[5]=h*l;c[9]=n-k*d;c[2]=-h*e;c[6]=d;c[10]=h*j}else if(b==="ZYX"){k=h*l;i=h*f;m=d*l;
- n=d*f;c[0]=j*l;c[4]=m*e-i;c[8]=k*e+n;c[1]=j*f;c[5]=n*e+k;c[9]=i*e-m;c[2]=-e;c[6]=d*j;c[10]=h*j}else if(b==="YZX"){k=h*j;i=h*e;m=d*j;n=d*e;c[0]=j*l;c[4]=n-k*f;c[8]=m*f+i;c[1]=f;c[5]=h*l;c[9]=-d*l;c[2]=-e*l;c[6]=i*f+m;c[10]=k-n*f}else if(b==="XZY"){k=h*j;i=h*e;m=d*j;n=d*e;c[0]=j*l;c[4]=-f;c[8]=e*l;c[1]=k*f+n;c[5]=h*l;c[9]=i*f-m;c[2]=m*f-i;c[6]=d*l;c[10]=n*f+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,j=d+d,l=e+e,a=c*h,k=c*j,c=c*l,i=d*j,d=d*
- l,e=e*l,h=f*h,j=f*j,f=f*l;b[0]=1-(i+e);b[4]=k-f;b[8]=c+j;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-j;b[6]=d+h;b[10]=1-(a+i);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
- h.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=h.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
- c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*
- c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],h=b[8],j=b[9],l=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[4]=i*c+a*h;b[5]=i*d+a*j;b[6]=i*e+a*l;b[7]=i*f+a*k;b[8]=i*h-a*c;b[9]=i*j-a*d;b[10]=i*l-a*e;b[11]=i*k-a*f;return this},rotateY:function(a){var b=
- this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[8],j=b[9],l=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[0]=i*c-a*h;b[1]=i*d-a*j;b[2]=i*e-a*l;b[3]=i*f-a*k;b[8]=i*h+a*c;b[9]=i*j+a*d;b[10]=i*l+a*e;b[11]=i*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[4],j=b[5],l=b[6],k=b[7],i=Math.cos(a),a=Math.sin(a);b[0]=i*c+a*h;b[1]=i*d+a*j;b[2]=i*e+a*l;b[3]=i*f+a*k;b[4]=i*h-a*c;b[5]=i*j-a*d;b[6]=i*l-a*e;b[7]=i*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
- if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,h=Math.sqrt(d*d+e*e+f*f),d=d/h,e=e/h,f=f/h,h=d*d,j=e*e,l=f*f,k=Math.cos(b),i=Math.sin(b),m=1-k,n=d*e*m,o=d*f*m,m=e*f*m,d=d*i,u=e*i,i=f*i,f=h+(1-h)*k,h=n+i,e=o-u,n=n-i,j=j+(1-j)*k,i=m+d,o=o+u,m=m-d,l=l+(1-l)*k,k=c[0],d=c[1],u=c[2],q=c[3],r=c[4],p=c[5],x=c[6],w=c[7],H=c[8],v=c[9],E=c[10],A=c[11];c[0]=f*k+h*r+e*H;c[1]=f*d+h*
- p+e*v;c[2]=f*u+h*x+e*E;c[3]=f*q+h*w+e*A;c[4]=n*k+j*r+i*H;c[5]=n*d+j*p+i*v;c[6]=n*u+j*x+i*E;c[7]=n*q+j*w+i*A;c[8]=o*k+m*r+l*H;c[9]=o*d+m*p+l*v;c[10]=o*u+m*x+l*E;c[11]=o*q+m*w+l*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
- a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);
- return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,j=a.z,l=e*f,k=e*h;this.set(l*f+c,l*h-d*j,l*j+d*h,0,l*h+d*j,k*h+c,k*j-d*f,0,l*j-d*h,k*j+d*f,e*j*j+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=
- 0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var h=this.elements,j=b-a,l=c-d,k=f-e;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);h[1]=0;h[5]=2/l;h[9]=0;h[13]=-((c+d)/l);h[2]=0;h[6]=0;h[10]=-2/k;h[14]=-((f+e)/k);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
- a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
- THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=new THREE.Quaternion;
- this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),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))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=
- b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
- this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
- this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
- THREE.Projector=function(){function a(a,c){h=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||I.contains(a)===true)){A.copy(a.matrixWorld.getPosition());C.multiplyVector3(A);f=b();f.object=a;f.z=A.z;E.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){A.copy(a.matrixWorld.getPosition());C.multiplyVector3(A);f=b();f.object=a;f.z=A.z;E.sprites.push(f)}else a instanceof
- THREE.Light&&E.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&E.objects.sort(d);return E}function b(){var a;if(h===j.length){a=new THREE.RenderableObject;j.push(a)}else a=j[h];h++;return a}function c(){var a;if(k===i.length){a=new THREE.RenderableVertex;i.push(a)}else a=i[k];k++;return a}function d(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,f=a.z+a.w,h=b.z+b.w,e=-a.z+a.w,j=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&j>=0)return true;if(f<0&&h<0||e<0&&j<0)return false;
- f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));e<0?c=Math.max(c,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,j=[],l,k,i=[],m,n,o=[],u,q=[],r,p,x=[],w,H,v=[],E={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,G=new THREE.Vector4,C=new THREE.Matrix4,P=new THREE.Matrix4,I=new THREE.Frustum,U=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,
- b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(b,f,h){var j=f.near,A=f.far,ea=false,ja,Q,la,aa,T,da,ta,ia,N,ua,Ba,ma,
- Ja,Ia,Ca;H=p=u=n=0;E.elements.length=0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");b.add(f)}b.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);C.multiply(f.projectionMatrix,f.matrixWorldInverse);I.setFromMatrix(C);E=a(b,false);b=0;for(ja=E.objects.length;b<ja;b++){N=E.objects[b].object;ua=N.matrixWorld;k=0;if(N instanceof THREE.Mesh){Ba=N.geometry;ma=N.geometry.materials;aa=Ba.vertices;Ja=Ba.faces;Ia=Ba.faceVertexUvs;Ba=N.matrixRotationWorld.extractRotation(ua);
- Q=0;for(la=aa.length;Q<la;Q++){l=c();l.positionWorld.copy(aa[Q]);ua.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);C.multiplyVector4(l.positionScreen);l.positionScreen.x=l.positionScreen.x/l.positionScreen.w;l.positionScreen.y=l.positionScreen.y/l.positionScreen.w;l.visible=l.positionScreen.z>j&&l.positionScreen.z<A}aa=0;for(Q=Ja.length;aa<Q;aa++){la=Ja[aa];if(la instanceof THREE.Face3){T=i[la.a];da=i[la.b];ta=i[la.c];if(T.visible===true&&da.visible===true&&ta.visible===true){ea=
- (ta.positionScreen.x-T.positionScreen.x)*(da.positionScreen.y-T.positionScreen.y)-(ta.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){ia=void 0;if(n===o.length){ia=new THREE.RenderableFace3;o.push(ia)}else ia=o[n];n++;m=ia;m.v1.copy(T);m.v2.copy(da);m.v3.copy(ta)}else continue}else continue}else if(la instanceof THREE.Face4){T=i[la.a];da=i[la.b];ta=i[la.c];ia=i[la.d];if(T.visible===true&&da.visible===true&&ta.visible===true&&
- ia.visible===true){ea=(ia.positionScreen.x-T.positionScreen.x)*(da.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(da.positionScreen.x-T.positionScreen.x)<0||(da.positionScreen.x-ta.positionScreen.x)*(ia.positionScreen.y-ta.positionScreen.y)-(da.positionScreen.y-ta.positionScreen.y)*(ia.positionScreen.x-ta.positionScreen.x)<0;if(N.doubleSided===true||ea!==N.flipSided){Ca=void 0;if(u===q.length){Ca=new THREE.RenderableFace4;q.push(Ca)}else Ca=q[u];u++;m=Ca;m.v1.copy(T);
- m.v2.copy(da);m.v3.copy(ta);m.v4.copy(ia)}else continue}else continue}m.normalWorld.copy(la.normal);ea===false&&(N.flipSided===true||N.doubleSided===true)&&m.normalWorld.negate();Ba.multiplyVector3(m.normalWorld);m.centroidWorld.copy(la.centroid);ua.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);C.multiplyVector3(m.centroidScreen);ta=la.vertexNormals;T=0;for(da=ta.length;T<da;T++){ia=m.vertexNormalsWorld[T];ia.copy(ta[T]);ea===false&&(N.flipSided===true||N.doubleSided===true)&&
- ia.negate();Ba.multiplyVector3(ia)}T=0;for(da=Ia.length;T<da;T++){Ca=Ia[T][aa];if(Ca!==void 0){ta=0;for(ia=Ca.length;ta<ia;ta++)m.uvs[T][ta]=Ca[ta]}}m.material=N.material;m.faceMaterial=la.materialIndex!==null?ma[la.materialIndex]:null;m.z=m.centroidScreen.z;E.elements.push(m)}}else if(N instanceof THREE.Line){P.multiply(C,ua);aa=N.geometry.vertices;T=c();T.positionScreen.copy(aa[0]);P.multiplyVector4(T.positionScreen);ua=N.type===THREE.LinePieces?2:1;Q=1;for(la=aa.length;Q<la;Q++){T=c();T.positionScreen.copy(aa[Q]);
- P.multiplyVector4(T.positionScreen);if(!((Q+1)%ua>0)){da=i[k-2];U.copy(T.positionScreen);W.copy(da.positionScreen);if(e(U,W)===true){U.multiplyScalar(1/U.w);W.multiplyScalar(1/W.w);ma=void 0;if(p===x.length){ma=new THREE.RenderableLine;x.push(ma)}else ma=x[p];p++;r=ma;r.v1.positionScreen.copy(U);r.v2.positionScreen.copy(W);r.z=Math.max(U.z,W.z);r.material=N.material;E.elements.push(r)}}}}}b=0;for(ja=E.sprites.length;b<ja;b++){N=E.sprites[b].object;ua=N.matrixWorld;if(N instanceof THREE.Particle){G.set(ua.elements[12],
- ua.elements[13],ua.elements[14],1);C.multiplyVector4(G);G.z=G.z/G.w;if(G.z>0&&G.z<1){j=void 0;if(H===v.length){j=new THREE.RenderableParticle;v.push(j)}else j=v[H];H++;w=j;w.object=N;w.x=G.x/G.w;w.y=G.y/G.w;w.z=G.z;w.rotation=N.rotation.z;w.scale.x=N.scale.x*Math.abs(w.x-(G.x+f.projectionMatrix.elements[0])/(G.w+f.projectionMatrix.elements[12]));w.scale.y=N.scale.y*Math.abs(w.y-(G.y+f.projectionMatrix.elements[5])/(G.w+f.projectionMatrix.elements[13]));w.material=N.material;E.elements.push(w)}}}h&&
- E.elements.sort(d);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),h=Math.sin(a.y/2),j=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="YXZ"){this.x=f*d*e+c*h*j;this.y=c*h*e-f*d*j;this.z=
- c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="ZXY"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e-f*h*j}else if(b==="ZYX"){this.x=f*d*e-c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e+f*h*j}else if(b==="YZX"){this.x=f*d*e+c*h*j;this.y=c*h*e+f*d*j;this.z=c*d*j-f*h*e;this.w=c*d*e-f*h*j}else if(b==="XZY"){this.x=f*d*e-c*h*j;this.y=c*h*e-f*d*j;this.z=c*d*j+f*h*e;this.w=c*d*e+f*h*j}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
- d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],j=b[2],l=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(l-h)*c;this.y=(d-j)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(l-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+j)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-j)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+l)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
- (d+j)/c;this.y=(h+l)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
- this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
- f=this.x,h=this.y,j=this.z,l=this.w,k=l*c+h*e-j*d,i=l*d+j*c-f*e,m=l*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=k*l+c*-f+i*-j-m*-h;b.y=i*l+c*-h+m*-f-k*-j;b.z=m*l+c*-j+k*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
- this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*j)/l;j=Math.sin(b*j)/l;this.w=f*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=e*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
- THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
- THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
- THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
- return a}};THREE.Face4=function(a,b,c,d,e,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
- THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
- return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
- THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.name="";this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
- THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,h=e.vertexNormals.length;f<h;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
- 0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,h=new THREE.Vector3,j=new THREE.Vector3;a=0;for(b=this.faces.length;a<
- b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];h.sub(f,e);j.sub(d,e);h.crossSelf(j);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
- else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
- for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
- e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
- [];var h=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,l,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];l=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};h.push(l);j.push(k)}}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
- l=h.faceNormals[c];k=h.vertexNormals[c];l.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,z){j=a.vertices[b];l=a.vertices[c];
- k=a.vertices[d];i=h[f];m=h[e];n=h[z];o=l.x-j.x;u=k.x-j.x;q=l.y-j.y;r=k.y-j.y;p=l.z-j.z;x=k.z-j.z;w=m.u-i.u;H=n.u-i.u;v=m.v-i.v;E=n.v-i.v;A=1/(w*E-H*v);I.set((E*o-v*u)*A,(E*q-v*r)*A,(E*p-v*x)*A);U.set((w*u-H*o)*A,(w*r-H*q)*A,(w*x-H*p)*A);C[b].addSelf(I);C[c].addSelf(I);C[d].addSelf(I);P[b].addSelf(U);P[c].addSelf(U);P[d].addSelf(U)}var b,c,d,e,f,h,j,l,k,i,m,n,o,u,q,r,p,x,w,H,v,E,A,G,C=[],P=[],I=new THREE.Vector3,U=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=
- this.vertices.length;b<c;b++){C[b]=new THREE.Vector3;P[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];h=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var O=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){z.copy(f.vertexNormals[d]);e=f[O[d]];G=C[e];W.copy(G);W.subSelf(z.multiplyScalar(z.dot(G))).normalize();
- S.cross(f.vertexNormals[d],G);e=S.dot(P[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
- a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h,j,l;f=0;for(h=this.vertices.length;f<h;f++){d=this.vertices[f];d=
- [Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(h=this.faces.length;f<h;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(e=3;e>0;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
- d=0;for(j=this.faceVertexUvs.length;d<j;d++)(l=this.faceVertexUvs[d][f])&&l.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
- THREE.Spline=function(a){function b(a,b,c,d,f,h,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*h+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,j,l,k,i,m,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);h=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
- f+2;k=this.points[c[0]];i=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];j=h*h;l=h*j;d.x=b(k.x,i.x,m.x,n.x,h,j,l);d.y=b(k.y,i.y,m.y,n.y,h,j,l);d.z=b(k.z,i.z,m.z,n.z,h,j,l);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,h=new THREE.Vector3,e=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++){b=
- a/c;d=this.getPoint(b);e.copy(d);i=i+e.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){j[b]=i;f=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,h,e,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<e-1;c++){d=f+c*(1/e)*(h-f);d=this.getPoint(d);
- j.push(i.copy(d).clone())}j.push(i.copy(this.points[b]).clone())}this.points=j}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
- THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
- THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);
- THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;
- this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
- THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);
- THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.angle=d!==void 0?d:Math.PI/2;this.exponent=e!==void 0?e:10;this.onlyShadow=this.castShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=
- this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
- a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
- Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=j.crossOrigin;f.src=b}function f(a,c,d,f,h,j){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
- d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[c].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[c].wrapT=f[j[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
- if(a.shading){var i=a.shading.toLowerCase();i==="phong"?l="MeshPhongMaterial":i==="basic"&&(l="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.visible!==void 0)k.visible=a.visible;if(a.doubleSided!==void 0)k.doubleSided=a.doubleSided;if(a.flipSided!==void 0)k.flipSided=a.flipSided;
- if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);
- a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){l=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(l.uniforms);i.tNormal.texture=k.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(k.map){i.tDiffuse.texture=
- k.map;i.enableDiffuse.value=true}if(k.specularMap){i.tSpecular.texture=k.specularMap;i.enableSpecular.value=true}if(k.lightMap){i.tAO.texture=k.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(k.color);i.uSpecularColor.value.setHex(k.specular);i.uAmbientColor.value.setHex(k.ambient);i.uShininess.value=k.shininess;if(k.opacity!==void 0)i.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:i,lights:true,fog:true})}else k=
- new THREE[l](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype);THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
- THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var j=JSON.parse(h.responseText);a.loadAjaxBuffers(j,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
- THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};
- f.open("GET",h,true);f.responseType="arraybuffer";f.send(null)};
- THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,l,k,i,m,n,o,u,q,r,p,x,w,H;function v(a){return a%4?4-a%4:0}function E(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,f,e,h,j,i,k,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];h=l[d*3+2];j=V[f*2];f=V[f*2+1];i=V[e*2];k=V[e*2+1];e=V[h*2];m=V[h*2+1];h=S.faceVertexUvs[0];var n=[];n.push(new THREE.UV(j,f));n.push(new THREE.UV(i,k));n.push(new THREE.UV(e,
- m));h.push(n)}}function C(b,c){var d,f,e,h,j,i,k,m,l,n,q=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=q[d*4];e=q[d*4+1];h=q[d*4+2];j=q[d*4+3];i=V[f*2];f=V[f*2+1];k=V[e*2];l=V[e*2+1];m=V[h*2];n=V[h*2+1];h=V[j*2];e=V[j*2+1];j=S.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,f));o.push(new THREE.UV(k,l));o.push(new THREE.UV(m,n));o.push(new THREE.UV(h,e));j.push(o)}}function P(b,c,d){for(var f,e,h,j,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];h=c[d*3+2];j=i[d];
- S.faces.push(new THREE.Face3(f,e,h,null,null,j))}}function I(b,c,d){for(var f,e,h,j,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];h=c[d*4+2];j=c[d*4+3];i=k[d];S.faces.push(new THREE.Face4(f,e,h,j,null,null,i))}}function U(b,c,d,f){for(var e,h,j,i,k,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];h=c[f*3+1];j=c[f*3+2];k=d[f*3];m=d[f*3+1];l=d[f*3+2];i=n[f];var o=O[m*3],q=O[m*3+1];m=O[m*3+2];var r=O[l*3],
- p=O[l*3+1];l=O[l*3+2];S.faces.push(new THREE.Face3(e,h,j,[new THREE.Vector3(O[k*3],O[k*3+1],O[k*3+2]),new THREE.Vector3(o,q,m),new THREE.Vector3(r,p,l)],null,i))}}function W(b,c,d,f){for(var e,h,j,i,k,m,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];h=c[f*4+1];j=c[f*4+2];i=c[f*4+3];m=d[f*4];l=d[f*4+1];n=d[f*4+2];o=d[f*4+3];k=q[f];var r=O[l*3],p=O[l*3+1];l=O[l*3+2];var u=O[n*3],w=O[n*3+1];n=O[n*3+2];var v=O[o*3],x=O[o*3+1];o=O[o*3+2];S.faces.push(new THREE.Face4(e,
- h,j,i,[new THREE.Vector3(O[m*3],O[m*3+1],O[m*3+2]),new THREE.Vector3(r,p,l),new THREE.Vector3(u,w,n),new THREE.Vector3(v,x,o)],null,k))}}var S=this,z=0,O=[],V=[],F,ea,ja;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(S,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,z,12);c=E(a,z+12);E(a,z+13);E(a,z+14);E(a,z+15);e=E(a,z+16);l=E(a,z+17);k=E(a,z+18);i=E(a,z+19);m=A(a,z+20);n=A(a,z+20+4);o=A(a,z+20+8);b=A(a,z+20+12);
- u=A(a,z+20+16);q=A(a,z+20+20);r=A(a,z+20+24);p=A(a,z+20+28);x=A(a,z+20+32);w=A(a,z+20+36);H=A(a,z+20+40);z=z+c;c=e*3+i;ja=e*4+i;F=b*c;ea=u*(c+l*3);e=q*(c+k*3);i=r*(c+l*3+k*3);c=p*ja;l=x*(ja+l*4);k=w*(ja+k*4);z=z+function(b){var b=new Float32Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];S.vertices.push(new THREE.Vector3(d,f,e))}return m*3*Float32Array.BYTES_PER_ELEMENT}(z);z=z+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,f,e;for(c=0;c<n;c++){d=b[c*3];f=b[c*3+1];e=b[c*
- 3+2];O.push(d/127,f/127,e/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(z);z=z+v(n*3);z=z+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,f;for(c=0;c<o;c++){d=b[c*2];f=b[c*2+1];V.push(d,f)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(z);F=z+F+v(b*2);ea=F+ea+v(u*2);e=ea+e+v(q*2);i=e+i+v(r*2);c=i+c+v(p*2);l=c+l+v(x*2);k=l+k+v(w*2);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;P(q,a,b+q*Uint32Array.BYTES_PER_ELEMENT*3);G(q,b)}})(ea);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*
- 3,c=b+r*Uint32Array.BYTES_PER_ELEMENT*3;U(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);G(r,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;I(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);C(w,b)}})(l);(function(a){if(H){var b=a+H*Uint32Array.BYTES_PER_ELEMENT*4,c=b+H*Uint32Array.BYTES_PER_ELEMENT*4;W(H,a,b,c+H*Uint32Array.BYTES_PER_ELEMENT*4);C(H,c)}})(k);b&&P(b,z,z+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*3;U(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*
- 3)}})(F);p&&I(p,i,i+p*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;W(x,a,b,b+x*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
- THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
- THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
- THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var j=JSON.parse(f.responseText);a.createModel(j,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){h===0&&(h=f.getResponseHeader("Content-Length"));
- e({total:h,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
- THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,l,k,i,m,n,o,u,q,r,p,x,w,H=a.faces;m=a.vertices;var v=a.normals,E=a.colors,A=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&A++;for(c=0;c<A;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(i=m.length;k<i;){n=new THREE.Vector3;n.x=m[k++]*b;n.y=m[k++]*b;n.z=m[k++]*b;d.vertices.push(n)}k=0;for(i=H.length;k<i;){b=H[k++];m=b&1;l=b&2;c=b&
- 4;e=b&8;o=b&16;n=b&32;q=b&64;b=b&128;if(m){r=new THREE.Face4;r.a=H[k++];r.b=H[k++];r.c=H[k++];r.d=H[k++];m=4}else{r=new THREE.Face3;r.a=H[k++];r.b=H[k++];r.c=H[k++];m=3}if(l){l=H[k++];r.materialIndex=l}l=d.faces.length;if(c)for(c=0;c<A;c++){p=a.uvs[c];u=H[k++];w=p[u*2];u=p[u*2+1];d.faceUvs[c][l]=new THREE.UV(w,u)}if(e)for(c=0;c<A;c++){p=a.uvs[c];x=[];for(e=0;e<m;e++){u=H[k++];w=p[u*2];u=p[u*2+1];x[e]=new THREE.UV(w,u)}d.faceVertexUvs[c][l]=x}if(o){o=H[k++]*3;e=new THREE.Vector3;e.x=v[o++];e.y=v[o++];
- e.z=v[o];r.normal=e}if(n)for(c=0;c<m;c++){o=H[k++]*3;e=new THREE.Vector3;e.x=v[o++];e.y=v[o++];e.z=v[o];r.vertexNormals.push(e)}if(q){n=H[k++];n=new THREE.Color(E[n]);r.color=n}if(b)for(c=0;c<m;c++){n=H[k++];n=new THREE.Color(E[n]);r.vertexColors.push(n)}d.faces.push(r)}})(e);(function(){var b,c,e,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];l=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,l,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
- b+2){e=a.skinIndices[b];l=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,l,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,l,k,i,m;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];i=d.morphTargets[c].vertices;m=a.morphTargets[c].vertices;l=0;for(k=m.length;l<k;l=l+3){var n=new THREE.Vector3;n.x=m[l]*b;n.y=m[l+1]*b;n.z=m[l+2]*b;i.push(n)}}}if(a.morphColors!==
- void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;i=a.morphColors[c].colors;b=0;for(l=i.length;b<l;b=b+3){m=new THREE.Color(16755200);m.setRGB(i[b],i[b+1],i[b+2]);k.push(m)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
- THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
- a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var h=a.materials[f],j=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},l=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,f,e,h,i){a[d]=new THREE.Texture;a[d].sourceFile=
- f;if(e){a[d].repeat.set(e[0],e[1]);if(e[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[d].wrapT=THREE.RepeatWrapping}h&&a[d].offset.set(h[0],h[1]);if(i){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[i[0]]!==void 0)a[d].wrapS=e[i[0]];if(e[i[1]]!==void 0)a[d].wrapT=e[i[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!j(a.width)||!j(a.height)){var b=l(a.width),c=l(a.height);k.image=document.createElement("canvas");k.image.width=
- b;k.image.height=c;k.image.getContext("2d").drawImage(a,0,0,b,c)}else k.image=a;k.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},i=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},m="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:h.wireframe};if(h.shading){var o=h.shading.toLowerCase();o==="phong"?m="MeshPhongMaterial":o==="basic"&&(m="MeshBasicMaterial")}if(h.blending!==void 0&&THREE[h.blending]!==void 0)n.blending=
- THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)n.transparent=h.transparent;if(h.depthTest!==void 0)n.depthTest=h.depthTest;if(h.depthWrite!==void 0)n.depthWrite=h.depthWrite;if(h.vertexColors!==void 0)if(h.vertexColors=="face")n.vertexColors=THREE.FaceColors;else if(h.vertexColors)n.vertexColors=THREE.VertexColors;if(h.colorDiffuse)n.color=i(h.colorDiffuse);else if(h.DbgColor)n.color=h.DbgColor;if(h.colorSpecular)n.specular=i(h.colorSpecular);if(h.colorAmbient)n.ambient=i(h.colorAmbient);
- if(h.transparency)n.opacity=h.transparency;if(h.specularCoef)n.shininess=h.specularCoef;h.mapDiffuse&&k(n,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&k(n,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapNormal&&k(n,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&k(n,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){k=THREE.ShaderUtils.lib.normal;
- i=THREE.UniformsUtils.clone(k.uniforms);i.tNormal.texture=n.normalMap;if(h.mapNormalFactor)i.uNormalScale.value=h.mapNormalFactor;if(n.map){i.tDiffuse.texture=n.map;i.enableDiffuse.value=true}if(n.specularMap){i.tSpecular.texture=n.specularMap;i.enableSpecular.value=true}if(n.lightMap){i.tAO.texture=n.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(n.color);i.uSpecularColor.value.setHex(n.specular);i.uAmbientColor.value.setHex(n.ambient);i.uShininess.value=n.shininess;if(n.opacity!==void 0)i.uOpacity.value=
- n.opacity;n=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:i,lights:true,fog:true})}else n=new THREE[m](n);if(h.DbgName!==void 0)n.name=h.DbgName;d.materials[f]=n}}var h=a.faces,u=a.vertices,n=a.normals,k=a.colors,i=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&i++;for(f=0;f<i;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}m=0;for(o=u.length;m<o;){var q=new THREE.Vector3;q.x=u[m++]*e;q.y=u[m++]*e;q.z=u[m++]*e;d.vertices.push(q)}m=0;for(o=h.length;m<
- o;){var r=h[m++],p=r&2,f=r&4,x=r&8,w=r&16,u=r&32,H=r&64,q=r&128;if(r&1){r=new THREE.Face4;r.a=h[m++];r.b=h[m++];r.c=h[m++];r.d=h[m++];var v=4}else{r=new THREE.Face3;r.a=h[m++];r.b=h[m++];r.c=h[m++];v=3}if(p){p=h[m++];r.materialIndex=p}var E=d.faces.length;if(f)for(f=0;f<i;f++){var A=a.uvs[f],p=h[m++],G=A[p*2],p=A[p*2+1];d.faceUvs[f][E]=new THREE.UV(G,p)}if(x)for(f=0;f<i;f++){for(var A=a.uvs[f],x=[],C=0;C<v;C++){p=h[m++];G=A[p*2];p=A[p*2+1];x[C]=new THREE.UV(G,p)}d.faceVertexUvs[f][E]=x}if(w){w=h[m++]*
- 3;p=new THREE.Vector3;p.x=n[w++];p.y=n[w++];p.z=n[w];r.normal=p}if(u)for(f=0;f<v;f++){w=h[m++]*3;p=new THREE.Vector3;p.x=n[w++];p.y=n[w++];p.z=n[w];r.vertexNormals.push(p)}if(H){u=h[m++];r.color=new THREE.Color(k[u])}if(q)for(f=0;f<v;f++){u=h[m++];r.vertexColors.push(new THREE.Color(k[u]))}d.faces.push(r)}if(a.skinWeights){f=0;for(h=a.skinWeights.length;f<h;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(h=a.skinIndices.length;f<h;f=f+
- 2){n=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],n,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(h=a.morphTargets.length;f<h;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];n=d.morphTargets[f].vertices;k=a.morphTargets[f].vertices;p=0;for(i=k.length;p<i;p=p+3){q=new THREE.Vector3;q.x=k[p]*e;q.y=k[p+1]*e;q.z=k[p+2]*e;n.push(q)}}}if(a.morphColors){f=0;for(h=a.morphColors.length;f<h;f++){d.morphColors[f]=
- {};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;k=a.morphColors[f].colors;n=0;for(i=k.length;n<i;n=n+3){m=new THREE.Color(16755200);m.setRGB(k[n],k[n+1],k[n+2]);e.push(m)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
- THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
- THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
- THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(n in z.objects)if(!Q.objects[n]){p=z.objects[n];if(p.geometry!==void 0){if(I=Q.geometries[p.geometry]){a=false;U=Q.materials[p.materials[0]];(a=U instanceof THREE.ShaderMaterial)&&I.computeTangents();v=p.position;E=p.rotation;A=p.quaternion;G=p.scale;x=p.matrix;A=0;p.materials.length==0&&(U=new THREE.MeshFaceMaterial);p.materials.length>1&&(U=new THREE.MeshFaceMaterial);
- a=new THREE.Mesh(I,U);a.name=n;if(x){a.matrixAutoUpdate=false;a.matrix.set(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15])}else{a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2])}a.visible=p.visible;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;Q.scene.add(a);Q.objects[n]=a}}else{v=p.position;E=p.rotation;A=p.quaternion;G=p.scale;A=0;a=new THREE.Object3D;
- a.name=n;a.position.set(v[0],v[1],v[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(G[0],G[1],G[2]);a.visible=p.visible!==void 0?p.visible:false;Q.scene.add(a);Q.objects[n]=a;Q.empties[n]=a}}}function f(a){return function(b){Q.geometries[a]=b;e();V=V-1;l.onLoadComplete();j()}}function h(a){return function(b){Q.geometries[a]=b}}function j(){l.callbackProgress({totalModels:ea,totalTextures:ja,loadedModels:ea-V,loadedTextures:ja-F},
- Q);l.onLoadProgress();V===0&&F===0&&b(Q)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),i,m,n,o,u,q,r,p,x,w,H,v,E,A,G,C,P,I,U,W,S,z,O,V,F,ea,ja,Q;z=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;F=V=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;w=z.transform.rotation;C=z.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);w&&Q.scene.rotation.set(w[0],w[1],w[2]);C&&Q.scene.scale.set(C[0],
- C[1],C[2]);if(a||w||C){Q.scene.updateMatrix();Q.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;j();l.onLoadComplete()}};for(u in z.cameras){C=z.cameras[u];C.type==="perspective"?W=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type==="ortho"&&(W=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far));v=C.position;w=C.target;C=C.up;W.position.set(v[0],v[1],v[2]);W.target=new THREE.Vector3(w[0],w[1],w[2]);C&&W.up.set(C[0],C[1],C[2]);Q.cameras[u]=W}for(o in z.lights){w=
- z.lights[o];u=w.color!==void 0?w.color:16777215;W=w.intensity!==void 0?w.intensity:1;if(w.type==="directional"){v=w.direction;H=new THREE.DirectionalLight(u,W);H.position.set(v[0],v[1],v[2]);H.position.normalize()}else if(w.type==="point"){v=w.position;H=w.distance;H=new THREE.PointLight(u,W,H);H.position.set(v[0],v[1],v[2])}else w.type==="ambient"&&(H=new THREE.AmbientLight(u));Q.scene.add(H);Q.lights[o]=H}for(q in z.fogs){o=z.fogs[q];o.type==="linear"?S=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&
- (S=new THREE.FogExp2(0,o.density));C=o.color;S.color.setRGB(C[0],C[1],C[2]);Q.fogs[q]=S}if(Q.cameras&&z.defaults.camera)Q.currentCamera=Q.cameras[z.defaults.camera];if(Q.fogs&&z.defaults.fog)Q.scene.fog=Q.fogs[z.defaults.fog];C=z.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(C[0],C[1],C[2]);Q.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){q=z.geometries[i];if(q.type=="bin_mesh"||q.type=="ascii_mesh"){V=V+1;l.onLoadStart()}}ea=V;for(i in z.geometries){q=z.geometries[i];if(q.type===
- "cube"){I=new THREE.CubeGeometry(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);Q.geometries[i]=I}else if(q.type==="plane"){I=new THREE.PlaneGeometry(q.width,q.height,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="sphere"){I=new THREE.SphereGeometry(q.radius,q.segmentsWidth,q.segmentsHeight);Q.geometries[i]=I}else if(q.type==="cylinder"){I=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs);Q.geometries[i]=
- I}else if(q.type==="torus"){I=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT);Q.geometries[i]=I}else if(q.type==="icosahedron"){I=new THREE.IcosahedronGeometry(q.radius,q.subdivisions);Q.geometries[i]=I}else if(q.type==="bin_mesh")c.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="ascii_mesh")O.load(d(q.url,z.urlBaseType),f(i));else if(q.type==="embedded_mesh"){q=z.embeds[q.id];q.metadata=z.metadata;q&&O.createModel(q,h(i),"")}}for(r in z.textures){i=z.textures[r];if(i.url instanceof
- Array){F=F+i.url.length;for(q=0;q<i.url.length;q++)l.onLoadStart()}else{F=F+1;l.onLoadStart()}}ja=F;for(r in z.textures){i=z.textures[r];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){q=i.url.length;S=[];for(c=0;c<q;c++)S[c]=d(i.url[c],z.urlBaseType);q=THREE.ImageUtils.loadTextureCube(S,i.mapping,a(q))}else{q=THREE.ImageUtils.loadTexture(d(i.url,z.urlBaseType),i.mapping,a(1));if(THREE[i.minFilter]!==void 0)q.minFilter=THREE[i.minFilter];
- if(THREE[i.magFilter]!==void 0)q.magFilter=THREE[i.magFilter];if(i.repeat){q.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)q.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)q.wrapT=THREE.RepeatWrapping}i.offset&&q.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)q.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)q.wrapT=S[i.wrap[1]]}}Q.textures[r]=q}for(m in z.materials){x=z.materials[m];for(P in x.parameters)if(P===
- "envMap"||P==="map"||P==="lightMap")x.parameters[P]=Q.textures[x.parameters[P]];else if(P==="shading")x.parameters[P]=x.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P==="blending")x.parameters[P]=x.parameters[P]in THREE?THREE[x.parameters[P]]:THREE.NormalBlending;else if(P==="combine")x.parameters[P]=x.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(P==="vertexColors")if(x.parameters[P]=="face")x.parameters[P]=THREE.FaceColors;else if(x.parameters[P])x.parameters[P]=
- THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=true;if(x.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);i=x.parameters.color;q=x.parameters.specular;S=x.parameters.ambient;c=x.parameters.shininess;a.tNormal.texture=Q.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map){a.tDiffuse.texture=x.parameters.map;a.enableDiffuse.value=
- true}if(x.parameters.lightMap){a.tAO.texture=x.parameters.lightMap;a.enableAO.value=true}if(x.parameters.specularMap){a.tSpecular.texture=Q.textures[x.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(q);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;U=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else U=
- new THREE[x.type](x.parameters);Q.materials[m]=U}e();l.callbackSync(Q);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
- THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
- THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
- a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.visible=a.visible!==void 0?a.visible:true;this.doubleSided=a.doubleSided!==void 0?a.doubleSided:false;
- this.flipSided=a.flipSided!==void 0?a.flipSided:false;this.needsUpdate=true};THREE.MaterialCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};
- THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
- true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
- void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=
- a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?
- a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:false;this.perPixel=
- a.perPixel!==void 0?a.perPixel:false;this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=
- a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?
- a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshFaceMaterial=function(){};
- THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
- a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.Texture=function(a,b,c,d,e,f,h,j,l){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.anisotropy=l!==void 0?l:1;this.format=h!==void 0?h:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=
- new THREE.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type,this.anisotropy);a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a}};
- THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,h,j,l,k){THREE.Texture.call(this,null,f,h,j,l,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};
- THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};
- THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
- THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
- this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
- THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
- THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.useVertexTexture=c!==void 0?c:true;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f;if(this.geometry.bones!==void 0){for(a=0;a<this.geometry.bones.length;a++){c=this.geometry.bones[a];d=c.pos;e=c.rotq;f=c.scl;b=this.addBone();b.name=c.name;b.position.set(d[0],d[1],d[2]);b.quaternion.set(e[0],e[1],e[2],e[3]);b.useQuaternion=true;f!==void 0?b.scale.set(f[0],f[1],f[2]):b.scale.set(1,1,1)}for(a=0;a<this.bones.length;a++){c=
- this.geometry.bones[a];b=this.bones[a];c.parent===-1?this.add(b):this.bones[c.parent].add(b)}a=this.bones.length;if(this.useVertexTexture){this.boneTextureHeight=this.boneTextureWidth=a=a>256?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;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
- a*16);if(this.useVertexTexture)this.boneTexture.needsUpdate=true};
- THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,
- d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x=this.geometry.skinWeights[a].x+c;this.geometry.skinWeights[a].y=this.geometry.skinWeights[a].y+c}}}};
- THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
- THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=true;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance){this.LODs[b-1].object3D.visible=false;this.LODs[b].object3D.visible=true}else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
- false}};
- THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?
- a.useScreenCoordinates:true;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=
- new THREE.Vector2(1,1)};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=true};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
- THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
- THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
- THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
- THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
- THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
- THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
- envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
- lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngle[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
- lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nlVector = normalize( lVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - mPosition.xyz ) );\nif ( spotEffect > spotLightAngle[ i ] ) {\nspotEffect = pow( spotEffect, spotLightExponent[ i ] );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",
- lights_phong_pars_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvarying vec3 vWorldPosition;\n#endif",lights_phong_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvWorldPosition = mPosition.xyz;\n#endif",
- lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngle[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
- lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngle[ i ] ) {\nspotEffect = pow( spotEffect, spotLightExponent[ i ] );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n#ifdef BONE_TEXTURE\nuniform sampler2D boneTexture;\nmat4 getBoneMatrix( const in float i ) {\nfloat j = i * 4.0;\nfloat x = mod( j, N_BONE_PIXEL_X );\nfloat y = floor( j / N_BONE_PIXEL_X );\nconst float dx = 1.0 / N_BONE_PIXEL_X;\nconst float dy = 1.0 / N_BONE_PIXEL_Y;\ny = dy * ( y + 0.5 );\nvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\nvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\nvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\nvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\nmat4 bone = mat4( v1, v2, v3, v4 );\nreturn bone;\n}\n#else\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\nmat4 getBoneMatrix( const in float i ) {\nmat4 bone = boneGlobalMatrices[ int(i) ];\nreturn bone;\n}\n#endif\n#endif",
- skinbase_vertex:"#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix( skinIndex.x );\nmat4 boneMatY = getBoneMatrix( skinIndex.y );\n#endif",skinning_vertex:"#ifdef USE_SKINNING\nvec4 skinned = boneMatX * skinVertexA * skinWeight.x;\nskinned \t += boneMatY * skinVertexB * skinWeight.y;\ngl_Position = projectionMatrix * modelViewMatrix * skinned;\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",
- morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
- default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\n#endif",
- skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix \t+= skinWeight.y * boneMatY;\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif",defaultnormal_vertex:"vec3 transformedNormal;\n#ifdef USE_SKINNING\ntransformedNormal = skinnedNormal.xyz;\n#endif\n#ifdef USE_MORPHNORMALS\ntransformedNormal = morphedNormal;\n#endif\n#ifndef USE_MORPHNORMALS\n#ifndef USE_SKINNING\ntransformedNormal = normal;\n#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;",
- 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\nvec4 transformedPosition;\n#ifdef USE_MORPHTARGETS\ntransformedPosition = modelMatrix * vec4( morphed, 1.0 );\n#else\n#ifdef USE_SKINNING\ntransformedPosition = modelMatrix * skinned;\n#else\ntransformedPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * transformedPosition;\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,e={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)e[c]=d[c]}return e},clone:function(a){var b,c,d,e={};for(b in a){e[b]={};for(c in a[b]){d=a[b][c];e[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d}}return e}};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
- value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",
- value:[]},spotLightAngle:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",
- value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalMatrix * normal;\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
- THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinning_vertex,
- THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,
- THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},
- wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
- THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif",THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,
- "}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
- "#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,
- THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
- THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,
- THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"vNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
- THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,
- THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
- THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
- "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
- THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=true;var h=1;e.type==="v2"?h=2:e.type==="v3"?h=3:e.type==="v4"?h=4:e.type==="c"&&(h=3);e.size=h;e.array=new Float32Array(c*h);e.buffer=g.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=true}a.__webglCustomAttributesList.push(e)}}}
- function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,f,e,h,i=a.vertices;h=i.length;
- var j=a.colors,k=j.length,m=a.__vertexArray,l=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,q=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Vb.copy(Wb);Vb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d];pb.copy(f);Vb.multiplyVector3(pb);n[d]=[pb.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[n[d][1]];e=d*3;m[e]=f.x;m[e+1]=f.y;m[e+2]=f.z}for(d=0;d<k;d++){e=d*3;f=j[n[d][1]];l[e]=f.r;l[e+1]=f.g;l[e+2]=f.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];
- if(i.boundTo===void 0||i.boundTo==="vertices"){e=0;f=i.value.length;if(i.size===1)for(d=0;d<f;d++){h=n[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<f;d++){h=n[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;e=e+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=n[d][1];h=i.value[h];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=n[d][1];h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===4)for(d=0;d<f;d++){h=n[d][1];
- h=i.value[h];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}else{if(o)for(d=0;d<h;d++){f=i[d];e=d*3;m[e]=f.x;m[e+1]=f.y;m[e+2]=f.z}if(q)for(d=0;d<k;d++){f=j[d];e=d*3;l[e]=f.r;l[e+1]=f.g;l[e+2]=f.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;e=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;e=e+2}else if(i.size===
- 3)if(i.type==="c")for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.r;i.array[e+1]=h.g;i.array[e+2]=h.b;e=e+3}else for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;e=e+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[e]=h.x;i.array[e+1]=h.y;i.array[e+2]=h.z;i.array[e+3]=h.w;e=e+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,m,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
- l,b)}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.bufferData(g.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function j(a,b){return b[1]-a[1]}function l(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){da=Q=null;aa=T=N=ia=Ca=Ia=ua=-1;Wa=true;a[d].render(b,c,gc,xc);da=Q=null;aa=T=N=ia=Ca=Ia=ua=-1;Wa=true}}function k(a,b,c,d,g,f,e,h){var i,j,k,m;if(b){j=a.length-1;m=b=-1}else{j=0;b=a.length;m=1}for(var l=j;l!==b;l=
- l+m){i=a[l];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);x(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setMaterialFaces(i);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,f,i,k,j):F.renderBuffer(d,g,f,i,k,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(e)h=e;else{h=h[b];
- if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,g,h,i)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function u(a,b){for(var c=
- a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,f){if(d.needsUpdate){d.program&&F.deallocateMaterial(d);F.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==Q){g.useProgram(h);Q=h;e=true}if(d.id!==aa){aa=d.id;e=true}if(e||a!==da){g.uniformMatrix4fv(i.projectionMatrix,
- false,a._projectionMatrixArray);a!==da&&(da=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Wa){for(var k,m=0,l=0,n=0,o,q,r,p=yc,u=p.directional.colors,w=p.directional.positions,v=p.point.colors,x=p.point.positions,z=p.point.distances,C=p.spot.colors,E=p.spot.positions,O=p.spot.distances,
- P=p.spot.directions,I=p.spot.angles,W=p.spot.exponents,T=0,U=0,S=0,N=r=0,c=N=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){o=k.color;q=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){m=m+o.r*o.r;l=l+o.g*o.g;n=n+o.b*o.b}else{m=m+o.r;l=l+o.g;n=n+o.b}else if(k instanceof THREE.DirectionalLight){r=T*3;if(F.gammaInput){u[r]=o.r*o.r*q*q;u[r+1]=o.g*o.g*q*q;u[r+2]=o.b*o.b*q*q}else{u[r]=o.r*q;u[r+1]=o.g*q;u[r+2]=o.b*q}Ma.copy(k.matrixWorld.getPosition());Ma.subSelf(k.target.matrixWorld.getPosition());
- Ma.normalize();w[r]=Ma.x;w[r+1]=Ma.y;w[r+2]=Ma.z;T=T+1}else if(k instanceof THREE.PointLight){N=U*3;if(F.gammaInput){v[N]=o.r*o.r*q*q;v[N+1]=o.g*o.g*q*q;v[N+2]=o.b*o.b*q*q}else{v[N]=o.r*q;v[N+1]=o.g*q;v[N+2]=o.b*q}o=k.matrixWorld.getPosition();x[N]=o.x;x[N+1]=o.y;x[N+2]=o.z;z[U]=r;U=U+1}else if(k instanceof THREE.SpotLight){N=S*3;if(F.gammaInput){C[N]=o.r*o.r*q*q;C[N+1]=o.g*o.g*q*q;C[N+2]=o.b*o.b*q*q}else{C[N]=o.r*q;C[N+1]=o.g*q;C[N+2]=o.b*q}o=k.matrixWorld.getPosition();E[N]=o.x;E[N+1]=o.y;E[N+2]=
- o.z;O[S]=r;Ma.copy(o);Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();P[N]=Ma.x;P[N+1]=Ma.y;P[N+2]=Ma.z;I[S]=Math.cos(k.angle);W[S]=k.exponent;S=S+1}}}c=T*3;for(e=u.length;c<e;c++)u[c]=0;c=U*3;for(e=v.length;c<e;c++)v[c]=0;c=S*3;for(e=C.length;c<e;c++)C[c]=0;p.directional.length=T;p.point.length=U;p.spot.length=S;p.ambient[0]=m;p.ambient[1]=l;p.ambient[2]=n;Wa=false}c=yc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
- c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=
- d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
- THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=G.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;
- j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=
- d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){e=c=0;for(k=b.length;e<k;e++){m=b[e];if(m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&!m.shadowCascade)){j.shadowMap.texture[c]=m.shadowMap;j.shadowMapSize.value[c]=m.shadowMapSize;j.shadowMatrix.value[c]=m.shadowMatrix;j.shadowDarkness.value[c]=m.shadowDarkness;j.shadowBias.value[c]=m.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(m=h.uniforms[b[j][1]]){e=b[j][0];l=e.type;k=e.value;
- if(l==="i")g.uniform1i(m,k);else if(l==="f")g.uniform1f(m,k);else if(l==="v2")g.uniform2f(m,k.x,k.y);else if(l==="v3")g.uniform3f(m,k.x,k.y,k.z);else if(l==="v4")g.uniform4f(m,k.x,k.y,k.z,k.w);else if(l==="c")g.uniform3f(m,k.r,k.g,k.b);else if(l==="iv1")g.uniform1iv(m,k);else if(l==="iv")g.uniform3iv(m,k);else if(l==="fv1")g.uniform1fv(m,k);else if(l==="fv")g.uniform3fv(m,k);else if(l==="v2v"){if(e._array===void 0)e._array=new Float32Array(2*k.length);l=0;for(n=k.length;l<n;l++){p=l*2;e._array[p]=
- k[l].x;e._array[p+1]=k[l].y}g.uniform2fv(m,e._array)}else if(l==="v3v"){if(e._array===void 0)e._array=new Float32Array(3*k.length);l=0;for(n=k.length;l<n;l++){p=l*3;e._array[p]=k[l].x;e._array[p+1]=k[l].y;e._array[p+2]=k[l].z}g.uniform3fv(m,e._array)}else if(l==="v4v"){if(e._array===void 0)e._array=new Float32Array(4*k.length);l=0;for(n=k.length;l<n;l++){p=l*4;e._array[p]=k[l].x;e._array[p+1]=k[l].y;e._array[p+2]=k[l].z;e._array[p+3]=k[l].w}g.uniform4fv(m,e._array)}else if(l==="m4"){if(e._array===
- void 0)e._array=new Float32Array(16);k.flattenToArray(e._array);g.uniformMatrix4fv(m,false,e._array)}else if(l==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(e._array,l*16);g.uniformMatrix4fv(m,false,e._array)}else if(l==="t"){g.uniform1i(m,k);if(m=e.texture)if(m.image instanceof Array&&m.image.length===6){e=m;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=g.createTexture();
- g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(m=0;m<6;m++){l=k;n=m;if(F.autoScaleCubemaps){p=e.image[m];w=Pc;if(!(p.width<=w&&p.height<=w)){v=Math.max(p.width,p.height);u=Math.floor(p.width*w/v);w=Math.floor(p.height*w/v);v=document.createElement("canvas");v.width=u;v.height=w;v.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,u,w);p=v}}else p=e.image[m];l[n]=p}m=k[0];l=(m.width&m.width-1)===0&&
- (m.height&m.height-1)===0;n=A(e.format);p=A(e.type);H(g.TEXTURE_CUBE_MAP,e,l);for(m=0;m<6;m++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n,n,p,k[m]);e.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(m instanceof THREE.WebGLRenderTargetCube){e=m;g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.__webglTexture)}else F.setTexture(m,
- k)}else if(l==="tv"){if(e._array===void 0){e._array=[];l=0;for(n=e.texture.length;l<n;l++)e._array[l]=k+l}g.uniform1iv(m,e._array);l=0;for(n=e.texture.length;l<n;l++)(m=e.texture[l])&&F.setTexture(m,e._array[l])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();g.uniform3f(i.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
- d.skinning)&&i.viewMatrix!==null&&g.uniformMatrix4fv(i.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(hc&&f.useVertexTexture){if(i.boneTexture!==null){g.uniform1i(i.boneTexture,12);F.setTexture(f.boneTexture,12)}}else i.boneGlobalMatrices!==null&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,f.boneMatrices);g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.modelMatrix!==null&&g.uniformMatrix4fv(i.modelMatrix,
- false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function x(a,b,c){if(Va!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);Va=a}if(a&&(wb!==b||Lb!==c)){g.polygonOffset(b,c);wb=b;Lb=c}}function w(a,b){var c;a==="fragment"?c=g.createShader(g.FRAGMENT_SHADER):a==="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);
- if(!g.getShaderParameter(c,g.COMPILE_STATUS)){console.error(g.getShaderInfoLog(c));console.error(b);return null}return c}function H(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,A(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,A(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,A(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,A(b.minFilter))}else{g.texParameteri(a,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_MAG_FILTER,E(b.magFilter));
- g.texParameteri(a,g.TEXTURE_MIN_FILTER,E(b.minFilter))}if(Za&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){g.texParameterf(a,Za.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,zc));b.__oldAnisotropy=b.anisotropy}}function v(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,
- g.DEPTH_STENCIL,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,a)}else g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function E(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?g.NEAREST:g.LINEAR}function A(a){return a===THREE.RepeatWrapping?g.REPEAT:a===THREE.ClampToEdgeWrapping?g.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?g.MIRRORED_REPEAT:a===THREE.NearestFilter?
- g.NEAREST:a===THREE.NearestMipMapNearestFilter?g.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?g.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?g.LINEAR:a===THREE.LinearMipMapNearestFilter?g.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?g.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?g.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?g.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?g.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?g.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?
- g.BYTE:a===THREE.ShortType?g.SHORT:a===THREE.UnsignedShortType?g.UNSIGNED_SHORT:a===THREE.IntType?g.INT:a===THREE.UnsignedIntType?g.UNSIGNED_INT:a===THREE.FloatType?g.FLOAT:a===THREE.AlphaFormat?g.ALPHA:a===THREE.RGBFormat?g.RGB:a===THREE.RGBAFormat?g.RGBA:a===THREE.LuminanceFormat?g.LUMINANCE:a===THREE.LuminanceAlphaFormat?g.LUMINANCE_ALPHA:a===THREE.AddEquation?g.FUNC_ADD:a===THREE.SubtractEquation?g.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?g.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?g.ZERO:
- a===THREE.OneFactor?g.ONE:a===THREE.SrcColorFactor?g.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?g.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?g.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?g.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?g.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?g.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?g.DST_COLOR:a===THREE.OneMinusDstColorFactor?g.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?g.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=
- a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),C=a.precision!==void 0?a.precision:"highp",P=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,U=a.antialias!==void 0?a.antialias:false,W=a.stencil!==void 0?a.stencil:true,S=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),O=a.clearAlpha!==void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=
- G;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 F=this,ea=[],ja=0,Q=null,la=null,aa=-1,T=null,da=null,ta=0,ia=-1,N=-1,ua=-1,Ba=-1,ma=-1,Ja=-1,Ia=-1,Ca=-1,Va=null,wb=null,Lb=null,Mb=null,xb=0,Nb=0,Ob=0,Pb=0,gc=0,xc=0,ic=new THREE.Frustum,Wb=new THREE.Matrix4,Vb=new THREE.Matrix4,pb=new THREE.Vector4,Ma=new THREE.Vector3,Wa=true,yc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},
- spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},g,Za;try{if(!(g=G.getContext("experimental-webgl",{alpha:P,premultipliedAlpha:I,antialias:U,stencil:W,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";}catch(Qc){console.error(Qc)}a=g.getExtension("OES_texture_float");P=g.getExtension("OES_standard_derivatives");Za=g.getExtension("EXT_texture_filter_anisotropic")||g.getExtension("MOZ_EXT_texture_filter_anisotropic")||g.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
- a||console.log("THREE.WebGLRenderer: Float textures not supported.");P||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Za||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(z.r,z.g,
- z.b,O);this.context=g;P=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Pc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),zc=Za?g.getParameter(Za.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,jc=P>0,hc=jc&&a;this.getContext=function(){return g};this.supportsVertexTextures=function(){return jc};this.getMaxAnisotropy=function(){return zc};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){xb=a!==void 0?
- a:0;Nb=b!==void 0?b:0;Ob=c!==void 0?c:G.width;Pb=d!==void 0?d:G.height;g.viewport(xb,Nb,Ob,Pb)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){z.setHex(a);O=b;g.clearColor(z.r,z.g,z.b,O)};this.setClearColor=function(a,b){z.copy(a);O=b;g.clearColor(z.r,z.g,z.b,O)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=
- 0;if(a===void 0||a)d=d|g.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|g.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|g.STENCIL_BUFFER_BIT;g.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];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);
- g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)g.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}F.info.memory.geometries--}else if(a instanceof
- THREE.Ribbon){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
- false;g.deleteTexture(a.__webglTexture);F.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){g.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){g.deleteFramebuffer(a.__webglFramebuffer[b]);g.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{g.deleteFramebuffer(a.__webglFramebuffer);g.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=
- false,a=0;for(c=ea.length;a<c;a++){d=ea[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=ea.length;a<c;a++){d=ea[a];d.program!==b&&e.push(d)}ea=e;g.deleteProgram(b);F.info.memory.programs--}}};this.updateShadowMap=function(a,b){Q=null;aa=T=Ca=Ia=ua=-1;Wa=true;N=ia=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
- g.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=g.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=g.createBuffer();if(a.hasPositions){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.position);g.vertexAttribPointer(b.attributes.position,3,g.FLOAT,false,0,0)}if(a.hasNormals){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
- e,f,h,i,j,k,l,m,n,o,q=a.count*3;for(o=0;o<q;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];h=n[o+3];j=n[o+4];l=n[o+5];i=n[o+6];k=n[o+7];m=n[o+8];d=(d+h+i)/3;e=(e+j+k)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,3,g.FLOAT,false,0,0)}if(a.hasUvs&&c.map){g.bindBuffer(g.ARRAY_BUFFER,a.__webglUvBuffer);g.bufferData(g.ARRAY_BUFFER,
- a.uvArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.uv);g.vertexAttribPointer(b.attributes.uv,2,g.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,a.colorArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.color);g.vertexAttribPointer(b.attributes.color,3,g.FLOAT,false,0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=
- r(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==T){T=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var h=f[d].index;if(b){var i=e.attributes.position,j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.position,j,g.FLOAT,false,0,h*j*4);i=e.attributes.normal;if(a.normal>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.normal,j,g.FLOAT,false,0,h*j*4)}i=e.attributes.uv;
- if(a.uv>=0&&i)if(i.buffer){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.uv,j,g.FLOAT,false,0,h*j*4);g.enableVertexAttribArray(a.uv)}else g.disableVertexAttribArray(a.uv);i=e.attributes.color;if(a.color>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.color,j,g.FLOAT,false,0,h*j*4)}i=e.attributes.tangent;if(a.tangent>=0&&i){j=i.itemSize;g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.vertexAttribPointer(a.tangent,j,g.FLOAT,false,0,h*j*4)}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,
- e.attributes.index.buffer)}g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,f[d].start*2);F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+f[d].count;F.info.render.faces=F.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,i,c=r(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==T){T=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(b.position,
- 3,g.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}else if(c.position>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<i.length;){g.bindBuffer(g.ARRAY_BUFFER,
- e.__webglMorphTargetsBuffers[i[k]]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[k]]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[i[k]];k++}}else{i=[];h=f.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){k=h[l];k>0&&i.push([l,k])}if(i.length>d.numSupportedMorphTargets){i.sort(j);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?
- i.sort(j):i.length===0&&i.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(i[k]){l=i[k][0];g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[l]}else{g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);d.morphNormals&&g.vertexAttribPointer(c["morphNormal"+
- k],3,g.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==null&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){h=0;for(i=e.__webglCustomAttributesList.length;h<i;h++){c=e.__webglCustomAttributesList[h];if(b[c.buffer.belongsToAttribute]>=0){g.bindBuffer(g.ARRAY_BUFFER,c.buffer);g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,false,0,0)}}}if(b.color>=0){g.bindBuffer(g.ARRAY_BUFFER,
- e.__webglColorBuffer);g.vertexAttribPointer(b.color,3,g.FLOAT,false,0,0)}if(b.normal>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer);g.vertexAttribPointer(b.normal,3,g.FLOAT,false,0,0)}if(b.tangent>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer);g.vertexAttribPointer(b.tangent,4,g.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer);g.vertexAttribPointer(b.uv,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv)}else g.disableVertexAttribArray(b.uv);
- if(b.uv2>=0)if(e.__webglUV2Buffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer);g.vertexAttribPointer(b.uv2,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv2)}else g.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer);g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,
- false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Mb){g.lineWidth(d);Mb=d}a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,0)}else{a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
- g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==Mb){g.lineWidth(d);Mb=d}g.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;
- F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,m,n=a.__lights,o=a.fog;aa=-1;Wa=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
- new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wb.multiply(b.projectionMatrix,b.matrixWorldInverse);ic.setFromMatrix(Wb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
- this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||ic.contains(j))){p(j,b);var q=f,r=q.object,u=q.buffer,v=void 0,v=v=void 0,v=r.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=r.geometry.materials[v];if(v.transparent){q.transparent=v;q.opaque=null}else{q.opaque=v;q.transparent=null}}}else if(v)if(v.transparent){q.transparent=
- v;q.opaque=null}else{q.opaque=v;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{pb.copy(j.matrixWorld.getPosition());Wb.multiplyVector3(pb);f.z=pb.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;if(j.visible){p(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,
- d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);i(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);i(a.__webglObjectsImmediate,"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",b,n,o,true);i(a.__webglObjectsImmediate,"transparent",b,n,o,true)}l(this.renderPluginsPost,
- a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=r(a,b,c,d,e);T=
- -1;F.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,g,ic):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,l=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=
- h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var p=k,r=void 0,v=void 0,w=void 0,x=void 0,z=void 0,A=void 0,C=void 0,E={},H=p.morphTargets.length,P=p.morphNormals.length;p.geometryGroups={};r=0;for(v=p.faces.length;r<v;r++){w=p.faces[r];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P});
- z=w instanceof THREE.Face3?3:4;if(p.geometryGroups[C].vertices+z>65535){E[A].counter=E[A].counter+1;C=E[A].hash+"_"+E[A].counter;p.geometryGroups[C]===void 0&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:P})}w instanceof THREE.Face3?p.geometryGroups[C].faces3.push(r):p.geometryGroups[C].faces4.push(r);p.geometryGroups[C].vertices=p.geometryGroups[C].vertices+z}p.geometryGroupsList=[];var O=void 0;for(O in p.geometryGroups){p.geometryGroups[O].id=
- ta++;p.geometryGroupsList.push(p.geometryGroups[O])}}for(j in k.geometryGroups){l=k.geometryGroups[j];if(!l.__webglVertexBuffer){var G=l;G.__webglVertexBuffer=g.createBuffer();G.__webglNormalBuffer=g.createBuffer();G.__webglTangentBuffer=g.createBuffer();G.__webglColorBuffer=g.createBuffer();G.__webglUVBuffer=g.createBuffer();G.__webglUV2Buffer=g.createBuffer();G.__webglSkinVertexABuffer=g.createBuffer();G.__webglSkinVertexBBuffer=g.createBuffer();G.__webglSkinIndicesBuffer=g.createBuffer();G.__webglSkinWeightsBuffer=
- g.createBuffer();G.__webglFaceBuffer=g.createBuffer();G.__webglLineBuffer=g.createBuffer();var N=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];N=0;for(Q=G.numMorphTargets;N<Q;N++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];N=0;for(Q=G.numMorphNormals;N<Q;N++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;var I=l,S=h,T=S.geometry,U=I.faces3,W=I.faces4,V=U.length*3+W.length*4,da=U.length*
- 1+W.length*2,ea=U.length*3+W.length*4,aa=c(S,I),ia=e(aa),la=d(aa),ua=aa.vertexColors?aa.vertexColors:false;I.__vertexArray=new Float32Array(V*3);if(la)I.__normalArray=new Float32Array(V*3);if(T.hasTangents)I.__tangentArray=new Float32Array(V*4);if(ua)I.__colorArray=new Float32Array(V*3);if(ia){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)I.__uvArray=new Float32Array(V*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(V*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){I.__skinVertexAArray=
- new Float32Array(V*4);I.__skinVertexBArray=new Float32Array(V*4);I.__skinIndexArray=new Float32Array(V*4);I.__skinWeightArray=new Float32Array(V*4)}I.__faceArray=new Uint16Array(da*3);I.__lineArray=new Uint16Array(ea*2);var ja=void 0,Lb=void 0;if(I.numMorphTargets){I.__morphTargetsArrays=[];ja=0;for(Lb=I.numMorphTargets;ja<Lb;ja++)I.__morphTargetsArrays.push(new Float32Array(V*3))}if(I.numMorphNormals){I.__morphNormalsArrays=[];ja=0;for(Lb=I.numMorphNormals;ja<Lb;ja++)I.__morphNormalsArrays.push(new Float32Array(V*
- 3))}I.__webglFaceCount=da*3;I.__webglLineCount=ea*2;if(aa.attributes){if(I.__webglCustomAttributesList===void 0)I.__webglCustomAttributesList=[];var Ca=void 0;for(Ca in aa.attributes){var Ba=aa.attributes[Ca],ma={},Ja;for(Ja in Ba)ma[Ja]=Ba[Ja];if(!ma.__webglInitialized||ma.createUniqueBuffers){ma.__webglInitialized=true;var Ia=1;ma.type==="v2"?Ia=2:ma.type==="v3"?Ia=3:ma.type==="v4"?Ia=4:ma.type==="c"&&(Ia=3);ma.size=Ia;ma.array=new Float32Array(V*Ia);ma.buffer=g.createBuffer();ma.buffer.belongsToAttribute=
- Ca;Ba.needsUpdate=true;ma.__original=Ba}I.__webglCustomAttributesList.push(ma)}}I.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}else if(k instanceof THREE.BufferGeometry){var Mb=k,Ma=void 0,xb=void 0,Va=void 0;for(Ma in Mb.attributes){Va=Ma==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;xb=Mb.attributes[Ma];xb.buffer=g.createBuffer();g.bindBuffer(Va,
- xb.buffer);g.bufferData(Va,xb.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var pb=k;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var Wa=k,Za=Wa.vertices.length;Wa.__vertexArray=new Float32Array(Za*3);Wa.__colorArray=new Float32Array(Za*3);Wa.__webglVertexCount=Za;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var wb=
- k;wb.__webglVertexBuffer=g.createBuffer();wb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var kc=k,Wb=h,Nb=kc.vertices.length;kc.__vertexArray=new Float32Array(Nb*3);kc.__colorArray=new Float32Array(Nb*3);kc.__webglLineCount=Nb;b(kc,Wb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Vb=k;Vb.__webglVertexBuffer=g.createBuffer();Vb.__webglColorBuffer=g.createBuffer();F.info.geometries++;var Xb=
- k,hc=h,Ob=Xb.vertices.length;Xb.__vertexArray=new Float32Array(Ob*3);Xb.__colorArray=new Float32Array(Ob*3);Xb.__sortArray=[];Xb.__webglParticleCount=Ob;b(Xb,hc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)m(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];m(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
- h.geometry;m(i.__webglObjects,k,h)}else h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ra=a.__objectsRemoved[0],Ac=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof
- THREE.Line?u(Ac.__webglObjects,Ra):Ra instanceof THREE.Sprite?q(Ac.__webglSprites,Ra):Ra instanceof THREE.LensFlare?q(Ac.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(Ac.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Pb=0,ic=a.__webglObjects.length;Pb<ic;Pb++){var Xa=a.__webglObjects[Pb].object,X=Xa.geometry,lc=void 0,Yb=void 0,Na=void 0;if(Xa instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||
- X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate){var qb=X,Zb=g.DYNAMIC_DRAW,jc=!X.dynamic,$b=qb.attributes,Rc=$b.index,Sc=$b.position,Tc=$b.normal,Uc=$b.uv,Vc=$b.color,Wc=$b.tangent;if(qb.elementsNeedUpdate&&Rc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Rc.array,Zb)}if(qb.verticesNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Zb)}if(qb.normalsNeedUpdate&&
- Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Zb)}if(qb.uvsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Zb)}if(qb.colorsNeedUpdate&&Vc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Vc.buffer);g.bufferData(g.ARRAY_BUFFER,Vc.array,Zb)}if(qb.tangentsNeedUpdate&&Wc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Wc.buffer);g.bufferData(g.ARRAY_BUFFER,Wc.array,Zb)}if(jc){var gc=void 0;for(gc in qb.attributes)delete qb.attributes[gc].array}}X.verticesNeedUpdate=
- false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false}else{for(var Xc=0,xc=X.geometryGroupsList.length;Xc<xc;Xc++){lc=X.geometryGroupsList[Xc];Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.morphTargetsNeedUpdate||X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate||Yb){var Z=lc,yc=Xa,Pa=g.DYNAMIC_DRAW,zc=!X.dynamic,Qb=Na;if(Z.__inittedArrays){var fd=d(Qb),
- Yc=Qb.vertexColors?Qb.vertexColors:false,gd=e(Qb),Bc=fd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,D=void 0,ac=void 0,yb=void 0,Ya=void 0,Cc=void 0,rb=void 0,bc=void 0,cc=void 0,J=void 0,K=void 0,L=void 0,$=void 0,$a=void 0,ab=void 0,bb=void 0,mc=void 0,cb=void 0,db=void 0,eb=void 0,nc=void 0,fb=void 0,gb=void 0,hb=void 0,oc=void 0,ib=void 0,jb=void 0,kb=void 0,pc=void 0,lb=void 0,mb=void 0,nb=void 0,qc=void 0,zb=void 0,Ab=void 0,Bb=void 0,Dc=void 0,Cb=void 0,Db=void 0,Eb=void 0,Ec=void 0,
- fa=void 0,hd=void 0,Fb=void 0,dc=void 0,ec=void 0,Da=void 0,id=void 0,za=void 0,Aa=void 0,Gb=void 0,sb=void 0,va=0,ya=0,tb=0,ub=0,Sa=0,Ha=0,ha=0,Ka=0,wa=0,B=0,Y=0,t=0,ga=void 0,Ea=Z.__vertexArray,rc=Z.__uvArray,sc=Z.__uv2Array,Ta=Z.__normalArray,na=Z.__tangentArray,Fa=Z.__colorArray,oa=Z.__skinVertexAArray,pa=Z.__skinVertexBArray,qa=Z.__skinIndexArray,ra=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,s=void 0,ob=Z.__faceArray,Qa=Z.__lineArray,
- La=yc.geometry,Pc=La.elementsNeedUpdate,jd=La.uvsNeedUpdate,Qc=La.normalsNeedUpdate,qd=La.tangentsNeedUpdate,rd=La.colorsNeedUpdate,sd=La.morphTargetsNeedUpdate,Rb=La.vertices,ba=Z.faces3,ca=Z.faces4,xa=La.faces,bd=La.faceVertexUvs[0],cd=La.faceVertexUvs[1],Sb=La.skinVerticesA,Tb=La.skinVerticesB,Ub=La.skinIndices,Hb=La.skinWeights,Ib=La.morphTargets,Fc=La.morphNormals;if(La.verticesNeedUpdate){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=
- J.z;Ea[ya+3]=K.x;Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;ya=ya+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=Rb[D.a];K=Rb[D.b];L=Rb[D.c];$=Rb[D.d];Ea[ya]=J.x;Ea[ya+1]=J.y;Ea[ya+2]=J.z;Ea[ya+3]=K.x;Ea[ya+4]=K.y;Ea[ya+5]=K.z;Ea[ya+6]=L.x;Ea[ya+7]=L.y;Ea[ya+8]=L.z;Ea[ya+9]=$.x;Ea[ya+10]=$.y;Ea[ya+11]=$.z;ya=ya+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Pa)}if(sd){Da=0;for(id=Ib.length;Da<id;Da++){y=Y=0;for(M=ba.length;y<M;y++){Gb=ba[y];
- D=xa[Gb];J=Ib[Da].vertices[D.a];K=Ib[Da].vertices[D.b];L=Ib[Da].vertices[D.c];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c}else eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z}Y=Y+9}y=0;for(M=ca.length;y<M;y++){Gb=ca[y];D=xa[Gb];J=Ib[Da].vertices[D.a];
- K=Ib[Da].vertices[D.b];L=Ib[Da].vertices[D.c];$=Ib[Da].vertices[D.d];za=Zc[Da];za[Y]=J.x;za[Y+1]=J.y;za[Y+2]=J.z;za[Y+3]=K.x;za[Y+4]=K.y;za[Y+5]=K.z;za[Y+6]=L.x;za[Y+7]=L.y;za[Y+8]=L.z;za[Y+9]=$.x;za[Y+10]=$.y;za[Y+11]=$.z;if(Qb.morphNormals){if(Bc){sb=Fc[Da].vertexNormals[Gb];cb=sb.a;db=sb.b;eb=sb.c;nc=sb.d}else nc=eb=db=cb=Fc[Da].faceNormals[Gb];Aa=$c[Da];Aa[Y]=cb.x;Aa[Y+1]=cb.y;Aa[Y+2]=cb.z;Aa[Y+3]=db.x;Aa[Y+4]=db.y;Aa[Y+5]=db.z;Aa[Y+6]=eb.x;Aa[Y+7]=eb.y;Aa[Y+8]=eb.z;Aa[Y+9]=nc.x;Aa[Y+10]=nc.y;
- Aa[Y+11]=nc.z}Y=Y+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphTargetsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,Zc[Da],Pa);if(Qb.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphNormalsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,$c[Da],Pa)}}}if(Hb.length){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;lb=Ub[D.a];mb=
- Ub[D.b];nb=Ub[D.c];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+
- 9]=Eb.y;pa[B+10]=Eb.z;pa[B+11]=1;B=B+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ib=Hb[D.a];jb=Hb[D.b];kb=Hb[D.c];pc=Hb[D.d];ra[B]=ib.x;ra[B+1]=ib.y;ra[B+2]=ib.z;ra[B+3]=ib.w;ra[B+4]=jb.x;ra[B+5]=jb.y;ra[B+6]=jb.z;ra[B+7]=jb.w;ra[B+8]=kb.x;ra[B+9]=kb.y;ra[B+10]=kb.z;ra[B+11]=kb.w;ra[B+12]=pc.x;ra[B+13]=pc.y;ra[B+14]=pc.z;ra[B+15]=pc.w;lb=Ub[D.a];mb=Ub[D.b];nb=Ub[D.c];qc=Ub[D.d];qa[B]=lb.x;qa[B+1]=lb.y;qa[B+2]=lb.z;qa[B+3]=lb.w;qa[B+4]=mb.x;qa[B+5]=mb.y;qa[B+6]=mb.z;qa[B+7]=mb.w;qa[B+8]=nb.x;qa[B+
- 9]=nb.y;qa[B+10]=nb.z;qa[B+11]=nb.w;qa[B+12]=qc.x;qa[B+13]=qc.y;qa[B+14]=qc.z;qa[B+15]=qc.w;zb=Sb[D.a];Ab=Sb[D.b];Bb=Sb[D.c];Dc=Sb[D.d];oa[B]=zb.x;oa[B+1]=zb.y;oa[B+2]=zb.z;oa[B+3]=1;oa[B+4]=Ab.x;oa[B+5]=Ab.y;oa[B+6]=Ab.z;oa[B+7]=1;oa[B+8]=Bb.x;oa[B+9]=Bb.y;oa[B+10]=Bb.z;oa[B+11]=1;oa[B+12]=Dc.x;oa[B+13]=Dc.y;oa[B+14]=Dc.z;oa[B+15]=1;Cb=Tb[D.a];Db=Tb[D.b];Eb=Tb[D.c];Ec=Tb[D.d];pa[B]=Cb.x;pa[B+1]=Cb.y;pa[B+2]=Cb.z;pa[B+3]=1;pa[B+4]=Db.x;pa[B+5]=Db.y;pa[B+6]=Db.z;pa[B+7]=1;pa[B+8]=Eb.x;pa[B+9]=Eb.y;
- pa[B+10]=Eb.z;pa[B+11]=1;pa[B+12]=Ec.x;pa[B+13]=Ec.y;pa[B+14]=Ec.z;pa[B+15]=1;B=B+16}if(B>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,oa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,pa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,qa,Pa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Pa)}}if(rd&&Yc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];
- Ya=D.vertexColors;Cc=D.color;if(Ya.length===3&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2]}else hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;wa=wa+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];Ya=D.vertexColors;Cc=D.color;if(Ya.length===4&&Yc===THREE.VertexColors){fb=Ya[0];gb=Ya[1];hb=Ya[2];oc=Ya[3]}else oc=hb=gb=fb=Cc;Fa[wa]=fb.r;Fa[wa+1]=fb.g;Fa[wa+2]=fb.b;Fa[wa+3]=gb.r;Fa[wa+4]=gb.g;Fa[wa+5]=gb.b;Fa[wa+
- 6]=hb.r;Fa[wa+7]=hb.g;Fa[wa+8]=hb.b;Fa[wa+9]=oc.r;Fa[wa+10]=oc.g;Fa[wa+11]=oc.b;wa=wa+12}if(wa>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Fa,Pa)}}if(qd&&La.hasTangents){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];rb=D.vertexTangents;$a=rb[0];ab=rb[1];bb=rb[2];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;ha=ha+12}y=0;for(M=ca.length;y<M;y++){D=
- xa[ca[y]];rb=D.vertexTangents;$a=rb[0];ab=rb[1];bb=rb[2];mc=rb[3];na[ha]=$a.x;na[ha+1]=$a.y;na[ha+2]=$a.z;na[ha+3]=$a.w;na[ha+4]=ab.x;na[ha+5]=ab.y;na[ha+6]=ab.z;na[ha+7]=ab.w;na[ha+8]=bb.x;na[ha+9]=bb.y;na[ha+10]=bb.z;na[ha+11]=bb.w;na[ha+12]=mc.x;na[ha+13]=mc.y;na[ha+14]=mc.z;na[ha+15]=mc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,na,Pa)}if(Qc&&fd){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===3&&Bc)for(fa=
- 0;fa<3;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<3;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ac=D.vertexNormals;yb=D.normal;if(ac.length===4&&Bc)for(fa=0;fa<4;fa++){Fb=ac[fa];Ta[Ha]=Fb.x;Ta[Ha+1]=Fb.y;Ta[Ha+2]=Fb.z;Ha=Ha+3}else for(fa=0;fa<4;fa++){Ta[Ha]=yb.x;Ta[Ha+1]=yb.y;Ta[Ha+2]=yb.z;Ha=Ha+3}}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Pa)}if(jd&&bd&&gd){y=0;for(M=
- ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];bc=bd[Ua];if(bc!==void 0)for(fa=0;fa<3;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=xa[Ua];bc=bd[Ua];if(bc!==void 0)for(fa=0;fa<4;fa++){dc=bc[fa];rc[tb]=dc.u;rc[tb+1]=dc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Pa)}}if(jd&&cd&&gd){y=0;for(M=ba.length;y<M;y++){Ua=ba[y];D=xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<3;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=
- ub+2}}y=0;for(M=ca.length;y<M;y++){Ua=ca[y];D=xa[Ua];cc=cd[Ua];if(cc!==void 0)for(fa=0;fa<4;fa++){ec=cc[fa];sc[ub]=ec.u;sc[ub+1]=ec.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,sc,Pa)}}if(Pc){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+2;Sa=Sa+3;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+2;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Ka=Ka+6;va=va+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];ob[Sa]=va;ob[Sa+1]=va+1;ob[Sa+2]=va+
- 3;ob[Sa+3]=va+1;ob[Sa+4]=va+2;ob[Sa+5]=va+3;Sa=Sa+6;Qa[Ka]=va;Qa[Ka+1]=va+1;Qa[Ka+2]=va;Qa[Ka+3]=va+3;Qa[Ka+4]=va+1;Qa[Ka+5]=va+2;Qa[Ka+6]=va+2;Qa[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,ob,Pa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Qa,Pa)}if(ad){fa=0;for(hd=ad.length;fa<hd;fa++){s=ad[fa];if(s.__original.needsUpdate){t=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo===
- "vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];t=t+3}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];s.array[t]=s.value[D.a];s.array[t+1]=s.value[D.b];s.array[t+2]=s.value[D.c];s.array[t+3]=s.value[D.d];t=t+4}}else{if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=ga;t=t+3}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];s.array[t]=ga;s.array[t+1]=ga;s.array[t+2]=
- ga;s.array[t+3]=ga;t=t+4}}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;
- s.array[t+7]=$.y;t=t+8}}else{if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;t=t+6}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=K.x;s.array[t+3]=K.y;s.array[t+4]=L.x;s.array[t+5]=L.y;s.array[t+6]=$.x;s.array[t+7]=$.y;t=t+8}}}else if(s.size===3){var R;R=s.type==="c"?["r","g","b"]:["x","y","z"];if(s.boundTo===void 0||
- s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];
- s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J[R[0]];
- s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+
- 7]=L[R[1]];s.array[t+8]=L[R[2]];t=t+9}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J[R[0]];s.array[t+1]=J[R[1]];s.array[t+2]=J[R[2]];s.array[t+3]=K[R[0]];s.array[t+4]=K[R[1]];s.array[t+5]=K[R[2]];s.array[t+6]=L[R[0]];s.array[t+7]=L[R[1]];s.array[t+8]=L[R[2]];s.array[t+9]=$[R[0]];s.array[t+10]=$[R[1]];s.array[t+11]=$[R[2]];t=t+12}}}else if(s.size===4)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(M=ba.length;y<M;y++){D=xa[ba[y]];J=s.value[D.a];K=
- s.value[D.b];L=s.value[D.c];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){D=xa[ca[y]];J=s.value[D.a];K=s.value[D.b];L=s.value[D.c];$=s.value[D.d];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+
- 9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faces"){y=0;for(M=ba.length;y<M;y++){L=K=J=ga=s.value[ba[y]];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){$=L=K=J=ga=s.value[ca[y]];s.array[t]=J.x;s.array[t+1]=J.y;
- s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}else if(s.boundTo==="faceVertices"){y=0;for(M=ba.length;y<M;y++){ga=s.value[ba[y]];J=ga[0];K=ga[1];L=ga[2];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+
- 8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;t=t+12}y=0;for(M=ca.length;y<M;y++){ga=s.value[ca[y]];J=ga[0];K=ga[1];L=ga[2];$=ga[3];s.array[t]=J.x;s.array[t+1]=J.y;s.array[t+2]=J.z;s.array[t+3]=J.w;s.array[t+4]=K.x;s.array[t+5]=K.y;s.array[t+6]=K.z;s.array[t+7]=K.w;s.array[t+8]=L.x;s.array[t+9]=L.y;s.array[t+10]=L.z;s.array[t+11]=L.w;s.array[t+12]=$.x;s.array[t+13]=$.y;s.array[t+14]=$.z;s.array[t+15]=$.w;t=t+16}}g.bindBuffer(g.ARRAY_BUFFER,s.buffer);g.bufferData(g.ARRAY_BUFFER,s.array,
- Pa)}}}if(zc){delete Z.__inittedArrays;delete Z.__colorArray;delete Z.__normalArray;delete Z.__tangentArray;delete Z.__uvArray;delete Z.__uv2Array;delete Z.__faceArray;delete Z.__vertexArray;delete Z.__lineArray;delete Z.__skinVertexAArray;delete Z.__skinVertexBArray;delete Z.__skinIndexArray;delete Z.__skinWeightArray}}}}X.verticesNeedUpdate=false;X.morphTargetsNeedUpdate=false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=
- false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.Ribbon){if(X.verticesNeedUpdate||X.colorsNeedUpdate){var Jb=X,kd=g.DYNAMIC_DRAW,tc=void 0,uc=void 0,Gc=void 0,Kb=void 0,Hc=void 0,ld=Jb.vertices,md=Jb.colors,td=ld.length,ud=md.length,Ic=Jb.__vertexArray,Jc=Jb.__colorArray,vd=Jb.colorsNeedUpdate;if(Jb.verticesNeedUpdate){for(tc=0;tc<td;tc++){Gc=ld[tc];Kb=tc*3;Ic[Kb]=Gc.x;Ic[Kb+1]=Gc.y;Ic[Kb+2]=Gc.z}g.bindBuffer(g.ARRAY_BUFFER,Jb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ic,kd)}if(vd){for(uc=
- 0;uc<ud;uc++){Hc=md[uc];Kb=uc*3;Jc[Kb]=Hc.r;Jc[Kb+1]=Hc.g;Jc[Kb+2]=Hc.b}g.bindBuffer(g.ARRAY_BUFFER,Jb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,kd)}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);if(X.verticesNeedUpdate||X.colorsNeedUpdate||Yb){var vb=X,dd=g.DYNAMIC_DRAW,vc=void 0,wc=void 0,Kc=void 0,sa=void 0,Lc=void 0,nd=vb.vertices,od=vb.colors,wd=nd.length,xd=od.length,Mc=vb.__vertexArray,Nc=vb.__colorArray,yd=
- vb.colorsNeedUpdate,ed=vb.__webglCustomAttributesList,Oc=void 0,pd=void 0,Ga=void 0,fc=void 0,Oa=void 0,ka=void 0;if(vb.verticesNeedUpdate){for(vc=0;vc<wd;vc++){Kc=nd[vc];sa=vc*3;Mc[sa]=Kc.x;Mc[sa+1]=Kc.y;Mc[sa+2]=Kc.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Mc,dd)}if(yd){for(wc=0;wc<xd;wc++){Lc=od[wc];sa=wc*3;Nc[sa]=Lc.r;Nc[sa+1]=Lc.g;Nc[sa+2]=Lc.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Nc,dd)}if(ed){Oc=0;for(pd=ed.length;Oc<
- pd;Oc++){ka=ed[Oc];if(ka.needsUpdate&&(ka.boundTo===void 0||ka.boundTo==="vertices")){sa=0;fc=ka.value.length;if(ka.size===1)for(Ga=0;Ga<fc;Ga++)ka.array[Ga]=ka.value[Ga];else if(ka.size===2)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;sa=sa+2}else if(ka.size===3)if(ka.type==="c")for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.r;ka.array[sa+1]=Oa.g;ka.array[sa+2]=Oa.b;sa=sa+3}else for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;ka.array[sa+
- 2]=Oa.z;sa=sa+3}else if(ka.size===4)for(Ga=0;Ga<fc;Ga++){Oa=ka.value[Ga];ka.array[sa]=Oa.x;ka.array[sa+1]=Oa.y;ka.array[sa+2]=Oa.z;ka.array[sa+3]=Oa.w;sa=sa+4}g.bindBuffer(g.ARRAY_BUFFER,ka.buffer);g.bufferData(g.ARRAY_BUFFER,ka.array,dd)}}}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}else if(Xa instanceof THREE.ParticleSystem){Na=c(Xa,lc);Yb=Na.attributes&&n(Na);(X.verticesNeedUpdate||X.colorsNeedUpdate||Xa.sortParticles||Yb)&&f(X,g.DYNAMIC_DRAW,Xa);X.verticesNeedUpdate=
- false;X.colorsNeedUpdate=false;Na.attributes&&o(Na)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=
- THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var o,q;o=h=e=n=0;for(f=b.length;o<f;o++){q=b[o];if(!q.onlyShadow){q instanceof THREE.DirectionalLight&&h++;q instanceof THREE.PointLight&&e++;q instanceof THREE.SpotLight&&n++}}if(e+n+h<=V){o=h;f=e}else{o=Math.ceil(V*h/(e+h));n=f=V-o}e=o;h=n;n=l=0;for(o=b.length;n<o;n++){q=b[n];if(q.castShadow){q instanceof THREE.SpotLight&&l++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&l++}}if(hc&&d&&
- d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var p;a:{q=a.fragmentShader;o=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
- sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:k,useVertexTexture:hc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
- shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.doubleSided},r,d=[];if(m)d.push(m);else{d.push(q);d.push(o)}for(r in c){d.push(r);d.push(c[r])}m=d.join();r=0;for(d=ea.length;r<d;r++){e=ea[r];if(e.code===m){e.usedTimes++;p=e.program;break a}}r=g.createProgram();d=["precision "+C+" float;",jc?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?
- "#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
- "",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
- "","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
- e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
- "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
- e=w("fragment",e+q);d=w("vertex",d+o);g.attachShader(r,d);g.attachShader(r,e);g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(e);g.deleteShader(d);r.uniforms={};r.attributes={};var u,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
- d.push("boneGlobalMatrices");for(u in n)d.push(u);u=d;d=0;for(n=u.length;d<n;d++){e=u[d];r.uniforms[e]=g.getUniformLocation(r,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)d.push("morphTarget"+u);for(u=0;u<c.maxMorphNormals;u++)d.push("morphNormal"+u);for(p in b)d.push(p);p=d;u=0;for(c=p.length;u<c;u++){d=p[u];r.attributes[d]=g.getAttribLocation(r,d)}r.id=ja++;ea.push({program:r,code:m,usedTimes:1});F.info.memory.programs=
- ea.length;p=r}a.program=p;p=a.program.attributes;p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(j in a.attributes)p[j]!==
- void 0&&p[j]>=0&&g.enableVertexAttribArray(p[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){u=r+j;if(p[u]>=0){g.enableVertexAttribArray(p[u]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){u=r+j;if(p[u]>=0){g.enableVertexAttribArray(p[u]);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"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setMaterialFaces=function(a){if(ia!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);ia=a.doubleSided}if(N!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);N=a.flipSided}};this.setDepthTest=function(a){if(Ia!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
- Ia=a}};this.setDepthWrite=function(a){if(Ca!==a){g.depthMask(a);Ca=a}};this.setBlending=function(a,b,c,d){if(a!==ua){if(a===THREE.NoBlending)g.disable(g.BLEND);else if(a===THREE.AdditiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE)}else if(a===THREE.SubtractiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
- g.SRC_COLOR)}else if(a===THREE.CustomBlending)g.enable(g.BLEND);else{g.enable(g.BLEND);g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD);g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}ua=a}if(a===THREE.CustomBlending){if(b!==Ba){g.blendEquation(A(b));Ba=b}if(c!==ma||d!==Ja){g.blendFunc(A(c),A(d));ma=c;Ja=d}}else Ja=ma=Ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();F.info.memory.textures++}g.activeTexture(g.TEXTURE0+
- b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,a.flipY);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=A(a.format),f=A(a.type);H(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+
- b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);H(g.TEXTURE_CUBE_MAP,a,c);
- for(var f=0;f<6;f++){a.__webglFramebuffer[f]=g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);v(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=
- g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,a.__webglTexture);H(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);v(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,
- null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Ob;a=Pb;d=xb;e=Nb}if(b!==la){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);la=b}gc=c;xc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
- THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=c.anisotropy!==void 0?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:
- THREE.RGBAFormat;this.type=c.type!==void 0?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
- THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.anisotropy=this.anisotropy;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;return a};
- THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
- THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
- THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
- THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
- THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
- Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,h=a.length;f<h;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
- {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
- 0}var e=this.offsets,f=this.attributes.index.array,h=this.attributes.position.array,j=this.attributes.normal.array,l,k,i,m,n,o,u=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,x=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;l=e[c].count;var w=e[c].index;a=b;for(b=b+l;a<b;a=a+3){l=w+f[a];k=w+f[a+1];i=w+f[a+2];m=h[l*3];n=h[l*3+1];o=h[l*3+2];u.set(m,n,o);m=h[k*3];n=h[k*3+1];o=h[k*3+2];q.set(m,n,o);m=h[i*3];n=h[i*3+1];o=h[i*3+2];r.set(m,n,o);p.sub(r,q);x.sub(u,
- q);p.crossSelf(x);j[l*3]=j[l*3]+p.x;j[l*3+1]=j[l*3+1]+p.y;j[l*3+2]=j[l*3+2]+p.z;j[k*3]=j[k*3]+p.x;j[k*3+1]=j[k*3+1]+p.y;j[k*3+2]=j[k*3+2]+p.z;j[i*3]=j[i*3]+p.x;j[i*3+1]=j[i*3+1]+p.y;j[i*3+2]=j[i*3+2]+p.z}}a=0;for(b=j.length;a<b;a=a+3){m=j[a];n=j[a+1];o=j[a+2];c=1/Math.sqrt(m*m+n*n+o*o);j[a]=j[a]*c;j[a+1]=j[a+1]*c;j[a+2]=j[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){m=d[a*3];n=d[a*3+1];o=d[a*3+2];u=d[b*3];q=d[b*3+1];r=d[b*3+2];p=d[c*3];x=d[c*3+1];w=d[c*3+2];H=
- f[a*2];v=f[a*2+1];E=f[b*2];A=f[b*2+1];G=f[c*2];C=f[c*2+1];P=u-m;I=p-m;U=q-n;W=x-n;S=r-o;z=w-o;O=E-H;V=G-H;F=A-v;ea=C-v;ja=1/(O*ea-V*F);Q.set((ea*P-F*I)*ja,(ea*U-F*W)*ja,(ea*S-F*z)*ja);la.set((O*I-V*P)*ja,(O*W-V*U)*ja,(O*z-V*S)*ja);k[a].addSelf(Q);k[b].addSelf(Q);k[c].addSelf(Q);i[a].addSelf(la);i[b].addSelf(la);i[c].addSelf(la)}function b(a){Ja.x=e[a*3];Ja.y=e[a*3+1];Ja.z=e[a*3+2];Ia.copy(Ja);Va=k[a];Ba.copy(Va);Ba.subSelf(Ja.multiplyScalar(Ja.dot(Va))).normalize();ma.cross(Ia,Va);wb=ma.dot(i[a]);
- Ca=wb<0?-1:1;l[a*4]=Ba.x;l[a*4+1]=Ba.y;l[a*4+2]=Ba.z;l[a*4+3]=Ca}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,h=d.length/3;if(this.attributes.tangent===void 0){var j=4*h;this.attributes.tangent=
- {itemSize:4,array:new Float32Array(j),numItems:j}}for(var l=this.attributes.tangent.array,k=[],i=[],j=0;j<h;j++){k[j]=new THREE.Vector3;i[j]=new THREE.Vector3}var m,n,o,u,q,r,p,x,w,H,v,E,A,G,C,P,I,U,W,S,z,O,V,F,ea,ja,Q=new THREE.Vector3,la=new THREE.Vector3,aa,T,da,ta,ia,N=this.offsets,j=0;for(T=N.length;j<T;++j){aa=N[j].start;da=N[j].count;var ua=N[j].index,h=aa;for(aa=aa+da;h<aa;h=h+3){da=ua+c[h];ta=ua+c[h+1];ia=ua+c[h+2];a(da,ta,ia)}}var Ba=new THREE.Vector3,ma=new THREE.Vector3,Ja=new THREE.Vector3,
- Ia=new THREE.Vector3,Ca,Va,wb,j=0;for(T=N.length;j<T;++j){aa=N[j].start;da=N[j].count;ua=N[j].index;h=aa;for(aa=aa+da;h<aa;h=h+3){da=ua+c[h];ta=ua+c[h+1];ia=ua+c[h+2];b(da);b(ta);b(ia)}}this.tangentsNeedUpdate=this.hasTangents=true}}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
- THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else this.matrixWorld.copy(this.matrix);
- this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
- THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4",
- "n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);this.camera=a;this.update(a);
- this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);this.add(this.lines)};THREE.CameraHelper.prototype=Object.create(THREE.Object3D.prototype);
- THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
- 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
- THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
- THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
- THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
- 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,h,j,l,k,i,m,n,o;this.init=function(u){b=u.context;c=u;d=new Float32Array(16);e=new Uint16Array(6);u=0;d[u++]=-1;d[u++]=-1;d[u++]=0;d[u++]=0;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=
- 0;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=1;d[u++]=-1;d[u++]=1;d[u++]=0;d[u++]=1;u=0;e[u++]=0;e[u++]=1;e[u++]=2;e[u++]=0;e[u++]=2;e[u++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);j=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,j);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,l);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){k=false;i=a(THREE.ShaderFlares.lensFlare)}else{k=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}m={};n={};m.vertex=b.getAttribLocation(i,"position");m.uv=b.getAttribLocation(i,"uv");n.renderType=b.getUniformLocation(i,"renderType");n.map=b.getUniformLocation(i,"map");n.occlusionMap=b.getUniformLocation(i,"occlusionMap");n.opacity=b.getUniformLocation(i,"opacity");n.color=b.getUniformLocation(i,
- "color");n.scale=b.getUniformLocation(i,"scale");n.rotation=b.getUniformLocation(i,"rotation");n.screenPosition=b.getUniformLocation(i,"screenPosition");o=false};this.render=function(a,d,e,p){var a=a.__webglFlares,x=a.length;if(x){var w=new THREE.Vector3,H=p/e,v=e*0.5,E=p*0.5,A=16/p,G=new THREE.Vector2(A*H,A),C=new THREE.Vector3(1,1,0),P=new THREE.Vector2(1,1),I=n,A=m;b.useProgram(i);if(!o){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);o=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
- 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var U,W,S,z,O;for(U=0;U<x;U++){A=16/p;G.set(A*H,A);z=a[U];w.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);C.copy(w);P.x=C.x*v+v;P.y=C.y*E+E;if(k||P.x>0&&P.x<e&&P.y>0&&
- P.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,G.x,G.y);b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,P.x-8,P.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
- b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(C);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);W=0;for(S=z.lensFlares.length;W<S;W++){O=z.lensFlares[W];if(O.opacity>0.0010&&O.scale>0.0010){C.x=O.x;C.y=O.y;C.z=O.z;A=O.size*O.scale/p;G.x=A*H;G.y=A;b.uniform3f(I.screenPosition,C.x,C.y,C.z);b.uniform2f(I.scale,G.x,G.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
- b.uniform3f(I.color,O.color.r,O.color.g,O.color.b);c.setBlending(O.blending,O.blendEquation,O.blendSrc,O.blendDst);c.setTexture(O.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
- THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,h=new THREE.Matrix4,j=new THREE.Vector3,l=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:h,morphTargets:true});e=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,
- vertexShader:f.vertexShader,uniforms:h,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,i){var m,n,o,u,q,r,p,x,w,H=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(n=k.__lights.length;m<n;m++){o=k.__lights[m];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&
- o.shadowCascade)for(q=0;q<o.shadowCascadeCount;q++){var v;if(o.shadowCascadeArray[q])v=o.shadowCascadeArray[q];else{w=o;p=q;v=new THREE.DirectionalLight;v.isVirtual=true;v.onlyShadow=true;v.castShadow=true;v.shadowCameraNear=w.shadowCameraNear;v.shadowCameraFar=w.shadowCameraFar;v.shadowCameraLeft=w.shadowCameraLeft;v.shadowCameraRight=w.shadowCameraRight;v.shadowCameraBottom=w.shadowCameraBottom;v.shadowCameraTop=w.shadowCameraTop;v.shadowCameraVisible=w.shadowCameraVisible;v.shadowDarkness=w.shadowDarkness;
- v.shadowBias=w.shadowCascadeBias[p];v.shadowMapWidth=w.shadowCascadeWidth[p];v.shadowMapHeight=w.shadowCascadeHeight[p];v.pointsWorld=[];v.pointsFrustum=[];x=v.pointsWorld;r=v.pointsFrustum;for(var E=0;E<8;E++){x[E]=new THREE.Vector3;r[E]=new THREE.Vector3}x=w.shadowCascadeNearZ[p];w=w.shadowCascadeFarZ[p];r[0].set(-1,-1,x);r[1].set(1,-1,x);r[2].set(-1,1,x);r[3].set(1,1,x);r[4].set(-1,-1,w);r[5].set(1,-1,w);r[6].set(-1,1,w);r[7].set(1,1,w);v.originalCamera=i;r=new THREE.Gyroscope;r.position=o.shadowCascadeOffset;
- r.add(v);r.add(v.target);i.add(r);o.shadowCascadeArray[q]=v;console.log("Created virtualLight",v)}p=o;x=q;w=p.shadowCascadeArray[x];w.position.copy(p.position);w.target.position.copy(p.target.position);w.lookAt(w.target);w.shadowCameraVisible=p.shadowCameraVisible;w.shadowDarkness=p.shadowDarkness;w.shadowBias=p.shadowCascadeBias[x];r=p.shadowCascadeNearZ[x];p=p.shadowCascadeFarZ[x];w=w.pointsFrustum;w[0].z=r;w[1].z=r;w[2].z=r;w[3].z=r;w[4].z=p;w[5].z=p;w[6].z=p;w[7].z=p;H[u]=v;u++}else{H[u]=o;u++}}m=
- 0;for(n=H.length;m<n;m++){o=H[m];if(!o.shadowMap){o.shadowMap=new THREE.WebGLRenderTarget(o.shadowMapWidth,o.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});o.shadowMapSize=new THREE.Vector2(o.shadowMapWidth,o.shadowMapHeight);o.shadowMatrix=new THREE.Matrix4}if(!o.shadowCamera){if(o instanceof THREE.SpotLight)o.shadowCamera=new THREE.PerspectiveCamera(o.shadowCameraFov,o.shadowMapWidth/o.shadowMapHeight,o.shadowCameraNear,o.shadowCameraFar);else if(o instanceof
- THREE.DirectionalLight)o.shadowCamera=new THREE.OrthographicCamera(o.shadowCameraLeft,o.shadowCameraRight,o.shadowCameraTop,o.shadowCameraBottom,o.shadowCameraNear,o.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(o.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(o.shadowCameraVisible&&!o.cameraHelper){o.cameraHelper=new THREE.CameraHelper(o.shadowCamera);o.shadowCamera.add(o.cameraHelper)}if(o.isVirtual&&v.originalCamera==i){q=i;u=o.shadowCamera;
- r=o.pointsFrustum;w=o.pointsWorld;j.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){x=w[p];x.copy(r[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(x,q);u.matrixWorldInverse.multiplyVector3(x);if(x.x<j.x)j.x=x.x;if(x.x>l.x)l.x=x.x;if(x.y<j.y)j.y=x.y;if(x.y>l.y)l.y=x.y;if(x.z<j.z)j.z=x.z;if(x.z>l.z)l.z=x.z}u.left=j.x;u.right=l.x;u.top=l.y;u.bottom=j.y;u.updateProjectionMatrix()}u=o.shadowMap;r=o.shadowMatrix;q=o.shadowCamera;q.position.copy(o.matrixWorld.getPosition());
- q.lookAt(o.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(o.cameraHelper)o.cameraHelper.lines.visible=o.shadowCameraVisible;o.shadowCameraVisible&&o.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(q.projectionMatrix);r.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);
- q.projectionMatrix.flattenToArray(q._projectionMatrixArray);h.multiply(q.projectionMatrix,q.matrixWorldInverse);f.setFromMatrix(h);b.setRenderTarget(u);b.clear();w=k.__webglObjects;o=0;for(u=w.length;o<u;o++){p=w[o];r=p.object;p.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||f.contains(r))){r._modelViewMatrix.multiply(q.matrixWorldInverse,r.matrixWorld);p.render=true}}o=0;for(u=w.length;o<u;o++){p=w[o];if(p.render){r=p.object;p=p.buffer;x=r.customDepthMaterial?
- r.customDepthMaterial:r.geometry.morphTargets.length?d:r instanceof THREE.SkinnedMesh?e:c;p instanceof THREE.BufferGeometry?b.renderBufferDirect(q,k.__lights,null,x,p,r):b.renderBuffer(q,k.__lights,null,x,p,r)}}w=k.__webglObjectsImmediate;o=0;for(u=w.length;o<u;o++){p=w[o];r=p.object;if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(q.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(q,k.__lights,null,c,r)}}}m=b.getClearColor();n=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,n);a.enable(a.BLEND);
- b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
- THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,h,j,l,k,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
- h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(u,a.vertexShader);b.compileShader(o);b.compileShader(u);b.attachShader(n,o);b.attachShader(n,u);b.linkProgram(n);j=n;l={};k={};l.position=b.getAttribLocation(j,"position");l.uv=b.getAttribLocation(j,"uv");k.uvOffset=b.getUniformLocation(j,"uvOffset");k.uvScale=b.getUniformLocation(j,
- "uvScale");k.rotation=b.getUniformLocation(j,"rotation");k.scale=b.getUniformLocation(j,"scale");k.alignment=b.getUniformLocation(j,"alignment");k.color=b.getUniformLocation(j,"color");k.map=b.getUniformLocation(j,"map");k.opacity=b.getUniformLocation(j,"opacity");k.useScreenCoordinates=b.getUniformLocation(j,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(j,"affectedByDistance");k.screenPosition=b.getUniformLocation(j,"screenPosition");k.modelViewMatrix=b.getUniformLocation(j,"modelViewMatrix");
- k.projectionMatrix=b.getUniformLocation(j,"projectionMatrix");i=false};this.render=function(d,e,o,u){var d=d.__webglSprites,q=d.length;if(q){var r=l,p=k,x=u/o,o=o*0.5,w=u*0.5,H=true;b.useProgram(j);if(!i){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);i=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
- h);b.uniformMatrix4fv(p.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var v,E=[],r=0;r<q;r++){v=d[r];if(v.visible&&v.opacity!==0)if(v.useScreenCoordinates)v.z=-v.position.z;else{v._modelViewMatrix.multiply(e.matrixWorldInverse,v.matrixWorld);v.z=-v._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<q;r++){v=d[r];if(v.visible&&v.opacity!==0&&v.map&&v.map.image&&v.map.image.width){if(v.useScreenCoordinates){b.uniform1i(p.useScreenCoordinates,1);
- b.uniform3f(p.screenPosition,(v.position.x-o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))}else{b.uniform1i(p.useScreenCoordinates,0);b.uniform1i(p.affectedByDistance,v.affectedByDistance?1:0);b.uniformMatrix4fv(p.modelViewMatrix,false,v._modelViewMatrix.elements)}e=v.map.image.width/(v.scaleByViewport?u:1);E[0]=e*x*v.scale.x;E[1]=e*v.scale.y;b.uniform2f(p.uvScale,v.uvScale.x,v.uvScale.y);b.uniform2f(p.uvOffset,v.uvOffset.x,v.uvOffset.y);b.uniform2f(p.alignment,v.alignment.x,v.alignment.y);
- b.uniform1f(p.opacity,v.opacity);b.uniform3f(p.color,v.color.r,v.color.g,v.color.b);b.uniform1f(p.rotation,v.rotation);b.uniform2fv(p.scale,E);if(v.mergeWith3D&&!H){b.enable(b.DEPTH_TEST);H=true}else if(!v.mergeWith3D&&H){b.disable(b.DEPTH_TEST);H=false}c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst);c.setTexture(v.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
- THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
- lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
- THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
- fragmentShader:"precision mediump float;\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};
|