// ThreeWebGL.js r40 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(b){this.setHex(b)}; THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var g,h,p,o,q,r;if(e==0)g=h=p=0;else{o=Math.floor(b*6);q=b*6-o;b=e*(1-d);r=e*(1-d*q);d=e*(1-d*(1-q));switch(o){case 1:g=r;h=e;p=b;break;case 2:g=b;h=e;p=d;break;case 3:g=b;h=r;p=e;break;case 4:g=d;h=b;p=e;break;case 5:g=e;h=b;p=r;break;case 6:case 0:g=e;h=d;p=b}}this.setRGB(g, h,p)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)}; THREE.Vector3.prototype={set:function(b,d,e){this.x=b;this.y=d;this.z=e;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,e=this.y,g=this.z;this.set(e*b.z-g*b.y,g*b.x-d*b.z,d*b.y-e*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,e=this.y-b.y;b=this.z-b.z;return d*d+e*e+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b= this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var d=Math.cos(this.y);this.y=Math.asin(b.n13);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n12/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,g){this.set(b||0,d||0,e||0,g||1)}; THREE.Vector4.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;this.w=g;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,g,h=[];d=0;for(e=b.length;d0&&P>0&&X+P<1}var e,g,h,p,o,q,r,v,E,G,H,C=b.geometry,F=C.vertices,O=[];e=0;for(g=C.faces.length;e0:E<0)){v=v.dot((new THREE.Vector3).sub(p,G))/E;G=G.addSelf(H.multiplyScalar(v));if(h instanceof THREE.Face3){if(d(G,p,o,q)){h={distance:this.origin.distanceTo(G),point:G,face:h,object:b};O.push(h)}}else if(h instanceof THREE.Face4&&(d(G,p,o,r)||d(G,o,q,r))){h={distance:this.origin.distanceTo(G),point:G,face:h,object:b};O.push(h)}}}return O}}; THREE.Rectangle=function(){function b(){p=g-d;o=h-e}var d,e,g,h,p,o,q=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return p};this.getHeight=function(){return o};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(r,v,E,G){q=!1;d=r;e=v;g=E;h=G;b()};this.addPoint=function(r,v){if(q){q=!1;d=r;e=v;g=r;h=v}else{d=dr?g:r;h=h>v?h:v}b()}; this.add3Points=function(r,v,E,G,H,C){if(q){q=!1;d=rE?r>H?r:H:E>H?E:H;h=v>G?v>C?v:C:G>C?G:C}else{d=rE?r>H?r>g?r:g:H>g?H:g:E>H?E>g?E:g:H>g?H:g;h=v>G?v>C?v>h?v:h:C>h?C:h:G>C?G>h?G:h:C>h?C:h}b()};this.addRectangle=function(r){if(q){q=!1;d=r.getLeft();e=r.getTop();g=r.getRight();h=r.getBottom()}else{d=dr.getRight()? g:r.getRight();h=h>r.getBottom()?h:r.getBottom()}b()};this.inflate=function(r){d-=r;e-=r;g+=r;h+=r;b()};this.minSelf=function(r){d=d>r.getLeft()?d:r.getLeft();e=e>r.getTop()?e:r.getTop();g=g=0&&Math.min(h,r.getBottom())-Math.max(e,r.getTop())>=0};this.empty=function(){q=!0;h=g=e=d=0;b()};this.isEmpty=function(){return q}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}}; THREE.Matrix4=function(b,d,e,g,h,p,o,q,r,v,E,G,H,C,F,O){this.set(b||1,d||0,e||0,g||0,h||0,p||1,o||0,q||0,r||0,v||0,E||1,G||0,H||0,C||0,F||0,O||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(b,d,e,g,h,p,o,q,r,v,E,G,H,C,F,O){this.n11=b;this.n12=d;this.n13=e;this.n14=g;this.n21=h;this.n22=p;this.n23=o;this.n24=q;this.n31=r;this.n32=v;this.n33=E;this.n34=G;this.n41=H;this.n42=C;this.n43=F;this.n44=O;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var g=THREE.Matrix4.__v1, h=THREE.Matrix4.__v2,p=THREE.Matrix4.__v3;p.sub(b,d).normalize();if(p.length()===0)p.z=1;g.cross(e,p).normalize();if(g.length()===0){p.x+=1.0E-4;g.cross(e,p).normalize()}h.cross(p,g).normalize();this.n11=g.x;this.n12=h.x;this.n13=p.x;this.n21=g.y;this.n22=h.y;this.n23=p.y;this.n31=g.z;this.n32=h.z;this.n33=p.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,g=b.z,h=1/(this.n41*d+this.n42*e+this.n43*g+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*g+this.n14)*h;b.y=(this.n21*d+this.n22*e+this.n23* g+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*g+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,g=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*g+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*g+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*g+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*g+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,g=b.z;b.x=d*this.n11+e*this.n12+g*this.n13;b.y=d*this.n21+e*this.n22+g*this.n23;b.z=d*this.n31+e*this.n32+g*this.n33;b.normalize(); return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,g=b.n12,h=b.n13,p=b.n14,o=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,G=b.n32,H=b.n33,C=b.n34,F=b.n41,O=b.n42,P=b.n43,L=b.n44,ea=d.n11,W=d.n12,Z=d.n13,X=d.n14,M=d.n21,Ia=d.n22, fa=d.n23,Fa=d.n24,ha=d.n31,T=d.n32,c=d.n33,ia=d.n34;this.n11=e*ea+g*M+h*ha;this.n12=e*W+g*Ia+h*T;this.n13=e*Z+g*fa+h*c;this.n14=e*X+g*Fa+h*ia+p;this.n21=o*ea+q*M+r*ha;this.n22=o*W+q*Ia+r*T;this.n23=o*Z+q*fa+r*c;this.n24=o*X+q*Fa+r*ia+v;this.n31=E*ea+G*M+H*ha;this.n32=E*W+G*Ia+H*T;this.n33=E*Z+G*fa+H*c;this.n34=E*X+G*Fa+H*ia+C;this.n41=F*ea+O*M+P*ha;this.n42=F*W+O*Ia+P*T;this.n43=F*Z+O*fa+P*c;this.n44=F*X+O*Fa+P*ia+L;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]= this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,p=this.n22,o=this.n23,q=this.n24,r=this.n31,v=this.n32,E=this.n33,G=this.n34,H=this.n41,C=this.n42,F=this.n43,O=this.n44;return g*o*v*H-e*q*v*H-g*p*E*H+d*q*E*H+e*p*G*H-d*o*G*H-g*o*r*C+e*q*r*C+g*h*E*C-b*q*E*C-e*h*G*C+b*o*G*C+g*p*r*F-d*q*r*F-g*h*v*F+b*q*v*F+d*h*G*F-b*p*G*F-e*p*r*O+d*o*r*O+e*h*v*O-b*o*v*O-d*h*E*O+b*p*E*O},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42; b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0, 0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),g=Math.sin(d),h= 1-e,p=b.x,o=b.y,q=b.z,r=h*p,v=h*o;this.set(r*p+e,r*o-g*q,r*q+g*o,0,r*o+g*q,v*o+e,v*q-g*p,0,r*q-g*o,v*q+g*p,h*q*q+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY= new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,g=b.z;b=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var p=Math.cos(g);g=Math.sin(g);var o=b*e,q=d*e;this.n11=h*p;this.n12=-h*g;this.n13=e;this.n21=q*p+b*g;this.n22=-q*g+b*p;this.n23=-d*h;this.n31=-o*p+d*g;this.n32=o*g+ d*p;this.n33=b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,g=b.z,h=b.w,p=d+d,o=e+e,q=g+g;b=d*p;var r=d*o;d*=q;var v=e*o;e*=q;g*=q;p*=h;o*=h;h*=q;this.n11=1-(v+g);this.n12=r-h;this.n13=d+o;this.n21=r+h;this.n22=1-(b+g);this.n23=e-p;this.n31=d-o;this.n32=e+p;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this}, extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,g=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*g;this.n22=b.n22*g;this.n32=b.n32*g;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}}; THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,g=b.n12,h=b.n13,p=b.n14,o=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,G=b.n32,H=b.n33,C=b.n34,F=b.n41,O=b.n42,P=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=r*C*O-v*H*O+v*G*P-q*C*P-r*G*L+q*H*L;d.n12=p*H*O-h*C*O-p*G*P+g*C*P+h*G*L-g*H*L;d.n13=h*v*O-p*r*O+p*q*P-g*v*P-h*q*L+g*r*L;d.n14=p*r*G-h*v*G-p*q*H+g*v*H+h*q*C-g*r*C;d.n21=v*H*F-r*C*F-v*E*P+o*C*P+r*E*L-o*H*L;d.n22=h*C*F-p*H*F+p*E*P-e*C*P-h*E*L+e*H*L;d.n23=p*r*F-h*v*F-p*o*P+e*v*P+h*o*L-e*r*L; d.n24=h*v*E-p*r*E+p*o*H-e*v*H-h*o*C+e*r*C;d.n31=q*C*F-v*G*F+v*E*O-o*C*O-q*E*L+o*G*L;d.n32=p*G*F-g*C*F-p*E*O+e*C*O+g*E*L-e*G*L;d.n33=h*v*F-p*q*F+p*o*O-e*v*O-g*o*L+e*q*L;d.n34=p*q*E-g*v*E-p*o*G+e*v*G+g*o*C-e*q*C;d.n41=r*G*F-q*H*F-r*E*O+o*H*O+q*E*P-o*G*P;d.n42=g*H*F-h*G*F+h*E*O-e*H*O-g*E*P+e*G*P;d.n43=h*q*F-g*r*F-h*o*O+e*r*O+g*o*P-e*q*P;d.n44=g*r*E-h*q*E+h*o*G-e*r*G-g*o*H+e*q*H;d.multiplyScalar(1/b.determinant());return d}; THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,g=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,p=b.n32*b.n21-b.n31*b.n22,o=-b.n33*b.n12+b.n32*b.n13,q=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*g+b.n21*o+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*g;e[1]=b*h;e[2]=b*p;e[3]=b*o;e[4]=b*q;e[5]=b*r;e[6]=b*v;e[7]=b*E;e[8]=b*G;return d}; THREE.Matrix4.makeFrustum=function(b,d,e,g,h,p){var o;o=new THREE.Matrix4;o.n11=2*h/(d-b);o.n12=0;o.n13=(d+b)/(d-b);o.n14=0;o.n21=0;o.n22=2*h/(g-e);o.n23=(g+e)/(g-e);o.n24=0;o.n31=0;o.n32=0;o.n33=-(p+h)/(p-h);o.n34=-2*p*h/(p-h);o.n41=0;o.n42=0;o.n43=-1;o.n44=0;return o};THREE.Matrix4.makePerspective=function(b,d,e,g){var h;b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,g)}; THREE.Matrix4.makeOrtho=function(b,d,e,g,h,p){var o,q,r,v;o=new THREE.Matrix4;q=d-b;r=e-g;v=p-h;o.n11=2/q;o.n12=0;o.n13=0;o.n14=-((d+b)/q);o.n21=0;o.n22=2/r;o.n23=0;o.n24=-((e+g)/r);o.n31=0;o.n32=0;o.n33=-2/v;o.n34=-((p+h)/v);o.n41=0;o.n42=0;o.n43=0;o.n44=1;return o};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale= 1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== -1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==undefined;)d=d.parent;d!==undefined&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},getChildByName:function(b,d){var e,g,h;e=0;for(g=this.children.length;e=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var p=Math.acos(h),o=Math.sqrt(1-h*h);if(Math.abs(o)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}h=Math.sin((1-g)*p)/o;g=Math.sin(g*p)/o;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,e,g,h,p){this.a=b;this.b=d;this.c=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=p instanceof Array?p:[p];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,e,g,h,p,o){this.a=b;this.b=d;this.c=e;this.d=g;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=p instanceof THREE.Color?p:new THREE.Color;this.vertexColors=p instanceof Array?p:[];this.vertexTangents=[];this.materials=o instanceof Array?o:[o];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;dthis.points.length-2?p:p+1;e[3]=p>this.points.length-3?p:p+2;v=this.points[e[0]];E=this.points[e[1]]; G=this.points[e[2]];H=this.points[e[3]];q=o*o;r=o*q;g.x=d(v.x,E.x,G.x,H.x,o,q,r);g.y=d(v.y,E.y,G.y,H.y,o,q,r);g.z=d(v.z,E.z,G.z,H.z,o,q,r);return g};this.getControlPointsArray=function(){var C,F,O=this.points.length,P=[];for(C=0;C1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible= !1;this.LODs[g].object3D.visible=!0}else break;for(;gG){e=E;E=G;G=e}}else if(EC){e=H;H=C;C=e}}else if(H=0&&ya>=0&&$>=0&&qa>=0)return!0;else if(ta<0&&ya<0||$<0&&qa<0)return!1;else{if(ta<0)ia=Math.max(ia,ta/(ta-ya));else ya<0&&(xa=Math.min(xa,ta/(ta-ya)));if($<0)ia=Math.max(ia,$/($-qa));else qa<0&&(xa=Math.min(xa,$/($-qa)));if(xata&&o.positionScreen.z0&&X.z<1){Pa=W[ea]=W[ea]||new THREE.RenderableParticle;ea++;L=Pa;L.x=X.x/X.w;L.y=X.y/X.w;L.z=X.z;L.rotation=ca.rotation.z;L.scale.x=ca.scale.x*Math.abs(L.x-(X.x+c.projectionMatrix.n11)/(X.w+c.projectionMatrix.n14));L.scale.y=ca.scale.y*Math.abs(L.y-(X.y+c.projectionMatrix.n22)/(X.w+c.projectionMatrix.n24));L.materials=ca.materials;xa.push(L)}}}}ia&&xa.sort(d);return xa}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(undefined,!1,d);e=b.sounds;var g,h=e.length;for(g=0;g 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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\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 pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", 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\nvColor = color;\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 * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\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"};THREE.UniformsUtils={merge:function(b){var d,e,g,h={};for(d=0;d=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}else{s=i.program.attributes;if(x.morphTargetBase!==-1){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[x.morphTargetBase]);c.vertexAttribPointer(s.position,3,c.FLOAT,!1,0,0)}else if(s.position>=0){c.bindBuffer(c.ARRAY_BUFFER, m.__webglVertexBuffer);c.vertexAttribPointer(s.position,3,c.FLOAT,!1,0,0)}if(x.morphTargetForcedOrder.length){k=0;for(var u=x.morphTargetForcedOrder,z=x.morphTargetInfluences;kD){n=y;D=z[n]}c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[n]);c.vertexAttribPointer(s["morphTarget"+k],3,c.FLOAT,!1,0,0);x.__webglMorphTargetInfluences[k]=D;u[n]=1;D=-1;k++}}i.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(i.program.uniforms.morphTargetInfluences,x.__webglMorphTargetInfluences)}if(i.attributes)for(w in i.attributes)if(f[w]!==undefined&&f[w]>=0){s=i.attributes[w];if(s.buffer){c.bindBuffer(c.ARRAY_BUFFER, s.buffer);c.vertexAttribPointer(f[w],s.size,c.FLOAT,!1,0,0)}}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(m.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.vertexAttribPointer(f.uv, 2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(m.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(i.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER, m.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(x instanceof THREE.Mesh){if(i.wireframe){c.lineWidth(i.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.drawElements(c.LINES,m.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, m.__webglFaceBuffer);c.drawElements(c.TRIANGLES,m.__webglFaceCount,c.UNSIGNED_SHORT,0)}T.data.vertices+=m.__webglFaceCount;T.data.faces+=m.__webglFaceCount/3;T.data.drawCalls++}else if(x instanceof THREE.Line){x=x.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(i.linewidth);c.drawArrays(x,0,m.__webglLineCount);T.data.drawCalls++}else if(x instanceof THREE.ParticleSystem){c.drawArrays(c.POINTS,0,m.__webglParticleCount);T.data.drawCalls++}else if(x instanceof THREE.Ribbon){c.drawArrays(c.TRIANGLE_STRIP, 0,m.__webglVertexCount);T.data.drawCalls++}}}function h(f,s,k){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(k== THREE.FlatShading){var i,m,x,w,u,z,D,n,y,B,K=f.count*3;for(B=0;B0&&Y[0]0&&Y[1]0.001&&u.scale>0.001){J[0]=u.x;J[1]=u.y;J[2]=u.z;B=u.size*u.scale/Aa;K[0]=B*D;K[1]=B;c.uniform3fv(Q.screenPosition,J);c.uniform2fv(Q.scale,K);c.uniform1f(Q.rotation,u.rotation);c.uniform1f(Q.opacity,u.opacity);Z(u.blending);M(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask($)}function P(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse, f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var s,k,i,m,x;if(f instanceof THREE.Mesh){k=f.geometry;for(s in k.geometryGroups){i=k.geometryGroups[s];x=!1;for(m in i.__webglCustomAttributes)if(i.__webglCustomAttributes[m].needsUpdate){x=!0;break}if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||x){x=f;var w=c.DYNAMIC_DRAW; if(i.__inittedArrays){var u=void 0,z=void 0,D=void 0,n=void 0;D=void 0;var y=void 0,B=void 0,K=void 0,J=void 0,Y=void 0,Q=void 0,da=void 0,Ga=void 0,Va=void 0,S=void 0,U=void 0,V=void 0,pa=void 0;B=void 0;K=void 0;n=void 0;J=void 0;n=void 0;var t=void 0,I=void 0;B=void 0;t=void 0;I=void 0;var j=void 0,Ka=void 0;t=void 0;I=void 0;j=void 0;Ka=void 0;t=void 0;I=void 0;j=void 0;Ka=void 0;t=void 0;I=void 0;j=void 0;n=void 0;J=void 0;y=void 0;D=void 0;D=void 0;t=void 0;I=void 0;j=void 0;var Wa=void 0,ua= 0,Ba=0,$a=0,ab=0,Ja=0,La=0,ga=0,Ma=0,wa=0,A=0,Ca=0;I=t=0;var Da=i.__vertexArray,hb=i.__uvArray,ib=i.__uv2Array,Qa=i.__normalArray,ka=i.__tangentArray,Ea=i.__colorArray,la=i.__skinVertexAArray,ma=i.__skinVertexBArray,na=i.__skinIndexArray,oa=i.__skinWeightArray,jb=i.__morphTargetsArrays,Ra=i.__webglCustomAttributes;j=void 0;var Na=i.__faceArray,Oa=i.__lineArray,sb=i.__needsSmoothNormals;Q=i.__vertexColorType;Y=i.__uvType;da=i.__normalType;var Ha=x.geometry,kb=Ha.__dirtyVertices,lb=Ha.__dirtyElements, gb=Ha.__dirtyUvs,mb=Ha.__dirtyNormals,nb=Ha.__dirtyTangents,ob=Ha.__dirtyColors,pb=Ha.__dirtyMorphTargets,bb=Ha.vertices,tb=i.faces,wb=Ha.faces,ub=Ha.faceVertexUvs[0],vb=Ha.faceVertexUvs[1],cb=Ha.skinVerticesA,db=Ha.skinVerticesB,eb=Ha.skinIndices,Xa=Ha.skinWeights,Za=x instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}u=0;for(z=tb.length;u0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,w)}if(mb){c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(nb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,i.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,hb,w)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER, ib,w)}if(lb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(A>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,la,w);c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ma,w);c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,na,w);c.bindBuffer(c.ARRAY_BUFFER, i.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,oa,w)}if(!x.dynamic){delete i.__inittedArrays;delete i.__colorArray;delete i.__normalArray;delete i.__tangentArray;delete i.__uvArray;delete i.__uv2Array;delete i.__faceArray;delete i.__vertexArray;delete i.__lineArray;delete i.__skinVertexAArray;delete i.__skinVertexBArray;delete i.__skinIndexArray;delete i.__skinWeightArray}}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents= !1;k.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){k=f.geometry;if(k.__dirtyVertices||k.__dirtyColors){f=k;s=c.DYNAMIC_DRAW;Y=f.vertices;i=f.colors;Q=Y.length;x=i.length;da=f.__vertexArray;w=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u65535){n[z].counter+=1;D=n[z].hash+"_"+n[z].counter;f.geometryGroups[D]==undefined&&(f.geometryGroups[D]={faces:[], materials:u,vertices:0,numMorphTargets:y})}f.geometryGroups[D].faces.push(m);f.geometryGroups[D].vertices+=w}}function W(f,s,k){f.push({buffer:s,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function Z(f){if(f!=ja){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD); c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ja=f}}function X(f,s,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ha(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ha(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ha(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ha(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f, c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Fa(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Fa(s.minFilter))}}function M(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE, f.image);f.__webglInit=!0}X(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_S,ha(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ha(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ha(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ha(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ha(f.format),f.width,f.height,0,ha(f.format),ha(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture, 0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D, null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,k;if(f){s=f.__webglFramebuffer;k=f.width;f=f.height}else{s=null;k=za;f=Aa}if(s!=ya){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(va,sa,k,f);ya=s}}function fa(f,s){var k;if(f=="fragment")k=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(k=c.createShader(c.VERTEX_SHADER));c.shaderSource(k,s);c.compileShader(k);if(!c.getShaderParameter(k,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(k));console.error(s); return null}return k}function Fa(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ha(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA; case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var T=this,c,ia=document.createElement("canvas"),xa=[],ta=null,ya=null,$=!0,qa=null,ra=null,ja=null,aa=null,va=0,sa=0,za=0,Aa=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Ya=new Float32Array(16),Ua=new THREE.Vector4, Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ia;this.autoClear=!0;this.sortObjects=!0;(function(f,s,k,i){try{if(!(c= ia.getContext("experimental-webgl",{antialias:f,stencil:i})))throw"Error creating WebGL context.";}catch(m){console.error(m)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA, c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,k)})(antialias,clearColor,clearAlpha,stencil);this.context=c;var fb=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(stencil){var R={};R.vertices=new Float32Array(12);R.faces=new Uint16Array(6);R.darkness=0.5;R.vertices[0]=-20;R.vertices[1]=-20;R.vertices[2]=-1;R.vertices[3]=20;R.vertices[4]=-20;R.vertices[5]=-1;R.vertices[6]=20;R.vertices[7]=20;R.vertices[8]=-1;R.vertices[9]=-20;R.vertices[10]=20;R.vertices[11]=-1;R.faces[0]=0;R.faces[1]=1;R.faces[2]= 2;R.faces[3]=0;R.faces[4]=2;R.faces[5]=3;R.vertexBuffer=c.createBuffer();R.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,R.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,R.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,R.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,R.faces,c.STATIC_DRAW);R.program=c.createProgram();c.attachShader(R.program,fa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(R.program,fa("vertex",THREE.ShaderLib.shadowPost.vertexShader)); c.linkProgram(R.program);R.vertexLocation=c.getAttribLocation(R.program,"position");R.projectionLocation=c.getUniformLocation(R.program,"projectionMatrix");R.darknessLocation=c.getUniformLocation(R.program,"darkness")}var N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);b=0;N.vertices[b++]=-1;N.vertices[b++]=-1;N.vertices[b++]=0;N.vertices[b++]=0;N.vertices[b++]=1;N.vertices[b++]=-1;N.vertices[b++]=1;N.vertices[b++]=0;N.vertices[b++]=1;N.vertices[b++]=1;N.vertices[b++]=1;N.vertices[b++]= 1;N.vertices[b++]=-1;N.vertices[b++]=1;N.vertices[b++]=0;N.vertices[b++]=1;b=0;N.faces[b++]=0;N.faces[b++]=1;N.faces[b++]=2;N.faces[b++]=0;N.faces[b++]=2;N.faces[b++]=3;N.vertexBuffer=c.createBuffer();N.elementBuffer=c.createBuffer();N.tempTexture=c.createTexture();N.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,N.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,N.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,N.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,N.faces,c.STATIC_DRAW); c.bindTexture(c.TEXTURE_2D,N.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,N.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){N.hasVertexTexture=!1;N.program=c.createProgram();c.attachShader(N.program,fa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(N.program,fa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{N.hasVertexTexture= !0;N.program=c.createProgram();c.attachShader(N.program,fa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(N.program,fa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.vertex=c.getAttribLocation(N.program,"position");N.attributes.uv=c.getAttribLocation(N.program,"UV");N.uniforms.renderType=c.getUniformLocation(N.program,"renderType");N.uniforms.map=c.getUniformLocation(N.program,"map"); N.uniforms.occlusionMap=c.getUniformLocation(N.program,"occlusionMap");N.uniforms.opacity=c.getUniformLocation(N.program,"opacity");N.uniforms.scale=c.getUniformLocation(N.program,"scale");N.uniforms.rotation=c.getUniformLocation(N.program,"rotation");N.uniforms.screenPosition=c.getUniformLocation(N.program,"screenPosition");var rb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]= 0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER, _sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,fa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,fa("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position= c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map= c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix= c.getUniformLocation(_sprite.program,"projectionMatrix");var qb=!1;this.setSize=function(f,s){ia.width=f;ia.height=s;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(f,s,k,i){va=f;sa=s;za=k;Aa=i;c.viewport(va,sa,za,Aa)};this.setScissor=function(f,s,k,i){c.scissor(f,s,k,i)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){$=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var k=new THREE.Color(f); c.clearColor(k.r,k.g,k.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){R.darkness=f};this.getContext=function(){return c};this.initMaterial=function(f,s,k,i){var m,x,w;if(f instanceof THREE.MeshDepthMaterial)w="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)w="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)w="normal"; else if(f instanceof THREE.MeshBasicMaterial)w="basic";else if(f instanceof THREE.MeshLambertMaterial)w="lambert";else if(f instanceof THREE.MeshPhongMaterial)w="phong";else if(f instanceof THREE.LineBasicMaterial)w="basic";else f instanceof THREE.ParticleBasicMaterial&&(w="particle_basic");if(w){var u=THREE.ShaderLib[w];f.uniforms=THREE.UniformsUtils.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var z,D,n;z=n=u=0;for(D=s.length;z=0&&c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color); y.normal>=0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}if(f.attributes)for(m in f.attributes)y[m]!==undefined&&y[m]>=0&&c.enableVertexAttribArray(y[m]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>= 0){c.enableVertexAttribArray(y.morphTarget0);f.numSupportedMorphTargets++}if(y.morphTarget1>=0){c.enableVertexAttribArray(y.morphTarget1);f.numSupportedMorphTargets++}if(y.morphTarget2>=0){c.enableVertexAttribArray(y.morphTarget2);f.numSupportedMorphTargets++}if(y.morphTarget3>=0){c.enableVertexAttribArray(y.morphTarget3);f.numSupportedMorphTargets++}if(y.morphTarget4>=0){c.enableVertexAttribArray(y.morphTarget4);f.numSupportedMorphTargets++}if(y.morphTarget5>=0){c.enableVertexAttribArray(y.morphTarget5); f.numSupportedMorphTargets++}if(y.morphTarget6>=0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}i.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(m=this.maxMorphTargets;f0||B.faceVertexUvs.length>0)w.__uvArray=new Float32Array(z*2);if(B.faceUvs.length>1||B.faceVertexUvs.length> 1)w.__uv2Array=new Float32Array(z*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){w.__skinVertexAArray=new Float32Array(z*4);w.__skinVertexBArray=new Float32Array(z*4);w.__skinIndexArray=new Float32Array(z*4);w.__skinWeightArray=new Float32Array(z*4)}w.__faceArray=new Uint16Array(J*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));w.__lineArray=new Uint16Array(Y*2);if(w.numMorphTargets){w.__morphTargetsArrays=[];B=0;for(K=w.numMorphTargets;B=0;m--){i=k.__webglObjects[m].object;if(s==i){k.__webglObjects.splice(m,1);break}}else if(s instanceof THREE.Sprite)for(m=k.__webglSprites.length- 1;m>=0;m--){i=k.__webglSprites[m];if(s==i){k.__webglSprites.splice(m,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(k=f.__webglObjects.length;s