123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- // 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.Color=function(a){a!==void 0&&this.setHex(a);return this};
- THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
- this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);f=c*(1-b*e);b=c*(1-b*(1-e));switch(d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c;this.g=b;this.b=a}}return this},setHex:function(a){a=
- Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
- THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
- this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
- lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
- a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
- this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
- setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
- a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],j=d[1],k=d[5],l=d[9],i=d[2],o=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(h,d);this.z=Math.atan2(j,k)}else{this.y=Math.atan2(-i,e);this.z=0}break;case "ZXY":this.x=Math.asin(c(o));if(Math.abs(o)<
- 0.99999){this.y=Math.atan2(-i,d);this.z=Math.atan2(-f,k)}else{this.y=0;this.z=Math.atan2(h,e)}break;case "ZYX":this.y=Math.asin(-c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(j,e)}else{this.x=0;this.z=Math.atan2(-f,k)}break;case "YZX":this.z=Math.asin(c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(-l,k);this.y=Math.atan2(-i,e)}else{this.x=0;this.y=Math.atan2(i,d)}break;case "XZY":this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,k);this.y=Math.atan2(h,e)}else{this.x=
- Math.atan2(-h,d);this.y=0}break;default:this.y=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(j,k);this.z=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;switch(b){case "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);break;case "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);break;case "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);break;case "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)));break;case "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)));break;default: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)}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===
- this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
- this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
- a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],j=a[5],k=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-h)<0.01&&Math.abs(f-c)<0.01&&Math.abs(k-b)<0.01){if(Math.abs(d+h)<0.1&&Math.abs(f+c)<0.1&&Math.abs(k+b)<0.1&&Math.abs(e+j+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;j=(j+1)/2;l=(l+1)/2;d=(d+h)/4;f=(f+c)/4;k=(k+b)/4;if(e>j&&e>l)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(j>
- l)if(j<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(j);b=d/c;d=k/c}else if(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=f/d;c=k/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(h-d)*(h-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+j+l-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,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],h=d[4],j=d[5],k=d[6],l=d[7],i=d[8],o=d[9],m=d[10],v=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(f-a,l-h,v-i,d-r);c[1].set(f+a,l+h,v+i,d+r);c[2].set(f+b,l+j,v+o,d+n);c[3].set(f-b,l-j,v-o,d-n);c[4].set(f-e,l-k,v-m,d-q);c[5].set(f+e,l+k,v+m,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
- THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
- THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,v=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,w,p,D,C=function(a,b,c){r.sub(c,a);w=r.dot(b);p=n.add(a,q.copy(b).multiplyScalar(w));
- return D=c.distanceTo(p)},t,L,A,G,E,M,Q,R,H=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);t=r.dot(r);L=r.dot(n);A=r.dot(q);G=n.dot(n);E=n.dot(q);M=1/(t*G-L*L);Q=(G*A-L*E)*M;R=(t*E-L*A)*M;return Q>=0&&R>=0&&Q+R<1},S=1.0E-4;this.setPrecision=function(a){S=a};this.intersectObject=function(a){var b,c=[];if(a instanceof THREE.Particle){D=C(this.origin,this.direction,a.matrixWorld.getPosition());if(D>a.scale.x)return[];b={distance:D,point:a.position,face:null,object:a};c.push(b)}else if(a instanceof
- THREE.Mesh){var d=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length()),d=a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z));D=C(this.origin,this.direction,a.matrixWorld.getPosition());if(D>d)return c;var g,n,r,q=a.geometry,p=q.vertices,w;a.matrixRotationWorld.extractRotation(a.matrixWorld);d=0;for(g=q.faces.length;d<g;d++){b=q.faces[d];k.copy(this.origin);l.copy(this.direction);w=a.matrixWorld;i=w.multiplyVector3(i.copy(b.centroid)).subSelf(k);
- o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal));n=l.dot(o);if(!(Math.abs(n)<S)){r=o.dot(i)/n;if(!(r<0)&&(a.doubleSided||(a.flipSided?n>0:n<0))){m.add(k,l.multiplyScalar(r));D=k.distanceTo(m);if(!(D<this.near)&&!(D>this.far))if(b instanceof THREE.Face3){e=w.multiplyVector3(e.copy(p[b.a]));f=w.multiplyVector3(f.copy(p[b.b]));h=w.multiplyVector3(h.copy(p[b.c]));if(H(m,e,f,h)){b={distance:D,point:m.clone(),face:b,object:a};c.push(b)}}else if(b instanceof THREE.Face4){e=w.multiplyVector3(e.copy(p[b.a]));
- f=w.multiplyVector3(f.copy(p[b.b]));h=w.multiplyVector3(h.copy(p[b.c]));j=w.multiplyVector3(j.copy(p[b.d]));if(H(m,e,f,j)||H(m,f,h,j)){b={distance:D,point:m.clone(),face:b,object:a};c.push(b)}}}}}}c.sort(v);return c};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(v);return b}};
- THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b,c,d,e,f,h,j=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,i,o){j=false;b=f;c=h;d=i;e=o;a()};this.addPoint=function(f,h){if(j){j=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:h;d=d>f?d:f;e=e>h?
- e:h}a()};this.add3Points=function(f,h,i,o,m,v){if(j){j=false;b=f<i?f<m?f:m:i<m?i:m;c=h<o?h<v?h:v:o<v?o:v;d=f>i?f>m?f:m:i>m?i:m;e=h>o?h>v?h:v:o>v?o:v}else{b=f<i?f<m?f<b?f:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b;c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c;d=f>i?f>m?f>d?f:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d;e=h>o?h>v?h>e?h:e:v>e?v:e:o>v?o>e?o:e:v>e?v:e}a()};this.addRectangle=function(f){if(j){j=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
- d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){j=true;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
- THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*j;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,i=this.elements;i[0]=b*a;i[1]=b*c;i[2]=b*d;i[3]=b*e;i[4]=b*f;i[5]=b*h;i[6]=b*j;i[7]=b*k;i[8]=b*l;return this},
- transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,h,j,k,l,i,o,m,v,r,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,j||0,k||0,l||0,i!==void 0?i:1,o||0,m||0,v||0,r||0,n!==void 0?n:1)};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,j,k,l,i,o,m,v,r,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]=j;q[2]=k;q[6]=l;q[10]=i;q[14]=o;q[3]=m;q[7]=v;q[11]=r;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],j=c[8],k=c[12],l=c[1],i=c[5],o=c[9],m=c[13],v=c[2],r=c[6],n=c[10],q=c[14],w=c[3],p=c[7],D=c[11],c=c[15],C=d[0],t=d[4],
- L=d[8],A=d[12],G=d[1],E=d[5],M=d[9],Q=d[13],R=d[2],H=d[6],S=d[10],z=d[14],K=d[3],Z=d[7],F=d[11],d=d[15];e[0]=f*C+h*G+j*R+k*K;e[4]=f*t+h*E+j*H+k*Z;e[8]=f*L+h*M+j*S+k*F;e[12]=f*A+h*Q+j*z+k*d;e[1]=l*C+i*G+o*R+m*K;e[5]=l*t+i*E+o*H+m*Z;e[9]=l*L+i*M+o*S+m*F;e[13]=l*A+i*Q+o*z+m*d;e[2]=v*C+r*G+n*R+q*K;e[6]=v*t+r*E+n*H+q*Z;e[10]=v*L+r*M+n*S+q*F;e[14]=v*A+r*Q+n*z+q*d;e[3]=w*C+p*G+D*R+c*K;e[7]=w*t+p*E+D*H+c*Z;e[11]=w*L+p*M+D*S+c*F;e[15]=w*A+p*Q+D*z+c*d;return this},multiplySelf:function(a){return this.multiply(this,
- a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
- b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
- d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],j=a[9],k=a[13],l=a[2],i=a[6],o=a[10],m=a[14],v=a[3],r=a[7],
- n=a[11],a=a[15];return e*j*i*v-d*k*i*v-e*h*o*v+c*k*o*v+d*h*m*v-c*j*m*v-e*j*l*r+d*k*l*r+e*f*o*r-b*k*o*r-d*f*m*r+b*j*m*r+e*h*l*n-c*k*l*n-e*f*i*n+b*k*i*n+c*f*m*n-b*h*m*n-d*h*l*a+c*j*l*a+d*f*i*a-b*j*i*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],j=c[1],k=c[5],l=c[9],i=c[13],o=c[2],m=c[6],v=c[10],r=
- c[14],n=c[3],q=c[7],w=c[11],c=c[15];b[0]=l*r*q-i*v*q+i*m*w-k*r*w-l*m*c+k*v*c;b[4]=h*v*q-f*r*q-h*m*w+e*r*w+f*m*c-e*v*c;b[8]=f*i*q-h*l*q+h*k*w-e*i*w-f*k*c+e*l*c;b[12]=h*l*m-f*i*m-h*k*v+e*i*v+f*k*r-e*l*r;b[1]=i*v*n-l*r*n-i*o*w+j*r*w+l*o*c-j*v*c;b[5]=f*r*n-h*v*n+h*o*w-d*r*w-f*o*c+d*v*c;b[9]=h*l*n-f*i*n-h*j*w+d*i*w+f*j*c-d*l*c;b[13]=f*i*o-h*l*o+h*j*v-d*i*v-f*j*r+d*l*r;b[2]=k*r*n-i*m*n+i*o*q-j*r*q-k*o*c+j*m*c;b[6]=h*m*n-e*r*n-h*o*q+d*r*q+e*o*c-d*m*c;b[10]=e*i*n-h*k*n+h*j*q-d*i*q-e*j*c+d*k*c;b[14]=h*k*o-
- e*i*o-h*j*m+d*i*m+e*j*r-d*k*r;b[3]=l*m*n-k*v*n-l*o*q+j*v*q+k*o*w-j*m*w;b[7]=e*v*n-f*m*n+f*o*q-d*v*q-e*o*w+d*m*w;b[11]=f*k*n-e*l*n-f*j*q+d*l*q+e*j*w-d*k*w;b[15]=e*l*o-f*k*o+f*j*m-d*l*m-e*j*v+d*k*v;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=j*k,i=j*f,o=e*k,m=e*f;c[0]=l+m*d;c[4]=o*d-i;c[8]=h*e;c[1]=h*f;c[5]=h*
- k;c[9]=-d;c[2]=i*d-o;c[6]=m+l*d;c[10]=h*j;break;case "ZXY":l=j*k;i=j*f;o=e*k;m=e*f;c[0]=l-m*d;c[4]=-h*f;c[8]=o+i*d;c[1]=i+o*d;c[5]=h*k;c[9]=m-l*d;c[2]=-h*e;c[6]=d;c[10]=h*j;break;case "ZYX":l=h*k;i=h*f;o=d*k;m=d*f;c[0]=j*k;c[4]=o*e-i;c[8]=l*e+m;c[1]=j*f;c[5]=m*e+l;c[9]=i*e-o;c[2]=-e;c[6]=d*j;c[10]=h*j;break;case "YZX":l=h*j;i=h*e;o=d*j;m=d*e;c[0]=j*k;c[4]=m-l*f;c[8]=o*f+i;c[1]=f;c[5]=h*k;c[9]=-d*k;c[2]=-e*k;c[6]=i*f+o;c[10]=l-m*f;break;case "XZY":l=h*j;i=h*e;o=d*j;m=d*e;c[0]=j*k;c[4]=-f;c[8]=e*k;
- c[1]=l*f+m;c[5]=h*k;c[9]=i*f-o;c[2]=o*f-i;c[6]=d*k;c[10]=m*f+l;break;default:l=h*k;i=h*f;o=d*k;m=d*f;c[0]=j*k;c[4]=-j*f;c[8]=e;c[1]=i+o*e;c[5]=l-m*e;c[9]=-d*j;c[2]=m-l*e;c[6]=o+i*e;c[10]=h*j}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,j=d+d,k=e+e,a=c*h,l=c*j,c=c*k,i=d*j,d=d*k,e=e*k,h=f*h,j=f*j,f=f*k;b[0]=1-(i+e);b[4]=l-f;b[8]=c+j;b[1]=l+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-j;b[6]=d+h;b[10]=1-(a+i);return this},compose:function(a,b,c){var d=this.elements,
- e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);h.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
- c.x=e.length();c.y=f.length();c.z=h.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
- b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
- d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],h=b[8],j=b[9],k=b[10],l=b[11],i=Math.cos(a),a=Math.sin(a);b[4]=i*c+a*h;b[5]=i*d+a*j;b[6]=i*e+a*k;b[7]=i*f+a*l;b[8]=i*h-a*c;b[9]=i*j-a*d;b[10]=i*k-a*e;b[11]=i*l-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[8],j=b[9],k=b[10],l=b[11],i=Math.cos(a),a=Math.sin(a);b[0]=i*c-a*h;b[1]=i*d-a*j;b[2]=i*e-a*k;b[3]=i*f-a*l;b[8]=i*h+a*c;b[9]=
- i*j+a*d;b[10]=i*k+a*e;b[11]=i*l+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],h=b[4],j=b[5],k=b[6],l=b[7],i=Math.cos(a),a=Math.sin(a);b[0]=i*c+a*h;b[1]=i*d+a*j;b[2]=i*e+a*k;b[3]=i*f+a*l;b[4]=i*h-a*c;b[5]=i*j-a*d;b[6]=i*k-a*e;b[7]=i*l-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
- e=a.y,f=a.z,h=Math.sqrt(d*d+e*e+f*f),d=d/h,e=e/h,f=f/h,h=d*d,j=e*e,k=f*f,l=Math.cos(b),i=Math.sin(b),o=1-l,m=d*e*o,v=d*f*o,o=e*f*o,d=d*i,r=e*i,i=f*i,f=h+(1-h)*l,h=m+i,e=v-r,m=m-i,j=j+(1-j)*l,i=o+d,v=v+r,o=o-d,k=k+(1-k)*l,l=c[0],d=c[1],r=c[2],n=c[3],q=c[4],w=c[5],p=c[6],D=c[7],C=c[8],t=c[9],L=c[10],A=c[11];c[0]=f*l+h*q+e*C;c[1]=f*d+h*w+e*t;c[2]=f*r+h*p+e*L;c[3]=f*n+h*D+e*A;c[4]=m*l+j*q+i*C;c[5]=m*d+j*w+i*t;c[6]=m*r+j*p+i*L;c[7]=m*n+j*D+i*A;c[8]=v*l+o*q+k*C;c[9]=v*d+o*w+k*t;c[10]=v*r+o*p+k*L;c[11]=
- v*n+o*D+k*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
- makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,j=a.z,k=e*f,l=e*h;this.set(k*f+c,k*h-d*j,k*j+d*h,0,k*h+d*j,l*h+c,l*j-d*f,0,k*j-
- d*h,l*j+d*f,e*j*j+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
- b,c,d,e,f){var h=this.elements,j=b-a,k=c-d,l=f-e;h[0]=2/j;h[4]=0;h[8]=0;h[12]=-((b+a)/j);h[1]=0;h[5]=2/k;h[9]=0;h[13]=-((c+d)/k);h[2]=0;h[6]=0;h[10]=-2/l;h[14]=-((f+e)/l);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
- THREE.Matrix4.__m2=new THREE.Matrix4;
- THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
- true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.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?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,
- this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
- THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
- d);return true}var e,f,h=[],j,k,l=[],i,o,m=[],v,r=[],n,q,w=[],p,D,C=[],t={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,A=new THREE.Vector4,G=new THREE.Matrix4,E=new THREE.Matrix4,M=new THREE.Frustum,Q=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
- G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||M.contains(b))){L.copy(b.matrixWorld.getPosition());
- G.multiplyVector3(L);e=a();e.object=b;e.z=L.z;t.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){L.copy(b.matrixWorld.getPosition());G.multiplyVector3(L);e=a();e.object=b;e.z=L.z;t.sprites.push(e)}else b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var h=e.near,L=e.far,F=false,g,W,I,za,T,na,ca,ga,oa,Ba,Ha,Ia,Sa,Ua,Na;D=q=v=o=0;t.elements.length=
- 0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);G.multiply(e.projectionMatrix,e.matrixWorldInverse);M.setFromMatrix(G);t=this.projectGraph(a,false);a=0;for(g=t.objects.length;a<g;a++){oa=t.objects[a].object;Ba=oa.matrixWorld;k=0;if(oa instanceof THREE.Mesh){Ha=oa.geometry;Ia=oa.geometry.materials;za=Ha.vertices;Sa=Ha.faces;Ua=Ha.faceVertexUvs;Ha=oa.matrixRotationWorld.extractRotation(Ba);
- W=0;for(I=za.length;W<I;W++){j=b();j.positionWorld.copy(za[W]);Ba.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);G.multiplyVector4(j.positionScreen);j.positionScreen.x=j.positionScreen.x/j.positionScreen.w;j.positionScreen.y=j.positionScreen.y/j.positionScreen.w;j.visible=j.positionScreen.z>h&&j.positionScreen.z<L}za=0;for(W=Sa.length;za<W;za++){I=Sa[za];if(I instanceof THREE.Face3){T=l[I.a];na=l[I.b];ca=l[I.c];if(T.visible&&na.visible&&ca.visible){F=(ca.positionScreen.x-
- T.positionScreen.x)*(na.positionScreen.y-T.positionScreen.y)-(ca.positionScreen.y-T.positionScreen.y)*(na.positionScreen.x-T.positionScreen.x)<0;if(oa.doubleSided||F!=oa.flipSided){ga=m[o]=m[o]||new THREE.RenderableFace3;o++;i=ga;i.v1.copy(T);i.v2.copy(na);i.v3.copy(ca)}else continue}else continue}else if(I instanceof THREE.Face4){T=l[I.a];na=l[I.b];ca=l[I.c];ga=l[I.d];if(T.visible&&na.visible&&ca.visible&&ga.visible){F=(ga.positionScreen.x-T.positionScreen.x)*(na.positionScreen.y-T.positionScreen.y)-
- (ga.positionScreen.y-T.positionScreen.y)*(na.positionScreen.x-T.positionScreen.x)<0||(na.positionScreen.x-ca.positionScreen.x)*(ga.positionScreen.y-ca.positionScreen.y)-(na.positionScreen.y-ca.positionScreen.y)*(ga.positionScreen.x-ca.positionScreen.x)<0;if(oa.doubleSided||F!=oa.flipSided){Na=r[v]=r[v]||new THREE.RenderableFace4;v++;i=Na;i.v1.copy(T);i.v2.copy(na);i.v3.copy(ca);i.v4.copy(ga)}else continue}else continue}i.normalWorld.copy(I.normal);!F&&(oa.flipSided||oa.doubleSided)&&i.normalWorld.negate();
- Ha.multiplyVector3(i.normalWorld);i.centroidWorld.copy(I.centroid);Ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);G.multiplyVector3(i.centroidScreen);ca=I.vertexNormals;T=0;for(na=ca.length;T<na;T++){ga=i.vertexNormalsWorld[T];ga.copy(ca[T]);!F&&(oa.flipSided||oa.doubleSided)&&ga.negate();Ha.multiplyVector3(ga)}T=0;for(na=Ua.length;T<na;T++)if(Na=Ua[T][za]){ca=0;for(ga=Na.length;ca<ga;ca++)i.uvs[T][ca]=Na[ca]}i.material=oa.material;i.faceMaterial=I.materialIndex!==null?
- Ia[I.materialIndex]:null;i.z=i.centroidScreen.z;t.elements.push(i)}}else if(oa instanceof THREE.Line){E.multiply(G,Ba);za=oa.geometry.vertices;T=b();T.positionScreen.copy(za[0]);E.multiplyVector4(T.positionScreen);Ba=oa.type===THREE.LinePieces?2:1;W=1;for(I=za.length;W<I;W++){T=b();T.positionScreen.copy(za[W]);E.multiplyVector4(T.positionScreen);if(!((W+1)%Ba>0)){na=l[k-2];Q.copy(T.positionScreen);R.copy(na.positionScreen);if(d(Q,R)){Q.multiplyScalar(1/Q.w);R.multiplyScalar(1/R.w);Ia=w[q]=w[q]||new THREE.RenderableLine;
- q++;n=Ia;n.v1.positionScreen.copy(Q);n.v2.positionScreen.copy(R);n.z=Math.max(Q.z,R.z);n.material=oa.material;t.elements.push(n)}}}}}a=0;for(g=t.sprites.length;a<g;a++){oa=t.sprites[a].object;Ba=oa.matrixWorld;if(oa instanceof THREE.Particle){A.set(Ba.elements[12],Ba.elements[13],Ba.elements[14],1);G.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){h=C[D]=C[D]||new THREE.RenderableParticle;D++;p=h;p.x=A.x/A.w;p.y=A.y/A.w;p.z=A.z;p.rotation=oa.rotation.z;p.scale.x=oa.scale.x*Math.abs(p.x-(A.x+e.projectionMatrix.elements[0])/
- (A.w+e.projectionMatrix.elements[12]));p.scale.y=oa.scale.y*Math.abs(p.y-(A.y+e.projectionMatrix.elements[5])/(A.w+e.projectionMatrix.elements[13]));p.material=oa.material;t.elements.push(p)}}}f&&t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
- THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=b||"XYZ",d=Math.cos(a.x/2),e=Math.cos(a.y/2),f=Math.cos(a.z/2),h=Math.sin(a.x/2),j=Math.sin(a.y/2),k=Math.sin(a.z/2);switch(c){case "YXZ":this.x=h*e*f+d*j*k;this.y=d*j*f-h*e*k;this.z=d*e*k-h*j*f;this.w=d*e*f+h*j*k;break;case "ZXY":this.x=h*e*f-d*j*k;this.y=d*j*f+h*e*
- k;this.z=d*e*k+h*j*f;this.w=d*e*f-h*j*k;break;case "ZYX":this.x=h*e*f-d*j*k;this.y=d*j*f+h*e*k;this.z=d*e*k-h*j*f;this.w=d*e*f+h*j*k;break;case "YZX":this.x=h*e*f+d*j*k;this.y=d*j*f+h*e*k;this.z=d*e*k-h*j*f;this.w=d*e*f-h*j*k;break;case "XZY":this.x=h*e*f-d*j*k;this.y=d*j*f-h*e*k;this.z=d*e*k+h*j*f;this.w=d*e*f+h*j*k;break;default:this.x=h*e*f+d*j*k;this.y=d*j*f-h*e*k;this.z=d*e*k+h*j*f;this.w=d*e*f-h*j*k}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
- d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],j=b[2],k=b[6],b=b[10],l=c+f+b;if(l>0){c=0.5/Math.sqrt(l+1);this.w=0.25/c;this.x=(k-h)*c;this.y=(d-j)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(k-h)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+j)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-j)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(h+k)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
- (d+j)/c;this.y=(h+k)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
- this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
- f=this.x,h=this.y,j=this.z,k=this.w,l=k*c+h*e-j*d,i=k*d+j*c-f*e,o=k*e+f*d-h*c,c=-f*c-h*d-j*e;b.x=l*k+c*-f+i*-j-o*-h;b.y=i*k+c*-h+o*-f-l*-j;b.z=o*k+c*-j+l*-h-i*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;if(h<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;h=-h}else this.copy(a);if(h>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var j=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
- this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}h=Math.sin((1-b)*j)/k;j=Math.sin(b*j)/k;this.w=f*h+this.w*j;this.x=c*h+this.x*j;this.y=d*h+this.y*j;this.z=e*h+this.z*j;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
- THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
- THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
- THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
- return a}};THREE.Face4=function(a,b,c,d,e,f,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.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
- THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,h=e.vertexNormals.length;f<h;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
- 0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,h=new THREE.Vector3,j=new THREE.Vector3;a=0;for(b=this.faces.length;a<
- b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];h.sub(f,e);j.sub(d,e);h.crossSelf(j);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
- else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
- for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
- e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
- [];var h=this.morphNormals[a].faceNormals,j=this.morphNormals[a].vertexNormals,k,l;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];k=new THREE.Vector3;l=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(k);j.push(l)}}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];
- k=h.faceNormals[c];l=h.vertexNormals[c];k.copy(e.normal);if(e instanceof THREE.Face3){l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2])}else{l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2]);l.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,e,f,T){j=a.vertices[b];k=a.vertices[c];
- l=a.vertices[d];i=h[e];o=h[f];m=h[T];v=k.x-j.x;r=l.x-j.x;n=k.y-j.y;q=l.y-j.y;w=k.z-j.z;p=l.z-j.z;D=o.u-i.u;C=m.u-i.u;t=o.v-i.v;L=m.v-i.v;A=1/(D*L-C*t);Q.set((L*v-t*r)*A,(L*n-t*q)*A,(L*w-t*p)*A);R.set((D*r-C*v)*A,(D*q-C*n)*A,(D*p-C*w)*A);E[b].addSelf(Q);E[c].addSelf(Q);E[d].addSelf(Q);M[b].addSelf(R);M[c].addSelf(R);M[d].addSelf(R)}var b,c,d,e,f,h,j,k,l,i,o,m,v,r,n,q,w,p,D,C,t,L,A,G,E=[],M=[],Q=new THREE.Vector3,R=new THREE.Vector3,H=new THREE.Vector3,S=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=
- this.vertices.length;b<c;b++){E[b]=new THREE.Vector3;M[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 K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){z.copy(f.vertexNormals[d]);e=f[K[d]];G=E[e];H.copy(G);H.subSelf(z.multiplyScalar(z.dot(G))).normalize();
- S.cross(f.vertexNormals[d],G);e=S.dot(M[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(H.x,H.y,H.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
- a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h,j;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++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(j=
- this.faceVertexUvs[e][f])&&j.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
- THREE.Spline=function(a){function b(a,b,c,d,e,f,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,j,k,l,i,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;l=this.points[c[0]];i=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];j=h*h;k=h*j;d.x=b(l.x,i.x,o.x,m.x,h,j,k);d.y=b(l.y,i.y,o.y,m.y,h,j,k);d.z=b(l.z,i.z,o.z,m.z,h,j,k);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,e=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
- a/c;d=this.getPoint(b);h.copy(d);i=i+h.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){j[b]=i;e=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,h,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++){d=e+c*(1/h)*(f-e);d=this.getPoint(d);
- j.push(i.copy(d).clone())}j.push(i.copy(this.points[b]).clone())}this.points=j}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
- THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.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=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
- THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
- THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
- THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;
- this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
- THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.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=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
- a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
- Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=j.crossOrigin;e.src=b}function f(a,c,d,f,h,j){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
- d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[c].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[c].wrapT=f[j[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var j=this,k="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
- if(a.shading){var i=a.shading.toLowerCase();i==="phong"?k="MeshPhongMaterial":i==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)l.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)l.transparent=a.transparent;if(a.depthTest!==void 0)l.depthTest=a.depthTest;if(a.depthWrite!==void 0)l.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;
- if(a.colorDiffuse)l.color=h(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=h(a.colorSpecular);if(a.colorAmbient)l.ambient=h(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&f(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(l,"normalMap",a.mapNormal,a.mapNormalRepeat,
- a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){k=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(k.uniforms);i.tNormal.texture=l.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(l.map){i.tDiffuse.texture=l.map;i.enableDiffuse.value=true}if(l.specularMap){i.tSpecular.texture=l.specularMap;i.enableSpecular.value=true}if(l.lightMap){i.tAO.texture=l.lightMap;
- i.enableAO.value=true}i.uDiffuseColor.value.setHex(l.color);i.uSpecularColor.value.setHex(l.specular);i.uAmbientColor.value.setHex(l.ambient);i.uShininess.value=l.shininess;if(l.opacity!==void 0)i.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:i,lights:true,fog:true})}else l=new THREE[k](l);if(a.DbgName!==void 0)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
- THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
- THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var j=JSON.parse(h.responseText);a.loadAjaxBuffers(j,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
- THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,h=c+"/"+a.buffers,j=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};
- f.open("GET",h,true);f.responseType="arraybuffer";f.send(null)};
- THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,k,l,i,o,m,v,r,n,q,w,p,D,C;function t(a){return a%4?4-a%4:0}function L(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,g,e,f,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){g=l[d*3];e=l[d*3+1];f=l[d*3+2];h=Z[g*2];g=Z[g*2+1];j=Z[e*2];i=Z[e*2+1];e=Z[f*2];k=Z[f*2+1];f=S.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,g));m.push(new THREE.UV(j,i));m.push(new THREE.UV(e,
- k));f.push(m)}}function E(b,c){var d,g,e,f,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){g=n[d*4];e=n[d*4+1];f=n[d*4+2];h=n[d*4+3];j=Z[g*2];g=Z[g*2+1];i=Z[e*2];l=Z[e*2+1];k=Z[f*2];m=Z[f*2+1];f=Z[h*2];e=Z[h*2+1];h=S.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,g));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(f,e));h.push(o)}}function M(b,c,d){for(var g,e,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){g=c[d*3];e=c[d*3+1];f=c[d*3+2];h=j[d];
- S.faces.push(new THREE.Face3(g,e,f,null,null,h))}}function Q(b,c,d){for(var g,e,f,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){g=c[d*4];e=c[d*4+1];f=c[d*4+2];h=c[d*4+3];j=i[d];S.faces.push(new THREE.Face4(g,e,f,h,null,null,j))}}function R(b,c,d,g){for(var e,f,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,g,b),g=0;g<b;g++){e=c[g*3];f=c[g*3+1];h=c[g*3+2];i=d[g*3];k=d[g*3+1];l=d[g*3+2];j=m[g];var n=K[k*3],o=K[k*3+1];k=K[k*3+2];var r=K[l*3],
- q=K[l*3+1];l=K[l*3+2];S.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(K[i*3],K[i*3+1],K[i*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(r,q,l)],null,j))}}function H(b,c,d,g){for(var e,f,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,g,b),g=0;g<b;g++){e=c[g*4];f=c[g*4+1];h=c[g*4+2];j=c[g*4+3];k=d[g*4];l=d[g*4+1];m=d[g*4+2];n=d[g*4+3];i=o[g];var r=K[l*3],q=K[l*3+1];l=K[l*3+2];var p=K[m*3],v=K[m*3+1];m=K[m*3+2];var w=K[n*3],t=K[n*3+1];n=K[n*3+2];S.faces.push(new THREE.Face4(e,
- f,h,j,[new THREE.Vector3(K[k*3],K[k*3+1],K[k*3+2]),new THREE.Vector3(r,q,l),new THREE.Vector3(p,v,m),new THREE.Vector3(w,t,n)],null,i))}}var S=this,z=0,K=[],Z=[],F,g,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(S,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",g=0;g<c;g++)d=d+String.fromCharCode(a[b+g]);return d})(a,z,12);c=L(a,z+12);L(a,z+13);L(a,z+14);L(a,z+15);e=L(a,z+16);k=L(a,z+17);l=L(a,z+18);i=L(a,z+19);o=A(a,z+20);m=A(a,z+20+4);v=A(a,z+20+8);b=A(a,z+20+12);r=
- A(a,z+20+16);n=A(a,z+20+20);q=A(a,z+20+24);w=A(a,z+20+28);p=A(a,z+20+32);D=A(a,z+20+36);C=A(a,z+20+40);z=z+c;c=e*3+i;W=e*4+i;F=b*c;g=r*(c+k*3);e=n*(c+l*3);i=q*(c+k*3+l*3);c=w*W;k=p*(W+k*4);l=D*(W+l*4);z=z+function(b){var b=new Float32Array(a,b,o*3),c,d,g,e;for(c=0;c<o;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];S.vertices.push(new THREE.Vector3(d,g,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(z);z=z+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,g,e;for(c=0;c<m;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];K.push(d/
- 127,g/127,e/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(z);z=z+t(m*3);z=z+function(b){if(v){var b=new Float32Array(a,b,v*2),c,d,g;for(c=0;c<v;c++){d=b[c*2];g=b[c*2+1];Z.push(d,g)}}return v*2*Float32Array.BYTES_PER_ELEMENT}(z);F=z+F+t(b*2);g=F+g+t(r*2);e=g+e+t(n*2);i=e+i+t(q*2);c=i+c+t(w*2);k=c+k+t(p*2);l=k+l+t(D*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;M(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);G(n,b)}})(g);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
- q*Uint32Array.BYTES_PER_ELEMENT*3;R(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);G(q,c)}})(e);(function(a){if(D){var b=a+D*Uint32Array.BYTES_PER_ELEMENT*4;Q(D,a,b+D*Uint32Array.BYTES_PER_ELEMENT*4);E(D,b)}})(k);(function(a){if(C){var b=a+C*Uint32Array.BYTES_PER_ELEMENT*4,c=b+C*Uint32Array.BYTES_PER_ELEMENT*4;H(C,a,b,c+C*Uint32Array.BYTES_PER_ELEMENT*4);E(C,c)}})(l);b&&M(b,z,z+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;R(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
- 3)}})(F);w&&Q(w,i,i+w*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*4;H(p,a,b,b+p*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
- THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
- THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
- THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var j=JSON.parse(f.responseText);a.createModel(j,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){h===0&&(h=f.getResponseHeader("Content-Length"));
- e({total:h,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
- THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,k,l,i,o,m,v,r,n,q,w,p,D,C=a.faces;o=a.vertices;var t=a.normals,L=a.colors,A=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&A++;for(c=0;c<A;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(i=o.length;l<i;){m=new THREE.Vector3;m.x=o[l++]*b;m.y=o[l++]*b;m.z=o[l++]*b;d.vertices.push(m)}l=0;for(i=C.length;l<i;){b=C[l++];o=b&1;k=b&2;c=b&
- 4;e=b&8;v=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=C[l++];q.b=C[l++];q.c=C[l++];q.d=C[l++];o=4}else{q=new THREE.Face3;q.a=C[l++];q.b=C[l++];q.c=C[l++];o=3}if(k){k=C[l++];q.materialIndex=k}k=d.faces.length;if(c)for(c=0;c<A;c++){w=a.uvs[c];r=C[l++];D=w[r*2];r=w[r*2+1];d.faceUvs[c][k]=new THREE.UV(D,r)}if(e)for(c=0;c<A;c++){w=a.uvs[c];p=[];for(e=0;e<o;e++){r=C[l++];D=w[r*2];r=w[r*2+1];p[e]=new THREE.UV(D,r)}d.faceVertexUvs[c][k]=p}if(v){v=C[l++]*3;e=new THREE.Vector3;e.x=t[v++];e.y=t[v++];
- e.z=t[v];q.normal=e}if(m)for(c=0;c<o;c++){v=C[l++]*3;e=new THREE.Vector3;e.x=t[v++];e.y=t[v++];e.z=t[v];q.vertexNormals.push(e)}if(n){m=C[l++];m=new THREE.Color(L[m]);q.color=m}if(b)for(c=0;c<o;c++){m=C[l++];m=new THREE.Color(L[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];k=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,k,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
- b+2){e=a.skinIndices[b];k=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,k,l,i,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=[];i=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;k=0;for(l=o.length;k<l;k=k+3){var m=new THREE.Vector3;m.x=o[k]*b;m.y=o[k+1]*b;m.z=o[k+2]*b;i.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=[];l=d.morphColors[c].colors;i=a.morphColors[c].colors;b=0;for(k=i.length;b<k;b=b+3){o=new THREE.Color(16755200);o.setRGB(i[b],i[b+1],i[b+2]);l.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
- THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
- THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
- THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(m in z.objects)if(!I.objects[m]){w=z.objects[m];if(w.geometry!==void 0){if(Q=I.geometries[w.geometry]){a=false;R=I.materials[w.materials[0]];(a=R instanceof THREE.ShaderMaterial)&&Q.computeTangents();t=w.position;L=w.rotation;A=w.quaternion;G=w.scale;p=w.matrix;A=0;w.materials.length==0&&(R=new THREE.MeshFaceMaterial);w.materials.length>1&&(R=new THREE.MeshFaceMaterial);
- a=new THREE.Mesh(Q,R);a.name=m;if(p){a.matrixAutoUpdate=false;a.matrix.set(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15])}else{a.position.set(t[0],t[1],t[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(L[0],L[1],L[2]);a.scale.set(G[0],G[1],G[2])}a.visible=w.visible;a.doubleSided=w.doubleSided;a.castShadow=w.castShadow;a.receiveShadow=w.receiveShadow;I.scene.add(a);I.objects[m]=a}}else{t=w.position;L=w.rotation;A=w.quaternion;
- G=w.scale;A=0;a=new THREE.Object3D;a.name=m;a.position.set(t[0],t[1],t[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(L[0],L[1],L[2]);a.scale.set(G[0],G[1],G[2]);a.visible=w.visible!==void 0?w.visible:false;I.scene.add(a);I.objects[m]=a;I.empties[m]=a}}}function f(a){return function(b){I.geometries[a]=b;e();Z=Z-1;k.onLoadComplete();j()}}function h(a){return function(b){I.geometries[a]=b}}function j(){k.callbackProgress({totalModels:g,totalTextures:W,loadedModels:g-
- Z,loadedTextures:W-F},I);k.onLoadProgress();Z==0&&F==0&&b(I)}var k=this,l=THREE.Loader.prototype.extractUrlBase(c),i,o,m,v,r,n,q,w,p,D,C,t,L,A,G,E,M,Q,R,H,S,z,K,Z,F,g,W,I;z=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;F=Z=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;D=z.transform.rotation;E=z.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);D&&I.scene.rotation.set(D[0],D[1],
- D[2]);E&&I.scene.scale.set(E[0],E[1],E[2]);if(a||D||E){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(){F=F-1;j();k.onLoadComplete()};for(r in z.cameras){E=z.cameras[r];E.type=="perspective"?H=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type=="ortho"&&(H=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far));t=E.position;D=E.target;E=E.up;H.position.set(t[0],t[1],t[2]);H.target=new THREE.Vector3(D[0],D[1],D[2]);E&&H.up.set(E[0],E[1],E[2]);I.cameras[r]=
- H}for(v in z.lights){D=z.lights[v];r=D.color!==void 0?D.color:16777215;H=D.intensity!==void 0?D.intensity:1;if(D.type=="directional"){t=D.direction;C=new THREE.DirectionalLight(r,H);C.position.set(t[0],t[1],t[2]);C.position.normalize()}else if(D.type=="point"){t=D.position;C=D.distance;C=new THREE.PointLight(r,H,C);C.position.set(t[0],t[1],t[2])}else D.type=="ambient"&&(C=new THREE.AmbientLight(r));I.scene.add(C);I.lights[v]=C}for(n in z.fogs){v=z.fogs[n];v.type=="linear"?S=new THREE.Fog(0,v.near,
- v.far):v.type=="exp2"&&(S=new THREE.FogExp2(0,v.density));E=v.color;S.color.setRGB(E[0],E[1],E[2]);I.fogs[n]=S}if(I.cameras&&z.defaults.camera)I.currentCamera=I.cameras[z.defaults.camera];if(I.fogs&&z.defaults.fog)I.scene.fog=I.fogs[z.defaults.fog];E=z.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(E[0],E[1],E[2]);I.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){n=z.geometries[i];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){Z=Z+1;k.onLoadStart()}}g=Z;for(i in z.geometries){n=
- z.geometries[i];if(n.type=="cube"){Q=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);I.geometries[i]=Q}else if(n.type=="plane"){Q=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=Q}else if(n.type=="sphere"){Q=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=Q}else if(n.type=="cylinder"){Q=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
- n.heightSegs);I.geometries[i]=Q}else if(n.type=="torus"){Q=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);I.geometries[i]=Q}else if(n.type=="icosahedron"){Q=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);I.geometries[i]=Q}else if(n.type=="bin_mesh")c.load(d(n.url,z.urlBaseType),f(i));else if(n.type=="ascii_mesh")K.load(d(n.url,z.urlBaseType),f(i));else if(n.type=="embedded_mesh"){n=z.embeds[n.id];n.metadata=z.metadata;n&&K.createModel(n,h(i),"")}}for(q in z.textures){i=z.textures[q];
- if(i.url instanceof Array){F=F+i.url.length;for(n=0;n<i.url.length;n++)k.onLoadStart()}else{F=F+1;k.onLoadStart()}}W=F;for(q in z.textures){i=z.textures[q];if(i.mapping!=void 0&&THREE[i.mapping]!=void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){n=[];for(S=0;S<i.url.length;S++)n[S]=d(i.url[S],z.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,i.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(i.url,z.urlBaseType),i.mapping,a);if(THREE[i.minFilter]!=void 0)n.minFilter=THREE[i.minFilter];
- if(THREE[i.magFilter]!=void 0)n.magFilter=THREE[i.magFilter];if(i.repeat){n.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}i.offset&&n.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)n.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)n.wrapT=S[i.wrap[1]]}}I.textures[q]=n}for(o in z.materials){p=z.materials[o];for(M in p.parameters)if(M==
- "envMap"||M=="map"||M=="lightMap")p.parameters[M]=I.textures[p.parameters[M]];else if(M=="shading")p.parameters[M]=p.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")p.parameters[M]=THREE[p.parameters[M]]?THREE[p.parameters[M]]:THREE.NormalBlending;else if(M=="combine")p.parameters[M]=p.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(p.parameters[M]=="face")p.parameters[M]=THREE.FaceColors;else if(p.parameters[M])p.parameters[M]=
- THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=true;if(p.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);i=p.parameters.color;n=p.parameters.specular;S=p.parameters.ambient;c=p.parameters.shininess;a.tNormal.texture=I.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=p.parameters.normalMapFactor;if(p.parameters.map){a.tDiffuse.texture=p.parameters.map;a.enableDiffuse.value=
- true}if(p.parameters.lightMap){a.tAO.texture=p.parameters.lightMap;a.enableAO.value=true}if(p.parameters.specularMap){a.tSpecular.texture=I.textures[p.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;R=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else R=
- new THREE[p.type](p.parameters);I.materials[o]=R}e();k.callbackSync(I);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
- THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
- THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
- a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;
- THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;
- THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
- THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
- THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
- true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==
- void 0?a.morphTargets:false};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=
- a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?
- a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
- THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.emissive=a.emissive!==void 0?new THREE.Color(a.emissive):new THREE.Color(0);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:false;this.perPixel=
- a.perPixel!==void 0?a.perPixel:false;this.wrapAround=a.wrapAround!==void 0?a.wrapAround:false;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:true;this.shading=
- a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?
- a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};
- THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;
- THREE.MeshFaceMaterial=function(){};THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};THREE.ParticleBasicMaterial.prototype=new THREE.Material;
- THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
- a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
- THREE.Texture=function(a,b,c,d,e,f,h,j){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=h!==void 0?h:THREE.RGBAFormat;this.type=j!==void 0?j:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
- true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.UnsignedByteType=9;THREE.ByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
- THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,e,f,h,j,k,l){THREE.Texture.call(this,null,f,h,j,k,l,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
- THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
- THREE.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=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
- this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};
- THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.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){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,e,f,h,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];f=e.pos;h=e.rotq;j=e.scl;d=this.addBone();d.name=e.name;d.position.set(f[0],f[1],f[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=true;j!==void 0?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=this.geometry.bones[c];
- d=this.bones[c];e.parent===-1?this.add(d):this.bones[e.parent].add(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;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)};
- 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=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
- 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=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=true};THREE.SpriteAlignment={};
- THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);
- THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
- THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
- THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
- THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
- THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
- envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
- lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngle[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
- lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nlVector = normalize( lVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - mPosition.xyz ) );\nif ( spotEffect > spotLightAngle[ i ] ) {\nspotEffect = pow( spotEffect, spotLightExponent[ i ] );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",
- lights_phong_pars_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvarying vec3 vWorldPosition;\n#endif",lights_phong_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvWorldPosition = mPosition.xyz;\n#endif",
- lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngle[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
- lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngle[ i ] ) {\nspotEffect = pow( spotEffect, spotLightExponent[ i ] );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * modelViewMatrix * gl_Position;\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;\nvec3 transformedNormal = normalMatrix * morphedNormal;\n#else\nvec3 transformedNormal = normalMatrix * normal;\n#endif",
- shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
- shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n#ifdef USE_MORPHTARGETS\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( morphed, 1.0 );\n#else\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n#endif\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",
- linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
- THREE.UniformsUtils={merge:function(a){var b,c,d,e={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)e[c]=d[c]}return e},clone:function(a){var b,c,d,e={};for(b in a){e[b]={};for(c in a[b]){d=a[b][c];e[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d}}return e}};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
- value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",
- value:[]},spotLightAngle:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",
- value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalMatrix * normal;\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
- THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
- THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
- THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,
- 1,1)}}]),vertexShader:["varying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,
- THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif",THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",
- THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},
- shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
- THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.morphnormal_vertex,"vNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),
- fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
- THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",
- THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
- THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
- THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
- THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=g.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
- function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,h,i=a.vertices;h=i.length;
- var j=a.colors,k=j.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,r=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){Qb.copy(Rb);Qb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){e=i[d];Oa.copy(e);Qb.multiplyVector3(Oa);n[d]=[Oa.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){e=i[n[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(q){j=0;for(k=q.length;j<k;j++){i=q[j];
- if(i.boundTo===void 0||i.boundTo==="vertices"){f=0;e=i.value.length;if(i.size===1)for(d=0;d<e;d++){h=n[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<e;d++){h=n[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===3)if(i.type==="c")for(d=0;d<e;d++){h=n[d][1];h=i.value[h];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=n[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=n[d][1];
- h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}else{if(o)for(d=0;d<h;d++){e=i[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(r)for(d=0;d<k;d++){e=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.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")){e=i.value.length;f=0;if(i.size===1)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===
- 3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,l,b)}if(r||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
- m,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 j(a,b){return b[1]-a[1]}function k(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){ga=za=null;na=ca=Ha=Ba=nb=Xa=Ia=-1;ob=true;a[d].render(b,c,$b,ac);ga=za=null;na=ca=Ha=Ba=nb=Xa=Ia=-1;ob=true}}function l(a,b,c,d,g,e,f,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 m=j;m!==
- b;m=m+l){i=a[m];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;f&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);p(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,e,i,k,j):F.renderBuffer(d,g,e,i,k,j)}}}function i(a,b,c,d,g,e,f){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(f)h=f;else{h=
- h[b];if(!h)continue;e&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);p(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.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 v(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,
- b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function 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,e){if(d.needsUpdate){d.program&&F.deallocateMaterial(d);F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var f=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==za){g.useProgram(h);za=h;f=true}if(d.id!==na){na=d.id;f=true}if(f||a!==ga){g.uniformMatrix4fv(i.projectionMatrix,
- false,a._projectionMatrixArray);a!==ga&&(ga=a)}if(f){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(ob){for(var k,l=0,m=0,n=0,o,q,r,p=bc,v=p.directional.colors,w=p.directional.positions,t=p.point.colors,z=p.point.positions,D=p.point.distances,E=p.spot.colors,I=p.spot.positions,L=p.spot.distances,
- K=p.spot.directions,M=p.spot.angles,Q=p.spot.exponents,S=0,R=0,T=0,H=r=0,c=H=0,f=b.length;c<f;c++){k=b[c];if(!k.onlyShadow){o=k.color;q=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(k instanceof THREE.DirectionalLight){r=S*3;if(F.gammaInput){v[r]=o.r*o.r*q*q;v[r+1]=o.g*o.g*q*q;v[r+2]=o.b*o.b*q*q}else{v[r]=o.r*q;v[r+1]=o.g*q;v[r+2]=o.b*q}Ca.copy(k.matrixWorld.getPosition());Ca.subSelf(k.target.matrixWorld.getPosition());
- Ca.normalize();w[r]=Ca.x;w[r+1]=Ca.y;w[r+2]=Ca.z;S=S+1}else if(k instanceof THREE.PointLight){H=R*3;if(F.gammaInput){t[H]=o.r*o.r*q*q;t[H+1]=o.g*o.g*q*q;t[H+2]=o.b*o.b*q*q}else{t[H]=o.r*q;t[H+1]=o.g*q;t[H+2]=o.b*q}o=k.matrixWorld.getPosition();z[H]=o.x;z[H+1]=o.y;z[H+2]=o.z;D[R]=r;R=R+1}else if(k instanceof THREE.SpotLight){H=T*3;if(F.gammaInput){E[H]=o.r*o.r*q*q;E[H+1]=o.g*o.g*q*q;E[H+2]=o.b*o.b*q*q}else{E[H]=o.r*q;E[H+1]=o.g*q;E[H+2]=o.b*q}o=k.matrixWorld.getPosition();I[H]=o.x;I[H+1]=o.y;I[H+2]=
- o.z;L[T]=r;Ca.copy(o);Ca.subSelf(k.target.matrixWorld.getPosition());Ca.normalize();K[H]=Ca.x;K[H+1]=Ca.y;K[H+2]=Ca.z;M[T]=Math.cos(k.angle);Q[T]=k.exponent;T=T+1}}}c=S*3;for(f=v.length;c<f;c++)v[c]=0;c=R*3;for(f=t.length;c<f;c++)t[c]=0;c=T*3;for(f=E.length;c<f;c++)E[c]=0;p.directional.length=S;p.point.length=R;p.spot.length=T;p.ambient[0]=l;p.ambient[1]=m;p.ambient[2]=n;ob=false}c=bc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
- c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=
- d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
- THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=G.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;
- j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=
- d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){f=c=0;for(k=b.length;f<k;f++){l=b[f];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){j.shadowMap.texture[c]=l.shadowMap;j.shadowMapSize.value[c]=l.shadowMapSize;j.shadowMatrix.value[c]=l.shadowMatrix;j.shadowDarkness.value[c]=l.shadowDarkness;j.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(l=h.uniforms[b[j][1]]){f=b[j][0];m=f.type;k=f.value;
- switch(m){case "i":g.uniform1i(l,k);break;case "f":g.uniform1f(l,k);break;case "v2":g.uniform2f(l,k.x,k.y);break;case "v3":g.uniform3f(l,k.x,k.y,k.z);break;case "v4":g.uniform4f(l,k.x,k.y,k.z,k.w);break;case "c":g.uniform3f(l,k.r,k.g,k.b);break;case "fv1":g.uniform1fv(l,k);break;case "fv":g.uniform3fv(l,k);break;case "v2v":if(!f._array)f._array=new Float32Array(2*k.length);m=0;for(n=k.length;m<n;m++){p=m*2;f._array[p]=k[m].x;f._array[p+1]=k[m].y}g.uniform2fv(l,f._array);break;case "v3v":if(!f._array)f._array=
- new Float32Array(3*k.length);m=0;for(n=k.length;m<n;m++){p=m*3;f._array[p]=k[m].x;f._array[p+1]=k[m].y;f._array[p+2]=k[m].z}g.uniform3fv(l,f._array);break;case "v4v":if(!f._array)f._array=new Float32Array(4*k.length);m=0;for(n=k.length;m<n;m++){p=m*4;f._array[p]=k[m].x;f._array[p+1]=k[m].y;f._array[p+2]=k[m].z;f._array[p+3]=k[m].w}g.uniform4fv(l,f._array);break;case "m4":if(!f._array)f._array=new Float32Array(16);k.flattenToArray(f._array);g.uniformMatrix4fv(l,false,f._array);break;case "m4v":if(!f._array)f._array=
- new Float32Array(16*k.length);m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(f._array,m*16);g.uniformMatrix4fv(l,false,f._array);break;case "t":g.uniform1i(l,k);l=f.texture;if(!l)continue;if(l.image instanceof Array&&l.image.length===6){f=l;if(f.image.length===6)if(f.needsUpdate){if(!f.image.__webglTextureCube)f.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,f.image.__webglTextureCube);k=[];for(l=0;l<6;l++){m=k;n=l;if(F.autoScaleCubemaps){p=
- f.image[l];w=Kc;if(!(p.width<=w&&p.height<=w)){t=Math.max(p.width,p.height);v=Math.floor(p.width*w/t);w=Math.floor(p.height*w/t);t=document.createElement("canvas");t.width=v;t.height=w;t.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,v,w);p=t}}else p=f.image[l];m[n]=p}l=k[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=A(f.format);p=A(f.type);C(g.TEXTURE_CUBE_MAP,f,m);for(l=0;l<6;l++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,p,k[l]);f.generateMipmaps&&m&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
- f.needsUpdate=false;if(f.onUpdate)f.onUpdate()}else{g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,f.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){f=l;g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,f.__webglTexture)}else F.setTexture(l,k);break;case "tv":if(!f._array){f._array=[];m=0;for(n=f.texture.length;m<n;m++)f._array[m]=k+m}g.uniform1iv(l,f._array);m=0;for(n=f.texture.length;m<n;m++)(l=f.texture[m])&&F.setTexture(l,f._array[m])}}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);d.skinning&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,e.boneMatrices)}g.uniformMatrix4fv(i.modelViewMatrix,false,e._modelViewMatrix.elements);
- i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,e._normalMatrix.elements);i.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,e.matrixWorld.elements);return h}function w(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function p(a,b,c){if(sc!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);sc=a}if(a&&(tc!==b||uc!==c)){g.polygonOffset(b,c);tc=b;uc=c}}function D(a,
- b){var c;a==="fragment"?c=g.createShader(g.FRAGMENT_SHADER):a==="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS)){console.error(g.getShaderInfoLog(c));console.error(b);return null}return c}function C(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,A(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,A(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,A(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,A(b.minFilter))}else{g.texParameteri(a,
- g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_MAG_FILTER,L(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,L(b.minFilter))}}function t(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 L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;
- case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.UnsignedShort4444Type:return g.UNSIGNED_SHORT_4_4_4_4;case THREE.UnsignedShort5551Type:return g.UNSIGNED_SHORT_5_5_5_1;
- case THREE.UnsignedShort565Type:return g.UNSIGNED_SHORT_5_6_5;case THREE.ByteType:return g.BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedIntType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA;
- case THREE.AddEquation:return g.FUNC_ADD;case THREE.SubtractEquation:return g.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return g.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return g.ZERO;case THREE.OneFactor:return g.ONE;case THREE.SrcColorFactor:return g.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return g.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return g.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return g.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return g.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return g.ONE_MINUS_DST_ALPHA;
- case THREE.DstColorFactor:return g.DST_COLOR;case THREE.OneMinusDstColorFactor:return g.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return g.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),E=a.precision!==void 0?a.precision:"highp",M=a.alpha!==void 0?a.alpha:true,Q=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,R=a.antialias!==void 0?a.antialias:false,H=a.stencil!==void 0?a.stencil:
- true,S=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==void 0?a.clearAlpha:0,Z=a.maxLights!==void 0?a.maxLights:4;this.domElement=G;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
- this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var F=this,g,W=[],I=0,za=null,T=null,na=-1,ca=null,ga=null,oa=0,Ba=-1,Ha=-1,Ia=-1,Sa=-1,Ua=-1,Na=-1,Xa=-1,nb=-1,sc=null,tc=null,uc=null,Hb=null,Ib=0,cc=0,Jb=0,Kb=0,$b=0,ac=0,dc=new THREE.Frustum,
- Rb=new THREE.Matrix4,Qb=new THREE.Matrix4,Oa=new THREE.Vector4,Ca=new THREE.Vector3,ob=true,bc={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=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:Q,antialias:R,stencil:H,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";}catch(b){console.error(b)}a.getExtension("OES_texture_float")||
- console.log("THREE.WebGLRenderer: Float textures not supported.");return a}();g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(z.r,z.g,z.b,K);this.context=g;var ec=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Kc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);
- this.getContext=function(){return g};this.supportsVertexTextures=function(){return ec>0};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){Ib=a;cc=b;Jb=c;Kb=d;g.viewport(Ib,cc,Jb,Kb)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){z.setHex(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.setClearColor=function(a,
- b){z.copy(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return K};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._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);
- g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)g.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=
- void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}F.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;g.deleteBuffer(a.__webglVertexBuffer);
- g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;g.deleteTexture(a.__webglTexture);F.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){g.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){g.deleteFramebuffer(a.__webglFramebuffer[b]);g.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{g.deleteFramebuffer(a.__webglFramebuffer);
- g.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=W.length;a<c;a++){d=W[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=W.length;a<c;a++){d=W[a];d.program!==b&&e.push(d)}W=e;g.deleteProgram(b);F.info.memory.programs--}}};this.updateShadowMap=function(a,b){za=null;na=ca=nb=Xa=Ia=-1;ob=true;Ha=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,m,o,n,q=a.count*3;for(n=0;n<q;n=n+9){o=a.normalArray;d=o[n];e=o[n+1];f=o[n+2];h=o[n+3];j=o[n+4];l=o[n+5];i=o[n+6];k=o[n+7];m=o[n+8];d=(d+h+i)/3;e=(e+j+k)/3;f=(f+l+m)/3;o[n]=d;o[n+1]=e;o[n+2]=f;o[n+3]=d;o[n+4]=e;o[n+5]=f;o[n+6]=d;o[n+7]=e;o[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!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){g.bindBuffer(g.ARRAY_BUFFER,e.vertexPositionBuffer);g.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,g.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){g.bindBuffer(g.ARRAY_BUFFER,
- e.vertexNormalBuffer);g.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,g.FLOAT,false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.vertexUvBuffer);g.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,g.FLOAT,false,0,f[d].index*8);g.enableVertexAttribArray(a.uv)}else g.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.vertexColorBuffer);g.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,
- g.FLOAT,false,0,f[d].index*16)}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,f[d].start*2);F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+f[d].count;F.info.render.faces=F.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var h,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){g.bindBuffer(g.ARRAY_BUFFER,
- e.__webglVertexBuffer);g.vertexAttribPointer(b.position,3,g.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}else if(c.position>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer);g.vertexAttribPointer(c.position,3,g.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;k<
- d.numSupportedMorphTargets&&k<i.length;){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[k]]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[k]]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[i[k]];k++}}else{i=[];h=f.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){k=h[l];k>0&&i.push([l,k])}if(i.length>d.numSupportedMorphTargets){i.sort(j);
- i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(j):i.length===0&&i.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(i[k]){l=i[k][0];g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+k],3,g.FLOAT,false,0,0);if(d.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=h[l]}else{g.vertexAttribPointer(c["morphTarget"+
- k],3,g.FLOAT,false,0,0);d.morphNormals&&g.vertexAttribPointer(c["morphNormal"+k],3,g.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==null&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){h=0;for(i=e.__webglCustomAttributesList.length;h<i;h++){c=e.__webglCustomAttributesList[h];if(b[c.buffer.belongsToAttribute]>=0){g.bindBuffer(g.ARRAY_BUFFER,c.buffer);g.vertexAttribPointer(b[c.buffer.belongsToAttribute],
- c.size,g.FLOAT,false,0,0)}}}if(b.color>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer);g.vertexAttribPointer(b.color,3,g.FLOAT,false,0,0)}if(b.normal>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer);g.vertexAttribPointer(b.normal,3,g.FLOAT,false,0,0)}if(b.tangent>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer);g.vertexAttribPointer(b.tangent,4,g.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer);g.vertexAttribPointer(b.uv,2,g.FLOAT,
- false,0,0);g.enableVertexAttribArray(b.uv)}else g.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer);g.vertexAttribPointer(b.uv2,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv2)}else g.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer);g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,
- e.__webglSkinVertexBBuffer);g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Hb){g.lineWidth(d);Hb=d}a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);g.drawElements(g.LINES,e.__webglLineCount,
- g.UNSIGNED_SHORT,0)}else{a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==Hb){g.lineWidth(d);Hb=d}g.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof
- THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,m,o=a.__lights,n=a.fog;na=-1;ob=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();
- if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Rb.multiply(b.projectionMatrix,b.matrixWorldInverse);dc.setFromMatrix(Rb);this.autoUpdateObjects&&this.initWebGLObjects(a);k(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=
- 0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||dc.contains(j))){w(j,b);var q=f,r=q.object,v=q.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=v.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){q.transparent=
- t;q.opaque=null}else{q.opaque=t;q.transparent=null}}}else if(t)if(t.transparent){q.transparent=t;q.opaque=null}else{q.opaque=t;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{Oa.copy(j.matrixWorld.getPosition());Rb.multiplyVector3(Oa);f.z=Oa.z}}}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;if(j.visible){w(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=
- null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);p(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);l(a.__webglObjects,false,"",b,o,n,true,d);i(a.__webglObjectsImmediate,"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);l(a.__webglObjects,true,"opaque",b,o,n,false);i(a.__webglObjectsImmediate,"opaque",b,o,n,false);l(a.__webglObjects,false,"transparent",
- b,o,n,true);i(a.__webglObjectsImmediate,"transparent",b,o,n,true)}k(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);ca=-1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,dc):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,l=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;
- h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,p=void 0,t=void 0,w=void 0,z=void 0,C=void 0,A=void 0,D=void 0,E={},I=q.morphTargets.length,K=q.morphNormals.length;q.geometryGroups={};p=0;for(t=q.faces.length;p<t;p++){w=q.faces[p];z=w.materialIndex;A=z!==void 0?z:-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:z,vertices:0,numMorphTargets:I,numMorphNormals:K});C=w instanceof THREE.Face3?3:4;if(q.geometryGroups[D].vertices+C>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:z,vertices:0,numMorphTargets:I,numMorphNormals:K})}w instanceof THREE.Face3?q.geometryGroups[D].faces3.push(p):q.geometryGroups[D].faces4.push(p);q.geometryGroups[D].vertices=q.geometryGroups[D].vertices+C}q.geometryGroupsList=
- [];var L=void 0;for(L in q.geometryGroups){q.geometryGroups[L].id=oa++;q.geometryGroupsList.push(q.geometryGroups[L])}}for(j in k.geometryGroups){l=k.geometryGroups[j];if(!l.__webglVertexBuffer){var H=l;H.__webglVertexBuffer=g.createBuffer();H.__webglNormalBuffer=g.createBuffer();H.__webglTangentBuffer=g.createBuffer();H.__webglColorBuffer=g.createBuffer();H.__webglUVBuffer=g.createBuffer();H.__webglUV2Buffer=g.createBuffer();H.__webglSkinVertexABuffer=g.createBuffer();H.__webglSkinVertexBBuffer=
- g.createBuffer();H.__webglSkinIndicesBuffer=g.createBuffer();H.__webglSkinWeightsBuffer=g.createBuffer();H.__webglFaceBuffer=g.createBuffer();H.__webglLineBuffer=g.createBuffer();var M=void 0,Q=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];M=0;for(Q=H.numMorphTargets;M<Q;M++)H.__webglMorphTargetsBuffers.push(g.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];M=0;for(Q=H.numMorphNormals;M<Q;M++)H.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;
- var G=l,S=h,R=S.geometry,T=G.faces3,Z=G.faces4,W=T.length*3+Z.length*4,ca=T.length*1+Z.length*2,na=T.length*3+Z.length*4,ga=c(S,G),za=e(ga),Ba=d(ga),Ha=ga.vertexColors?ga.vertexColors:false;G.__vertexArray=new Float32Array(W*3);if(Ba)G.__normalArray=new Float32Array(W*3);if(R.hasTangents)G.__tangentArray=new Float32Array(W*4);if(Ha)G.__colorArray=new Float32Array(W*3);if(za){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)G.__uvArray=new Float32Array(W*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
- 1)G.__uv2Array=new Float32Array(W*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(W*4);G.__skinVertexBArray=new Float32Array(W*4);G.__skinIndexArray=new Float32Array(W*4);G.__skinWeightArray=new Float32Array(W*4)}G.__faceArray=new Uint16Array(ca*3);G.__lineArray=new Uint16Array(na*2);var Ca=void 0,Ia=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];Ca=0;for(Ia=G.numMorphTargets;Ca<Ia;Ca++)G.__morphTargetsArrays.push(new Float32Array(W*
- 3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];Ca=0;for(Ia=G.numMorphNormals;Ca<Ia;Ca++)G.__morphNormalsArrays.push(new Float32Array(W*3))}G.__webglFaceCount=ca*3;G.__webglLineCount=na*2;if(ga.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Na=void 0;for(Na in ga.attributes){var Sa=ga.attributes[Na],Ma={},Ua;for(Ua in Sa)Ma[Ua]=Sa[Ua];if(!Ma.__webglInitialized||Ma.createUniqueBuffers){Ma.__webglInitialized=true;var Oa=1;Ma.type==="v2"?Oa=2:Ma.type===
- "v3"?Oa=3:Ma.type==="v4"?Oa=4:Ma.type==="c"&&(Oa=3);Ma.size=Oa;Ma.array=new Float32Array(W*Oa);Ma.buffer=g.createBuffer();Ma.buffer.belongsToAttribute=Na;Sa.needsUpdate=true;Ma.__original=Sa}G.__webglCustomAttributesList.push(Ma)}}G.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangetsNeedUpdate=true;k.colorsNeedUpdate=true}}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var ob=
- k;ob.__webglVertexBuffer=g.createBuffer();ob.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var Xa=k,nb=Xa.vertices.length;Xa.__vertexArray=new Float32Array(nb*3);Xa.__colorArray=new Float32Array(nb*3);Xa.__webglVertexCount=nb;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var Hb=k;Hb.__webglVertexBuffer=g.createBuffer();Hb.__webglColorBuffer=g.createBuffer();F.info.memory.geometries++;var fc=k,Rb=h,Ib=fc.vertices.length;
- fc.__vertexArray=new Float32Array(Ib*3);fc.__colorArray=new Float32Array(Ib*3);fc.__webglLineCount=Ib;b(fc,Rb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Qb=k;Qb.__webglVertexBuffer=g.createBuffer();Qb.__webglColorBuffer=g.createBuffer();F.info.geometries++;var Sb=k,cc=h,Jb=Sb.vertices.length;Sb.__vertexArray=new Float32Array(Jb*3);Sb.__colorArray=new Float32Array(Jb*3);Sb.__sortArray=[];Sb.__webglParticleCount=
- Jb;b(Sb,cc);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 Pa=a.__objectsRemoved[0],vc=a;Pa instanceof THREE.Mesh||Pa instanceof THREE.ParticleSystem||Pa instanceof THREE.Ribbon||Pa instanceof THREE.Line?r(vc.__webglObjects,Pa):Pa instanceof THREE.Sprite?n(vc.__webglSprites,Pa):Pa instanceof THREE.LensFlare?n(vc.__webglFlares,Pa):(Pa instanceof
- THREE.ImmediateRenderObject||Pa.immediateRenderCallback)&&r(vc.__webglObjectsImmediate,Pa);Pa.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Kb=0,dc=a.__webglObjects.length;Kb<dc;Kb++){var Va=a.__webglObjects[Kb].object,Y=Va.geometry,gc=void 0,Tb=void 0,Fa=void 0;if(Va instanceof THREE.Mesh)if(Y instanceof THREE.BufferGeometry){Y.verticesNeedUpdate=false;Y.elementsNeedUpdate=false;Y.uvsNeedUpdate=false;Y.normalsNeedUpdate=false;Y.colorsNeedUpdate=false}else{for(var Lc=0,sc=Y.geometryGroupsList.length;Lc<
- sc;Lc++){gc=Y.geometryGroupsList[Lc];Fa=c(Va,gc);Tb=Fa.attributes&&m(Fa);if(Y.verticesNeedUpdate||Y.morphTargetsNeedUpdate||Y.elementsNeedUpdate||Y.uvsNeedUpdate||Y.normalsNeedUpdate||Y.colorsNeedUpdate||Y.tangetsNeedUpdate||Tb){var V=gc,tc=Va,Ja=g.DYNAMIC_DRAW,uc=!Y.dynamic,Lb=Fa;if(V.__inittedArrays){var $b=d(Lb),Mc=Lb.vertexColors?Lb.vertexColors:false,ac=e(Lb),wc=$b===THREE.SmoothShading,x=void 0,J=void 0,Ta=void 0,B=void 0,Ub=void 0,ub=void 0,Wa=void 0,xc=void 0,pb=void 0,Vb=void 0,Wb=void 0,
- N=void 0,O=void 0,P=void 0,da=void 0,Ya=void 0,Za=void 0,$a=void 0,hc=void 0,ab=void 0,bb=void 0,cb=void 0,ic=void 0,db=void 0,eb=void 0,fb=void 0,jc=void 0,gb=void 0,hb=void 0,ib=void 0,kc=void 0,jb=void 0,kb=void 0,lb=void 0,lc=void 0,vb=void 0,wb=void 0,xb=void 0,yc=void 0,yb=void 0,zb=void 0,Ab=void 0,zc=void 0,$=void 0,bc=void 0,Bb=void 0,Xb=void 0,Yb=void 0,va=void 0,ec=void 0,ta=void 0,ua=void 0,Cb=void 0,qb=void 0,pa=0,sa=0,rb=0,sb=0,Qa=0,Aa=0,ea=0,Da=0,qa=0,y=0,U=0,u=0,Ka=void 0,wa=V.__vertexArray,
- mc=V.__uvArray,nc=V.__uv2Array,Ra=V.__normalArray,ha=V.__tangentArray,xa=V.__colorArray,ia=V.__skinVertexAArray,ja=V.__skinVertexBArray,ka=V.__skinIndexArray,la=V.__skinWeightArray,Nc=V.__morphTargetsArrays,Oc=V.__morphNormalsArrays,Pc=V.__webglCustomAttributesList,s=void 0,mb=V.__faceArray,La=V.__lineArray,Ea=tc.geometry,Kc=Ea.elementsNeedUpdate,Uc=Ea.uvsNeedUpdate,ad=Ea.normalsNeedUpdate,bd=Ea.tangetsNeedUpdate,cd=Ea.colorsNeedUpdate,dd=Ea.morphTargetsNeedUpdate,Mb=Ea.vertices,aa=V.faces3,ba=V.faces4,
- ra=Ea.faces,Qc=Ea.faceVertexUvs[0],Rc=Ea.faceVertexUvs[1],Nb=Ea.skinVerticesA,Ob=Ea.skinVerticesB,Pb=Ea.skinIndices,Db=Ea.skinWeights,Eb=Ea.morphTargets,Ac=Ea.morphNormals;if(Ea.verticesNeedUpdate){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=Mb[B.a];O=Mb[B.b];P=Mb[B.c];wa[sa]=N.x;wa[sa+1]=N.y;wa[sa+2]=N.z;wa[sa+3]=O.x;wa[sa+4]=O.y;wa[sa+5]=O.z;wa[sa+6]=P.x;wa[sa+7]=P.y;wa[sa+8]=P.z;sa=sa+9}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=Mb[B.a];O=Mb[B.b];P=Mb[B.c];da=Mb[B.d];wa[sa]=N.x;wa[sa+1]=N.y;wa[sa+
- 2]=N.z;wa[sa+3]=O.x;wa[sa+4]=O.y;wa[sa+5]=O.z;wa[sa+6]=P.x;wa[sa+7]=P.y;wa[sa+8]=P.z;wa[sa+9]=da.x;wa[sa+10]=da.y;wa[sa+11]=da.z;sa=sa+12}g.bindBuffer(g.ARRAY_BUFFER,V.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,wa,Ja)}if(dd){va=0;for(ec=Eb.length;va<ec;va++){x=U=0;for(J=aa.length;x<J;x++){Cb=aa[x];B=ra[Cb];N=Eb[va].vertices[B.a];O=Eb[va].vertices[B.b];P=Eb[va].vertices[B.c];ta=Nc[va];ta[U]=N.x;ta[U+1]=N.y;ta[U+2]=N.z;ta[U+3]=O.x;ta[U+4]=O.y;ta[U+5]=O.z;ta[U+6]=P.x;ta[U+7]=P.y;ta[U+8]=P.z;if(Lb.morphNormals){if(wc){qb=
- Ac[va].vertexNormals[Cb];ab=qb.a;bb=qb.b;cb=qb.c}else cb=bb=ab=Ac[va].faceNormals[Cb];ua=Oc[va];ua[U]=ab.x;ua[U+1]=ab.y;ua[U+2]=ab.z;ua[U+3]=bb.x;ua[U+4]=bb.y;ua[U+5]=bb.z;ua[U+6]=cb.x;ua[U+7]=cb.y;ua[U+8]=cb.z}U=U+9}x=0;for(J=ba.length;x<J;x++){Cb=ba[x];B=ra[Cb];N=Eb[va].vertices[B.a];O=Eb[va].vertices[B.b];P=Eb[va].vertices[B.c];da=Eb[va].vertices[B.d];ta=Nc[va];ta[U]=N.x;ta[U+1]=N.y;ta[U+2]=N.z;ta[U+3]=O.x;ta[U+4]=O.y;ta[U+5]=O.z;ta[U+6]=P.x;ta[U+7]=P.y;ta[U+8]=P.z;ta[U+9]=da.x;ta[U+10]=da.y;ta[U+
- 11]=da.z;if(Lb.morphNormals){if(wc){qb=Ac[va].vertexNormals[Cb];ab=qb.a;bb=qb.b;cb=qb.c;ic=qb.d}else ic=cb=bb=ab=Ac[va].faceNormals[Cb];ua=Oc[va];ua[U]=ab.x;ua[U+1]=ab.y;ua[U+2]=ab.z;ua[U+3]=bb.x;ua[U+4]=bb.y;ua[U+5]=bb.z;ua[U+6]=cb.x;ua[U+7]=cb.y;ua[U+8]=cb.z;ua[U+9]=ic.x;ua[U+10]=ic.y;ua[U+11]=ic.z}U=U+12}g.bindBuffer(g.ARRAY_BUFFER,V.__webglMorphTargetsBuffers[va]);g.bufferData(g.ARRAY_BUFFER,Nc[va],Ja);if(Lb.morphNormals){g.bindBuffer(g.ARRAY_BUFFER,V.__webglMorphNormalsBuffers[va]);g.bufferData(g.ARRAY_BUFFER,
- Oc[va],Ja)}}}if(Db.length){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];gb=Db[B.a];hb=Db[B.b];ib=Db[B.c];la[y]=gb.x;la[y+1]=gb.y;la[y+2]=gb.z;la[y+3]=gb.w;la[y+4]=hb.x;la[y+5]=hb.y;la[y+6]=hb.z;la[y+7]=hb.w;la[y+8]=ib.x;la[y+9]=ib.y;la[y+10]=ib.z;la[y+11]=ib.w;jb=Pb[B.a];kb=Pb[B.b];lb=Pb[B.c];ka[y]=jb.x;ka[y+1]=jb.y;ka[y+2]=jb.z;ka[y+3]=jb.w;ka[y+4]=kb.x;ka[y+5]=kb.y;ka[y+6]=kb.z;ka[y+7]=kb.w;ka[y+8]=lb.x;ka[y+9]=lb.y;ka[y+10]=lb.z;ka[y+11]=lb.w;vb=Nb[B.a];wb=Nb[B.b];xb=Nb[B.c];ia[y]=vb.x;ia[y+1]=vb.y;
- ia[y+2]=vb.z;ia[y+3]=1;ia[y+4]=wb.x;ia[y+5]=wb.y;ia[y+6]=wb.z;ia[y+7]=1;ia[y+8]=xb.x;ia[y+9]=xb.y;ia[y+10]=xb.z;ia[y+11]=1;yb=Ob[B.a];zb=Ob[B.b];Ab=Ob[B.c];ja[y]=yb.x;ja[y+1]=yb.y;ja[y+2]=yb.z;ja[y+3]=1;ja[y+4]=zb.x;ja[y+5]=zb.y;ja[y+6]=zb.z;ja[y+7]=1;ja[y+8]=Ab.x;ja[y+9]=Ab.y;ja[y+10]=Ab.z;ja[y+11]=1;y=y+12}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];gb=Db[B.a];hb=Db[B.b];ib=Db[B.c];kc=Db[B.d];la[y]=gb.x;la[y+1]=gb.y;la[y+2]=gb.z;la[y+3]=gb.w;la[y+4]=hb.x;la[y+5]=hb.y;la[y+6]=hb.z;la[y+7]=hb.w;la[y+
- 8]=ib.x;la[y+9]=ib.y;la[y+10]=ib.z;la[y+11]=ib.w;la[y+12]=kc.x;la[y+13]=kc.y;la[y+14]=kc.z;la[y+15]=kc.w;jb=Pb[B.a];kb=Pb[B.b];lb=Pb[B.c];lc=Pb[B.d];ka[y]=jb.x;ka[y+1]=jb.y;ka[y+2]=jb.z;ka[y+3]=jb.w;ka[y+4]=kb.x;ka[y+5]=kb.y;ka[y+6]=kb.z;ka[y+7]=kb.w;ka[y+8]=lb.x;ka[y+9]=lb.y;ka[y+10]=lb.z;ka[y+11]=lb.w;ka[y+12]=lc.x;ka[y+13]=lc.y;ka[y+14]=lc.z;ka[y+15]=lc.w;vb=Nb[B.a];wb=Nb[B.b];xb=Nb[B.c];yc=Nb[B.d];ia[y]=vb.x;ia[y+1]=vb.y;ia[y+2]=vb.z;ia[y+3]=1;ia[y+4]=wb.x;ia[y+5]=wb.y;ia[y+6]=wb.z;ia[y+7]=1;
- ia[y+8]=xb.x;ia[y+9]=xb.y;ia[y+10]=xb.z;ia[y+11]=1;ia[y+12]=yc.x;ia[y+13]=yc.y;ia[y+14]=yc.z;ia[y+15]=1;yb=Ob[B.a];zb=Ob[B.b];Ab=Ob[B.c];zc=Ob[B.d];ja[y]=yb.x;ja[y+1]=yb.y;ja[y+2]=yb.z;ja[y+3]=1;ja[y+4]=zb.x;ja[y+5]=zb.y;ja[y+6]=zb.z;ja[y+7]=1;ja[y+8]=Ab.x;ja[y+9]=Ab.y;ja[y+10]=Ab.z;ja[y+11]=1;ja[y+12]=zc.x;ja[y+13]=zc.y;ja[y+14]=zc.z;ja[y+15]=1;y=y+16}if(y>0){g.bindBuffer(g.ARRAY_BUFFER,V.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,ia,Ja);g.bindBuffer(g.ARRAY_BUFFER,V.__webglSkinVertexBBuffer);
- g.bufferData(g.ARRAY_BUFFER,ja,Ja);g.bindBuffer(g.ARRAY_BUFFER,V.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,ka,Ja);g.bindBuffer(g.ARRAY_BUFFER,V.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,la,Ja)}}if(cd&&Mc){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];Wa=B.vertexColors;xc=B.color;if(Wa.length===3&&Mc===THREE.VertexColors){db=Wa[0];eb=Wa[1];fb=Wa[2]}else fb=eb=db=xc;xa[qa]=db.r;xa[qa+1]=db.g;xa[qa+2]=db.b;xa[qa+3]=eb.r;xa[qa+4]=eb.g;xa[qa+5]=eb.b;xa[qa+6]=fb.r;xa[qa+7]=fb.g;xa[qa+
- 8]=fb.b;qa=qa+9}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];Wa=B.vertexColors;xc=B.color;if(Wa.length===4&&Mc===THREE.VertexColors){db=Wa[0];eb=Wa[1];fb=Wa[2];jc=Wa[3]}else jc=fb=eb=db=xc;xa[qa]=db.r;xa[qa+1]=db.g;xa[qa+2]=db.b;xa[qa+3]=eb.r;xa[qa+4]=eb.g;xa[qa+5]=eb.b;xa[qa+6]=fb.r;xa[qa+7]=fb.g;xa[qa+8]=fb.b;xa[qa+9]=jc.r;xa[qa+10]=jc.g;xa[qa+11]=jc.b;qa=qa+12}if(qa>0){g.bindBuffer(g.ARRAY_BUFFER,V.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,xa,Ja)}}if(bd&&Ea.hasTangents){x=0;for(J=aa.length;x<
- J;x++){B=ra[aa[x]];pb=B.vertexTangents;Ya=pb[0];Za=pb[1];$a=pb[2];ha[ea]=Ya.x;ha[ea+1]=Ya.y;ha[ea+2]=Ya.z;ha[ea+3]=Ya.w;ha[ea+4]=Za.x;ha[ea+5]=Za.y;ha[ea+6]=Za.z;ha[ea+7]=Za.w;ha[ea+8]=$a.x;ha[ea+9]=$a.y;ha[ea+10]=$a.z;ha[ea+11]=$a.w;ea=ea+12}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];pb=B.vertexTangents;Ya=pb[0];Za=pb[1];$a=pb[2];hc=pb[3];ha[ea]=Ya.x;ha[ea+1]=Ya.y;ha[ea+2]=Ya.z;ha[ea+3]=Ya.w;ha[ea+4]=Za.x;ha[ea+5]=Za.y;ha[ea+6]=Za.z;ha[ea+7]=Za.w;ha[ea+8]=$a.x;ha[ea+9]=$a.y;ha[ea+10]=$a.z;ha[ea+11]=
- $a.w;ha[ea+12]=hc.x;ha[ea+13]=hc.y;ha[ea+14]=hc.z;ha[ea+15]=hc.w;ea=ea+16}g.bindBuffer(g.ARRAY_BUFFER,V.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ha,Ja)}if(ad&&$b){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];Ub=B.vertexNormals;ub=B.normal;if(Ub.length===3&&wc)for($=0;$<3;$++){Bb=Ub[$];Ra[Aa]=Bb.x;Ra[Aa+1]=Bb.y;Ra[Aa+2]=Bb.z;Aa=Aa+3}else for($=0;$<3;$++){Ra[Aa]=ub.x;Ra[Aa+1]=ub.y;Ra[Aa+2]=ub.z;Aa=Aa+3}}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];Ub=B.vertexNormals;ub=B.normal;if(Ub.length===4&&wc)for($=
- 0;$<4;$++){Bb=Ub[$];Ra[Aa]=Bb.x;Ra[Aa+1]=Bb.y;Ra[Aa+2]=Bb.z;Aa=Aa+3}else for($=0;$<4;$++){Ra[Aa]=ub.x;Ra[Aa+1]=ub.y;Ra[Aa+2]=ub.z;Aa=Aa+3}}g.bindBuffer(g.ARRAY_BUFFER,V.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ra,Ja)}if(Uc&&Qc&&ac){x=0;for(J=aa.length;x<J;x++){Ta=aa[x];B=ra[Ta];Vb=Qc[Ta];if(Vb!==void 0)for($=0;$<3;$++){Xb=Vb[$];mc[rb]=Xb.u;mc[rb+1]=Xb.v;rb=rb+2}}x=0;for(J=ba.length;x<J;x++){Ta=ba[x];B=ra[Ta];Vb=Qc[Ta];if(Vb!==void 0)for($=0;$<4;$++){Xb=Vb[$];mc[rb]=Xb.u;mc[rb+1]=Xb.v;rb=rb+
- 2}}if(rb>0){g.bindBuffer(g.ARRAY_BUFFER,V.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,mc,Ja)}}if(Uc&&Rc&&ac){x=0;for(J=aa.length;x<J;x++){Ta=aa[x];B=ra[Ta];Wb=Rc[Ta];if(Wb!==void 0)for($=0;$<3;$++){Yb=Wb[$];nc[sb]=Yb.u;nc[sb+1]=Yb.v;sb=sb+2}}x=0;for(J=ba.length;x<J;x++){Ta=ba[x];B=ra[Ta];Wb=Rc[Ta];if(Wb!==void 0)for($=0;$<4;$++){Yb=Wb[$];nc[sb]=Yb.u;nc[sb+1]=Yb.v;sb=sb+2}}if(sb>0){g.bindBuffer(g.ARRAY_BUFFER,V.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,nc,Ja)}}if(Kc){x=0;for(J=aa.length;x<J;x++){B=
- ra[aa[x]];mb[Qa]=pa;mb[Qa+1]=pa+1;mb[Qa+2]=pa+2;Qa=Qa+3;La[Da]=pa;La[Da+1]=pa+1;La[Da+2]=pa;La[Da+3]=pa+2;La[Da+4]=pa+1;La[Da+5]=pa+2;Da=Da+6;pa=pa+3}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];mb[Qa]=pa;mb[Qa+1]=pa+1;mb[Qa+2]=pa+3;mb[Qa+3]=pa+1;mb[Qa+4]=pa+2;mb[Qa+5]=pa+3;Qa=Qa+6;La[Da]=pa;La[Da+1]=pa+1;La[Da+2]=pa;La[Da+3]=pa+3;La[Da+4]=pa+1;La[Da+5]=pa+2;La[Da+6]=pa+2;La[Da+7]=pa+3;Da=Da+8;pa=pa+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,V.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,mb,Ja);
- g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,V.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,La,Ja)}if(Pc){$=0;for(bc=Pc.length;$<bc;$++){s=Pc[$];if(s.__original.needsUpdate){u=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];s.array[u]=s.value[B.a];s.array[u+1]=s.value[B.b];s.array[u+2]=s.value[B.c];u=u+3}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];s.array[u]=s.value[B.a];s.array[u+1]=s.value[B.b];s.array[u+2]=s.value[B.c];s.array[u+3]=s.value[B.d];
- u=u+4}}else{if(s.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){Ka=s.value[aa[x]];s.array[u]=Ka;s.array[u+1]=Ka;s.array[u+2]=Ka;u=u+3}x=0;for(J=ba.length;x<J;x++){Ka=s.value[ba[x]];s.array[u]=Ka;s.array[u+1]=Ka;s.array[u+2]=Ka;s.array[u+3]=Ka;u=u+4}}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=O.x;s.array[u+3]=O.y;s.array[u+4]=P.x;s.array[u+5]=P.y;
- u=u+6}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];da=s.value[B.d];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=O.x;s.array[u+3]=O.y;s.array[u+4]=P.x;s.array[u+5]=P.y;s.array[u+6]=da.x;s.array[u+7]=da.y;u=u+8}}else{if(s.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=s.value[aa[x]];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=O.x;s.array[u+3]=O.y;s.array[u+4]=P.x;s.array[u+5]=P.y;u=u+6}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=s.value[ba[x]];s.array[u]=
- N.x;s.array[u+1]=N.y;s.array[u+2]=O.x;s.array[u+3]=O.y;s.array[u+4]=P.x;s.array[u+5]=P.y;s.array[u+6]=da.x;s.array[u+7]=da.y;u=u+8}}}else if(s.size===3){var X;X=s.type==="c"?["r","g","b"]:["x","y","z"];if(s.boundTo===void 0||s.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];s.array[u]=N[X[0]];s.array[u+1]=N[X[1]];s.array[u+2]=N[X[2]];s.array[u+3]=O[X[0]];s.array[u+4]=O[X[1]];s.array[u+5]=O[X[2]];s.array[u+6]=P[X[0]];s.array[u+7]=P[X[1]];
- s.array[u+8]=P[X[2]];u=u+9}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];da=s.value[B.d];s.array[u]=N[X[0]];s.array[u+1]=N[X[1]];s.array[u+2]=N[X[2]];s.array[u+3]=O[X[0]];s.array[u+4]=O[X[1]];s.array[u+5]=O[X[2]];s.array[u+6]=P[X[0]];s.array[u+7]=P[X[1]];s.array[u+8]=P[X[2]];s.array[u+9]=da[X[0]];s.array[u+10]=da[X[1]];s.array[u+11]=da[X[2]];u=u+12}}else if(s.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=s.value[aa[x]];s.array[u]=N[X[0]];s.array[u+
- 1]=N[X[1]];s.array[u+2]=N[X[2]];s.array[u+3]=O[X[0]];s.array[u+4]=O[X[1]];s.array[u+5]=O[X[2]];s.array[u+6]=P[X[0]];s.array[u+7]=P[X[1]];s.array[u+8]=P[X[2]];u=u+9}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=s.value[ba[x]];s.array[u]=N[X[0]];s.array[u+1]=N[X[1]];s.array[u+2]=N[X[2]];s.array[u+3]=O[X[0]];s.array[u+4]=O[X[1]];s.array[u+5]=O[X[2]];s.array[u+6]=P[X[0]];s.array[u+7]=P[X[1]];s.array[u+8]=P[X[2]];s.array[u+9]=da[X[0]];s.array[u+10]=da[X[1]];s.array[u+11]=da[X[2]];u=u+12}}}else if(s.size===
- 4)if(s.boundTo===void 0||s.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=N.z;s.array[u+3]=N.w;s.array[u+4]=O.x;s.array[u+5]=O.y;s.array[u+6]=O.z;s.array[u+7]=O.w;s.array[u+8]=P.x;s.array[u+9]=P.y;s.array[u+10]=P.z;s.array[u+11]=P.w;u=u+12}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=s.value[B.a];O=s.value[B.b];P=s.value[B.c];da=s.value[B.d];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=N.z;s.array[u+
- 3]=N.w;s.array[u+4]=O.x;s.array[u+5]=O.y;s.array[u+6]=O.z;s.array[u+7]=O.w;s.array[u+8]=P.x;s.array[u+9]=P.y;s.array[u+10]=P.z;s.array[u+11]=P.w;s.array[u+12]=da.x;s.array[u+13]=da.y;s.array[u+14]=da.z;s.array[u+15]=da.w;u=u+16}}else if(s.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=s.value[aa[x]];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=N.z;s.array[u+3]=N.w;s.array[u+4]=O.x;s.array[u+5]=O.y;s.array[u+6]=O.z;s.array[u+7]=O.w;s.array[u+8]=P.x;s.array[u+9]=P.y;s.array[u+10]=P.z;s.array[u+
- 11]=P.w;u=u+12}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=s.value[ba[x]];s.array[u]=N.x;s.array[u+1]=N.y;s.array[u+2]=N.z;s.array[u+3]=N.w;s.array[u+4]=O.x;s.array[u+5]=O.y;s.array[u+6]=O.z;s.array[u+7]=O.w;s.array[u+8]=P.x;s.array[u+9]=P.y;s.array[u+10]=P.z;s.array[u+11]=P.w;s.array[u+12]=da.x;s.array[u+13]=da.y;s.array[u+14]=da.z;s.array[u+15]=da.w;u=u+16}}g.bindBuffer(g.ARRAY_BUFFER,s.buffer);g.bufferData(g.ARRAY_BUFFER,s.array,Ja)}}}if(uc){delete V.__inittedArrays;delete V.__colorArray;delete V.__normalArray;
- delete V.__tangentArray;delete V.__uvArray;delete V.__uv2Array;delete V.__faceArray;delete V.__vertexArray;delete V.__lineArray;delete V.__skinVertexAArray;delete V.__skinVertexBArray;delete V.__skinIndexArray;delete V.__skinWeightArray}}}}Y.verticesNeedUpdate=false;Y.morphTargetsNeedUpdate=false;Y.elementsNeedUpdate=false;Y.uvsNeedUpdate=false;Y.normalsNeedUpdate=false;Y.colorsNeedUpdate=false;Y.tangetsNeedUpdate=false;Fa.attributes&&v(Fa)}else if(Va instanceof THREE.Ribbon){if(Y.verticesNeedUpdate||
- Y.colorsNeedUpdate){var Fb=Y,Vc=g.DYNAMIC_DRAW,oc=void 0,pc=void 0,Bc=void 0,Gb=void 0,Cc=void 0,Wc=Fb.vertices,Xc=Fb.colors,ed=Wc.length,fd=Xc.length,Dc=Fb.__vertexArray,Ec=Fb.__colorArray,gd=Fb.colorsNeedUpdate;if(Fb.verticesNeedUpdate){for(oc=0;oc<ed;oc++){Bc=Wc[oc];Gb=oc*3;Dc[Gb]=Bc.x;Dc[Gb+1]=Bc.y;Dc[Gb+2]=Bc.z}g.bindBuffer(g.ARRAY_BUFFER,Fb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Dc,Vc)}if(gd){for(pc=0;pc<fd;pc++){Cc=Xc[pc];Gb=pc*3;Ec[Gb]=Cc.r;Ec[Gb+1]=Cc.g;Ec[Gb+2]=Cc.b}g.bindBuffer(g.ARRAY_BUFFER,
- Fb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ec,Vc)}}Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false}else if(Va instanceof THREE.Line){Fa=c(Va,gc);Tb=Fa.attributes&&m(Fa);if(Y.verticesNeedUpdate||Y.colorsNeedUpdate||Tb){var tb=Y,Sc=g.DYNAMIC_DRAW,qc=void 0,rc=void 0,Fc=void 0,ma=void 0,Gc=void 0,Yc=tb.vertices,Zc=tb.colors,hd=Yc.length,id=Zc.length,Hc=tb.__vertexArray,Ic=tb.__colorArray,jd=tb.colorsNeedUpdate,Tc=tb.__webglCustomAttributesList,Jc=void 0,$c=void 0,ya=void 0,Zb=void 0,Ga=void 0,
- fa=void 0;if(tb.verticesNeedUpdate){for(qc=0;qc<hd;qc++){Fc=Yc[qc];ma=qc*3;Hc[ma]=Fc.x;Hc[ma+1]=Fc.y;Hc[ma+2]=Fc.z}g.bindBuffer(g.ARRAY_BUFFER,tb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Hc,Sc)}if(jd){for(rc=0;rc<id;rc++){Gc=Zc[rc];ma=rc*3;Ic[ma]=Gc.r;Ic[ma+1]=Gc.g;Ic[ma+2]=Gc.b}g.bindBuffer(g.ARRAY_BUFFER,tb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ic,Sc)}if(Tc){Jc=0;for($c=Tc.length;Jc<$c;Jc++){fa=Tc[Jc];if(fa.needsUpdate&&(fa.boundTo===void 0||fa.boundTo==="vertices")){ma=0;Zb=fa.value.length;
- if(fa.size===1)for(ya=0;ya<Zb;ya++)fa.array[ya]=fa.value[ya];else if(fa.size===2)for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=Ga.y;ma=ma+2}else if(fa.size===3)if(fa.type==="c")for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.r;fa.array[ma+1]=Ga.g;fa.array[ma+2]=Ga.b;ma=ma+3}else for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=Ga.y;fa.array[ma+2]=Ga.z;ma=ma+3}else if(fa.size===4)for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=
- Ga.y;fa.array[ma+2]=Ga.z;fa.array[ma+3]=Ga.w;ma=ma+4}g.bindBuffer(g.ARRAY_BUFFER,fa.buffer);g.bufferData(g.ARRAY_BUFFER,fa.array,Sc)}}}}Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false;Fa.attributes&&v(Fa)}else if(Va instanceof THREE.ParticleSystem){Fa=c(Va,gc);Tb=Fa.attributes&&m(Fa);(Y.verticesNeedUpdate||Y.colorsNeedUpdate||Va.sortParticles||Tb)&&f(Y,g.DYNAMIC_DRAW,Va);Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false;Fa.attributes&&v(Fa)}}};this.initMaterial=function(a,b,c,d){var e,f,h;a instanceof
- THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m,o;j=m=o=
- i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&o++;l instanceof THREE.SpotLight&&i++}}if(o+i+m<=Z){k=m;l=o;m=i}else{k=Math.ceil(Z*m/(o+m));m=l=Z-k}var n=0,i=0;for(o=b.length;i<o;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&n++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&n++}}var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var p;a:{j=a.fragmentShader;o=a.vertexShader;var i=
- a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:q,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
- shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(h)d.push(h);else{d.push(j);d.push(o)}for(r in c){d.push(r);d.push(c[r])}h=d.join();r=0;for(d=W.length;r<d;r++){k=W[r];if(k.code===h){k.usedTimes++;p=k.program;break a}}r=g.createProgram();d=["precision "+E+" float;",ec>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?
- "#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?
- "#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
- k=["precision "+E+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
- "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
- j=D("fragment",k+j);d=D("vertex",d+o);g.attachShader(r,d);g.attachShader(r,j);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(j);g.deleteShader(d);r.uniforms={};r.attributes={};var t,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(t in i)d.push(t);
- t=d;d=0;for(i=t.length;d<i;d++){o=t[d];r.uniforms[o]=g.getUniformLocation(r,o)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+t);for(t=0;t<c.maxMorphNormals;t++)d.push("morphNormal"+t);for(p in b)d.push(p);p=d;t=0;for(b=p.length;t<b;t++){c=p[t];r.attributes[c]=g.getAttribLocation(r,c)}r.id=I++;W.push({program:r,code:h,usedTimes:1});F.info.memory.programs=W.length;p=r}a.program=p;p=a.program.attributes;
- p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(f in a.attributes)p[f]!==void 0&&p[f]>=
- 0&&g.enableVertexAttribArray(p[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){t=b+f;if(p[t]>=0){g.enableVertexAttribArray(p[t]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){t=b+f;if(p[t]>=0){g.enableVertexAttribArray(p[t]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};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.setObjectFaces=function(a){if(Ba!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);Ba=a.doubleSided}if(Ha!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);Ha=a.flipSided}};this.setDepthTest=function(a){if(Xa!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
- Xa=a}};this.setDepthWrite=function(a){if(nb!==a){g.depthMask(a);nb=a}};this.setBlending=function(a,b,c,d){if(a!==Ia){switch(a){case THREE.NoBlending:g.disable(g.BLEND);break;case THREE.AdditiveBlending:g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
- g.SRC_COLOR);break;case THREE.CustomBlending:g.enable(g.BLEND);break;default: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)}Ia=a}if(a===THREE.CustomBlending){if(b!==Sa){g.blendEquation(A(b));Sa=b}if(c!==Ua||d!==Na){g.blendFunc(A(c),A(d));Ua=c;Na=d}}else Na=Ua=Sa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();F.info.memory.textures++}g.activeTexture(g.TEXTURE0+
- b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=A(a.format),f=A(a.type);C(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+b);g.bindTexture(g.TEXTURE_2D,
- a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);C(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);t(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);C(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);t(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=Jb;a=Kb;d=Ib;e=cc}if(b!==T){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);T=b}$b=c;ac=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
- THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
- THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
- THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
- THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
- THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
- THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
- THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
- THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
- THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
- 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=new THREE.Object3D;THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;
- 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=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
- 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=new THREE.Object3D;
- THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
- THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,h,j,k,l,i,o,m,v;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
- 0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);j=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
- b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
- b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){l=false;i=a(THREE.ShaderFlares.lensFlare)}else{l=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(i,"position");o.uv=b.getAttribLocation(i,"uv");m.renderType=b.getUniformLocation(i,"renderType");m.map=b.getUniformLocation(i,"map");m.occlusionMap=b.getUniformLocation(i,"occlusionMap");m.opacity=b.getUniformLocation(i,"opacity");m.color=b.getUniformLocation(i,
- "color");m.scale=b.getUniformLocation(i,"scale");m.rotation=b.getUniformLocation(i,"rotation");m.screenPosition=b.getUniformLocation(i,"screenPosition");v=false};this.render=function(a,d,e,w){var a=a.__webglFlares,p=a.length;if(p){var D=new THREE.Vector3,C=w/e,t=e*0.5,L=w*0.5,A=16/w,G=new THREE.Vector2(A*C,A),E=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),Q=m,A=o;b.useProgram(i);if(!v){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);v=true}b.uniform1i(Q.occlusionMap,0);b.uniform1i(Q.map,
- 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(A.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var R,H,S,z,K;for(R=0;R<p;R++){A=16/w;G.set(A*C,A);z=a[R];D.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(D);d.projectionMatrix.multiplyVector3(D);E.copy(D);M.x=E.x*t+t;M.y=E.y*L+L;if(l||M.x>0&&M.x<e&&M.y>0&&
- M.y<w){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0);b.uniform1i(Q.renderType,0);b.uniform2f(Q.scale,G.x,G.y);b.uniform3f(Q.screenPosition,E.x,E.y,E.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,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0);b.uniform1i(Q.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
- b.bindTexture(b.TEXTURE_2D,j);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(E);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(Q.renderType,2);b.enable(b.BLEND);H=0;for(S=z.lensFlares.length;H<S;H++){K=z.lensFlares[H];if(K.opacity>0.0010&&K.scale>0.0010){E.x=K.x;E.y=K.y;E.z=K.z;A=K.size*K.scale/w;G.x=A*C;G.y=A;b.uniform3f(Q.screenPosition,E.x,E.y,E.z);b.uniform2f(Q.scale,G.x,G.y);b.uniform1f(Q.rotation,K.rotation);b.uniform1f(Q.opacity,K.opacity);
- b.uniform3f(Q.color,K.color.r,K.color.g,K.color.b);c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst);c.setTexture(K.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=new THREE.Frustum,f=new THREE.Matrix4,h=new THREE.Vector3,j=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
- function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,l){var i,o,m,v,r,n,q,w,p,D=[];v=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);i=0;for(o=k.__lights.length;i<o;i++){m=k.__lights[i];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var C;if(m.shadowCascadeArray[r])C=m.shadowCascadeArray[r];
- else{p=m;q=r;C=new THREE.DirectionalLight;C.isVirtual=true;C.onlyShadow=true;C.castShadow=true;C.shadowCameraNear=p.shadowCameraNear;C.shadowCameraFar=p.shadowCameraFar;C.shadowCameraLeft=p.shadowCameraLeft;C.shadowCameraRight=p.shadowCameraRight;C.shadowCameraBottom=p.shadowCameraBottom;C.shadowCameraTop=p.shadowCameraTop;C.shadowCameraVisible=p.shadowCameraVisible;C.shadowDarkness=p.shadowDarkness;C.shadowBias=p.shadowCascadeBias[q];C.shadowMapWidth=p.shadowCascadeWidth[q];C.shadowMapHeight=p.shadowCascadeHeight[q];
- C.pointsWorld=[];C.pointsFrustum=[];w=C.pointsWorld;n=C.pointsFrustum;for(var t=0;t<8;t++){w[t]=new THREE.Vector3;n[t]=new THREE.Vector3}w=p.shadowCascadeNearZ[q];p=p.shadowCascadeFarZ[q];n[0].set(-1,-1,w);n[1].set(1,-1,w);n[2].set(-1,1,w);n[3].set(1,1,w);n[4].set(-1,-1,p);n[5].set(1,-1,p);n[6].set(-1,1,p);n[7].set(1,1,p);C.originalCamera=l;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(C);n.add(C.target);l.add(n);m.shadowCascadeArray[r]=C;console.log("Created virtualLight",C)}q=m;w=
- r;p=q.shadowCascadeArray[w];p.position.copy(q.position);p.target.position.copy(q.target.position);p.lookAt(p.target);p.shadowCameraVisible=q.shadowCameraVisible;p.shadowDarkness=q.shadowDarkness;p.shadowBias=q.shadowCascadeBias[w];n=q.shadowCascadeNearZ[w];q=q.shadowCascadeFarZ[w];p=p.pointsFrustum;p[0].z=n;p[1].z=n;p[2].z=n;p[3].z=n;p[4].z=q;p[5].z=q;p[6].z=q;p[7].z=q;D[v]=C;v++}else{D[v]=m;v++}}i=0;for(o=D.length;i<o;i++){m=D[i];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,
- m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight);m.shadowMatrix=new THREE.Matrix4}if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,
- m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}k.add(m.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&C.originalCamera==l){r=l;v=m.shadowCamera;n=m.pointsFrustum;p=m.pointsWorld;h.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(q=
- 0;q<8;q++){w=p[q];w.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,r);v.matrixWorldInverse.multiplyVector3(w);if(w.x<h.x)h.x=w.x;if(w.x>j.x)j.x=w.x;if(w.y<h.y)h.y=w.y;if(w.y>j.y)j.y=w.y;if(w.z<h.z)h.z=w.z;if(w.z>j.z)j.z=w.z}v.left=h.x;v.right=j.x;v.top=j.y;v.bottom=h.y;v.updateProjectionMatrix()}v=m.shadowMap;n=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
- if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,
- r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(v);b.clear();p=k.__webglObjects;m=0;for(v=p.length;m<v;m++){q=p[m];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}m=0;for(v=p.length;m<v;m++){q=p[m];if(q.render){n=q.object;q=q.buffer;w=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
- b.renderBufferDirect(r,k.__lights,null,w,q,n):b.renderBuffer(r,k.__lights,null,w,q,n)}}p=k.__webglObjectsImmediate;m=0;for(v=p.length;m<v;m++){q=p[m];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,k.__lights,null,c,n)}}}i=b.getClearColor();o=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
- THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,h,j,k,l,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[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(),v=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(v,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(v);b.compileShader(r);b.attachShader(m,v);b.attachShader(m,r);b.linkProgram(m);j=m;k={};l={};k.position=b.getAttribLocation(j,"position");k.uv=b.getAttribLocation(j,"uv");l.uvOffset=b.getUniformLocation(j,"uvOffset");l.uvScale=b.getUniformLocation(j,
- "uvScale");l.rotation=b.getUniformLocation(j,"rotation");l.scale=b.getUniformLocation(j,"scale");l.alignment=b.getUniformLocation(j,"alignment");l.color=b.getUniformLocation(j,"color");l.map=b.getUniformLocation(j,"map");l.opacity=b.getUniformLocation(j,"opacity");l.useScreenCoordinates=b.getUniformLocation(j,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(j,"affectedByDistance");l.screenPosition=b.getUniformLocation(j,"screenPosition");l.modelViewMatrix=b.getUniformLocation(j,"modelViewMatrix");
- l.projectionMatrix=b.getUniformLocation(j,"projectionMatrix");i=false};this.render=function(d,e,v,r){var d=d.__webglSprites,n=d.length;if(n){var q=k,w=l,p=r/v,v=v*0.5,D=r*0.5,C=true;b.useProgram(j);if(!i){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);i=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(w.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(w.map,0);for(var t,L=[],q=0;q<n;q++){t=d[q];if(t.visible&&t.opacity!==0)if(t.useScreenCoordinates)t.z=-t.position.z;else{t._modelViewMatrix.multiply(e.matrixWorldInverse,t.matrixWorld);t.z=-t._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){t=d[q];if(t.visible&&t.opacity!==0&&t.map&&t.map.image&&t.map.image.width){if(t.useScreenCoordinates){b.uniform1i(w.useScreenCoordinates,1);
- b.uniform3f(w.screenPosition,(t.position.x-v)/v,(D-t.position.y)/D,Math.max(0,Math.min(1,t.position.z)))}else{b.uniform1i(w.useScreenCoordinates,0);b.uniform1i(w.affectedByDistance,t.affectedByDistance?1:0);b.uniformMatrix4fv(w.modelViewMatrix,false,t._modelViewMatrix.elements)}e=t.map.image.width/(t.scaleByViewport?r:1);L[0]=e*p*t.scale.x;L[1]=e*t.scale.y;b.uniform2f(w.uvScale,t.uvScale.x,t.uvScale.y);b.uniform2f(w.uvOffset,t.uvOffset.x,t.uvOffset.y);b.uniform2f(w.alignment,t.alignment.x,t.alignment.y);
- b.uniform1f(w.opacity,t.opacity);b.uniform3f(w.color,t.color.r,t.color.g,t.color.b);b.uniform1f(w.rotation,t.rotation);b.uniform2fv(w.scale,L);if(t.mergeWith3D&&!C){b.enable(b.DEPTH_TEST);C=true}else if(!t.mergeWith3D&&C){b.disable(b.DEPTH_TEST);C=false}c.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst);c.setTexture(t.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}"}};
|