123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- // ThreeWebGL.js - http://github.com/mrdoob/three.js
- 'use strict';var THREE=THREE||{REVISION:"49"};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(),g=Math.max(0,16-(c-a)),h=window.setTimeout(function(){b(c+g)},g);a=c+g;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,g;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);g=c*(1-b*e);b=c*(1-b*(1-e));switch(d){case 1:this.r=g;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=g;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=g;break;case 6:case 0:this.r=c;this.g=b;this.b=a}}return this},setHex:function(a){a=
- Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
- THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
- this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
- lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
- a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
- this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
- setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
- a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,g=a.elements[0]/c,h=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,k=a.elements[9]/e,m=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-k/e,m/e);this.z=Math.atan2(-h/e,g/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
- this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
- this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
- THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],g=d[3],h=d[4],k=d[5],m=d[6],j=d[7],i=d[8],p=d[9],l=d[10],v=d[11],o=d[12],n=d[13],r=d[14],d=d[15];c[0].set(g-a,j-h,v-i,d-o);c[1].set(g+a,j+h,v+i,d+o);c[2].set(g+b,j+k,v+p,d+n);c[3].set(g-b,j-k,v-p,d-n);c[4].set(g-e,j-m,v-l,d-r);c[5].set(g+e,j+m,v+l,d+r);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
- THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
- THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);w=o.dot(b);q=n.add(a,r.copy(b).multiplyScalar(w));return F=c.distanceTo(q)}function d(a,b,c,d){o.sub(d,b);n.sub(c,b);r.sub(a,b);C=o.dot(o);s=o.dot(n);K=o.dot(r);A=n.dot(n);G=n.dot(r);D=1/(C*A-s*s);M=(A*K-s*G)*D;Q=(C*G-s*K)*D;return M>=0&&Q>=0&&M+Q<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,
- j=new THREE.Vector3,i=new THREE.Vector3,p=new THREE.Vector3,l=new THREE.Vector3,v=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var o=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
- a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return n;var q,w,f=a.geometry,s=f.vertices,H;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(r=f.faces.length;o<r;o++){b=f.faces[o];j.copy(this.origin);i.copy(this.direction);H=a.matrixWorld;p=H.multiplyVector3(p.copy(b.centroid)).subSelf(j);l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal));q=i.dot(l);if(!(Math.abs(q)<e)){w=l.dot(p)/q;if(!(w<0)&&(a.doubleSided||(a.flipSided?
- q>0:q<0))){v.add(j,i.multiplyScalar(w));if(b instanceof THREE.Face3){g=H.multiplyVector3(g.copy(s[b.a]));h=H.multiplyVector3(h.copy(s[b.b]));k=H.multiplyVector3(k.copy(s[b.c]));if(d(v,g,h,k)){b={distance:j.distanceTo(v),point:v.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){g=H.multiplyVector3(g.copy(s[b.a]));h=H.multiplyVector3(h.copy(s[b.b]));k=H.multiplyVector3(k.copy(s[b.c]));m=H.multiplyVector3(m.copy(s[b.d]));if(d(v,g,h,m)||d(v,h,k,m)){b={distance:j.distanceTo(v),point:v.clone(),
- face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var o=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,w,q,F,C,s,K,A,G,D,M,Q};
- THREE.Rectangle=function(){function a(){g=d-b;h=e-c}var b,c,d,e,g,h,k=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};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(g,h,i,p){k=false;b=g;c=h;d=i;e=p;a()};this.addPoint=function(g,h){if(k){k=false;b=g;c=h;d=g;e=h}else{b=b<g?b:g;c=c<h?c:h;d=d>g?d:g;e=e>h?
- e:h}a()};this.add3Points=function(g,h,i,p,l,v){if(k){k=false;b=g<i?g<l?g:l:i<l?i:l;c=h<p?h<v?h:v:p<v?p:v;d=g>i?g>l?g:l:i>l?i:l;e=h>p?h>v?h:v:p>v?p:v}else{b=g<i?g<l?g<b?g:b:l<b?l:b:i<l?i<b?i:b:l<b?l:b;c=h<p?h<v?h<c?h:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c;d=g>i?g>l?g>d?g:d:l>d?l:d:i>l?i>d?i:d:l>d?l:d;e=h>p?h>v?h>e?h:e:v>e?v:e:p>v?p>e?p:e:v>e?v:e}a()};this.addRectangle=function(g){if(k){k=false;b=g.getLeft();c=g.getTop();d=g.getRight();e=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();
- d=d>g.getRight()?d:g.getRight();e=e>g.getBottom()?e:g.getBottom()}a()};this.inflate=function(g){b=b-g;c=c-g;d=d+g;e=e+g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){k=true;e=d=c=b=0;a()};this.isEmpty=function(){return k}};
- 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],g=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*k;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*g;i[5]=b*h;i[6]=b*k;i[7]=b*m;i[8]=b*j;return this},
- transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,h,k,m,j,i,p,l,v,o,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,h||0,k||0,m||0,j||0,i!==void 0?i:1,p||0,l||0,v||0,o||0,n!==void 0?n:1)};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,h,k,m,j,i,p,l,v,o,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=g;r[9]=h;r[13]=k;r[2]=m;r[6]=j;r[10]=i;r[14]=p;r[3]=l;r[7]=v;r[11]=o;r[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,g=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()}g.cross(h,e);d[0]=e.x;d[4]=g.x;d[8]=h.x;d[1]=e.y;d[5]=g.y;d[9]=h.y;d[2]=e.z;d[6]=g.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,g=c[0],h=c[4],k=c[8],m=c[12],j=c[1],i=c[5],p=c[9],l=c[13],v=c[2],o=c[6],n=c[10],r=c[14],w=c[3],q=c[7],F=c[11],c=c[15],C=d[0],s=d[4],
- K=d[8],A=d[12],G=d[1],D=d[5],M=d[9],Q=d[13],S=d[2],Z=d[6],R=d[10],z=d[14],L=d[3],I=d[7],E=d[11],d=d[15];e[0]=g*C+h*G+k*S+m*L;e[4]=g*s+h*D+k*Z+m*I;e[8]=g*K+h*M+k*R+m*E;e[12]=g*A+h*Q+k*z+m*d;e[1]=j*C+i*G+p*S+l*L;e[5]=j*s+i*D+p*Z+l*I;e[9]=j*K+i*M+p*R+l*E;e[13]=j*A+i*Q+p*z+l*d;e[2]=v*C+o*G+n*S+r*L;e[6]=v*s+o*D+n*Z+r*I;e[10]=v*K+o*M+n*R+r*E;e[14]=v*A+o*Q+n*z+r*d;e[3]=w*C+q*G+F*S+c*L;e[7]=w*s+q*D+F*Z+c*I;e[11]=w*K+q*M+F*R+c*E;e[15]=w*A+q*Q+F*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,g=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])*g;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*g;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*g;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*g;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*g;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*g;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*g;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],g=a[1],h=a[5],k=a[9],m=a[13],j=a[2],i=a[6],p=a[10],l=a[14],v=a[3],o=a[7],
- n=a[11],a=a[15];return e*k*i*v-d*m*i*v-e*h*p*v+c*m*p*v+d*h*l*v-c*k*l*v-e*k*j*o+d*m*j*o+e*g*p*o-b*m*p*o-d*g*l*o+b*k*l*o+e*h*j*n-c*m*j*n-e*g*i*n+b*m*i*n+c*g*l*n-b*h*l*n-d*h*j*a+c*k*j*a+d*g*i*a-b*k*i*a-c*g*p*a+b*h*p*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],g=c[8],h=c[12],k=c[1],m=c[5],j=c[9],i=c[13],p=c[2],l=c[6],v=c[10],o=
- c[14],n=c[3],r=c[7],w=c[11],c=c[15];b[0]=j*o*r-i*v*r+i*l*w-m*o*w-j*l*c+m*v*c;b[4]=h*v*r-g*o*r-h*l*w+e*o*w+g*l*c-e*v*c;b[8]=g*i*r-h*j*r+h*m*w-e*i*w-g*m*c+e*j*c;b[12]=h*j*l-g*i*l-h*m*v+e*i*v+g*m*o-e*j*o;b[1]=i*v*n-j*o*n-i*p*w+k*o*w+j*p*c-k*v*c;b[5]=g*o*n-h*v*n+h*p*w-d*o*w-g*p*c+d*v*c;b[9]=h*j*n-g*i*n-h*k*w+d*i*w+g*k*c-d*j*c;b[13]=g*i*p-h*j*p+h*k*v-d*i*v-g*k*o+d*j*o;b[2]=m*o*n-i*l*n+i*p*r-k*o*r-m*p*c+k*l*c;b[6]=h*l*n-e*o*n-h*p*r+d*o*r+e*p*c-d*l*c;b[10]=e*i*n-h*m*n+h*k*r-d*i*r-e*k*c+d*m*c;b[14]=h*m*p-
- e*i*p-h*k*l+d*i*l+e*k*o-d*m*o;b[3]=j*l*n-m*v*n-j*p*r+k*v*r+m*p*w-k*l*w;b[7]=e*v*n-g*l*n+g*p*r-d*v*r-e*p*w+d*l*w;b[11]=g*m*n-e*j*n-g*k*r+d*j*r+e*k*w-d*m*w;b[15]=e*j*p-g*m*p+g*k*l-d*j*l-e*k*v+d*m*v;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,g=a.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e),m=Math.cos(g),g=Math.sin(g);switch(b){case "YXZ":var j=k*m,i=k*g,p=e*m,l=e*g;c[0]=j+l*d;c[4]=p*d-i;c[8]=h*e;c[1]=h*g;c[5]=h*
- m;c[9]=-d;c[2]=i*d-p;c[6]=l+j*d;c[10]=h*k;break;case "ZXY":j=k*m;i=k*g;p=e*m;l=e*g;c[0]=j-l*d;c[4]=-h*g;c[8]=p+i*d;c[1]=i+p*d;c[5]=h*m;c[9]=l-j*d;c[2]=-h*e;c[6]=d;c[10]=h*k;break;case "ZYX":j=h*m;i=h*g;p=d*m;l=d*g;c[0]=k*m;c[4]=p*e-i;c[8]=j*e+l;c[1]=k*g;c[5]=l*e+j;c[9]=i*e-p;c[2]=-e;c[6]=d*k;c[10]=h*k;break;case "YZX":j=h*k;i=h*e;p=d*k;l=d*e;c[0]=k*m;c[4]=l-j*g;c[8]=p*g+i;c[1]=g;c[5]=h*m;c[9]=-d*m;c[2]=-e*m;c[6]=i*g+p;c[10]=j-l*g;break;case "XZY":j=h*k;i=h*e;p=d*k;l=d*e;c[0]=k*m;c[4]=-g;c[8]=e*m;
- c[1]=j*g+l;c[5]=h*m;c[9]=i*g-p;c[2]=p*g-i;c[6]=d*m;c[10]=l*g+j;break;default:j=h*m;i=h*g;p=d*m;l=d*g;c[0]=k*m;c[4]=-k*g;c[8]=e;c[1]=i+p*e;c[5]=j-l*e;c[9]=-d*k;c[2]=l-j*e;c[6]=p+i*e;c[10]=h*k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w,h=c+c,k=d+d,m=e+e,a=c*h,j=c*k,c=c*m,i=d*k,d=d*m,e=e*m,h=g*h,k=g*k,g=g*m;b[0]=1-(i+e);b[4]=j-g;b[8]=c+k;b[1]=j+g;b[5]=1-(a+e);b[9]=d-h;b[2]=c-k;b[6]=d+h;b[10]=1-(a+i);return this},compose:function(a,b,c){var d=this.elements,
- e=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);g.makeScale(c.x,c.y,c.z);this.multiply(e,g);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,g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);g.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=g.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],g=b[7],h=b[8],k=b[9],m=b[10],j=b[11],i=Math.cos(a),a=Math.sin(a);b[4]=i*c+a*h;b[5]=i*d+a*k;b[6]=i*e+a*m;b[7]=i*g+a*j;b[8]=i*h-a*c;b[9]=i*k-a*d;b[10]=i*m-a*e;b[11]=i*j-a*g;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],g=b[3],h=b[8],k=b[9],m=b[10],j=b[11],i=Math.cos(a),a=Math.sin(a);b[0]=i*c-a*h;b[1]=i*d-a*k;b[2]=i*e-a*m;b[3]=i*g-a*j;b[8]=i*h+a*c;b[9]=
- i*k+a*d;b[10]=i*m+a*e;b[11]=i*j+a*g;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],g=b[3],h=b[4],k=b[5],m=b[6],j=b[7],i=Math.cos(a),a=Math.sin(a);b[0]=i*c+a*h;b[1]=i*d+a*k;b[2]=i*e+a*m;b[3]=i*g+a*j;b[4]=i*h-a*c;b[5]=i*k-a*d;b[6]=i*m-a*e;b[7]=i*j-a*g;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,g=a.z,h=Math.sqrt(d*d+e*e+g*g),d=d/h,e=e/h,g=g/h,h=d*d,k=e*e,m=g*g,j=Math.cos(b),i=Math.sin(b),p=1-j,l=d*e*p,v=d*g*p,p=e*g*p,d=d*i,o=e*i,i=g*i,g=h+(1-h)*j,h=l+i,e=v-o,l=l-i,k=k+(1-k)*j,i=p+d,v=v+o,p=p-d,m=m+(1-m)*j,j=c[0],d=c[1],o=c[2],n=c[3],r=c[4],w=c[5],q=c[6],F=c[7],C=c[8],s=c[9],K=c[10],A=c[11];c[0]=g*j+h*r+e*C;c[1]=g*d+h*w+e*s;c[2]=g*o+h*q+e*K;c[3]=g*n+h*F+e*A;c[4]=l*j+k*r+i*C;c[5]=l*d+k*w+i*s;c[6]=l*o+k*q+i*K;c[7]=l*n+k*F+i*A;c[8]=v*j+p*r+m*C;c[9]=v*d+p*w+m*s;c[10]=v*o+p*q+m*K;c[11]=
- v*n+p*F+m*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,g=a.x,h=a.y,k=a.z,m=e*g,j=e*h;this.set(m*g+c,m*h-d*k,m*k+d*h,0,m*h+d*k,j*h+c,j*k-d*g,0,m*k-
- d*h,j*k+d*g,e*k*k+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,g){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]=-(g+e)/(g-e);h[14]=-2*g*e/(g-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,g){var h=this.elements,k=b-a,m=c-d,j=g-e;h[0]=2/k;h[4]=0;h[8]=0;h[12]=-((b+a)/k);h[1]=0;h[5]=2/m;h[9]=0;h[13]=-((c+d)/m);h[2]=0;h[6]=0;h[10]=-2/j;h[14]=-((g+e)/j);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.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
- this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=
- this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
- this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<
- c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
- THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[m]=j[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
- d);return true}var e,g,h=[],k,m,j=[],i,p,l=[],v,o=[],n,r,w=[],q,F,C=[],s={objects:[],sprites:[],lights:[],elements:[]},K=new THREE.Vector3,A=new THREE.Vector4,G=new THREE.Matrix4,D=new THREE.Matrix4,M=new THREE.Frustum,Q=new THREE.Vector4,S=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){g=0;s.objects.length=0;s.sprites.length=0;s.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))){K.copy(b.matrixWorld.getPosition());
- G.multiplyVector3(K);e=a();e.object=b;e.z=K.z;s.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){K.copy(b.matrixWorld.getPosition());G.multiplyVector3(K);e=a();e.object=b;e.z=K.z;s.sprites.push(e)}else b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&s.objects.sort(c);return s};this.projectScene=function(a,e,g){var h=e.near,K=e.far,E=false,f,W,H,za,T,na,ca,ga,oa,Ba,Ha,Ia,Sa,Ua,Na;F=r=v=p=0;s.elements.length=
- 0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);G.multiply(e.projectionMatrix,e.matrixWorldInverse);M.setFromMatrix(G);s=this.projectGraph(a,false);a=0;for(f=s.objects.length;a<f;a++){oa=s.objects[a].object;Ba=oa.matrixWorld;m=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(H=za.length;W<H;W++){k=b();k.positionWorld.copy(za[W]);Ba.multiplyVector3(k.positionWorld);k.positionScreen.copy(k.positionWorld);G.multiplyVector4(k.positionScreen);k.positionScreen.x=k.positionScreen.x/k.positionScreen.w;k.positionScreen.y=k.positionScreen.y/k.positionScreen.w;k.visible=k.positionScreen.z>h&&k.positionScreen.z<K}za=0;for(W=Sa.length;za<W;za++){H=Sa[za];if(H instanceof THREE.Face3){T=j[H.a];na=j[H.b];ca=j[H.c];if(T.visible&&na.visible&&ca.visible){E=(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||E!=oa.flipSided){ga=l[p]=l[p]||new THREE.RenderableFace3;p++;i=ga;i.v1.copy(T);i.v2.copy(na);i.v3.copy(ca)}else continue}else continue}else if(H instanceof THREE.Face4){T=j[H.a];na=j[H.b];ca=j[H.c];ga=j[H.d];if(T.visible&&na.visible&&ca.visible&&ga.visible){E=(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||E!=oa.flipSided){Na=o[v]=o[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(H.normal);!E&&(oa.flipSided||oa.doubleSided)&&i.normalWorld.negate();
- Ha.multiplyVector3(i.normalWorld);i.centroidWorld.copy(H.centroid);Ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);G.multiplyVector3(i.centroidScreen);ca=H.vertexNormals;T=0;for(na=ca.length;T<na;T++){ga=i.vertexNormalsWorld[T];ga.copy(ca[T]);!E&&(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=H.materialIndex!==null?
- Ia[H.materialIndex]:null;i.z=i.centroidScreen.z;s.elements.push(i)}}else if(oa instanceof THREE.Line){D.multiply(G,Ba);za=oa.geometry.vertices;T=b();T.positionScreen.copy(za[0]);D.multiplyVector4(T.positionScreen);Ba=oa.type===THREE.LinePieces?2:1;W=1;for(H=za.length;W<H;W++){T=b();T.positionScreen.copy(za[W]);D.multiplyVector4(T.positionScreen);if(!((W+1)%Ba>0)){na=j[m-2];Q.copy(T.positionScreen);S.copy(na.positionScreen);if(d(Q,S)){Q.multiplyScalar(1/Q.w);S.multiplyScalar(1/S.w);Ia=w[r]=w[r]||new THREE.RenderableLine;
- r++;n=Ia;n.v1.positionScreen.copy(Q);n.v2.positionScreen.copy(S);n.z=Math.max(Q.z,S.z);n.material=oa.material;s.elements.push(n)}}}}}a=0;for(f=s.sprites.length;a<f;a++){oa=s.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[F]=C[F]||new THREE.RenderableParticle;F++;q=h;q.x=A.x/A.w;q.y=A.y/A.w;q.z=A.z;q.rotation=oa.rotation.z;q.scale.x=oa.scale.x*Math.abs(q.x-(A.x+e.projectionMatrix.elements[0])/
- (A.w+e.projectionMatrix.elements[12]));q.scale.y=oa.scale.y*Math.abs(q.y-(A.y+e.projectionMatrix.elements[5])/(A.w+e.projectionMatrix.elements[13]));q.material=oa.material;s.elements.push(q)}}}g&&s.elements.sort(c);return s}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
- THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),h=a*b,k=d*e;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
- this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
- Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
- Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,h=a.y,k=a.z,a=a.w;this.x=b*a+e*g+c*k-d*h;this.y=
- c*a+e*h+d*g-b*k;this.z=d*a+e*k+b*h-c*g;this.w=e*a-b*g-c*h-d*k;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,h=this.y,k=this.z,m=this.w,j=m*c+h*e-k*d,i=m*d+k*c-g*e,p=m*e+g*d-h*c,c=-g*c-h*d-k*e;b.x=j*m+c*-g+i*-k-p*-h;b.y=i*m+c*-h+p*-g-j*-k;b.z=p*m+c*-k+j*-h-i*-g;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,g=this.w,h=g*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=g;this.x=
- c;this.y=d;this.z=e;return this}var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.0010){this.w=0.5*(g+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)*k)/m;k=Math.sin(b*k)/m;this.w=g*h+this.w*k;this.x=c*h+this.x*k;this.y=d*h+this.y*k;this.z=e*h+this.z*k;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),g=Math.sqrt(1-e*e);if(Math.abs(g)<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)/g;d=Math.sin(d*b)/g;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,g){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=g;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,g,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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];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 g=0,h=e.vertexNormals.length;g<h;g++)b.multiplyVector3(e.vertexNormals[g]);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,g,h=new THREE.Vector3,k=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];g=this.vertices[c.c];h.sub(g,e);k.sub(d,e);h.crossSelf(k);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 g=new THREE.Geometry;g.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,k=this.morphNormals[a].vertexNormals,m,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];m=new THREE.Vector3;j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};h.push(m);k.push(j)}}h=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();g.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
- m=h.faceNormals[c];j=h.vertexNormals[c];m.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,g,T){k=a.vertices[b];m=a.vertices[c];
- j=a.vertices[d];i=h[e];p=h[g];l=h[T];v=m.x-k.x;o=j.x-k.x;n=m.y-k.y;r=j.y-k.y;w=m.z-k.z;q=j.z-k.z;F=p.u-i.u;C=l.u-i.u;s=p.v-i.v;K=l.v-i.v;A=1/(F*K-C*s);Q.set((K*v-s*o)*A,(K*n-s*r)*A,(K*w-s*q)*A);S.set((F*o-C*v)*A,(F*r-C*n)*A,(F*q-C*w)*A);D[b].addSelf(Q);D[c].addSelf(Q);D[d].addSelf(Q);M[b].addSelf(S);M[c].addSelf(S);M[d].addSelf(S)}var b,c,d,e,g,h,k,m,j,i,p,l,v,o,n,r,w,q,F,C,s,K,A,G,D=[],M=[],Q=new THREE.Vector3,S=new THREE.Vector3,Z=new THREE.Vector3,R=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=
- this.vertices.length;b<c;b++){D[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];h=this.faceVertexUvs[0][b];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.d,0,1,3);a(this,g.b,g.c,g.d,1,2,3)}}var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){z.copy(g.vertexNormals[d]);e=g[L[d]];G=D[e];Z.copy(G);Z.subSelf(z.multiplyScalar(z.dot(G))).normalize();
- R.cross(g.vertexNormals[d],G);e=R.dot(M[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.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),g,h,k;g=0;for(h=this.vertices.length;g<h;g++){d=this.vertices[g];d=[Math.round(d.x*
- e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=g;b.push(this.vertices[g]);c[g]=b.length-1}else c[g]=c[a[d]]}g=0;for(h=this.faces.length;g<h;g++){e=this.faces[g];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[g]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(k=
- this.faceVertexUvs[e][g])&&k.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,g,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,h,k,m,j,i,p,l;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;g=Math.floor(e);h=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
- g+2;j=this.points[c[0]];i=this.points[c[1]];p=this.points[c[2]];l=this.points[c[3]];k=h*h;m=h*k;d.x=b(j.x,i.x,p.x,l.x,h,k,m);d.y=b(j.y,i.y,p.y,l.y,h,k,m);d.z=b(j.z,i.z,p.z,l.z,h,k,m);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,g=new THREE.Vector3,h=new THREE.Vector3,i=[],k=0;i[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++){b=
- a/c;d=this.getPoint(b);h.copy(d);k=k+h.distanceTo(g);g.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){i[b]=k;e=b}}i[i.length]=k;return{chunks:i,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,h,i=[],k=new THREE.Vector3,l=this.getLength();i.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++){d=e+c*(1/h)*(g-e);d=this.getPoint(d);
- i.push(k.copy(d).clone())}i.push(k.copy(this.points[b]).clone())}this.points=i}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};
- THREE.OrthographicCamera=function(a,b,c,d,e,g){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=g!==void 0?g: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,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
- THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;
- this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
- THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.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=k.crossOrigin;e.src=b}function g(a,c,d,g,h,i){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=
- d;if(g){a[c].repeat.set(g[0],g[1]);if(g[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(g[1]!=1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(i){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[i[0]]!==void 0)a[c].wrapS=g[i[0]];if(g[i[1]]!==void 0)a[c].wrapT=g[i[1]]}e(a[c],b+"/"+d)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k=this,m="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
- if(a.shading){var i=a.shading.toLowerCase();i==="phong"?m="MeshPhongMaterial":i==="basic"&&(m="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
- if(a.colorDiffuse)j.color=h(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=h(a.colorSpecular);if(a.colorAmbient)j.ambient=h(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&g(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
- a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(m.uniforms);i.tNormal.texture=j.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(j.map){i.tDiffuse.texture=j.map;i.enableDiffuse.value=true}if(j.specularMap){i.tSpecular.texture=j.specularMap;i.enableSpecular.value=true}if(j.lightMap){i.tAO.texture=j.lightMap;
- i.enableAO.value=true}i.uDiffuseColor.value.setHex(j.color);i.uSpecularColor.value.setHex(j.specular);i.uAmbientColor.value.setHex(j.ambient);i.uShininess.value=j.shininess;if(j.opacity!==void 0)i.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:i,lights:true,fog:true})}else j=new THREE[m](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};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,g){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var k=JSON.parse(h.responseText);a.loadAjaxBuffers(k,c,e,d,g)}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 g=new XMLHttpRequest,h=c+"/"+a.buffers,k=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(e){k==0&&(k=g.getResponseHeader("Content-Length"));e({total:k,loaded:g.responseText.length})}}else g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};
- g.open("GET",h,true);g.responseType="arraybuffer";g.send(null)};
- THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,m,j,i,p,l,v,o,n,r,w,q,F,C;function s(a){return a%4?4-a%4:0}function K(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,f,e,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];g=l[d*3+2];h=I[f*2];f=I[f*2+1];i=I[e*2];k=I[e*2+1];e=I[g*2];j=I[g*2+1];g=R.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,k));m.push(new THREE.UV(e,
- j));g.push(m)}}function D(b,c){var d,f,e,g,h,i,k,l,j,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=I[f*2];f=I[f*2+1];k=I[e*2];j=I[e*2+1];l=I[g*2];m=I[g*2+1];g=I[h*2];e=I[h*2+1];h=R.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(k,j));p.push(new THREE.UV(l,m));p.push(new THREE.UV(g,e));h.push(p)}}function M(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
- R.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function Q(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=k[d];R.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function S(b,c,d,f){for(var e,g,h,i,k,l,j,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];k=d[f*3];l=d[f*3+1];j=d[f*3+2];i=m[f];var n=L[l*3],p=L[l*3+1];l=L[l*3+2];var o=L[j*3],
- r=L[j*3+1];j=L[j*3+2];R.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(L[k*3],L[k*3+1],L[k*3+2]),new THREE.Vector3(n,p,l),new THREE.Vector3(o,r,j)],null,i))}}function Z(b,c,d,f){for(var e,g,h,i,k,l,j,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];j=d[f*4+1];m=d[f*4+2];n=d[f*4+3];k=p[f];var o=L[j*3],r=L[j*3+1];j=L[j*3+2];var q=L[m*3],v=L[m*3+1];m=L[m*3+2];var s=L[n*3],w=L[n*3+1];n=L[n*3+2];R.faces.push(new THREE.Face4(e,
- g,h,i,[new THREE.Vector3(L[l*3],L[l*3+1],L[l*3+2]),new THREE.Vector3(o,r,j),new THREE.Vector3(q,v,m),new THREE.Vector3(s,w,n)],null,k))}}var R=this,z=0,L=[],I=[],E,f,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(R,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,z,12);c=K(a,z+12);K(a,z+13);K(a,z+14);K(a,z+15);e=K(a,z+16);m=K(a,z+17);j=K(a,z+18);i=K(a,z+19);p=A(a,z+20);l=A(a,z+20+4);v=A(a,z+20+8);b=A(a,z+20+12);o=
- A(a,z+20+16);n=A(a,z+20+20);r=A(a,z+20+24);w=A(a,z+20+28);q=A(a,z+20+32);F=A(a,z+20+36);C=A(a,z+20+40);z=z+c;c=e*3+i;W=e*4+i;E=b*c;f=o*(c+m*3);e=n*(c+j*3);i=r*(c+m*3+j*3);c=w*W;m=q*(W+m*4);j=F*(W+j*4);z=z+function(b){var b=new Float32Array(a,b,p*3),c,d,f,e;for(c=0;c<p;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];R.vertices.push(new THREE.Vector3(d,f,e))}return p*3*Float32Array.BYTES_PER_ELEMENT}(z);z=z+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,f,e;for(c=0;c<l;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];L.push(d/
- 127,f/127,e/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(z);z=z+s(l*3);z=z+function(b){if(v){var b=new Float32Array(a,b,v*2),c,d,f;for(c=0;c<v;c++){d=b[c*2];f=b[c*2+1];I.push(d,f)}}return v*2*Float32Array.BYTES_PER_ELEMENT}(z);E=z+E+s(b*2);f=E+f+s(o*2);e=f+e+s(n*2);i=e+i+s(r*2);c=i+c+s(w*2);m=c+m+s(q*2);j=m+j+s(F*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)}})(f);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
- r*Uint32Array.BYTES_PER_ELEMENT*3;S(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);G(r,c)}})(e);(function(a){if(F){var b=a+F*Uint32Array.BYTES_PER_ELEMENT*4;Q(F,a,b+F*Uint32Array.BYTES_PER_ELEMENT*4);D(F,b)}})(m);(function(a){if(C){var b=a+C*Uint32Array.BYTES_PER_ELEMENT*4,c=b+C*Uint32Array.BYTES_PER_ELEMENT*4;Z(C,a,b,c+C*Uint32Array.BYTES_PER_ELEMENT*4);D(C,c)}})(j);b&&M(b,z,z+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*3;S(o,a,b,b+o*Uint32Array.BYTES_PER_ELEMENT*
- 3)}})(E);w&&Q(w,i,i+w*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*4;Z(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
- THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
- THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,h=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(g.status===200||g.status===0){if(g.responseText){var k=JSON.parse(g.responseText);a.createModel(k,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+"] ["+g.status+"]");else if(g.readyState===g.LOADING){if(e){h===0&&(h=g.getResponseHeader("Content-Length"));
- e({total:h,loaded:g.responseText.length})}}else g.readyState===g.HEADERS_RECEIVED&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
- THREE.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,m,j,i,p,l,v,o,n,r,w,q,F,C=a.faces;p=a.vertices;var s=a.normals,K=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]=[]}j=0;for(i=p.length;j<i;){l=new THREE.Vector3;l.x=p[j++]*b;l.y=p[j++]*b;l.z=p[j++]*b;d.vertices.push(l)}j=0;for(i=C.length;j<i;){b=C[j++];p=b&1;m=b&2;c=b&
- 4;e=b&8;v=b&16;l=b&32;n=b&64;b=b&128;if(p){r=new THREE.Face4;r.a=C[j++];r.b=C[j++];r.c=C[j++];r.d=C[j++];p=4}else{r=new THREE.Face3;r.a=C[j++];r.b=C[j++];r.c=C[j++];p=3}if(m){m=C[j++];r.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<A;c++){w=a.uvs[c];o=C[j++];F=w[o*2];o=w[o*2+1];d.faceUvs[c][m]=new THREE.UV(F,o)}if(e)for(c=0;c<A;c++){w=a.uvs[c];q=[];for(e=0;e<p;e++){o=C[j++];F=w[o*2];o=w[o*2+1];q[e]=new THREE.UV(F,o)}d.faceVertexUvs[c][m]=q}if(v){v=C[j++]*3;e=new THREE.Vector3;e.x=s[v++];e.y=s[v++];
- e.z=s[v];r.normal=e}if(l)for(c=0;c<p;c++){v=C[j++]*3;e=new THREE.Vector3;e.x=s[v++];e.y=s[v++];e.z=s[v];r.vertexNormals.push(e)}if(n){l=C[j++];l=new THREE.Color(K[l]);r.color=l}if(b)for(c=0;c<p;c++){l=C[j++];l=new THREE.Color(K[l]);r.vertexColors.push(l)}d.faces.push(r)}})(e);(function(){var b,c,e,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
- b+2){e=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,m,j,i,p;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;p=a.morphTargets[c].vertices;m=0;for(j=p.length;m<j;m=m+3){var l=new THREE.Vector3;l.x=p[m]*b;l.y=p[m+1]*b;l.z=p[m+2]*b;i.push(l)}}}if(a.morphColors!==
- void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;i=a.morphColors[c].colors;b=0;for(m=i.length;b<m;b=b+3){p=new THREE.Color(16755200);p.setRGB(i[b],i[b+1],i[b+2]);j.push(p)}}}})(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:j+"/"+a}function e(){var a;for(l in z.objects)if(!H.objects[l]){w=z.objects[l];if(w.geometry!==void 0){if(Q=H.geometries[w.geometry]){a=false;S=H.materials[w.materials[0]];(a=S instanceof THREE.ShaderMaterial)&&Q.computeTangents();s=w.position;K=w.rotation;A=w.quaternion;G=w.scale;q=w.matrix;A=0;w.materials.length==0&&(S=new THREE.MeshFaceMaterial);w.materials.length>1&&(S=new THREE.MeshFaceMaterial);
- a=new THREE.Mesh(Q,S);a.name=l;if(q){a.matrixAutoUpdate=false;a.matrix.set(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15])}else{a.position.set(s[0],s[1],s[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(K[0],K[1],K[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;H.scene.add(a);H.objects[l]=a}}else{s=w.position;K=w.rotation;A=w.quaternion;
- G=w.scale;A=0;a=new THREE.Object3D;a.name=l;a.position.set(s[0],s[1],s[2]);if(A){a.quaternion.set(A[0],A[1],A[2],A[3]);a.useQuaternion=true}else a.rotation.set(K[0],K[1],K[2]);a.scale.set(G[0],G[1],G[2]);a.visible=w.visible!==void 0?w.visible:false;H.scene.add(a);H.objects[l]=a;H.empties[l]=a}}}function g(a){return function(b){H.geometries[a]=b;e();I=I-1;m.onLoadComplete();k()}}function h(a){return function(b){H.geometries[a]=b}}function k(){m.callbackProgress({totalModels:f,totalTextures:W,loadedModels:f-
- I,loadedTextures:W-E},H);m.onLoadProgress();I==0&&E==0&&b(H)}var m=this,j=THREE.Loader.prototype.extractUrlBase(c),i,p,l,v,o,n,r,w,q,F,C,s,K,A,G,D,M,Q,S,Z,R,z,L,I,E,f,W,H;z=a;c=new THREE.BinaryLoader;L=new THREE.JSONLoader;E=I=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform){a=z.transform.position;F=z.transform.rotation;D=z.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);F&&H.scene.rotation.set(F[0],F[1],
- F[2]);D&&H.scene.scale.set(D[0],D[1],D[2]);if(a||F||D){H.scene.updateMatrix();H.scene.updateMatrixWorld()}}a=function(){E=E-1;k();m.onLoadComplete()};for(o in z.cameras){D=z.cameras[o];D.type=="perspective"?Z=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(Z=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far));s=D.position;F=D.target;D=D.up;Z.position.set(s[0],s[1],s[2]);Z.target=new THREE.Vector3(F[0],F[1],F[2]);D&&Z.up.set(D[0],D[1],D[2]);H.cameras[o]=
- Z}for(v in z.lights){F=z.lights[v];o=F.color!==void 0?F.color:16777215;Z=F.intensity!==void 0?F.intensity:1;if(F.type=="directional"){s=F.direction;C=new THREE.DirectionalLight(o,Z);C.position.set(s[0],s[1],s[2]);C.position.normalize()}else if(F.type=="point"){s=F.position;C=F.distance;C=new THREE.PointLight(o,Z,C);C.position.set(s[0],s[1],s[2])}else F.type=="ambient"&&(C=new THREE.AmbientLight(o));H.scene.add(C);H.lights[v]=C}for(n in z.fogs){v=z.fogs[n];v.type=="linear"?R=new THREE.Fog(0,v.near,
- v.far):v.type=="exp2"&&(R=new THREE.FogExp2(0,v.density));D=v.color;R.color.setRGB(D[0],D[1],D[2]);H.fogs[n]=R}if(H.cameras&&z.defaults.camera)H.currentCamera=H.cameras[z.defaults.camera];if(H.fogs&&z.defaults.fog)H.scene.fog=H.fogs[z.defaults.fog];D=z.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(D[0],D[1],D[2]);H.bgColorAlpha=z.defaults.bgalpha;for(i in z.geometries){n=z.geometries[i];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){I=I+1;m.onLoadStart()}}f=I;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);H.geometries[i]=Q}else if(n.type=="plane"){Q=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);H.geometries[i]=Q}else if(n.type=="sphere"){Q=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);H.geometries[i]=Q}else if(n.type=="cylinder"){Q=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
- n.heightSegs);H.geometries[i]=Q}else if(n.type=="torus"){Q=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);H.geometries[i]=Q}else if(n.type=="icosahedron"){Q=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);H.geometries[i]=Q}else if(n.type=="bin_mesh")c.load(d(n.url,z.urlBaseType),g(i));else if(n.type=="ascii_mesh")L.load(d(n.url,z.urlBaseType),g(i));else if(n.type=="embedded_mesh"){n=z.embeds[n.id];n.metadata=z.metadata;n&&L.createModel(n,h(i),"")}}for(r in z.textures){i=z.textures[r];
- if(i.url instanceof Array){E=E+i.url.length;for(n=0;n<i.url.length;n++)m.onLoadStart()}else{E=E+1;m.onLoadStart()}}W=E;for(r in z.textures){i=z.textures[r];if(i.mapping!=void 0&&THREE[i.mapping]!=void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){n=[];for(R=0;R<i.url.length;R++)n[R]=d(i.url[R],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){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[i.wrap[0]]!==void 0)n.wrapS=R[i.wrap[0]];if(R[i.wrap[1]]!==void 0)n.wrapT=R[i.wrap[1]]}}H.textures[r]=n}for(p in z.materials){q=z.materials[p];for(M in q.parameters)if(M==
- "envMap"||M=="map"||M=="lightMap")q.parameters[M]=H.textures[q.parameters[M]];else if(M=="shading")q.parameters[M]=q.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")q.parameters[M]=THREE[q.parameters[M]]?THREE[q.parameters[M]]:THREE.NormalBlending;else if(M=="combine")q.parameters[M]=q.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(q.parameters[M]=="face")q.parameters[M]=THREE.FaceColors;else if(q.parameters[M])q.parameters[M]=
- THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=true;if(q.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);i=q.parameters.color;n=q.parameters.specular;R=q.parameters.ambient;c=q.parameters.shininess;a.tNormal.texture=H.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=q.parameters.normalMapFactor;if(q.parameters.map){a.tDiffuse.texture=q.parameters.map;a.enableDiffuse.value=
- true}if(q.parameters.lightMap){a.tAO.texture=q.parameters.lightMap;a.enableAO.value=true}if(q.parameters.specularMap){a.tSpecular.texture=H.textures[q.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(R);a.uShininess.value=c;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;S=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else S=
- new THREE[q.type](q.parameters);H.materials[p]=S}e();m.callbackSync(H);k()};
- 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,g,h,k){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=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.format=h!==void 0?h:THREE.RGBAFormat;this.type=k!==void 0?k:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
- true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
- THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,g,h,k,m,j){THREE.Texture.call(this,null,g,h,k,m,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
- THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
- THREE.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.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
- THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,e,g,h,k;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];g=e.pos;h=e.rotq;k=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=true;k!==void 0?d.scale.set(k[0],k[1],k[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,g=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[g].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.supr=THREE.Object3D.prototype;
- THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
- THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=true;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance){this.LODs[b-1].object3D.visible=false;this.LODs[b].object3D.visible=true}else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
- false}};
- THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?
- a.useScreenCoordinates:true;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=
- new THREE.Vector2(1,1)};THREE.Sprite.prototype=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 g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=true;var h=1;g.type==="v2"?h=2:g.type==="v3"?h=3:g.type==="v4"?h=4:g.type==="c"&&(h=3);g.size=h;g.array=new Float32Array(c*h);g.buffer=f.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=true}a.__webglCustomAttributesList.push(g)}}}
- 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 g(a,b,c){var d,e,g,h,i=a.vertices;h=i.length;
- var k=a.colors,j=k.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a.verticesNeedUpdate,o=a.colorsNeedUpdate,r=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]];g=d*3;l[g]=e.x;l[g+1]=e.y;l[g+2]=e.z}for(d=0;d<j;d++){g=d*3;e=k[n[d][1]];m[g]=e.r;m[g+1]=e.g;m[g+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){i=r[k];
- if(i.boundTo===void 0||i.boundTo==="vertices"){g=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[g]=h.x;i.array[g+1]=h.y;g=g+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[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<e;d++){h=n[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<e;d++){h=n[d][1];
- h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}else{if(p)for(d=0;d<h;d++){e=i[d];g=d*3;l[g]=e.x;l[g+1]=e.y;l[g+2]=e.z}if(o)for(d=0;d<j;d++){e=k[d];g=d*3;m[g]=e.r;m[g+1]=e.g;m[g+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){i=r[k];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){e=i.value.length;g=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[g]=h.x;i.array[g+1]=h.y;g=g+2}else if(i.size===
- 3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<e;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}if(p||c.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l,b)}if(o||c.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,a.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
- m,b)}if(r){k=0;for(j=r.length;k<j;k++){i=r[k];if(i.needsUpdate||c.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,i.buffer);f.bufferData(f.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function k(a,b){return b[1]-a[1]}function m(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;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 j(a,b,c,d,f,e,g,h){var i,k,j,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==
- b;m=m+l){i=a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);q(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(k);j instanceof THREE.BufferGeometry?E.renderBufferDirect(d,f,e,i,j,k):E.renderBuffer(d,f,e,i,j,k)}}}function i(a,b,c,d,f,e,g){for(var i,h,k=0,j=a.length;k<j;k++){i=a[k];h=i.object;if(h.visible){if(g)i=g;else{i=
- i[b];if(!i)continue;e&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);q(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.renderImmediateObject(c,d,f,i,h)}}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function l(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 o(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 r(a,b,c,d,e){if(d.needsUpdate){d.program&&E.deallocateMaterial(d);E.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,i=E.maxMorphTargets;g<i;g++)e.__webglMorphTargetInfluences[g]=0}var h=false,g=d.program,i=g.uniforms,k=d.uniforms;if(g!==
- za){f.useProgram(g);za=g;h=true}if(d.id!==na){na=d.id;h=true}if(h||a!==ga){f.uniformMatrix4fv(i.projectionMatrix,false,a._projectionMatrixArray);a!==ga&&(ga=a)}if(h){if(c&&d.fog){k.fogColor.value=c.color;if(c instanceof THREE.Fog){k.fogNear.value=c.near;k.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ob){for(var j,l=0,m=0,n=0,p,o,r,q=bc,v=q.directional.colors,s=q.directional.positions,
- w=q.point.colors,z=q.point.positions,H=q.point.distances,D=q.spot.colors,F=q.spot.positions,L=q.spot.distances,K=q.spot.directions,M=q.spot.angles,Q=q.spot.exponents,R=0,T=0,S=0,I=r=0,c=I=0,h=b.length;c<h;c++){j=b[c];if(!j.onlyShadow){p=j.color;o=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(E.gammaInput){l=l+p.r*p.r;m=m+p.g*p.g;n=n+p.b*p.b}else{l=l+p.r;m=m+p.g;n=n+p.b}else if(j instanceof THREE.DirectionalLight){r=R*3;if(E.gammaInput){v[r]=p.r*p.r*o*o;v[r+1]=p.g*p.g*o*o;v[r+2]=p.b*
- p.b*o*o}else{v[r]=p.r*o;v[r+1]=p.g*o;v[r+2]=p.b*o}Ca.copy(j.matrixWorld.getPosition());Ca.subSelf(j.target.matrixWorld.getPosition());Ca.normalize();s[r]=Ca.x;s[r+1]=Ca.y;s[r+2]=Ca.z;R=R+1}else if(j instanceof THREE.PointLight){I=T*3;if(E.gammaInput){w[I]=p.r*p.r*o*o;w[I+1]=p.g*p.g*o*o;w[I+2]=p.b*p.b*o*o}else{w[I]=p.r*o;w[I+1]=p.g*o;w[I+2]=p.b*o}p=j.matrixWorld.getPosition();z[I]=p.x;z[I+1]=p.y;z[I+2]=p.z;H[T]=r;T=T+1}else if(j instanceof THREE.SpotLight){I=S*3;if(E.gammaInput){D[I]=p.r*p.r*o*o;D[I+
- 1]=p.g*p.g*o*o;D[I+2]=p.b*p.b*o*o}else{D[I]=p.r*o;D[I+1]=p.g*o;D[I+2]=p.b*o}p=j.matrixWorld.getPosition();F[I]=p.x;F[I+1]=p.y;F[I+2]=p.z;L[S]=r;Ca.copy(p);Ca.subSelf(j.target.matrixWorld.getPosition());Ca.normalize();K[I]=Ca.x;K[I+1]=Ca.y;K[I+2]=Ca.z;M[S]=Math.cos(j.angle);Q[S]=j.exponent;S=S+1}}}c=R*3;for(h=v.length;c<h;c++)v[c]=0;c=T*3;for(h=w.length;c<h;c++)w[c]=0;c=S*3;for(h=D.length;c<h;c++)D[c]=0;q.directional.length=R;q.point.length=T;q.spot.length=S;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=
- n;ob=false}c=bc;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngle.value=c.spot.angles;k.spotLightExponent.value=
- c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=d.opacity;E.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;(k.map.texture=d.map)&&k.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);k.lightMap.texture=d.lightMap;k.envMap.texture=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;
- k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){k.diffuse.value=d.color;k.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){k.psColor.value=d.color;k.opacity.value=d.opacity;k.size.value=d.size;k.scale.value=G.height/2;k.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){k.shininess.value=d.shininess;if(E.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);
- k.emissive.value.copyGammaToLinear(d.emissive);k.specular.value.copyGammaToLinear(d.specular)}else{k.ambient.value=d.ambient;k.emissive.value=d.emissive;k.specular.value=d.specular}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(E.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive)}else{k.ambient.value=d.ambient;k.emissive.value=d.emissive}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof
- THREE.MeshDepthMaterial){k.mNear.value=a.near;k.mFar.value=a.far;k.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)k.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix){h=c=0;for(j=b.length;h<j;h++){l=b[h];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){k.shadowMap.texture[c]=l.shadowMap;k.shadowMapSize.value[c]=l.shadowMapSize;k.shadowMatrix.value[c]=l.shadowMatrix;k.shadowDarkness.value[c]=l.shadowDarkness;
- k.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;k=0;for(c=b.length;k<c;k++)if(l=g.uniforms[b[k][1]]){h=b[k][0];m=h.type;j=h.value;switch(m){case "i":f.uniform1i(l,j);break;case "f":f.uniform1f(l,j);break;case "v2":f.uniform2f(l,j.x,j.y);break;case "v3":f.uniform3f(l,j.x,j.y,j.z);break;case "v4":f.uniform4f(l,j.x,j.y,j.z,j.w);break;case "c":f.uniform3f(l,j.r,j.g,j.b);break;case "fv1":f.uniform1fv(l,j);break;case "fv":f.uniform3fv(l,j);break;case "v2v":if(!h._array)h._array=new Float32Array(2*
- j.length);m=0;for(n=j.length;m<n;m++){q=m*2;h._array[q]=j[m].x;h._array[q+1]=j[m].y}f.uniform2fv(l,h._array);break;case "v3v":if(!h._array)h._array=new Float32Array(3*j.length);m=0;for(n=j.length;m<n;m++){q=m*3;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z}f.uniform3fv(l,h._array);break;case "v4v":if(!h._array)h._array=new Float32Array(4*j.length);m=0;for(n=j.length;m<n;m++){q=m*4;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z;h._array[q+3]=j[m].w}f.uniform4fv(l,h._array);
- break;case "m4":if(!h._array)h._array=new Float32Array(16);j.flattenToArray(h._array);f.uniformMatrix4fv(l,false,h._array);break;case "m4v":if(!h._array)h._array=new Float32Array(16*j.length);m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(h._array,m*16);f.uniformMatrix4fv(l,false,h._array);break;case "t":f.uniform1i(l,j);l=h.texture;if(!l)continue;if(l.image instanceof Array&&l.image.length===6){h=l;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=
- f.createTexture();f.activeTexture(f.TEXTURE0+j);f.bindTexture(f.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);j=[];for(l=0;l<6;l++){m=j;n=l;if(E.autoScaleCubemaps){q=h.image[l];s=Kc;if(!(q.width<=s&&q.height<=s)){w=Math.max(q.width,q.height);v=Math.floor(q.width*s/w);s=Math.floor(q.height*s/w);w=document.createElement("canvas");w.width=v;w.height=s;w.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,v,s);q=w}}else q=h.image[l];m[n]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;
- n=A(h.format);q=A(h.type);C(f.TEXTURE_CUBE_MAP,h,m);for(l=0;l<6;l++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,q,j[l]);h.generateMipmaps&&m&&f.generateMipmap(f.TEXTURE_CUBE_MAP);h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{f.activeTexture(f.TEXTURE0+j);f.bindTexture(f.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){h=l;f.activeTexture(f.TEXTURE0+j);f.bindTexture(f.TEXTURE_CUBE_MAP,h.__webglTexture)}else E.setTexture(l,j);break;case "tv":if(!h._array){h._array=
- [];m=0;for(n=h.texture.length;m<n;m++)h._array[m]=j+m}f.uniform1iv(l,h._array);m=0;for(n=h.texture.length;m<n;m++)(l=h.texture[m])&&E.setTexture(l,h._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();f.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&&f.uniformMatrix4fv(i.viewMatrix,
- false,a._viewMatrixArray);d.skinning&&f.uniformMatrix4fv(i.boneGlobalMatrices,false,e.boneMatrices)}f.uniformMatrix4fv(i.modelViewMatrix,false,e._modelViewMatrix.elements);i.normalMatrix&&f.uniformMatrix3fv(i.normalMatrix,false,e._normalMatrix.elements);i.objectMatrix!==null&&f.uniformMatrix4fv(i.objectMatrix,false,e.matrixWorld.elements);return g}function w(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}
- function q(a,b,c){if(sc!==a){a?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL);sc=a}if(a&&(tc!==b||uc!==c)){f.polygonOffset(b,c);tc=b;uc=c}}function F(a,b){var c;a==="fragment"?c=f.createShader(f.FRAGMENT_SHADER):a==="vertex"&&(c=f.createShader(f.VERTEX_SHADER));f.shaderSource(c,b);f.compileShader(c);if(!f.getShaderParameter(c,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(c));console.error(b);return null}return c}function C(a,b,c){if(c){f.texParameteri(a,f.TEXTURE_WRAP_S,A(b.wrapS));
- f.texParameteri(a,f.TEXTURE_WRAP_T,A(b.wrapT));f.texParameteri(a,f.TEXTURE_MAG_FILTER,A(b.magFilter));f.texParameteri(a,f.TEXTURE_MIN_FILTER,A(b.minFilter))}else{f.texParameteri(a,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(a,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(a,f.TEXTURE_MAG_FILTER,K(b.magFilter));f.texParameteri(a,f.TEXTURE_MIN_FILTER,K(b.minFilter))}}function s(a,b){f.bindRenderbuffer(f.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){f.renderbufferStorage(f.RENDERBUFFER,
- f.DEPTH_COMPONENT16,b.width,b.height);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,a)}else f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height)}function K(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;
- default:return f.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
- case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedIntType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA;
- case THREE.AddEquation:return f.FUNC_ADD;case THREE.SubtractEquation:return f.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return f.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return f.ZERO;case THREE.OneFactor:return f.ONE;case THREE.SrcColorFactor:return f.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return f.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return f.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return f.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return f.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return f.ONE_MINUS_DST_ALPHA;
- case THREE.DstColorFactor:return f.DST_COLOR;case THREE.OneMinusDstColorFactor:return f.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return f.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),D=a.precision!==void 0?a.precision:"highp",M=a.alpha!==void 0?a.alpha:true,Q=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,S=a.antialias!==void 0?a.antialias:false,Z=a.stencil!==void 0?a.stencil:
- true,R=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),L=a.clearAlpha!==void 0?a.clearAlpha:0,I=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 E=this,f,W=[],H=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:[]}};f=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:Q,antialias:S,stencil:Z,preserveDrawingBuffer:R})))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}();f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,L);this.context=f;var ec=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS);f.getParameter(f.MAX_TEXTURE_SIZE);var Kc=f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE);
- this.getContext=function(){return f};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;f.viewport(Ib,cc,Jb,Kb)};this.setScissor=function(a,b,c,d){f.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(a,b){z.setHex(a);L=b;f.clearColor(z.r,z.g,z.b,L)};this.setClearColor=function(a,
- b){z.copy(a);L=b;f.clearColor(z.r,z.g,z.b,L)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return L};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|f.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|f.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|f.STENCIL_BUFFER_BIT;f.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];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);
- f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)f.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=
- void 0;for(d in c.__webglCustomAttributesList)f.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}E.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;f.deleteBuffer(a.__webglVertexBuffer);f.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;f.deleteBuffer(a.__webglVertexBuffer);f.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;f.deleteBuffer(a.__webglVertexBuffer);
- f.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;f.deleteTexture(a.__webglTexture);E.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){f.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){f.deleteFramebuffer(a.__webglFramebuffer[b]);f.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{f.deleteFramebuffer(a.__webglFramebuffer);
- f.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;f.deleteProgram(b);E.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.hasPos&&!a.__webglVertexBuffer)a.__webglVertexBuffer=f.createBuffer();if(a.hasNormal&&!a.__webglNormalBuffer)a.__webglNormalBuffer=f.createBuffer();if(a.hasUv&&!a.__webglUvBuffer)a.__webglUvBuffer=f.createBuffer();if(a.hasPos){f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,a.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(b.attributes.position);f.vertexAttribPointer(b.attributes.position,3,f.FLOAT,false,0,0)}if(a.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
- a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,h,i,k,j,l,m,n,p=a.count*3;for(n=0;n<p;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];g=c[n+2];h=c[n+3];k=c[n+4];l=c[n+5];i=c[n+6];j=c[n+7];m=c[n+8];d=(d+h+i)/3;e=(e+k+j)/3;g=(g+l+m)/3;c[n]=d;c[n+1]=e;c[n+2]=g;c[n+3]=d;c[n+4]=e;c[n+5]=g;c[n+6]=d;c[n+7]=e;c[n+8]=g}}f.bufferData(f.ARRAY_BUFFER,a.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(b.attributes.normal);f.vertexAttribPointer(b.attributes.normal,3,f.FLOAT,false,0,0)}if(a.hasUv){f.bindBuffer(f.ARRAY_BUFFER,
- a.__webglUvBuffer);f.bufferData(f.ARRAY_BUFFER,a.uvArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(b.attributes.uv);f.vertexAttribPointer(b.attributes.uv,2,f.FLOAT,false,0,0)}f.drawArrays(f.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,g){if(d.visible!==false){c=r(a,b,c,d,g);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(g instanceof THREE.Mesh){g=e.offsets;d=0;for(c=g.length;d<c;++d){if(b){f.bindBuffer(f.ARRAY_BUFFER,e.vertexPositionBuffer);
- f.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,f.FLOAT,false,0,g[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){f.bindBuffer(f.ARRAY_BUFFER,e.vertexNormalBuffer);f.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,f.FLOAT,false,0,g[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){f.bindBuffer(f.ARRAY_BUFFER,e.vertexUvBuffer);f.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,f.FLOAT,false,0,g[d].index*8);f.enableVertexAttribArray(a.uv)}else f.disableVertexAttribArray(a.uv);
- if(a.color>=0&&e.vertexColorBuffer){f.bindBuffer(f.ARRAY_BUFFER,e.vertexColorBuffer);f.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,f.FLOAT,false,0,g[d].index*16)}f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}f.drawElements(f.TRIANGLES,g[d].count,f.UNSIGNED_SHORT,g[d].start*2);E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+g[d].count;E.info.render.faces=E.info.render.faces+g[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,g){if(d.visible!==false){var h,
- i,c=r(a,b,c,d,g),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){f.bindBuffer(f.ARRAY_BUFFER,e.__webglVertexBuffer);f.vertexAttribPointer(b.position,3,f.FLOAT,false,0,0)}}else if(g.morphTargetBase){c=d.program.attributes;if(g.morphTargetBase!==-1){f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]);f.vertexAttribPointer(c.position,3,f.FLOAT,false,0,0)}else if(c.position>=0){f.bindBuffer(f.ARRAY_BUFFER,
- e.__webglVertexBuffer);f.vertexAttribPointer(c.position,3,f.FLOAT,false,0,0)}if(g.morphTargetForcedOrder.length){var j=0;i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<i.length;){f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[j]]);f.vertexAttribPointer(c["morphTarget"+j],3,f.FLOAT,false,0,0);if(d.morphNormals){f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[j]]);f.vertexAttribPointer(c["morphNormal"+j],3,f.FLOAT,false,0,0)}g.__webglMorphTargetInfluences[j]=
- h[i[j]];j++}}else{i=[];h=g.morphTargetInfluences;var l,m=h.length;for(l=0;l<m;l++){j=h[l];j>0&&i.push([l,j])}if(i.length>d.numSupportedMorphTargets){i.sort(k);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(k):i.length===0&&i.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(i[j]){l=i[j][0];f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);f.vertexAttribPointer(c["morphTarget"+j],3,f.FLOAT,false,0,0);if(d.morphNormals){f.bindBuffer(f.ARRAY_BUFFER,
- e.__webglMorphNormalsBuffers[l]);f.vertexAttribPointer(c["morphNormal"+j],3,f.FLOAT,false,0,0)}g.__webglMorphTargetInfluences[j]=h[l]}else{f.vertexAttribPointer(c["morphTarget"+j],3,f.FLOAT,false,0,0);d.morphNormals&&f.vertexAttribPointer(c["morphNormal"+j],3,f.FLOAT,false,0,0);g.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__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){f.bindBuffer(f.ARRAY_BUFFER,c.buffer);f.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,f.FLOAT,false,0,0)}}}if(b.color>=0){f.bindBuffer(f.ARRAY_BUFFER,e.__webglColorBuffer);f.vertexAttribPointer(b.color,3,f.FLOAT,false,0,0)}if(b.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,e.__webglNormalBuffer);f.vertexAttribPointer(b.normal,3,f.FLOAT,false,0,0)}if(b.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
- e.__webglTangentBuffer);f.vertexAttribPointer(b.tangent,4,f.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,e.__webglUVBuffer);f.vertexAttribPointer(b.uv,2,f.FLOAT,false,0,0);f.enableVertexAttribArray(b.uv)}else f.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,e.__webglUV2Buffer);f.vertexAttribPointer(b.uv2,2,f.FLOAT,false,0,0);f.enableVertexAttribArray(b.uv2)}else f.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=
- 0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexABuffer);f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,false,0,0);f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,false,0,0);f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,false,0,0);f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,false,0,0)}}if(g instanceof
- THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Hb){f.lineWidth(d);Hb=d}a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);f.drawElements(f.LINES,e.__webglLineCount,f.UNSIGNED_SHORT,0)}else{a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);f.drawElements(f.TRIANGLES,e.__webglFaceCount,f.UNSIGNED_SHORT,0)}E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+e.__webglFaceCount;E.info.render.faces=E.info.render.faces+e.__webglFaceCount/3}else if(g instanceof
- THREE.Line){g=g.type===THREE.LineStrip?f.LINE_STRIP:f.LINES;d=d.linewidth;if(d!==Hb){f.lineWidth(d);Hb=d}f.drawArrays(g,0,e.__webglLineCount);E.info.render.calls++}else if(g instanceof THREE.ParticleSystem){f.drawArrays(f.POINTS,0,e.__webglParticleCount);E.info.render.calls++;E.info.render.points=E.info.render.points+e.__webglParticleCount}else if(g instanceof THREE.Ribbon){f.drawArrays(f.TRIANGLE_STRIP,0,e.__webglVertexCount);E.info.render.calls++}}};this.render=function(a,b,c,d){var e,g,k,l,n=a.__lights,
- p=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);m(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++){g=l[d];k=g.object;g.render=false;if(k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||
- dc.contains(k))){w(k,b);var o=g,r=o.object,v=o.buffer,s=void 0,s=s=void 0,s=r.material;if(s instanceof THREE.MeshFaceMaterial){s=v.materialIndex;if(s>=0){s=r.geometry.materials[s];if(s.transparent){o.transparent=s;o.opaque=null}else{o.opaque=s;o.transparent=null}}}else if(s)if(s.transparent){o.transparent=s;o.opaque=null}else{o.opaque=s;o.transparent=null}g.render=true;if(this.sortObjects)if(k.renderDepth)g.z=k.renderDepth;else{Oa.copy(k.matrixWorld.getPosition());Rb.multiplyVector3(Oa);g.z=Oa.z}}}this.sortObjects&&
- l.sort(h);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++){g=l[d];k=g.object;if(k.visible){w(k,b);k=g.object.material;if(k.transparent){g.transparent=k;g.opaque=null}else{g.opaque=k;g.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);q(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,p,true,d);i(a.__webglObjectsImmediate,
- "",b,n,p,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,p,false);i(a.__webglObjectsImmediate,"opaque",b,n,p,false);j(a.__webglObjects,false,"transparent",b,n,p,true);i(a.__webglObjectsImmediate,"transparent",b,n,p,true)}m(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){f.bindTexture(f.TEXTURE_CUBE_MAP,c.__webglTexture);f.generateMipmap(f.TEXTURE_CUBE_MAP);
- f.bindTexture(f.TEXTURE_CUBE_MAP,null)}else{f.bindTexture(f.TEXTURE_2D,c.__webglTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var g=r(a,b,c,d,e);ca=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(g,f,dc):e.render(function(a){E.renderBufferImmediate(a,g,d.shading)})};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,k=void 0,j=void 0,m=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){j=h.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,r=void 0,s=void 0,w=void 0,z=void 0,C=void 0,A=void 0,D=void 0,F={},H=q.morphTargets.length,K=q.morphNormals.length;q.geometryGroups={};r=0;for(s=q.faces.length;r<
- s;r++){w=q.faces[r];z=w.materialIndex;A=z!==void 0?z:-1;F[A]===void 0&&(F[A]={hash:A,counter:0});D=F[A].hash+"_"+F[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:K});C=w instanceof THREE.Face3?3:4;if(q.geometryGroups[D].vertices+C>65535){F[A].counter=F[A].counter+1;D=F[A].hash+"_"+F[A].counter;q.geometryGroups[D]===void 0&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,
- numMorphNormals:K})}w instanceof THREE.Face3?q.geometryGroups[D].faces3.push(r):q.geometryGroups[D].faces4.push(r);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(k in j.geometryGroups){m=j.geometryGroups[k];if(!m.__webglVertexBuffer){var I=m;I.__webglVertexBuffer=f.createBuffer();I.__webglNormalBuffer=f.createBuffer();I.__webglTangentBuffer=f.createBuffer();
- I.__webglColorBuffer=f.createBuffer();I.__webglUVBuffer=f.createBuffer();I.__webglUV2Buffer=f.createBuffer();I.__webglSkinVertexABuffer=f.createBuffer();I.__webglSkinVertexBBuffer=f.createBuffer();I.__webglSkinIndicesBuffer=f.createBuffer();I.__webglSkinWeightsBuffer=f.createBuffer();I.__webglFaceBuffer=f.createBuffer();I.__webglLineBuffer=f.createBuffer();var M=void 0,Q=void 0;if(I.numMorphTargets){I.__webglMorphTargetsBuffers=[];M=0;for(Q=I.numMorphTargets;M<Q;M++)I.__webglMorphTargetsBuffers.push(f.createBuffer())}if(I.numMorphNormals){I.__webglMorphNormalsBuffers=
- [];M=0;for(Q=I.numMorphNormals;M<Q;M++)I.__webglMorphNormalsBuffers.push(f.createBuffer())}E.info.memory.geometries++;var G=m,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=f.createBuffer();Ma.buffer.belongsToAttribute=Na;Sa.needsUpdate=true;Ma.__original=Sa}G.__webglCustomAttributesList.push(Ma)}}G.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangetsNeedUpdate=true;j.colorsNeedUpdate=
- true}}}}else if(h instanceof THREE.Ribbon){j=h.geometry;if(!j.__webglVertexBuffer){var ob=j;ob.__webglVertexBuffer=f.createBuffer();ob.__webglColorBuffer=f.createBuffer();E.info.memory.geometries++;var Xa=j,nb=Xa.vertices.length;Xa.__vertexArray=new Float32Array(nb*3);Xa.__colorArray=new Float32Array(nb*3);Xa.__webglVertexCount=nb;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){j=h.geometry;if(!j.__webglVertexBuffer){var Hb=j;Hb.__webglVertexBuffer=f.createBuffer();
- Hb.__webglColorBuffer=f.createBuffer();E.info.memory.geometries++;var fc=j,Rb=h,Ib=fc.vertices.length;fc.__vertexArray=new Float32Array(Ib*3);fc.__colorArray=new Float32Array(Ib*3);fc.__webglLineCount=Ib;b(fc,Rb);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){j=h.geometry;if(!j.__webglVertexBuffer){var Qb=j;Qb.__webglVertexBuffer=f.createBuffer();Qb.__webglColorBuffer=f.createBuffer();E.info.geometries++;var Sb=j,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);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){j=h.geometry;if(j instanceof THREE.BufferGeometry)p(i.__webglObjects,j,h);else for(k in j.geometryGroups){m=j.geometryGroups[k];p(i.__webglObjects,m,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){j=h.geometry;p(i.__webglObjects,j,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?o(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)&&o(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&&l(Fa);if(Y.verticesNeedUpdate||Y.morphTargetsNeedUpdate||Y.elementsNeedUpdate||Y.uvsNeedUpdate||Y.normalsNeedUpdate||Y.colorsNeedUpdate||Y.tangetsNeedUpdate||Tb){var V=gc,tc=Va,Ja=f.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,t=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}f.bindBuffer(f.ARRAY_BUFFER,V.__webglVertexBuffer);f.bufferData(f.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}f.bindBuffer(f.ARRAY_BUFFER,V.__webglMorphTargetsBuffers[va]);
- f.bufferData(f.ARRAY_BUFFER,Nc[va],Ja);if(Lb.morphNormals){f.bindBuffer(f.ARRAY_BUFFER,V.__webglMorphNormalsBuffers[va]);f.bufferData(f.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){f.bindBuffer(f.ARRAY_BUFFER,V.__webglSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,ia,Ja);f.bindBuffer(f.ARRAY_BUFFER,V.__webglSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,ja,Ja);f.bindBuffer(f.ARRAY_BUFFER,V.__webglSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,ka,Ja);f.bindBuffer(f.ARRAY_BUFFER,V.__webglSkinWeightsBuffer);f.bufferData(f.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){f.bindBuffer(f.ARRAY_BUFFER,V.__webglColorBuffer);f.bufferData(f.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}f.bindBuffer(f.ARRAY_BUFFER,V.__webglTangentBuffer);f.bufferData(f.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}}f.bindBuffer(f.ARRAY_BUFFER,V.__webglNormalBuffer);f.bufferData(f.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){f.bindBuffer(f.ARRAY_BUFFER,V.__webglUVBuffer);f.bufferData(f.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){f.bindBuffer(f.ARRAY_BUFFER,V.__webglUV2Buffer);f.bufferData(f.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}f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,V.__webglFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,mb,Ja);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,V.__webglLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,La,Ja)}if(Pc){$=0;for(bc=Pc.length;$<bc;$++){t=Pc[$];if(t.__original.needsUpdate){u=0;if(t.size===1)if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];t.array[u]=t.value[B.a];t.array[u+1]=t.value[B.b];t.array[u+2]=
- t.value[B.c];u=u+3}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];t.array[u]=t.value[B.a];t.array[u+1]=t.value[B.b];t.array[u+2]=t.value[B.c];t.array[u+3]=t.value[B.d];u=u+4}}else{if(t.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){Ka=t.value[aa[x]];t.array[u]=Ka;t.array[u+1]=Ka;t.array[u+2]=Ka;u=u+3}x=0;for(J=ba.length;x<J;x++){Ka=t.value[ba[x]];t.array[u]=Ka;t.array[u+1]=Ka;t.array[u+2]=Ka;t.array[u+3]=Ka;u=u+4}}}else if(t.size===2)if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(J=aa.length;x<
- J;x++){B=ra[aa[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=O.x;t.array[u+3]=O.y;t.array[u+4]=P.x;t.array[u+5]=P.y;u=u+6}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];da=t.value[B.d];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=O.x;t.array[u+3]=O.y;t.array[u+4]=P.x;t.array[u+5]=P.y;t.array[u+6]=da.x;t.array[u+7]=da.y;u=u+8}}else{if(t.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=t.value[aa[x]];t.array[u]=
- N.x;t.array[u+1]=N.y;t.array[u+2]=O.x;t.array[u+3]=O.y;t.array[u+4]=P.x;t.array[u+5]=P.y;u=u+6}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=t.value[ba[x]];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=O.x;t.array[u+3]=O.y;t.array[u+4]=P.x;t.array[u+5]=P.y;t.array[u+6]=da.x;t.array[u+7]=da.y;u=u+8}}}else if(t.size===3){var X;X=t.type==="c"?["r","g","b"]:["x","y","z"];if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];t.array[u]=
- N[X[0]];t.array[u+1]=N[X[1]];t.array[u+2]=N[X[2]];t.array[u+3]=O[X[0]];t.array[u+4]=O[X[1]];t.array[u+5]=O[X[2]];t.array[u+6]=P[X[0]];t.array[u+7]=P[X[1]];t.array[u+8]=P[X[2]];u=u+9}x=0;for(J=ba.length;x<J;x++){B=ra[ba[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];da=t.value[B.d];t.array[u]=N[X[0]];t.array[u+1]=N[X[1]];t.array[u+2]=N[X[2]];t.array[u+3]=O[X[0]];t.array[u+4]=O[X[1]];t.array[u+5]=O[X[2]];t.array[u+6]=P[X[0]];t.array[u+7]=P[X[1]];t.array[u+8]=P[X[2]];t.array[u+9]=da[X[0]];t.array[u+
- 10]=da[X[1]];t.array[u+11]=da[X[2]];u=u+12}}else if(t.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=t.value[aa[x]];t.array[u]=N[X[0]];t.array[u+1]=N[X[1]];t.array[u+2]=N[X[2]];t.array[u+3]=O[X[0]];t.array[u+4]=O[X[1]];t.array[u+5]=O[X[2]];t.array[u+6]=P[X[0]];t.array[u+7]=P[X[1]];t.array[u+8]=P[X[2]];u=u+9}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=t.value[ba[x]];t.array[u]=N[X[0]];t.array[u+1]=N[X[1]];t.array[u+2]=N[X[2]];t.array[u+3]=O[X[0]];t.array[u+4]=O[X[1]];t.array[u+5]=O[X[2]];t.array[u+
- 6]=P[X[0]];t.array[u+7]=P[X[1]];t.array[u+8]=P[X[2]];t.array[u+9]=da[X[0]];t.array[u+10]=da[X[1]];t.array[u+11]=da[X[2]];u=u+12}}}else if(t.size===4)if(t.boundTo===void 0||t.boundTo==="vertices"){x=0;for(J=aa.length;x<J;x++){B=ra[aa[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=N.z;t.array[u+3]=N.w;t.array[u+4]=O.x;t.array[u+5]=O.y;t.array[u+6]=O.z;t.array[u+7]=O.w;t.array[u+8]=P.x;t.array[u+9]=P.y;t.array[u+10]=P.z;t.array[u+11]=P.w;u=u+12}x=0;for(J=
- ba.length;x<J;x++){B=ra[ba[x]];N=t.value[B.a];O=t.value[B.b];P=t.value[B.c];da=t.value[B.d];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=N.z;t.array[u+3]=N.w;t.array[u+4]=O.x;t.array[u+5]=O.y;t.array[u+6]=O.z;t.array[u+7]=O.w;t.array[u+8]=P.x;t.array[u+9]=P.y;t.array[u+10]=P.z;t.array[u+11]=P.w;t.array[u+12]=da.x;t.array[u+13]=da.y;t.array[u+14]=da.z;t.array[u+15]=da.w;u=u+16}}else if(t.boundTo==="faces"){x=0;for(J=aa.length;x<J;x++){P=O=N=Ka=t.value[aa[x]];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+
- 2]=N.z;t.array[u+3]=N.w;t.array[u+4]=O.x;t.array[u+5]=O.y;t.array[u+6]=O.z;t.array[u+7]=O.w;t.array[u+8]=P.x;t.array[u+9]=P.y;t.array[u+10]=P.z;t.array[u+11]=P.w;u=u+12}x=0;for(J=ba.length;x<J;x++){da=P=O=N=Ka=t.value[ba[x]];t.array[u]=N.x;t.array[u+1]=N.y;t.array[u+2]=N.z;t.array[u+3]=N.w;t.array[u+4]=O.x;t.array[u+5]=O.y;t.array[u+6]=O.z;t.array[u+7]=O.w;t.array[u+8]=P.x;t.array[u+9]=P.y;t.array[u+10]=P.z;t.array[u+11]=P.w;t.array[u+12]=da.x;t.array[u+13]=da.y;t.array[u+14]=da.z;t.array[u+15]=da.w;
- u=u+16}}f.bindBuffer(f.ARRAY_BUFFER,t.buffer);f.bufferData(f.ARRAY_BUFFER,t.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=f.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}f.bindBuffer(f.ARRAY_BUFFER,
- Fb.__webglVertexBuffer);f.bufferData(f.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}f.bindBuffer(f.ARRAY_BUFFER,Fb.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ec,Vc)}}Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false}else if(Va instanceof THREE.Line){Fa=c(Va,gc);Tb=Fa.attributes&&l(Fa);if(Y.verticesNeedUpdate||Y.colorsNeedUpdate||Tb){var tb=Y,Sc=f.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}f.bindBuffer(f.ARRAY_BUFFER,tb.__webglVertexBuffer);f.bufferData(f.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}f.bindBuffer(f.ARRAY_BUFFER,tb.__webglColorBuffer);
- f.bufferData(f.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}f.bindBuffer(f.ARRAY_BUFFER,fa.buffer);f.bufferData(f.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&&l(Fa);(Y.verticesNeedUpdate||Y.colorsNeedUpdate||
- Va.sortParticles||Tb)&&g(Y,f.DYNAMIC_DRAW,Va);Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false;Fa.attributes&&v(Fa)}}};this.initMaterial=function(a,b,c,d){var e,g,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,n;j=m=n=i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&i++}}if(n+i+m<=I){k=m;l=n;m=i}else{k=Math.ceil(I*m/(n+m));m=l=I-k}var p=0,i=0;for(n=b.length;i<n;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&p++;
- j instanceof THREE.DirectionalLight&&!j.shadowCascade&&p++}}var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var o;a:{j=a.fragmentShader;n=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:p,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(n)}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++;o=k.program;
- break a}}r=f.createProgram();d=["precision "+D+" float;",ec>0?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
- "",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.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 "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
- "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
- j=F("fragment",k+j);d=F("vertex",d+n);f.attachShader(r,d);f.attachShader(r,j);f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");f.deleteShader(j);f.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in i)d.push(s);
- s=d;d=0;for(i=s.length;d<i;d++){n=s[d];r.uniforms[n]=f.getUniformLocation(r,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(o in b)d.push(o);o=d;s=0;for(b=o.length;s<b;s++){c=o[s];r.attributes[c]=f.getAttribLocation(r,c)}r.id=H++;W.push({program:r,code:h,usedTimes:1});E.info.memory.programs=W.length;o=r}a.program=o;o=a.program.attributes;
- o.position>=0&&f.enableVertexAttribArray(o.position);o.color>=0&&f.enableVertexAttribArray(o.color);o.normal>=0&&f.enableVertexAttribArray(o.normal);o.tangent>=0&&f.enableVertexAttribArray(o.tangent);if(a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0){f.enableVertexAttribArray(o.skinVertexA);f.enableVertexAttribArray(o.skinVertexB);f.enableVertexAttribArray(o.skinIndex);f.enableVertexAttribArray(o.skinWeight)}if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=
- 0&&f.enableVertexAttribArray(o[g]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(g=0;g<this.maxMorphTargets;g++){s=b+g;if(o[s]>=0){f.enableVertexAttribArray(o[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(g=0;g<this.maxMorphNormals;g++){s=b+g;if(o[s]>=0){f.enableVertexAttribArray(o[s]);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"?f.frontFace(f.CCW):f.frontFace(f.CW);a==="back"?f.cullFace(f.BACK):a==="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.setObjectFaces=function(a){if(Ba!==a.doubleSided){a.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);Ba=a.doubleSided}if(Ha!==a.flipSided){a.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);Ha=a.flipSided}};this.setDepthTest=function(a){if(Xa!==a){a?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
- Xa=a}};this.setDepthWrite=function(a){if(nb!==a){f.depthMask(a);nb=a}};this.setBlending=function(a,b,c,d){if(a!==Ia){switch(a){case THREE.NoBlending:f.disable(f.BLEND);break;case THREE.AdditiveBlending:f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,
- f.SRC_COLOR);break;case THREE.CustomBlending:f.enable(f.BLEND);break;default:f.enable(f.BLEND);f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD);f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}Ia=a}if(a===THREE.CustomBlending){if(b!==Sa){f.blendEquation(A(b));Sa=b}if(c!==Ua||d!==Na){f.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=f.createTexture();E.info.memory.textures++}f.activeTexture(f.TEXTURE0+
- b);f.bindTexture(f.TEXTURE_2D,a.__webglTexture);f.pixelStorei(f.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),g=A(a.type);C(f.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,e,c.width,c.height,0,e,g,c.data):f.texImage2D(f.TEXTURE_2D,0,e,e,g,a.image);a.generateMipmaps&&d&&f.generateMipmap(f.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{f.activeTexture(f.TEXTURE0+b);f.bindTexture(f.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=f.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=[];f.bindTexture(f.TEXTURE_CUBE_MAP,a.__webglTexture);C(f.TEXTURE_CUBE_MAP,a,c);for(var g=0;g<6;g++){a.__webglFramebuffer[g]=
- f.createFramebuffer();a.__webglRenderbuffer[g]=f.createRenderbuffer();f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,d,a.width,a.height,0,d,e,null);var h=a,i=f.TEXTURE_CUBE_MAP_POSITIVE_X+g;f.bindFramebuffer(f.FRAMEBUFFER,a.__webglFramebuffer[g]);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,i,h.__webglTexture,0);s(a.__webglRenderbuffer[g],a)}c&&f.generateMipmap(f.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=f.createFramebuffer();a.__webglRenderbuffer=f.createRenderbuffer();f.bindTexture(f.TEXTURE_2D,
- a.__webglTexture);C(f.TEXTURE_2D,a,c);f.texImage2D(f.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=f.TEXTURE_2D;f.bindFramebuffer(f.FRAMEBUFFER,a.__webglFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&f.generateMipmap(f.TEXTURE_2D)}b?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.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){f.bindFramebuffer(f.FRAMEBUFFER,b);f.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,g){THREE.CameraHelper.__v.set(d,e,g);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.supr=THREE.Object3D.prototype;
- THREE.LensFlare.prototype.add=function(a,b,c,d,e,g){b===void 0&&(b=-1);c===void 0&&(c=0);g===void 0&&(g=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:g,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,g,h,k,m,j,i,p,l,v;this.init=function(o){b=o.context;c=o;d=new Float32Array(16);e=new Uint16Array(6);o=0;d[o++]=-1;d[o++]=-1;d[o++]=0;d[o++]=0;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=
- 0;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);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);k=b.createTexture();m=b.createTexture();b.bindTexture(b.TEXTURE_2D,k);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,m);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
- b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;i=a(THREE.ShaderFlares.lensFlare)}else{j=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}p={};l={};p.vertex=b.getAttribLocation(i,"position");p.uv=b.getAttribLocation(i,"uv");l.renderType=b.getUniformLocation(i,"renderType");l.map=b.getUniformLocation(i,"map");l.occlusionMap=b.getUniformLocation(i,"occlusionMap");l.opacity=b.getUniformLocation(i,"opacity");l.color=b.getUniformLocation(i,
- "color");l.scale=b.getUniformLocation(i,"scale");l.rotation=b.getUniformLocation(i,"rotation");l.screenPosition=b.getUniformLocation(i,"screenPosition");v=false};this.render=function(a,d,e,w){var a=a.__webglFlares,q=a.length;if(q){var F=new THREE.Vector3,C=w/e,s=e*0.5,K=w*0.5,A=16/w,G=new THREE.Vector2(A*C,A),D=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),Q=l,A=p;b.useProgram(i);if(!v){b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);v=true}b.uniform1i(Q.occlusionMap,0);b.uniform1i(Q.map,
- 1);b.bindBuffer(b.ARRAY_BUFFER,g);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 S,Z,R,z,L;for(S=0;S<q;S++){A=16/w;G.set(A*C,A);z=a[S];F.set(z.matrixWorld.elements[12],z.matrixWorld.elements[13],z.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(F);d.projectionMatrix.multiplyVector3(F);D.copy(F);M.x=D.x*s+s;M.y=D.y*K+K;if(j||M.x>0&&M.x<e&&M.y>0&&
- M.y<w){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,k);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,D.x,D.y,D.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,m);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,k);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(D);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(Q.renderType,2);b.enable(b.BLEND);Z=0;for(R=z.lensFlares.length;Z<R;Z++){L=z.lensFlares[Z];if(L.opacity>0.0010&&L.scale>0.0010){D.x=L.x;D.y=L.y;D.z=L.z;A=L.size*L.scale/w;G.x=A*C;G.y=A;b.uniform3f(Q.screenPosition,D.x,D.y,D.z);b.uniform2f(Q.scale,G.x,G.y);b.uniform1f(Q.rotation,L.rotation);b.uniform1f(Q.opacity,L.opacity);
- b.uniform3f(Q.color,L.color.r,L.color.g,L.color.b);c.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst);c.setTexture(L.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,g=new THREE.Matrix4,h=new THREE.Vector3,k=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
- function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,j){var i,p,l,v,o,n,r,w,q,F=[];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(p=m.__lights.length;i<p;i++){l=m.__lights[i];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(o=0;o<l.shadowCascadeCount;o++){var C;if(l.shadowCascadeArray[o])C=l.shadowCascadeArray[o];
- else{q=l;r=o;C=new THREE.DirectionalLight;C.isVirtual=true;C.onlyShadow=true;C.castShadow=true;C.shadowCameraNear=q.shadowCameraNear;C.shadowCameraFar=q.shadowCameraFar;C.shadowCameraLeft=q.shadowCameraLeft;C.shadowCameraRight=q.shadowCameraRight;C.shadowCameraBottom=q.shadowCameraBottom;C.shadowCameraTop=q.shadowCameraTop;C.shadowCameraVisible=q.shadowCameraVisible;C.shadowDarkness=q.shadowDarkness;C.shadowBias=q.shadowCascadeBias[r];C.shadowMapWidth=q.shadowCascadeWidth[r];C.shadowMapHeight=q.shadowCascadeHeight[r];
- C.pointsWorld=[];C.pointsFrustum=[];w=C.pointsWorld;n=C.pointsFrustum;for(var s=0;s<8;s++){w[s]=new THREE.Vector3;n[s]=new THREE.Vector3}w=q.shadowCascadeNearZ[r];q=q.shadowCascadeFarZ[r];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,q);n[5].set(1,-1,q);n[6].set(-1,1,q);n[7].set(1,1,q);C.originalCamera=j;n=new THREE.Gyroscope;n.position=l.shadowCascadeOffset;n.add(C);n.add(C.target);j.add(n);l.shadowCascadeArray[o]=C;console.log("Created virtualLight",C)}r=l;w=
- o;q=r.shadowCascadeArray[w];q.position.copy(r.position);q.target.position.copy(r.target.position);q.lookAt(q.target);q.shadowCameraVisible=r.shadowCameraVisible;q.shadowDarkness=r.shadowDarkness;q.shadowBias=r.shadowCascadeBias[w];n=r.shadowCascadeNearZ[w];r=r.shadowCascadeFarZ[w];q=q.pointsFrustum;q[0].z=n;q[1].z=n;q[2].z=n;q[3].z=n;q[4].z=r;q[5].z=r;q[6].z=r;q[7].z=r;F[v]=C;v++}else{F[v]=l;v++}}i=0;for(p=F.length;i<p;i++){l=F[i];if(!l.shadowMap){l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,
- l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight);l.shadowMatrix=new THREE.Matrix4}if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,
- l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(l.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&C.originalCamera==j){o=j;v=l.shadowCamera;n=l.pointsFrustum;q=l.pointsWorld;h.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(r=
- 0;r<8;r++){w=q[r];w.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(w,o);v.matrixWorldInverse.multiplyVector3(w);if(w.x<h.x)h.x=w.x;if(w.x>k.x)k.x=w.x;if(w.y<h.y)h.y=w.y;if(w.y>k.y)k.y=w.y;if(w.z<h.z)h.z=w.z;if(w.z>k.z)k.z=w.z}v.left=h.x;v.right=k.x;v.top=k.y;v.bottom=h.y;v.updateProjectionMatrix()}v=l.shadowMap;n=l.shadowMatrix;o=l.shadowCamera;o.position.copy(l.matrixWorld.getPosition());o.lookAt(l.target.matrixWorld.getPosition());o.updateMatrixWorld();o.matrixWorldInverse.getInverse(o.matrixWorld);
- if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;l.shadowCameraVisible&&l.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(o.projectionMatrix);n.multiplySelf(o.matrixWorldInverse);if(!o._viewMatrixArray)o._viewMatrixArray=new Float32Array(16);if(!o._projectionMatrixArray)o._projectionMatrixArray=new Float32Array(16);o.matrixWorldInverse.flattenToArray(o._viewMatrixArray);o.projectionMatrix.flattenToArray(o._projectionMatrixArray);g.multiply(o.projectionMatrix,
- o.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(v);b.clear();q=m.__webglObjects;l=0;for(v=q.length;l<v;l++){r=q[l];n=r.object;r.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(o.matrixWorldInverse,n.matrixWorld);r.render=true}}l=0;for(v=q.length;l<v;l++){r=q[l];if(r.render){n=r.object;r=r.buffer;w=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?
- b.renderBufferDirect(o,m.__lights,null,w,r,n):b.renderBuffer(o,m.__lights,null,w,r,n)}}q=m.__webglObjectsImmediate;l=0;for(v=q.length;l<v;l++){r=q[l];n=r.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(o.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(o,m.__lights,null,c,n)}}}i=b.getClearColor();p=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,p);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,g,h,k,m,j,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;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);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,l=b.createProgram(),v=b.createShader(b.FRAGMENT_SHADER),o=b.createShader(b.VERTEX_SHADER);b.shaderSource(v,a.fragmentShader);b.shaderSource(o,a.vertexShader);b.compileShader(v);b.compileShader(o);b.attachShader(l,v);b.attachShader(l,o);b.linkProgram(l);k=l;m={};j={};m.position=b.getAttribLocation(k,"position");m.uv=b.getAttribLocation(k,"uv");j.uvOffset=b.getUniformLocation(k,"uvOffset");j.uvScale=b.getUniformLocation(k,
- "uvScale");j.rotation=b.getUniformLocation(k,"rotation");j.scale=b.getUniformLocation(k,"scale");j.alignment=b.getUniformLocation(k,"alignment");j.color=b.getUniformLocation(k,"color");j.map=b.getUniformLocation(k,"map");j.opacity=b.getUniformLocation(k,"opacity");j.useScreenCoordinates=b.getUniformLocation(k,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(k,"affectedByDistance");j.screenPosition=b.getUniformLocation(k,"screenPosition");j.modelViewMatrix=b.getUniformLocation(k,"modelViewMatrix");
- j.projectionMatrix=b.getUniformLocation(k,"projectionMatrix");i=false};this.render=function(d,e,v,o){var d=d.__webglSprites,n=d.length;if(n){var r=m,w=j,q=o/v,v=v*0.5,F=o*0.5,C=true;b.useProgram(k);if(!i){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);i=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
- h);b.uniformMatrix4fv(w.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(w.map,0);for(var s,K=[],r=0;r<n;r++){s=d[r];if(s.visible&&s.opacity!==0)if(s.useScreenCoordinates)s.z=-s.position.z;else{s._modelViewMatrix.multiply(e.matrixWorldInverse,s.matrixWorld);s.z=-s._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<n;r++){s=d[r];if(s.visible&&s.opacity!==0&&s.map&&s.map.image&&s.map.image.width){if(s.useScreenCoordinates){b.uniform1i(w.useScreenCoordinates,1);
- b.uniform3f(w.screenPosition,(s.position.x-v)/v,(F-s.position.y)/F,Math.max(0,Math.min(1,s.position.z)))}else{b.uniform1i(w.useScreenCoordinates,0);b.uniform1i(w.affectedByDistance,s.affectedByDistance?1:0);b.uniformMatrix4fv(w.modelViewMatrix,false,s._modelViewMatrix.elements)}e=s.map.image.width/(s.scaleByViewport?o:1);K[0]=e*q*s.scale.x;K[1]=e*s.scale.y;b.uniform2f(w.uvScale,s.uvScale.x,s.uvScale.y);b.uniform2f(w.uvOffset,s.uvOffset.x,s.uvOffset.y);b.uniform2f(w.alignment,s.alignment.x,s.alignment.y);
- b.uniform1f(w.opacity,s.opacity);b.uniform3f(w.color,s.color.r,s.color.g,s.color.b);b.uniform1f(w.rotation,s.rotation);b.uniform2fv(w.scale,K);if(s.mergeWith3D&&!C){b.enable(b.DEPTH_TEST);C=true}else if(!s.mergeWith3D&&C){b.disable(b.DEPTH_TEST);C=false}c.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst);c.setTexture(s.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}"}};
|