1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"btse@5f19a485"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="55b56f95-1aed-4031-8fb5-a7a94538cc3a",e._sentryDebugIdIdentifier="sentry-dbid-55b56f95-1aed-4031-8fb5-a7a94538cc3a")}catch(i){}}();import{_ as e}from"./CRPzHAml.js";import{a8 as t,a9 as n}from"./PmfENnFs.js";import"./DzIKp7QL.js";import"./ByGuns7q.js";var r,o,s,a,h=h||{};h.Color=function(e){this.setHex(e)},h.Color.prototype={autoUpdate:!0,copy:function(e){this.r=e.r,this.g=e.g,this.b=e.b,this.hex=e.hex,this.__styleString=e.__styleString},setRGB:function(e,t,i){this.r=e,this.g=t,this.b=i,this.autoUpdate&&(this.updateHex(),this.updateStyleString())},setHSV:function(e,t,i){var n,r,o,s,a,h;if(0==i)n=r=o=0;else switch(a=6*e-(s=Math.floor(6*e)),e=i*(1-t),h=i*(1-t*a),t=i*(1-t*(1-a)),s){case 1:n=h,r=i,o=e;break;case 2:n=e,r=i,o=t;break;case 3:n=e,r=h,o=i;break;case 4:n=t,r=e,o=i;break;case 5:n=i,r=e,o=h;break;case 6:case 0:n=i,r=t,o=e}this.r=n,this.g=r,this.b=o,this.autoUpdate&&(this.updateHex(),this.updateStyleString())},setHex:function(e){this.hex=16777215&e,this.autoUpdate&&(this.updateRGB(),this.updateStyleString())},updateHex:function(){this.hex=255*this.r<<16^255*this.g<<8^255*this.b},updateRGB:function(){this.r=(this.hex>>16&255)/255,this.g=(this.hex>>8&255)/255,this.b=(255&this.hex)/255},updateStyleString:function(){this.__styleString="rgb("+~~(255*this.r)+","+~~(255*this.g)+","+~~(255*this.b)+")"},clone:function(){return new h.Color(this.hex)}},h.Vector2=function(e,t){this.set(e||0,t||0)},h.Vector2.prototype={set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.set(e.x,e.y),this},addSelf:function(e){return this.set(this.x+e.x,this.y+e.y),this},add:function(e,t){return this.set(e.x+t.x,e.y+t.y),this},subSelf:function(e){return this.set(this.x-e.x,this.y-e.y),this},sub:function(e,t){return this.set(e.x-t.x,e.y-t.y),this},multiplyScalar:function(e){return this.set(this.x*e,this.y*e),this},negate:function(){return this.set(-this.x,-this.y),this},unit:function(){return this.multiplyScalar(1/this.length()),this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new h.Vector2(this.x,this.y)}},h.Vector3=function(e,t,i){this.set(e||0,t||0,i||0)},h.Vector3.prototype={set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},copy:function(e){return this.set(e.x,e.y,e.z),this},add:function(e,t){return this.set(e.x+t.x,e.y+t.y,e.z+t.z),this},addSelf:function(e){return this.set(this.x+e.x,this.y+e.y,this.z+e.z),this},addScalar:function(e){return this.set(this.x+e,this.y+e,this.z+e),this},sub:function(e,t){return this.set(e.x-t.x,e.y-t.y,e.z-t.z),this},subSelf:function(e){return this.set(this.x-e.x,this.y-e.y,this.z-e.z),this},cross:function(e,t){return this.set(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),this},crossSelf:function(e){var t=this.x,i=this.y,n=this.z;return this.set(i*e.z-n*e.y,n*e.x-t*e.z,t*e.y-i*e.x),this},multiply:function(e,t){return this.set(e.x*t.x,e.y*t.y,e.z*t.z),this},multiplySelf:function(e){return this.set(this.x*e.x,this.y*e.y,this.z*e.z),this},multiplyScalar:function(e){return this.set(this.x*e,this.y*e,this.z*e),this},divideSelf:function(e){return this.set(this.x/e.x,this.y/e.y,this.z/e.z),this},divideScalar:function(e){return this.set(this.x/e,this.y/e,this.z/e),this},negate:function(){return this.set(-this.x,-this.y,-this.z),this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i+(e=this.z-e.z)*e},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 e=this.length();return e>0?this.multiplyScalar(1/e):this.set(0,0,0),this}
1,setPositionFromMatrix:function(e){this.x=e.n14,this.y=e.n24,this.z=e.n34},setRotationFromMatrix:function(e){this.y=Math.asin(e.n13);var t=Math.cos(this.y);Math.abs(t)>1e-5?(this.x=Math.atan2(-e.n23/t,e.n33/t),this.z=Math.atan2(-e.n13/t,e.n11/t)):(this.x=0,this.z=Math.atan2(e.n21,e.n22))},setLength:function(e){return this.normalize().multiplyScalar(e)},isZero:function(){return Math.abs(this.x)<1e-4&&Math.abs(this.y)<1e-4&&Math.abs(this.z)<1e-4},clone:function(){return new h.Vector3(this.x,this.y,this.z)}},h.Vector4=function(e,t,i,n){this.set(e||0,t||0,i||0,n||1)},h.Vector4.prototype={set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},copy:function(e){return this.set(e.x,e.y,e.z,e.w||1),this},add:function(e,t){return this.set(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),this},addSelf:function(e){return this.set(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w),this},sub:function(e,t){return this.set(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),this},subSelf:function(e){return this.set(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w),this},multiplyScalar:function(e){return this.set(this.x*e,this.y*e,this.z*e,this.w*e),this},divideScalar:function(e){return this.set(this.x/e,this.y/e,this.z/e,this.w/e),this},lerpSelf:function(e,t){this.set(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t,this.z+(e.z-this.z)*t,this.w+(e.w-this.w)*t)},clone:function(){return new h.Vector4(this.x,this.y,this.z,this.w)}},h.Ray=function(e,t){this.origin=e||new h.Vector3,this.direction=t||new h.Vector3},h.Ray.prototype={intersectScene:function(e){var t,i,n=e.objects,r=[];for(e=0,t=n.length;e<t;e++)(i=n[e])instanceof h.Mesh&&(r=r.concat(this.intersectObject(i)));return r.sort((function(e,t){return e.distance-t.distance})),r},intersectObject:function(e){function t(e,t,i,n){n=n.clone().subSelf(t),i=i.clone().subSelf(t);var r=e.clone().subSelf(t);e=n.dot(n),t=n.dot(i),n=n.dot(r);var o=i.dot(i);return e=(e*(i=i.dot(r))-t*n)*(r=1/(e*o-t*t)),(o=(o*n-t*i)*r)>0&&e>0&&o+e<1}var i,n,r,o,s,a,l,c,d,f,p,u=e.geometry,m=u.vertices,g=[];for(i=0,n=u.faces.length;i<n;i++)r=u.faces[i],f=this.origin.clone(),p=this.direction.clone(),o=(l=e.matrixWorld).multiplyVector3(m[r.a].position.clone()),s=l.multiplyVector3(m[r.b].position.clone()),a=l.multiplyVector3(m[r.c].position.clone()),l=r instanceof h.Face4?l.multiplyVector3(m[r.d].position.clone()):null,c=e.matrixRotationWorld.multiplyVector3(r.normal.clone()),(d=p.dot(c))<0&&(c=c.dot((new h.Vector3).sub(o,f))/d,f=f.addSelf(p.multiplyScalar(c)),r instanceof h.Face3?t(f,o,s,a)&&(r={distance:this.origin.distanceTo(f),point:f,face:r,object:e},g.push(r)):r instanceof h.Face4&&(t(f,o,s,l)||t(f,s,a,l))&&(r={distance:this.origin.distanceTo(f),point:f,face:r,object:e},g.push(r)));return g}},h.Rectangle=function(){function e(){o=n-t,s=r-i}var t,i,n,r,o,s,a=!0;this.getX=function(){return t},this.getY=function(){return i},this.getWidth=function(){return o},this.getHeight=function(){return s},this.getLeft=function(){return t},this.getTop=function(){return i},this.getRight=function(){return n},this.getBottom=function(){return r},this.set=function(o,s,h,l){a=!1,t=o,i=s,n=h,r=l,e()},this.addPoint=function(o,s){a?(a=!1,t=o,i=s,n=o,r=s):(t=t<o?t:o,i=i<s?i:s,n=n>o?n:o,r=r>s?r:s),e()},this.add3Points=function(o,s,h,l,c,d){a?(a=!1,t=o<h?o<c?o:c:h<c?h:c,i=s<l?s<d?s:d:l<d?l:d,n=o>h?o>c?o:c:h>c?h:c,r=s>l?s>d?s:d:l>d?l:d):(t=o<h?o<c?o<t?o:t:c<t?c:t:h<c?h<t?h:t:c<t?c:t,i=s<l?s<d?s<i?s:i:d<i?d:i:l<d?l<i?l:i:d<i?d:i,n=o>h?o>c?o>n?o:n:c>n?c:n:h>c?h>n?h:n:c>n?c:n,r=s>l?s>d?s>r?s:r:d>r?d:r:l>d?l>r?l:r:d>r?d:r),e()},this.addRectangle=function(o){a?(a=!1,t=o.getLeft(),i=o.getTop(),n=o.getRight(),r=o.getBottom()):(t=t<o.getLeft()?t:o.getLeft(),i=i<o.getTop()?i:o.getTop(),n=n>o.getRight()?n:o.getRight(),r=r>o.getBottom()?r:o.getBottom()),e()},this.inflate=function(o){t-=o,i-=o,n+=o,r+=o,e()},this.minSelf=function(o){t=t>o.getLeft()?t:o.getLeft(),i=i>o.getTop()?i:o.getTop(),n=n<o.getRight()?n:o.getRight(),r=r<o.getBottom()?r:o.getBottom(),e()},this.instersects=function(e){return Math.min(n,e.getRight())-Math.max(t,e.getLeft())>=0&&Math.min(r,e.getBottom())-Math.max(i,e.getTop())>=0},this.empty=function(){a=!0,r=n=i=t=0,e()},this.isEmpty=function(){return a}},h.Matrix3=function(){this.m=[]},h.Matrix3.prototype={transpose:function(){var e,t=this.m;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},transposeIntoArray:function(e){var t=this.m;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},h.Matrix4=function(e,t,i,n,r,o,s,a,l,c,d,f,p,u,m,g){this.set(e||1,t||0,i||0,n||0,r||0,o||1,s||0,a||0,l||0,c||0,d||1,f||0,p||0,u||0,m||0,g||1),this.flat=Array(16),this.m33=new h.Matrix3},h.Matrix4.prototype={set:function(e,t,i,n,r,o,s,a,h,l,c,d,f,p,u,m){return this.n11=e,this.n12=t,this.n13=i,this.n14=n,this.n21=r,this.n22=o,this.n23=s,this.n24=a,this.n31=h,this.n32=l,this.n33=c,this.n34=d,this.n41=f,this.n42=p,this.n43=u,this.n44=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.set(e.n11,e.n12,e.n13,e.n14,e.n21,e.n22,e.n23,e.n24,e.n31,e.n32,e.n33,e.n34,e.n41,e.n42,e.n43,e.n44),this},lookAt:function(e,t,i){var n=h.Matrix4.__v1,r=h.Matrix4.__v2,o=h.Matrix4.__v3;return o.sub(e,t).normalize(),0===o.length()&&(o.z=1),n.cross(i,o).normalize(),0===n.length()&&(o.x+=1e-4,n.cross(i,o).normalize()),r.cross(o,n).normalize(),this.n11=n.x,this.n12=r.x,this.n13=o.x,this.n21=n.y,this.n22=r.y,this.n23=o.y,this.n31=n.z,this.n32=r.z,this.n33=o.z,this},multiplyVector3:function(e){var t=e.x,i=e.y,n=e.z,r=1/(this.n41*t+this.n42*i+this.n43*n+this.n44);return e.x=(this.n11*t+this.n12*i+this.n13*n+this.n14)*r,e.y=(this.n21*t+this.n22*i+this.n23*n+this.n24)*r,e.z=(this.n31*t+this.n32*i+this.n33*n+this.n34)*r,e},multiplyVector4:function(e){var t=e.x,i=e.y,n=e.z,r=e.w;return e.x=this.n11*t+this.n12*i+this.n13*n+this.n14*r,e.y=this.n21*t+this.n22*i+this.n23*n+this.n24*r,e.z=this.n31*t+this.n32*i+this.n33*n+this.n34*r,e.w=this.n41*t+this.n42*i+this.n43*n+this.n44*r,e},rotateAxis:function(e){var t=e.x,i=e.y,n=e.z;return e.x=t*this.n11+i*this.n12+n*this.n13,e.y=t*this.n21+i*this.n22+n*this.n23,e.z=t*this.n31+i*this.n32+n*this.n33,e.normalize(),e},crossVector:function(e){var t=new h.Vector4;return t.x=this.n11*e.x+this.n12*e.y+this.n13*e.z+this.n14*e.w,t.y=this.n21*e.x+this.n22*e.y+this.n23*e.z+this.n24*e.w,t.z=this.n31*e.x+this.n32*e.y+this.n33*e.z+this.n34*e.w,t.w=e.w?this.n41*e.x+this.n42*e.y+this.n43*e.z+this.n44*e.w:1,t},multiply:function(e,t){var i=e.n11,n=e.n12,r=e.n13,o=e.n14,s=e.n21,a=e.n22,h=e.n23,l=e.n24,c=e.n31,d=e.n32,f=e.n33,p=e.n34,u=e.n41,m=e.n42,g=e.n43,v=e.n44,y=t.n11,_=t.n12,x=t.n13,b=t.n14,w=t.n21,S=t.n22,M=t.n23,A=t.n24,T=t.n31,R=t.n32,L=t.n33,C=t.n34;return this.n11=i*y+n*w+r*T,this.n12=i*_+n*S+r*R,this.n13=i*x+n*M+r*L,this.n14=i*b+n*A+r*C+o,this.n21=s*y+a*w+h*T,this.n22=s*_+a*S+h*R,this.n23=s*x+a*M+h*L,this.n24=s*b+a*A+h*C+l,this.n31=c*y+d
1*w+f*T,this.n32=c*_+d*S+f*R,this.n33=c*x+d*M+f*L,this.n34=c*b+d*A+f*C+p,this.n41=u*y+m*w+g*T,this.n42=u*_+m*S+g*R,this.n43=u*x+m*M+g*L,this.n44=u*b+m*A+g*C+v,this},multiplyToArray:function(e,t,i){return this.multiply(e,t),i[0]=this.n11,i[1]=this.n21,i[2]=this.n31,i[3]=this.n41,i[4]=this.n12,i[5]=this.n22,i[6]=this.n32,i[7]=this.n42,i[8]=this.n13,i[9]=this.n23,i[10]=this.n33,i[11]=this.n43,i[12]=this.n14,i[13]=this.n24,i[14]=this.n34,i[15]=this.n44,this},multiplySelf:function(e){return this.multiply(this,e),this},multiplyScalar:function(e){return this.n11*=e,this.n12*=e,this.n13*=e,this.n14*=e,this.n21*=e,this.n22*=e,this.n23*=e,this.n24*=e,this.n31*=e,this.n32*=e,this.n33*=e,this.n34*=e,this.n41*=e,this.n42*=e,this.n43*=e,this.n44*=e,this},determinant:function(){var e=this.n11,t=this.n12,i=this.n13,n=this.n14,r=this.n21,o=this.n22,s=this.n23,a=this.n24,h=this.n31,l=this.n32,c=this.n33,d=this.n34,f=this.n41,p=this.n42,u=this.n43,m=this.n44;return n*s*l*f-i*a*l*f-n*o*c*f+t*a*c*f+i*o*d*f-t*s*d*f-n*s*h*p+i*a*h*p+n*r*c*p-e*a*c*p-i*r*d*p+e*s*d*p+n*o*h*u-t*a*h*u-n*r*l*u+e*a*l*u+t*r*d*u-e*o*d*u-i*o*h*m+t*s*h*m+i*r*l*m-e*s*l*m-t*r*c*m+e*o*c*m},transpose:function(){var e;return e=this.n21,this.n21=this.n12,this.n12=e,e=this.n31,this.n31=this.n13,this.n13=e,e=this.n32,this.n32=this.n23,this.n23=e,e=this.n41,this.n41=this.n14,this.n14=e,e=this.n42,this.n42=this.n24,this.n24=e,e=this.n43,this.n43=this.n34,this.n43=e,this},clone:function(){var e=new h.Matrix4;return e.n11=this.n11,e.n12=this.n12,e.n13=this.n13,e.n14=this.n14,e.n21=this.n21,e.n22=this.n22,e.n23=this.n23,e.n24=this.n24,e.n31=this.n31,e.n32=this.n32,e.n33=this.n33,e.n34=this.n34,e.n41=this.n41,e.n42=this.n42,e.n43=this.n43,e.n44=this.n44,e},flatten:function(){return 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,this.flat},flattenToArray:function(e){return 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,e},flattenToArrayOffset:function(e,t){return e[t]=this.n11,e[t+1]=this.n21,e[t+2]=this.n31,e[t+3]=this.n41,e[t+4]=this.n12,e[t+5]=this.n22,e[t+6]=this.n32,e[t+7]=this.n42,e[t+8]=this.n13,e[t+9]=this.n23,e[t+10]=this.n33,e[t+11]=this.n43,e[t+12]=this.n14,e[t+13]=this.n24,e[t+14]=this.n34,e[t+15]=this.n44,e},setTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},setScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},setRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},setRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},setRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},setRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,o=e.x,s=e.y,a=e.z,h=r*o,l=r*s;return this.set(h*o+i,h*s-n*a,h*a+n*s,0,h*s+n*a,l*s+i,l*a-n*o,0,h*a-n*s,l*a+n*o,r*a*a+i,0,0,0,0,1),this},setPosition:function(e){return this.n14=e.x,this.n24=e.y,this.n34=e.z,this},setRotationFromEuler:function(e){var t=e.x,i=e.y,n=e.z;e=Math.cos(t),t=Math.sin(t);var r=Math.cos(i);i=Math.sin(i);var o=Math.cos(n);n=Math.sin(n);var s=e*i,a=t*i;return this.n11=r*o,this.n12=-r*n,this.n13=i,this.n21=a*o+e*n,this.n22=-a*n+e*o,this.n23=-t*r,this.n31=-s*o+t*n,this.n32=s*n+t*o,this.n33=e*r,this},setRotationFromQuaternion:function(e){var t=e.x,i=e.y,n=e.z,r=e.w,o=t+t,s=i+i,a=n+n;e=t*o;var h=t*s;t*=a;var l=i*s;return i*=a,n*=a,o*=r,s*=r,r*=a,this.n11=1-(l+n),this.n12=h-r,this.n13=t+s,this.n21=h+r,this.n22=1-(e+n),this.n23=i-o,this.n31=t-s,this.n32=i+o,this.n33=1-(e+l),this},scale:function(e){var t=e.x,i=e.y;return e=e.z,this.n11*=t,this.n12*=i,this.n13*=e,this.n21*=t,this.n22*=i,this.n23*=e,this.n31*=t,this.n32*=i,this.n33*=e,this.n41*=t,this.n42*=i,this.n43*=e,this},extractPosition:function(e){this.n14=e.n14,this.n24=e.n24,this.n34=e.n34},extractRotation:function(e,t){var i=1/t.x,n=1/t.y,r=1/t.z;this.n11=e.n11*i,this.n21=e.n21*i,this.n31=e.n31*i,this.n12=e.n12*n,this.n22=e.n22*n,this.n32=e.n32*n,this.n13=e.n13*r,this.n23=e.n23*r,this.n33=e.n33*r}},h.Matrix4.makeInvert=function(e,t){var i=e.n11,n=e.n12,r=e.n13,o=e.n14,s=e.n21,a=e.n22,l=e.n23,c=e.n24,d=e.n31,f=e.n32,p=e.n33,u=e.n34,m=e.n41,g=e.n42,v=e.n43,y=e.n44;return void 0===t&&(t=new h.Matrix4),t.n11=l*u*g-c*p*g+c*f*v-a*u*v-l*f*y+a*p*y,t.n12=o*p*g-r*u*g-o*f*v+n*u*v+r*f*y-n*p*y,t.n13
1=r*c*g-o*l*g+o*a*v-n*c*v-r*a*y+n*l*y,t.n14=o*l*f-r*c*f-o*a*p+n*c*p+r*a*u-n*l*u,t.n21=c*p*m-l*u*m-c*d*v+s*u*v+l*d*y-s*p*y,t.n22=r*u*m-o*p*m+o*d*v-i*u*v-r*d*y+i*p*y,t.n23=o*l*m-r*c*m-o*s*v+i*c*v+r*s*y-i*l*y,t.n24=r*c*d-o*l*d+o*s*p-i*c*p-r*s*u+i*l*u,t.n31=a*u*m-c*f*m+c*d*g-s*u*g-a*d*y+s*f*y,t.n32=o*f*m-n*u*m-o*d*g+i*u*g+n*d*y-i*f*y,t.n33=r*c*m-o*a*m+o*s*g-i*c*g-n*s*y+i*a*y,t.n34=o*a*d-n*c*d-o*s*f+i*c*f+n*s*u-i*a*u,t.n41=l*f*m-a*p*m-l*d*g+s*p*g+a*d*v-s*f*v,t.n42=n*p*m-r*f*m+r*d*g-i*p*g-n*d*v+i*f*v,t.n43=r*a*m-n*l*m-r*s*g+i*l*g+n*s*v-i*a*v,t.n44=n*l*d-r*a*d+r*s*f-i*l*f-n*s*p+i*a*p,t.multiplyScalar(1/e.determinant()),t},h.Matrix4.makeInvert3x3=function(e){var t=e.m33,i=t.m,n=e.n33*e.n22-e.n32*e.n23,r=-e.n33*e.n21+e.n31*e.n23,o=e.n32*e.n21-e.n31*e.n22,s=-e.n33*e.n12+e.n32*e.n13,a=e.n33*e.n11-e.n31*e.n13,h=-e.n32*e.n11+e.n31*e.n12,l=e.n23*e.n12-e.n22*e.n13,c=-e.n23*e.n11+e.n21*e.n13,d=e.n22*e.n11-e.n21*e.n12;if(0==(e=e.n11*n+e.n21*s+e.n31*l))throw"matrix not invertible";return e=1/e,i[0]=e*n,i[1]=e*r,i[2]=e*o,i[3]=e*s,i[4]=e*a,i[5]=e*h,i[6]=e*l,i[7]=e*c,i[8]=e*d,t},h.Matrix4.makeFrustum=function(e,t,i,n,r,o){var s;return(s=new h.Matrix4).n11=2*r/(t-e),s.n12=0,s.n13=(t+e)/(t-e),s.n14=0,s.n21=0,s.n22=2*r/(n-i),s.n23=(n+i)/(n-i),s.n24=0,s.n31=0,s.n32=0,s.n33=-(o+r)/(o-r),s.n34=-2*o*r/(o-r),s.n41=0,s.n42=0,s.n43=-1,s.n44=0,s},h.Matrix4.makePerspective=function(e,t,i,n){var r;return r=-(e=i*Math.tan(e*Math.PI/360)),h.Matrix4.makeFrustum(r*t,e*t,r,e,i,n)},h.Matrix4.makeOrtho=function(e,t,i,n,r,o){var s,a,l,c;return a=t-e,l=i-n,c=o-r,(s=new h.Matrix4).n11=2/a,s.n12=0,s.n13=0,s.n14=-(t+e)/a,s.n21=0,s.n22=2/l,s.n23=0,s.n24=-(i+n)/l,s.n31=0,s.n32=0,s.n33=-2/c,s.n34=-(o+r)/c,s.n41=0,s.n42=0,s.n43=0,s.n44=1,s},h.Matrix4.__v1=new h.Vector3,h.Matrix4.__v2=new h.Vector3,h.Matrix4.__v3=new h.Vector3,h.Object3D=function(){this.parent=void 0,this.children=[],this.up=new h.Vector3(0,1,0),this.position=new h.Vector3,this.rotation=new h.Vector3,this.scale=new h.Vector3(1,1,1),this.rotationAutoUpdate=!0,this.matrix=new h.Matrix4,this.matrixWorld=new h.Matrix4,this.matrixRotationWorld=new h.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!0,this.quaternion=new h.Quaternion,this.useQuaternion=!1,this.boundRadius=0,this.boundRadiusScale=1,this.visible=!0,this._vector=new h.Vector3},h.Object3D.prototype={translate:function(e,t){this.matrix.rotateAxis(t),this.position.addSelf(t.multiplyScalar(e))},translateX:function(e){this.translate(e,this._vector.set(1,0,0))},translateY:function(e){this.translate(e,this._vector.set(0,1,0))},translateZ:function(e){this.translate(e,this._vector.set(0,0,1))},lookAt:function(e){this.matrix.lookAt(this.position,e,this.up),this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(e){if(-1===this.children.indexOf(e)){void 0!==e.parent&&e.parent.removeChild(e),e.parent=this,this.children.push(e);for(var t=this;t instanceof h.Scene==!1&&void 0!==t;)t=t.parent;void 0!==t&&t.addChildRecurse(e)}},removeChild:function(e){var t=this.children.indexOf(e);-1!==t&&(e.parent=void 0,this.children.splice(t,1))},updateMatrix:function(){this.matrix.setPosition(this.position),this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation),1===this.scale.x&&1===this.scale.y&&1===this.scale.z||(this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))),this.matrixWorldNeedsUpdate=!0},update:function(e,t,i){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,t=!0),e=0;for(var n=this.children.length;e<n;e++)this.children[e].update(this.matrixWorld,t,i)}},h.Quaternion=function(e,t,i,n){this.set(e||0,t||0,i||0,void 0!==n?n:1)},h.Quaternion.prototype={set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},setFromEuler:function(e){var t=.5*Math.PI/360,i=e.x*t,n=e.y*t,r=e.z*t;e=Math.cos(n),n=Math.sin(n),t=Math.cos(-r),r=Math.sin(-r);var o=Math.cos(i);i=Math.sin(i);var s=e*t,a=n*r;return this.w=s*o-a*i,this.x=s*i+a*o,this.y=n*t*o+e*r*i,this.z=e*r*o-n*t*i,this},calculateW:function(){return this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z)),this},inverse:function(){return this.x*=-1,this.y*=-1,this.z*=-1,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 e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return 0==e?this.w=this.z=this.y=this.x=0:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this},multiplySelf:function(e){var t=this.x,i=this.y,n=this.z,r=this.w,o=e.x,s=e.y,a=e.z;return e=e.w,this.x=t*e+r*o+i*a-n*s,this.y=i*e+r*s+n*o-t*a,this.z=n*e+r*a+t*s-i*o,this.w=r*e-t*o-i*s-n*a,this},multiplyVector3:function(e,t){t||(t=e);var i=e.x,n=e.y,r=e.z,o=this.x,s=this.y,a=this.z,h=this.w,l=h*i+s*r-a*n,c=h*n+a*i-o*r,d=h*r+o*n-s*i;return i=-o*i-s*n-a*r,t.x=l*h+i*-o+c*-a-d*-s,t.y=c*h+i*-s+d*-o-l*-a,t.z=d*h+i*-a+l*-s-c*-o,t}},h.Quaternion.slerp=function(e,t,i,n){var r=e.w*t.w+e.x*t.x+e.y*t.y+e.z*t.z;if(Math.abs(r)>=1)return i.w=e.w,i.x=e.x,i.y=e.y,i.z=e.z,i;var o=Math.acos(r),s=Math.sqrt(1-r*r);return Math.abs(s)<.001?(i.w=.5*(e.w+t.w),i.x=.5*(e.x+t.x),i.y=.5*(e.y+t.y),i.z=.5*(e.z+t.z),i):(r=Math.sin((1-n)*o)/s,n=Math.sin(n*o)/s,i.w=e.w*r+t.w*n,i.x=e.x*r+t.x*n,i.y=e.y*r+t.y*n,i.z=e.z*r+t.z*n,i)},h.Vertex=function(e){this.position=e||new h.Vector3},h.Face3=function(e,t,i,n,r,o){this.a=e,this.b=t,this.c=i,this.normal=n instanceof h.Vector3?n:new h.Vector3,this.vertexNormals=n instanceof Array?n:[],this.color=r instanceof h.Color?r:new h.Color,this.vertexColors=r instanceof Array?r:[],this.vertexTangents=[],this.materials=o instanceof Array?o:[o],this.centroid=new h.Vector3},h.Face4=function(e,t,i,n,r,o,s){this.a=e,this.b=t,this.c=i,this.d=n,this.normal=r instanceof h.Vector3?r:new h.Vector3,this.vertexNormals=r instanceof Array?r:[],this.color=o instanceof h.Color?o:new h.C
1olor,this.vertexColors=o instanceof Array?o:[],this.vertexTangents=[],this.materials=s instanceof Array?s:[s],this.centroid=new h.Vector3},h.UV=function(e,t){this.set(e||0,t||0)},h.UV.prototype={set:function(e,t){return this.u=e,this.v=t,this},copy:function(e){return this.set(e.u,e.v),this}},h.Geometry=function(){this.id="Geometry"+h.GeometryIdCounter++,this.vertices=[],this.colors=[],this.faces=[],this.faceUvs=[[]],this.faceVertexUvs=[[]],this.morphTargets=[],this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.hasTangents=!1},h.Geometry.prototype={computeCentroids:function(){var e,t,i;for(e=0,t=this.faces.length;e<t;e++)(i=this.faces[e]).centroid.set(0,0,0),i instanceof h.Face3?(i.centroid.addSelf(this.vertices[i.a].position),i.centroid.addSelf(this.vertices[i.b].position),i.centroid.addSelf(this.vertices[i.c].position),i.centroid.divideScalar(3)):i instanceof h.Face4&&(i.centroid.addSelf(this.vertices[i.a].position),i.centroid.addSelf(this.vertices[i.b].position),i.centroid.addSelf(this.vertices[i.c].position),i.centroid.addSelf(this.vertices[i.d].position),i.centroid.divideScalar(4))},computeFaceNormals:function(e){var t,i,n,r,o,s,a=new h.Vector3,l=new h.Vector3;for(n=0,r=this.faces.length;n<r;n++){if(o=this.faces[n],e&&o.vertexNormals.length){for(a.set(0,0,0),t=0,i=o.vertexNormals.length;t<i;t++)a.addSelf(o.vertexNormals[t]);a.divideScalar(3)}else t=this.vertices[o.a],i=this.vertices[o.b],s=this.vertices[o.c],a.sub(s.position,i.position),l.sub(t.position,i.position),a.crossSelf(l);a.isZero()||a.normalize(),o.normal.copy(a)}},computeVertexNormals:function(){var e,t,i,n;if(null==this.__tmpVertices){for(n=this.__tmpVertices=Array(this.vertices.length),e=0,t=this.vertices.length;e<t;e++)n[e]=new h.Vector3;for(e=0,t=this.faces.length;e<t;e++)(i=this.faces[e])instanceof h.Face3?i.vertexNormals=[new h.Vector3,new h.Vector3,new h.Vector3]:i instanceof h.Face4&&(i.vertexNormals=[new h.Vector3,new h.Vector3,new h.Vector3,new h.Vector3])}else for(n=this.__tmpVertices,e=0,t=this.vertices.length;e<t;e++)n[e].set(0,0,0);for(e=0,t=this.faces.length;e<t;e++)(i=this.faces[e])instanceof h.Face3?(n[i.a].addSelf(i.normal),n[i.b].addSelf(i.normal),n[i.c].addSelf(i.normal)):i instanceof h.Face4&&(n[i.a].addSelf(i.normal),n[i.b].addSelf(i.normal),n[i.c].addSelf(i.normal),n[i.d].addSelf(i.normal));for(e=0,t=this.vertices.length;e<t;e++)n[e].normalize();for(e=0,t=this.faces.length;e<t;e++)(i=this.faces[e])instanceof h.Face3?(i.vertexNormals[0].copy(n[i.a]),i.vertexNormals[1].copy(n[i.b]),i.vertexNormals[2].copy(n[i.c])):i instanceof h.Face4&&(i.vertexNormals[0].copy(n[i.a]),i.vertexNormals[1].copy(n[i.b]),i.vertexNormals[2].copy(n[i.c]),i.vertexNormals[3].copy(n[i.d]))},computeTangents:function(){function e(e,t,i,n,r,o,h){a=e.vertices[t].position,l=e.vertices[i].position,c=e.vertices[n].position,d=s[r],f=s[o],p=s[h],u=l.x-a.x,m=c.x-a.x,g=l.y-a.y,v=c.y-a.y,y=l.z-a.z,_=c.z-a.z,x=f.u-d.u,b=p.u-d.u,w=f.v-d.v,S=p.v-d.v,M=1/(x*S-b*w),L.set((S*u-w*m)*M,(S*g-w*v)*M,(S*y-w*_)*M),C.set((x*m-b*u)*M,(x*v-b*g)*M,(x*_-b*y)*M),T[t].addSelf(L),T[i].addSelf(L),T[n].addSelf(L),R[t].addSelf(C),R[i].addSelf(C),R[n].addSelf(C)}var t,i,n,r,o,s,a,l,c,d,f,p,u,m,g,v,y,_,x,b,w,S,M,A,T=[],R=[],L=new h.Vector3,C=new h.Vector3,E=new h.Vector3,F=new h.Vector3,z=new h.Vector3;for(t=0,i=this.vertices.length;t<i;t++)T[t]=new h.Vector3,R[t]=new h.Vector3;for(t=0,i=this.faces.length;t<i;t++)o=this.faces[t],s=this.faceVertexUvs[0][t],o instanceof h.Face3?e(this,o.a,o.b,o.c,0,1,2):o instanceof h.Face4&&(e(this,o.a,o.b,o.c,0,1,2),e(this,o.a,o.b,o.d,0,1,3));var V=["a","b","c","d"];for(t=0,i=this.faces.length;t<i;t++)for(o=this.faces[t],n=0;n<o.vertexNormals.length;n++)z.copy(o.vertexNormals[n]),r=o[V[n]],A=T[r],E.copy(A),E.subSelf(z.multiplyScalar(z.dot(A))).normalize(),F.cross(o.vertexNormals[n],A),r=(r=F.dot(R[r]))<0?-1:1,o.vertexTangents[n]=new h.Vector4(E.x,E.y,E.z,r);this.hasTangents=!0},computeBoundingBox:function(){var e;if(this.vertices.length>0){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 t=1,i=this.vertices.length;t<i;t++)(e=this.vertices[t]).position.x<this.boundingBox.x[0]?this.boundingBox.x[0]=e.position.x:e.position.x>this.boundingBox.x[1]&&(this.boundingBox.x[1]=e.position.x),e.position.y<this.boundingBox.y[0]?this.boundingBox.y[0]=e.position.y:e.position.y>this.boundingBox.y[1]&&(this.boundingBox.y[1]=e.position.y),e.position.z<this.boundingBox.z[0]?this.boundingBox.z[0]=e.position.z:e.position.z>this.boundingBox.z[1]&&(this.boundingBox.z[1]=e.position.z)}},computeBoundingSphere:function(){for(var e=null===this.boundingSphere?0:this.boundingSphere.radius,t=0,i=this.vertices.length;t<i;t++)e=Math.max(e,this.vertices[t].position.length());this.boundingSphere={radius:e}}},h.GeometryIdCounter=0,h.Spline=function(e){function t(e,t,i,n,r,o,s){return(2*(t-i)+(e=.5*(i-e))+(n=.5*(n-t)))*s+(-3*(t-i)-2*e-n)*o+e*r+t}this.points=e;var i,n,r,o,s,a,l,c,d,f=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return i=(this.points.length-1)*e,n=Math.floor(i),r=i-n,f[0]=0==n?n:n-1,f[1]=n,f[2]=n>this.points.length-2?n:n+1,f[3]=n>this.points.length-3?n:n+2,a=this.points[f[0]],l=this.points[f[1]],c=this.points[f[2]],d=this.points[f[3]],s=r*(o=r*r),p.x=t(a.x,l.x,c.x,d.x,r,o,s),p.y=t(a.y,l.y,c.y,d.y,r,o,s),p.z=t(a.z,l.z,c.z,d.z,r,o,s),p},this.getControlPointsArray=function(){var e,t,i=this.points.length,n=[];for(e=0;e<i;e++)t=this.points[e],n[e]=[t.x,t.y,t.z];return n},this.getLength=function(e){var t,i,n=t=t=0,r=new h.Vector3,o=new h.Vector3,s=[],a=0;for(s[0]=0,e||(e=100),i=this.points.length*e,r.copy(this.points[0]),e=1;e<i;e++)t=e/i,position=this.getPoint(t),o.copy(position),a+=o.distanceTo(r),r.copy(position),t*=this.points.length-1,(t=Math.floor(t))!=n&&(s[t]=a,n=t);return s[s.length]=a,{chunks:s,total:a}},this.reparametrizeByArcLength=function(e){var t,i,n,r,o,s,a=[],l=new h.Vector3,c=this.getLength();for(a.push(l.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(i=c.chunks[t]-c.chunks[t-1],s=Math.ceil(e*i/c.total),r=(t-1)/(this.points.length-1),o=t/(this.points.length-1),i=1;i<s-1;i++)n=r+i*(1/s)*(o-r),position=this.getPoint(n),a.push(l.copy(position).clone());a.push(l.copy(this.points[t]).clone())}this.points=a}},h.AnimationHandler=(r=[],o={},s={update:function(e){for(var t=0;t<r.length;t++)r[t].update(e)},addToUpdate:function(e){-1===r.indexOf(e)&&r.push(e)},removeFromUpdate:function(e){-1!==(e=r.indexOf(e))&&r.splice(e,1)},add:function(e){if(o[e.name],o[e.name]=e,!0!==e.initialized){for(var t=0;t<e.hierarchy.length;t++){for(var i=0;i<e.hierarchy[t].keys.length;i++)if(e.hierarchy[t].keys[i].time<0&&(e.hierarchy[t].keys[i].time=0),void 0!==e.hierarchy[t].keys[i].rot&&!(e.hierarchy[t].keys[i].rot instanceof h.Quaternion)){var n=e.hierarchy[t].keys[i].rot;e.hierarchy[t].keys[i].rot=new h.Quaternion(n[0],n[1],n[2],n[3])}if(void 0!==e.hierarchy[t].keys[0].morphTargets){for(n={},i=0;i<e.hierarchy[t].keys.length;i++)for(var r=0;r<e.hierarchy[t].keys[i].morphTargets.length;r++){var s=e.hierarchy[t].keys[i].morphTargets[r];n[s]=-1}for(e.hierarchy[t].usedMorphTargets=n,i=0;i<e.hierarchy[t].keys.length;i++){var a={};for(s in n){for(r=0;r<e.hierarchy[t].keys[i].morphTargets.length;r++)if(e.hierarchy[t].keys[i].morphTargets[r]===s){a[s]=e.hierarchy[t].keys[i].morphTargetsInfluences[r];break}r===e.hierarchy[t].keys[i].morphTargets.length&&(a[s]=0)}e.hierarchy[t].keys[i].morphTargetsInfluences=a}}for(i=1;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].time===e.hierarchy[t].keys[i-1].time&&(e.hierarchy[t].keys.splice(i,1),i--);for(i=1;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].index=i}for(i=parseInt(e.length*e.fps,10),e.JIT={},e.JIT.hierarchy=[],t=0;t<e.hierarchy.length;t++)e.JIT.hierarchy.push(Array(i));e.initialized=!0}},get:function(e){if("string"==typeof e)return o[e]?o[e]:null},parse:function(e){var t=[];if(e instanceof h.SkinnedMesh)for(var i=0;i<e.bones.length;i++)t.push(e.bones[i]);else a(e,t);return t}},a=function(e,t){t.push(e);for(var i=0;i<e.children.length;i++)a(e.children[i],t)},s.LINEAR=0,s.CATMULLROM=1,s.CATMULLROM_FORWARD=2,s),h.Animation=function(e,t,i,n){this.root=e,this.data=h.AnimationHandler.get(t),this.hierarchy=h.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.isPaused=!0,this.loop=!0,this.interpolationType=void 0!==i?i:h.AnimationHandler.LINEAR,this.JITCompile=void 0===n||n,this.points=[],this.target=new h.Vector3},h.Animation.prototype.play=function(e,t){if(!this.isPlaying){this.isPlaying=!0,this.loop=void 0===e||e,this.currentTime=void 0!==t?t:0;var i,n,r=this.hierarchy.length;for(i=0;i<r;i++){n=this.hierarchy[i],this.interpolationType!==h.AnimationHandler.CATMULLROM_FORWARD&&(n.useQuaternion=!0),n.matrixAutoUpdate=!0,void 0===n.animationCache&&(n.animationCache={},n.animationCache.prevKey={pos:0,rot:0,scl:0},n.animationCache.nextKey={pos:0,rot:0,scl:0},n.animationCache.originalMatrix=n instanceof h.Bone?n.skinMatrix:n.matrix
1);var o=n.animationCache.prevKey;n=n.animationCache.nextKey,o.pos=this.data.hierarchy[i].keys[0],o.rot=this.data.hierarchy[i].keys[0],o.scl=this.data.hierarchy[i].keys[0],n.pos=this.getNextKeyWith("pos",i,1),n.rot=this.getNextKeyWith("rot",i,1),n.scl=this.getNextKeyWith("scl",i,1)}this.update(0)}this.isPaused=!1,h.AnimationHandler.addToUpdate(this)},h.Animation.prototype.pause=function(){this.isPaused?h.AnimationHandler.addToUpdate(this):h.AnimationHandler.removeFromUpdate(this),this.isPaused=!this.isPaused},h.Animation.prototype.stop=function(){this.isPlaying=!1,this.isPaused=!1,h.AnimationHandler.removeFromUpdate(this);for(var e=0;e<this.hierarchy.length;e++)void 0!==this.hierarchy[e].animationCache&&(this.hierarchy[e]instanceof h.Bone?this.hierarchy[e].skinMatrix=this.hierarchy[e].animationCache.originalMatrix:this.hierarchy[e].matrix=this.hierarchy[e].animationCache.originalMatrix,delete this.hierarchy[e].animationCache)},h.Animation.prototype.update=function(e){if(this.isPlaying){var t,i,n,r,o,s,a,l,c,d,f=["pos","rot","scl"],p=this.data.JIT.hierarchy;this.currentTime+=e*this.timeScale,d=this.currentTime,c=this.currentTime%=this.data.length,l=parseInt(Math.min(c*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,m=this.hierarchy.length;u<m;u++)if(a=(e=this.hierarchy[u]).animationCache,this.JITCompile&&void 0!==p[u][l])e instanceof h.Bone?(e.skinMatrix=p[u][l],e.matrixAutoUpdate=!1,e.matrixWorldNeedsUpdate=!1):(e.matrix=p[u][l],e.matrixAutoUpdate=!1,e.matrixWorldNeedsUpdate=!0);else{this.JITCompile&&(e instanceof h.Bone?e.skinMatrix=e.animationCache.originalMatrix:e.matrix=e.animationCache.originalMatrix);for(var g=0;g<3;g++){if(t=f[g],o=a.prevKey[t],(s=a.nextKey[t]).time<=d){if(c<d){if(!this.loop)return void this.stop();for(o=this.data.hierarchy[u].keys[0],s=this.getNextKeyWith(t,u,1);s.time<c;)o=s,s=this.getNextKeyWith(t,u,s.index+1)}else do{o=s,s=this.getNextKeyWith(t,u,s.index+1)}while(s.time<c);a.prevKey[t]=o,a.nextKey[t]=s}e.matrixAutoUpdate=!0,e.matrixWorldNeedsUpdate=!0,i=(c-o.time)/(s.time-o.time),n=o[t],r=s[t],(i<0||i>1)&&(i=i<0?0:1),"pos"===t?(t=e.position,this.interpolationType===h.AnimationHandler.LINEAR?(t.x=n[0]+(r[0]-n[0])*i,t.y=n[1]+(r[1]-n[1])*i,t.z=n[2]+(r[2]-n[2])*i):this.interpolationType!==h.AnimationHandler.CATMULLROM&&this.interpolationType!==h.AnimationHandler.CATMULLROM_FORWARD||(this.points[0]=this.getPrevKeyWith("pos",u,o.index-1).pos,this.points[1]=n,this.points[2]=r,this.points[3]=this.getNextKeyWith("pos",u,s.index+1).pos,i=.33*i+.33,n=this.interpolateCatmullRom(this.points,i),t.x=n[0],t.y=n[1],t.z=n[2],this.interpolationType===h.AnimationHandler.CATMULLROM_FORWARD&&(i=this.interpolateCatmullRom(this.points,1.01*i),this.target.set(i[0],i[1],i[2]),this.target.subSelf(t),this.target.y=0,this.target.normalize(),i=Math.atan2(this.target.x,this.target.z),e.rotation.set(0,i,0)))):"rot"===t?h.Quaternion.slerp(n,r,e.quaternion,i):"scl"===t&&((t=e.scale).x=n[0]+(r[0]-n[0])*i,t.y=n[1]+(r[1]-n[1])*i,t.z=n[2]+(r[2]-n[2])*i)}}if(this.JITCompile&&void 0===p[0][l])for(this.hierarchy[0].update(void 0,!0),u=0;u<this.hierarchy.length;u++)p[u][l]=this.hierarchy[u]instanceof h.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}},h.Animation.prototype.interpolateCatmullRom=function(e,t){var i,n,r,o,s,a,h=[],l=[];return i=(e.length-1)*t,i-=n=Math.floor(i),h[0]=0==n?n:n-1,h[1]=n,h[2]=n>e.length-2?n:n+1,h[3]=n>e.length-3?n:n+2,n=e[h[0]],o=e[h[1]],s=e[h[2]],a=e[h[3]],r=i*(h=i*i),l[0]=this.interpolate(n[0],o[0],s[0],a[0],i,h,r),l[1]=this.interpolate(n[1],o[1],s[1],a[1],i,h,r),l[2]=this.interpolate(n[2],o[2],s[2],a[2],i,h,r),l},h.Animation.prototype.interpolate=function(e,t,i,n,r,o,s){return(2*(t-i)+(e=.5*(i-e))+(n=.5*(n-t)))*s+(-3*(t-i)-2*e-n)*o+e*r+t},h.Animation.prototype.getNextKeyWith=function(e,t,i){var n=this.data.hierarchy[t].keys;for(this.interpolationType===h.AnimationHandler.CATMULLROM||this.interpolationType===h.AnimationHandler.CATMULLROM_FORWARD?i=i<n.length-1?i:n.length-1:i%=n.length;i<n.length;i++)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[0]},h.Animation.prototype.getPrevKeyWith=function(e,t,i){var n=this.data.hierarchy[t].keys;for(i=this.interpolationType===h.AnimationHandler.CATMULLROM||this.interpolationType===h.AnimationHandler.CATMULLROM_FORWARD?i>0?i:0:i>=0?i:i+n.length;i>=0;i--)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[n.length-1]},h.Camera=function(e,t,i,n,r){h.Object3D.call(this),this.fov=e||50,this.aspect=t||1,this.near=i||.1,this.far=n||2e3,this.target=r||new h.Object3D,this.useTarget=!0,this.matrixWorldInverse=new h.Matrix4,this.projectionMatrix=null,this.updateProjectionMatrix()},h.Camera.prototype=new h.Object3D,h.Camera.prototype.constructor=h.Camera,h.Camera.prototype.supr=h.Object3D.prototype,h.Camera.prototype.translate=function(e,t){this.matrix.rotateAxis(t),this.position.addSelf(t.multiplyScalar(e)),this.target.position.addSelf(t.multiplyScalar(e))},h.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=h.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)},h.Camera.prototype.updateMatrix=function(){this.update(void 0,!0)},h.Camera.prototype.update=function(e,t,i){for(this.useTarget?(this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),e?this.matrixWorld.multiply(e,this.matrix
1):this.matrixWorld.copy(this.matrix),h.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),t=!0):(this.matrixAutoUpdate&&(t|=this.updateMatrix()),(t||this.matrixWorldNeedsUpdate)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0,h.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse))),e=0;e<this.children.length;e++)this.children[e].update(this.matrixWorld,t,i)},h.Light=function(e){h.Object3D.call(this),this.color=new h.Color(e)},h.Light.prototype=new h.Object3D,h.Light.prototype.constructor=h.Light,h.Light.prototype.supr=h.Object3D.prototype,h.AmbientLight=function(e){h.Light.call(this,e)},h.AmbientLight.prototype=new h.Light,h.AmbientLight.prototype.constructor=h.AmbientLight,h.DirectionalLight=function(e,t,i){h.Light.call(this,e),this.position=new h.Vector3(0,1,0),this.intensity=t||1,this.distance=i||0},h.DirectionalLight.prototype=new h.Light,h.DirectionalLight.prototype.constructor=h.DirectionalLight,h.PointLight=function(e,t,i){h.Light.call(this,e),this.position=new h.Vector3,this.intensity=t||1,this.distance=i||0},h.PointLight.prototype=new h.Light,h.PointLight.prototype.constructor=h.PointLight,h.NoShading=0,h.FlatShading=1,h.SmoothShading=2,h.NoColors=0,h.FaceColors=1,h.VertexColors=2,h.NormalBlending=0,h.AdditiveBlending=1,h.SubtractiveBlending=2,h.MultiplyBlending=3,h.MaterialCounter={value:0},h.CubeReflectionMapping=function(){},h.CubeRefractionMapping=function(){},h.LatitudeReflectionMapping=function(){},h.LatitudeRefractionMapping=function(){},h.SphericalReflectionMapping=function(){},h.SphericalRefractionMapping=function(){},h.UVMapping=function(){},h.LineBasicMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.opacity=1,this.blending=h.NormalBlending,this.depthTest=!0,this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=!1,e&&(void 0!==e.color&&this.color.setHex(e.color),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.linewidth&&(this.linewidth=e.linewidth),void 0!==e.linecap&&(this.linecap=e.linecap),void 0!==e.linejoin&&(this.linejoin=e.linejoin),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors))},h.MeshBasicMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.opacity=1,this.envMap=this.lightMap=this.map=null,this.combine=h.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=h.SmoothShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=!1,this.skinning=!1,this.morphTargets=!1,e&&(void 0!==e.color&&this.color.setHex(e.color),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.map&&(this.map=e.map),void 0!==e.lightMap&&(this.lightMap=e.lightMap),void 0!==e.envMap&&(this.envMap=e.envMap),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors),void 0!==e.skinning&&(this.skinning=e.skinning),void 0!==e.morphTargets&&(this.morphTargets=e.morphTargets))},h.MeshLambertMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.opacity=1,this.envMap=this.lightMap=this.map=null,this.combine=h.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=h.SmoothShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=!1,this.skinning=!1,this.morphTargets=!1,e&&(void 0!==e.color&&this.color.setHex(e.color),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.map&&(this.map=e.map),void 0!==e.lightMap&&(this.lightMap=e.lightMap),void 0!==e.envMap&&(this.envMap=e.envMap),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors),void 0!==e.skinning&&(this.skinning=e.skinning),void 0!==e.morphTargets&&(this.morphTargets=e.morphTargets))},h.MeshPhongMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.ambient=new h.Color(328965),this.specular=new h.Color(1118481),this.shininess=30,this.opacity=1,this.envMap=this.lightMap=this.map=null,this.combine=h.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=h.SmoothShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=!1,this.skinning=!1,this.morphTargets=!1,e&&(void 0!==e.color&&(this.color=new h.Color(e.color)),void 0!==e.ambient&&(this.ambient=new h.Color(e.ambient)),void 0!==e.specular&&(this.specular=new h.Color(e.specular)),void 0!==e.shininess&&(this.shininess=e.shininess),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.lightMap&&(this.lightMap=e.lightMap),void 0!==e.map&&(this.map=e.map),void 0!==e.envMap&&(this.envMap=e.envMap),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors),void 0!==e.skinning&&(this.skinning=e.skinning),void 0!==e.morphTargets&&(this.morphTargets=e.morphTargets))},h.MeshDepthMaterial=function(e){this.id=h.MaterialCounter.value++,this.opacity=1,this.shading=h.SmoothShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,e&&(void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth))},h.MeshNormalMaterial=function(e){this.id=h.MaterialCounter.value++,this.opacity=1,this.shading=h.FlatShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,e&&(void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth))},h.MeshFaceMaterial=function(){},h.MeshShaderMaterial=function(e){this.id=h.MaterialCounter.value++,this.vertexShader=this.fragmentShader="void main() {}",this.uniforms={},this.opacity=1,this.shading=h.SmoothShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.lights=!1,this.vertexColors=!1,this.skinning=!1,this.morphTargets=!1,e&&(void 0!==e.fragmentShader&&(this.fragmentShader=e.fragmentShader),void 0!==e.vertexShader&&(this.vertexShader=e.vertexShader),void 0!==e.uniforms&&(this.uniforms=e.uniforms),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.shading&&(this.shading=e.shading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.lights&&(this.lights=e.lights),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors),void 0!==e.skinning&&(this.skinning=e.skinning),void 0!==e.morphTargets&&(this.morphTargets=e.morphTargets))},h.ShadowVolumeDynamicMaterial=function(){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.opacity=1,this.envMap=this.lightMap=this.map=null,this.combine=h.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=h.FlatShading,this.blending=h.NormalBlending,this.depthTest=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=!1,this.skinning=!1,this.morphTargets=!1},h.ParticleBasicMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.opacity=1,this.map=null,this.size=1,this.sizeAttenuation=!0,this.blending=h.NormalBlending,this.depthTest=!0,this.offset=new h.Vector2,this.vertexColors=!1,e&&(void 0!==e.color&&this.color.setHex(e.color),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.map&&(this.map=e.map),void 0!==e.size&&(this.size=e.size),void 0!==e.sizeAttenuation&&(this.sizeAttenuation=e.sizeAttenuation),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.vertexColors&&(this.vertexColors=e.vertexColors))},h.ParticleCanvasMaterial=function(e){this.id=h.MaterialCounter.value++,this.color=new h.Color(16777215),this.program=function(){},this.opacity=1,this.blending=h.NormalBlending,e&&(void 0!==e.color&&this.color.setHex(e.color),void 0!==e.program&&(this.program=e.program),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.blending&&(this.blending=e.blending))},h.ParticleDOMMaterial=function(e){this.id=h.MaterialCounter.value++,this.domElement=e},h.Texture=function(e,t,i,n,r,o){this.image=e,this.mapping=void 0!==t?t:new h.UVMapping,this.wrapS=void 0!==i?i:h.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:h.ClampToEdgeWrapping,this.magFilter=void 0!==r?r:h.LinearFilter,this.minFilter=void 0!==o?o:h.LinearMipMapLinearFilter,this.needsUpdate=!1},h.Texture.prototype={clone:function(){return new h.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}},h.MultiplyOperation=0,h.MixOperation=1,h.RepeatWrapping=0,h.ClampToEdgeWrapping=1,h.MirroredRepeatWrapping=2,h.NearestFilter=3,h.NearestMipMapNearestFilter=4,h.NearestMipMapLinearFilter=5,h.LinearFilter=6,h.LinearMipMapNearestFilter=7,h.LinearMipMapLinearFilter=8,h.ByteType=9,h.UnsignedByteType=10,h.ShortType=11,h.UnsignedShortType=12,h.IntType=13,h.UnsignedIntType=14,h.FloatType=15,h.AlphaFormat=16,h.RGBFormat=17,h.RGBAFormat=18,h.LuminanceFormat=19,h.LuminanceAlphaFormat=20,h.RenderTarget=function(e,t,i){this.width=e,this.height=t,i=i||{},this.wrapS=void 0!==i.wrapS?i.wrapS:h.ClampToEdgeWrapping,this.wrapT=void 0!==i.wrapT?i.wrapT:h.ClampToEdgeWrapping,this.magFilter=void 0!==i.magFilter?i.magFilter:h.LinearFilter,this.minFilter=void 0!==i.minFilter?i.minFilter:h.LinearMipMapLinearFilter,this.format=void 0!==i.format?i.format:h.RGBFormat,this.type=void 0!==i.type?i.type:h.UnsignedByteType};var c={clone:function(e){var t,i,n,r={};for(t in e)for(i in r[t]={},e[t])n=e[t][i],r[t][i]=n instanceof h.Color||n instanceof h.Vector3||n instanceof h.Texture?n.clone():n;return r},merge:function(e){var t,i,n,r={};for(t=0;t<e.length;t++)for(i in n=this.clone(e[t]))r[i]=n[i];return r}};h.Particle=function(e){h.Object3D.call(this),this.materials=e instanceof Array?e:[e],this.matrixAutoUpdate=!1},h.Particle.prototype=new h.Object3D,h.Particle.prototype.constructor=h.Particle,h.ParticleSystem=function(e,t){h.Object3D.call(this),this.geometry=e,this.materials=t instanceof Array?t:[t],this.sortParticles=!1},h.ParticleSystem.prototype=new h.Object3D,h.ParticleSystem.prototype.constructor=h.ParticleSystem,h.Line=function(e,t,i){h.Object3D.call(this),this.geometry=e,this.materials=t instanceof Array?t:[t],this.type=null!=i?i:h.LineStrip},h.LineStrip=0,h.LinePieces=1,h.Line.prototype=new h.Object3D,h.Line.prototype.constructor=h.Line,h.Mesh=function(e,t){if(h.Object3D.call(this),this.geometry=e,this.materials=t&&t.length?t:[t],this.flipSided=!1,this.doubleSided=!1,this.overdraw=!1,this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=e.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0;i<this.geometry.morphTargets.length;i++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[i].name]=i}},h.Mesh.prototype=new h.Object3D,h.Mesh.prototype.constructor=h.Mesh,h.Mesh.prototype.supr=h.Object3D.prototype,h.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:0},h.Bone=function(e){h.Object3D.call(this),this.skin=e,this.skinMatrix=new h.Matrix4,this.hasNoneBoneChildren=!1},h.Bone.prototype=new h.Object3D,h.Bone.prototype.constructor=h.Bone,h.Bone.prototype.supr=h.Object3D.prototype,h.Bone.prototype.update=function(e,t,i){this.matrixAutoUpdate&&(t|=this.updateMatrix()),(t||this.matrixWorldNeedsUpdate)&&(e?this.skinMatrix.multiply(e,this.matrix
1):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);var n,r=this.children.length;if(this.hasNoneBoneChildren)for(this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix),n=0;n<r;n++)(e=this.children[n])instanceof h.Bone?e.update(this.skinMatrix,t,i):e.update(this.matrixWorld,!0,i);else for(n=0;n<r;n++)this.children[n].update(this.skinMatrix,t,i)},h.Bone.prototype.addChild=function(e){-1===this.children.indexOf(e)&&(void 0!==e.parent&&e.parent.removeChild(e),e.parent=this,this.children.push(e),e instanceof h.Bone||(this.hasNoneBoneChildren=!0))},window.Float32Array||(window.Float32Array=Array),h.SkinnedMesh=function(e,t){var i,n,r,o,s,a;if(h.Mesh.call(this,e,t),this.identityMatrix=new h.Matrix4,this.bones=[],this.boneMatrices=[],void 0!==this.geometry.bones){for(i=0;i<this.geometry.bones.length;i++)o=(r=this.geometry.bones[i]).pos,s=r.rotq,a=r.scl,(n=this.addBone()).name=r.name,n.position.set(o[0],o[1],o[2]),n.quaternion.set(s[0],s[1],s[2],s[3]),n.useQuaternion=!0,void 0!==a?n.scale.set(a[0],a[1],a[2]):n.scale.set(1,1,1);for(i=0;i<this.bones.length;i++)r=this.geometry.bones[i],n=this.bones[i],-1===r.parent?this.addChild(n):this.bones[r.parent].addChild(n);this.boneMatrices=new Float32Array(16*this.bones.length),this.pose()}},h.SkinnedMesh.prototype=new h.Mesh,h.SkinnedMesh.prototype.constructor=h.SkinnedMesh,h.SkinnedMesh.prototype.update=function(e,t,i){if(this.visible){this.matrixAutoUpdate&&(t|=this.updateMatrix()),(t||this.matrixWorldNeedsUpdate)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);var n,r=this.children.length;for(n=0;n<r;n++)(e=this.children[n])instanceof h.Bone?e.update(this.identityMatrix,!1,i):e.update(this.matrixWorld,t,i);for(i=this.bones.length,ba=this.bones,bm=this.boneMatrices,t=0;t<i;t++)ba[t].skinMatrix.flattenToArrayOffset(bm,16*t)}},h.SkinnedMesh.prototype.addBone=function(e){return void 0===e&&(e=new h.Bone(this)),this.bones.push(e),e},h.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var e,t=[],i=0;i<this.bones.length;i++)e=this.bones[i],t.push(h.Matrix4.makeInvert(e.skinMatrix)),e.skinMatrix.flattenToArrayOffset(this.boneMatrices,16*i);var n;if(void 0===this.geometry.skinVerticesA)for(this.geometry.skinVerticesA=[],this.geometry.skinVerticesB=[],e=0;e<this.geometry.skinIndices.length;e++){i=this.geometry.vertices[e].position;var r=this.geometry.skinIndices[e].x,o=this.geometry.skinIndices[e].y;n=new h.Vector3(i.x,i.y,i.z),this.geometry.skinVerticesA.push(t[r].multiplyVector3(n)),n=new h.Vector3(i.x,i.y,i.z),this.geometry.skinVerticesB.push(t[o].multiplyVector3(n)),this.geometry.skinWeights[e].x+this.geometry.skinWeights[e].y!==1&&(i=.5*(1-(this.geometry.skinWeights[e].x+this.geometry.skinWeights[e].y)),this.geometry.skinWeights[e].x+=i,this.geometry.skinWeights[e].y+=i)}},h.Ribbon=function(e,t){h.Object3D.call(this),this.geometry=e,this.materials=t instanceof Array?t:[t],this.flipSided=!1,this.doubleSided=!1},h.Ribbon.prototype=new h.Object3D,h.Ribbon.prototype.constructor=h.Ribbon,h.Sound=function(e,t,i,n){var r;for(h.Object3D.call(this),this.isLoaded=!1,this.isAddedToDOM=!1,this.isPlaying=!1,this.duration=-1,this.radius=void 0!==t?Math.abs(t):100,this.volume=Math.min(1,Math.max(0,void 0!==i?i:1)),this.domElement=document.createElement("audio"),this.domElement.volume=0,this.domElement.pan=0,this.domElement.loop=void 0===n||n,this.sources=e instanceof Array?e:[e],i=this.sources.length,e=0;e<i;e++)if((t=this.sources[e]).toLowerCase(),-1!==t.indexOf(".mp3")?r="audio/mpeg":-1!==t.indexOf(".ogg")?r="audio/ogg":-1!==t.indexOf(".wav")&&(r="audio/wav"),this.domElement.canPlayType(r)){(r=document.createElement("source")).src=this.sources[e],this.domElement.THREESound=this,this.domElement.appendChild(r),this.domElement.addEventListener("canplay",this.onLoad,!0),this.domElement.load();break}},h.Sound.prototype=new h.Object3D,h.Sound.prototype.constructor=h.Sound,h.Sound.prototype.supr=h.Object3D.prototype,h.Sound.prototype.onLoad=function(){var e=this.THREESound;e.isLoaded||(this.removeEventListener("canplay",this.onLoad,!0),e.isLoaded=!0,e.duration=this.duration,e.isPlaying&&e.play())},h.Sound.prototype.addToDOM=function(e){this.isAddedToDOM=!0,e.a
1ppendChild(this.domElement)},h.Sound.prototype.play=function(e){this.isPlaying=!0,this.isLoaded&&(this.domElement.play(),e&&(this.domElement.currentTime=e%this.duration))},h.Sound.prototype.pause=function(){this.isPlaying=!1,this.domElement.pause()},h.Sound.prototype.stop=function(){this.isPlaying=!1,this.domElement.pause(),this.domElement.currentTime=0},h.Sound.prototype.calculateVolumeAndPan=function(e){e=e.length(),this.domElement.volume=e<=this.radius?this.volume*(1-e/this.radius):0},h.Sound.prototype.update=function(e,t,i){this.matrixAutoUpdate&&(this.matrix.setPosition(this.position),t=!0),(t||this.matrixWorldNeedsUpdate)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);var n=this.children.length;for(e=0;e<n;e++)this.children[e].update(this.matrixWorld,t,i)},h.LOD=function(){h.Object3D.call(this),this.LODs=[]},h.LOD.prototype=new h.Object3D,h.LOD.prototype.constructor=h.LOD,h.LOD.prototype.supr=h.Object3D.prototype,h.LOD.prototype.add=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=0;i<this.LODs.length&&!(t<this.LODs[i].visibleAtDistance);i++);this.LODs.splice(i,0,{visibleAtDistance:t,object3D:e}),this.addChild(e)},h.LOD.prototype.update=function(e,t,i){if(this.matrixAutoUpdate&&(t|=this.updateMatrix()),(t||this.matrixWorldNeedsUpdate)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0),this.LODs.length>1){e=-((e=i.matrixWorldInverse).n31*this.position.x+e.n32*this.position.y+e.n33*this.position.z+e.n34),this.LODs[0].object3D.visible=!0;for(var n=1;n<this.LODs.length&&e>=this.LODs[n].visibleAtDistance;n++)this.LODs[n-1].object3D.visible=!1,this.LODs[n].object3D.visible=!0;for(;n<this.LODs.length;n++)this.LODs[n].object3D.visible=!1}for(e=0;e<this.children.length;e++)this.children[e].update(this.matrixWorld,t,i)},h.ShadowVolume=function(e,t){h.Mesh.call(this,e.geometry,[new h.ShadowVolumeDynamicMaterial]),e.addChild(this),this.calculateShadowVolumeGeometry(e.geometry)},h.ShadowVolume.prototype=new h.Mesh,h.ShadowVolume.prototype.constructor=h.ShadowVolume,h.ShadowVolume.prototype.supr=h.Mesh.prototype,h.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(e){this.geometry=new h.Geometry,this.geometry.boundingSphere=e.boundingSphere,this.geometry.edgeFaces=[];var t=this.geometry.vertices,i=this.geometry.faces,n=this.geometry.edgeFaces,r=e.faces;e=e.vertices;var o,s,a,l,c,d=r.length,f=["a","b","c","d"];for(a=0;a<d;a++)for(s=t.length,(o=r[a])instanceof h.Face4?(l=4,s=new h.Face4(s,s+1,s+2,s+3)):(l=3,s=new h.Face3(s,s+1,s+2)),s.normal.copy(o.normal),i.push(s),s=0;s<l;s++)c=e[o[f[s]]],t.push(new h.Vertex(c.position.clone()));for(d=0;d<r.length-1;d++)for(e=i[d],o=d+1;o<r.length;o++)s=i[o],void 0!==(s=this.facesShareEdge(t,e,s))&&((s=new h.Face4(s.indices[0],s.indices[3],s.indices[2],s.indices[1])).normal.set(1,0,0),n.push(s))},h.ShadowVolume.prototype.facesShareEdge=function(e,t,i){var n,r,o,s,a,l,c,d,f,p,u,m,g,v=0,y=["a","b","c","d"];for(n=t instanceof h.Face4?4:3,r=i instanceof h.Face4?4:3,m=0;m<n;m++)for(a=e[o=t[y[m]]],g=0;g<r;g++)if(l=e[s=i[y[g]]],Math.abs(a.position.x-l.position.x)<1e-4&&Math.abs(a.position.y-l.position.y)<1e-4&&Math.abs(a.position.z-l.position.z)<1e-4&&(1===++v&&(c=a,d=l,f=o,p=s,u=y[m]),2===v))return"ad"===(u+=y[m])||"ac"===u?{faces:[t,i],vertices:[c,d,l,a],indices:[f,p,s,o],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[t,i],vertices:[c,a,l,d],indices:[f,o,s,p],vertexTypes:[1,1,2,2],extrudable:!0}},h.Scene=function(){h.Object3D.call(this),this.matrixAutoUpdate=!1,this.fog=null,this.objects=[],this.lights=[],this.sounds=[],this.__objectsAdded=[],this.__objectsRemoved=[]},h.Scene.prototype=new h.Object3D,h.Scene.prototype.constructor=h.Scene,h.Scene.prototype.supr=h.Object3D.prototype,h.Scene.prototype.addChild=function(e){this.supr.addChild.call(this,e),this.addChildRecurse(e)},h.Scene.prototype.addChildRecurse=function(e){e instanceof h.Light?-1===this.lights.indexOf(e)&&this.lights.push(e):e instanceof h.Sound?-1===this.sounds.indexOf(e)&&this.sounds.push(e):e instanceof h.Camera||e instanceof h.Bone||-1!==this.objects.indexOf(e)||(this.objects.push(e),this.__objectsAdded.push(e));for(var t=0;t<e.children.length;t++)this.addChildRecurse(e.children[t])},h.Scene.prototype.removeChild=function(e){this.supr.removeChild.call(this,e),this.removeChildRecurse(e)},h.Scene.prototype.removeChildRecurse=function(e){if(e instanceof h.Light){var t=this.lights.indexOf(e);-1!==t&&this.lights.splice(t,1)}else e instanceof h.Sound?-1!==(t=this.sounds.indexOf(e))&&this.sounds.splice(t,1):e instanceof h.Camera||-1!==(t=this.objects.indexOf(e))&&(this.objects.splice(t,1),this.__objectsRemoved.push(e));for(t=0;t<e.children.length;t++)this.removeChildRecurse(e.children[t])},h.Scene.prototype.addObject=h.Scene.prototype.addChild,h.Scene.prototype.removeObject=h.Scene.prototype.removeChild,h.Scene.prototype.addLight=h.Scene.prototype.addChild,h.Scene.prototype.removeLight=h.Scene.prototype.removeChild,h.Fog=function(e,t,i){this.color=new h.Color(e),this.near=t||1,this.far=i||1e3},h.FogExp2=function(e,t){this.color=new h.Color(e),this.density=void 0!==t?t:25e-5},h.Projector=function(){function e(){var e=g[s]=g[s]||new h.RenderableVertex;return s++,e}function t(e,t){return t.z-e.z}function i(e,t){var i=0,n=1,r=e.z+e.w,o=t.z+t.w,s=-e.z+e.w,a=-t.z+t.w;return r>=0&&o>=0&&s>=0&&a>=0||!(r<0&&o<0||s<0&&a<0)&&(r<0?i=Math.max(i,r/(r-o)):o<0&&(n=Math.min(n,r/(r-o))),s<0?i=Math.max(i,s/(s-a)
1):a<0&&(n=Math.min(n,s/(s-a))),!(n<i)&&(e.lerpSelf(t,i),t.lerpSelf(e,1-n),!0))}var n,r,o,s,a,l,c,d,f,p,u,m=[],g=[],v=[],y=[],_=[],x=[],b=new h.Vector4,w=new h.Vector4,S=new h.Matrix4,M=new h.Matrix4,A=[new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4],T=new h.Vector4,R=new h.Vector4;this.projectVector=function(e,t){return S.multiply(t.projectionMatrix,t.matrixWorldInverse),S.multiplyVector3(e),e},this.unprojectVector=function(e,t){return S.multiply(t.matrixWorld,h.Matrix4.makeInvert(t.projectionMatrix)),S.multiplyVector3(e),e},this.projectObjects=function(e,i,o){var s,a,l;for(i=[],r=0,a=e.objects,e=0,s=a.length;e<s;e++){var c;if(!(c=!(l=a[e]).visible)&&(c=l instanceof h.Mesh)){e:{c=void 0;for(var d=l.matrixWorld,f=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++)if((c=A[p].x*d.n14+A[p].y*d.n24+A[p].z*d.n34+A[p].w)<=f){c=!1;break e}c=!0}c=!c}c||(c=m[r]=m[r]||new h.RenderableObject,r++,n=c,b.copy(l.position),S.multiplyVector3(b),n.object=l,n.z=b.z,i.push(n))}return o&&i.sort(t),i},this.projectScene=function(n,r,m){var b,L,C,E,F,z,V,B,P,k,U,N,D,I,O,W,j,G=[],H=r.near,X=r.far;for(u=f=c=l=0,r.matrixAutoUpdate&&r.updateMatrix(),n.update(void 0,!1,r),S.multiply(r.projectionMatrix,r.matrixWorldInverse),A[0].set(S.n41-S.n11,S.n42-S.n12,S.n43-S.n13,S.n44-S.n14),A[1].set(S.n41+S.n11,S.n42+S.n12,S.n43+S.n13,S.n44+S.n14),A[2].set(S.n41+S.n21,S.n42+S.n22,S.n43+S.n23,S.n44+S.n24),A[3].set(S.n41-S.n21,S.n42-S.n22,S.n43-S.n23,S.n44-S.n24),A[4].set(S.n41-S.n31,S.n42-S.n32,S.n43-S.n33,S.n44-S.n34),A[5].set(S.n41+S.n31,S.n42+S.n32,S.n43+S.n33,S.n44+S.n34),b=0;b<6;b++)(P=A[b]).divideScalar(Math.sqrt(P.x*P.x+P.y*P.y+P.z*P.z));for(P=this.projectObjects(n,r,!0),n=0,b=P.length;n<b;n++)if((k=P[n].object).visible)if(U=k.matrixWorld,N=k.matrixRotationWorld,D=k.materials,I=k.overdraw,s=0,k instanceof h.Mesh){for(E=(O=k.geometry).vertices,W=O.faces,O=O.faceVertexUvs,L=0,C=E.length;L<C;L++)(o=e()).positionWorld.copy(E[L].position),U.multiplyVector3(o.positionWorld),o.positionScreen.copy(o.positionWorld),S.multiplyVector4(o.positionScreen),o.positionScreen.x/=o.positionScreen.w,o.positionScreen.y/=o.positionScreen.w,o.visible=o.positionScreen.z>H&&o.positionScreen.z<X;for(E=0,L=W.length;E<L;E++){if((C=W[E])instanceof h.Face3){if(F=g[C.a],z=g[C.b],V=g[C.c],!(F.visible&&z.visible&&V.visible)||!k.doubleSided&&k.flipSided==(V.positionScreen.x-F.positionScreen.x)*(z.positionScreen.y-F.positionScreen.y)-(V.positionScreen.y-F.positionScreen.y)*(z.positionScreen.x-F.positionScreen.x)<0)continue;B=v[l]=v[l]||new h.RenderableFace3,l++,(a=B).v1.copy(F),a.v2.copy(z),a.v3.copy(V)}else if(C instanceof h.Face4){if(F=g[C.a],z=g[C.b],V=g[C.c],B=g[C.d],!(F.visible&&z.visible&&V.visible&&B.visible)||!k.doubleSided&&k.flipSided==((B.positionScreen.x-F.positionScreen.x)*(z.positionScreen.y-F.positionScreen.y)-(B.positionScreen.y-F.positionScreen.y)*(z.positionScreen.x-F.positionScreen.x)<0||(z.positionScreen.x-V.positionScreen.x)*(B.positionScreen.y-V.positionScreen.y)-(z.positionScreen.y-V.positionScreen.y)*(B.positionScreen.x-V.positionScreen.x)<0))continue;j=y[c]=y[c]||new h.RenderableFace4,c++,(a=j).v1.copy(F),a.v2.copy(z),a.v3.copy(V),a.v4.copy(B)}for(a.normalWorld.copy(C.normal),N.multiplyVector3(a.normalWorld),a.centroidWorld.copy(C.centroid),U.multiplyVector3(a.centroidWorld),a.centroidScreen.copy(a.centroidWorld),S.multiplyVector3(a.centroidScreen),F=0,z=(V=C.vertexNormals).length;F<z;F++)(B=a.vertexNormalsWorld[F]).copy(V[F]),N.multiplyVector3(B);for(F=0,z=O.length;F<z;F++)if(j=O[F][E])for(V=0,B=j.length;V<B;V++)a.uvs[F][V]=j[V];a.meshMaterials=D,a.faceMaterials=C.materials,a.overdraw=I,a.z=a.centroidScreen.z,G.push(a)}}else if(k instanceof h.Line)for(M.multiply(S,U),E=k.geometry.vertices,(F=e()).positionScreen.copy(E[0].position),M.multiplyVector4(F.positionScreen),L=1,C=E.length;L<C;L++)(F=e()).positionScreen.copy(E[L].position),M.multiplyVector4(F.positionScreen),z=g[s-2],T.copy(F.positionScreen),R.copy(z.positionScreen),i(T,R)&&(T.multiplyScalar(1/T.w),R.multiplyScalar(1/R.w),U=_[f]=_[f]||new h.RenderableLine,f++,(d=U).v1.positionScreen.copy(T),d.v2.positionScreen.copy(R),d.z=Math.max(T.z,R.z),d.materials=k.materials,G.push(d));else k instanceof h.Particle&&(w.set(k.position.x,k.position.y,k.position.z,1),S.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1&&(U=x[u]=x[u]||new h.RenderableParticle,u++,(p=U).x=w.x/w.w,p.y=w.y/w.w,p.z=w.z,p.rotation=k.rotation.z,p.scale.x=k.scale.x*Math.abs(p.x-(w.x+r.projectionMatrix.n11)/(w.w+r.projectionMatrix.n14)),p.scale.y=k.scale.y*Math.abs(p.y-(w.y+r.projectionMatrix.n22)/(w.w+r.projectionMatrix.n24)),p.materials=k.materials,G.push(p)));return m&&G.sort(t),G}},h.DOMRenderer=function(){h.Renderer.call(this);var e,t,i=null,n=new h.Projector;this.domElement=document.createElement("div"),this.setSize=function(i,n){e=i/2,t=n/2},this.render=function(r,o){var s,a,l,c,d,f,p,u;for(s=0,a=(i=n.projectScene(r,o)).length;s<a;s++)if((d=i[s])instanceof h.RenderableParticle)for(p=d.x*e+e,u=d.y*t+t,l=0,c=d.material.length;l<c;l++)(f=d.material[l])instanceof h.ParticleDOMMaterial&&((f=f.domElement).style.left=p+"px",f.style.top=u+"px")}},h.CanvasRenderer=function(){function e(e){X!=e&&(j.globalAlpha=X=e)}function t(e){if(Y!=e){switch(e){case h.NormalBlending:j.globalCompositeOperation="source-over";break;case h.AdditiveBlending:j.globalCompositeOperation="lighter";break;case h.SubtractiveBlending:j.globalCompositeOperation="darker"}Y=e}}function i(e){q!=e&&(j.strokeStyle=q=e)}var n,r,o,s,a,l,c,d,f,p,u,m,g,v,y,_,x,b,w,S,M,A,T,R,L,C,E,F,z,V,B,P,k,U,N,D,I=null,O=new h.Projector,W=document.createElement("canvas"),j=W.getContext("2d"),G=new h.Color(0),H=0,X=1,Y=0,q=null,K=null,Q=null,J=null,Z=null,$=new h.RenderableVertex,ee=new h.RenderableVertex,te=new h.Color,ie=new h.Color,ne=new h.Color,re=new h.Color,oe=new h.Color,se=new h.Rectangle,ae=new h.Rectangle,he=new h.Rectangle,le=!1,ce=new h.Color,de=new h.Color,fe=new h.Color,pe=new h.Color,ue=new h.Vector3,me=16;(B=document.createElement("canvas")).width=B.height=2,(P=B.getContext("2d")).fillStyle="rgba(0,0,0,1)",P.fillRect(0,0,2,2),k=P.getImageData(0,0,2,2),U=k.data,(N=document.createElement("canvas")).width=N.height=me,(D=N.getContext("2d")).translate(-me/2,-me/2),D.scale(me,me),me--,this.domElement=W,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.setSize=function(e,t){o=(n=e)/2,s=(r=t)/2,W.width=n,W.height=r,se.set(-o,-s,o,s),X=1,Y=0,Z=J=Q=K=q=null},this.setClearColor=function(e,t){G=e,H=t},this.setClearColorHex=function(e,t){G.setHex(e),H=t},this.clear=function(){j.setTransform(1,0,0,-1,o,s),ae.isEmpty()||(ae.inflate(1),ae.minSelf(se),0==G.hex&&0==H?j.clearRect(ae.getX(),ae.getY(),ae.getWidth(),ae.getHeight()):(t(h.NormalBlending),e(1),j.fillStyle="rgba("+Math.floor(255*G.r)+","+Math.floor(255*G.g)+","+Math.floor(255*G.b)+","+H+")",j.fillRect(ae.getX(),ae.getY(),ae.getWidth(),ae.getHeight())),ae.empty())},this.render=function(n,r){function W(e,t,i,n){var r,o,s,a,l=e.lights;for(e=0,r=l.length;e<r;e++)s=(o=l[e]).color,o instanceof h.DirectionalLight?(a=i.dot(o.position))<=0||(a*=o.intensity,n.r+=s.r*a,n.g+=s.g*a,n.b+=s.b*a):o instanceof h.PointLight&&((a=i.dot(ue.sub(o.position,t).normalize()))<=0||0!=(a*=0==o.distance?1:1-Math.min(t.distanceTo(o.position)/o.distance,1))&&(a*=o.intensity,n.r+=s.r*a,n.g+=s.g*a,n.b+=s.b*a))}
1function G(n,r,o,s){e(s.opacity),t(s.blending),j.beginPath(),j.moveTo(n.positionScreen.x,n.positionScreen.y),j.lineTo(r.positionScreen.x,r.positionScreen.y),j.closePath(),s instanceof h.LineBasicMaterial&&(te.__styleString=s.color.__styleString,n=s.linewidth,Q!=n&&(j.lineWidth=Q=n),n=s.linecap,J!=n&&(j.lineCap=J=n),n=s.linejoin,Z!=n&&(j.lineJoin=Z=n),i(te.__styleString),j.stroke(),he.inflate(2*s.linewidth))}function H(i,n,o,s,a,l,c,d,y){e(d.opacity),t(d.blending),f=i.positionScreen.x,p=i.positionScreen.y,u=n.positionScreen.x,m=n.positionScreen.y,g=o.positionScreen.x,v=o.positionScreen.y,Y(f,p,u,m,g,v),d instanceof h.MeshBasicMaterial?d.map?d.map.mapping instanceof h.UVMapping&&(R=c.uvs[0],ve(f,p,u,m,g,v,d.map.image,R[s].u,R[s].v,R[a].u,R[a].v,R[l].u,R[l].v)):d.envMap?d.envMap.mapping instanceof h.SphericalReflectionMapping&&(i=r.matrixWorldInverse,ue.copy(c.vertexNormalsWorld[0]),L=.5*(ue.x*i.n11+ue.y*i.n12+ue.z*i.n13)+.5,C=.5*-(ue.x*i.n21+ue.y*i.n22+ue.z*i.n23)+.5,ue.copy(c.vertexNormalsWorld[1]),E=.5*(ue.x*i.n11+ue.y*i.n12+ue.z*i.n13)+.5,F=.5*-(ue.x*i.n21+ue.y*i.n22+ue.z*i.n23)+.5,ue.copy(c.vertexNormalsWorld[2]),z=.5*(ue.x*i.n11+ue.y*i.n12+ue.z*i.n13)+.5,V=.5*-(ue.x*i.n21+ue.y*i.n22+ue.z*i.n23)+.5,ve(f,p,u,m,g,v,d.envMap.image,L,C,E,F,z,V)):d.wireframe?me(d.color.__styleStr
1ing,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(d.color.__styleString):d instanceof h.MeshLambertMaterial?(d.map&&!d.wireframe&&(d.map.mapping instanceof h.UVMapping&&(R=c.uvs[0],ve(f,p,u,m,g,v,d.map.image,R[s].u,R[s].v,R[a].u,R[a].v,R[l].u,R[l].v)),t(h.SubtractiveBlending)),le?d.wireframe||d.shading!=h.SmoothShading||3!=c.vertexNormalsWorld.length?(ce.r=de.r,ce.g=de.g,ce.b=de.b,W(y,c.centroidWorld,c.normalWorld,ce),te.r=d.color.r*ce.r,te.g=d.color.g*ce.g,te.b=d.color.b*ce.b,te.updateStyleString(),d.wireframe?me(te.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(te.__styleString)):(ie.r=ne.r=re.r=de.r,ie.g=ne.g=re.g=de.g,ie.b=ne.b=re.b=de.b,W(y,c.v1.positionWorld,c.vertexNormalsWorld[0],ie),W(y,c.v2.positionWorld,c.vertexNormalsWorld[1],ne),W(y,c.v3.positionWorld,c.vertexNormalsWorld[2],re),oe.r=.5*(ne.r+re.r),oe.g=.5*(ne.g+re.g),oe.b=.5*(ne.b+re.b),T=ye(ie,ne,re,oe),ve(f,p,u,m,g,v,T,0,0,1,0,0,1)):d.wireframe?me(d.color.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(d.color.__styleStr
1ing)):d instanceof h.MeshDepthMaterial?(M=r.near,A=r.far,ie.r=ie.g=ie.b=1-_e(i.positionScreen.z,M,A),ne.r=ne.g=ne.b=1-_e(n.positionScreen.z,M,A),re.r=re.g=re.b=1-_e(o.positionScreen.z,M,A),oe.r=.5*(ne.r+re.r),oe.g=.5*(ne.g+re.g),oe.b=.5*(ne.b+re.b),T=ye(ie,ne,re,oe),ve(f,p,u,m,g,v,T,0,0,1,0,0,1)):d instanceof h.MeshNormalMaterial&&(te.r=xe(c.normalWorld.x),te.g=xe(c.normalWorld.y),te.b=xe(c.normalWorld.z),te.updateStyleString(),d.wireframe?me(te.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(te.__styleString))}function X(i,n,o,s,a,l,c,d,R){e(d.opacity),t(d.blending),d.map||d.envMap?(H(i,n,s,0,1,3,c,d,R),H(a,o,l,1,2,3,c,d,R)):(f=i.positionScreen.x,p=i.positionScreen.y,u=n.positionScreen.x,m=n.positionScreen.y,g=o.positionScreen.x,v=o.positionScreen.y,y=s.positionScreen.x,_=s.positionScreen.y,x=a.positionScreen.x,b=a.positionScreen.y,w=l.positionScreen.x,S=l.positionScreen.y,d instanceof h.MeshBasicMaterial?(q(f,p,u,m,g,v,y,_),d.wireframe?me(d.color.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(d.color.__styleStr
1ing)):d instanceof h.MeshLambertMaterial?le?d.wireframe||d.shading!=h.SmoothShading||4!=c.vertexNormalsWorld.length?(ce.r=de.r,ce.g=de.g,ce.b=de.b,W(R,c.centroidWorld,c.normalWorld,ce),te.r=d.color.r*ce.r,te.g=d.color.g*ce.g,te.b=d.color.b*ce.b,te.updateStyleString(),q(f,p,u,m,g,v,y,_),d.wireframe?me(te.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(te.__styleString)):(ie.r=ne.r=re.r=oe.r=de.r,ie.g=ne.g=re.g=oe.g=de.g,ie.b=ne.b=re.b=oe.b=de.b,W(R,c.v1.positionWorld,c.vertexNormalsWorld[0],ie),W(R,c.v2.positionWorld,c.vertexNormalsWorld[1],ne),W(R,c.v4.positionWorld,c.vertexNormalsWorld[3],re),W(R,c.v3.positionWorld,c.vertexNormalsWorld[2],oe),T=ye(ie,ne,re,oe),Y(f,p,u,m,y,_),ve(f,p,u,m,y,_,T,0,0,1,0,0,1),Y(x,b,g,v,w,S),ve(x,b,g,v,w,S,T,1,0,1,1,0,1)):(q(f,p,u,m,g,v,y,_),d.wireframe?me(d.color.__styleString,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(d.color.__styleString)):d instanceof h.MeshNormalMaterial?(te.r=xe(c.normalWorld.x),te.g=xe(c.normalWorld.y),te.b=xe(c.normalWorld.z),te.updateStyleString(),q(f,p,u,m,g,v,y,_),d.wireframe?me(te.__styleStr
1ing,d.wireframeLinewidth,d.wireframeLinecap,d.wireframeLinejoin):ge(te.__styleString)):d instanceof h.MeshDepthMaterial&&(M=r.near,A=r.far,ie.r=ie.g=ie.b=1-_e(i.positionScreen.z,M,A),ne.r=ne.g=ne.b=1-_e(n.positionScreen.z,M,A),re.r=re.g=re.b=1-_e(s.positionScreen.z,M,A),oe.r=oe.g=oe.b=1-_e(o.positionScreen.z,M,A),T=ye(ie,ne,re,oe),Y(f,p,u,m,y,_),ve(f,p,u,m,y,_,T,0,0,1,0,0,1),Y(x,b,g,v,w,S),ve(x,b,g,v,w,S,T,1,0,1,1,0,1)))}function Y(e,t,i,n,r,o){j.beginPath(),j.moveTo(e,t),j.lineTo(i,n),j.lineTo(r,o),j.lineTo(e,t),j.closePath()}function q(e,t,i,n,r,o,s,a){j.beginPath(),j.moveTo(e,t),j.lineTo(i,n),j.lineTo(r,o),j.lineTo(s,a),j.lineTo(e,t),j.closePath()}function me(e,t,n,r){Q!=t&&(j.lineWidth=Q=t),J!=n&&(j.lineCap=J=n),Z!=r&&(j.lineJoin=Z=r),i(e),j.stroke(),he.inflate(2*t)}function ge(e){K!=e&&(j.fillStyle=K=e),j.fill()}function ve(e,t,i,n,r,o,s,a,h,l,c,d,f){var p,u;l*=p=s.width-1,c*=u=s.height-1,d*=p,f*=u,i-=e,n-=t,r-=e,o-=t,0!=(p=(l-=a*=p)*(f-=h*=u)-(d-=a)*(c-=h))&&(e=e-(p=(f*i-c*r)*(u=1/p))*a-(i=(l*r-d*i)*u)*h,t=t-(c=(f*n-c*o)*u)*a-(n=(l*o-d*n)*u)*h,j.save(),j.transform(p,c,i,n,e,t),j.clip(),j.drawImage(s,0,0),j.restore())}function ye(e,t,i,n){var r=~~(255*e.r),o=~~(255*e.g);e=~~(255*e.b);var s=~~(255*t.r),a=~~(255*t.g);t=~~(255*t.b);var h=~~(255*i.r),l=~~(255*i.g);i=~~(255*i.b);var c=~~(255*n.r),d=~~(255*n.g);return n=~~(255*n.b),U[0]=r<0?0:r>255?255:r,U[1]=o<0?0:o>255?255:o,U[2]=e<0?0:e>255?255:e,U[4]=s<0?0:s>255?255:s,U[5]=a<0?0:a>255?255:a,U[6]=t<0?0:t>255?255:t,U[8]=h<0?0:h>255?255:h,U[9]=l<0?0:l>255?255:l,U[10]=i<0?0:i>255?255:i,U[12]=c<0?0:c>255?255:c,U[13]=d<0?0:d>255?255:d,U[14]=n<0?0:n>255?255:n,P.putImageData(k,0,0),D.drawImage(B,0,0),N}function _e(e,t,i){return(e=(e-t)/(i-t))*e*(3-2*e)}function xe(e){return(e=.5*(e+1))<0?0:e>1?1:e}function be(e,t){var i=t.x-e.x,n=t.y-e.y,r=1/Math.sqrt(i*i+n*n);i*=r,n*=r,t.x+=i,t.y+=n,e.x-=i,e.y-=n}var we,Se,Me,Ae,Te,Re,Le,Ce,Ee,Fe,ze,Ve,Be,Pe,ke,Ue,Ne;for(this.autoClear?this.clear():j.setTransform(1,0,0,-1,o,s),I=O.projectScene(n,r,this.sortElements),(le=n.lights.length>0)&&function(e){var t,i,n,r=e.lights;for(de.setRGB(0,0,0),fe.setRGB(0,0,0),pe.setRGB(0,0,0),e=0,t=r.length;e<t;e++)n=(i=r[e]).color,i instanceof h.AmbientLight?(de.r+=n.r,de.g+=n.g,de.b+=n.b):i instanceof h.DirectionalLight?(fe.r+=n.r,fe.g+=n.g,fe.b+=n.b):i instanceof h.PointLight&&(pe.r+=n.r,pe.g+=n.g,pe.b+=n.b)}(n),we=0,Se=I.length;we<Se;we++){if(Me=I[we],he.empty(),Me instanceof h.RenderableParticle)for((a=Me).x*=o,a.y*=s,Ae=0,Te=Me.materials.length;Ae<Te;)0!=(Ce=Me.materials[Ae++]).opacity&&(Ee=a,Fe=Me,Ve=void 0,Be=void 0,Pe=void 0,ke=void 0,Ue=void 0,Ne=void 0,e((ze=Ce).opacity),t(ze.blending),ze instanceof h.ParticleBasicMaterial?ze.map&&(Ue=(ke=ze.map.image).width>>1,Ne=ke.height>>1,Ve=(ze=Fe.scale.x*o)*Ue,Be=(Pe=Fe.scale.y*s)*Ne,he.set(Ee.x-Ve,Ee.y-Be,Ee.x+Ve,Ee.y+Be),se.instersects(he)&&(j.save(),j.translate(Ee.x,Ee.y),j.rotate(-Fe.rotation),j.scale(ze,-Pe),j.translate(-Ue,-Ne),j.drawImage(ke,0,0),j.restore())):ze instanceof h.ParticleCanvasMaterial&&(Ve=Fe.scale.x*o,Be=Fe.scale.y*s,he.set(Ee.x-Ve,Ee.y-Be,Ee.x+Ve,Ee.y+Be),se.instersects(he)&&(i(ze.color.__styleStr
1ing),Pe=ze.color.__styleString,K!=Pe&&(j.fillStyle=K=Pe),j.save(),j.translate(Ee.x,Ee.y),j.rotate(-Fe.rotation),j.scale(Ve,Be),ze.program(j),j.restore())));else if(Me instanceof h.RenderableLine){if(a=Me.v1,l=Me.v2,a.positionScreen.x*=o,a.positionScreen.y*=s,l.positionScreen.x*=o,l.positionScreen.y*=s,he.addPoint(a.positionScreen.x,a.positionScreen.y),he.addPoint(l.positionScreen.x,l.positionScreen.y),se.instersects(he))for(Ae=0,Te=Me.materials.length;Ae<Te;)0!=(Ce=Me.materials[Ae++]).opacity&&G(a,l,0,Ce)}else if(Me instanceof h.RenderableFace3){if(a=Me.v1,l=Me.v2,c=Me.v3,a.positionScreen.x*=o,a.positionScreen.y*=s,l.positionScreen.x*=o,l.positionScreen.y*=s,c.positionScreen.x*=o,c.positionScreen.y*=s,Me.overdraw&&(be(a.positionScreen,l.positionScreen),be(l.positionScreen,c.positionScreen),be(c.positionScreen,a.positionScreen)),he.add3Points(a.positionScreen.x,a.positionScreen.y,l.positionScreen.x,l.positionScreen.y,c.positionScreen.x,c.positionScreen.y),se.instersects(he))for(Ae=0,Te=Me.meshMaterials.length;Ae<Te;)if((Ce=Me.meshMaterials[Ae++])instanceof h.MeshFaceMaterial)for(Re=0,Le=Me.faceMaterials.length;Re<Le;)(Ce=Me.faceMaterials[Re++])&&0!=Ce.opacity&&H(a,l,c,0,1,2,Me,Ce,n);else 0!=Ce.opacity&&H(a,l,c,0,1,2,Me,Ce,n)}else if(Me instanceof h.RenderableFace4&&(a=Me.v1,l=Me.v2,c=Me.v3,d=Me.v4,a.positionScreen.x*=o,a.positionScreen.y*=s,l.positionScreen.x*=o,l.positionScreen.y*=s,c.positionScreen.x*=o,c.positionScreen.y*=s,d.positionScreen.x*=o,d.positionScreen.y*=s,$.positionScreen.copy(l.positionScreen),ee.positionScreen.copy(d.positionScreen),Me.overdraw&&(be(a.positionScreen,l.positionScreen),be(l.positionScreen,d.positionScreen),be(d.positionScreen,a.positionScreen),be(c.positionScreen,$.positionScreen),be(c.positionScreen,ee.positionScreen)),he.addPoint(a.positionScreen.x,a.positionScreen.y),he.addPoint(l.positionScreen.x,l.positionScreen.y),he.addPoint(c.positionScreen.x,c.positionScreen.y),he.addPoint(d.positionScreen.x,d.positionScreen.y),se.instersects(he)))for(Ae=0,Te=Me.meshMaterials.length;Ae<Te;)if((Ce=Me.meshMaterials[Ae++])instanceof h.MeshFaceMaterial)for(Re=0,Le=Me.faceMaterials.length;Re<Le;)(Ce=Me.faceMaterials[Re++])&&0!=Ce.opacity&&X(a,l,c,d,$,ee,Me,Ce,n);else 0!=Ce.opacity&&X(a,l,c,d,$,ee,Me,Ce,n);ae.addRectangle(he)}j.setTransform(1,0,0,1,0,0)}},h.SVGRenderer=function(){function e(e,t,i){var n,r,o,s;for(n=0,r=e.lights.length;n<r;n++)(o=e.lights[n])instanceof h.DirectionalLight?(s=t.normalWorld.dot(o.position)*o.intensity)>0&&(i.r+=o.color.r*s,i.g+=o.color.g*s,i.b+=o.color.b*s):o instanceof h.PointLight&&(C.sub(o.position,t.centroidWorld),C.normalize(),(s=t.normalWorld.dot(C)*o.intensity)>0&&(i.r+=o.color.r*s,i.g+=o.color.g*s,i.b+=o.color.b*s))}function t(t,i,o,s,a,l){(m=n(g++)).setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z"),a instanceof h.MeshBasicMaterial?M.__styleString=a.color.__styleStr
1ing:a instanceof h.MeshLambertMaterial?S?(A.r=T.r,A.g=T.g,A.b=T.b,e(l,s,A),M.r=a.color.r*A.r,M.g=a.color.g*A.g,M.b=a.color.b*A.b,M.updateStyleString()):M.__styleString=a.color.__styleString:a instanceof h.MeshDepthMaterial?(u=1-a.__2near/(a.__farPlusNear-s.z*a.__farMinusNear),M.setRGB(u,u,u)):a instanceof h.MeshNormalMaterial&&M.setRGB(r(s.normalWorld.x),r(s.normalWorld.y),r(s.normalWorld.z)),a.wireframe?m.setAttribute("style","fill: none; stroke: "+M.__styleString+"; stroke-width: "+a.wireframeLinewidth+"; stroke-opacity: "+a.opacity+"; stroke-linecap: "+a.wireframeLinecap+"; stroke-linejoin: "+a.wireframeLinejoin):m.setAttribute("style","fill: "+M.__styleString+"; fill-opacity: "+a.opacity),x.appendChild(m)}function i(t,i,o,s,a,l,c){(m=n(g++)).setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+" L "+s.positionScreen.x+","+s.positionScreen.y+"z"),l instanceof h.MeshBasicMaterial?M.__styleString=l.color.__styleStr
1ing:l instanceof h.MeshLambertMaterial?S?(A.r=T.r,A.g=T.g,A.b=T.b,e(c,a,A),M.r=l.color.r*A.r,M.g=l.color.g*A.g,M.b=l.color.b*A.b,M.updateStyleString()):M.__styleString=l.color.__styleString:l instanceof h.MeshDepthMaterial?(u=1-l.__2near/(l.__farPlusNear-a.z*l.__farMinusNear),M.setRGB(u,u,u)):l instanceof h.MeshNormalMaterial&&M.setRGB(r(a.normalWorld.x),r(a.normalWorld.y),r(a.normalWorld.z)),l.wireframe?m.setAttribute("style","fill: none; stroke: "+M.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):m.setAttribute("style","fill: "+M.__styleString+"; fill-opacity: "+l.opacity),x.appendChild(m)}function n(e){return null==E[e]&&(E[e]=document.createElementNS("http://www.w3.org/2000/svg","path"),0==z&&E[e].setAttribute("shape-rendering","crispEdges")),E[e]}function r(e){return e<0?Math.min(.5*(1+e),.5):.5+Math.min(.5*e,.5)}var o,s,a,l,c,d,f,p,u,m,g,v,y=null,_=new h.Projector,x=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=new h.Rectangle,w=new h.Rectangle,S=!1,M=new h.Color(16777215),A=new h.Color(16777215),T=new h.Color(0),R=new h.Color(0),L=new h.Color(0),C=new h.Vector3,E=[],F=[],z=1;this.domElement=x,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.setQuality=function(e){switch(e){case"high":z=1;break;case"low":z=0}},this.setSize=function(e,t){a=(o=e)/2,l=(s=t)/2,x.setAttribute("viewBox",-a+" "+-l+" "+o+" "+s),x.setAttribute("width",o),x.setAttribute("height",s),b.set(-a,-l,a,l)},this.clear=function(){for(;x.childNodes.length>0;)x.removeChild(x.childNodes[0])},this.render=function(e,n){var r,o,s,u,A,C,E,V;if(this.autoClear&&this.clear(),y=_.projectScene(e,n,this.sortElements),v=g=0,S=e.lights.length>0)for(E=e.lights,T.setRGB(0,0,0),R.setRGB(0,0,0),L.setRGB(0,0,0),r=0,o=E.length;r<o;r++)u=(s=E[r]).color,s instanceof h.AmbientLight?(T.r+=u.r,T.g+=u.g,T.b+=u.b):s instanceof h.DirectionalLight?(R.r+=u.r,R.g+=u.g,R.b+=u.b):s instanceof h.PointLight&&(L.r+=u.r,L.g+=u.g,L.b+=u.b);for(r=0,o=y.length;r<o;r++)if(E=y[r],w.empty(),E instanceof h.RenderableParticle)for((c=E).x*=a,c.y*=-l,s=0,u=E.materials.length;s<u;)s++;else if(E instanceof h.RenderableLine){if(c=E.v1,d=E.v2,c.positionScreen.x*=a,c.positionScreen.y*=-l,d.positionScreen.x*=a,d.positionScreen.y*=-l,w.addPoint(c.positionScreen.x,c.positionScreen.y),w.addPoint(d.positionScreen.x,d.positionScreen.y),b.instersects(w))for(s=0,u=E.materials.length;s<u;)if((V=E.materials[s++])&&0!=V.opacity){A=c,C=d;var B=v++;null==F[B]&&(F[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==z&&F[B].setAttribute("shape-rendering","crispEdges")),(m=F[B]).setAttribute("x1",A.positionScreen.x),m.setAttribute("y1",A.positionScreen.y),m.setAttribute("x2",C.positionScreen.x),m.setAttribute("y2",C.positionScreen.y),V instanceof h.LineBasicMaterial&&(M.__styleString=V.color.__styleStr
1ing,m.setAttribute("style","fill: none; stroke: "+M.__styleString+"; stroke-width: "+V.linewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.linecap+"; stroke-linejoin: "+V.linejoin),x.appendChild(m))}}else if(E instanceof h.RenderableFace3){if(c=E.v1,d=E.v2,f=E.v3,c.positionScreen.x*=a,c.positionScreen.y*=-l,d.positionScreen.x*=a,d.positionScreen.y*=-l,f.positionScreen.x*=a,f.positionScreen.y*=-l,w.addPoint(c.positionScreen.x,c.positionScreen.y),w.addPoint(d.positionScreen.x,d.positionScreen.y),w.addPoint(f.positionScreen.x,f.positionScreen.y),b.instersects(w))for(s=0,u=E.meshMaterials.length;s<u;)if((V=E.meshMaterials[s++])instanceof h.MeshFaceMaterial)for(A=0,C=E.faceMaterials.length;A<C;)(V=E.faceMaterials[A++])&&0!=V.opacity&&t(c,d,f,E,V,e);else V&&0!=V.opacity&&t(c,d,f,E,V,e)}else if(E instanceof h.RenderableFace4&&(c=E.v1,d=E.v2,f=E.v3,p=E.v4,c.positionScreen.x*=a,c.positionScreen.y*=-l,d.positionScreen.x*=a,d.positionScreen.y*=-l,f.positionScreen.x*=a,f.positionScreen.y*=-l,p.positionScreen.x*=a,p.positionScreen.y*=-l,w.addPoint(c.positionScreen.x,c.positionScreen.y),w.addPoint(d.positionScreen.x,d.positionScreen.y),w.addPoint(f.positionScreen.x,f.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),b.instersects(w)))for(s=0,u=E.meshMaterials.length;s<u;)if((V=E.meshMaterials[s++])instanceof h.MeshFaceMaterial)for(A=0,C=E.faceMaterials.length;A<C;)(V=E.faceMaterials[A++])&&0!=V.opacity&&i(c,d,f,p,E,V,e);else V&&0!=V.opacity&&i(c,d,f,p,E,V,e)}},h.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 int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\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_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\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_pars_vertex:"uniform bool enableLighting;\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#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 );
1\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"},h.UniformsLib={common:{diffuse:{type:"c",value:new h.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new h.Color(16777215)},morphTargetInfluences:{type:"f",value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new h.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:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new h.Color(16777215)}}},h.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;
1\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},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}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:h.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",h.ShaderChunk.color_pars_fragment,h.ShaderChunk.map_pars_fragment,h.ShaderChunk.lightmap_pars_fragment,h.ShaderChunk.envmap_pars_fragment,h.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",h.ShaderChunk.map_fragment,h.ShaderChunk.lightmap_fragment,h.ShaderChunk.color_fragment,h.ShaderChunk.envmap_fragment,h.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[h.ShaderChunk.map_pars_vertex,h.ShaderChunk.lightmap_pars_vertex,h.ShaderChunk.envmap_pars_vertex,h.ShaderChunk.color_pars_vertex,h.ShaderChunk.skinning_pars_vertex,h.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",h.ShaderChunk.map_vertex,h.ShaderChunk.lightmap_vertex,h.ShaderChunk.envmap_vertex,h.ShaderChunk.color_vertex,h.ShaderChunk.skinning_vertex,h.ShaderChunk.morphtarget_vertex,h.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:c.merge([h.UniformsLib.common,h.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",h.ShaderChunk.color_pars_fragment,h.ShaderChunk.map_pars_fragment,h.ShaderChunk.lightmap_pars_fragment,h.ShaderChunk.envmap_pars_fragment,h.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",h.ShaderChunk.map_fragment,h.ShaderChunk.lightmap_fragment,h.ShaderChunk.color_fragment,h.ShaderChunk.envmap_fragment,h.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",h.ShaderChunk.map_pars_vertex,h.ShaderChunk.lightmap_pars_vertex,h.ShaderChunk.envmap_pars_vertex,h.ShaderChunk.lights_pars_vertex,h.ShaderChunk.color_pars_vertex,h.ShaderChunk.skinning_pars_vertex,h.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",h.ShaderChunk.map_vertex,h.ShaderChunk.lightmap_vertex,h.ShaderChunk.envmap_vertex,h.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",h.ShaderChunk.lights_vertex,h.ShaderChunk.skinning_vertex,h.ShaderChunk.morphtarget_vertex,h.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:c.merge([h.UniformsLib.common,h.UniformsLib.lights,{ambient:{type:"c",value:new h.Color(328965)},specular:{type:"c",value:new h.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",h.ShaderChunk.color_pars_fragment,h.ShaderChunk.map_pars_fragment,h.ShaderChunk.lightmap_pars_fragment,h.ShaderChunk.envmap_pars_fragment,h.ShaderChunk.fog_pars_fragment,h.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",h.ShaderChunk.lights_fragment,h.ShaderChunk.map_fragment,h.ShaderChunk.lightmap_fragment,h.ShaderChunk.color_fragment,h.ShaderChunk.envmap_fragment,h.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",h.ShaderChunk.map_pars_vertex,h.ShaderChunk.lightmap_pars_vertex,h.ShaderChunk.envmap_pars_vertex,h.ShaderChunk.lights_pars_vertex,h.ShaderChunk.color_pars_vertex,h.ShaderChunk.skinning_pars_vertex,h.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",h.ShaderChunk.map_vertex,h.ShaderChunk.lightmap_vertex,h.ShaderChunk.envmap_vertex,h.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",h.ShaderChunk.lights_vertex,h.ShaderChunk.skinning_vertex,h.ShaderChunk.morphtarget_vertex,h.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:h.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",h.ShaderChunk.color_pars_fragment,h.ShaderChunk.map_particle_pars_fragment,h.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",h.ShaderChunk.map_particle_fragment,h.ShaderChunk.color_fragment,h.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",h.ShaderChunk.color_pars_vertex,"void main() {",h.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;\n}"].join("\n")}},h.WebGLRenderer=function(e){function t(e,t){e.uniforms=c.clone(t.uniforms),e.vertexShader=t.vertexShader,e.fragmentShader=t.fragmentShader}function i(e,t,i,n,r){n.__webglProgram||L.initMaterial(n,t,i,r);var o=n.program,s=o.uniforms,a=n.uniforms;
1if(o!=T&&(M.useProgram(o),T=o),M.uniformMatrix4fv(s.projectionMatrix,!1,D),i&&(n instanceof h.MeshBasicMaterial||n instanceof h.MeshLambertMaterial||n instanceof h.MeshPhongMaterial||n instanceof h.LineBasicMaterial||n instanceof h.ParticleBasicMaterial)&&(a.fogColor.value.setHex(i.color.hex),i instanceof h.Fog?(a.fogNear.value=i.near,a.fogFar.value=i.far):i instanceof h.FogExp2&&(a.fogDensity.value=i.density)),n instanceof h.MeshPhongMaterial||n instanceof h.MeshLambertMaterial||n.lights){var l,c,d,f,p,u,m=0,g=0,v=0,y=W,_=y.directional.colors,b=y.directional.positions,w=y.point.colors,S=y.point.positions,R=y.point.distances,C=0,E=0;for(i=c=u=0,l=t.length;i<l;i++)d=(c=t[i]).color,f=c.position,p=c.intensity,u=c.distance,c instanceof h.AmbientLight?(m+=d.r,g+=d.g,v+=d.b):c instanceof h.DirectionalLight?(_[u=3*C]=d.r*p,_[u+1]=d.g*p,_[u+2]=d.b*p,b[u]=f.x,b[u+1]=f.y,b[u+2]=f.z,C+=1):c instanceof h.PointLight&&(w[c=3*E]=d.r*p,w[c+1]=d.g*p,w[c+2]=d.b*p,S[c]=f.x,S[c+1]=f.y,S[c+2]=f.z,R[E]=u,E+=1);for(i=3*C;i<_.length;i++)_[i]=0;for(i=3*E;i<w.length;i++)w[i]=0;y.point.length=E,y.directional.length=C,y.ambient[0]=m,y.ambient[1]=g,y.ambient[2]=v,i=W,a.enableLighting.value=i.directional.length+i.point.length,a.ambientLightColor.value=i.ambient,a.directionalLightColor.value=i.directional.colors,a.directionalLightDirection.value=i.directional.positions,a.pointLightColor.value=i.point.colors,a.pointLightPosition.value=i.point.positions,a.pointLightDistance.value=i.point.distances}for(var F in(n instanceof h.MeshBasicMaterial||n instanceof h.MeshLambertMaterial||n instanceof h.MeshPhongMaterial)&&(a.diffuse.value.setRGB(n.color.r,n.color.g,n.color.b),a.opacity.value=n.opacity,a.map.texture=n.map,a.lightMap.texture=n.lightMap,a.envMap.texture=n.envMap,a.reflectivity.value=n.reflectivity,a.refractionRatio.value=n.refractionRatio,a.combine.value=n.combine,a.useRefract.value=n.envMap&&n.envMap.mapping instanceof h.CubeRefractionMapping),n instanceof h.LineBasicMaterial?(a.diffuse.value.setRGB(n.color.r,n.color.g,n.color.b),a.opacity.value=n.opacity):n instanceof h.ParticleBasicMaterial?(a.psColor.value.setRGB(n.color.r,n.color.g,n.color.b),a.opacity.value=n.opacity,a.size.value=n.size,a.scale.value=A.height/2,a.map.texture=n.map):n instanceof h.MeshPhongMaterial?(a.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b),a.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b),a.shininess.value=n.shininess):n instanceof h.MeshDepthMaterial?(a.mNear.value=e.near,a.mFar.value=e.far,a.opacity.value=n.opacity):n instanceof h.MeshNormalMaterial&&(a.opacity.value=n.opacity),a)if(g=o.uniforms[F])if(m=(l=a[F]).type,i=l.value,"i"==m)M.uniform1i(g,i);else if("f"==m)M.uniform1f(g,i);else if("fv1"==m)M.uniform1fv(g,i);else if("fv"==m)M.uniform3fv(g,i);else if("v2"==m)M.uniform2f(g,i.x,i.y);else if("v3"==m)M.uniform3f(g,i.x,i.y,i.z);else if("c"==m)M.uniform3f(g,i.r,i.g,i.b);else if("t"==m&&(M.uniform1i(g,i),l=l.texture))if(l.image instanceof Array&&6==l.image.length){if(6==l.image.length){if(l.needsUpdate){if(l.__webglInit)for(M.bindTexture(M.TEXTURE_CUBE_MAP,l.image.__webglTextureCube),m=0;m<6;++m)M.texSubImage2D(M.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,M.RGBA,M.UNSIGNED_BYTE,l.image[m]);else{for(l.image.__webglTextureCube=M.createTexture(),M.bindTexture(M.TEXTURE_CUBE_MAP,l.image.__webglTextureCube),m=0;m<6;++m)M.texImage2D(M.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,M.RGBA,M.RGBA,M.UNSIGNED_BYTE,l.image[m]);l.__webglInit=!0}x(M.TEXTURE_CUBE_MAP,l,l.image[0]),M.bindTexture(M.TEXTURE_CUBE_MAP,null),l.needsUpdate=!1}M.activeTexture(M.TEXTURE0+i),M.bindTexture(M.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}}else l.needsUpdate&&(l.__webglInit?(M.bindTexture(M.TEXTURE_2D,l.__webglTexture),M.texSubImage2D(M.TEXTURE_2D,0,0,0,M.RGBA,M.UNSIGNED_BYTE,l.image)):(l.__webglTexture=M.createTexture(),M.bindTexture(M.TEXTURE_2D,l.__webglTexture),M.texImage2D(M.TEXTURE_2D,0,M.RGBA,M.RGBA,M.UNSIGNED_BYTE,l.image),l.__webglInit=!0),x(M.TEXTURE_2D,l,l.image),M.bindTexture(M.TEXTURE_2D,null),l.needsUpdate=!1),M.activeTexture(M.TEXTURE0+i),M.bindTexture(M.TEXTURE_2D,l.__webglTexture);return M.uniformMatrix4fv(s.modelViewMatrix,!1,r._modelViewMatrixArray),M.uniformMatrix3fv(s.normalMatrix,!1,r._normalMatrixArray),(n instanceof h.MeshShaderMaterial||n instanceof h.MeshPhongMaterial||n.envMap)&&M.uniform3f(s.cameraPosition,e.position.x,e.position.y,e.position.z),(n instanceof h.MeshShaderMaterial||n.envMap||n.skinning)&&M.uniformMatrix4fv(s.objectMatrix,!1,r._objectMatrixArray),(n instanceof h.MeshPhongMaterial||n instanceof h.MeshLambertMaterial||n instanceof h.MeshShaderMaterial||n.skinning)&&M.uniformMatrix4fv(s.viewMatrix,!1,I),n instanceof h.ShadowVolumeDynamicMaterial&&((e=a.directionalLightDirection.value)[0]=-t.position.x,e[1]=-t.position.y,e[2]=-t.position.z,M.uniform3fv(s.directionalLightDirection,e),M.uniformMatrix4fv(s.objectMatrix,!1,r._objectMatrixArray),M.uniformMatrix4fv(s.viewMatrix,!1,I)),n.skinning&&(M.uniformMatrix4fv(s.cameraInverseMatrix,!1,I),M.uniformMatrix4fv(s.boneGlobalMatrices,!1,r.boneMatrices)),o}
1function n(e,t,n,r,o,s){if(0!=r.opacity){if(e=i(e,t,n,r,s).attributes,r.morphTargets){if(t=r.program.attributes,-1!==s.morphTargetBase?M.bindBuffer(M.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[s.morphTargetBase]):M.bindBuffer(M.ARRAY_BUFFER,o.__webglVertexBuffer),M.vertexAttribPointer(t.position,3,M.FLOAT,!1,0,0),s.morphTargetForcedOrder.length){n=0;for(var a=s.morphTargetForcedOrder,l=s.morphTargetInfluences;n<r.numSupportedMorphTargets&&n<a.length;)M.bindBuffer(M.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[a[n]]),M.vertexAttribPointer(t["morphTarget"+n],3,M.FLOAT,!1,0,0),s.__webglMorphTargetInfluences[n]=l[a[n]],n++}else{a=[];var c,d=-1,f=0,p=(l=s.morphTargetInfluences).length;for(n=0,-1!==s.morphTargetBase&&(a[s.morphTargetBase]=!0);n<r.numSupportedMorphTargets;){for(c=0;c<p;c++)!a[c]&&l[c]>d&&(d=l[f=c]);M.bindBuffer(M.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[f]),M.vertexAttribPointer(t["morphTarget"+n],3,M.FLOAT,!1,0,0),s.__webglMorphTargetInfluences[n]=d,a[f]=1,d=-1,n++}}M.uniform1fv(r.program.uniforms.morphTargetInfluences,s.__webglMorphTargetInfluences)}else M.bindBuffer(M.ARRAY_BUFFER,o.__webglVertexBuffer),M.vertexAttribPointer(e.position,3,M.FLOAT,!1,0,0);e.color>=0&&(M.bindBuffer(M.ARRAY_BUFFER,o.__webglColorBuffer),M.vertexAttribPointer(e.color,3,M.FLOAT,!1,0,0)),e.normal>=0&&(M.bindBuffer(M.ARRAY_BUFFER,o.__webglNormalBuffer),M.vertexAttribPointer(e.normal,3,M.FLOAT,!1,0,0)),e.tangent>=0&&(M.bindBuffer(M.ARRAY_BUFFER,o.__webglTangentBuffer),M.vertexAttribPointer(e.tangent,4,M.FLOAT,!1,0,0)),e.uv>=0&&(o.__webglUVBuffer?(M.bindBuffer(M.ARRAY_BUFFER,o.__webglUVBuffer),M.vertexAttribPointer(e.uv,2,M.FLOAT,!1,0,0),M.enableVertexAttribArray(e.uv)):M.disableVertexAttribArray(e.uv)),e.uv2>=0&&(o.__webglUV2Buffer?(M.bindBuffer(M.ARRAY_BUFFER,o.__webglUV2Buffer),M.vertexAttribPointer(e.uv2,2,M.FLOAT,!1,0,0),M.enableVertexAttribArray(e.uv2)):M.disableVertexAttribArray(e.uv2)),r.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0&&(M.bindBuffer(M.ARRAY_BUFFER,o.__webglSkinVertexABuffer),M.vertexAttribPointer(e.skinVertexA,4,M.FLOAT,!1,0,0),M.bindBuffer(M.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),M.vertexAttribPointer(e.skinVertexB,4,M.FLOAT,!1,0,0),M.bindBuffer(M.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),M.vertexAttribPointer(e.skinIndex,4,M.FLOAT,!1,0,0),M.bindBuffer(M.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),M.vertexAttribPointer(e.skinWeight,4,M.FLOAT,!1,0,0)),s instanceof h.Mesh?r.wireframe?(M.lineWidth(r.wireframeLinewidth),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),M.drawElements(M.LINES,o.__webglLineCount,M.UNSIGNED_SHORT,0)):(M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),M.drawElements(M.TRIANGLES,o.__webglFaceCount,M.UNSIGNED_SHORT,0)):s instanceof h.Line?(s=s.type==h.LineStrip?M.LINE_STRIP:M.LINES,M.lineWidth(r.linewidth),M.drawArrays(s,0,o.__webglLineCount)):s instanceof h.ParticleSystem?M.drawArrays(M.POINTS,0,o.__webglParticleCount):s instanceof h.Ribbon&&M.drawArrays(M.TRIANGLE_STRIP,0,o.__webglVertexCount)}}function r(e,t){e.__webglVertexBuffer||(e.__webglVertexBuffer=M.createBuffer()),e.__webglNormalBuffer||(e.__webglNormalBuffer=M.createBuffer()),e.hasPos&&(M.bindBuffer(M.ARRAY_BUFFER,e.__webglVertexBuffer),M.bufferData(M.ARRAY_BUFFER,e.positionArray,M.DYNAMIC_DRAW),M.enableVertexAttribArray(t.attributes.position),M.vertexAttribPointer(t.attributes.position,3,M.FLOAT,!1,0,0)),e.hasNormal&&(M.bindBuffer(M.ARRAY_BUFFER,e.__webglNormalBuffer),M.bufferData(M.ARRAY_BUFFER,e.normalArray,M.DYNAMIC_DRAW),M.enableVertexAttribArray(t.attributes.normal),M.vertexAttribPointer(t.attributes.normal,3,M.FLOAT,!1,0,0)),M.drawArrays(M.TRIANGLES,0,e.count),e.count=0}function o(e){C!=e.doubleSided&&(e.doubleSided?M.disable(M.CULL_FACE):M.enable(M.CULL_FACE),C=e.doubleSided),E!=e.flipSided&&(e.flipSided?M.frontFace(M.CW):M.frontFace(M.CCW),E=e.flipSided)}function s(e){z!=e&&(e?M.enable(M.DEPTH_TEST):M.disable(M.DEPTH_TEST),z=e)}function a(e){for(var t=e.matrixWorld,i=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),n=0;n<6;
1n++)if((e=U[n].x*t.n14+U[n].y*t.n24+U[n].z*t.n34+U[n].w)<=i)return!1;return!0}function d(e,t){e.list[e.count]=t,e.count+=1}function f(e){var t,i,n=e.object,r=e.opaque,o=e.transparent;for(o.count=0,e=r.count=0,t=n.materials.length;e<t;e++)(i=n.materials[e]).opacity&&i.opacity<1||i.blending!=h.NormalBlending?d(o,i):d(r,i)}function p(e){var t,i,n,r,o=e.object,s=e.buffer,a=e.opaque,l=e.transparent;for(l.count=0,e=a.count=0,n=o.materials.length;e<n;e++)if((t=o.materials[e])instanceof h.MeshFaceMaterial)for(t=0,i=s.materials.length;t<i;t++)(r=s.materials[t])&&(r.opacity&&r.opacity<1||r.blending!=h.NormalBlending?d(l,r):d(a,r));else(r=t).opacity&&r.opacity<1||r.blending!=h.NormalBlending?d(l,r):d(a,r)}function u(e,t){return t.z-e.z}function m(e,t){e._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray),h.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function g(e){var t,i,n;if(e instanceof h.Mesh){for(t in(i=e.geometry).geometryGroups)if(n=i.geometryGroups[t],i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){var r=M.DYNAMIC_DRAW,o=void 0,s=void 0,a=void 0,l=void 0;a=void 0;var c=void 0,d=void 0,f=void 0,p=void 0,u=void 0,m=void 0,g=void 0,v=void 0,y=void 0,_=void 0,x=void 0,b=void 0,w=void 0;d=void 0,f=void 0,l=void 0,p=void 0,l=void 0,_=void 0,x=void 0,d=void 0,_=void 0,x=void 0,b=void 0,w=void 0,_=void 0,x=void 0,b=void 0,w=void 0,_=void 0,x=void 0,b=void 0,w=void 0,_=void 0,x=void 0,b=void 0,l=void 0,p=void 0,c=void 0,a=void 0,a=void 0;var S=void 0,A=void 0,T=void 0,R=0,L=0,C=0,E=0,F=0,z=0,V=0,B=0,P=0,k=0,U=0,D=n.__vertexArray,I=n.__uvArray,W=n.__uv2Array,j=n.__normalArray,G=n.__tangentArray,H=n.__colorArray,X=n.__skinVertexAArray,Y=n.__skinVertexBArray,q=n.__skinIndexArray,K=n.__skinWeightArray,Q=n.__morphTargetsArrays,J=n.__faceArray,Z=n.__lineArray,$=n.__needsSmoothNormals;m=n.__vertexColorType,u=n.__uvType,g=n.__normalType;var ee=e.geometry,te=ee.__dirtyVertices,ie=ee.__dirtyElements,ne=ee.__dirtyUvs,re=ee.__dirtyNormals,oe=ee.__dirtyTangents,se=ee.__dirtyColors,ae=ee.__dirtyMorphTargets,he=ee.vertices,le=n.faces,ce=ee.faces,de=ee.faceVertexUvs[0],fe=ee.faceVertexUvs[1],pe=ee.skinVerticesA,ue=ee.skinVerticesB,me=ee.skinIndices,ge=ee.skinWeights,ve=ee.edgeFaces,ye=ee.morphTargets;for(o=0,s=le.length;o<s;o++)if(l=ce[a=le[o]],de&&(v=de[a]),fe&&(y=fe[a]),a=l.vertexNormals,c=l.normal,d=l.vertexColors,f=l.color,p=l.vertexTangents,l instanceof h.Face3){if(te&&(_=he[l.a].position,x=he[l.b].position,b=he[l.c].position,D[L]=_.x,D[L+1]=_.y,D[L+2]=_.z,D[L+3]=x.x,D[L+4]=x.y,D[L+5]=x.z,D[L+6]=b.x,D[L+7]=b.y,D[L+8]=b.z,L+=9),ae){for(S=0,A=ye.length;S<A;S++)_=ye[S].vertices[l.a].position,x=ye[S].vertices[l.b].position,b=ye[S].vertices[l.c].position,(T=Q[S])[U+0]=_.x,T[U+1]=_.y,T[U+2]=_.z,T[U+3]=x.x,T[U+4]=x.y,T[U+5]=x.z,T[U+6]=b.x,T[U+7]=b.y,T[U+8]=b.z;U+=9}if(ge.length&&(_=ge[l.a],x=ge[l.b],b=ge[l.c],K[k]=_.x,K[k+1]=_.y,K[k+2]=_.z,K[k+3]=_.w,K[k+4]=x.x,K[k+5]=x.y,K[k+6]=x.z,K[k+7]=x.w,K[k+8]=b.x,K[k+9]=b.y,K[k+10]=b.z,K[k+11]=b.w,_=me[l.a],x=me[l.b],b=me[l.c],q[k]=_.x,q[k+1]=_.y,q[k+2]=_.z,q[k+3]=_.w,q[k+4]=x.x,q[k+5]=x.y,q[k+6]=x.z,q[k+7]=x.w,q[k+8]=b.x,q[k+9]=b.y,q[k+10]=b.z,q[k+11]=b.w,_=pe[l.a],x=pe[l.b],b=pe[l.c],X[k]=_.x,X[k+1]=_.y,X[k+2]=_.z,X[k+3]=1,X[k+4]=x.x,X[k+5]=x.y,X[k+6]=x.z,X[k+7]=1,X[k+8]=b.x,X[k+9]=b.y,X[k+10]=b.z,X[k+11]=1,_=ue[l.a],x=ue[l.b],b=ue[l.c],Y[k]=_.x,Y[k+1]=_.y,Y[k+2]=_.z,Y[k+3]=1,Y[k+4]=x.x,Y[k+5]=x.y,Y[k+6]=x.z,Y[k+7]=1,Y[k+8]=b.x,Y[k+9]=b.y,Y[k+10]=b.z,Y[k+11]=1,k+=12),se&&m&&(3==d.length&&m==h.VertexColors?(l=d[0],_=d[1],x=d[2]):x=_=l=f,H[P]=l.r,H[P+1]=l.g,H[P+2]=l.b,H[P+3]=_.r,H[P+4]=_.g,H[P+5]=_.b,H[P+6]=x.r,H[P+7]=x.g,H[P+8]=x.b,P+=9),oe&&ee.hasTangents&&(d=p[0],f=p[1],l=p[2],G[V]=d.x,G[V+1]=d.y,G[V+2]=d.z,G[V+3]=d.w,G[V+4]=f.x,G[V+5]=f.y,G[V+6]=f.z,G[V+7]=f.w,G[V+8]=l.x,G[V+9]=l.y,G[V+10]=l.z,G[V+11]=l.w,V+=12),re&&g)if(3==a.length&&$)for(p=0;p<3;p++)c=a[p],j[z]=c.x,j[z+1]=c.y,j[z+2]=c.z,z+=3;else for(p=0;p<3;p++)j[z]=c.x,j[z+1]=c.y,j[z+2]=c.z,z+=3;if(ne&&void 0!==v&&u)for(p=0;p<3;p++)a=v[p],I[C]=a.u,I[C+1]=a.v,C+=2;if(ne&&void 0!==y&&u)for(p=0;p<3;p++)a=y[p],W[E]=a.u,W[E+1]=a.v,E+=2;ie&&(J[F]=R,J[F+1]=R+1,J[F+2]=R+2,F+=3,Z[B]=R,Z[B+1]=R+1,Z[B+2]=R,Z[B+3]=R+2,Z[B+4]=R+1,Z[B+5]=R+2,B+=6,R+=3)}else if(l instanceof h.Face4){if(te&&(_=he[l.a].position,x=he[l.b].position,b=he[l.c].position,w=he[l.d].position,D[L]=_.x,D[L+1]=_.y,D[L+2]=_.z,D[L+3]=x.x,D[L+4]=x.y,D[L+5]=x.z,D[L+6]=b.x,D[L+7]=b.y,D[L+8]=b.z,D[L+9]=w.x,D[L+10]=w.y,D[L+11]=w.z,L+=12),ae){for(S=0,A=ye.length;S<A;S++)_=ye[S].vertices[l.a].position,x=ye[S].vertices[l.b].position,b=ye[S].vertices[l.c].position,w=ye[S].vertices[l.d].position,(T=Q[S])[U+0]=_.x,T[U+1]=_.y,T[U+2]=_.z,T[U+3]=x.x,T[U+4]=x.y,T[U+5]=x.z,T[U+6]=b.x,T[U+7]=b.y,T[U+8]=b.z,T[U+9]=w.x,T[U+10]=w.y,T[U+11]=w.z;U+=12}if(ge.length&&(_=ge[l.a],x=ge[l.b],b=ge[l.c],w=ge[l.d],K[k]=_.x,K[k+1]=_.y,K[k+2]=_.z,K[k+3]=_.w,K[k+4]=x.x,K[k+5]=x.y,K[k+6]=x.z,K[k+7]=x.w,K[k+8]=b.x,K[k+9]=b.y,K[k+10]=b.z,K[k+11]=b.w,K[k+12]=w.x,K[k+13]=w.y,K[k+14]=w.z,K[k+15]=w.w,_=me[l.a],x=me[l.b],b=me[l.c],w=me[l.d],q[k]=_.x,q[k+1]=_.y,q[k+2]=_.z,q[k+3]=_.w,q[k+4]=x.x,q[k+5]=x.y,q[k+6]=x.z,q[k+7]=x.w,q[k+8]=b.x,q[k+9]=b.y,q[k+10]=b.z,q[k+11]=b.w,q[k+12]=w.x,q[k+13]=w.y,q[k+14]=w.z,q[k+15]=w.w,_=pe[l.a],x=pe[l.b],b=pe[l.c],w=pe[l.d],X[k]=_.x,X[k+1]=_.y,X[k+2]=_.z,X[k+3]=1,X[k+4]=x.x,X[k+5]=x.y,X[k+6]=x.z,X[k+7]=1,X[k+8]=b.x,X[k+9]=b.y,X[k+10]=b.z,X[k+11]=1,
1X[k+12]=w.x,X[k+13]=w.y,X[k+14]=w.z,X[k+15]=1,_=ue[l.a],x=ue[l.b],b=ue[l.c],l=ue[l.d],Y[k]=_.x,Y[k+1]=_.y,Y[k+2]=_.z,Y[k+3]=1,Y[k+4]=x.x,Y[k+5]=x.y,Y[k+6]=x.z,Y[k+7]=1,Y[k+8]=b.x,Y[k+9]=b.y,Y[k+10]=b.z,Y[k+11]=1,Y[k+12]=l.x,Y[k+13]=l.y,Y[k+14]=l.z,Y[k+15]=1,k+=16),se&&m&&(4==d.length&&m==h.VertexColors?(l=d[0],_=d[1],x=d[2],d=d[3]):d=x=_=l=f,H[P]=l.r,H[P+1]=l.g,H[P+2]=l.b,H[P+3]=_.r,H[P+4]=_.g,H[P+5]=_.b,H[P+6]=x.r,H[P+7]=x.g,H[P+8]=x.b,H[P+9]=d.r,H[P+10]=d.g,H[P+11]=d.b,P+=12),oe&&ee.hasTangents&&(d=p[0],f=p[1],l=p[2],p=p[3],G[V]=d.x,G[V+1]=d.y,G[V+2]=d.z,G[V+3]=d.w,G[V+4]=f.x,G[V+5]=f.y,G[V+6]=f.z,G[V+7]=f.w,G[V+8]=l.x,G[V+9]=l.y,G[V+10]=l.z,G[V+11]=l.w,G[V+12]=p.x,G[V+13]=p.y,G[V+14]=p.z,G[V+15]=p.w,V+=16),re&&g)if(4==a.length&&$)for(p=0;p<4;p++)c=a[p],j[z]=c.x,j[z+1]=c.y,j[z+2]=c.z,z+=3;else for(p=0;p<4;p++)j[z]=c.x,j[z+1]=c.y,j[z+2]=c.z,z+=3;if(ne&&void 0!==v&&u)for(p=0;p<4;p++)a=v[p],I[C]=a.u,I[C+1]=a.v,C+=2;if(ne&&void 0!==y&&u)for(p=0;p<4;p++)a=y[p],W[E]=a.u,W[E+1]=a.v,E+=2;ie&&(J[F]=R,J[F+1]=R+1,J[F+2]=R+3,J[F+3]=R+1,J[F+4]=R+2,J[F+5]=R+3,F+=6,Z[B]=R,Z[B+1]=R+1,Z[B+2]=R,Z[B+3]=R+3,Z[B+4]=R+1,Z[B+5]=R+2,Z[B+6]=R+2,Z[B+7]=R+3,B+=8,R+=4)}if(ve)for(o=0,s=ve.length;o<s;o++)J[F]=ve[o].a,J[F+1]=ve[o].b,J[F+2]=ve[o].c,J[F+3]=ve[o].a,J[F+4]=ve[o].c,J[F+5]=ve[o].d,F+=6;if(te&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglVertexBuffer),M.bufferData(M.ARRAY_BUFFER,D,r)),ae)for(S=0,A=ye.length;S<A;S++)M.bindBuffer(M.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[S]),M.bufferData(M.ARRAY_BUFFER,Q[S],r);se&&P>0&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglColorBuffer),M.bufferData(M.ARRAY_BUFFER,H,r)),re&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglNormalBuffer),M.bufferData(M.ARRAY_BUFFER,j,r)),oe&&ee.hasTangents&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglTangentBuffer),M.bufferData(M.ARRAY_BUFFER,G,r)),ne&&C>0&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglUVBuffer),M.bufferData(M.ARRAY_BUFFER,I,r)),ne&&E>0&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglUV2Buffer),M.bufferData(M.ARRAY_BUFFER,W,r)),ie&&(M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),M.bufferData(M.ELEMENT_ARRAY_BUFFER,J,r),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),M.bufferData(M.ELEMENT_ARRAY_BUFFER,Z,r)),k>0&&(M.bindBuffer(M.ARRAY_BUFFER,n.__webglSkinVertexABuffer),M.bufferData(M.ARRAY_BUFFER,X,r),M.bindBuffer(M.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),M.bufferData(M.ARRAY_BUFFER,Y,r),M.bindBuffer(M.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),M.bufferData(M.ARRAY_BUFFER,q,r),M.bindBuffer(M.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),M.bufferData(M.ARRAY_BUFFER,K,r))}i.__dirtyVertices=!1,i.__dirtyMorphTargets=!1,i.__dirtyElements=!1,i.__dirtyUvs=!1,i.__dirtyNormals=!1,i.__dirtyTangents=!1,i.__dirtyColors=!1}else if(e instanceof h.Ribbon){if((i=e.geometry).__dirtyVertices||i.__dirtyColors){if(e=i,t=M.DYNAMIC_DRAW,g=e.vertices,r=e.colors,v=g.length,o=r.length,y=e.__vertexArray,s=e.__colorArray,R=e.__dirtyColors,e.__dirtyVertices){for(u=0;u<v;u++)m=g[u].position,y[n=3*u]=m.x,y[n+1]=m.y,y[n+2]=m.z;M.bindBuffer(M.ARRAY_BUFFER,e.__webglVertexBuffer),M.bufferData(M.ARRAY_BUFFER,y,t)}if(R){for(u=0;u<o;u++)color=r[u],s[n=3*u]=color.r,s[n+1]=color.g,s[n+2]=color.b;M.bindBuffer(M.ARRAY_BUFFER,e.__webglColorBuffer),M.bufferData(M.ARRAY_BUFFER,s,t)}}i.__dirtyVertices=!1,i.__dirtyColors=!1}else if(e instanceof h.Line){if((i=e.geometry).__dirtyVertices||i.__dirtyColors){if(e=i,t=M.DYNAMIC_DRAW,g=e.vertices,r=e.colors,v=g.length,o=r.length,y=e.__vertexArray,s=e.__colorArray,R=e.__dirtyColors,e.__dirtyVertices){for(u=0;u<v;u++)m=g[u].position,y[n=3*u]=m.x,y[n+1]=m.y,y[n+2]=m.z;M.bindBuffer(M.ARRAY_BUFFER,e.__webglVertexBuffer),M.bufferData(M.ARRAY_BUFFER,y,t)}if(R){for(u=0;u<o;u++)color=r[u],s[n=3*u]=color.r,s[n+1]=color.g,s[n+2]=color.b;M.bindBuffer(M.ARRAY_BUFFER,e.__webglColorBuffer),M.bufferData(M.ARRAY_BUFFER,s,t)}}i.__dirtyVertices=!1,i.__dirtyColors=!1}else e instanceof h.ParticleSystem&&(((i=e.geometry).__dirtyVertices||i.__dirtyColors||e.sortParticles)&&function(e,t,i){var n,r,o,s=e.vertices,a=s.length,h=e.colors,l=h.length,c=e.__vertexArray,d=e.__colorArray,f=e.__sortArray,p=e.__dirtyVertices,u=e.__dirtyColors;if(i.sortParticles){for(N.multiplySelf(i.matrixWorld),n=0;n<a;n++)r=s[n].position,O.copy(r),N.multiplyVector3(O),f[n]=[O.z,n];for(f.sort((function(e,t){return t[0]-e[0]})),n=0;n<a;n++)r=s[f[n][1]].position,c[o=3*n]=r.x,c[o+1]=r.y,c[o+2]=r.z;for(n=0;n<l;n++)o=3*n,color=h[f[n][1]],d[o]=color.r,d[o+1]=color.g,d[o+2]=color.b}else{if(p)for(n=0;n<a;n++)r=s[n].position,c[o=3*n]=r.x,c[o+1]=r.y,c[o+2]=r.z;if(u)for(n=0;n<l;n++)color=h[n],d[o=3*n]=color.r,d[o+1]=color.g,d[o+2]=color.b}(p||i.sortParticles)&&(M.bindBuffer(M.ARRAY_BUFFER,e.__webglVertexBuffer),M.bufferData(M.ARRAY_BUFFER,c,t)),(u||i.sortParticles)&&(M.bindBuffer(M.ARRAY_BUFFER,e.__webglColorBuffer),M.bufferData(M.ARRAY_BUFFER,d,t))}(i,M.DYNAMIC_DRAW,e),i.__dirtyVertices=!1,i.__dirtyColors=!1)}function v(e){function t(e){var t=[];for(i=0,n=e.length;i<n;i++)null==e[i]?t.push("undefined"):t.push(e[i].id);return t.join("_")}var i,n,r,o,s,a,l,c,d={},f=void 0!==e.morphTargets?e.morphTargets.length:0;for(e.geometryGroups={},r=0,o=e.faces.length;r<o;r++)null==d[l=t(a=(s=e.faces[r]).materials)]&&(d[l]={hash:l,counter:0}),c=d[l].hash+"_"+d[l].counter,null==e.geometryGroups[c]&&(e.geometryGroups[c]={faces:[],materials:a,vertices:0,numMorphTargets:f}),s=s instanceof h.Face3?3:4,e.geometryGroups[c].vertices+s>65535&&(d[l].counter+=1,c=d[l].hash+"_"+d[l].counter,null==e.geometryGroups[c]&&(e.geometryGroups[c]={faces:[],materials:a,vertices:0,numMorphTargets:f})),e.geometryGroups[c].faces.push(r),e.geometryGroups[c].vertices+=s}function y(e,t,i){e.push({buffer:t,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function _(e){if(e!=F){switch(e){case h.AdditiveBlending:M.blendEquation(M.FUNC_ADD),M.blendFunc(M.SRC_ALPHA,M.ONE);break;case h.SubtractiveBlending:M.blendEquation(M.FUNC_ADD),M.blendFunc(M.ZERO,M.ONE_MINUS_SRC_COLOR);break;case h.MultiplyBlending:M.blendEquation(M.FUNC_ADD),M.blendFunc(M.ZERO,M.SRC_COLOR);break;default:M.blendEquationSeparate(M.FUNC_ADD,M.FUNC_ADD),M.blendFuncSeparate(M.SRC_ALPHA,M.ONE_MINUS_SRC_ALPHA,M.ONE,M.ONE_MINUS_SRC_ALPHA)}F=e}}function x(e,t,i){i.width&i.width-1||i.height&i.height-1?(M.texParameteri(e,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(e,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(e,M.TEXTURE_MAG_FILTER,w(t.magFilter)),M.texParameteri(e,M.TEXTURE_MIN_FILTER,w(t.minFilter))):(M.texParameteri(e,M.TEXTURE_WRAP_S,S(t.wrapS)),M.texParameteri(e,M.TEXTURE_WRAP_T,S(t.wrapT)),M.texParameteri(e,M.TEXTURE_MAG_FILTER,S(t.magFilter)),M.texParameteri(e,M.TEXTURE_MIN_FILTER,S(t.minFilter)),M.generateMipmap(e))}function b(e,t){var i;return"fragment"==e?i=M.createShader(M.FRAGMENT_SHADER):"vertex"==e&&(i=M.createShader(M.VERTEX_SHADER)),M.shaderSource(i,t),M.compileShader(i),M.getShaderParameter(i,M.COMPILE_STATUS)?i:null}function w(e){switch(e){case h.NearestFilter:case h.NearestMipMapNearestFilter:case h.NearestMipMapLinearFilter:return M.NEAREST;default:return M.LINEAR}}function S(e){switch(e){case h.RepeatWrapping:return M.REPEAT;case h.ClampToEdgeWrapping:return M.CLAMP_TO_EDGE;case h.MirroredRepeatWrapping:return M.MIRRORED_REPEAT;case h.NearestFilter:return M.NEAREST;case h.NearestMipMapNearestFilter:return M.NEAREST_MIPMAP_NEAREST;case h.NearestMipMapLinearFilter:return M.NEAREST_MIPMAP_LINEAR;case h.LinearFilter:return M.LINEAR;case h.LinearMipMapNearestFilter:return M.LINEAR_MIPMAP_NEAREST;case h.LinearMipMapLinearFilter:return M.LINEAR_MIPMAP_LINEAR;case h.ByteType:return M.BYTE;case h.UnsignedByteType:return M.UNSIGNED_BYTE;case h.ShortType:return M.SHORT;case h.UnsignedShortType:return M.UNSIGNED_SHORT;case h.IntType:return M.INT;case h.UnsignedShortType:return M.UNSIGNED_INT;case h.FloatType:return M.FLOAT;case h.AlphaFormat:return M.ALPHA;case h.RGBFormat:return M.RGB;case h.RGBAFormat:return M.RGBA;case h.LuminanceFormat:return M.LUMINANCE;case h.LuminanceAlphaFormat:return M.LUMINANCE_ALPHA}return 0}var M,A=document.createElement("canvas"),T=null,R=null,L=this,C=null,E=null,F=null,z=null,V=0,B=0,P=0,k=0,U=[new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4,new h.Vector4],N=new h.Matrix4,D=new Float32Array(16),I=new Float32Array(16),O=new h.Vector4,W={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},j=!0,G=new h.Color(0),H=0;e&&(void 0!==e.antialias&&(j=e.antialias),void 0!==e.clearColor&&G.setHex(e.clearColor),void 0!==e.clearAlpha&&
1(H=e.clearAlpha)),this.maxMorphTargets=8,this.domElement=A,this.autoClear=!0,this.sortObjects=!0,function(e,t,i){try{if(!(M=A.getContext("experimental-webgl",{antialias:e,stencil:!0})))throw"Error creating WebGL context."}catch(n){}M.clearColor(0,0,0,1),M.clearDepth(1),M.enable(M.DEPTH_TEST),M.depthFunc(M.LEQUAL),M.frontFace(M.CCW),M.cullFace(M.BACK),M.enable(M.CULL_FACE),M.enable(M.BLEND),M.blendEquation(M.FUNC_ADD),M.blendFunc(M.SRC_ALPHA,M.ONE_MINUS_SRC_ALPHA),M.clearColor(t.r,t.g,t.b,i)}(j,G,H),this.context=M;var X={};j=[],(e=[])[0]=-2,e[1]=-1,e[2]=-1,e[3]=2,e[4]=-1,e[5]=-1,e[6]=2,e[7]=1,e[8]=-1,e[9]=-2,e[10]=1,e[11]=-1,j[0]=0,j[1]=1,j[2]=2,j[3]=0,j[4]=2,j[5]=3,X.vertexBuffer=M.createBuffer(),X.elementBuffer=M.createBuffer(),M.bindBuffer(M.ARRAY_BUFFER,X.vertexBuffer),M.bufferData(M.ARRAY_BUFFER,new Float32Array(e),M.STATIC_DRAW),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,X.elementBuffer),M.bufferData(M.ELEMENT_ARRAY_BUFFER,new Uint16Array(j),M.STATIC_DRAW),X.program=M.createProgram(),M.attachShader(X.program,b("fragment",h.ShaderLib.shadowPost.fragmentShader)),M.attachShader(X.program,b("vertex",h.ShaderLib.shadowPost.vertexShader)),M.linkProgram(X.program),X.vertexLocation=M.getAttribLocation(X.program,"position"),X.projectionLocation=M.getUniformLocation(X.program,"projectionMatrix"),this.setSize=function(e,t){A.width=e,A.height=t,this.setViewport(0,0,A.width,A.height)},this.setViewport=function(e,t,i,n){V=e,B=t,P=i,k=n,M.viewport(V,B,P,k)},this.setScissor=function(e,t,i,n){M.scissor(e,t,i,n)},this.enableScissorTest=function(e){e?M.enable(M.SCISSOR_TEST):M.disable(M.SCISSOR_TEST)},this.enableDepthBufferWrite=function(e){M.depthMask(e)},this.setClearColorHex=function(e,t){var i=new h.Color(e);M.clearColor(i.r,i.g,i.b,t)},this.setClearColor=function(e,t){M.clearColor(e.r,e.g,e.b,t)},this.clear=function(){M.clear(M.COLOR_BUFFER_BIT|M.DEPTH_BUFFER_BIT|M.STENCIL_BUFFER_BIT)},this.initMaterial=function(e,i,n,r){var o,s,a,l;if(e instanceof h.MeshDepthMaterial?t(e,h.ShaderLib.depth):e instanceof h.ShadowVolumeDynamicMaterial?t(e,h.ShaderLib.shadowVolumeDynamic):e instanceof h.MeshNormalMaterial?t(e,h.ShaderLib.normal):e instanceof h.MeshBasicMaterial?t(e,h.ShaderLib.basic):e instanceof h.MeshLambertMaterial?t(e,h.ShaderLib.lambert):e instanceof h.MeshPhongMaterial?t(e,h.ShaderLib.phong):e instanceof h.LineBasicMaterial?t(e,h.ShaderLib.basic):e instanceof h.ParticleBasicMaterial&&t(e,h.ShaderLib.particle_basic),!e.program){var c,d,f;for(c=f=l=0,a=i.length;c<a;c++)(d=i[c])instanceof h.DirectionalLight&&f++,d instanceof h.PointLight&&l++;for(o in l+f<=4?i=f:l=4-(i=Math.ceil(4*f/(l+f))),l={directional:i,point:l},i=50,void 0!==r&&r instanceof h.SkinnedMesh&&(i=r.bones.length),a={map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,fog:n,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:l.directional,maxPointLights:l.point,maxBones:i},n=e.fragmentShader,l=e.vertexShader,i=M.createProgram(),c=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+a.maxDirLights,"#define MAX_POINT_LIGHTS "+a.maxPointLights,a.fog?"#define USE_FOG":"",a.fog instanceof h.FogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.lightMap?"#define USE_LIGHTMAP":"",a.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"),a=[M.getParameter(M.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+a.maxDirLights,"#define MAX_POINT_LIGHTS "+a.maxPointLights,"#define MAX_BONES "+a.maxBones,a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.lightMap?"#define USE_LIGHTMAP":"",a.vertexColors?"#define USE_COLOR":"",a.skinning?"#define USE_SKINNING":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"),M.attachShader(i,b("fragment",c+n)),M.attachShader(i,b("vertex",a+l)),M.linkProgram(i),M.getProgramParameter(i,M.LINK_STATUS),i.uniforms={},i.attributes={},e.program=i,n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"],e.uniforms)n.push(o);for(o=e.program,l=0,i=n.length;l<i;l++)c=n[l],o.uniforms[c]=M.getUniformLocation(o,c);for(n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"],o=0;o<this.maxMorphTargets;o++)n.push("morphTarget"+o);for(s in e.attributes)n.push(s);for(s=e.program,o=n,n=0,l=o.length;n<l;n++)i=o[n],s.attributes[i]=M.getAttribLocation(s,i);if(s=e.program.attributes,M.enableVertexAttribArray(s.position),s.color>=0&&M.enableVertexAttribArray(s.color),s.normal>=0&&M.enableVertexAttribArray(s.normal),s.tangent>=0&&M.enableVertexAttribArray(s.tangent),e.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0&&(M.enableVertexAttribArray(s.skinVertexA),M.enableVertexAttribArray(s.skinVertexB),M.enableVertexAttribArray(s.skinIndex),M.enableVertexAttribArray(s.skinWeight)),e.morphTargets)for(e.numSupportedMorphTargets=0,s.morphTarget0>=0&&(M.enableVertexAttribArray(s.morphTarget0),e.numSupportedMorphTargets++),s.morphTarget1>=0&&(M.enableVertexAttribArray(s.morphTarget1),e.numSupportedMorphTargets++),s.morphTarget2>=0&&(M.enableVertexAttribArray(s.morphTarget2),e.numSupportedMorphTargets++),s.morphTarget3>=0&&(M.enableVertexAttribArray(s.morphTarget3),e.numSupportedMorphTargets++),s.morphTarget4>=0&&(M.enableVertexAttribArray(s.morphTarget4),e.numSupportedMorphTargets++),s.morphTarget5>=0&&(M.enableVertexAttribArray(s.morphTarget5),e.numSupportedMorphTargets++),s.morphTarget6>=0&&(M.enableVertexAttribArray(s.morphTarget6),e.numSupportedMorphTargets++),s.morphTarget7>=0&&(M.enableVertexAttribArray(s.morphTarget7),e.numSupportedMorphTargets++),r.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets),o=0,s=this.maxMorphTargets;o<s;o++)r.__webglMorphTargetInfluences[o]=0}e.__webglProgram=!0},this.render=function(e,t,l,c){var d,g,v,y,x,b,w,A,C=e.lights,E=e.fog;for(t.matrixAutoUpdate&&t.updateMatrix(),e.update(void 0,!1,t),t.matrixWorldInverse.flattenToArray(I),t.projectionMatrix.flattenToArray(D),N.multiply(t.projectionMatrix,t.matrixWorldInverse),function(e){var t;for(U[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14),U[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14),U[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24),U[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24),U[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34),U[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34),e=0;e<6;e++)(t=U[e]).divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}(N),this.initWebGLObjects(e),function(e){var t,i;e&&!e.__webglFramebuffer&&(e.__webglFramebuffer=M.createFramebuffer(),e.__webglRenderbuffer=M.createRenderbuffer(),e.__webglTexture=M.createTexture(),M.bindRenderbuffer(M.RENDERBUFFER,e.__webglRenderbuffer),M.renderbufferStorage(M.RENDERBUFFER,M.DEPTH_COMPONENT16,e.width,e.height),M.bindTexture(M.TEXTURE_2D,e.__webglTexture),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,S(e.wrapS)),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,S(e.wrapT)),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,S(e.magFilter)),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,S(e.minFilter)),M.texImage2D(M.TEXTURE_2D,0,S(e.format),e.width,e.height,0,S(e.format),S(e.type),null),M.bindFramebuffer(M.FRAMEBUFFER,e.__webglFramebuffer),M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_2D,e.__webglTexture,0),M.framebufferRenderbuffer(M.FRAMEBUFFER,M.DEPTH_ATTACHMENT,M.RENDERBUFFER,e.__webglRenderbuffer),M.bindTexture(M.TEXTURE_2D,null),M.bindRenderbuffer(M.RENDERBUFFER,null),M.bindFramebuffer(M.FRAMEBUFFER,null)),e?(t=e.__webglFramebuffer,i=e.width,e=e.height):(t=null,i=P,e=k),t!=R&&(M.bindFramebuffer(M.FRAMEBUFFER,t),M.viewport(V,B,i,e),R=t)}(l),(this.autoClear||c)&&this.clear(),c=e.__webglObjects.length,x=0;x<c;x++)(w=(y=e.__webglObjects[x]).object).visible?w instanceof h.Mesh&&!a(w)?y.render=!1:(w.matrixWorld.flattenToArray(w._objectMatrixArray),m(w,t),p(y),y.render=!0,this.sortObjects&&(O.copy(w.position),N.multiplyVector3(O),y.z=O.z)):y.render=!1;for(this.sortObjects&&e.__webglObjects.sort(u),b=e.__webglObjectsImmediate.length,x=0;x<b;x++)(w=(y=e.__webglObjectsImmediate[x]).object).visible&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),m(w,t),f(y));for(_(h.NormalBlending),x=0;x<c;x++)if((y=e.__webglObjects[x]).render)for(w=y.object,A=y.buffer,v=y.opaque,o(w),d=0;d<v.count;d++)s((y=v.list[d]).depthTest),n(t,C,E,y,A,w);for(x=0;x<b;x++)if((w=(y=e.__webglObjectsImmediate[x]).object).visible)for(v=y.opaque,o(w),d=0;d<v.count;d++)s((y=v.list[d]).depthTest),g=i(t,C,E,y,w),w.render((function(e){r(e,g)}));for(x=0;x<c;x++)if((y=e.__webglObjects[x]).render)for(w=y.object,A=y.buffer,v=y.transparent,o(w),d=0;d<v.count;d++)_((y=v.list[d]).blending),s(y.depthTest),n(t,C,E,y,A,w);for(x=0;x<b;x++)if((w=(y=e.__webglObjectsImmediate[x]).object).visible)for(v=y.transparent,o(w),d=0;d<v.count;d++)_((y=v.list[d]).blending),s(y.depthTest),g=i(t,C,E,y,w),w.render((function(e){r(e,g)}));if(e.__webglShadowVolumes.length&&e.lights.length){for(M.enable(M.POLYGON_OFFSET_FILL),M.polygonOffset(.1,1),M.enable(M.STENCIL_TEST),M.depthMask(!1),M.colorMask(!1,!1,!1,!1),M.stencilFunc(M.ALWAYS,1,255),M.stencilOpSeparate(M.BACK,M.KEEP,M.INCR,M.KEEP),M.stencilOpSeparate(M.FRONT,M.KEEP,M.DECR,M.KEEP),b=e.lights.length,A=[],c=e.__webglShadowVolumes.length,t=0;t<b;t++)if((x=e.lights[t])instanceof h.DirectionalLight)for(A[0]=-x.position.x,A[1]=-x.position.y,A[2]=-x.position.z,x=0;x<c;x++)w=e.__webglShadowVolumes[x].object,d=e.__webglShadowVolumes[x].buffer,(y=w.materials[0]).program||L.initMaterial(y,C,E,w),y=(g=y.program).uniforms,v=g.attributes,T!==g&&(M.useProgram(g),T=g,M.uniformMatrix4fv(y.projectionMatrix,!1,D),M.uniformMatrix4fv(y.viewMatrix,!1,I),M.uniform3fv(y.directionalLightDirection,A)),w.matrixWorld.flattenToArray(w._objectMatrixArray),M.uniformMatrix4fv(y.objectMatrix,!1,w._objectMatrixArray),M.bindBuffer(M.ARRAY_BUFFER,d.__webglVertexBuffer),M.vertexAttribPointer(v.position,3,M.FLOAT,!1,0,0),M.bindBuffer(M.ARRAY_BUFFER,d.__webglNormalBuffer),M.vertexAttribPointer(v.normal,3,M.FLOAT,!1,0,0),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,d.__webglFaceBuffer),M.cullFace(M.FRONT),M.drawElements(M.TRIANGLES,d.__webglFaceCount,M.UNSIGNED_SHORT,0),M.cullFace(M.BACK),M.drawElements(M.TRIANGLES,d.__webglFaceCount,M.UNSIGNED_SHORT,0);
1M.disable(M.POLYGON_OFFSET_FILL),M.colorMask(!0,!0,!0,!0),M.stencilFunc(M.NOTEQUAL,0,255),M.stencilOp(M.KEEP,M.KEEP,M.KEEP),M.disable(M.DEPTH_TEST),M.enable(M.BLEND),M.blendFunc(M.ONE,M.ONE_MINUS_SRC_ALPHA),M.blendEquation(M.FUNC_ADD),F="",T=X.program,M.useProgram(X.program),M.uniformMatrix4fv(X.projectionLocation,!1,D),M.bindBuffer(M.ARRAY_BUFFER,X.vertexBuffer),M.vertexAttribPointer(X.vertexLocation,3,M.FLOAT,!1,0,0),M.enableVertexAttribArray(X.vertexLocation),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,X.elementBuffer),M.drawElements(M.TRIANGLES,6,M.UNSIGNED_SHORT,0),M.disable(M.STENCIL_TEST),M.enable(M.DEPTH_TEST),M.disable(M.BLEND),M.depthMask(!0)}l&&l.minFilter!==h.NearestFilter&&l.minFilter!==h.LinearFilter&&(M.bindTexture(M.TEXTURE_2D,l.__webglTexture),M.generateMipmap(M.TEXTURE_2D),M.bindTexture(M.TEXTURE_2D,null))},this.initWebGLObjects=function(e){for(e.__webglObjects||(e.__webglObjects=[],e.__webglObjectsImmediate=[],e.__webglShadowVolumes=[]);e.__objectsAdded.length;){var t=e.__objectsAdded[0],i=e,n=void 0,r=void 0,o=void 0;if(null==t._modelViewMatrix&&(t._modelViewMatrix=new h.Matrix4,t._normalMatrixArray=new Float32Array(9),t._modelViewMatrixArray=new Float32Array(16),t._objectMatrixArray=new Float32Array(16),t.matrixWorld.flattenToArray(t._objectMatrixArray)),t instanceof h.Mesh)for(n in null==(r=t.geometry).geometryGroups&&v(r),r.geometryGroups){if(!(o=r.geometryGroups[n]).__webglVertexBuffer){var s=o;if(s.__webglVertexBuffer=M.createBuffer(),s.__webglNormalBuffer=M.createBuffer(),s.__webglTangentBuffer=M.createBuffer(),s.__webglColorBuffer=M.createBuffer(),s.__webglUVBuffer=M.createBuffer(),s.__webglUV2Buffer=M.createBuffer(),s.__webglSkinVertexABuffer=M.createBuffer(),s.__webglSkinVertexBBuffer=M.createBuffer(),s.__webglSkinIndicesBuffer=M.createBuffer(),s.__webglSkinWeightsBuffer=M.createBuffer(),s.__webglFaceBuffer=M.createBuffer(),s.__webglLineBuffer=M.createBuffer(),s.numMorphTargets){var a=void 0,c=void 0;for(s.__webglMorphTargetsBuffers=[],a=0,c=s.numMorphTargets;a<c;a++)s.__webglMorphTargetsBuffers.push(M.createBuffer())}s=o;var d=void 0,f=void 0,p=void 0;p=void 0;var u=c=0,m=0;d=void 0,f=void 0;var _=void 0;f=void 0;var x=(a=t).geometry;_=x.faces;var b=s.faces;for(d=0,f=b.length;d<f;d++)(p=_[p=b[d]])instanceof h.Face3?(c+=3,u+=1,m+=3):p instanceof h.Face4&&(c+=4,u+=2,m+=4);d=s,_=void 0,b=void 0;var w=void 0,S=void 0;for(w=void 0,p=[],_=0,b=(f=a).materials.length;_<b;_++)if((w=f.materials[_])instanceof h.MeshFaceMaterial)for(w=0,l=d.materials.length;w<l;w++)(S=d.materials[w])&&p.push(S);else(S=w)&&p.push(S);e:{for(d=void 0,_=void 0,b=(f=p).length,d=0;d<b;d++)if((_=f[d]).map||_.lightMap||_ instanceof h.MeshShaderMaterial){d=!0;break e}d=!1}e:{for(b=void 0,p=void 0,w=(_=f).length,b=0;b<w;b++)if(!((p=_[b])instanceof h.MeshBasicMaterial&&!p.envMap||p instanceof h.MeshDepthMaterial)){_=p&&null!=p.shading&&p.shading==h.SmoothShading?h.SmoothShading:h.FlatShading;break e}_=!1}e:{for(b=void 0,p=void 0,w=f.length,b=0;b<w;b++)if((p=f[b]).vertexColors){f=p.vertexColors;break e}f=!1}if(s.__vertexArray=new Float32Array(3*c),_&&(s.__normalArray=new Float32Array(3*c)),x.hasTangents&&(s.__tangentArray=new Float32Array(4*c)),f&&(s.__colorArray=new Float32Array(3*c)),d&&((x.faceUvs.length>0||x.faceVertexUvs.length>0)&&(s.__uvArray=new Float32Array(2*c)),(x.faceUvs.length>1||x.faceVertexUvs.length>1)&&(s.__uv2Array=new Float32Array(2*c))),a.geometry.skinWeights.length&&a.geometry.skinIndices.length&&(s.__skinVertexAArray=new Float32Array(4*c),s.__skinVertexBArray=new Float32Array(4*c),s.__skinIndexArray=new Float32Array(4*c),s.__skinWeightArray=new Float32Array(4*c)),s.__faceArray=new Uint16Array(3*u+(a.geometry.edgeFaces?6*a.geometry.edgeFaces.length:0)),s.__lineArray=new Uint16Array(2*m),s.numMorphTargets)for(x=void 0,b=void 0,s.__morphTargetsArrays=[],x=0,b=s.numMorphTargets;x<b;x++)s.__morphTargetsArrays.push(new Float32Array(3*c));s.__needsSmoothNormals=_==h.SmoothShading,s.__uvType=d,s.__vertexColorType=f,s.__normalType=_,s.__webglFaceCount=3*u+(a.geometry.edgeFaces?6*a.geometry.edgeFaces.length:0),s.__webglLineCount=2*m,r.__dirtyVertices=!0,r.__dirtyMorphTargets=!0,r.__dirtyElements=!0,r.__dirtyUvs=!0,r.__dirtyNormals=!0,r.__dirtyTangents=!0,r.__dirtyColors=!0}t instanceof h.ShadowVolume?y(i.__webglShadowVolumes,o,t):y(i.__webglObjects,o,t)}else t instanceof h.Ribbon?((r=t.geometry).__webglVertexBuffer||((n=r).__webglVertexBuffer=M.createBuffer(),n.__webglColorBuffer=M.createBuffer(),o=(n=r).vertices.length,n.__vertexArray=new Float32Array(3*o),n.__colorArray=new Float32Array(3*o),n.__webglVertexCount=o,r.__dirtyVertices=!0,r.__dirtyColors=!0),y(i.__webglObjects,r,t)):t instanceof h.Line?((r=t.geometry).__webglVertexBuffer||((n=r).__webglVertexBuffer=M.createBuffer(),n.__webglColorBuffer=M.createBuffer(),o=(n=r).vertices.length,n.__vertexArray=new Float32Array(3*o),n.__colorArray=new Float32Array(3*o),n.__webglLineCount=o,r.__dirtyVertices=!0,r.__dirtyColors=!0),y(i.__webglObjects,r,t)):t instanceof h.ParticleSystem?((r=t.geometry).__webglVertexBuffer||((n=r).__webglVertexBuffer=M.createBuffer(),n.__webglColorBuffer=M.createBuffer(),o=(n=r).vertices.length,n.__vertexArray=new Float32Array(3*o),n.__colorArray=new Float32Array(3*o),n.__sortArray=[],n.__webglParticleCount=o,r.__dirtyVertices=!0,r.__dirtyColors=!0),y(i.__webglObjects,r,t)):void 0!==h.MarchingCubes&&t instanceof h.MarchingCubes&&i.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){for(t=e.__objectsRemoved[0],r=void 0,n=void 0,r=(i=e).__webglObjects.length-1;r>=0;r--)t==(n=i.__webglObjects[r].object)&&i.__webglObjects.splice(r,1);e.__objectsRemoved.splice(0,1)}for(t=0,i=e.__webglObjects.length;t<i;t++)g(e.__webglObjects[t].object);for(t=0,i=e.__webglShadowVolumes.length;t<i;t++)g(e.__webglShadowVolumes[t].object)},this.setFaceCulling=function(e,t){e?(t&&"ccw"!=t?M.frontFace(M.CW):M.frontFace(M.CCW),"back"==e?M.cullFace(M.BACK):"front"==e?M.cullFace(M.FRONT):M.cullFace(M.FRONT_AND_BACK),M.enable(M.CULL_FACE)):M.disable(M.CULL_FACE)}
1,this.supportsVertexTextures=function(){return M.getParameter(M.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}},h.SoundRenderer=function(){this.volume=1,this.domElement=document.createElement("div"),this.domElement.id="THREESound",this.cameraPosition=new h.Vector3,this.soundPosition=new h.Vector3,this.render=function(e,t,i){i&&e.update(void 0,!1,t);var n,r=(i=e.sounds).length;for(n=0;n<r;n++)e=i[n],this.soundPosition.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),this.soundPosition.subSelf(t.position),e.isPlaying&&e.isLoaded&&(e.isAddedToDOM||e.addToDOM(this.domElement),e.calculateVolumeAndPan(this.soundPosition))}},h.RenderableVertex=function(){this.positionWorld=new h.Vector3,this.positionScreen=new h.Vector4,this.visible=!0},h.RenderableVertex.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)},h.RenderableFace3=function(){this.v1=new h.RenderableVertex,this.v2=new h.RenderableVertex,this.v3=new h.RenderableVertex,this.centroidWorld=new h.Vector3,this.centroidScreen=new h.Vector3,this.normalWorld=new h.Vector3,this.vertexNormalsWorld=[new h.Vector3,new h.Vector3,new h.Vector3],this.faceMaterials=this.meshMaterials=null,this.overdraw=!1,this.uvs=[[]],this.z=null},h.RenderableFace4=function(){this.v1=new h.RenderableVertex,this.v2=new h.RenderableVertex,this.v3=new h.RenderableVertex,this.v4=new h.RenderableVertex,this.centroidWorld=new h.Vector3,this.centroidScreen=new h.Vector3,this.normalWorld=new h.Vector3,this.vertexNormalsWorld=[new h.Vector3,new h.Vector3,new h.Vector3,new h.Vector3],this.faceMaterials=this.meshMaterials=null,this.overdraw=!1,this.uvs=[[]],this.z=null},h.RenderableObject=function(){this.z=this.object=null},h.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null,this.scale=new h.Vector2,this.materials=null},h.RenderableLine=function(){this.z=null,this.v1=new h.RenderableVertex,this.v2=new h.RenderableVertex,this.materials=null},new h.Vector3,new h.Color(15658734),new h.Vector3,new h.Color(15658734),new h.Color(328965),new h.Color(15658734),new h.Color(1118481),new h.Color(328965),new h.Vector2(.001953125,0),h.QuakeCamera=function(e){function t(e,t){return function(){t.apply(e,arguments)}}h.Camera.call(this,e.fov,e.aspect,e.near,e.far,e.target),this.movementSpeed=1,this.lookSpeed=.005,this.noFly=!1,this.lookVertical=!0,this.autoForward=!1,this.activeLook=!0,this.heightSpeed=!1,this.heightCoef=1,this.heightMin=0,this.domElement=document,e&&(void 0!==e.movementSpeed&&(this.movementSpeed=e.movementSpeed),void 0!==e.lookSpeed&&(this.lookSpeed=e.lookSpeed),void 0!==e.noFly&&(this.noFly=e.noFly),void 0!==e.lookVertical&&(this.lookVertical=e.lookVertical),void 0!==e.autoForward&&(this.autoForward=e.autoForward),void 0!==e.activeLook&&(this.activeLook=e.activeLook),void 0!==e.heightSpeed&&(this.heightSpeed=e.heightSpeed),void 0!==e.heightCoef&&(this.heightCoef=e.heightCoef),void 0!==e.heightMin&&(this.heightMin=e.heightMin),void 0!==e.heightMax&&
1(this.heightMax=e.heightMax),void 0!==e.domElement&&(this.domElement=e.domElement)),this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0,this.moveForward=!1,this.moveBackward=!1,this.moveLeft=!1,this.moveRight=!1,this.mouseDragOn=!1,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.onMouseDown=function(e){if(e.preventDefault(),e.stopPropagation(),this.activeLook)switch(e.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0},this.onMouseUp=function(e){if(e.preventDefault(),e.stopPropagation(),this.activeLook)switch(e.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1},this.onMouseMove=function(e){this.mouseX=e.clientX-this.windowHalfX,this.mouseY=e.clientY-this.windowHalfY},this.onKeyDown=function(e){switch(e.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}},this.onKeyUp=function(e){switch(e.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}},this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0,(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor)),this.moveBackward&&this.translateZ(this.movementSpeed),this.moveLeft&&this.translateX(-this.movementSpeed),this.moveRight&&this.translateX(this.movementSpeed);var e=this.lookSpeed;this.activeLook||(e=0),this.lon+=this.mouseX*e,this.lookVertical&&(this.lat-=this.mouseY*e),this.lat=Math.max(-85,Math.min(85,this.lat)),this.phi=(90-this.lat)*Math.PI/180,this.theta=this.lon*Math.PI/180,e=this.target.position;var t=this.position;e.x=t.x+100*Math.sin(this.phi)*Math.cos(this.theta),e.y=t.y+100*Math.cos(this.phi),e.z=t.z+100*Math.sin(this.phi)*Math.sin(this.theta),this.supr.update.call(this)},this.domElement.addEventListener("contextmenu",(function(e){e.preventDefault()}),!1),this.domElement.addEventListener("mousemove",t(this,this.onMouseMove),!1),this.domElement.addEventListener("mousedown",t(this,this.onMouseDown),!1),this.domElement.addEventListener("mouseup",t(this,this.onMouseUp),!1),this.domElement.addEventListener("keydown",t(this,this.onKeyDown),!1),this.domElement.addEventListener("keyup",t(this,this.onKeyUp),!1)},h.QuakeCamera.prototype=new h.Camera,h.QuakeCamera.prototype.constructor=h.QuakeCamera,h.QuakeCamera.prototype.supr=h.Camera.prototype,h.QuakeCamera.prototype.translate=function(e,t){this.matrix.rotateAxis(t),this.noFly&&(t.y=0),this.position.addSelf(t.multiplyScalar(e)),this.target.position.addSelf(t.multiplyScalar(e))},h.PathCamera=function(e){function t(e,t,i,n){var r,o={name:i,fps:.6,length:n,hierarchy:[]},s=t.getControlPointsArray(),a=t.getLength(),l=s.length,c=0;for(r=l-1,(t={parent:-1,keys:[]}).keys[0]={time:0,pos:s[0],rot:[0,0,0,1],scl:[1,1,1]},t.keys[r]={time:n,pos:s[r],rot:[0,0,0,1],scl:[1,1,1]},r=1;r<l-1;r++)c=n*a.chunks[r]/a.total,t.keys[r]={time:c,pos:s[r]};return o.hierarchy[0]=t,h.AnimationHandler.add(o),new h.Animation(e,i,h.AnimationHandler.CATMULLROM_FORWARD,!1)}function n(e,t){var i,n,r=new h.Geometry;for(i=0;i<e.points.length*t;i++)n=i/(e.points.length*t),n=e.getPoint(n),r.vertices[i]=new h.Vertex(new h.Vector3(n.x,n.y,n.z));return r}h.Camera.call(this,e.fov,e.aspect,e.near,e.far,e.target),this.id="PathCamera"+h.PathCameraIdCounter++,this.duration=1e4,this.waypoints=[],this.useConstantSpeed=!0,this.resamplingCoef=50,this.debugPath=new h.Object3D,this.debugDummy=new h.Object3D,this.animationParent=new h.Object3D,this.lookSpeed=.005,this.lookVertical=!0,this.lookHorizontal=!0,this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]},this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]},this.domElement=document,e&&(void 0!==e.duration&&(this.duration=1e3*e.duration),void 0!==e.waypoints&&(this.waypoints=e.waypoints),void 0!==e.useConstantSpeed&&(this.useConstantSpeed=e.useConstantSpeed),void 0!==e.resamplingCoef&&(this.resamplingCoef=e.resamplingCoef),void 0!==e.createDebugPath&&(this.createDebugPath=e.createDebugPath),void 0!==e.createDebugDummy&&(this.createDebugDummy=e.createDebugDummy),void 0!==e.lookSpeed&&(this.lookSpeed=e.lookSpeed),void 0!==e.lookVertical&&(this.lookVertical=e.lookVertical),void 0!==e.lookHorizontal&&(this.lookHorizontal=e.lookHorizontal),void 0!==e.verticalAngleMap&&(this.verticalAngleMap=e.verticalAngleMap),void 0!==e.horizontalAngleMap&&(this.horizontalAngleMap=e.horizontalAngleMap),void 0!==e.domElement&&(this.domElement=e.domElement)),this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2;var r=2*Math.PI,o=Math.PI/180;if(this.update=function(e,t,i){var n,s;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed),this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed),this.lon=Math.max(0,Math.min(360,this.lon)),this.lat=Math.max(-85,Math.min(85,this.lat)),this.phi=(90-this.lat)*o,this.theta=this.lon*o,n=this.phi%r,this.phi=n>=0?n:n+r,n=this.verticalAngleMap.srcRange,s=this.verticalAngleMap.dstRange,this.phi=(this.phi-n[0])*(s[1]-s[0])/(n[1]-n[0])+s[0],n=this.horizontalAngleMap.srcRange,s=this.horizontalAngleMap.dstRange,this.theta=(this.theta-n[0])*(s[1]-s[0])/(n[1]-n[0])+s[0],(n=this.target.position).x=100*Math.sin(this.phi)*Math.cos(this.theta),n.y=100*Math.cos(this.phi),n.z=100*Math.sin(this.phi)*Math.sin(this.theta),this.supr.update.call(this,e,t,i)},this.onMouseMove=function(e){this.mouseX=e.clientX-this.windowHalfX,this.mouseY=e.clientY-this.windowHalfY},this.spline=new h.Spline,this.spline.initFromArray(this.waypoints),this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef),this.createDebugDummy){e=new h.MeshLambertMaterial({color:30719});var s=new h.MeshLambertMaterial({color:65280}),a=new d(10,10,20),l=new d(2,2,10);this.animationParent=new h.Mesh(a,e),(e=new h.Mesh(l,s)).position.set(0,10,0),this.animation=t(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this),this.animationParent.addChild(this.target),this.animationParent.addChild(e)}else this.animation=t(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&function(e,t){var r=n(t,10),o=n(t,10),s=new h.LineBasicMaterial({color:16711680,linewidth:3});for(lineObj=new h.Line(r,s),particleObj=new h.ParticleSystem(o,new h.ParticleBasicMaterial({color:16755200,size:3})),lineObj.scale.set(1,1,1),e.addChild(lineObj),particleObj.scale.set(1,1,1),e.addChild(particleObj),o=new y(1,16,8),s=new h.MeshBasicMaterial({color:65280}),i=0;i<t.points.length;i++)(r=new h.Mesh(o,s)).position.copy(t.points[i]),r.updateMatrix(),e.addChild(r)}(this.debugPath,this.spline),this.domElement.addEventListener("mousemove",function(e,t){return function(){t.apply(e,arguments)}}(this,this.onMouseMove),!1)},h.PathCamera.prototype=new h.Camera,h.PathCamera.prototype.constructor=h.PathCamera,h.PathCamera.prototype.supr=h.Camera.prototype,h.PathCameraIdCounter=0;var d=function(e,t,i,n,r,o,s,a,l){function c(e,t,i,s,a,l,c,f){var p,u,m=n||
11,g=r||1,v=a/2,y=l/2,_=d.vertices.length;"x"==e&&"y"==t||"y"==e&&"x"==t?p="z":"x"==e&&"z"==t||"z"==e&&"x"==t?(p="y",g=o||1):("z"==e&&"y"==t||"y"==e&&"z"==t)&&(p="x",m=o||1);var x=m+1,b=g+1;a/=m;var w=l/g;for(u=0;u<b;u++)for(l=0;l<x;l++){var S=new h.Vector3;S[e]=(l*a-v)*i,S[t]=(u*w-y)*s,S[p]=c,d.vertices.push(new h.Vertex(S))}for(u=0;u<g;u++)for(l=0;l<m;l++)d.faces.push(new h.Face4(l+x*u+_,l+x*(u+1)+_,l+1+x*(u+1)+_,l+1+x*u+_,null,null,f)),d.faceVertexUvs[0].push([new h.UV(l/m,u/g),new h.UV(l/m,(u+1)/g),new h.UV((l+1)/m,(u+1)/g),new h.UV((l+1)/m,u/g)])}h.Geometry.call(this);var d=this,f=e/2,p=t/2,u=i/2;if(a=a?-1:1,void 0!==s)if(s instanceof Array)this.materials=s;else{this.materials=[];for(var m=0;m<6;m++)this.materials.push([s])}else this.materials=[];if(this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0},null!=l)for(var g in l)null!=this.sides[g]&&(this.sides[g]=l[g]);this.sides.px&&c("z","y",1*a,-1,i,t,-f,this.materials[0]),this.sides.nx&&c("z","y",-1*a,-1,i,t,f,this.materials[1]),this.sides.py&&c("x","z",1*a,1,e,i,p,this.materials[2]),this.sides.ny&&c("x","z",1*a,-1,e,i,-p,this.materials[3]),this.sides.pz&&c("x","y",1*a,-1,e,t,u,this.materials[4]),this.sides.nz&&c("x","y",-1*a,-1,e,t,-u,this.materials[5]),function(){for(var e=[],t=[],i=0,n=d.vertices.length;i<n;i++){for(var r=d.vertices[i],o=!1,s=0,a=e.length;s<a;s++){var l=e[s];if(r.position.x==l.position.x&&r.position.y==l.position.y&&r.position.z==l.position.z){t[i]=s,o=!0;break}}o||(t[i]=e.length,e.push(new h.Vertex(r.position.clone())))}for(i=0,n=d.faces.length;i<n;i++)(r=d.faces[i]).a=t[r.a],r.b=t[r.b],r.c=t[r.c],r.d=t[r.d];d.vertices=e}(),this.computeCentroids(),this.computeFaceNormals()};d.prototype=new h.Geometry,d.prototype.constructor=d;var f=function(e,t,i,n,r,o){function s(e,t,i){a.vertices.push(new h.Vertex(new h.Vector3(e,t,i)))}h.Geometry.call(this);var a=this,l=Math.PI,c=n/2;for(n=0;n<e;n++)s(Math.sin(2*l*n/e)*t,Math.cos(2*l*n/e)*t,-c);for(n=0;n<e;n++)s(Math.sin(2*l*n/e)*i,Math.cos(2*l*n/e)*i,c);for(n=0;n<e;n++)a.faces.push(new h.Face4(n,n+e,e+(n+1)%e,(n+1)%e));if(i>0)for(s(0,0,-c-(o||0)),n=e;n<e+e/2;n++)a.faces.push(new h.Face4(2*e,(2*n-2*e)%e,(2*n-2*e+1)%e,(2*n-2*e+2)%e));if(t>0)for(s(0,0,c+(r||0)),n=e+e/2;n<2*e;n++)a.faces.push(new h.Face4(2*e+1,(2*n-2*e+2)%e+e,(2*n-2*e+1)%e+e,(2*n-2*e)%e+e));this.computeCentroids(),this.computeFaceNormals()};(f.prototype=new h.Geometry).constructor=f;var p=function(e){function t(e,t,i){var n=Math.sqrt(e*e+t*t+i*i);return o.vertices.push(new h.Vertex(new h.Vector3(e/n,t/n,i/n)))-1}function i(e,t,i,n){n.faces.push(new h.Face3(e,t,i))}function n(e,i){var n=o.vertices[e].position,r=o.vertices[i].position;return t((n.x+r.x)/2,(n.y+r.y)/2,(n.z+r.z)/2)}var r,o=this,s=new h.Geometry;for(this.subdivisions=e||0,h.Geometry.call(this),t(-1,e=(1+Math.sqrt(5))/2,0),t(1,e,0),t(-1,-e,0),t(1,-e,0),t(0,-1,e),t(0,1,e),t(0,-1,-e),t(0,1,-e),t(e,0,-1),t(e,0,1),t(-e,0,-1),t(-e,0,1),i(0,11,5,s),i(0,5,1,s),i(0,1,7,s),i(0,7,10,s),i(0,10,11,s),i(1,5,9,s),i(5,11,4,s),i(11,10,2,s),i(10,7,6,s),i(7,1,8,s),i(3,9,4,s),i(3,4,2,s),i(3,2,6,s),i(3,6,8,s),i(3,8,9,s),i(4,9,5,s),i(2,4,11,s),i(6,2,10,s),i(8,6,7,s),i(9,8,1,s),e=0;e<this.subdivisions;e++){for(var a in r=new h.Geometry,s.faces){var l=n(s.faces[a].a,s.faces[a].b),c=n(s.faces[a].b,s.faces[a].c),d=n(s.faces[a].c,s.faces[a].a);i(s.faces[a].a,l,d,r),i(s.faces[a].b,c,l,r),i(s.faces[a].c,d,c,r),i(l,c,d,r)}s.faces=r.faces}o.faces=s.faces,delete s.faces,delete r.faces,this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()};function m(e,t,i){h.Geometry.call(this),this.steps=t||12,this.angle=i||2*Math.PI,t=this.angle/this.steps;for(var n=[],r=[],o=[],s=[],a=0;a<e.length;a++)this.vertices.push(new h.Vertex(e[a])),n[a]=e[a].clone(),r[a]=this.vertices.length-1;for(var l=(new h.Matrix4).setRotationZ(t),c=0;c<=this.angle+.001;c+=t){for(a=0;a<n.length;a++)c<this.angle?(n[a]=l.multiplyVector3(n[a].clone()),this.vertices.push(new h.Vertex(n[a])),o[a]=this.vertices.length-1):o=s;for(0==c&&(s=r),a=0;a<r.length-1;a++)this.faces.push(new h.Face4(o[a],o[a+1],r[a+1],r[a])),this.faceVertexUvs[0].push([new h.UV(c/i,a/e.length),new h.UV(c/i,(a+1)/e.length),new h.UV((c-t)/i,(a+1)/e.length),new h.UV((c-t)/i,a/e.length)]);
1r=o,o=[]}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()}(p.prototype=new h.Geometry).constructor=p,m.prototype=new h.Geometry,m.prototype.constructor=m;var g=function(e,t,i,n){h.Geometry.call(this);var r,o=e/2,s=t/2,a=(i=i||1)+1,l=(n=n||1)+1;e/=i;var c=t/n;for(r=0;r<l;r++)for(t=0;t<a;t++)this.vertices.push(new h.Vertex(new h.Vector3(t*e-o,-(r*c-s),0)));for(r=0;r<n;r++)for(t=0;t<i;t++)this.faces.push(new h.Face4(t+a*r,t+a*(r+1),t+1+a*(r+1),t+1+a*r)),this.faceVertexUvs[0].push([new h.UV(t/i,r/n),new h.UV(t/i,(r+1)/n),new h.UV((t+1)/i,(r+1)/n),new h.UV((t+1)/i,r/n)]);this.computeCentroids(),this.computeFaceNormals()};(g.prototype=new h.Geometry).constructor=g;var y=function(e,t,i){h.Geometry.call(this);var n,r,o,s,a=Math.PI,l=Math.max(3,t||8),c=Math.max(2,i||6);for(t=[],i=0;i<c+1;i++){n=i/c;var d=e*Math.cos(n*a),f=e*Math.sin(n*a),p=[],u=0;for(n=0;n<l;n++){var m=2*n/l,g=f*Math.sin(m*a);m=f*Math.cos(m*a),(0==i||i==c)&&n>0||(u=this.vertices.push(new h.Vertex(new h.Vector3(m,d,g)))-1),p.push(u)}t.push(p)}for(a=t.length,i=0;i<a;i++)if(l=t[i].length,i>0)for(n=0;n<l;n++){p=n==l-1,c=t[i][p?0:n+1],d=t[i][p?l-1:n],f=t[i-1][p?l-1:n],p=t[i-1][p?0:n+1],g=i/(a-1),r=(i-1)/(a-1),o=(n+1)/l,m=n/l,u=new h.UV(1-o,g),g=new h.UV(1-m,g),m=new h.UV(1-m,r);var v=new h.UV(1-o,r);i<t.length-1&&(r=this.vertices[c].position.clone(),o=this.vertices[d].position.clone(),s=this.vertices[f].position.clone(),r.normalize(),o.normalize(),s.normalize(),this.faces.push(new h.Face3(c,d,f,[new h.Vector3(r.x,r.y,r.z),new h.Vector3(o.x,o.y,o.z),new h.Vector3(s.x,s.y,s.z)])),this.faceVertexUvs[0].push([u,g,m])),i>1&&(r=this.vertices[c].position.clone(),o=this.vertices[f].position.clone(),s=this.vertices[p].position.clone(),r.normalize(),o.normalize(),s.normalize(),this.faces.push(new h.Face3(c,f,p,[new h.Vector3(r.x,r.y,r.z),new h.Vector3(o.x,o.y,o.z),new h.Vector3(s.x,s.y,s.z)])),this.faceVertexUvs[0].push([u,m,v]))}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals(),this.boundingSphere={radius:e}};y.prototype=new h.Geometry,y.prototype.constructor=y;var _=function(e,t,i,n){for(this.radius=e||100,this.tube=t||40,this.segmentsR=i||8,this.segmentsT=n||6,e=[],h.Geometry.call(this),t=0;t<=this.segmentsR;++t)for(i=0;i<=this.segmentsT;++i){n=i/this.segmentsT*2*Math.PI;var r=t/this.segmentsR*2*Math.PI;this.vertices.push(new h.Vertex(new h.Vector3((this.radius+this.tube*Math.cos(r))*Math.cos(n),(this.radius+this.tube*Math.cos(r))*Math.sin(n),this.tube*Math.sin(r)))),e.push([i/this.segmentsT,1-t/this.segmentsR])}for(t=1;t<=this.segmentsR;++t)for(i=1;i<=this.segmentsT;++i){n=(this.segmentsT+1)*t+i,r=(this.segmentsT+1)*t+i-1;var o=(this.segmentsT+1)*(t-1)+i-1,s=(this.segmentsT+1)*(t-1)+i;this.faces.push(new h.Face4(n,r,o,s)),this.faceVertexUvs[0].push([new h.UV(e[n][0],e[n][1]),new h.UV(e[r][0],e[r][1]),new h.UV(e[o][0],e[o][1]),new h.UV(e[s][0],e[s][1])])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()};(_.prototype=new h.Geometry).constructor=_;var x=function(e,t,i,n,r,o,s){function a(e,t,i,n,r,o){return t=i/n*e,i=Math.cos(t),new h.Vector3(r*(2+i)*.5*Math.cos(e),r*(2+i)*Math.sin(e)*.5,o*r*Math.sin(t)*.5)}for(h.Geometry.call(this),this.radius=e||200,this.tube=t||40,this.segmentsR=i||64,this.segmentsT=n||8,this.p=r||2,this.q=o||3,this.heightScale=s||1,this.grid=Array(this.segmentsR),i=new h.Vector3,n=new h.Vector3,o=new h.Vector3,e=0;e<this.segmentsR;++e)for(this.grid[e]=Array(this.segmentsT),t=0;t<this.segmentsT;++t){var l=e/this.segmentsR*2*this.p*Math.PI;r=a(l,s=t/this.segmentsT*2*Math.PI,this.q,this.p,this.radius,this.heightScale),l=a(l+.01,s,this.q,this.p,this.radius,this.heightScale),i.x=l.x-r.x,i.y=l.y-r.y,i.z=l.z-r.z,n.x=l.x+r.x,n.y=l.y+r.y,n.z=l.z+r.z,o.cross(i,n),n.cross(o,i),o.normalize(),n.normalize(),l=this.tube*Math.cos(s),s=this.tube*Math.sin(s),r.x+=l*n.x+s*o.x,r.y+=l*n.y+s*o.y,r.z+=l*n.z+s*o.z,this.grid[e][t]=this.vertices.push(new h.Vertex(new h.Vector3(r.x,r.y,r.z)))-1}for(e=0;e<this.segmentsR;++e)for(t=0;t<this.segmentsT;++t){o=(e+1)%this.segmentsR,s=(t+1)%this.segmentsT,r=this.grid[e][t],i=this.grid[o][t],n=this.grid[e][s],o=this.grid[o][s],s=new h.UV(e/this.segmentsR,t/this.segmentsT),l=new h.UV((e+1)/this.segmentsR,t/this.segmentsT);var c=new h.UV(e/this.segmentsR,(t+1)/this.segmentsT),d=new h.UV((e+1)/this.segmentsR,(t+1)/this.segmentsT);this.faces.push(new h.Face3(r,i,n)),this.faceVertexUvs[0].push([s,l,c]),this.faces.push(new h.Face3(o,n,i)),this.faceVertexUvs[0].push([d,c,l])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()};(x.prototype=new h.Geometry).constructor=x,h.Loader=function(e){this.statusDomElement=(this.showStatus=e)?h.Loader.prototype.addStatusElement():null,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},h.Loader.prototype={addStatusElement:function(){var e=document.createElement("div");return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";t+=e.total?(100*e.loaded/e.total).toFixed(0)+"%":(e.loaded/1e3).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlbase:function(e){return(e=e.split("/")).pop(),e.join("/")},init_materials:function(e,t,i){e.materials=[];for(var n=0;n<t.length;++n)e.materials[n]=[h.Loader.prototype.createMaterial(t[n],i)]},createMaterial:function(e,t){function i(e){return e=Math.log(e)/Math.LN2,Math.floor(e)==e}function n(e,t){var n=new Image;n.onload=function(){if(i(this.width)&&i(this.height))e.image=this;else{var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),n=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));e.image.width=t,e.image.height=n,e.image.getContext("2d").drawImage(this,0,0,t,n)}e.needsUpdate=!0},n.src=t}var r,o,s;return r="MeshLambertMaterial",o={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:!!e.vertexColors&&h.VertexColors,wireframe:e.wireframe},e.shading&&("Phong"==e.shading?r="MeshPhongMaterial":"Basic"==e.shading&&(r="MeshBasicMaterial")),e.mapDiffuse&&t?(s=document.createElement("canvas"),o.map=new h.Texture(s),o.map.sourceFile=e.mapDiffuse,n(o.map,t+"/"+e.mapDiffuse)):e.colorDiffuse?(s=(255*e.colorDiffuse[0]<<16)+(255*e.colorDiffuse[1]<<8)+255*e.colorDiffuse[2],o.color=s,o.opacity=e.transparency):e.DbgColor&&(o.color=e.DbgColor),e.mapLightmap&&t&&(s=document.createElement("canvas"),o.lightMap=new h.Texture(s),o.lightMap.sourceFile=e.mapLightmap,n(o.lightMap,t+"/"+e.mapLightmap)),new h[r](o)}},h.JSONLoader=function(e){h.Loader.call(this,e)},h.JSONLoader.prototype=new h.Loader,h.JSONLoader.prototype.constructor=h.JSONLoader,h.JSONLoader.prototype.supr=h.Loader.prototype,h.JSONLoader.prototype.load=function(e){var t=this,i=e.model,n=e.callback,r=e.texture_path?e.texture_path:this.extractUrlbase(i);(e=new Worker(i)).onmessage=function(e){t.createModel(e.data,n,r),t.onLoadComplete()},this.onLoadStart(),e.postMessage((new Date).getTime())},h.JSONLoader.prototype.createModel=function(e,t,i){var n=new h.Geometry;this.init_materials(n,e.materials,i),function(){if(void 0===e.version||2!=e.version);else{var t,i,r,o,s,a,l,c,d,f,p=e.faces;c=e.vertices;var m=e.normals,g=e.colors,y=0;for(t=0;t<e.uvs.length;t++)e.uvs[t].length&&y++;for(t=0;t<y;t++)n.faceUvs[t]=[],n.faceVertexUvs[t]=[];for(o=0,s=c.length;o<s;)(d=new h.Vertex).position.x=c[o++],d.position.y=c[o++],d.position.z=c[o++],n.vertices.push(d);for(o=0,s=p.length;o<s;){if(l=1&(a=p[o++]),r=2&a,t=4&a,i=8&a,c=16&a,d=32&a,f=64&a,a&=128,l?((l=new h.Face4).a=p[o++],l.b=p[o++],l.c=p[o++],l.d=p[o++],nVertices=4):((l=new h.Face3).a=p[o++],l.b=p[o++],l.c=p[o++],nVertices=3),r&&(materialIndex=p[o++],l.materials=n.materials[materialIndex]),r=n.faces.length,t)for(t=0;t<y;t++)uvLayer=e.uvs[t],uvIndex=p[o++],u=uvLayer[2*uvIndex],v=uvLayer[2*uvIndex+1],n.faceUvs[t][r]=new h.UV(u,v);if(i)for(t=0;t<y;t++){for(uvLayer=e.uvs[t],uvs=[],i=0;i<nVertices;i++)uvIndex=p[o++],u=uvLayer[2*uvIndex],v=uvLayer[2*uvIndex+1],uvs[i]=new h.UV(u,v);n.faceVertexUvs[t][r]=uvs}
1if(c&&(normalIndex=3*p[o++],normal=new h.Vector3,normal.x=m[normalIndex++],normal.y=m[normalIndex++],normal.z=m[normalIndex],l.normal=normal),d)for(t=0;t<nVertices;t++)normalIndex=3*p[o++],normal=new h.Vector3,normal.x=m[normalIndex++],normal.y=m[normalIndex++],normal.z=m[normalIndex],l.vertexNormals.push(normal);if(f&&(color=new h.Color(p[o++]),l.color=color),a)for(t=0;t<nVertices;t++)colorIndex=p[o++],color=new h.Color(g[colorIndex]),l.vertexColors.push(color);n.faces.push(l)}}}(),function(){var t,i,r,o;if(e.skinWeights)for(t=0,i=e.skinWeights.length;t<i;t+=2)r=e.skinWeights[t],o=e.skinWeights[t+1],n.skinWeights.push(new h.Vector4(r,o,0,0));if(e.skinIndices)for(t=0,i=e.skinIndices.length;t<i;t+=2)r=e.skinIndices[t],o=e.skinIndices[t+1],n.skinIndices.push(new h.Vector4(r,o,0,0));n.bones=e.bones,n.animation=e.animation}(),function(){var t,i,r,o;if(void 0!==e.morphTargets)for(t=0,i=e.morphTargets.length;t<i;t++)for(n.morphTargets[t]={},n.morphTargets[t].name=e.morphTargets[t].name,n.morphTargets[t].vertices=[],dstVertices=n.morphTargets[t].vertices,srcVertices=e.morphTargets[t].vertices,r=0,o=srcVertices.length;r<o;r+=3)dstVertices.push(new h.Vertex(new h.Vector3(srcVertices[r],srcVertices[r+1],srcVertices[r+2])))}(),n.computeCentroids(),n.computeFaceNormals(),t(n)},h.BinaryLoader=function(e){h.Loader.call(this,e)},h.BinaryLoader.prototype=new h.Loader,h.BinaryLoader.prototype.constructor=h.BinaryLoader,h.BinaryLoader.prototype.supr=h.Loader.prototype,h.BinaryLoader.prototype={load:function(e){var t=e.model,i=e.callback,n=e.texture_path?e.texture_path:h.Loader.prototype.extractUrlbase(t),r=e.bin_path?e.bin_path:h.Loader.prototype.extractUrlbase(t);e=(new Date).getTime(),t=new Worker(t);var o=this.showProgress?h.Loader.prototype.updateProgress:null;t.onmessage=function(e){h.BinaryLoader.prototype.loadAjaxBuffers(e.data.buffers,e.data.materials,i,r,n,o)},t.onerror=function(e){alert("worker.onerror: "+e.message+"\n"+e.data),e.preventDefault()},t.postMessage(e)},loadAjaxBuffers:function(e,t,i,n,r,o){var s=new XMLHttpRequest,a=n+"/"+e,l=0;s.onreadystatechange=function(){4==s.readyState?200==s.status||0==s.status?h.BinaryLoader.prototype.createBinModel(s.responseText,i,r,t):alert("Couldn't load ["+a+"] ["+s.status+"]"):3==s.readyState?o&&(0==l&&(l=s.getResponseHeader("Content-Length")),o({total:l,loaded:s.responseText.length})):2==s.readyState&&(l=s.getResponseHeader("Content-Length"))},s.open("GET",a,!0),s.overrideMimeType("text/plain; charset=x-user-defined"),s.setRequestHeader("Content-Type","text/plain"),s.send(null)},createBinModel:function(e,t,i,n){var r=function(t){function i(e,t){var i=a(e,t),n=a(e,t+1),r=a(e,t+2),o=a(e,t+3),s=(o<<1&255|r>>7)-127;return 0==(i|=(127&r)<<16|n<<8)&&-127==s?0:(1-2*(o>>7))*(1+i*Math.pow(2,-23))*Math.pow(2,s)}function r(e,t){var i=a(e,t),n=a(e,t+1),r=a(e,t+2);return(a(e,t+3)<<24)+(r<<16)+(n<<8)+i}function o(e,t){var i=a(e,t);return(a(e,t+1)<<8)+i}function s(e,t){var i=a(e,t);return i>127?i-256:i}function a(e,t){return 255&e.charCodeAt(t)}function l(t){var i,n,s;i=r(e,t),n=r(e,t+g),s=r(e,t+v),t=o(e,t+y),h.BinaryLoader.prototype.f3(O,i,n,s,t)}function c(t){var i,n,s,a,l,c;i=r(e,t),n=r(e,t+g),s=r(e,t+v),a=o(e,t+y),l=r(e,t+_),c=r(e,t+x),t=r(e,t+b),h.BinaryLoader.prototype.f3n(O,j,i,n,s,a,l,c,t)}function d(t){var i,n,s,a;i=r(e,t),n=r(e,t+w),s=r(e,t+S),a=r(e,t+M),t=o(e,t+A),h.BinaryLoader.prototype.f4(O,i,n,s,a,t)}function f(t){var i,n,s,a,l,c,d,f;i=r(e,t),n=r(e,t+w),s=r(e,t+S),a=r(e,t+M),l=o(e,t+A),c=r(e,t+T),d=r(e,t+R),f=r(e,t+L),t=r(e,t+C),h.BinaryLoader.prototype.f4n(O,j,i,n,s,a,l,c,d,f,t)}function p(t){var i,n;i=r(e,t),n=r(e,t+E),t=r(e,t+F),h.BinaryLoader.prototype.uv3(O.faceVertexUvs[0],G[2*i],G[2*i+1],G[2*n],G[2*n+1],G[2*t],G[2*t+1])}function u(t){var i,n,o;i=r(e,t),n=r(e,t+z),o=r(e,t+V),t=r(e,t+B),h.BinaryLoader.prototype.uv4(O.faceVertexUvs[0],G[2*i],G[2*i+1],G[2*n],G[2*n+1],G[2*o],G[2*o+1],G[2*t],G[2*t+1])}var m,g,v,y,_,x,b,w,S,M,A,T,R,L,C,E,F,z,V,B,P,k,U,N,D,I,O=this,W=0,j=[],G=[];h.Geometry.call(this),h.Loader.prototype.init_materials(O,n,t),W+=(m={signature:e.substr(W,8),header_bytes:a(e,W+8),vertex_coordinate_bytes:a(e,W+9),normal_coordinate_bytes:a(e,W+10),uv_coordinate_bytes:a(e,W+11),vertex_index_bytes:a(e,W+12),normal_index_bytes:a(e,W+13),uv_index_bytes:a(e,W+14),material_index_bytes:a(e,W+15),nvertices:r(e,W+16),nnormals:r(e,W+16+4),nuvs:r(e,W+16+8),ntri_flat:r(e,W+16+12),ntri_smooth:r(e,W+16+16),ntri_flat_uv:r(e,W+16+20),ntri_smooth_uv:r(e,W+16+24),nquad_flat:r(e,W+16+28),nquad_smooth:r(e,W+16+32),nquad_flat_uv:r(e,W+16+36),nquad_smooth_uv:r(e,W+16+40)}).header_bytes,g=m.vertex_index_bytes,v=2*m.vertex_index_bytes,y=3*m.vertex_index_bytes,_=3*m.vertex_index_bytes+m.material_index_bytes,x=3*m.vertex_index_bytes+m.material_index_bytes+m.normal_index_bytes,b=3*m.vertex_index_bytes+m.material_index_bytes+2*m.normal_index_bytes,w=m.vertex_index_bytes,S=2*m.vertex_index_bytes,M=3*m.vertex_index_bytes,A=4*m.vertex_index_bytes,T=4*m.vertex_index_bytes+m.material_index_bytes,R=4*m.vertex_index_bytes+m.material_index_bytes+m.normal_index_bytes,L=4*m.vertex_index_bytes+m.material_index_bytes+2*m.normal_index_bytes,C=4*m.vertex_index_bytes+m.material_index_bytes+3*m.normal_index_bytes,E=m.uv_index_bytes,F=2*m.uv_index_bytes,z=m.uv_index_bytes,V=2*m.uv_index_bytes,B=3*m.uv_index_bytes,P=m.ntri_flat*(t=3*m.vertex_index_bytes+m.material_index_bytes),k=m.ntri_smooth*(t+3*m.normal_index_bytes),U=m.ntri_flat_uv*(t+3*m.uv_index_bytes),N=m.ntri_smooth_uv*(t+3*m.normal_index_bytes+3*m.uv_index_bytes),D=m.nquad_flat*(I=4*m.vertex_index_bytes+m.material_index_bytes),t=m.nquad_smooth*(I+4*m.n
1ormal_index_bytes),I=m.nquad_flat_uv*(I+4*m.uv_index_bytes),W+=function(t){for(var n,r,o,s=3*m.vertex_coordinate_bytes,a=t+m.nvertices*s;t<a;t+=s)n=i(e,t),r=i(e,t+m.vertex_coordinate_bytes),o=i(e,t+2*m.vertex_coordinate_bytes),h.BinaryLoader.prototype.v(O,n,r,o);return m.nvertices*s}(W),W+=function(t){for(var i,n,r,o=3*m.normal_coordinate_bytes,a=t+m.nnormals*o;t<a;t+=o)i=s(e,t),n=s(e,t+m.normal_coordinate_bytes),r=s(e,t+2*m.normal_coordinate_bytes),j.push(i/127,n/127,r/127);return m.nnormals*o}(W),I=(t=(D=(N=(U=(k=(P=(W+=function(t){for(var n,r,o=2*m.uv_coordinate_bytes,s=t+m.nuvs*o;t<s;t+=o)n=i(e,t),r=i(e,t+m.uv_coordinate_bytes),G.push(n,r);return m.nuvs*o}(W))+P)+k)+U)+N)+D)+t)+I,function(e){var t,i=3*m.vertex_index_bytes+m.material_index_bytes,n=i+3*m.uv_index_bytes,r=e+m.ntri_flat_uv*n;for(t=e;t<r;t+=n)l(t),p(t+i)}(k),function(e){var t,i=3*m.vertex_index_bytes+m.material_index_bytes+3*m.normal_index_bytes,n=i+3*m.uv_index_bytes,r=e+m.ntri_smooth_uv*n;for(t=e;t<r;t+=n)c(t),p(t+i)}(U),function(e){var t,i=4*m.vertex_index_bytes+m.material_index_bytes,n=i+4*m.uv_index_bytes,r=e+m.nquad_flat_uv*n;for(t=e;t<r;t+=n)d(t),u(t+i)}(t),function(e){var t,i=4*m.vertex_index_bytes+m.material_index_bytes+4*m.normal_index_bytes,n=i+4*m.uv_index_bytes,r=e+m.nquad_smooth_uv*n;for(t=e;t<r;t+=n)f(t),u(t+i)}(I),function(e){var t,i=3*m.vertex_index_bytes+m.material_index_bytes,n=e+m.ntri_flat*i;for(t=e;t<n;t+=i)l(t)}(W),function(e){var t,i=3*m.vertex_index_bytes+m.material_index_bytes+3*m.normal_index_bytes,n=e+m.ntri_smooth*i;for(t=e;t<n;t+=i)c(t)}(P),function(e){var t,i=4*m.vertex_index_bytes+m.material_index_bytes,n=e+m.nquad_flat*i;for(t=e;t<n;t+=i)d(t)}(N),function(e){var t,i=4*m.vertex_index_bytes+m.material_index_bytes+4*m.normal_index_bytes,n=e+m.nquad_smooth*i;for(t=e;t<n;t+=i)f(t)}(D),this.computeCentroids(),this.computeFaceNormals()};(r.prototype=new h.Geometry).constructor=r,t(new r(i))},v:function(e,t,i,n){e.vertices.push(new h.Vertex(new h.Vector3(t,i,n)))},f3:function(e,t,i,n,r){e.faces.push(new h.Face3(t,i,n,null,null,e.materials[r]))},f4:function(e,t,i,n,r,o){e.faces.push(new h.Face4(t,i,n,r,null,null,e.materials[o]))},f3n:function(e,t,i,n,r,o,s,a,l){o=e.materials[o];var c=t[3*a],d=t[3*a+1];a=t[3*a+2];var f=t[3*l],p=t[3*l+1];l=t[3*l+2],e.faces.push(new h.Face3(i,n,r,[new h.Vector3(t[3*s],t[3*s+1],t[3*s+2]),new h.Vector3(c,d,a),new h.Vector3(f,p,l)],null,o))},f4n:function(e,t,i,n,r,o,s,a,l,c,d){s=e.materials[s];var f=t[3*l],p=t[3*l+1];l=t[3*l+2];var u=t[3*c],m=t[3*c+1];c=t[3*c+2];var g=t[3*d],v=t[3*d+1];d=t[3*d+2],e.faces.push(new h.Face4(i,n,r,o,[new h.Vector3(t[3*a],t[3*a+1],t[3*a+2]),new h.Vector3(f,p,l),new h.Vector3(u,m,c),new h.Vector3(g,v,d)],null,s))},uv3:function(e,t,i,n,r,o,s){var a=[];a.push(new h.UV(t,i)),a.push(new h.UV(n,r)),a.push(new h.UV(o,s)),e.push(a)},uv4:function(e,t,i,n,r,o,s,a,l){var c=[];c.push(new h.UV(t,i)),c.push(new h.UV(n,r)),c.push(new h.UV(o,s)),c.push(new h.UV(a,l)),e.push(c)}},window.Int32Array||(window.Int32Array=Array,window.Float32Array=Array),h.MarchingCubes=function(e,t){h.Object3D.call(this),this.materials=t instanceof Array?t:[t],this.init=function(e){this.isolation=80,this.size=e,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(3*this.size3),this.vlist=new Float32Array(36),this.nlist=new Float32Array(36),this.firstDraw=!0,this.maxCount=4096,this.count=0,this.hasPos=!1,this.hasNormal=!1,this.positionArray=new Float32Array(3*this.maxCount),this.normalArray=new Float32Array(3*this.maxCount)},this.lerp=function(e,t,i){return e+(t-e)*i},this.VIntX=function(e,t,i,n,r,o,s,a,h,l){r=(r-h)/(l-h),h=this.normal_cache,t[n]=o+r*this.delta,t[n+1]=s,t[n+2]=a,i[n]=this.lerp(h[e],h[e+3],r),i[n+1]=this.lerp(h[e+1],h[e+4],r),i[n+2]=this.lerp(h[e+2],h[e+5],r)},this.VIntY=function(e,t,i,n,r,o,s,a,h,l){r=(r-h)/(l-h),h=this.normal_cache,t[n]=o,t[n+1]=s+r*this.delta,t[n+2]=a,t=e+3*this.yd,i[n]=this.lerp(h[e],h[t],r),i[n+1]=this.lerp(h[e+1],h[t+1],r),i[n+2]=this.lerp(h[e+2],h[t+2],r)},this.VIntZ=function(e,t,i,n,r,o,s,a,h,l){r=(r-h)/(l-h),h=this.normal_cache,t[n]=o,t[n+1]=s,t[n+2]=a+r*this.delta,t=e+3*this.zd,i[n]=this.lerp(h[e],h[t],r),i[n+1]=this.lerp(h[e+1],h[t+1],r),i[n+2]=this.lerp(h[e+2],h[t+2],r)},this.compNorm=function(e){var t=3*e;0==this.normal_cache[t]&&(this.normal_cache[t]=this.field[e-1]-this.field[e+1],this.normal_cache[t+1]=this.field[e-this.yd]-this.field[e+this.yd],this.normal_cache[t+2]=this.field[e-this.zd]-this.field[e+this.zd])},this.polygonize=function(e,t,i,n,r,o){var s=n+1,a=n+this.yd,l=n+this.zd,c=s+this.yd,d=s+this.zd,f=n+this.yd+this.zd,p=s+this.yd+this.zd,u=0,m=this.field[n],g=this.field[s],v=this.field[a],y=this.field[c],_=this.field[l],x=this.field[d],b=this.field[f],w=this.field[p];m<r&&(u|=1),g<r&&(u|=2),v<r&&(u|=8),y<r&&(u|=4),_<r&&(u|=16),x<r&&(u|=32),b<r&&(u|=128),w<r&&(u|=64);var S=h.edgeTable[u];
1if(0==S)return 0;var M=this.delta,A=e+M,T=t+M;for(M=i+M,1&S&&(this.compNorm(n),this.compNorm(s),this.VIntX(3*n,this.vlist,this.nlist,0,r,e,t,i,m,g)),2&S&&(this.compNorm(s),this.compNorm(c),this.VIntY(3*s,this.vlist,this.nlist,3,r,A,t,i,g,y)),4&S&&(this.compNorm(a),this.compNorm(c),this.VIntX(3*a,this.vlist,this.nlist,6,r,e,T,i,v,y)),8&S&&(this.compNorm(n),this.compNorm(a),this.VIntY(3*n,this.vlist,this.nlist,9,r,e,t,i,m,v)),16&S&&(this.compNorm(l),this.compNorm(d),this.VIntX(3*l,this.vlist,this.nlist,12,r,e,t,M,_,x)),32&S&&(this.compNorm(d),this.compNorm(p),this.VIntY(3*d,this.vlist,this.nlist,15,r,A,t,M,x,w)),64&S&&(this.compNorm(f),this.compNorm(p),this.VIntX(3*f,this.vlist,this.nlist,18,r,e,T,M,b,w)),128&S&&(this.compNorm(l),this.compNorm(f),this.VIntY(3*l,this.vlist,this.nlist,21,r,e,t,M,_,b)),256&S&&(this.compNorm(n),this.compNorm(l),this.VIntZ(3*n,this.vlist,this.nlist,24,r,e,t,i,m,_)),512&S&&(this.compNorm(s),this.compNorm(d),this.VIntZ(3*s,this.vlist,this.nlist,27,r,A,t,i,g,x)),1024&S&&(this.compNorm(c),this.compNorm(p),this.VIntZ(3*c,this.vlist,this.nlist,30,r,A,T,i,y,w)),2048&S&&(this.compNorm(a),this.compNorm(f),this.VIntZ(3*a,this.vlist,this.nlist,33,r,e,T,i,v,b)),u<<=4,r=n=0;-1!=h.triTable[u+r];)t=(e=u+r)+1,i=e+2,this.posnormtriv(this.vlist,this.nlist,3*h.triTable[e],3*h.triTable[t],3*h.triTable[i],o),r+=3,n++;return n},this.posnormtriv=function(e,t,i,n,r,o){var s=3*this.count;this.positionArray[s]=e[i],this.positionArray[s+1]=e[i+1],this.positionArray[s+2]=e[i+2],this.positionArray[s+3]=e[n],this.positionArray[s+4]=e[n+1],this.positionArray[s+5]=e[n+2],this.positionArray[s+6]=e[r],this.positionArray[s+7]=e[r+1],this.positionArray[s+8]=e[r+2],this.normalArray[s]=t[i],this.normalArray[s+1]=t[i+1],this.normalArray[s+2]=t[i+2],this.normalArray[s+3]=t[n],this.normalArray[s+4]=t[n+1],this.normalArray[s+5]=t[n+2],this.normalArray[s+6]=t[r],this.normalArray[s+7]=t[r+1],this.normalArray[s+8]=t[r+2],this.hasPos=!0,this.hasNormal=!0,this.count+=3,this.count>=this.maxCount-3&&o(this)},this.begin=function(){this.count=0,this.hasPos=!1,this.hasNormal=!1},this.end=function(e){if(0!=this.count){for(var t=3*this.count;t<this.positionArray.length;t++)this.positionArray[t]=0;e(this)}},this.addBall=function(e,t,i,n,r){var o=this.size*Math.sqrt(n/r),s=i*this.size,a=t*this.size,h=e*this.size,l=Math.floor(s-o);l<1&&(l=1),(s=Math.floor(s+o))>this.size-1&&(s=this.size-1);var c=Math.floor(a-o);c<1&&(c=1),(a=Math.floor(a+o))>this.size-1&&(a=this.size-1);var d,f,p,u,m,g,v=Math.floor(h-o);for(v<1&&(v=1),(o=Math.floor(h+o))>this.size-1&&(o=this.size-1);l<s;l++)for(h=this.size2*l,m=(f=l/this.size-i)*f,f=c;f<a;f++)for(p=h+this.size*f,g=(d=f/this.size-t)*d,d=v;d<o;d++)(u=n/(1e-6+(u=d/this.size-e)*u+g+m)-r)>0&&(this.field[p+d]+=u)},this.addPlaneX=function(e,t){var i,n,r,o,s,a=this.size,h=this.yd,l=this.zd,c=this.field,d=a*Math.sqrt(e/t);for(d>a&&(d=a),i=0;i<d;i++)if(n=i/a,(o=e/(1e-4+(n*=n))-t)>0)for(n=0;n<a;n++)for(s=i+n*h,r=0;r<a;r++)c[l*r+s]+=o},this.addPlaneY=function(e,t){var i,n,r,o,s,a,h=this.size,l=this.yd,c=this.zd,d=this.field,f=h*Math.sqrt(e/t);for(f>h&&(f=h),n=0;n<f;n++)if(i=n/h,(o=e/(1e-4+(i*=i))-t)>0)for(s=n*l,i=0;i<h;i++)for(a=s+i,r=0;r<h;r++)d[c*r+a]+=o},this.addPlaneZ=function(e,t){var i,n,r,o,s,a;for(size=this.size,yd=this.yd,zd=this.zd,field=this.field,dist=size*Math.sqrt(e/t),dist>size&&(dist=size),r=0;r<dist;r++)if(i=r/size,(o=e/(1e-4+(i*=i))-t)>0)for(s=zd*r,n=0;n<size;n++)for(a=s+n*yd,i=0;i<size;i++)field[a+i]+=o},this.reset=function(){var e;for(e=0;e<this.size3;e++)this.normal_cache[3*e]=0,this.field[e]=0},this.render=function(e){this.begin();var t,i,n,r,o,s,a,h,l,c=this.size-2;for(r=1;r<c;r++)for(l=this.size2*r,a=(r-this.halfsize)/this.halfsize,n=1;n<c;n++)for(h=l+this.size*n,s=(n-this.halfsize)/this.halfsize,i=1;i<c;i++)o=(i-this.halfsize)/this.halfsize,t=h+i,this.polygonize(o,s,a,t,this.isolation,e);this.end(e)},this.generateGeometry=function(){var e=0,t=new h.Geometry;return this.render((function(i){var n,r,o,s,a,l,c,d;for(n=0;n<i.count;n++)c=(a=3*n)+1,d=a+2,r=i.positionArray[a],o=i.positionArray[c],s=i.positionArray[d],l=new h.Vector3(r,o,s),r=i.normalArray[a],o=i.normalArray[c],s=i.normalArray[d],(a=new h.Vector3(r,o,s)).normalize(),a=new h.Vertex(l,a),t.vertices.push(a);for(nfaces=i.count/3,n=0;n<nfaces;n++)c=(a=3*(e+n))+1,d=a+2,l=t.vertices[a].normal,r=t.vertices[c].normal,o=t.vertices[d].normal,a=new h.Face3(a,c,d,[l,r,o]),t.faces.push(a);e+=nfaces,i.count=0})),t},this.init(e)},h.MarchingCubes.prototype=new h.Object3D,h.MarchingCubes.prototype.constructor=h.MarchingCubes,h.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,23
109,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),h.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,
11,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,
16,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)});const b={id:"background-animation",class:"animation"};const w=e({name:"WavesAnimation",mounted(){this.genAnima()},methods:{genAnima(){let e,t,i,n,r,o,s=100,a=0,l=0,c=0,d=window.innerWidth/2,f=window.innerHeight/2;function p(e){l=e.clientX-d,c=e.clientY-f}function u(e){1==e.touches.length&&(e.preventDefault(),l=e.touches[0].pageX-d,c=e.touches[0].pageY-f)}function m(e){1==e.touches.length&&(e.preventDefault(),l=e.touches[0].pageX-d,c=e.touches[0].pageY-f)}!function(){e=document.getElementById("background-animation"),t=new h.Camera(75,window.innerWidth/window.innerHeight,1,1e4),t.position.z=1e3,i=new h.Scene,r=new Array;let a=2*Math.PI,l=new h.ParticleCanvasMaterial({color:16777215,opacity:.2,program:function(e){e.beginPath(),e.arc(0,0,.5,0,a,!0),e.closePath(),e.stroke()}}),c=0;for(let e=0;e<50;e++)for(let t=0;t<50;t++)o=r[c++]=new h.Particle(l),o.position.x=e*s-2500,o.position.z=t*s-2500,i.addObject(o);n=new h.CanvasRenderer,n.setSize(window.innerWidth,window.innerHeight),e.appendChild(n.domElement),document.addEventListener("mousemove",p,!1),document.addEventListener("touchstart",u,!1),document.addEventListener("touchmove",m,!1)}(),function e(){requestAnimationFrame(e),function(){t.position.x+=.05*(l-t.position.x),t.position.y+=.05*(-c-t.position.y);let e=0;for(let t=0;t<50;t++)for(let i=0;i<50;i++)o=r[e++],o.position.y=50*Math.sin(.3*(t+a))+50*Math.sin(.5*(i+a)),o.scale.x=o.scale.y=2*(Math.sin(.3*(t+a))+1)+2*(Math.sin(.5*(i+a))+1);n.render(i,t),a+=.1}()}()}}},[["render",function(e,i,r,o,s,a){return n(),t("div",b)}],["__scopeId","data-v-66fd4091"]]);export{w as default}; 2//# sourceMappingURL=8DupW_yk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.