123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- // 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.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;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],i=d[1],l=d[5],k=d[9],j=d[2],o=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(i,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(i,l)}else{this.y=Math.atan2(-j,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-j,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(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(i,e)}else{this.x=0;this.z=Math.atan2(-f,l)}}else if(b==="YZX"){this.z=Math.asin(c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(-k,l);this.y=Math.atan2(-j,
- e)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,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],i=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+i+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;i=(i+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;l=(l+b)/4;if(e>i&&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(i>
- k)if(i<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(i);b=d/c;d=l/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=l/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.001&&(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+i+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],i=c[5],l=c[6],k=c[7],j=c[8],o=c[9],m=c[10],p=c[11],u=c[12],n=c[13],q=c[14],c=c[15];b[0].set(f-a,k-h,p-j,c-u);b[1].set(f+a,k+h,p+j,c+u);b[2].set(f+d,k+i,p+o,c+n);b[3].set(f-d,k-i,p-o,c-n);b[4].set(f-e,k-l,p-m,c-q);b[5].set(f+e,k+l,p+m,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
- THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
- THREE.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,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},u=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,r,w,v,H=function(a,b,c){u.sub(c,a);r=u.dot(b);w=n.add(a,q.copy(b).multiplyScalar(r));
- return v=c.distanceTo(w)},x,D,E,O,B,Q,F,W,V=function(a,b,c,d){u.sub(d,b);n.sub(c,b);q.sub(a,b);x=u.dot(u);D=u.dot(n);E=u.dot(q);O=n.dot(n);B=n.dot(q);Q=1/(x*O-D*D);F=(O*E-D*B)*Q;W=(x*B-D*E)*Q;return F>=0&&W>=0&&F+W<1},T=1.0E-4;this.setPrecision=function(a){T=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var n=0,q=a.children.length;n<q;n++)Array.prototype.push.apply(d,this.intersectObject(a.children[n],b));if(a instanceof THREE.Particle){v=H(this.origin,this.direction,a.matrixWorld.getPosition());
- if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){n=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());n=a.geometry.boundingSphere.radius*Math.max(n.x,Math.max(n.y,n.z));v=H(this.origin,this.direction,a.matrixWorld.getPosition());if(v>n)return d;var u,r,x=a.geometry,w=x.vertices,B;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(q=x.faces.length;n<
- q;n++){c=x.faces[n];l.copy(this.origin);k.copy(this.direction);B=a.matrixWorld;j=B.multiplyVector3(j.copy(c.centroid)).subSelf(l);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));u=k.dot(o);if(!(Math.abs(u)<T)){r=o.dot(j)/u;if(!(r<0)&&(a.doubleSided||(a.flipSided?u>0:u<0))){m.add(l,k.multiplyScalar(r));v=l.distanceTo(m);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));
- if(V(m,e,f,h)){c={distance:v,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=B.multiplyVector3(e.copy(w[c.a]));f=B.multiplyVector3(f.copy(w[c.b]));h=B.multiplyVector3(h.copy(w[c.c]));i=B.multiplyVector3(i.copy(w[c.d]));if(V(m,e,f,i)||V(m,f,h,i)){c={distance:v,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}}}}}d.sort(p);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(p);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,i=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,j,o){i=false;b=f;c=h;d=j;e=o;a()};this.addPoint=function(f,h){if(i===true){i=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,j,o,m,p){if(i===true){i=false;b=f<j?f<m?f:m:j<m?j:m;c=h<o?h<p?h:p:o<p?o:p;d=f>j?f>m?f:m:j>m?j:m;e=h>o?h>p?h:p:o>p?o:p}else{b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b;c=h<o?h<p?h<c?h:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;e=h>o?h>p?h>e?h:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(i===true){i=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
- c=c<f.getTop()?c:f.getTop();d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
- THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],i=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]*i;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*e;j[4]=b*f;j[5]=b*h;j[6]=b*i;j[7]=b*l;j[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,i,l,k,j,o,m,p,u,n){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,i||0,l||0,k||0,j!==void 0?j:1,o||0,m||0,p||0,u||0,n!==void 0?n:1)};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,i,l,k,j,o,m,p,u,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=i;q[2]=l;q[6]=k;q[10]=j;q[14]=o;q[3]=m;q[7]=p;q[11]=u;q[15]=n;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],i=c[8],l=c[12],k=c[1],j=c[5],o=c[9],m=c[13],p=c[2],u=c[6],n=c[10],q=c[14],r=c[3],w=c[7],v=c[11],c=c[15],H=d[0],x=d[4],
- D=d[8],E=d[12],O=d[1],B=d[5],Q=d[9],F=d[13],W=d[2],V=d[6],T=d[10],A=d[14],M=d[3],G=d[7],ea=d[11],d=d[15];e[0]=f*H+h*O+i*W+l*M;e[4]=f*x+h*B+i*V+l*G;e[8]=f*D+h*Q+i*T+l*ea;e[12]=f*E+h*F+i*A+l*d;e[1]=k*H+j*O+o*W+m*M;e[5]=k*x+j*B+o*V+m*G;e[9]=k*D+j*Q+o*T+m*ea;e[13]=k*E+j*F+o*A+m*d;e[2]=p*H+u*O+n*W+q*M;e[6]=p*x+u*B+n*V+q*G;e[10]=p*D+u*Q+n*T+q*ea;e[14]=p*E+u*F+n*A+q*d;e[3]=r*H+w*O+v*W+c*M;e[7]=r*x+w*B+v*V+c*G;e[11]=r*D+w*Q+v*T+c*ea;e[15]=r*E+w*F+v*A+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],i=a[9],l=a[13],k=a[2],j=a[6],o=a[10],m=a[14],p=a[3],u=a[7],n=a[11],a=a[15];return e*i*j*p-d*l*j*p-e*h*o*p+c*l*o*p+d*h*m*p-c*i*m*p-e*i*k*u+d*l*k*u+e*f*o*u-b*l*o*u-d*f*m*u+b*i*m*u+e*h*k*n-c*l*k*n-e*f*j*n+b*l*j*n+c*f*m*n-b*h*m*n-d*h*k*a+c*i*k*a+d*f*j*a-b*i*j*a-c*f*o*a+b*h*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
- 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],i=c[1],l=c[5],k=c[9],j=c[13],o=c[2],m=c[6],p=c[10],u=c[14],n=c[3],q=c[7],r=c[11],c=c[15];b[0]=k*u*q-j*p*q+j*m*r-l*u*r-k*m*c+l*p*c;b[4]=h*p*q-f*u*q-h*m*r+e*u*r+f*m*c-e*p*c;b[8]=f*j*q-h*k*q+h*l*r-e*j*r-f*l*c+e*k*c;b[12]=h*k*m-f*j*m-h*l*p+e*j*p+f*l*u-e*k*u;b[1]=j*p*n-k*u*n-j*o*r+i*u*r+k*o*c-i*p*c;b[5]=f*u*n-h*p*n+h*o*r-d*u*r-f*o*c+d*p*c;b[9]=h*k*n-f*j*n-h*i*r+d*j*r+f*i*c-d*k*c;b[13]=f*j*o-h*k*o+h*i*p-d*
- j*p-f*i*u+d*k*u;b[2]=l*u*n-j*m*n+j*o*q-i*u*q-l*o*c+i*m*c;b[6]=h*m*n-e*u*n-h*o*q+d*u*q+e*o*c-d*m*c;b[10]=e*j*n-h*l*n+h*i*q-d*j*q-e*i*c+d*l*c;b[14]=h*l*o-e*j*o-h*i*m+d*j*m+e*i*u-d*l*u;b[3]=k*m*n-l*p*n-k*o*q+i*p*q+l*o*r-i*m*r;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*r+d*m*r;b[11]=f*l*n-e*k*n-f*i*q+d*k*q+e*i*r-d*l*r;b[15]=e*k*o-f*l*o+f*i*m-d*k*m-e*i*p+d*l*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,h=Math.cos(d),d=Math.sin(d),
- i=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,j=h*f,o=d*l,m=d*f;c[0]=i*l;c[4]=-i*f;c[8]=e;c[1]=j+o*e;c[5]=k-m*e;c[9]=-d*i;c[2]=m-k*e;c[6]=o+j*e;c[10]=h*i}else if(b==="YXZ"){k=i*l;j=i*f;o=e*l;m=e*f;c[0]=k+m*d;c[4]=o*d-j;c[8]=h*e;c[1]=h*f;c[5]=h*l;c[9]=-d;c[2]=j*d-o;c[6]=m+k*d;c[10]=h*i}else if(b==="ZXY"){k=i*l;j=i*f;o=e*l;m=e*f;c[0]=k-m*d;c[4]=-h*f;c[8]=o+j*d;c[1]=j+o*d;c[5]=h*l;c[9]=m-k*d;c[2]=-h*e;c[6]=d;c[10]=h*i}else if(b==="ZYX"){k=h*l;j=h*f;o=d*l;
- m=d*f;c[0]=i*l;c[4]=o*e-j;c[8]=k*e+m;c[1]=i*f;c[5]=m*e+k;c[9]=j*e-o;c[2]=-e;c[6]=d*i;c[10]=h*i}else if(b==="YZX"){k=h*i;j=h*e;o=d*i;m=d*e;c[0]=i*l;c[4]=m-k*f;c[8]=o*f+j;c[1]=f;c[5]=h*l;c[9]=-d*l;c[2]=-e*l;c[6]=j*f+o;c[10]=k-m*f}else if(b==="XZY"){k=h*i;j=h*e;o=d*i;m=d*e;c[0]=i*l;c[4]=-f;c[8]=e*l;c[1]=k*f+m;c[5]=h*l;c[9]=j*f-o;c[2]=o*f-j;c[6]=d*l;c[10]=m*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,i=d+d,l=e+e,a=c*h,k=c*i,c=c*l,j=d*i,d=d*
- l,e=e*l,h=f*h,i=f*i,f=f*l;b[0]=1-(j+e);b[4]=k-f;b[8]=c+i;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-i;b[6]=d+h;b[10]=1-(a+j);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],i=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[4]=j*c+a*h;b[5]=j*d+a*i;b[6]=j*e+a*l;b[7]=j*f+a*k;b[8]=j*h-a*c;b[9]=j*i-a*d;b[10]=j*l-a*e;b[11]=j*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],i=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[0]=j*c-a*h;b[1]=j*d-a*i;b[2]=j*e-a*l;b[3]=j*f-a*k;b[8]=j*h+a*c;b[9]=j*i+a*d;b[10]=j*l+a*e;b[11]=j*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],i=b[5],l=b[6],k=b[7],j=Math.cos(a),a=Math.sin(a);b[0]=j*c+a*h;b[1]=j*d+a*i;b[2]=j*e+a*l;b[3]=j*f+a*k;b[4]=j*h-a*c;b[5]=j*i-a*d;b[6]=j*l-a*e;b[7]=j*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,i=e*e,l=f*f,k=Math.cos(b),j=Math.sin(b),o=1-k,m=d*e*o,p=d*f*o,o=e*f*o,d=d*j,u=e*j,j=f*j,f=h+(1-h)*k,h=m+j,e=p-u,m=m-j,i=i+(1-i)*k,j=o+d,p=p+u,o=o-d,l=l+(1-l)*k,k=c[0],d=c[1],u=c[2],n=c[3],q=c[4],r=c[5],w=c[6],v=c[7],H=c[8],x=c[9],D=c[10],E=c[11];c[0]=f*k+h*q+e*H;c[1]=f*d+h*
- r+e*x;c[2]=f*u+h*w+e*D;c[3]=f*n+h*v+e*E;c[4]=m*k+i*q+j*H;c[5]=m*d+i*r+j*x;c[6]=m*u+i*w+j*D;c[7]=m*n+i*v+j*E;c[8]=p*k+o*q+l*H;c[9]=p*d+o*r+l*x;c[10]=p*u+o*w+l*D;c[11]=p*n+o*v+l*E;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,i=a.z,l=e*f,k=e*h;this.set(l*f+c,l*h-d*i,l*i+d*h,0,l*h+d*i,k*h+c,k*i-d*f,0,l*i-d*h,k*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var 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,i=b-a,l=c-d,k=f-e;h[0]=2/i;h[4]=0;h[8]=0;h[12]=-((b+a)/i);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.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=
- new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);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)},clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
- THREE.Projector=function(){function a(a,c){h=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var e=function(a){if(a.visible!==false){if((a instanceof THREE.Mesh||a instanceof THREE.Line)&&(a.frustumCulled===false||F.contains(a)===true)){E.copy(a.matrixWorld.getPosition());B.multiplyVector3(E);f=b();f.object=a;f.z=E.z;D.objects.push(f)}else if(a instanceof THREE.Sprite||a instanceof THREE.Particle){E.copy(a.matrixWorld.getPosition());B.multiplyVector3(E);f=b();f.object=a;f.z=E.z;D.sprites.push(f)}else a instanceof
- THREE.Light&&D.lights.push(a);for(var c=0,d=a.children.length;c<d;c++)e(a.children[c])}};e(a);c===true&&D.objects.sort(d);return D}function b(){var a;if(h===i.length){a=new THREE.RenderableObject;i.push(a)}else a=i[h];h++;return a}function c(){var a;if(k===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[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,i=-b.z+b.w;if(f>=0&&h>=0&&e>=0&&i>=0)return true;if(f<0&&h<0||e<0&&i<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-i)):i<0&&(d=Math.min(d,e/(e-i)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,h,i=[],l,k,j=[],o,m,p=[],u,n=[],q,r,w=[],v,H,x=[],D={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,O=new THREE.Vector4,B=new THREE.Matrix4,Q=new THREE.Matrix4,F=new THREE.Frustum,W=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,
- b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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 i=f.near,E=f.far,I=false,aa,P,Aa,sa,U,S,ta,wa,ba,ia,fa,Ja,
- Ga,la,Pa,ua,Xa;H=r=u=m=0;D.elements.length=0;b.updateMatrixWorld();f.parent===void 0&&f.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);B.multiply(f.projectionMatrix,f.matrixWorldInverse);F.setFromMatrix(B);D=a(b,false);b=0;for(aa=D.objects.length;b<aa;b++){ba=D.objects[b].object;ia=ba.matrixWorld;k=0;if(ba instanceof THREE.Mesh){fa=ba.geometry;Ja=ba.geometry.materials;sa=fa.vertices;Ga=fa.faces;Pa=fa.faceVertexUvs;fa=ba.matrixRotationWorld.extractRotation(ia);Xa=ba.material instanceof
- THREE.MeshFaceMaterial;P=0;for(Aa=sa.length;P<Aa;P++){l=c();l.positionWorld.copy(sa[P]);ia.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);B.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>i&&l.positionScreen.z<E}sa=0;for(P=Ga.length;sa<P;sa++){wa=Ga[sa];Aa=Xa===true?Ja[wa.materialIndex]:ba.material;if(Aa!==void 0){ta=Aa.side;if(wa instanceof THREE.Face3){U=
- j[wa.a];S=j[wa.b];la=j[wa.c];if(U.visible===true&&S.visible===true&&la.visible===true){I=(la.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(la.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){ua=void 0;if(m===p.length){ua=new THREE.RenderableFace3;p.push(ua)}else ua=p[m];m++;o=ua;o.v1.copy(U);o.v2.copy(S);o.v3.copy(la)}else continue}else continue}else if(wa instanceof THREE.Face4){U=
- j[wa.a];S=j[wa.b];la=j[wa.c];ua=j[wa.d];if(U.visible===true&&S.visible===true&&la.visible===true&&ua.visible===true){I=(ua.positionScreen.x-U.positionScreen.x)*(S.positionScreen.y-U.positionScreen.y)-(ua.positionScreen.y-U.positionScreen.y)*(S.positionScreen.x-U.positionScreen.x)<0||(S.positionScreen.x-la.positionScreen.x)*(ua.positionScreen.y-la.positionScreen.y)-(S.positionScreen.y-la.positionScreen.y)*(ua.positionScreen.x-la.positionScreen.x)<0;if(ta===THREE.DoubleSide||I===(ta===THREE.FrontSide)){var Va=
- void 0;if(u===n.length){Va=new THREE.RenderableFace4;n.push(Va)}else Va=n[u];u++;o=Va;o.v1.copy(U);o.v2.copy(S);o.v3.copy(la);o.v4.copy(ua)}else continue}else continue}o.normalWorld.copy(wa.normal);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&o.normalWorld.negate();fa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(wa.centroid);ia.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);B.multiplyVector3(o.centroidScreen);wa=wa.vertexNormals;U=0;for(S=wa.length;U<S;U++){la=
- o.vertexNormalsWorld[U];la.copy(wa[U]);I===false&&(ta===THREE.BackSide||ta===THREE.DoubleSide)&&la.negate();fa.multiplyVector3(la)}U=0;for(S=Pa.length;U<S;U++){la=Pa[U][sa];if(la!==void 0){ta=0;for(wa=la.length;ta<wa;ta++)o.uvs[U][ta]=la[ta]}}o.material=Aa;o.z=o.centroidScreen.z;D.elements.push(o)}}}else if(ba instanceof THREE.Line){Q.multiply(B,ia);sa=ba.geometry.vertices;U=c();U.positionScreen.copy(sa[0]);Q.multiplyVector4(U.positionScreen);ia=ba.type===THREE.LinePieces?2:1;P=1;for(Aa=sa.length;P<
- Aa;P++){U=c();U.positionScreen.copy(sa[P]);Q.multiplyVector4(U.positionScreen);if(!((P+1)%ia>0)){S=j[k-2];W.copy(U.positionScreen);V.copy(S.positionScreen);if(e(W,V)===true){W.multiplyScalar(1/W.w);V.multiplyScalar(1/V.w);Ja=void 0;if(r===w.length){Ja=new THREE.RenderableLine;w.push(Ja)}else Ja=w[r];r++;q=Ja;q.v1.positionScreen.copy(W);q.v2.positionScreen.copy(V);q.z=Math.max(W.z,V.z);q.material=ba.material;D.elements.push(q)}}}}}b=0;for(aa=D.sprites.length;b<aa;b++){ba=D.sprites[b].object;ia=ba.matrixWorld;
- if(ba instanceof THREE.Particle){O.set(ia.elements[12],ia.elements[13],ia.elements[14],1);B.multiplyVector4(O);O.z=O.z/O.w;if(O.z>0&&O.z<1){i=void 0;if(H===x.length){i=new THREE.RenderableParticle;x.push(i)}else i=x[H];H++;v=i;v.object=ba;v.x=O.x/O.w;v.y=O.y/O.w;v.z=O.z;v.rotation=ba.rotation.z;v.scale.x=ba.scale.x*Math.abs(v.x-(O.x+f.projectionMatrix.elements[0])/(O.w+f.projectionMatrix.elements[12]));v.scale.y=ba.scale.y*Math.abs(v.y-(O.y+f.projectionMatrix.elements[5])/(O.w+f.projectionMatrix.elements[13]));
- v.material=ba.material;D.elements.push(v)}}}h&&D.elements.sort(d);return D}};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),i=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*h*i;this.y=c*h*e-f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e-f*h*i}else if(b==="YXZ"){this.x=f*d*e+c*h*i;this.y=c*h*e-f*d*i;this.z=
- c*d*i-f*h*e;this.w=c*d*e+f*h*i}else if(b==="ZXY"){this.x=f*d*e-c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e-f*h*i}else if(b==="ZYX"){this.x=f*d*e-c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i-f*h*e;this.w=c*d*e+f*h*i}else if(b==="YZX"){this.x=f*d*e+c*h*i;this.y=c*h*e+f*d*i;this.z=c*d*i-f*h*e;this.w=c*d*e-f*h*i}else if(b==="XZY"){this.x=f*d*e-c*h*i;this.y=c*h*e-f*d*i;this.z=c*d*i+f*h*e;this.w=c*d*e+f*h*i}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],i=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-i)*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+i)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-i)/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+i)/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){var c=a.x,d=a.y,e=a.z,f=a.w,h=b.x,i=b.y,l=b.z,k=b.w;this.x=c*k+d*l-e*i+f*h;this.y=-c*l+d*k+e*h+f*i;this.z=c*i-d*h+e*k+f*l;this.w=-c*h-d*i-e*l+f*k;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*h;this.y=c*a+e*h+d*f-b*i;this.z=d*a+e*i+b*h-c*f;this.w=e*a-b*f-c*h-d*i;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,i=this.z,l=this.w,k=l*c+h*e-i*d,j=l*d+i*c-f*e,o=l*e+f*d-h*c,c=-f*c-h*d-i*e;b.x=k*l+c*-f+j*-i-o*-h;b.y=j*l+c*-h+o*-f-k*-i;b.z=o*l+c*-i+k*-h-j*-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 i=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);this.y=0.5*
- (d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*i)/l;i=Math.sin(b*i)/l;this.w=f*h+this.w*i;this.x=c*h+this.x*i;this.y=d*h+this.y*i;this.z=e*h+this.z*i;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
- THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
- THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
- THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;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.hasTangents=false;this.dynamic=true};
- 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,i=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);i.sub(d,e);h.crossSelf(i);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,i=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);i.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,A){i=a.vertices[b];l=a.vertices[c];
- k=a.vertices[d];j=h[f];o=h[e];m=h[A];p=l.x-i.x;u=k.x-i.x;n=l.y-i.y;q=k.y-i.y;r=l.z-i.z;w=k.z-i.z;v=o.u-j.u;H=m.u-j.u;x=o.v-j.v;D=m.v-j.v;E=1/(v*D-H*x);F.set((D*p-x*u)*E,(D*n-x*q)*E,(D*r-x*w)*E);W.set((v*u-H*p)*E,(v*q-H*n)*E,(v*w-H*r)*E);B[b].addSelf(F);B[c].addSelf(F);B[d].addSelf(F);Q[b].addSelf(W);Q[c].addSelf(W);Q[d].addSelf(W)}var b,c,d,e,f,h,i,l,k,j,o,m,p,u,n,q,r,w,v,H,x,D,E,O,B=[],Q=[],F=new THREE.Vector3,W=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=
- this.vertices.length;b<c;b++){B[b]=new THREE.Vector3;Q[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 M=["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++){A.copy(f.vertexNormals[d]);e=f[M[d]];O=B[e];V.copy(O);V.subSelf(A.multiplyScalar(A.dot(O))).normalize();
- T.cross(f.vertexNormals[d],O);e=T.dot(Q[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(V.x,V.y,V.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
- a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h,i,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(i=this.faceVertexUvs.length;d<i;d++)(l=this.faceVertexUvs[d][f])&&l.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;
- THREE.Spline=function(a){function b(a,b,c,d,f,h,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*h+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,i,l,k,j,o,m;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]];j=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];i=h*h;l=h*i;d.x=b(k.x,j.x,o.x,m.x,h,i,l);d.y=b(k.y,j.y,o.y,m.y,h,i,l);d.z=b(k.z,j.z,o.z,m.z,h,i,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,i=[],j=0;i[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);j=j+e.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){i[b]=j;f=b}}i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,h,e,i=[],j=new THREE.Vector3,k=this.getLength();i.push(j.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);
- i.push(j.copy(d).clone())}i.push(j.copy(this.points[b]).clone())}this.points=i}};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=i.crossOrigin;f.src=b}function f(a,c,d,f,h,i){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
- d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!==1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!==1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(i){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[i[0]]!==void 0)a[c].wrapS=f[i[0]];if(f[i[1]]!==void 0)a[c].wrapT=f[i[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var i=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};
- if(a.shading){var j=a.shading.toLowerCase();j==="phong"?l="MeshPhongMaterial":j==="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.flipSided!==void 0)k.side=THREE.BackSide;if(a.doubleSided!==void 0)k.side=THREE.DoubleSide;if(a.wireframe!==
- void 0)k.wireframe=a.wireframe;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.mapBump&&b&&f(k,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap);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;j=THREE.UniformsUtils.clone(l.uniforms);j.tNormal.texture=
- k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map){j.tDiffuse.texture=k.map;j.enableDiffuse.value=true}if(k.specularMap){j.tSpecular.texture=k.specularMap;j.enableSpecular.value=true}if(k.lightMap){j.tAO.texture=k.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(k.opacity!==void 0)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
- vertexShader:l.vertexShader,uniforms:j,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 i=JSON.parse(h.responseText);a.loadAjaxBuffers(i,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,i=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0){var c=f.response;if(c===void 0)c=(new Uint8Array(f.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){i==0&&(i=f.getResponseHeader("Content-Length"));e({total:i,loaded:f.responseText.length})}}else f.readyState==
- 2&&(i=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,j,o,m,p,u,n,q,r,w,v,H;function x(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function O(b,c){var d,f,e,h,i,j,k,o,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];i=G[f*2];f=G[f*2+1];j=G[e*2];k=G[e*2+1];e=G[h*2];o=G[h*2+1];h=T.faceVertexUvs[0];var m=[];m.push(new THREE.UV(i,f));m.push(new THREE.UV(j,k));m.push(new THREE.UV(e,
- o));h.push(m)}}function B(b,c){var d,f,e,h,i,j,k,o,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];h=n[d*4+2];i=n[d*4+3];j=G[f*2];f=G[f*2+1];k=G[e*2];l=G[e*2+1];o=G[h*2];m=G[h*2+1];h=G[i*2];e=G[i*2+1];i=T.faceVertexUvs[0];var p=[];p.push(new THREE.UV(j,f));p.push(new THREE.UV(k,l));p.push(new THREE.UV(o,m));p.push(new THREE.UV(h,e));i.push(p)}}function Q(b,c,d){for(var f,e,h,i,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];h=c[d*3+2];i=j[d];
- T.faces.push(new THREE.Face3(f,e,h,null,null,i))}}function F(b,c,d){for(var f,e,h,i,j,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];i=c[d*4+3];j=k[d];T.faces.push(new THREE.Face4(f,e,h,i,null,null,j))}}function W(b,c,d,f){for(var e,h,i,j,k,o,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];h=c[f*3+1];i=c[f*3+2];k=d[f*3];o=d[f*3+1];l=d[f*3+2];j=m[f];var n=M[o*3],p=M[o*3+1];o=M[o*3+2];var q=M[l*3],
- r=M[l*3+1];l=M[l*3+2];T.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(q,r,l)],null,j))}}function V(b,c,d,f){for(var e,h,i,j,k,o,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];h=c[f*4+1];i=c[f*4+2];j=c[f*4+3];o=d[f*4];l=d[f*4+1];m=d[f*4+2];n=d[f*4+3];k=p[f];var q=M[l*3],r=M[l*3+1];l=M[l*3+2];var u=M[m*3],x=M[m*3+1];m=M[m*3+2];var v=M[n*3],w=M[n*3+1];n=M[n*3+2];T.faces.push(new THREE.Face4(e,
- h,i,j,[new THREE.Vector3(M[o*3],M[o*3+1],M[o*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(u,x,m),new THREE.Vector3(v,w,n)],null,k))}}var T=this,A=0,M=[],G=[],ea,I,aa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(T,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,A,12);c=D(a,A+12);D(a,A+13);D(a,A+14);D(a,A+15);e=D(a,A+16);l=D(a,A+17);k=D(a,A+18);j=D(a,A+19);o=E(a,A+20);m=E(a,A+20+4);p=E(a,A+20+8);b=E(a,A+20+12);
- u=E(a,A+20+16);n=E(a,A+20+20);q=E(a,A+20+24);r=E(a,A+20+28);w=E(a,A+20+32);v=E(a,A+20+36);H=E(a,A+20+40);A=A+c;c=e*3+j;aa=e*4+j;ea=b*c;I=u*(c+l*3);e=n*(c+k*3);j=q*(c+l*3+k*3);c=r*aa;l=w*(aa+l*4);k=v*(aa+k*4);A=A+function(b){var b=new Float32Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];T.vertices.push(new THREE.Vector3(d,f,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,f,e;for(c=0;c<m;c++){d=b[c*3];f=b[c*3+1];e=b[c*
- 3+2];M.push(d/127,f/127,e/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(m*3);A=A+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,f;for(c=0;c<p;c++){d=b[c*2];f=b[c*2+1];G.push(d,f)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(A);ea=A+ea+x(b*2);I=ea+I+x(u*2);e=I+e+x(n*2);j=e+j+x(q*2);c=j+c+x(r*2);l=c+l+x(w*2);k=l+k+x(v*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;Q(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);O(n,b)}})(I);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
- 3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;W(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);O(q,c)}})(e);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;F(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);B(v,b)}})(l);(function(a){if(H){var b=a+H*Uint32Array.BYTES_PER_ELEMENT*4,c=b+H*Uint32Array.BYTES_PER_ELEMENT*4;V(H,a,b,c+H*Uint32Array.BYTES_PER_ELEMENT*4);B(H,c)}})(k);b&&Q(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*3;W(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*
- 3)}})(ea);r&&F(r,j,j+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;V(w,a,b,b+w*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
- THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.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 i=JSON.parse(f.responseText);a.createModel(i,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,j,o,m,p,u,n,q,r,w,v,H=a.faces;o=a.vertices;var x=a.normals,D=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(j=o.length;k<j;){m=new THREE.Vector3;m.x=o[k++]*b;m.y=o[k++]*b;m.z=o[k++]*b;d.vertices.push(m)}k=0;for(j=H.length;k<j;){b=H[k++];o=b&1;l=b&2;c=b&
- 4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=H[k++];q.b=H[k++];q.c=H[k++];q.d=H[k++];o=4}else{q=new THREE.Face3;q.a=H[k++];q.b=H[k++];q.c=H[k++];o=3}if(l){l=H[k++];q.materialIndex=l}l=d.faces.length;if(c)for(c=0;c<E;c++){r=a.uvs[c];u=H[k++];v=r[u*2];u=r[u*2+1];d.faceUvs[c][l]=new THREE.UV(v,u)}if(e)for(c=0;c<E;c++){r=a.uvs[c];w=[];for(e=0;e<o;e++){u=H[k++];v=r[u*2];u=r[u*2+1];w[e]=new THREE.UV(v,u)}d.faceVertexUvs[c][l]=w}if(p){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
- e.z=x[p];q.normal=e}if(m)for(c=0;c<o;c++){p=H[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){m=H[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<o;c++){m=H[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(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,j,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];j=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;l=0;for(k=o.length;l<k;l=l+3){var m=new THREE.Vector3;m.x=o[l]*b;m.y=o[l+1]*b;m.z=o[l+2]*b;j.push(m)}}}if(a.morphColors!==
- void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(l=j.length;b<l;b=b+3){o=new THREE.Color(16755200);o.setRGB(j[b],j[b+1],j[b+2]);k.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
- THREE.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],i=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,j){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(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[d].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[d].wrapT=e[j[1]]}var k=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!i(a.width)||!i(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)},j=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(h.shading){var p=h.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="MeshBasicMaterial")}if(h.blending!==void 0&&THREE[h.blending]!==
- void 0)m.blending=THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)m.transparent=h.transparent;if(h.depthTest!==void 0)m.depthTest=h.depthTest;if(h.depthWrite!==void 0)m.depthWrite=h.depthWrite;if(h.vertexColors!==void 0)if(h.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(h.vertexColors)m.vertexColors=THREE.VertexColors;if(h.colorDiffuse)m.color=j(h.colorDiffuse);else if(h.DbgColor)m.color=h.DbgColor;if(h.colorSpecular)m.specular=j(h.colorSpecular);if(h.colorAmbient)m.ambient=
- j(h.colorAmbient);if(h.transparency)m.opacity=h.transparency;if(h.specularCoef)m.shininess=h.specularCoef;if(h.visible!==void 0)m.visible=h.visible;if(h.flipSided!==void 0)m.side=THREE.BackSide;if(h.doubleSided!==void 0)m.side=THREE.DoubleSide;if(h.wireframe!==void 0)m.wireframe=h.wireframe;h.mapDiffuse&&k(m,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&k(m,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapBump&&k(m,"bumpMap",h.mapBump,
- h.mapBumpRepeat,h.mapBumpOffset,h.mapBumpWrap);h.mapNormal&&k(m,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&k(m,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){k=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(k.uniforms);j.tNormal.texture=m.normalMap;if(h.mapNormalFactor)j.uNormalScale.value=h.mapNormalFactor;if(m.map){j.tDiffuse.texture=m.map;j.enableDiffuse.value=true}if(m.specularMap){j.tSpecular.texture=
- m.specularMap;j.enableSpecular.value=true}if(m.lightMap){j.tAO.texture=m.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(m.color);j.uSpecularColor.value.setHex(m.specular);j.uAmbientColor.value.setHex(m.ambient);j.uShininess.value=m.shininess;if(m.opacity!==void 0)j.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:true,fog:true})}else m=new THREE[o](m);if(h.DbgName!==void 0)m.name=h.DbgName;d.materials[f]=
- m}}var h=a.faces,u=a.vertices,m=a.normals,k=a.colors,j=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&j++;for(f=0;f<j;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=u.length;o<p;){var n=new THREE.Vector3;n.x=u[o++]*e;n.y=u[o++]*e;n.z=u[o++]*e;d.vertices.push(n)}o=0;for(p=h.length;o<p;){var q=h[o++],r=q&2,f=q&4,w=q&8,v=q&16,u=q&32,H=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=h[o++];q.b=h[o++];q.c=h[o++];q.d=h[o++];var x=4}else{q=new THREE.Face3;q.a=h[o++];q.b=h[o++];q.c=h[o++];x=3}if(r){r=
- h[o++];q.materialIndex=r}var D=d.faces.length;if(f)for(f=0;f<j;f++){var E=a.uvs[f],r=h[o++],O=E[r*2],r=E[r*2+1];d.faceUvs[f][D]=new THREE.UV(O,r)}if(w)for(f=0;f<j;f++){for(var E=a.uvs[f],w=[],B=0;B<x;B++){r=h[o++];O=E[r*2];r=E[r*2+1];w[B]=new THREE.UV(O,r)}d.faceVertexUvs[f][D]=w}if(v){v=h[o++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];q.normal=r}if(u)for(f=0;f<x;f++){v=h[o++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];q.vertexNormals.push(r)}if(H){u=h[o++];q.color=new THREE.Color(k[u])}if(n)for(f=
- 0;f<x;f++){u=h[o++];q.vertexColors.push(new THREE.Color(k[u]))}d.faces.push(q)}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){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,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=[];m=d.morphTargets[f].vertices;k=a.morphTargets[f].vertices;r=0;for(j=k.length;r<j;r=r+3){n=new THREE.Vector3;n.x=k[r]*e;n.y=k[r+1]*e;n.z=k[r+2]*e;m.push(n)}}}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;m=0;for(j=k.length;m<j;m=m+3){o=new THREE.Color(16755200);o.setRGB(k[m],k[m+1],k[m+2]);e.push(o)}}}d.computeCentroids();
- d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};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(a,b){var c;for(m in b)if(P.objects[m]===void 0){r=b[m];if(r.geometry!==void 0){if(F=P.geometries[r.geometry]){c=false;W=P.materials[r.materials[0]];(c=W instanceof THREE.ShaderMaterial)&&F.computeTangents();x=r.position;D=r.rotation;E=r.quaternion;O=r.scale;w=r.matrix;E=0;r.materials.length==0&&(W=new THREE.MeshFaceMaterial);r.materials.length>1&&(W=new THREE.MeshFaceMaterial);c=
- new THREE.Mesh(F,W);c.name=m;if(w){c.matrixAutoUpdate=false;c.matrix.set(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15])}else{c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);P.objects[m]=c}}else{x=r.position;D=r.rotation;E=r.quaternion;O=r.scale;E=0;c=new THREE.Object3D;
- c.name=m;c.position.set(x[0],x[1],x[2]);if(E){c.quaternion.set(E[0],E[1],E[2],E[3]);c.useQuaternion=true}else c.rotation.set(D[0],D[1],D[2]);c.scale.set(O[0],O[1],O[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);P.objects[m]=c;P.empties[m]=c}if(r.properties!==void 0)for(var d in r.properties)c.properties[d]=r.properties[d];r.children!==void 0&&e(c,r.children)}}function f(a){return function(b){P.geometries[a]=b;e(P.scene,A.objects);G=G-1;l.onLoadComplete();i()}}function h(a){return function(b){P.geometries[a]=
- b}}function i(){l.callbackProgress({totalModels:I,totalTextures:aa,loadedModels:I-G,loadedTextures:aa-ea},P);l.onLoadProgress();G===0&&ea===0&&b(P)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),j,o,m,p,u,n,q,r,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P;A=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;ea=G=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(A.transform){a=A.transform.position;v=A.transform.rotation;B=A.transform.scale;
- a&&P.scene.position.set(a[0],a[1],a[2]);v&&P.scene.rotation.set(v[0],v[1],v[2]);B&&P.scene.scale.set(B[0],B[1],B[2]);if(a||v||B){P.scene.updateMatrix();P.scene.updateMatrixWorld()}}a=function(a){return function(){ea=ea-a;i();l.onLoadComplete()}};for(u in A.cameras){B=A.cameras[u];B.type==="perspective"?V=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type==="ortho"&&(V=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far));x=B.position;v=B.target;B=B.up;V.position.set(x[0],
- x[1],x[2]);V.target=new THREE.Vector3(v[0],v[1],v[2]);B&&V.up.set(B[0],B[1],B[2]);P.cameras[u]=V}for(p in A.lights){v=A.lights[p];u=v.color!==void 0?v.color:16777215;V=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){x=v.direction;H=new THREE.DirectionalLight(u,V);H.position.set(x[0],x[1],x[2]);H.position.normalize()}else if(v.type==="point"){x=v.position;H=v.distance;H=new THREE.PointLight(u,V,H);H.position.set(x[0],x[1],x[2])}else v.type==="ambient"&&(H=new THREE.AmbientLight(u));P.scene.add(H);
- P.lights[p]=H}for(n in A.fogs){p=A.fogs[n];p.type==="linear"?T=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(T=new THREE.FogExp2(0,p.density));B=p.color;T.color.setRGB(B[0],B[1],B[2]);P.fogs[n]=T}if(P.cameras&&A.defaults.camera)P.currentCamera=P.cameras[A.defaults.camera];if(P.fogs&&A.defaults.fog)P.scene.fog=P.fogs[A.defaults.fog];B=A.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(B[0],B[1],B[2]);P.bgColorAlpha=A.defaults.bgalpha;for(j in A.geometries){n=A.geometries[j];if(n.type==
- "bin_mesh"||n.type=="ascii_mesh"){G=G+1;l.onLoadStart()}}I=G;for(j in A.geometries){n=A.geometries[j];if(n.type==="cube"){F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);P.geometries[j]=F}else if(n.type==="plane"){F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);P.geometries[j]=F}else if(n.type==="sphere"){F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);P.geometries[j]=F}else if(n.type===
- "cylinder"){F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs);P.geometries[j]=F}else if(n.type==="torus"){F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);P.geometries[j]=F}else if(n.type==="icosahedron"){F=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);P.geometries[j]=F}else if(n.type==="bin_mesh")c.load(d(n.url,A.urlBaseType),f(j));else if(n.type==="ascii_mesh")M.load(d(n.url,A.urlBaseType),f(j));else if(n.type==="embedded_mesh"){n=A.embeds[n.id];
- n.metadata=A.metadata;n&&M.createModel(n,h(j),"")}}for(q in A.textures){j=A.textures[q];if(j.url instanceof Array){ea=ea+j.url.length;for(n=0;n<j.url.length;n++)l.onLoadStart()}else{ea=ea+1;l.onLoadStart()}}aa=ea;for(q in A.textures){j=A.textures[q];if(j.mapping!==void 0&&THREE[j.mapping]!==void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=j.url.length;T=[];for(c=0;c<n;c++)T[c]=d(j.url[c],A.urlBaseType);n=THREE.ImageUtils.loadTextureCube(T,j.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(j.url,
- A.urlBaseType),j.mapping,a(1));if(THREE[j.minFilter]!==void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!==void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[j.wrap[0]]!==void 0)n.wrapS=T[j.wrap[0]];if(T[j.wrap[1]]!==void 0)n.wrapT=
- T[j.wrap[1]]}}P.textures[q]=n}for(o in A.materials){w=A.materials[o];for(Q in w.parameters)if(Q==="envMap"||Q==="map"||Q==="lightMap")w.parameters[Q]=P.textures[w.parameters[Q]];else if(Q==="shading")w.parameters[Q]=w.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q==="blending")w.parameters[Q]=w.parameters[Q]in THREE?THREE[w.parameters[Q]]:THREE.NormalBlending;else if(Q==="combine")w.parameters[Q]=w.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(Q===
- "vertexColors")if(w.parameters[Q]=="face")w.parameters[Q]=THREE.FaceColors;else if(w.parameters[Q])w.parameters[Q]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=true;if(w.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);j=w.parameters.color;n=w.parameters.specular;T=w.parameters.ambient;c=w.parameters.shininess;a.tNormal.texture=P.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=
- w.parameters.normalMapFactor;if(w.parameters.map){a.tDiffuse.texture=w.parameters.map;a.enableDiffuse.value=true}if(w.parameters.lightMap){a.tAO.texture=w.parameters.lightMap;a.enableAO.value=true}if(w.parameters.specularMap){a.tSpecular.texture=P.textures[w.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(j);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(T);a.uShininess.value=c;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;W=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,
- vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else W=new THREE[w.type](w.parameters);P.materials[o]=W}e(P.scene,A.objects);l.callbackSync(P);i()};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(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
- THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
- THREE.Material.prototype.clone=function(a){a===void 0&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
- a.visible=this.visible;return a};THREE.MaterialCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=false;this.fog=true;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.LineBasicMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};
- THREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=false;this.setValues(a)};
- THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshBasicMaterial.prototype.clone=function(){var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=
- this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a};
- THREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=false;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap=
- "round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=false;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshLambertMaterial.prototype.clone=function(){var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;
- a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};
- THREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.wrapAround=this.perPixel=this.metal=false;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.envMap=this.specularMap=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=true;
- this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=false;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.perPixel=this.perPixel;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.specularMap=this.specularMap;a.envMap=
- this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};
- THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.wireframe=false;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};
- THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.shading=THREE.FlatShading;this.wireframe=false;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(){};
- THREE.MeshFaceMaterial.prototype.clone=function(){return new THREE.MeshFaceMaterial};THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=true;this.vertexColors=false;this.fog=true;this.setValues(a)};THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};
- THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.lights=this.fog=false;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=false;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
- THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=this.uniforms;a.attributes=this.attributes;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;
- return a};
- THREE.Texture=function(a,b,c,d,e,f,h,i,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=i!==void 0?i: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,i,l,k){THREE.Texture.call(this,null,f,h,i,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\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#ifdef USE_BUMPMAP\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#ifdef USE_BUMPMAP\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
- envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP )\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:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
- map_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_SPECULARMAP )\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx( vUv );\nvec2 dSTdy = dFdy( vUv );\nfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\nfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\nfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\nreturn vec2( dBx, dBy );\n}\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\nvec3 vSigmaX = dFdx( surf_pos );\nvec3 vSigmaY = dFdy( surf_pos );\nvec3 vN = surf_norm;\nvec3 R1 = cross( vSigmaY, vN );\nvec3 R2 = cross( vN, vSigmaX );\nfloat fDet = dot( vSigmaX, R1 );\nvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\nreturn normalize( abs( fDet ) * surf_norm - vGrad );\n}\n#endif",
- specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D( specularMap, vUv );\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\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 || defined( USE_BUMPMAP )\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 || defined( USE_BUMPMAP )\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\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\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#ifdef USE_BUMPMAP\nnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\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 = specularStrength * 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 = specularStrength * 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 = specularStrength * 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},specularMap:{type:"t",value:3,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}},bump:{bumpMap:{type:"t",value:4,texture:null},bumpScale:{type:"f",value:1}},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,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",
- THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_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,
- THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_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.bump,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,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_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.bumpMap||a.specularMap||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,l=a.__vertexArray,o=a.__colorArray,m=a.__sortArray,n=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){Wb.copy(Xb);Wb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d];Ya.copy(f);Wb.multiplyVector3(Ya);m[d]=[Ya.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[m[d][1]];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}for(d=0;d<k;d++){e=d*3;f=j[m[d][1]];o[e]=f.r;o[e+1]=f.g;o[e+2]=f.b}if(q){j=0;
- for(k=q.length;j<k;j++){i=q[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=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<f;d++){h=m[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=m[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=m[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=m[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(n)for(d=0;d<h;d++){f=i[d];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}if(p)for(d=0;d<k;d++){f=j[d];e=d*3;o[e]=f.r;o[e+1]=f.g;o[e+2]=f.b}if(q){j=0;for(k=q.length;j<k;j++){i=q[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(n||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,
- a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,o,b)}if(q){j=0;for(k=q.length;j<k;j++){i=q[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 i(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++){ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true;a[d].render(b,c,hc,yc);ta=Aa=null;U=S=ia=ba=ua=Pa=fa=-1;ab=true}}function k(a,b,c,d,g,f,e,h){var i,j,k,l;if(b){j=a.length-1;
- l=b=-1}else{j=0;b=a.length;l=1}for(var o=j;o!==b;o=o+l){i=a[o];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&I.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);I.setDepthTest(i.depthTest);I.setDepthWrite(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}I.setMaterialFaces(i);k instanceof THREE.BufferGeometry?I.renderBufferDirect(d,g,f,i,k,j):I.renderBuffer(d,g,f,i,k,j)}}}function j(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&&I.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);I.setDepthTest(h.depthTest);I.setDepthWrite(h.depthWrite);w(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}I.renderImmediateObject(c,d,g,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
- false}function u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&I.deallocateMaterial(d);I.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==Aa){g.useProgram(h);Aa=h;e=true}if(d.id!==U){U=d.id;e=
- true}if(e||a!==ta){g.uniformMatrix4fv(i.projectionMatrix,false,a._projectionMatrixArray);a!==ta&&(ta=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(ab){for(var k,l=0,o=0,m=0,n,p,q,r=zc,u=r.directional.colors,v=r.directional.positions,w=r.point.colors,A=r.point.positions,E=
- r.point.distances,D=r.spot.colors,H=r.spot.positions,M=r.spot.distances,P=r.spot.directions,Q=r.spot.angles,F=r.spot.exponents,V=0,W=0,T=0,G=q=0,c=G=0,e=b.length;c<e;c++){k=b[c];if(!k.onlyShadow&&k.visible){n=k.color;p=k.intensity;q=k.distance;if(k instanceof THREE.AmbientLight)if(I.gammaInput){l=l+n.r*n.r;o=o+n.g*n.g;m=m+n.b*n.b}else{l=l+n.r;o=o+n.g;m=m+n.b}else if(k instanceof THREE.DirectionalLight){q=V*3;if(I.gammaInput){u[q]=n.r*n.r*p*p;u[q+1]=n.g*n.g*p*p;u[q+2]=n.b*n.b*p*p}else{u[q]=n.r*p;u[q+
- 1]=n.g*p;u[q+2]=n.b*p}Ma.copy(k.matrixWorld.getPosition());Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();v[q]=Ma.x;v[q+1]=Ma.y;v[q+2]=Ma.z;V=V+1}else if(k instanceof THREE.PointLight){G=W*3;if(I.gammaInput){w[G]=n.r*n.r*p*p;w[G+1]=n.g*n.g*p*p;w[G+2]=n.b*n.b*p*p}else{w[G]=n.r*p;w[G+1]=n.g*p;w[G+2]=n.b*p}n=k.matrixWorld.getPosition();A[G]=n.x;A[G+1]=n.y;A[G+2]=n.z;E[W]=q;W=W+1}else if(k instanceof THREE.SpotLight){G=T*3;if(I.gammaInput){D[G]=n.r*n.r*p*p;D[G+1]=n.g*n.g*p*p;D[G+2]=n.b*
- n.b*p*p}else{D[G]=n.r*p;D[G+1]=n.g*p;D[G+2]=n.b*p}n=k.matrixWorld.getPosition();H[G]=n.x;H[G+1]=n.y;H[G+2]=n.z;M[T]=q;Ma.copy(n);Ma.subSelf(k.target.matrixWorld.getPosition());Ma.normalize();P[G]=Ma.x;P[G+1]=Ma.y;P[G+2]=Ma.z;Q[T]=Math.cos(k.angle);F[T]=k.exponent;T=T+1}}}c=V*3;for(e=u.length;c<e;c++)u[c]=0;c=W*3;for(e=w.length;c<e;c++)w[c]=0;c=T*3;for(e=D.length;c<e;c++)D[c]=0;r.directional.length=V;r.point.length=W;r.spot.length=T;r.ambient[0]=l;r.ambient[1]=o;r.ambient[2]=m;ab=false}c=zc;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;I.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;j.map.texture=d.map;j.lightMap.texture=d.lightMap;j.specularMap.texture=d.specularMap;if(d.bumpMap){j.bumpMap.texture=d.bumpMap;j.bumpScale.value=d.bumpScale}var S;if(d.map)S=d.map;else if(d.specularMap)S=d.specularMap;else if(d.bumpMap)S=d.bumpMap;if(S!==void 0){c=S.offset;S=S.repeat;j.offsetRepeat.value.set(c.x,
- c.y,S.x,S.y)}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=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(I.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(I.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){c=S=0;for(e=b.length;c<e;c++){k=b[c];if(k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&
- !k.shadowCascade)){j.shadowMap.texture[S]=k.shadowMap;j.shadowMapSize.value[S]=k.shadowMapSize;j.shadowMatrix.value[S]=k.shadowMatrix;j.shadowDarkness.value[S]=k.shadowDarkness;j.shadowBias.value[S]=k.shadowBias;S++}}}b=d.uniformsList;j=0;for(S=b.length;j<S;j++)if(k=h.uniforms[b[j][1]]){c=b[j][0];l=c.type;e=c.value;if(l==="i")g.uniform1i(k,e);else if(l==="f")g.uniform1f(k,e);else if(l==="v2")g.uniform2f(k,e.x,e.y);else if(l==="v3")g.uniform3f(k,e.x,e.y,e.z);else if(l==="v4")g.uniform4f(k,e.x,e.y,
- e.z,e.w);else if(l==="c")g.uniform3f(k,e.r,e.g,e.b);else if(l==="iv1")g.uniform1iv(k,e);else if(l==="iv")g.uniform3iv(k,e);else if(l==="fv1")g.uniform1fv(k,e);else if(l==="fv")g.uniform3fv(k,e);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*e.length);l=0;for(o=e.length;l<o;l++){m=l*2;c._array[m]=e[l].x;c._array[m+1]=e[l].y}g.uniform2fv(k,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*e.length);l=0;for(o=e.length;l<o;l++){m=l*3;c._array[m]=e[l].x;
- c._array[m+1]=e[l].y;c._array[m+2]=e[l].z}g.uniform3fv(k,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*e.length);l=0;for(o=e.length;l<o;l++){m=l*4;c._array[m]=e[l].x;c._array[m+1]=e[l].y;c._array[m+2]=e[l].z;c._array[m+3]=e[l].w}g.uniform4fv(k,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=new Float32Array(16);e.flattenToArray(c._array);g.uniformMatrix4fv(k,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*e.length);l=0;
- for(o=e.length;l<o;l++)e[l].flattenToArrayOffset(c._array,l*16);g.uniformMatrix4fv(k,false,c._array)}else if(l==="t"){g.uniform1i(k,e);if(k=c.texture)if(k.image instanceof Array&&k.image.length===6){c=k;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(k=0;k<6;k++){l=e;o=k;if(I.autoScaleCubemaps){m=
- c.image[k];u=Qc;if(!(m.width<=u&&m.height<=u)){v=Math.max(m.width,m.height);r=Math.floor(m.width*u/v);u=Math.floor(m.height*u/v);v=document.createElement("canvas");v.width=r;v.height=u;v.getContext("2d").drawImage(m,0,0,m.width,m.height,0,0,r,u);m=v}}else m=c.image[k];l[o]=m}k=e[0];l=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;o=O(c.format);m=O(c.type);x(g.TEXTURE_CUBE_MAP,c,l);for(k=0;k<6;k++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o,o,m,e[k]);c.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
- c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(k instanceof THREE.WebGLRenderTargetCube){c=k;g.activeTexture(g.TEXTURE0+e);g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture)}else I.setTexture(k,e)}else if(l==="tv"){if(c._array===void 0){c._array=[];l=0;for(o=c.texture.length;l<o;l++)c._array[l]=e+l}g.uniform1iv(k,c._array);l=0;for(o=c.texture.length;l<o;l++)(k=c.texture[l])&&I.setTexture(k,c._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(ic&&f.useVertexTexture){if(i.boneTexture!==null){g.uniform1i(i.boneTexture,12);I.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 r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(a,b,c){if(Xa!==a){a?
- g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);Xa=a}if(a&&(Va!==b||Vb!==c)){g.polygonOffset(b,c);Va=b;Vb=c}}function v(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function H(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(v(b));return null}return c}
- function x(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,O(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,O(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,O(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,O(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(rb&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){g.texParameterf(a,
- rb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ac));b.__oldAnisotropy=b.anisotropy}}function D(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 O(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||{},B=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Q=a.precision!==void 0?
- a.precision:"highp",F=a.alpha!==void 0?a.alpha:true,W=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,V=a.antialias!==void 0?a.antialias:false,T=a.stencil!==void 0?a.stencil:true,A=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,M=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),G=a.clearAlpha!==void 0?a.clearAlpha:0,ea=a.maxLights!==void 0?a.maxLights:4;this.domElement=B;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 I=this,aa=[],P=0,Aa=null,sa=null,U=-1,S=null,ta=null,wa=0,ba=-1,ia=-1,fa=-1,Ja=-1,Ga=-1,la=-1,Pa=-1,ua=-1,Xa=null,Va=null,Vb=null,yb=null,Mb=0,Nb=0,Ob=0,jc=0,hc=0,yc=0,kc=new THREE.Frustum,Xb=new THREE.Matrix4,Wb=new THREE.Matrix4,Ya=new THREE.Vector4,Ma=new THREE.Vector3,ab=true,zc={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,rb;try{if(!(g=
- B.getContext("experimental-webgl",{alpha:F,premultipliedAlpha:W,antialias:V,stencil:T,preserveDrawingBuffer:A})))throw"Error creating WebGL context.";}catch(Rc){console.error(Rc)}a=g.getExtension("OES_texture_float");F=g.getExtension("OES_standard_derivatives");rb=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.");F||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
- rb||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(M.r,M.g,M.b,G);this.context=g;F=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Qc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),
- Ac=rb?g.getParameter(rb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Pb=F>0,ic=Pb&&a;this.getContext=function(){return g};this.supportsVertexTextures=function(){return Pb};this.getMaxAnisotropy=function(){return Ac};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){Mb=a!==void 0?a:0;Nb=b!==void 0?b:0;Ob=c!==void 0?c:B.width;jc=d!==void 0?d:B.height;g.viewport(Mb,Nb,Ob,jc)};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){M.setHex(a);G=b;g.clearColor(M.r,M.g,M.b,G)};this.setClearColor=function(a,b){M.copy(a);G=b;g.clearColor(M.r,M.g,M.b,G)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return G};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)}I.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);I.info.memory.geometries--}else if(a instanceof
- THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);I.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);I.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;g.deleteTexture(a.__webglTexture);I.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=aa.length;a<c;a++){d=aa[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=aa.length;a<c;a++){d=aa[a];d.program!==
- b&&e.push(d)}aa=e;g.deleteProgram(b);I.info.memory.programs--}}};this.updateShadowMap=function(a,b){Aa=null;U=S=ua=Pa=fa=-1;ab=true;ia=ba=-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,o,m,n,p=a.count*3;for(n=0;n<p;n=n+9){m=a.normalArray;d=m[n];e=m[n+1];f=m[n+2];h=m[n+3];j=m[n+4];l=m[n+5];i=m[n+6];k=m[n+
- 7];o=m[n+8];d=(d+h+i)/3;e=(e+j+k)/3;f=(f+l+o)/3;m[n]=d;m[n+1]=e;m[n+2]=f;m[n+3]=d;m[n+4]=e;m[n+5]=f;m[n+6]=d;m[n+7]=e;m[n+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=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==S){S=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);I.info.render.calls++;I.info.render.vertices=I.info.render.vertices+f[d].count;I.info.render.faces=I.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,j,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==S){S=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;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<j.length;){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[k]]);g.vertexAttribPointer(c["morphTarget"+
- k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[k]]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[j[k]];k++}}else{j=[];h=f.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){k=h[l];k>0&&j.push([l,k])}if(j.length>d.numSupportedMorphTargets){j.sort(i);j.length=d.numSupportedMorphTargets}else j.length>d.numSupportedMorphNormals?j.sort(i):j.length===0&&j.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(j[k]){l=
- j[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(j=e.__webglCustomAttributesList.length;h<j;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!==yb){g.lineWidth(d);yb=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)}I.info.render.calls++;
- I.info.render.vertices=I.info.render.vertices+e.__webglFaceCount;I.info.render.faces=I.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!==yb){g.lineWidth(d);yb=d}g.drawArrays(f,0,e.__webglLineCount);I.info.render.calls++}else if(f instanceof THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);I.info.render.calls++;I.info.render.points=I.info.render.points+e.__webglParticleCount}else if(f instanceof
- THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);I.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,i,m,o=a.__lights,n=a.fog;U=-1;ab=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.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);Xb.multiply(b.projectionMatrix,b.matrixWorldInverse);kc.setFromMatrix(Xb);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.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];i=f.object;f.render=false;if(i.visible&&(!(i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem)||!i.frustumCulled||kc.contains(i))){r(i,b);var p=f,q=p.object,u=p.buffer,v=void 0,v=v=void 0,v=q.material;if(v instanceof THREE.MeshFaceMaterial){v=u.materialIndex;if(v>=0){v=q.geometry.materials[v];if(v.transparent){p.transparent=v;p.opaque=null}else{p.opaque=v;p.transparent=null}}}else if(v)if(v.transparent){p.transparent=
- v;p.opaque=null}else{p.opaque=v;p.transparent=null}f.render=true;if(this.sortObjects)if(i.renderDepth)f.z=i.renderDepth;else{Ya.copy(i.matrixWorld.getPosition());Xb.multiplyVector3(Ya);f.z=Ya.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];i=f.object;if(i.visible){r(i,b);i=f.object.material;if(i.transparent){f.transparent=i;f.opaque=null}else{f.opaque=i;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,
- d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);w(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,o,n,true,d);j(a.__webglObjectsImmediate,"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,o,n,false);j(a.__webglObjectsImmediate,"opaque",b,o,n,false);k(a.__webglObjects,false,"transparent",b,o,n,true);j(a.__webglObjectsImmediate,"transparent",b,o,n,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=q(a,b,c,d,e);
- S=-1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,g,kc):e.render(function(a){I.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 q=k,r=void 0,v=void 0,w=void 0,x=void 0,B=void 0,A=void 0,D=void 0,E={},H=q.morphTargets.length,M=q.morphNormals.length;q.geometryGroups={};r=0;for(v=q.faces.length;r<v;r++){w=q.faces[r];x=w.materialIndex;A=x!==void 0?x:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M});
- B=w instanceof THREE.Face3?3:4;if(q.geometryGroups[D].vertices+B>65535){E[A].counter=E[A].counter+1;D=E[A].hash+"_"+E[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:H,numMorphNormals:M})}w instanceof THREE.Face3?q.geometryGroups[D].faces3.push(r):q.geometryGroups[D].faces4.push(r);q.geometryGroups[D].vertices=q.geometryGroups[D].vertices+B}q.geometryGroupsList=[];var O=void 0;for(O in q.geometryGroups){q.geometryGroups[O].id=
- wa++;q.geometryGroupsList.push(q.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 P=void 0,Q=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];P=0;for(Q=G.numMorphTargets;P<Q;P++)G.__webglMorphTargetsBuffers.push(g.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];P=0;for(Q=G.numMorphNormals;P<Q;P++)G.__webglMorphNormalsBuffers.push(g.createBuffer())}I.info.memory.geometries++;var F=l,S=h,T=S.geometry,V=F.faces3,W=F.faces4,U=V.length*3+W.length*4,ba=V.length*
- 1+W.length*2,ea=V.length*3+W.length*4,aa=c(S,F),la=e(aa),sa=d(aa),ta=aa.vertexColors?aa.vertexColors:false;F.__vertexArray=new Float32Array(U*3);if(sa)F.__normalArray=new Float32Array(U*3);if(T.hasTangents)F.__tangentArray=new Float32Array(U*4);if(ta)F.__colorArray=new Float32Array(U*3);if(la){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)F.__uvArray=new Float32Array(U*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(U*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){F.__skinVertexAArray=
- new Float32Array(U*4);F.__skinVertexBArray=new Float32Array(U*4);F.__skinIndexArray=new Float32Array(U*4);F.__skinWeightArray=new Float32Array(U*4)}F.__faceArray=new Uint16Array(ba*3);F.__lineArray=new Uint16Array(ea*2);var ia=void 0,Va=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];ia=0;for(Va=F.numMorphTargets;ia<Va;ia++)F.__morphTargetsArrays.push(new Float32Array(U*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];ia=0;for(Va=F.numMorphNormals;ia<Va;ia++)F.__morphNormalsArrays.push(new Float32Array(U*
- 3))}F.__webglFaceCount=ba*3;F.__webglLineCount=ea*2;if(aa.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];var ua=void 0;for(ua in aa.attributes){var Aa=aa.attributes[ua],fa={},Ja;for(Ja in Aa)fa[Ja]=Aa[Ja];if(!fa.__webglInitialized||fa.createUniqueBuffers){fa.__webglInitialized=true;var Ga=1;fa.type==="v2"?Ga=2:fa.type==="v3"?Ga=3:fa.type==="v4"?Ga=4:fa.type==="c"&&(Ga=3);fa.size=Ga;fa.array=new Float32Array(U*Ga);fa.buffer=g.createBuffer();fa.buffer.belongsToAttribute=
- ua;Aa.needsUpdate=true;fa.__original=Aa}F.__webglCustomAttributesList.push(fa)}}F.__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 Pa=k,yb=void 0,Ma=void 0,Vb=void 0;for(yb in Pa.attributes){Vb=yb==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;Ma=Pa.attributes[yb];Ma.buffer=g.createBuffer();g.bindBuffer(Vb,
- Ma.buffer);g.bufferData(Vb,Ma.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var Xa=k;Xa.__webglVertexBuffer=g.createBuffer();Xa.__webglColorBuffer=g.createBuffer();I.info.memory.geometries++;var Ya=k,ab=Ya.vertices.length;Ya.__vertexArray=new Float32Array(ab*3);Ya.__colorArray=new Float32Array(ab*3);Ya.__webglVertexCount=ab;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var rb=
- k;rb.__webglVertexBuffer=g.createBuffer();rb.__webglColorBuffer=g.createBuffer();I.info.memory.geometries++;var lc=k,Xb=h,Mb=lc.vertices.length;lc.__vertexArray=new Float32Array(Mb*3);lc.__colorArray=new Float32Array(Mb*3);lc.__webglLineCount=Mb;b(lc,Xb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Wb=k;Wb.__webglVertexBuffer=g.createBuffer();Wb.__webglColorBuffer=g.createBuffer();I.info.geometries++;var Yb=
- k,ic=h,Nb=Yb.vertices.length;Yb.__vertexArray=new Float32Array(Nb*3);Yb.__colorArray=new Float32Array(Nb*3);Yb.__sortArray=[];Yb.__webglParticleCount=Nb;b(Yb,ic);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)o(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];o(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
- h.geometry;o(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 Sa=a.__objectsRemoved[0],Bc=a;Sa instanceof THREE.Mesh||Sa instanceof THREE.ParticleSystem||Sa instanceof THREE.Ribbon||Sa instanceof
- THREE.Line?u(Bc.__webglObjects,Sa):Sa instanceof THREE.Sprite?n(Bc.__webglSprites,Sa):Sa instanceof THREE.LensFlare?n(Bc.__webglFlares,Sa):(Sa instanceof THREE.ImmediateRenderObject||Sa.immediateRenderCallback)&&u(Bc.__webglObjectsImmediate,Sa);Sa.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Ob=0,jc=a.__webglObjects.length;Ob<jc;Ob++){var Za=a.__webglObjects[Ob].object,X=Za.geometry,mc=void 0,Zb=void 0,Na=void 0;if(Za instanceof THREE.Mesh)if(X instanceof THREE.BufferGeometry){if(X.verticesNeedUpdate||
- X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate){var sb=X,$b=g.DYNAMIC_DRAW,kc=!X.dynamic,ac=sb.attributes,Pb=ac.index,Sc=ac.position,Tc=ac.normal,Uc=ac.uv,Vc=ac.color,Wc=ac.tangent;if(sb.elementsNeedUpdate&&Pb!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pb.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pb.array,$b)}if(sb.verticesNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,$b)}if(sb.normalsNeedUpdate&&
- Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,$b)}if(sb.uvsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,$b)}if(sb.colorsNeedUpdate&&Vc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Vc.buffer);g.bufferData(g.ARRAY_BUFFER,Vc.array,$b)}if(sb.tangentsNeedUpdate&&Wc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Wc.buffer);g.bufferData(g.ARRAY_BUFFER,Wc.array,$b)}if(kc){var hc=void 0;for(hc in sb.attributes)delete sb.attributes[hc].array}}X.verticesNeedUpdate=
- false;X.elementsNeedUpdate=false;X.uvsNeedUpdate=false;X.normalsNeedUpdate=false;X.colorsNeedUpdate=false;X.tangentsNeedUpdate=false}else{for(var Xc=0,yc=X.geometryGroupsList.length;Xc<yc;Xc++){mc=X.geometryGroupsList[Xc];Na=c(Za,mc);Zb=Na.attributes&&m(Na);if(X.verticesNeedUpdate||X.morphTargetsNeedUpdate||X.elementsNeedUpdate||X.uvsNeedUpdate||X.normalsNeedUpdate||X.colorsNeedUpdate||X.tangentsNeedUpdate||Zb){var Z=mc,zc=Za,Qa=g.DYNAMIC_DRAW,Ac=!X.dynamic,Qb=Na;if(Z.__inittedArrays){var fd=d(Qb),
- Yc=Qb.vertexColors?Qb.vertexColors:false,gd=e(Qb),Cc=fd===THREE.SmoothShading,y=void 0,N=void 0,Wa=void 0,C=void 0,bc=void 0,zb=void 0,$a=void 0,Dc=void 0,tb=void 0,cc=void 0,dc=void 0,J=void 0,K=void 0,L=void 0,$=void 0,bb=void 0,cb=void 0,db=void 0,nc=void 0,eb=void 0,fb=void 0,gb=void 0,oc=void 0,hb=void 0,ib=void 0,jb=void 0,pc=void 0,kb=void 0,lb=void 0,mb=void 0,qc=void 0,nb=void 0,ob=void 0,pb=void 0,rc=void 0,Ab=void 0,Bb=void 0,Cb=void 0,Ec=void 0,Db=void 0,Eb=void 0,Fb=void 0,Fc=void 0,
- ga=void 0,hd=void 0,Gb=void 0,ec=void 0,fc=void 0,Da=void 0,id=void 0,Ba=void 0,Ca=void 0,Hb=void 0,ub=void 0,va=0,za=0,vb=0,wb=0,Ta=0,Ia=0,ja=0,Ka=0,xa=0,z=0,Y=0,t=0,ha=void 0,Ea=Z.__vertexArray,sc=Z.__uvArray,tc=Z.__uv2Array,Ua=Z.__normalArray,ma=Z.__tangentArray,Fa=Z.__colorArray,na=Z.__skinVertexAArray,oa=Z.__skinVertexBArray,pa=Z.__skinIndexArray,qa=Z.__skinWeightArray,Zc=Z.__morphTargetsArrays,$c=Z.__morphNormalsArrays,ad=Z.__webglCustomAttributesList,s=void 0,qb=Z.__faceArray,Ra=Z.__lineArray,
- La=zc.geometry,Qc=La.elementsNeedUpdate,jd=La.uvsNeedUpdate,Rc=La.normalsNeedUpdate,qd=La.tangentsNeedUpdate,rd=La.colorsNeedUpdate,sd=La.morphTargetsNeedUpdate,Rb=La.vertices,ca=Z.faces3,da=Z.faces4,ya=La.faces,bd=La.faceVertexUvs[0],cd=La.faceVertexUvs[1],Sb=La.skinVerticesA,Tb=La.skinVerticesB,Ub=La.skinIndices,Ib=La.skinWeights,Jb=La.morphTargets,Gc=La.morphNormals;if(La.verticesNeedUpdate){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=Rb[C.a];K=Rb[C.b];L=Rb[C.c];Ea[za]=J.x;Ea[za+1]=J.y;Ea[za+2]=
- J.z;Ea[za+3]=K.x;Ea[za+4]=K.y;Ea[za+5]=K.z;Ea[za+6]=L.x;Ea[za+7]=L.y;Ea[za+8]=L.z;za=za+9}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];J=Rb[C.a];K=Rb[C.b];L=Rb[C.c];$=Rb[C.d];Ea[za]=J.x;Ea[za+1]=J.y;Ea[za+2]=J.z;Ea[za+3]=K.x;Ea[za+4]=K.y;Ea[za+5]=K.z;Ea[za+6]=L.x;Ea[za+7]=L.y;Ea[za+8]=L.z;Ea[za+9]=$.x;Ea[za+10]=$.y;Ea[za+11]=$.z;za=za+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Qa)}if(sd){Da=0;for(id=Jb.length;Da<id;Da++){y=Y=0;for(N=ca.length;y<N;y++){Hb=ca[y];
- C=ya[Hb];J=Jb[Da].vertices[C.a];K=Jb[Da].vertices[C.b];L=Jb[Da].vertices[C.c];Ba=Zc[Da];Ba[Y]=J.x;Ba[Y+1]=J.y;Ba[Y+2]=J.z;Ba[Y+3]=K.x;Ba[Y+4]=K.y;Ba[Y+5]=K.z;Ba[Y+6]=L.x;Ba[Y+7]=L.y;Ba[Y+8]=L.z;if(Qb.morphNormals){if(Cc){ub=Gc[Da].vertexNormals[Hb];eb=ub.a;fb=ub.b;gb=ub.c}else gb=fb=eb=Gc[Da].faceNormals[Hb];Ca=$c[Da];Ca[Y]=eb.x;Ca[Y+1]=eb.y;Ca[Y+2]=eb.z;Ca[Y+3]=fb.x;Ca[Y+4]=fb.y;Ca[Y+5]=fb.z;Ca[Y+6]=gb.x;Ca[Y+7]=gb.y;Ca[Y+8]=gb.z}Y=Y+9}y=0;for(N=da.length;y<N;y++){Hb=da[y];C=ya[Hb];J=Jb[Da].vertices[C.a];
- K=Jb[Da].vertices[C.b];L=Jb[Da].vertices[C.c];$=Jb[Da].vertices[C.d];Ba=Zc[Da];Ba[Y]=J.x;Ba[Y+1]=J.y;Ba[Y+2]=J.z;Ba[Y+3]=K.x;Ba[Y+4]=K.y;Ba[Y+5]=K.z;Ba[Y+6]=L.x;Ba[Y+7]=L.y;Ba[Y+8]=L.z;Ba[Y+9]=$.x;Ba[Y+10]=$.y;Ba[Y+11]=$.z;if(Qb.morphNormals){if(Cc){ub=Gc[Da].vertexNormals[Hb];eb=ub.a;fb=ub.b;gb=ub.c;oc=ub.d}else oc=gb=fb=eb=Gc[Da].faceNormals[Hb];Ca=$c[Da];Ca[Y]=eb.x;Ca[Y+1]=eb.y;Ca[Y+2]=eb.z;Ca[Y+3]=fb.x;Ca[Y+4]=fb.y;Ca[Y+5]=fb.z;Ca[Y+6]=gb.x;Ca[Y+7]=gb.y;Ca[Y+8]=gb.z;Ca[Y+9]=oc.x;Ca[Y+10]=oc.y;
- Ca[Y+11]=oc.z}Y=Y+12}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphTargetsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,Zc[Da],Qa);if(Qb.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglMorphNormalsBuffers[Da]);g.bufferData(g.ARRAY_BUFFER,$c[Da],Qa)}}}if(Ib.length){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];kb=Ib[C.a];lb=Ib[C.b];mb=Ib[C.c];qa[z]=kb.x;qa[z+1]=kb.y;qa[z+2]=kb.z;qa[z+3]=kb.w;qa[z+4]=lb.x;qa[z+5]=lb.y;qa[z+6]=lb.z;qa[z+7]=lb.w;qa[z+8]=mb.x;qa[z+9]=mb.y;qa[z+10]=mb.z;qa[z+11]=mb.w;nb=Ub[C.a];ob=
- Ub[C.b];pb=Ub[C.c];pa[z]=nb.x;pa[z+1]=nb.y;pa[z+2]=nb.z;pa[z+3]=nb.w;pa[z+4]=ob.x;pa[z+5]=ob.y;pa[z+6]=ob.z;pa[z+7]=ob.w;pa[z+8]=pb.x;pa[z+9]=pb.y;pa[z+10]=pb.z;pa[z+11]=pb.w;Ab=Sb[C.a];Bb=Sb[C.b];Cb=Sb[C.c];na[z]=Ab.x;na[z+1]=Ab.y;na[z+2]=Ab.z;na[z+3]=1;na[z+4]=Bb.x;na[z+5]=Bb.y;na[z+6]=Bb.z;na[z+7]=1;na[z+8]=Cb.x;na[z+9]=Cb.y;na[z+10]=Cb.z;na[z+11]=1;Db=Tb[C.a];Eb=Tb[C.b];Fb=Tb[C.c];oa[z]=Db.x;oa[z+1]=Db.y;oa[z+2]=Db.z;oa[z+3]=1;oa[z+4]=Eb.x;oa[z+5]=Eb.y;oa[z+6]=Eb.z;oa[z+7]=1;oa[z+8]=Fb.x;oa[z+
- 9]=Fb.y;oa[z+10]=Fb.z;oa[z+11]=1;z=z+12}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];kb=Ib[C.a];lb=Ib[C.b];mb=Ib[C.c];qc=Ib[C.d];qa[z]=kb.x;qa[z+1]=kb.y;qa[z+2]=kb.z;qa[z+3]=kb.w;qa[z+4]=lb.x;qa[z+5]=lb.y;qa[z+6]=lb.z;qa[z+7]=lb.w;qa[z+8]=mb.x;qa[z+9]=mb.y;qa[z+10]=mb.z;qa[z+11]=mb.w;qa[z+12]=qc.x;qa[z+13]=qc.y;qa[z+14]=qc.z;qa[z+15]=qc.w;nb=Ub[C.a];ob=Ub[C.b];pb=Ub[C.c];rc=Ub[C.d];pa[z]=nb.x;pa[z+1]=nb.y;pa[z+2]=nb.z;pa[z+3]=nb.w;pa[z+4]=ob.x;pa[z+5]=ob.y;pa[z+6]=ob.z;pa[z+7]=ob.w;pa[z+8]=pb.x;pa[z+
- 9]=pb.y;pa[z+10]=pb.z;pa[z+11]=pb.w;pa[z+12]=rc.x;pa[z+13]=rc.y;pa[z+14]=rc.z;pa[z+15]=rc.w;Ab=Sb[C.a];Bb=Sb[C.b];Cb=Sb[C.c];Ec=Sb[C.d];na[z]=Ab.x;na[z+1]=Ab.y;na[z+2]=Ab.z;na[z+3]=1;na[z+4]=Bb.x;na[z+5]=Bb.y;na[z+6]=Bb.z;na[z+7]=1;na[z+8]=Cb.x;na[z+9]=Cb.y;na[z+10]=Cb.z;na[z+11]=1;na[z+12]=Ec.x;na[z+13]=Ec.y;na[z+14]=Ec.z;na[z+15]=1;Db=Tb[C.a];Eb=Tb[C.b];Fb=Tb[C.c];Fc=Tb[C.d];oa[z]=Db.x;oa[z+1]=Db.y;oa[z+2]=Db.z;oa[z+3]=1;oa[z+4]=Eb.x;oa[z+5]=Eb.y;oa[z+6]=Eb.z;oa[z+7]=1;oa[z+8]=Fb.x;oa[z+9]=Fb.y;
- oa[z+10]=Fb.z;oa[z+11]=1;oa[z+12]=Fc.x;oa[z+13]=Fc.y;oa[z+14]=Fc.z;oa[z+15]=1;z=z+16}if(z>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,na,Qa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,oa,Qa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,pa,Qa);g.bindBuffer(g.ARRAY_BUFFER,Z.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,qa,Qa)}}if(rd&&Yc){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];
- $a=C.vertexColors;Dc=C.color;if($a.length===3&&Yc===THREE.VertexColors){hb=$a[0];ib=$a[1];jb=$a[2]}else jb=ib=hb=Dc;Fa[xa]=hb.r;Fa[xa+1]=hb.g;Fa[xa+2]=hb.b;Fa[xa+3]=ib.r;Fa[xa+4]=ib.g;Fa[xa+5]=ib.b;Fa[xa+6]=jb.r;Fa[xa+7]=jb.g;Fa[xa+8]=jb.b;xa=xa+9}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];$a=C.vertexColors;Dc=C.color;if($a.length===4&&Yc===THREE.VertexColors){hb=$a[0];ib=$a[1];jb=$a[2];pc=$a[3]}else pc=jb=ib=hb=Dc;Fa[xa]=hb.r;Fa[xa+1]=hb.g;Fa[xa+2]=hb.b;Fa[xa+3]=ib.r;Fa[xa+4]=ib.g;Fa[xa+5]=ib.b;Fa[xa+
- 6]=jb.r;Fa[xa+7]=jb.g;Fa[xa+8]=jb.b;Fa[xa+9]=pc.r;Fa[xa+10]=pc.g;Fa[xa+11]=pc.b;xa=xa+12}if(xa>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Fa,Qa)}}if(qd&&La.hasTangents){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];tb=C.vertexTangents;bb=tb[0];cb=tb[1];db=tb[2];ma[ja]=bb.x;ma[ja+1]=bb.y;ma[ja+2]=bb.z;ma[ja+3]=bb.w;ma[ja+4]=cb.x;ma[ja+5]=cb.y;ma[ja+6]=cb.z;ma[ja+7]=cb.w;ma[ja+8]=db.x;ma[ja+9]=db.y;ma[ja+10]=db.z;ma[ja+11]=db.w;ja=ja+12}y=0;for(N=da.length;y<N;y++){C=
- ya[da[y]];tb=C.vertexTangents;bb=tb[0];cb=tb[1];db=tb[2];nc=tb[3];ma[ja]=bb.x;ma[ja+1]=bb.y;ma[ja+2]=bb.z;ma[ja+3]=bb.w;ma[ja+4]=cb.x;ma[ja+5]=cb.y;ma[ja+6]=cb.z;ma[ja+7]=cb.w;ma[ja+8]=db.x;ma[ja+9]=db.y;ma[ja+10]=db.z;ma[ja+11]=db.w;ma[ja+12]=nc.x;ma[ja+13]=nc.y;ma[ja+14]=nc.z;ma[ja+15]=nc.w;ja=ja+16}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ma,Qa)}if(Rc&&fd){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];bc=C.vertexNormals;zb=C.normal;if(bc.length===3&&Cc)for(ga=
- 0;ga<3;ga++){Gb=bc[ga];Ua[Ia]=Gb.x;Ua[Ia+1]=Gb.y;Ua[Ia+2]=Gb.z;Ia=Ia+3}else for(ga=0;ga<3;ga++){Ua[Ia]=zb.x;Ua[Ia+1]=zb.y;Ua[Ia+2]=zb.z;Ia=Ia+3}}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];bc=C.vertexNormals;zb=C.normal;if(bc.length===4&&Cc)for(ga=0;ga<4;ga++){Gb=bc[ga];Ua[Ia]=Gb.x;Ua[Ia+1]=Gb.y;Ua[Ia+2]=Gb.z;Ia=Ia+3}else for(ga=0;ga<4;ga++){Ua[Ia]=zb.x;Ua[Ia+1]=zb.y;Ua[Ia+2]=zb.z;Ia=Ia+3}}g.bindBuffer(g.ARRAY_BUFFER,Z.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ua,Qa)}if(jd&&bd&&gd){y=0;for(N=
- ca.length;y<N;y++){Wa=ca[y];C=ya[Wa];cc=bd[Wa];if(cc!==void 0)for(ga=0;ga<3;ga++){ec=cc[ga];sc[vb]=ec.u;sc[vb+1]=ec.v;vb=vb+2}}y=0;for(N=da.length;y<N;y++){Wa=da[y];C=ya[Wa];cc=bd[Wa];if(cc!==void 0)for(ga=0;ga<4;ga++){ec=cc[ga];sc[vb]=ec.u;sc[vb+1]=ec.v;vb=vb+2}}if(vb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,sc,Qa)}}if(jd&&cd&&gd){y=0;for(N=ca.length;y<N;y++){Wa=ca[y];C=ya[Wa];dc=cd[Wa];if(dc!==void 0)for(ga=0;ga<3;ga++){fc=dc[ga];tc[wb]=fc.u;tc[wb+1]=fc.v;wb=
- wb+2}}y=0;for(N=da.length;y<N;y++){Wa=da[y];C=ya[Wa];dc=cd[Wa];if(dc!==void 0)for(ga=0;ga<4;ga++){fc=dc[ga];tc[wb]=fc.u;tc[wb+1]=fc.v;wb=wb+2}}if(wb>0){g.bindBuffer(g.ARRAY_BUFFER,Z.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,tc,Qa)}}if(Qc){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];qb[Ta]=va;qb[Ta+1]=va+1;qb[Ta+2]=va+2;Ta=Ta+3;Ra[Ka]=va;Ra[Ka+1]=va+1;Ra[Ka+2]=va;Ra[Ka+3]=va+2;Ra[Ka+4]=va+1;Ra[Ka+5]=va+2;Ka=Ka+6;va=va+3}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];qb[Ta]=va;qb[Ta+1]=va+1;qb[Ta+2]=va+
- 3;qb[Ta+3]=va+1;qb[Ta+4]=va+2;qb[Ta+5]=va+3;Ta=Ta+6;Ra[Ka]=va;Ra[Ka+1]=va+1;Ra[Ka+2]=va;Ra[Ka+3]=va+3;Ra[Ka+4]=va+1;Ra[Ka+5]=va+2;Ra[Ka+6]=va+2;Ra[Ka+7]=va+3;Ka=Ka+8;va=va+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,qb,Qa);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Ra,Qa)}if(ad){ga=0;for(hd=ad.length;ga<hd;ga++){s=ad[ga];if(s.__original.needsUpdate){t=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo===
- "vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];s.array[t]=s.value[C.a];s.array[t+1]=s.value[C.b];s.array[t+2]=s.value[C.c];t=t+3}y=0;for(N=da.length;y<N;y++){C=ya[da[y]];s.array[t]=s.value[C.a];s.array[t+1]=s.value[C.b];s.array[t+2]=s.value[C.c];s.array[t+3]=s.value[C.d];t=t+4}}else{if(s.boundTo==="faces"){y=0;for(N=ca.length;y<N;y++){ha=s.value[ca[y]];s.array[t]=ha;s.array[t+1]=ha;s.array[t+2]=ha;t=t+3}y=0;for(N=da.length;y<N;y++){ha=s.value[da[y]];s.array[t]=ha;s.array[t+1]=ha;s.array[t+2]=
- ha;s.array[t+3]=ha;t=t+4}}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){y=0;for(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.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(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.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(N=ca.length;y<N;y++){L=K=J=ha=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;t=t+6}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[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(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.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(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.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(N=ca.length;y<N;y++){L=K=J=ha=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]];t=t+9}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[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(N=ca.length;y<N;y++){ha=s.value[ca[y]];J=ha[0];K=ha[1];L=ha[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(N=da.length;y<N;y++){ha=s.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[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(N=ca.length;y<N;y++){C=ya[ca[y]];J=s.value[C.a];K=
- s.value[C.b];L=s.value[C.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(N=da.length;y<N;y++){C=ya[da[y]];J=s.value[C.a];K=s.value[C.b];L=s.value[C.c];$=s.value[C.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(N=ca.length;y<N;y++){L=K=J=ha=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;t=t+12}y=0;for(N=da.length;y<N;y++){$=L=K=J=ha=s.value[da[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(N=ca.length;y<N;y++){ha=s.value[ca[y]];J=ha[0];K=ha[1];L=ha[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(N=da.length;y<N;y++){ha=s.value[da[y]];J=ha[0];K=ha[1];L=ha[2];$=ha[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,
- Qa)}}}if(Ac){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&&p(Na)}else if(Za instanceof THREE.Ribbon){if(X.verticesNeedUpdate||X.colorsNeedUpdate){var Kb=X,kd=g.DYNAMIC_DRAW,uc=void 0,vc=void 0,Hc=void 0,Lb=void 0,Ic=void 0,ld=Kb.vertices,md=Kb.colors,td=ld.length,ud=md.length,Jc=Kb.__vertexArray,Kc=Kb.__colorArray,vd=Kb.colorsNeedUpdate;if(Kb.verticesNeedUpdate){for(uc=0;uc<td;uc++){Hc=ld[uc];Lb=uc*3;Jc[Lb]=Hc.x;Jc[Lb+1]=Hc.y;Jc[Lb+2]=Hc.z}g.bindBuffer(g.ARRAY_BUFFER,Kb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Jc,kd)}if(vd){for(vc=
- 0;vc<ud;vc++){Ic=md[vc];Lb=vc*3;Kc[Lb]=Ic.r;Kc[Lb+1]=Ic.g;Kc[Lb+2]=Ic.b}g.bindBuffer(g.ARRAY_BUFFER,Kb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,kd)}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false}else if(Za instanceof THREE.Line){Na=c(Za,mc);Zb=Na.attributes&&m(Na);if(X.verticesNeedUpdate||X.colorsNeedUpdate||Zb){var xb=X,dd=g.DYNAMIC_DRAW,wc=void 0,xc=void 0,Lc=void 0,ra=void 0,Mc=void 0,nd=xb.vertices,od=xb.colors,wd=nd.length,xd=od.length,Nc=xb.__vertexArray,Oc=xb.__colorArray,yd=
- xb.colorsNeedUpdate,ed=xb.__webglCustomAttributesList,Pc=void 0,pd=void 0,Ha=void 0,gc=void 0,Oa=void 0,ka=void 0;if(xb.verticesNeedUpdate){for(wc=0;wc<wd;wc++){Lc=nd[wc];ra=wc*3;Nc[ra]=Lc.x;Nc[ra+1]=Lc.y;Nc[ra+2]=Lc.z}g.bindBuffer(g.ARRAY_BUFFER,xb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Nc,dd)}if(yd){for(xc=0;xc<xd;xc++){Mc=od[xc];ra=xc*3;Oc[ra]=Mc.r;Oc[ra+1]=Mc.g;Oc[ra+2]=Mc.b}g.bindBuffer(g.ARRAY_BUFFER,xb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Oc,dd)}if(ed){Pc=0;for(pd=ed.length;Pc<
- pd;Pc++){ka=ed[Pc];if(ka.needsUpdate&&(ka.boundTo===void 0||ka.boundTo==="vertices")){ra=0;gc=ka.value.length;if(ka.size===1)for(Ha=0;Ha<gc;Ha++)ka.array[Ha]=ka.value[Ha];else if(ka.size===2)for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ra=ra+2}else if(ka.size===3)if(ka.type==="c")for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.r;ka.array[ra+1]=Oa.g;ka.array[ra+2]=Oa.b;ra=ra+3}else for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ka.array[ra+
- 2]=Oa.z;ra=ra+3}else if(ka.size===4)for(Ha=0;Ha<gc;Ha++){Oa=ka.value[Ha];ka.array[ra]=Oa.x;ka.array[ra+1]=Oa.y;ka.array[ra+2]=Oa.z;ka.array[ra+3]=Oa.w;ra=ra+4}g.bindBuffer(g.ARRAY_BUFFER,ka.buffer);g.bufferData(g.ARRAY_BUFFER,ka.array,dd)}}}}X.verticesNeedUpdate=false;X.colorsNeedUpdate=false;Na.attributes&&p(Na)}else if(Za instanceof THREE.ParticleSystem){Na=c(Za,mc);Zb=Na.attributes&&m(Na);(X.verticesNeedUpdate||X.colorsNeedUpdate||Za.sortParticles||Zb)&&f(X,g.DYNAMIC_DRAW,Za);X.verticesNeedUpdate=
- false;X.colorsNeedUpdate=false;Na.attributes&&p(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 o=THREE.ShaderLib[m];a.uniforms=
- THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var n,p;n=h=e=o=0;for(f=b.length;n<f;n++){p=b[n];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&h++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&o++}}if(e+o+h<=ea){n=h;f=e}else{n=Math.ceil(ea*h/(e+h));o=f=ea-n}e=n;h=o;o=l=0;for(n=b.length;o<n;o++){p=b[o];if(p.castShadow){p instanceof THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(ic&&
- 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 q;a:{p=a.fragmentShader;n=a.vertexShader;var o=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,specularMap:!!a.specularMap,
- vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:k,useVertexTexture:ic&&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.side===THREE.DoubleSide},r,d=[];if(m)d.push(m);else{d.push(p);d.push(n)}for(r in c){d.push(r);d.push(c[r])}m=d.join();r=0;for(d=aa.length;r<d;r++){e=aa[r];if(e.code===m){e.usedTimes++;q=e.program;break a}}r=g.createProgram();d=["precision "+Q+" float;",Pb?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?
- "#define GAMMA_OUTPUT":"",I.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.bumpMap?"#define USE_BUMPMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",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 "+Q+" float;",c.bumpMap?"#extension GL_OES_standard_derivatives : enable":"","#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:"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":"",I.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.bumpMap?"#define USE_BUMPMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",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=H("fragment",e+p);d=H("vertex",d+n);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 o)d.push(u);u=d;d=0;for(o=u.length;d<o;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(q in b)d.push(q);
- q=d;u=0;for(c=q.length;u<c;u++){d=q[u];r.attributes[d]=g.getAttribLocation(r,d)}r.id=P++;aa.push({program:r,code:m,usedTimes:1});I.info.memory.programs=aa.length;q=r}a.program=q;q=a.program.attributes;q.position>=0&&g.enableVertexAttribArray(q.position);q.color>=0&&g.enableVertexAttribArray(q.color);q.normal>=0&&g.enableVertexAttribArray(q.normal);q.tangent>=0&&g.enableVertexAttribArray(q.tangent);if(a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0){g.enableVertexAttribArray(q.skinVertexA);
- g.enableVertexAttribArray(q.skinVertexB);g.enableVertexAttribArray(q.skinIndex);g.enableVertexAttribArray(q.skinWeight)}if(a.attributes)for(j in a.attributes)q[j]!==void 0&&q[j]>=0&&g.enableVertexAttribArray(q[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){u=r+j;if(q[u]>=0){g.enableVertexAttribArray(q[u]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){u=r+j;
- if(q[u]>=0){g.enableVertexAttribArray(q[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){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ba!==b){b?g.disable(g.CULL_FACE):
- g.enable(g.CULL_FACE);ba=b}if(ia!==a){a?g.frontFace(g.CW):g.frontFace(g.CCW);ia=a}};this.setDepthTest=function(a){if(Pa!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);Pa=a}};this.setDepthWrite=function(a){if(ua!==a){g.depthMask(a);ua=a}};this.setBlending=function(a,b,c,d){if(a!==fa){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)}fa=a}if(a===THREE.CustomBlending){if(b!==Ja){g.blendEquation(O(b));Ja=b}if(c!==Ga||d!==la){g.blendFunc(O(c),O(d));
- Ga=c;la=d}}else la=Ga=Ja=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();I.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=O(a.format),f=O(a.type);x(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=O(a.format),e=O(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);x(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);D(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);x(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);D(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=jc;d=Mb;e=Nb}if(b!==sa){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);sa=b}hc=c;yc=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.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.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,i=this.attributes.normal.array,l,k,j,o,m,p,u=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3,w=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;l=e[c].count;var v=e[c].index;a=b;for(b=b+l;a<b;a=a+3){l=v+f[a];k=v+f[a+1];j=v+f[a+2];o=h[l*3];m=h[l*3+1];p=h[l*3+2];u.set(o,m,p);o=h[k*3];m=h[k*3+1];p=h[k*3+2];n.set(o,m,p);o=h[j*3];m=h[j*3+1];p=h[j*3+2];q.set(o,m,p);r.sub(q,n);w.sub(u,
- n);r.crossSelf(w);i[l*3]=i[l*3]+r.x;i[l*3+1]=i[l*3+1]+r.y;i[l*3+2]=i[l*3+2]+r.z;i[k*3]=i[k*3]+r.x;i[k*3+1]=i[k*3+1]+r.y;i[k*3+2]=i[k*3+2]+r.z;i[j*3]=i[j*3]+r.x;i[j*3+1]=i[j*3+1]+r.y;i[j*3+2]=i[j*3+2]+r.z}}a=0;for(b=i.length;a<b;a=a+3){o=i[a];m=i[a+1];p=i[a+2];c=1/Math.sqrt(o*o+m*m+p*p);i[a]=i[a]*c;i[a+1]=i[a+1]*c;i[a+2]=i[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a,b,c){o=d[a*3];m=d[a*3+1];p=d[a*3+2];u=d[b*3];n=d[b*3+1];q=d[b*3+2];r=d[c*3];w=d[c*3+1];v=d[c*3+2];H=
- f[a*2];x=f[a*2+1];D=f[b*2];E=f[b*2+1];O=f[c*2];B=f[c*2+1];Q=u-o;F=r-o;W=n-m;V=w-m;T=q-p;A=v-p;M=D-H;G=O-H;ea=E-x;I=B-x;aa=1/(M*I-G*ea);P.set((I*Q-ea*F)*aa,(I*W-ea*V)*aa,(I*T-ea*A)*aa);Aa.set((M*F-G*Q)*aa,(M*V-G*W)*aa,(M*A-G*T)*aa);k[a].addSelf(P);k[b].addSelf(P);k[c].addSelf(P);j[a].addSelf(Aa);j[b].addSelf(Aa);j[c].addSelf(Aa)}function b(a){Ga.x=e[a*3];Ga.y=e[a*3+1];Ga.z=e[a*3+2];la.copy(Ga);ua=k[a];fa.copy(ua);fa.subSelf(Ga.multiplyScalar(Ga.dot(ua))).normalize();Ja.cross(la,ua);Xa=Ja.dot(j[a]);
- Pa=Xa<0?-1:1;l[a*4]=fa.x;l[a*4+1]=fa.y;l[a*4+2]=fa.z;l[a*4+3]=Pa}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 i=4*h;this.attributes.tangent=
- {itemSize:4,array:new Float32Array(i),numItems:i}}for(var l=this.attributes.tangent.array,k=[],j=[],i=0;i<h;i++){k[i]=new THREE.Vector3;j[i]=new THREE.Vector3}var o,m,p,u,n,q,r,w,v,H,x,D,E,O,B,Q,F,W,V,T,A,M,G,ea,I,aa,P=new THREE.Vector3,Aa=new THREE.Vector3,sa,U,S,ta,wa,ba=this.offsets,i=0;for(U=ba.length;i<U;++i){sa=ba[i].start;S=ba[i].count;var ia=ba[i].index,h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];a(S,ta,wa)}}var fa=new THREE.Vector3,Ja=new THREE.Vector3,Ga=new THREE.Vector3,
- la=new THREE.Vector3,Pa,ua,Xa,i=0;for(U=ba.length;i<U;++i){sa=ba[i].start;S=ba[i].count;ia=ba[i].index;h=sa;for(sa=sa+S;h<sa;h=h+3){S=ia+c[h];ta=ia+c[h+1];wa=ia+c[h+2];b(S);b(ta);b(wa)}}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,i,l,k,j,o,m,p;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);i=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);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;j=a(THREE.ShaderFlares.lensFlare)}else{k=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(j,"position");o.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
- "color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,e,r){var a=a.__webglFlares,w=a.length;if(w){var v=new THREE.Vector3,H=r/e,x=e*0.5,D=r*0.5,E=16/r,O=new THREE.Vector2(E*H,E),B=new THREE.Vector3(1,1,0),Q=new THREE.Vector2(1,1),F=m,E=o;b.useProgram(j);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,
- 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var W,V,T,A,M;for(W=0;W<w;W++){E=16/r;O.set(E*H,E);A=a[W];v.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);B.copy(v);Q.x=B.x*x+x;Q.y=B.y*D+D;if(k||Q.x>0&&Q.x<e&&Q.y>0&&
- Q.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,O.x,O.y);b.uniform3f(F.screenPosition,B.x,B.y,B.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,Q.x-8,Q.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
- b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(B);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);V=0;for(T=A.lensFlares.length;V<T;V++){M=A.lensFlares[V];if(M.opacity>0.001&&M.scale>0.001){B.x=M.x;B.y=M.y;B.z=M.z;E=M.size*M.scale/r;O.x=E*H;O.y=E;b.uniform3f(F.screenPosition,B.x,B.y,B.z);b.uniform2f(F.scale,O.x,O.y);b.uniform1f(F.rotation,M.rotation);b.uniform1f(F.opacity,M.opacity);
- b.uniform3f(F.color,M.color.r,M.color.g,M.color.b);c.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst);c.setTexture(M.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,i=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,j){var o,m,p,u,n,q,r,w,v,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);o=0;for(m=k.__lights.length;o<m;o++){p=k.__lights[o];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&
- p.shadowCascade)for(n=0;n<p.shadowCascadeCount;n++){var x;if(p.shadowCascadeArray[n])x=p.shadowCascadeArray[n];else{v=p;r=n;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=v.shadowCameraNear;x.shadowCameraFar=v.shadowCameraFar;x.shadowCameraLeft=v.shadowCameraLeft;x.shadowCameraRight=v.shadowCameraRight;x.shadowCameraBottom=v.shadowCameraBottom;x.shadowCameraTop=v.shadowCameraTop;x.shadowCameraVisible=v.shadowCameraVisible;x.shadowDarkness=v.shadowDarkness;
- x.shadowBias=v.shadowCascadeBias[r];x.shadowMapWidth=v.shadowCascadeWidth[r];x.shadowMapHeight=v.shadowCascadeHeight[r];x.pointsWorld=[];x.pointsFrustum=[];w=x.pointsWorld;q=x.pointsFrustum;for(var D=0;D<8;D++){w[D]=new THREE.Vector3;q[D]=new THREE.Vector3}w=v.shadowCascadeNearZ[r];v=v.shadowCascadeFarZ[r];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,1,w);q[3].set(1,1,w);q[4].set(-1,-1,v);q[5].set(1,-1,v);q[6].set(-1,1,v);q[7].set(1,1,v);x.originalCamera=j;q=new THREE.Gyroscope;q.position=p.shadowCascadeOffset;
- q.add(x);q.add(x.target);j.add(q);p.shadowCascadeArray[n]=x;console.log("Created virtualLight",x)}r=p;w=n;v=r.shadowCascadeArray[w];v.position.copy(r.position);v.target.position.copy(r.target.position);v.lookAt(v.target);v.shadowCameraVisible=r.shadowCameraVisible;v.shadowDarkness=r.shadowDarkness;v.shadowBias=r.shadowCascadeBias[w];q=r.shadowCascadeNearZ[w];r=r.shadowCascadeFarZ[w];v=v.pointsFrustum;v[0].z=q;v[1].z=q;v[2].z=q;v[3].z=q;v[4].z=r;v[5].z=r;v[6].z=r;v[7].z=r;H[u]=x;u++}else{H[u]=p;u++}}o=
- 0;for(m=H.length;o<m;o++){p=H[o];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof
- THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(p.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(p.shadowCameraVisible&&!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&x.originalCamera==j){n=j;u=p.shadowCamera;
- q=p.pointsFrustum;v=p.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(r=0;r<8;r++){w=v[r];w.copy(q[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,n);u.matrixWorldInverse.multiplyVector3(w);if(w.x<i.x)i.x=w.x;if(w.x>l.x)l.x=w.x;if(w.y<i.y)i.y=w.y;if(w.y>l.y)l.y=w.y;if(w.z<i.z)i.z=w.z;if(w.z>l.z)l.z=w.z}u.left=i.x;u.right=l.x;u.top=l.y;u.bottom=i.y;u.updateProjectionMatrix()}u=p.shadowMap;q=p.shadowMatrix;n=p.shadowCamera;n.position.copy(p.matrixWorld.getPosition());
- n.lookAt(p.target.matrixWorld.getPosition());n.updateMatrixWorld();n.matrixWorldInverse.getInverse(n.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(n.projectionMatrix);q.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);
- n.projectionMatrix.flattenToArray(n._projectionMatrixArray);h.multiply(n.projectionMatrix,n.matrixWorldInverse);f.setFromMatrix(h);b.setRenderTarget(u);b.clear();v=k.__webglObjects;p=0;for(u=v.length;p<u;p++){r=v[p];q=r.object;r.render=false;if(q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q))){q._modelViewMatrix.multiply(n.matrixWorldInverse,q.matrixWorld);r.render=true}}p=0;for(u=v.length;p<u;p++){r=v[p];if(r.render){q=r.object;r=r.buffer;w=q.customDepthMaterial?
- q.customDepthMaterial:q.geometry.morphTargets.length?d:q instanceof THREE.SkinnedMesh?e:c;r instanceof THREE.BufferGeometry?b.renderBufferDirect(n,k.__lights,null,w,r,q):b.renderBuffer(n,k.__lights,null,w,r,q)}}v=k.__webglObjectsImmediate;p=0;for(u=v.length;p<u;p++){r=v[p];q=r.object;if(q.visible&&q.castShadow){q._modelViewMatrix.multiply(n.matrixWorldInverse,q.matrixWorld);b.renderImmediateObject(n,k.__lights,null,c,q)}}}o=b.getClearColor();m=b.getClearAlpha();a.clearColor(o.r,o.g,o.b,m);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,i,l,k,j;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,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(u,a.vertexShader);b.compileShader(p);b.compileShader(u);b.attachShader(m,p);b.attachShader(m,u);b.linkProgram(m);i=m;l={};k={};l.position=b.getAttribLocation(i,"position");l.uv=b.getAttribLocation(i,"uv");k.uvOffset=b.getUniformLocation(i,"uvOffset");k.uvScale=b.getUniformLocation(i,
- "uvScale");k.rotation=b.getUniformLocation(i,"rotation");k.scale=b.getUniformLocation(i,"scale");k.alignment=b.getUniformLocation(i,"alignment");k.color=b.getUniformLocation(i,"color");k.map=b.getUniformLocation(i,"map");k.opacity=b.getUniformLocation(i,"opacity");k.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");k.screenPosition=b.getUniformLocation(i,"screenPosition");k.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
- k.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=false};this.render=function(d,e,p,u){var d=d.__webglSprites,n=d.length;if(n){var q=l,r=k,w=u/p,p=p*0.5,v=u*0.5,H=true;b.useProgram(i);if(!j){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
- h);b.uniformMatrix4fv(r.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var x,D=[],q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(r.useScreenCoordinates,1);
- b.uniform3f(r.screenPosition,(x.position.x-p)/p,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(r.useScreenCoordinates,0);b.uniform1i(r.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(r.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?u:1);D[0]=e*w*x.scale.x;D[1]=e*x.scale.y;b.uniform2f(r.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(r.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(r.alignment,x.alignment.x,x.alignment.y);
- b.uniform1f(r.opacity,x.opacity);b.uniform3f(r.color,x.color.r,x.color.g,x.color.b);b.uniform1f(r.rotation,x.rotation);b.uniform2fv(r.scale,D);if(x.mergeWith3D&&!H){b.enable(b.DEPTH_TEST);H=true}else if(!x.mergeWith3D&&H){b.disable(b.DEPTH_TEST);H=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
- THREE.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}"}};
|