!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.v3d=e.v3d||{})}(this,function(e){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.values&&(Object.values=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}),void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&i|128]+e[i>>8&255]+"-"+e[i>>16&255]+e[i>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]}}(),hashString:function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Ft.DEG2RAD},radToDeg:function(e){return e*Ft.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},expAverage:function(e,t,n,i){var r=Math.exp(-n/i);return e*r+(1-r)*t},angleToRange_0_2Pi:function(e){return this.clamp(e-2*Math.PI*Math.floor(e/(2*Math.PI)),0,2*Math.PI)}};function Rt(e,t){this.x=e||0,this.y=t||0}function Nt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("v3d.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function It(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function Dt(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function Ot(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("v3d.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(Rt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Rt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(n=new Rt,i=new Rt,function(e,t){return n.set(e,e),i.set(t,t),this.clamp(n,i)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}}),Object.assign(Nt.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Nt).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:(u=new Dt,function(e){var t=this.elements,n=e.elements,i=1/u.setFromMatrixColumn(e,0).length(),r=1/u.setFromMatrixColumn(e,1).length(),a=1/u.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("v3d.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){var h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=p*l-d,t[8]=h*l+f,t[1]=s*u,t[5]=f*l+h,t[9]=d*l-p,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=w-x*u,t[8]=b*u+_,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=_*u+b,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=x*u+w,t[5]=a*c,t[9]=_*u-b,t[2]=b*u-_,t[6]=o*c,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e._x,i=e._y,r=e._z,a=e._w,o=n+n,s=i+i,l=r+r,c=n*o,u=n*s,h=n*l,d=i*s,p=i*l,f=r*l,m=a*o,v=a*s,g=a*l;return t[0]=1-(d+f),t[4]=u-g,t[8]=h+v,t[1]=u+g,t[5]=1-(c+f),t[9]=p-m,t[2]=h-v,t[6]=p+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:(s=new Dt,l=new Dt,c=new Dt,function(e,t,n){var i=this.elements;return c.subVectors(e,t),0===c.lengthSq()&&(c.z=1),c.normalize(),s.crossVectors(n,c),0===s.lengthSq()&&(1===Math.abs(n.z)?c.x+=1e-4:c.z+=1e-4,c.normalize(),s.crossVectors(n,c)),s.normalize(),l.crossVectors(c,s),i[0]=s.x,i[4]=l.x,i[8]=c.x,i[1]=s.y,i[5]=l.y,i[9]=c.y,i[2]=s.z,i[6]=l.z,i[10]=c.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("v3d.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices(a, b) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=i[0],w=i[4],A=i[8],M=i[12],T=i[1],S=i[5],E=i[9],L=i[13],C=i[2],P=i[6],F=i[10],R=i[14],N=i[3],I=i[7],D=i[11],O=i[15];return r[0]=a*b+o*T+s*C+l*N,r[4]=a*w+o*S+s*P+l*I,r[8]=a*A+o*E+s*F+l*D,r[12]=a*M+o*L+s*R+l*O,r[1]=c*b+u*T+h*C+d*N,r[5]=c*w+u*S+h*P+d*I,r[9]=c*A+u*E+h*F+d*D,r[13]=c*M+u*L+h*R+d*O,r[2]=p*b+f*T+m*C+v*N,r[6]=p*w+f*S+m*P+v*I,r[10]=p*A+f*E+m*F+v*D,r[14]=p*M+f*L+m*R+v*O,r[3]=g*b+y*T+x*C+_*N,r[7]=g*w+y*S+x*P+_*I,r[11]=g*A+y*E+x*F+_*D,r[15]=g*M+y*L+x*R+_*O,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(o=new Dt,function(e){for(var t=0,n=e.count;t=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,l=l*m+d*b,c=c*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}}),Object.defineProperties(It.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(It.prototype,{set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("v3d.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"YXZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"ZXY"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"ZYX"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"YZX"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p):"XZY"===a&&(this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-l)*t,this._y=(a-c)*t,this._z=(o-r)*t):i>s&&i>h?(t=2*Math.sqrt(1+i-s-h),this._w=(u-l)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+c)/t):s>h?(t=2*Math.sqrt(1+s-i-h),this._w=(a-c)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(l+u)/t):(t=2*Math.sqrt(1+h-i-s),this._w=(o-r)/t,this._x=(a+c)/t,this._y=(l+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:(d=new Dt,function(e,t){return void 0===d&&(d=new Dt),(h=e.dot(t)+1)<1e-6?(h=0,Math.abs(e.x)>Math.abs(e.z)?d.set(-e.y,e.x,0):d.set(0,-e.z,e.y)):d.crossVectors(e,t),this._x=d.x,this._y=d.y,this._z=d.z,this._w=h,this.normalize()}),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},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=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions(a, b) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var l=Math.atan2(s,o),c=Math.sin((1-t)*l)/s,u=Math.sin(t*l)/s;return this._w=a*c+this._w*u,this._x=n*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Dt.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors(a, b) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(_=new It,function(e){return e&&e.isEuler||console.error("v3d.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(_.setFromEuler(e))}),applyAxisAngle:(x=new It,function(e,t){return this.applyQuaternion(x.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,this},project:(y=new Nt,function(e){return y.multiplyMatrices(e.projectionMatrix,y.getInverse(e.matrixWorld)),this.applyMatrix4(y)}),unproject:(g=new Nt,function(e){return g.multiplyMatrices(e.matrixWorld,g.getInverse(e.projectionMatrix)),this.applyMatrix4(g)}),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(m=new Dt,v=new Dt,function(e,t){return m.set(e,e,e),v.set(t,t,t),this.clamp(m,v)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("v3d.Vector3: .cross() now only accepts one argument. Use .crossVectors(a, b) instead."),this.crossVectors(e,t);var n=this.x,i=this.y,r=this.z;return this.x=i*e.z-r*e.y,this.y=r*e.x-n*e.z,this.z=n*e.y-i*e.x,this},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(f=new Dt,function(e){return f.copy(this).projectOnVector(e),this.sub(f)}),reflect:(p=new Dt,function(e){return this.sub(p.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Ft.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(Ot.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:(b=new Dt,function(e){for(var t=0,n=e.count;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(i)}),n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Se:e.x=e.x-Math.floor(e.x);break;case Ee:e.x=e.x<0?0:1;break;case Le:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Se:e.y=e.y-Math.floor(e.y);break;case Ee:e.y=e.y<0?0:1;break;case Le:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}},getMaxMipLevel:function(){var e=this.mipmaps.length;return e>0?e:void 0!==this.image?Math.ceil(Math.log2(Math.max(this.image.width,this.image.height))):8}}),Object.assign(Vt.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+c)/4,x=(l+d)/4,_=(h+p)/4;return m>v&&m>g?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):v>g?v<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(v)),r=_/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(g)),i=_/r),this.set(n,i,r,t),this}var b=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(l-d)/b,this.z=(c-s)/b,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===Ut&&(Ut=new Vt,Bt=new Vt),Ut.set(e,e,e,e),Bt.set(t,t,t,t),this.clamp(Ut,Bt)},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return 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,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Object.assign(Gt.prototype,t.prototype,{isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),jt.prototype=Object.create(Gt.prototype),jt.prototype.constructor=jt,jt.prototype.isWebGLRenderTargetCube=!0,Xt.prototype=Object.create(zt.prototype),Xt.prototype.constructor=Xt,Xt.prototype.isDataTexture=!0,Wt.prototype=Object.create(zt.prototype),Wt.prototype.constructor=Wt,Wt.prototype.isCubeTexture=!0,Object.defineProperty(Wt.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var Ht=new zt,Yt=new Wt;function qt(){this.seq=[],this.map={}}var Qt=[],Zt=[],Jt=new Float32Array(16),Kt=new Float32Array(9);function $t(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=Qt[r];if(void 0===a&&(a=new Float32Array(r),Qt[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function en(e,t){var n=Zt[t];void 0===n&&(n=new Int32Array(t),Zt[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocTextureUnit();return n}function tn(e,t){e.uniform1f(this.addr,t)}function nn(e,t){e.uniform1i(this.addr,t)}function rn(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function an(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function on(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function sn(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function ln(e,t){void 0===t.elements?e.uniformMatrix3fv(this.addr,!1,t):(Kt.set(t.elements),e.uniformMatrix3fv(this.addr,!1,Kt))}function cn(e,t){void 0===t.elements?e.uniformMatrix4fv(this.addr,!1,t):(Jt.set(t.elements),e.uniformMatrix4fv(this.addr,!1,Jt))}function un(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTexture2D(t||Ht,i)}function hn(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTextureCube(t||Yt,i)}function dn(e,t){e.uniform2iv(this.addr,t)}function pn(e,t){e.uniform3iv(this.addr,t)}function fn(e,t){e.uniform4iv(this.addr,t)}function mn(e,t){e.uniform1fv(this.addr,t)}function vn(e,t){e.uniform1iv(this.addr,t)}function gn(e,t){e.uniform2fv(this.addr,$t(t,this.size,2))}function yn(e,t){e.uniform3fv(this.addr,$t(t,this.size,3))}function xn(e,t){e.uniform4fv(this.addr,$t(t,this.size,4))}function _n(e,t){e.uniformMatrix2fv(this.addr,!1,$t(t,this.size,4))}function bn(e,t){e.uniformMatrix3fv(this.addr,!1,$t(t,this.size,9))}function wn(e,t){e.uniformMatrix4fv(this.addr,!1,$t(t,this.size,16))}function An(e,t,n){var i=t.length,r=en(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTexture2D(t[a]||Ht,r[a])}function Mn(e,t,n){var i=t.length,r=en(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTextureCube(t[a]||Yt,r[a])}function Tn(e,t,n){this.id=e,this.addr=n,this.setValue=function(e){switch(e){case 5126:return tn;case 35664:return rn;case 35665:return an;case 35666:return on;case 35674:return sn;case 35675:return ln;case 35676:return cn;case 35678:case 36198:return un;case 35680:return hn;case 5124:case 35670:return nn;case 35667:case 35671:return dn;case 35668:case 35672:return pn;case 35669:case 35673:return fn}}(t.type)}function Sn(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return mn;case 35664:return gn;case 35665:return yn;case 35666:return xn;case 35674:return _n;case 35675:return bn;case 35676:return wn;case 35678:return An;case 35680:return Mn;case 5124:case 35670:return vn;case 35667:case 35671:return dn;case 35668:case 35672:return pn;case 35669:case 35673:return fn}}(t.type)}function En(e){this.id=e,qt.call(this)}En.prototype.setValue=function(e,t){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var a=n[i];a.setValue(e,t[a.id])}};var Ln=/([\w\d_]+)(\])?(\[|\.)?/g;function Cn(e,t){e.seq.push(t),e.map[t.id]=t}function Pn(e,t,n){var i=e.name,r=i.length;for(Ln.lastIndex=0;;){var a=Ln.exec(i),o=Ln.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Cn(n,void 0===c?new Tn(s,e,t):new Sn(s,e,t));break}var u=n.map[s];void 0===u&&Cn(n,u=new En(s)),n=u}}function Fn(e,t,n){qt.call(this),this.renderer=n;for(var i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,i){if(t=Ft.euclideanModulo(t,1),n=Ft.clamp(n,0,1),i=Ft.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,a=2*i-r;this.r=e(a,r,t+1/3),this.g=e(a,r,t),this.b=e(a,r,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("v3d.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c,u=(c=n[1]).length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(c=Rn[e])?this.setHex(c):console.warn("v3d.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},convertSRGBToLinear:function(){function e(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}return this.r=e(this.r),this.g=e(this.g),this.b=e(this.b),this},convertLinearToSRGB:function(){function e(e){return e<=31308e-8?12.92*e:1.055*Math.pow(e,1/2.4)-.055}return this.r=e(this.r),this.g=e(this.g),this.b=e(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,i=e||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),l=Math.min(r,a,o),c=(l+s)/2;if(l===s)t=0,n=0;else{var u=s-l;switch(n=c<=.5?u/(s+l):u/(2-s-l),s){case r:t=(a-o)/u+(a 0.0) {\n#if defined (PHYSICALLY_CORRECT_LIGHTS)\n \n \n \n \n \n float distanceFalloff = 1.0 / max(pow(lightDistance, decayExponent), 0.01);\n float maxDistanceCutoffFactor = pow2(saturate(1.0 - pow4(lightDistance / cutoffDistance)));\n return distanceFalloff * maxDistanceCutoffFactor;\n#elif defined(BLENDER_LIGHTS)\n return cutoffDistance / (cutoffDistance + pow2(lightDistance));\n#else\n return pow(saturate(-lightDistance / cutoffDistance + 1.0), decayExponent);\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n} \nvec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\n \n \n \n \n float fresnel = exp2((-5.55473 * dotLH - 6.98316) * dotLH);\n return (1.0 - specularColor) * fresnel + specularColor;\n} \nfloat G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\n \n \n float a2 = pow2(alpha);\n float gl = dotNL + sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n float gv = dotNV + sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n return 1.0 / (gl * gv);\n} \nfloat G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n \n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; \n return RECIPROCAL_PI * a2 / pow2(denom);\n}\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n float alpha = pow2(roughness); \n vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n float dotNL = saturate(dot(geometry.normal, incidentLight.direction));\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNH = saturate(dot(geometry.normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (G * D);\n} \nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float theta = acos(dot(N, V));\n \n \n \n vec2 uv = vec2(\n sqrt(saturate(roughness)),\n saturate(theta / (0.5 * PI)));\n \n \n \n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor(const in vec3 f) {\n float l = length(f);\n return max((l * l + f.z) / (l + 1.0), 0.0);\n}\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2) {\n float x = dot(v1, v2);\n float y = abs(x);\n float a = 0.86267 + (0.49788 + 0.01436 * y) * y;\n float b = 3.45068 + (4.18814 + y) * y;\n float v = a / b;\n float theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt(1.0 - x * x) - v;\n return cross(v1, v2) * theta_sintheta;\n}\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n \n \n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if(dot(lightNormal, P - rectCoords[0]) < 0.0) return vec3(0.0);\n \n vec3 T1, T2;\n T1 = normalize(V - N * dot(V, N));\n T2 = - cross(N, T1); \n \n mat3 mat = mInv * transposeMat3(mat3(T1, T2, N));\n \n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n \n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n \n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n \n vec3 result = vec3(LTC_ClippedSphereFormFactor(vectorFormFactor));\n return result;\n}\nvec3 BRDF_Specular_GGX_Environment(const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n const vec4 c0 = vec4(- 1, - 0.0275, - 0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, - 0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(- 9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n} \nfloat G_BlinnPhong_Implicit() {\n \n return 0.25;\n}\nfloat D_BlinnPhong(const in float shininess, const in float dotNH) {\n return RECIPROCAL_PI * (shininess * 0.5 + 1.0) * pow(dotNH, shininess);\n}\nvec3 BRDF_Specular_BlinnPhong(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess) {\n vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n \n \n float dotNH = saturate(dot(geometry.normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_BlinnPhong_Implicit();\n float D = D_BlinnPhong(shininess, dotNH);\n return F * (G * D);\n} \nfloat GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n return (2.0 / pow2(ggxRoughness + 0.0001) - 2.0);\n}\nfloat BlinnExponentToGGXRoughness(const in float blinnExponent) {\n return sqrt(2.0 / (blinnExponent + 2.0));\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n \n \n \n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx(vUv);\n vec2 dSTdy = dFdy(vUv);\n float Hll = bumpScale * texture2D(bumpMap, vUv).x;\n float dBx = bumpScale * texture2D(bumpMap, vUv + dSTdx).x - Hll;\n float dBy = bumpScale * texture2D(bumpMap, vUv + dSTdy).x - Hll;\n return vec2(dBx, dBy);\n }\n vec3 perturbNormalArb(vec3 surf_pos, vec3 surf_norm, vec2 dHdxy) {\n \n vec3 vSigmaX = vec3(dFdx(surf_pos.x), dFdx(surf_pos.y), dFdx(surf_pos.z));\n vec3 vSigmaY = vec3(dFdy(surf_pos.x), dFdy(surf_pos.y), dFdy(surf_pos.z));\n vec3 vN = surf_norm; \n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n vec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\n return normalize(abs(fDet) * surf_norm - vGrad);\n }\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n for (int i = 0; i < UNION_CLIPPING_PLANES; ++ i) {\n vec4 plane = clippingPlanes[i];\n if (dot(vViewPosition, plane.xyz) > plane.w) discard;\n }\n \n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n for (int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i) {\n vec4 plane = clippingPlanes[i];\n clipped = (dot(vViewPosition, plane.xyz) > plane.w) && clipped;\n }\n if (clipped) discard;\n \n #endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n# if !defined(PHYSICAL) && !defined(PHONG) && !defined(NODE) && !defined(BLENDER)\n varying vec3 vViewPosition;\n# endif\n uniform vec4 clippingPlanes[NUM_CLIPPING_PLANES];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(NODE) && !defined(BLENDER)\n varying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(NODE) && !defined(BLENDER)\n vViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_3 0.333333333333\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp(a, 0.0, 1.0)\n#define whiteCompliment(a) (1.0 - saturate(a))\nfloat pow2(const in float x)\n{\n return x*x;\n}\nfloat pow3(const in float x)\n{\n return x*x*x;\n}\nfloat pow4(const in float x)\n{\n float x2 = x*x;\n return x2*x2;\n}\nfloat powCompat(const in float val, const in float power)\n{\n if (power == 0.0)\n return 1.0;\n else if (val < 0.0) {\n if (mod(-power, 2.0) == 0.0)\n return pow(-val, power);\n else\n return -pow(-val, power);\n } else if (val == 0.0)\n return 0.0;\n return pow(val, power);\n}\nfloat average(const in vec3 color)\n{\n return dot(color, vec3(0.3333));\n}\nhighp float rand(const in vec2 uv)\n{\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, PI);\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection(in vec3 dir, in mat4 matrix)\n{\n return normalize((matrix * vec4(dir, 0.0)).xyz);\n}\nvec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\n return normalize((vec4(dir, 0.0) * matrix).xyz);\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot(planeNormal, point - pointOnPlane);\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n return sign(dot(point - pointOnPlane, planeNormal));\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nmat3 transposeMat3(const in mat3 m) {\n mat3 tmp;\n tmp[0] = vec3(m[0].x, m[1].x, m[2].x);\n tmp[1] = vec3(m[0].y, m[1].y, m[2].y);\n tmp[2] = vec3(m[0].z, m[1].z, m[2].z);\n return tmp;\n}\nfloat linearToRelativeLuminance(const in vec3 color) {\n vec3 weights = vec3(0.2126, 0.7152, 0.0722);\n return dot(weights, color.rgb);\n}\nfloat maxFromRGB(vec3 rgb) {\n return max(max(rgb.r, rgb.g), rgb.b);\n}\nbool isOrtho(const in mat4 m) {\n if (m[3][3] != 0.0)\n return true;\n else\n return false;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if(absDirection.x > absDirection.z) {\n if(absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo(vec3 vec, float roughnessLevel, float roughness) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx(vec * scale * dxRoughness);\n vec3 dy = dFdy(vec * scale * dyRoughness);\n float d = max(dot(dx, dx), dot(dy, dy));\n \n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2(vec2(roughnessLevel, mipLevel));\n vec2 rcp_exp2_packed = vec2(1.0) / exp2_packed;\n \n float powScale = exp2_packed.x * exp2_packed.y;\n \n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n \n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if(face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if(face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if(face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if(face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if(face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = (r.yz / abs(r.x) + vec2(1.0)) * 0.5;\n vec2 base = offset + vec2(texelOffset);\n return base + s * (scale - 2.0 * texelOffset);\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n \n level0 += min(floor(s + 0.5), 5.0);\n \n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize(objectNormal) * (texture2D(displacementMap, uv).x * displacementScale + displacementBias);\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D(emissiveMap, vUv);\n emissiveColor.rgb = emissiveMapTexelToLinear(emissiveColor).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel(gl_FragColor);\n",encodings_pars_fragment:"\nvec4 LinearToLinear(in vec4 value) {\n return value;\n}\nvec4 GammaToLinear(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.xyz, vec3(gammaFactor)), value.w);\n}\nvec4 LinearToGamma(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.xyz, vec3(1.0 / gammaFactor)), value.w);\n}\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\n}\nvec4 LinearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\nvec4 RGBEToLinear(in vec4 value) {\n return vec4(value.rgb * exp2(value.a * 255.0 - 128.0), 1.0);\n}\nvec4 LinearToRGBE(in vec4 value) {\n float maxComponent = max(max(value.r, value.g), value.b);\n float fExp = clamp(ceil(log2(maxComponent)), -128.0, 127.0);\n return vec4(value.rgb / exp2(fExp), (fExp + 128.0) / 255.0);\n}\nvec4 RGBMToLinear(in vec4 value, in float maxRange) {\n return vec4(value.xyz * value.w * maxRange, 1.0);\n}\nvec4 LinearToRGBM(in vec4 value, in float maxRange) {\n float maxRGB = max(value.x, max(value.g, value.b));\n float M = clamp(maxRGB / maxRange, 0.0, 1.0);\n M = ceil(M * 255.0) / 255.0;\n return vec4(value.rgb / (M * maxRange), M);\n}\nvec4 RGBDToLinear(in vec4 value, in float maxRange) {\n return vec4(value.rgb * ((maxRange / 255.0) / value.a), 1.0);\n}\nvec4 LinearToRGBD(in vec4 value, in float maxRange) {\n float maxRGB = max(value.x, max(value.g, value.b));\n float D = max(maxRange / maxRGB, 1.0);\n D = min(floor(D) / 255.0, 1.0);\n return vec4(value.rgb * (D * (255.0 / maxRange)), D);\n}\nconst mat3 cLogLuvM = mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);\nvec4 LinearToLogLuv(in vec4 value) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);\nvec4 LogLuvToLinear(in vec4 value) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4(max(vRGB, 0.0), 1.0);\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER)\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n \n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect(cameraToVertex, worldNormal);\n #else\n vec3 reflectVec = refract(cameraToVertex, worldNormal, refractionRatio);\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleUV;\n reflectVec = normalize(reflectVec);\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D(envMap, sampleUV);\n #elif defined(ENVMAP_TYPE_SPHERE)\n reflectVec = normalize(reflectVec);\n vec3 reflectView = normalize((viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0, 0.0, 1.0));\n vec4 envColor = texture2D(envMap, reflectView.xy * 0.5 + 0.5);\n #else\n vec4 envColor = vec4(0.0);\n #endif\n envColor = envMapTexelToLinear(envColor);\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);\n #elif defined(ENVMAP_BLENDING_MIX)\n outgoingLight = mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);\n #elif defined(ENVMAP_BLENDING_ADD)\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",envmap_pars_fragment:"#if defined(USE_ENVMAP) || defined(PHYSICAL)\n uniform float reflectivity;\n uniform float envMapIntensity;\n uniform int envMapMaxMipLevel;\n#endif\n#ifdef USE_ENVMAP\n #if !defined(PHYSICAL) && (defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER))\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER) || defined(PHYSICAL)\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n# if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER)\n varying vec3 vWorldPosition;\n# else\n varying vec3 vReflect;\n uniform float refractionRatio;\n# endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER)\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize(worldPosition.xyz - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(transformedNormal, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect(cameraToVertex, worldNormal);\n #else\n vReflect = refract(cameraToVertex, worldNormal, refractionRatio);\n #endif\n #endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment(exp2(- fogDensity * fogDensity * fogDepth * fogDepth * LOG2));\n #else\n float fogFactor = smoothstep(fogNear, fogFar, fogDepth);\n #endif\n gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n uniform sampler2D gradientMap;\n vec3 getGradientIrradiance(vec3 normal, vec3 lightDirection) {\n \n float dotNL = dot(normal, lightDirection);\n vec2 coord = vec2(dotNL * 0.5 + 0.5, 0.0);\n #ifdef USE_GRADIENTMAP\n return texture2D(gradientMap, coord).rgb;\n #else\n return (coord.x < 0.7) ? vec3(0.7) : vec3(1.0);\n #endif\n }\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D(lightMap, vUv2).xyz * lightMapIntensity; \n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3(1.0);\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize(transformedNormal);\ngeometry.viewDir = normalize(-mvPosition.xyz);\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3(0.0);\n#ifdef DOUBLE_SIDED\n vLightBack = vec3(0.0);\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for (int i = 0; i < NUM_POINT_LIGHTS; i ++) {\n getPointDirectLightIrradiance(pointLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for (int i = 0; i < NUM_SPOT_LIGHTS; i ++) {\n getSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for (int i = 0; i < NUM_DIR_LIGHTS; i ++) {\n getDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for (int i = 0; i < NUM_HEMI_LIGHTS; i ++) {\n vLightFront += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance(hemisphereLights[i], backGeometry);\n #endif\n }\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance(const in vec3 ambientLightColor) {\n vec3 irradiance = ambientLightColor;\n \n#if defined(BLENDER_LIGHTS) || !defined(PHYSICALLY_CORRECT_LIGHTS)\n irradiance *= PI;\n#endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];\n void getDirectionalDirectLightIrradiance(const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLight pointLights[NUM_POINT_LIGHTS];\n \n void getPointDirectLightIrradiance(const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor(lightDistance, pointLight.distance, pointLight.decay);\n directLight.visible = (directLight.color != vec3(0.0));\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[NUM_SPOT_LIGHTS];\n \n void getSpotDirectLightIrradiance(const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n float angleCos = dot(directLight.direction, spotLight.direction);\n if (angleCos > spotLight.coneCos) {\n float spotEffect = smoothstep(spotLight.coneCos, spotLight.penumbraCos, angleCos);\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor(lightDistance, spotLight.distance, spotLight.decay);\n directLight.visible = true;\n } else {\n directLight.color = vec3(0.0);\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n \n \n uniform sampler2D ltcMat; \n uniform sampler2D ltcMag; \n uniform RectAreaLight rectAreaLights[NUM_RECT_AREA_LIGHTS];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[NUM_HEMI_LIGHTS];\n vec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight, const in GeometricContext geometry) {\n float dotNL = dot(geometry.normal, hemiLight.direction);\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix(hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight);\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined(USE_ENVMAP) && defined(PHYSICAL)\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel) {\n vec3 worldNormal = inverseTransformDirection(geometry.normal, viewMatrix);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n \n \n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryVec, float(maxMIPLevel));\n #else\n \n vec4 envMapColor = textureCube(envMap, queryVec, float(maxMIPLevel));\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n vec4 envMapColor = textureCubeUV(queryVec, 1.0);\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(queryVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(queryVec.z, queryVec.x) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, sampleUV, float(maxMIPLevel));\n #else\n vec4 envMapColor = texture2D(envMap, sampleUV, float(maxMIPLevel));\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #else\n vec4 envMapColor = vec4(0.0);\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n \n float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\n \n \n float maxMIPLevelScalar = float(maxMIPLevel);\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2(pow2(blinnShininessExponent) + 1.0);\n \n return clamp(desiredMIPLevel, 0.0, maxMIPLevelScalar);\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect(-geometry.viewDir, geometry.normal);\n #else\n vec3 reflectVec = refract(-geometry.viewDir, geometry.normal, refractionRatio);\n #endif\n reflectVec = inverseTransformDirection(reflectVec, viewMatrix);\n float specularMIPLevel = getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryReflectVec, specularMIPLevel);\n #else\n vec4 envMapColor = textureCube(envMap, queryReflectVec, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryReflectVec = vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleReflectUV;\n sampleReflectUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleReflectUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, sampleReflectUV, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, sampleReflectUV, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_SPHERE)\n vec3 reflectView = normalize((viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong(const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef TOON\n vec3 irradiance = getGradientIrradiance(geometry.normal, directLight.direction) * directLight.color;\n #else\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #endif\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD(material) (0)\n",lights_node_fragment:"BlenderMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseIntensity = diffuseIntensity;\nmaterial.specularColor = specular;\nmaterial.specularIntensity = specularIntensity;\nmaterial.specularHardness = specularHardness;\n",lights_node_pars_fragment:"\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\nstruct BlenderMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n#ifdef PHYSICAL\n float specularRoughness;\n# ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n# endif\n#else \n float diffuseIntensity;\n float specularIntensity;\n float specularHardness;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat shadeSpecPhong(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = max(dot(h, normal), 0.0);\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat shadeSpecHemi(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = 0.5 * max(dot(h, normal), 0.0) + 0.5;\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\nvoid RE_Direct_RectArea_Node(const in RectAreaLight rectAreaLight,\n const in GeometricContext geometry, const in BlenderMaterial material,\n inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos - halfWidth - halfHeight; \n rectCoords[1] = lightPos + halfWidth - halfHeight;\n rectCoords[2] = lightPos + halfWidth + halfHeight;\n rectCoords[3] = lightPos - halfWidth + halfHeight;\n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n float norm = texture2D(ltcMag, uv).a;\n vec4 t = texture2D(ltcMat, uv);\n mat3 mInv = mat3(\n vec3( 1, 0, t.y),\n vec3( 0, t.z, 0),\n vec3(t.w, 0, t.x)\n );\n reflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords); \n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1), rectCoords);\n}\n#endif\nvoid RE_Direct_Node(const in IncidentLight directLight,\n const in GeometricContext geometry, const in BlenderMaterial material,\n inout ReflectedLight reflectedLight)\n{\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n#endif\n#ifdef PHYSICAL\n# ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n# else\n float clearCoatDHR = 0.0;\n#endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry, material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n# ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX(directLight, geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n# endif\n#else\n reflectedLight.directDiffuse += irradiance * material.diffuseIntensity * BRDF_Diffuse_Lambert(material.diffuseColor);\n \n reflectedLight.directSpecular += material.specularIntensity *\n shadeSpecPhong(geometry.normal, directLight.direction,\n geometry.viewDir, material.specularHardness) *\n directLight.color * material.specularColor;\n#endif\n}\nvoid RE_IndirectDiffuse_Node(const in vec3 irradiance, const in\n GeometricContext geometry, const in BlenderMaterial material,\n inout ReflectedLight reflectedLight)\n{\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#ifdef PHYSICAL\nvoid RE_IndirectSpecular_Node(const in vec3 radiance, const in vec3 clearCoatRadiance,\n const in GeometricContext geometry, const in BlenderMaterial material,\n inout ReflectedLight reflectedLight) {\n# ifndef STANDARD\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNL = dotNV;\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n# else\n float clearCoatDHR = 0.0;\n# endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance * BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\n# ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment(geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n# endif\n}\n#else\n# if defined(BLENDER_LIGHTS) && NUM_HEMI_LIGHTS > 0\nvoid RE_HemiSpec_Blender(const in HemisphereLight hemiLight,\n const in GeometricContext geometry, const in BlenderMaterial material,\n inout ReflectedLight reflectedLight)\n{\n reflectedLight.indirectSpecular += material.specularIntensity *\n shadeSpecHemi(geometry.normal, hemiLight.direction,\n geometry.viewDir, material.specularHardness) *\n hemiLight.skyColor * material.specularColor;\n}\n# endif\n#endif \n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\n return saturate(pow(dotNV + ambientOcclusion, exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}\n#define RE_Direct RE_Direct_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_Direct_RectArea RE_Direct_RectArea_Node\n#ifdef PHYSICAL\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#endif\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * (1.0 - metalnessFactor);\nmaterial.specularRoughness = clamp(roughnessFactor, 0.04, 1.0);\n#ifdef STANDARD\n material.specularColor = mix(vec3(DEFAULT_SPECULAR_COEFFICIENT), diffuseColor.rgb, metalnessFactor);\n#else\n material.specularColor = mix(vec3(MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity)), diffuseColor.rgb, metalnessFactor);\n material.clearCoat = saturate(clearCoat); \n material.clearCoatRoughness = clamp(clearCoatRoughness, 0.04, 1.0);\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n #endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos - halfWidth - halfHeight; \n rectCoords[1] = lightPos + halfWidth - halfHeight;\n rectCoords[2] = lightPos + halfWidth + halfHeight;\n rectCoords[3] = lightPos - halfWidth + halfHeight;\n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n float norm = texture2D(ltcMag, uv).a;\n vec4 t = texture2D(ltcMat, uv);\n mat3 mInv = mat3(\n vec3( 1, 0, t.y),\n vec3( 0, t.z, 0),\n vec3(t.w, 0, t.x)\n );\n reflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords); \n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1), rectCoords);\n }\n#endif\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n #endif\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry, material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n #ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX(directLight, geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n}\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Physical(const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifndef STANDARD\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNL = dotNV;\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance * BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\n #ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment(geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\n return saturate(pow(dotNV + ambientOcclusion, exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize(vViewPosition);\nIncidentLight directLight;\n#if (NUM_POINT_LIGHTS > 0) && defined(RE_Direct)\n PointLight pointLight;\n for (int i = 0; i < NUM_POINT_LIGHTS; i ++) {\n pointLight = pointLights[i];\n getPointDirectLightIrradiance(pointLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(pointLight.shadow, directLight.visible)) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_SPOT_LIGHTS > 0) && defined(RE_Direct)\n SpotLight spotLight;\n for (int i = 0; i < NUM_SPOT_LIGHTS; i ++) {\n spotLight = spotLights[i];\n getSpotDirectLightIrradiance(spotLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(spotLight.shadow, directLight.visible)) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_DIR_LIGHTS > 0) && defined(RE_Direct)\n DirectionalLight directionalLight;\n for (int i = 0; i < NUM_DIR_LIGHTS; i ++) {\n directionalLight = directionalLights[i];\n getDirectionalDirectLightIrradiance(directionalLight, geometry, directLight);\n# ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(directionalLight.shadow, directLight.visible)) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n# endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_RECT_AREA_LIGHTS > 0) && defined(RE_Direct_RectArea)\n RectAreaLight rectAreaLight;\n for (int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++) {\n rectAreaLight = rectAreaLights[i];\n RE_Direct_RectArea(rectAreaLight, geometry, material, reflectedLight);\n }\n#endif\n#if defined(RE_IndirectDiffuse)\n vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n# ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n# ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI; \n# endif\n irradiance += lightMapIrradiance;\n# endif\n# if (NUM_HEMI_LIGHTS > 0)\n for (int i = 0; i < NUM_HEMI_LIGHTS; i ++) {\n irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n# if defined(BLENDER_LIGHTS) && !defined(PHYSICAL)\n RE_HemiSpec_Blender(hemisphereLights[i], geometry, material, reflectedLight);\n# endif\n }\n# endif\n# if defined(USE_ENVMAP)\n# if defined(PHYSICAL)\n int maxMipLevel = envMapMaxMipLevel;\n# else\n int maxMipLevel = 8;\n# endif\n# endif\n# if defined(USE_ENVMAP) && defined(PHYSICAL)\n irradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel);\n# endif\n RE_IndirectDiffuse(irradiance, geometry, material, reflectedLight);\n#endif \n#if defined(USE_ENVMAP) && defined(RE_IndirectSpecular)\n vec3 radiance = getLightProbeIndirectRadiance( geometry,\n Material_BlinnShininessExponent(material), maxMipLevel);\n #ifndef STANDARD\n vec3 clearCoatRadiance = getLightProbeIndirectRadiance(\n geometry, Material_ClearCoat_BlinnShininessExponent(material), maxMipLevel);\n #else\n vec3 clearCoatRadiance = vec3(0.0);\n #endif\n RE_IndirectSpecular(radiance, clearCoatRadiance, geometry, material, reflectedLight);\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2(max(EPSILON, gl_Position.w + 1.0)) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n vec2 uv = (uvTransform * vec3(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1)).xy;\n vec4 mapTexel = texture2D(map, uv);\n diffuseColor *= mapTexelToLinear(mapTexel);\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n uniform mat3 uvTransform;\n uniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D(metalnessMap, vUv);\n \n metalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal += (morphNormal0 - normal) * morphTargetInfluences[0];\n objectNormal += (morphNormal1 - normal) * morphTargetInfluences[1];\n objectNormal += (morphNormal2 - normal) * morphTargetInfluences[2];\n objectNormal += (morphNormal3 - normal) * morphTargetInfluences[3];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[8];\n #else\n uniform float morphTargetInfluences[4];\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed += (morphTarget0 - position) * morphTargetInfluences[0];\n transformed += (morphTarget1 - position) * morphTargetInfluences[1];\n transformed += (morphTarget2 - position) * morphTargetInfluences[2];\n transformed += (morphTarget3 - position) * morphTargetInfluences[3];\n #ifndef USE_MORPHNORMALS\n transformed += (morphTarget4 - position) * morphTargetInfluences[4];\n transformed += (morphTarget5 - position) * morphTargetInfluences[5];\n transformed += (morphTarget6 - position) * morphTargetInfluences[6];\n transformed += (morphTarget7 - position) * morphTargetInfluences[7];\n #endif\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n \n vec3 fdx = vec3(dFdx(vViewPosition.x), dFdx(vViewPosition.y), dFdx(vViewPosition.z));\n vec3 fdy = vec3(dFdy(vViewPosition.x), dFdy(vViewPosition.y), dFdy(vViewPosition.z));\n vec3 normal = normalize(cross(fdx, fdy));\n#else\n vec3 normal = normalize(vNormal);\n #ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n #endif\n#endif\n#ifdef USE_NORMALMAP\n #ifdef USE_NORMALMAP_TANGENTS\n \n \n normal = perturbNormalTang(vNormal);\n #else\n normal = perturbNormal2Arb(-vViewPosition, normal);\n #endif\n#elif defined(USE_BUMPMAP)\n normal = perturbNormalArb(-vViewPosition, normal, dHdxy_fwd());\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n #ifdef USE_NORMALMAP_TANGENTS\n uniform mat4 modelViewMatrix;\n varying vec4 vTangent;\n vec3 perturbNormalTang(vec3 normal) {\n vec3 normalTex = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n normalTex.xy *= normalScale;\n normalTex = normalize(normalTex);\n \n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(vTangent.xyz, 0.0)).xyz), vTangent.w);\n vec3 bitangent = -viewTangent.w * cross(normal, viewTangent.xyz);\n vec3 normalOut = normalTex.x * (viewTangent.xyz) + normalTex.y * bitangent \n + normalTex.z * normal;\n normalOut = normalize(normalOut);\n return normalOut;\n }\n #else\n \n \n vec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm) {\n \n vec3 q0 = vec3(dFdx(eye_pos.x), dFdx(eye_pos.y), dFdx(eye_pos.z));\n vec3 q1 = vec3(dFdy(eye_pos.x), dFdy(eye_pos.y), dFdy(eye_pos.z));\n vec2 st0 = dFdx(vUv.st);\n vec2 st1 = dFdy(vUv.st);\n vec3 S = normalize(q0 * st1.t - q1 * st0.t);\n vec3 T = normalize(-q0 * st1.s + q1 * st0.s);\n vec3 N = normalize(surf_norm);\n vec3 mapN = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3(S, T, N);\n return normalize(tsn * mapN);\n }\n #endif\n#endif\n",normalmap_pars_vertex:"#if defined(USE_NORMALMAP) || defined(USE_NORMALMAP_TANGENTS)\nattribute vec4 tangent;\nvarying vec4 vTangent;\n#endif",normalmap_vertex:"#if defined(USE_NORMALMAP) || defined(USE_NORMALMAP_TANGENTS)\n vTangent = tangent;\n#endif",packing:"vec3 packNormalToRGB(const in vec3 normal) {\n return normalize(normal) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal(const in vec3 rgb) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.; \nconst float UnpackDownscale = 255. / 256.; \nconst vec3 PackFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.);\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; \n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\nfloat viewZToOrthographicDepth(const in float viewZ, const in float near, const in float far) {\n return (viewZ + near) / (near - far);\n}\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\nfloat viewZToPerspectiveDepth(const in float viewZ, const in float near, const in float far) {\n return ((near + viewZ) * far) / ((far - near) * viewZ);\n}\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n \n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4(transformed, 1.0);\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined(DITHERING)\n gl_FragColor.rgb = dithering(gl_FragColor.rgb);\n#endif\n",dithering_pars_fragment:"#if defined(DITHERING)\n \n vec3 dithering(vec3 color) {\n \n float grid_position = rand(gl_FragCoord.xy);\n \n vec3 dither_shift_RGB = vec3(0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0);\n \n dither_shift_RGB = mix(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position);\n \n return color + dither_shift_RGB;\n }\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D(roughnessMap, vUv);\n \n roughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n \n float texture2DCompare(sampler2D depths, vec2 uv, float compare) {\n return step(compare, unpackRGBAToDepth(texture2D(depths, uv)));\n }\n float texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {\n const vec2 offset = vec2(0.0, 1.0);\n vec2 texelSize = vec2(1.0) / size;\n vec2 centroidUV = floor(uv * size + 0.5) / size;\n float lb = texture2DCompare(depths, centroidUV + texelSize * offset.xx, compare);\n float lt = texture2DCompare(depths, centroidUV + texelSize * offset.xy, compare);\n float rb = texture2DCompare(depths, centroidUV + texelSize * offset.yx, compare);\n float rt = texture2DCompare(depths, centroidUV + texelSize * offset.yy, compare);\n vec2 f = fract(uv * size + 0.5);\n float a = mix(lb, lt, f.y);\n float b = mix(rb, rt, f.y);\n float c = mix(a, b, f.x);\n return c;\n }\n float getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n \n \n bvec4 inFrustumVec = bvec4 (shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0);\n bool inFrustum = all(inFrustumVec);\n bvec2 frustumTestVec = bvec2(inFrustum, shadowCoord.z <= 1.0);\n bool frustumTest = all(frustumTestVec);\n if (frustumTest) {\n #if defined(SHADOWMAP_TYPE_PCF)\n vec2 texelSize = vec2(1.0) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n shadow = (\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n ) * (1.0 / 9.0);\n #elif defined(SHADOWMAP_TYPE_PCF_SOFT)\n vec2 texelSize = vec2(1.0) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n shadow = (\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n ) * (1.0 / 9.0);\n #else \n shadow = texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);\n #endif\n }\n return shadow;\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n vec2 cubeToUV(vec3 v, float texelSizeY) {\n \n vec3 absV = abs(v);\n \n float scaleToCube = 1.0 / max(absV.x, max(absV.y, absV.z));\n absV *= scaleToCube;\n \n \n v *= scaleToCube * (1.0 - 2.0 * texelSizeY);\n \n \n \n \n \n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if (absV.z >= almostOne) {\n if (v.z > 0.0)\n planar.x = 4.0 - v.x;\n } else if (absV.x >= almostOne) {\n float signX = sign(v.x);\n planar.x = v.z * signX + 2.0 * signX;\n } else if (absV.y >= almostOne) {\n float signY = sign(v.y);\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n \n \n \n return vec2(0.125, 0.25) * planar + vec2(0.375, 0.75);\n }\n float getPointShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar) {\n vec2 texelSize = vec2(1.0) / (shadowMapSize * vec2(4.0, 2.0));\n \n \n vec3 lightToPosition = shadowCoord.xyz;\n \n float dp = (length(lightToPosition) - shadowCameraNear) / (shadowCameraFar - shadowCameraNear); \n dp += shadowBias;\n \n vec3 bd3D = normalize(lightToPosition);\n #if defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\n vec2 offset = vec2(- 1, 1) * shadowRadius * texelSize.y;\n return (\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxx, texelSize.y), dp)\n ) * (1.0 / 9.0);\n #else \n return texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp);\n #endif\n }\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n \n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for (int i = 0; i < NUM_DIR_LIGHTS; i ++) {\n vDirectionalShadowCoord[i] = directionalShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for (int i = 0; i < NUM_SPOT_LIGHTS; i ++) {\n vSpotShadowCoord[i] = spotShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for (int i = 0; i < NUM_POINT_LIGHTS; i ++) {\n vPointShadowCoord[i] = pointShadowMatrix[i] * worldPosition;\n }\n #endif\n \n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for (int i = 0; i < NUM_DIR_LIGHTS; i ++) {\n directionalLight = directionalLights[i];\n shadow *= bool(directionalLight.shadow) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for (int i = 0; i < NUM_SPOT_LIGHTS; i ++) {\n spotLight = spotLights[i];\n shadow *= bool(spotLight.shadow) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for (int i = 0; i < NUM_POINT_LIGHTS; i ++) {\n pointLight = pointLights[i];\n shadow *= bool(pointLight.shadow) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n }\n #endif\n \n #endif\n return shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix(skinIndex.x);\n mat4 boneMatY = getBoneMatrix(skinIndex.y);\n mat4 boneMatZ = getBoneMatrix(skinIndex.z);\n mat4 boneMatW = getBoneMatrix(skinIndex.w);\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix(const in float i) {\n float j = i * 4.0;\n float x = mod(j, float(boneTextureSize));\n float y = floor(j / float(boneTextureSize));\n float dx = 1.0 / float(boneTextureSize);\n float dy = 1.0 / float(boneTextureSize);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(boneTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(boneTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(boneTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(boneTexture, vec2(dx * (x + 3.5), y));\n mat4 bone = mat4(v1, v2, v3, v4);\n return bone;\n }\n #else\n uniform mat4 boneMatrices[MAX_BONES];\n mat4 getBoneMatrix(const in float i) {\n mat4 bone = boneMatrices[int(i)];\n return bone;\n }\n #endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4(transformed, 1.0);\n vec4 skinned = vec4(0.0);\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = (bindMatrixInverse * skinned).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4(0.0);\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4(skinMatrix * vec4(objectNormal, 0.0)).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D(specularMap, vUv);\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined(TONE_MAPPING)\n gl_FragColor.rgb = toneMapping(gl_FragColor.rgb);\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp(a, 0.0, 1.0)\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping(vec3 color) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping(vec3 color) {\n color *= toneMappingExposure;\n return saturate(color / (vec3(1.0) + color));\n}\n#define Uncharted2Helper(x) max(((x * (0.15 * x + 0.10 * 0.50) + 0.20 * 0.02) / (x * (0.15 * x + 0.50) + 0.20 * 0.30)) - 0.02 / 0.30, vec3(0.0))\nvec3 Uncharted2ToneMapping(vec3 color) {\n \n color *= toneMappingExposure;\n return saturate(Uncharted2Helper(color) / Uncharted2Helper(vec3(toneMappingWhitePoint)));\n}\nvec3 OptimizedCineonToneMapping(vec3 color) {\n \n color *= toneMappingExposure;\n color = max(vec3(0.0), color - 0.004);\n return pow((color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06), vec3(2.2));\n}\n",uv_pars_fragment:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif",uv2_pars_fragment:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",uv2_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n vUv2 = uv2;\n#endif",worldpos_vertex:"#if defined(USE_ENVMAP) || defined(PHONG) || defined(NODE) || defined(BLENDER) || defined(PHYSICAL) || defined(LAMBERT) || defined(DISTANCE) || defined(USE_SHADOWMAP) || defined(MASK)\n vec4 worldPosition = modelMatrix * vec4(transformed, 1.0);\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n gl_FragColor = textureCube(tCube, vec3(tFlip * vWorldPosition.x, vWorldPosition.yz));\n gl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n vWorldPosition = transformDirection(position, modelMatrix);\n #include \n #include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(1.0);\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4(vec3(gl_FragCoord.z), opacity);\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n #include \n vec4 diffuseColor = vec4(1.0);\n #include \n #include \n #include \n float dist = length(vWorldPosition - referencePosition);\n dist = (dist - nearDistance) / (farDistance - nearDistance);\n dist = saturate(dist); \n gl_FragColor = packDepthToRGBA(dist);\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}\n",equicube_frag:"uniform sampler2D tEquirect;\nuniform int faceIndex;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec2 vUv;\n#include \nvoid main() {\n vec3 direction;\n vec2 uv = vUv * 2.0 - 1.0;\n if (faceIndex==0) {\n direction = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n direction = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n direction = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n direction = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n direction = vec3(uv.x, -uv.y, 1.0);\n } else {\n direction = vec3(-uv.x, -uv.y, -1.0);\n }\n direction = normalize(direction);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n gl_FragColor = texture2D(tEquirect, sampleUV);\n}\n",equicube_vert:"varying vec2 vUv;\n#include \nvoid main() {\n vUv = uv;\n #include \n #include \n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n vec3 direction = normalize(vWorldPosition);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n \n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n gl_FragColor = texture2D(tEquirect, sampleUV);\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n vWorldPosition = transformDirection(position, modelMatrix);\n #include \n #include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n if (mod(vLineDistance, totalSize) > dashSize) {\n discard;\n }\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include \n #include \n outgoingLight = diffuseColor.rgb; \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}\n",mask_frag:"#define MASK\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nuniform mat4 projectionMatrix;\nuniform float opacity;\nuniform sampler2D depthTexture;\nuniform vec2 cameraNearFar;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include \n vec4 diffuseColor = vec4(1.0);\n diffuseColor.a = opacity;\n #include \n #include \n #include \n #include \n float depth = unpackRGBAToDepth(texture2DProj(depthTexture, projTexCoord));\n float viewZ;\n if (isOrtho(projectionMatrix))\n viewZ = -orthographicDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n else\n viewZ = -perspectiveDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n float depthTest = (vViewPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 0.0);\n}\n",mask_vert:"#define MASK\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nuniform mat4 textureMatrix;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include \n #include \n#ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n#endif\n #include \n #include \n #include \n #include \n #include \n vViewPosition = -mvPosition.xyz;\n #include \n projTexCoord = textureMatrix * worldPosition;\n #include \n #include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(diffuse, opacity);\n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n \n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3(1.0);\n #endif\n \n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_ENVMAP\n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}\n",meshblender_frag:"#define BLENDER\nuniform vec3 diffuse;\nuniform float diffuseIntensity;\nuniform vec3 specular;\nuniform float specularIntensity;\nuniform float specularHardness;\nuniform float specularAlpha;\nuniform float shininess;\nuniform float opacity;\nuniform vec3 emissive;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n \n #include \n #include \n #include \n material.specularIntensity *= specularStrength;\n \n #include \n \n #include \n vec3 diff = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n vec3 spec = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n vec3 outgoingLight = saturate(diff + spec);\n #include \n float alpha = diffuseColor.a - saturate(maxFromRGB(spec) * specularAlpha) * (diffuseColor.a - 1.0);\n gl_FragColor = vec4(outgoingLight, alpha);\n #include \n #include \n #include \n #include \n #include \n}\n",meshblender_vert:"#define BLENDER\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#ifndef FLAT_SHADED \n \n vNormal = normalize(transformedNormal);\n#endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n \n reflectedLight.indirectDiffuse = getAmbientLightIrradiance(ambientLightColor);\n #include \n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb);\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = (gl_FrontFacing) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb) * getShadowMask();\n \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n #include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n \n #include \n #include \n \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n #include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}\n",meshnode_frag:"#define NODE\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD) || defined(NODE_MATERIAL) || defined(NODE_MATERIAL_EXT) || defined(NODE_NORMAL_MAP) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL)\nuniform mat4 invViewMatrix;\n#endif\n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL)\nuniform mat4 projectionMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD)\nuniform mat4 modelMatrix;\nuniform mat4 invModelMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_NORMAL_MAP) || defined(NODE_NORMAL_BUMP_MAX)\nuniform mat4 modelViewMatrix;\n#endif\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\nvarying vec3 vWorldPosition;\n#endif\n#include \n#include \nvoid main() {\n #include \n #include \n vec4 outgoingLight = vec4(0.0);\n #include \n \n #include \n#ifdef ALPHATEST\n if (outgoingLight.a < ALPHATEST)\n discard;\n else\n outgoingLight.a = 1.0;\n#endif\n gl_FragColor = vec4(outgoingLight);\n #include \n #include \n #include \n #include \n #include \n}\n",meshnode_vert:"#define NODE\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\nvarying vec3 vWorldPosition;\n#endif\n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\n vWorldPosition = worldPosition.xyz;\n#endif\n #include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n uniform float clearCoat;\n uniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n \n #include \n #include \n \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n #include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP)\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n gl_FragColor = vec4(packNormalToRGB(normal), opacity);\n}\n",normal_vert:"#define NORMAL\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP)\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP)\n vViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include \n #include \n #include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * (scale / - mvPosition.z);\n #else\n gl_PointSize = size;\n #endif\n #include \n #include \n #include \n #include \n #include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n gl_FragColor = vec4(color, opacity * (1.0 - getShadowMask()));\n #include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n}\n",node_common_frag:"\nvoid hsvToRGB(vec4 hsv, out vec4 outCol)\n{\n float i, f, p, q, t, h, s, v;\n vec3 rgb;\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n if (s == 0.0)\n rgb = vec3(v, v, v);\n else {\n if (h == 1.0)\n h = 0.0;\n h *= 6.0;\n i = floor(h);\n f = h - i;\n rgb = vec3(f, f, f);\n p = v * (1.0 - s);\n q = v * (1.0 - (s * f));\n t = v * (1.0 - (s * (1.0 - f)));\n if (i == 0.0)\n rgb = vec3(v, t, p);\n else if (i == 1.0)\n rgb = vec3(q, v, p);\n else if (i == 2.0)\n rgb = vec3(p, v, t);\n else if (i == 3.0)\n rgb = vec3(p, q, v);\n else if (i == 4.0)\n rgb = vec3(t, p, v);\n else\n rgb = vec3(v, p, q);\n }\n outCol = vec4(rgb, hsv.w);\n}\nvoid rgbToHSV(vec4 rgb, out vec4 outCol)\n{\n float cmax, cmin, h, s, v, cdelta;\n vec3 c;\n cmax = max(rgb[0], max(rgb[1], rgb[2]));\n cmin = min(rgb[0], min(rgb[1], rgb[2]));\n cdelta = cmax - cmin;\n v = cmax;\n if (cmax != 0.0)\n s = cdelta / cmax;\n else {\n s = 0.0;\n h = 0.0;\n }\n if (s == 0.0)\n h = 0.0;\n else {\n c = (vec3(cmax, cmax, cmax) - rgb.xyz) / cdelta;\n if (rgb.x == cmax) h = c[2] - c[1];\n else if (rgb.y == cmax) h = 2.0 + c[0] - c[2];\n else h = 4.0 + c[1] - c[0];\n h /= 6.0;\n if (h < 0.0)\n h += 1.0;\n }\n outCol = vec4(h, s, v, rgb.w);\n}\nbool isPerspective(const mat4 projMatrix)\n{\n return (projMatrix[3][3] == 0.0);\n}\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\nvec4 sampleEquirectangular(sampler2D map, vec3 reflectVec, mat3 uvTransform, int useSRGB)\n{\n reflectVec = normalize(reflectVec);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n \n sampleUV.x = atan(reflectVec.x, reflectVec.z) * RECIPROCAL_PI2 + 0.5;\n \n sampleUV.y *= -1.0;\n \n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n float seam = max(0.0, 1.0 - abs (reflectVec.x) / seamWidth) *\n clamp (1.0 - reflectVec.z / seamWidth, 0.0, 1.0);\n sampleUV = (uvTransform * vec3(sampleUV, 1.0)).xy;\n vec4 color = texture2D(map, sampleUV, seamBiasFactor * seam);\n if (useSRGB == 1)\n color = sRGBToLinear(color);\n return color;\n}\n#endif\n#if defined(NODE_FRESNEL) || defined(NODE_FALLOFF_MAX)\nfloat fresnelReflection(const vec3 dir, const vec3 normal, const float ior)\n{\n float cos1 = clamp(abs(dot(dir, normal)), -1.0, 1.0);\n float sin2 = 1.0 / ior * sqrt(max(0.0, 1.0 - cos1 * cos1));\n if (sin2 >= 1.0) {\n return 1.0;\n } else {\n float cos2 = sqrt(max(0.0, 1.0 - sin2 * sin2));\n cos1 = abs(cos1);\n float Rs = ((ior * cos1) - cos2) / ((ior * cos1) + cos2);\n float Rp = (cos1 - (ior * cos2)) / (cos1 + (ior * cos2));\n return (Rs * Rs + Rp * Rp) / 2.0;\n }\n}\n#endif\n",node_add_shader_frag:"void node_add_shader(vec4 color1, vec4 color2, out vec4 outColor)\n{\n outColor = color1 + color2;\n}\n",node_ambient_occlusion_frag:"void node_ambient_occlusion(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}\n",node_attribute_frag:"void node_attribute(\n vec3 paramAttr,\n out vec4 outColor, out vec3 outVector, out float outFac)\n{\n outColor = vec4(paramAttr, 1.0);\n outVector = paramAttr;\n outFac = average(paramAttr);\n}\n",node_background_frag:"void node_background(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}\n",node_blackbody_frag:"void node_blackbody(float temp, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_brightcontrast_frag:"\nvoid node_brightcontrast(vec4 color, float bright, float contrast, out vec4 outColor)\n{\n\tfloat bminc = bright - contrast * 0.5;\n\toutColor.r = max((1.0 + contrast) * color.r + bminc, 0.0);\n\toutColor.g = max((1.0 + contrast) * color.g + bminc, 0.0);\n\toutColor.b = max((1.0 + contrast) * color.b + bminc, 0.0);\n\toutColor.a = color.a;\n}\n",node_bsdf_anisotropic_frag:"void node_bsdf_anisotropic(\n vec4 color, float roughness, float anisotropy, float rotation, vec3 normal, vec3 tangent,\n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_diffuse_frag:"\nvoid node_bsdf_diffuse(\n const int normalBlendWorld,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n BlenderMaterial material;\n material.diffuseColor = color.rgb;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include \n outColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse, 1.0);\n}\n",node_bsdf_glass_frag:"void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_glossy_frag:"\nvoid node_bsdf_glossy(\n const int normalBlendWorld,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n BlenderMaterial material;\n material.specularColor = color.rgb;\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include \n outColor = vec4(reflectedLight.directSpecular + reflectedLight.indirectSpecular, 1.0);\n}\n",node_bsdf_hair_frag:"void node_bsdf_hair(vec4 color, float offset, float roughnessU, float roughnessV, vec3 tangent, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_principled_frag:"void node_bsdf_principled(\n const int normalBlendWorld,\n vec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\n float metallic, float specular, float specularTint, float roughness,\n float anisotropic, float anisotropicRotation, float sheen, float sheenTint,\n float clearcoat, float clearcoatRoughness, float ior,\n float transmission, float transmissionRoughness,\n vec3 normal, vec3 clearcoatNormal, vec3 tangent, \n out vec4 outColor)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n BlenderMaterial material;\n material.diffuseColor = baseColor.rgb * (1.0 - metallic);\n#ifdef STANDARD\n float dielRefl = DEFAULT_SPECULAR_COEFFICIENT * specular;\n#else\n float dielRefl = MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity) * specular;\n material.clearCoat = saturate(clearcoat); \n material.clearCoatRoughness = clamp(clearcoatRoughness, 0.04, 1.0);\n#endif\n material.specularColor = mix(vec3(dielRefl), baseColor.rgb, metallic);\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include \n vec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n outColor = vec4(saturate(outColor3), saturate(1.0-transmission));\n}\n",node_bsdf_refraction_frag:"void node_bsdf_refraction(\n vec4 color, float roughness, float ior, vec3 normal, \n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_toon_frag:"void node_bsdf_toon(\n vec4 color, float size, float smooth, vec3 normal, \n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_translucent_frag:"void node_bsdf_translucent(vec4 color, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_transparent_frag:"\nvoid node_bsdf_transparent(vec4 color, out vec4 outColor)\n{\n outColor = vec4(color.rgb, 0.0);\n}\n",node_bsdf_velvet_frag:"void node_bsdf_velvet(vec4 color, float sigma, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bump_frag:"void node_bump(\n const int normalBlendWorld,\n const float strength, const float dist, const float height, vec3 normal,\n out vec3 outNormal)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n \n outNormal = normal;\n \n outNormal = vec3(outNormal[0], -outNormal[2], outNormal[1]);\n}\n",node_camera_frag:"\nvoid node_camera(out vec3 outView, out float outDepth, out float outDist)\n{\n outView = vec3(0.0);\n outDepth = 0.0;\n outDist = 0.0;\n}\n",node_combhsv_frag:"\nvoid node_combhsv(float h, float s, float v, out vec4 col)\n{\n hsvToRGB(vec4(h, s, v, 1.0), col);\n}\n",node_combrgb_frag:"\nvoid node_combrgb(float r, float g, float b, out vec4 col)\n{\n col = vec4(r, g, b, 1.0);\n}\n",node_combxyz_frag:"void node_combxyz(float x, float y, float z, out vec3 outVector)\n{\n outVector = vec3(x, y, z);\n}\n",node_curve_rgb_frag:"\nvoid node_curve_rgb(sampler2D curveData, float fac, vec4 col, out vec4 outCol)\n{\n outCol.r = texture2D(curveData, vec2(texture2D(curveData, vec2(col.r, 0.0)).a, 0.0)).r;\n outCol.g = texture2D(curveData, vec2(texture2D(curveData, vec2(col.g, 0.0)).a, 0.0)).g;\n outCol.b = texture2D(curveData, vec2(texture2D(curveData, vec2(col.b, 0.0)).a, 0.0)).b;\n outCol = mix(col, outCol, fac);\n outCol.a = col.a;\n}\n",node_curve_vec_frag:"\nvoid node_curve_vec(sampler2D curveData, float fac, vec3 vec, out vec3 outVec)\n{\n outVec.x = texture2D(curveData, vec2((vec.x + 1.0) * 0.5, 0.0)).x;\n outVec.y = texture2D(curveData, vec2((vec.y + 1.0) * 0.5, 0.0)).y;\n outVec.z = texture2D(curveData, vec2((vec.z + 1.0) * 0.5, 0.0)).z;\n outVec = mix(vec, outVec * 2.0 - vec3(1.0), fac);\n}\n",node_emission_frag:"\nvoid node_emission(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}\n",node_fresnel_frag:"\nvoid node_fresnel(vec3 viewPos, float IOR, vec3 normal, out float fac)\n{\n vec3 worldDir;\n if (isPerspective(projectionMatrix))\n worldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\n else\n worldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n \n \n worldDir = normalize(vec3(worldDir[0], -worldDir[2], worldDir[1]));\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n}\n",node_gamma_frag:"\nvoid node_gamma(vec4 col, float gamma, out vec4 outCol)\n{\n outCol = col;\n if (col.r > 0.0)\n outCol.r = powCompat(col.r, gamma);\n if (col.g > 0.0)\n outCol.g = powCompat(col.g, gamma);\n if (col.b > 0.0)\n outCol.b = powCompat(col.b, gamma);\n}\n",node_geometry_frag:"\nvoid node_geometry(\n vec3 viewPos, vec3 viewNorm, vec3 orcoIn, vec2 uvIn, vec4 vcolIn,\n out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv,\n out vec3 normal, out vec4 vcol, out float vcolAlpha, out float frontBack)\n{\n \n local = -viewPos;\n \n view = (projectionMatrix[3][3] == 0.0) ? normalize(local) : vec3(0.0, 0.0, -1.0);\n global = (invViewMatrix * vec4(local, 1.0)).xyz;\n \n global = vec3(global[0], -global[2], global[1]);\n \n \n orco = global;\n \n uvIn.y = 1.0 - uvIn.y;\n uv = vec3(uvIn * 2.0 - vec2(1.0, 1.0), 0.0);\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n \n normal = vec3(normal[0], -normal[2], normal[1]);\n vcol = sRGBToLinear(vec4(vcolIn.rgb, 1.0));\n vcolAlpha = vcolIn.a;\n frontBack = (gl_FrontFacing) ? 1.0 : 0.0;\n}\n",node_hair_info_frag:"void node_hair_info(\n out float isStrand, out float intercept, out float thickness, out vec3 tangentNormal)\n{\n isStrand = 0.0;\n intercept = 0.0;\n thickness = 0.0;\n tangentNormal = vec3(0.0);\n}\n",node_holdout_frag:"void node_holdout(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_hue_sat_frag:"\nvoid node_hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outCol)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n hsv[0] += (hue - 0.5);\n if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;\n hsv[1] *= sat;\n if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;\n hsv[2] *= value;\n if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;\n hsvToRGB(hsv, outCol);\n outCol = mix(col, outCol, fac);\n}\n",node_invert_frag:"\nvoid node_invert(float fac, vec4 col, out vec4 outCol)\n{\n outCol.xyz = mix(col.xyz, vec3(1.0, 1.0, 1.0) - col.xyz, fac);\n outCol.w = col.w;\n}\n",node_lamp_frag:"\nvoid node_lamp(out vec4 outCol, out vec3 outLv, out float outDist, out vec4 outShadow, out float outVisibility)\n{\n outCol = vec4(0.0);\n outLv = vec3(0.0);\n outDist = 0.0;\n outShadow = vec4(0.0);\n outVisibility = 1.0;\n}\n",node_layer_weight_frag:"\nvoid node_layer_weight(vec3 viewPos, float blend, vec3 normal, out float fresnel, out float facing)\n{\n fresnel = 1.0;\n facing = 1.0;\n}\n",node_light_falloff_frag:"void node_light_falloff(\n float strength, float smooth,\n out float quadratic, out float linear, out float constant)\n{\n\tquadratic = 1.0;\n\tlinear = 1.0;\n\tconstant = 1.0;\n}\n",node_light_path_frag:"void node_light_path(\n out float isCameraRay, out float isShadowRay, out float isDiffuseRay, \n out float isGlossyRay, out float isSingularRay, out float isReflectionRay,\n out float isTransmissionRay, out float rayLength, out float rayDepth, \n out float diffuseDepth, out float glossyDepth, out float transparentDepth, \n out float transmissionDepth)\n{\n isCameraRay = 1.0;\n isShadowRay = 0.0;\n isDiffuseRay = 0.0;\n isGlossyRay = 0.0;\n isSingularRay = 0.0;\n isReflectionRay = 0.0;\n isTransmissionRay = 0.0;\n rayLength = 1.0;\n rayDepth = 1.0;\n diffuseDepth = 1.0;\n glossyDepth = 1.0;\n transparentDepth = 1.0; \n transmissionDepth = 1.0;\n}\n",node_mapping_frag:"\nvoid node_mapping(mat4 mat, vec3 minVec, vec3 maxVec, int useMin, int useMax, vec3 vec, out vec3 outVec)\n{\n outVec = (mat * vec4(vec, 1.0)).xyz;\n if (useMin == 1)\n outVec = max(outVec, minVec);\n if (useMax == 1)\n outVec = min(outVec, maxVec);\n}\n",node_material_ext_frag:"\nvoid node_material_ext(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal, const vec4 mirror, const float ambient, \n const float emit, const float specularAlpha, const float reflectivity,\n const float alpha, const float translucency,\n \n out vec4 outColor, out float outAlpha, out vec3 outNormal, out vec4 outDiffuse,\n out vec4 outSpec, out vec4 outAO)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n BlenderMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#include \n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(saturate(diffuse + specular), 1.0);\n outAlpha = alpha - saturate(maxFromRGB(specular) * specularAlpha) * (alpha - 1.0);\n outNormal = normal;\n outDiffuse = vec4(diffuse, 1.0);\n outSpec = vec4(specular, 1.0);\n \n outAO = vec4(1.0, 1.0, 1.0, 1.0);\n}\n",node_material_frag:"\nvoid node_material(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness, \n const float ambient, const float emit, const float alpha,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal,\n out vec4 outColor, out float outAlpha, out vec3 outNormal)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n BlenderMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include \n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(saturate(diffuse + specular), 1.0);\n \n outAlpha = alpha;\n \n outNormal = normalize(invViewMatrix * vec4(normal, 0.0)).rgb;\n \n outNormal = vec3(outNormal[0], -outNormal[2], outNormal[1]);\n}\n",node_math_frag:"\nvoid node_math_add(float val1, float val2, out float outVal)\n{\n outVal = val1 + val2;\n}\nvoid node_math_subtract(float val1, float val2, out float outVal)\n{\n outVal = val1 - val2;\n}\nvoid node_math_multiply(float val1, float val2, out float outVal)\n{\n outVal = val1 * val2;\n}\nvoid node_math_divide(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = val1 / val2;\n}\nvoid node_math_sine(float val, float val2, out float outVal)\n{\n outVal = sin(val);\n}\nvoid node_math_cosine(float val, float val2, out float outVal)\n{\n outVal = cos(val);\n}\nvoid node_math_tangent(float val, float val2, out float outVal)\n{\n outVal = tan(val);\n}\nvoid node_math_arcsine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = asin(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arccosine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = acos(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arctangent(float val, float val2, out float outVal)\n{\n outVal = atan(val);\n}\nvoid node_math_power(float val1, float val2, out float outVal)\n{\n if (val1 >= 0.0)\n outVal = powCompat(val1, val2);\n else {\n float val2_mod_1 = mod(abs(val2), 1.0);\n if (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)\n outVal = powCompat(val1, floor(val2 + 0.5));\n else\n outVal = 0.0;\n }\n}\nvoid node_math_logarithm(float val1, float val2, out float outVal)\n{\n if (val1 > 0.0 && val2 > 0.0)\n outVal = log2(val1) / log2(val2);\n else\n outVal = 0.0;\n}\nvoid node_math_maximum(float val1, float val2, out float outVal)\n{\n outVal = max(val1, val2);\n}\nvoid node_math_minimum(float val1, float val2, out float outVal)\n{\n outVal = min(val1, val2);\n}\nvoid node_math_round(float val1, float val2, out float outVal)\n{\n outVal = floor(val1 + 0.5);\n}\nvoid node_math_less_than(float val1, float val2, out float outVal)\n{\n if (val1 < val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_greater_than(float val1, float val2, out float outVal)\n{\n if (val1 > val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_modulo(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = mod(val1, val2);\n outVal = (val1 > 0.0) ? outVal : outVal - val2;\n}\nvoid node_math_absolute(float val1, float val2, out float outVal)\n{\n outVal = abs(val1);\n}\n",node_mix_rgb_frag:"\nvoid node_mix_rgb_mix(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_add(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 + col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_multiply(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 * col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_screen(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = vec4(1.0) - (vec4(facm) + fac * (vec4(1.0) - col2)) * (vec4(1.0) - col1);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_overlay(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (outCol.r < 0.5)\n outCol.r *= facm + 2.0 * fac * col2.r;\n else\n outCol.r = 1.0 - (facm + 2.0 * fac * (1.0 - col2.r)) * (1.0 - outCol.r);\n if (outCol.g < 0.5)\n outCol.g *= facm + 2.0 * fac * col2.g;\n else\n outCol.g = 1.0 - (facm + 2.0 * fac * (1.0 - col2.g)) * (1.0 - outCol.g);\n if (outCol.b < 0.5)\n outCol.b *= facm + 2.0 * fac * col2.b;\n else\n outCol.b = 1.0 - (facm + 2.0 * fac * (1.0 - col2.b)) * (1.0 - outCol.b);\n}\nvoid node_mix_rgb_subtract(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 - col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_divide(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (col2.r != 0.0) outCol.r = facm * outCol.r + fac * outCol.r / col2.r;\n if (col2.g != 0.0) outCol.g = facm * outCol.g + fac * outCol.g / col2.g;\n if (col2.b != 0.0) outCol.b = facm * outCol.b + fac * outCol.b / col2.b;\n}\nvoid node_mix_rgb_difference(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, abs(col1 - col2), fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_darken(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = min(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_lighten(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = max(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_dodge(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1;\n if (outCol.r != 0.0) {\n float tmp = 1.0 - fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 1.0;\n else if ((tmp = outCol.r / tmp) > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n }\n if (outCol.g != 0.0) {\n float tmp = 1.0 - fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 1.0;\n else if ((tmp = outCol.g / tmp) > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n }\n if (outCol.b != 0.0) {\n float tmp = 1.0 - fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 1.0;\n else if ((tmp = outCol.b / tmp) > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n }\n}\nvoid node_mix_rgb_burn(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float tmp, facm = 1.0 - fac;\n outCol = col1;\n tmp = facm + fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.r) / tmp)) < 0.0)\n outCol.r = 0.0;\n else if (tmp > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n tmp = facm + fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.g) / tmp)) < 0.0)\n outCol.g = 0.0;\n else if (tmp > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n tmp = facm + fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.b) / tmp)) < 0.0)\n outCol.b = 0.0;\n else if (tmp > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n}\nvoid node_mix_rgb_hue(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\nvoid node_mix_rgb_saturation(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2;\n rgbToHSV(outCol, hsv);\n if (hsv.y != 0.0) {\n rgbToHSV(col2, hsv2);\n hsv.y = facm * hsv.y + fac * hsv2.y;\n hsvToRGB(hsv, outCol);\n }\n}\nvoid node_mix_rgb_value(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 hsv, hsv2;\n rgbToHSV(col1, hsv);\n rgbToHSV(col2, hsv2);\n hsv.z = facm * hsv.z + fac * hsv2.z;\n hsvToRGB(hsv, outCol);\n}\nvoid node_mix_rgb_color(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsv.y = hsv2.y;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\nvoid node_mix_rgb_soft_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 one = vec4(1.0);\n vec4 scr = one - (one - col2) * (one - col1);\n outCol = facm * col1 + fac * ((one - col1) * col2 * col1 + col1 * scr);\n}\nvoid node_mix_rgb_linear_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1 + fac * (2.0 * (col2 - vec4(0.5)));\n}\n",node_mix_shader_frag:"\nvoid node_mix_shader(float fac, vec4 color1, vec4 color2, out vec4 outColor)\n{\n fac = clamp(fac, 0.0, 1.0);\n outColor = mix(color1, color2, fac);\n}\n",node_new_geometry_frag:"void node_new_geometry(\n vec3 viewPos, vec3 viewNorm, \n out vec3 position, out vec3 normal, out vec3 tangent,\n out vec3 trueNormal, out vec3 incoming, out vec3 parametric,\n out float backfacing, out float pointiness)\n{\n \n position = (invViewMatrix * vec4(-viewPos, 1.0)).xyz;\n \n position = vec3(position[0], -position[2], position[1]);\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n \n normal = vec3(normal[0], -normal[2], normal[1]);\n\ttangent = vec3(0.0);\n \n\ttrueNormal = normal;\n\tvec4 viewDir = isOrtho(projectionMatrix) ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(normalize(-viewPos), 0.0);\n viewDir = invViewMatrix * viewDir;\n \n\tincoming = -vec3(viewDir[0], -viewDir[2], viewDir[1]);\n\tparametric = vec3(0.0);\n\tbackfacing = (gl_FrontFacing) ? 0.0 : 1.0;\n\tpointiness = 0.5;\n}\n",node_normal_frag:"\nvoid node_normal(vec3 norParam, vec3 norIn, out vec3 norOut, out float dotOut)\n{\n norOut = norParam;\n dotOut = -dot(norIn, norParam);\n}\n",node_normal_map_frag:"\nvoid node_normal_map(vec4 tangent, vec3 normal, float strength, vec4 normalColor, out vec3 normalOut)\n{\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz), tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = mix(normal, normalOut, strength);\n normalOut = normalize((invViewMatrix * vec4(normalOut, 0.0)).xyz);\n \n normalOut = vec3(normalOut[0], -normalOut[2], normalOut[1]);\n}\n",node_object_info_frag:"\nvoid node_object_info(out vec3 location, out float objIndex, out float matIndex, out float random)\n{\n location = vec3(0.0);\n objIndex = 0.0;\n matIndex = 0.0;\n random = 0.5;\n}\n",node_output_frag:"\nvoid node_output(vec4 rgb, float alpha, out vec4 outgoingLight)\n{\n outgoingLight = vec4(rgb.rgb, alpha);\n}\n",node_output_lamp_frag:"void node_output_lamp(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_output_material_frag:"\nvoid node_output_material(vec4 surface, vec4 volume, float displacement, out vec4 outgoingLight)\n{\n outgoingLight = surface;\n}\n",node_output_world_frag:"void node_output_world(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_particle_info_frag:"\nvoid node_particle_info(out float index, out float age, out float lifeTime, out vec3 location,\n out float size, out vec3 velocity, out vec3 angularVelocity)\n{\n index = 0.0;\n age = 0.0;\n lifeTime = 0.0;\n location = vec3(1.0, 0.0, 0.0);\n size = 0.0;\n velocity = vec3(0.0);\n angularVelocity = vec3(0.0);\n}\n",node_rgb_frag:"\nuniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}\n",node_rgbtobw_frag:"\nvoid node_rgbtobw(vec4 color, out float outVal)\n{\n outVal = color.r * 0.35 + color.g * 0.45 + color.b * 0.2;\n}\n",node_script_frag:"void node_script(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_sephsv_frag:"\nvoid node_sephsv(vec4 col, out float h, out float s, out float v)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n}\n",node_seprgb_frag:"\nvoid node_seprgb(vec4 col, out float r, out float g, out float b)\n{\n r = col.r;\n g = col.g;\n b = col.b;\n}\n",node_sepxyz_frag:"void node_sepxyz(vec3 vector, out float x, out float y, out float z)\n{\n x = vector.x;\n y = vector.y;\n z = vector.z;\n}\n",node_squeeze_frag:"\nvoid node_squeeze(float val, float width, float center, out float outVal)\n{\n outVal = 1.0 / (1.0 + pow(2.71828183, -((val - center) * width)));\n}\n",node_subsurface_scattering_frag:"void node_subsurface_scattering(\n vec4 color, float scale, vec3 radius, float sharpen, float textureBlur, vec3 normal,\n out vec4 outColor)\n{\n outColor = color;\n}\n",node_tangent_frag:"void node_tangent(out vec3 outTangent)\n{\n outTangent = vec3(0.0);\n}\n",node_tex_brick_frag:"void node_tex_brick(\n vec3 vector, vec4 color1, vec4 color2, vec4 mortar, float scale,\n float mortarSize, float mortarSmooth, float bias, float brickWidth,\n float rowHeight,\n out vec4 outColor, out float fac)\n{\n outColor = color1;\n}\n",node_tex_checker_frag:"void node_tex_checker(vec3 vector, vec4 color1, vec4 color2, float scale, \n out vec4 outColor, out float fac)\n{\n outColor = color1;\n}\n",node_tex_coord_frag:"void node_tex_coord(\n vec3 viewPos, vec3 viewNorm, vec2 uv,\n out vec3 outGenerated, out vec3 outNormal, out vec3 outUV, out vec3 outObject,\n out vec3 outCamera, out vec3 outWindow, out vec3 outReflection)\n{\n vec4 view = vec4(-viewPos, 1.0);\n vec4 loc = invModelMatrix * invViewMatrix * view;\n \n \n outGenerated = vec3(loc[0], -loc[2], loc[1]);\n outNormal = normalize(invModelMatrix * invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n \n outNormal = vec3(outNormal[0], -outNormal[2], outNormal[1]);\n \n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n \n outObject = vec3(loc[0], -loc[2], loc[1]);\n \n outCamera = vec3(view.xy, -view.z);\n \n outWindow = vec3(0.0);\n vec4 reflection = (invViewMatrix * vec4(reflect(view.xyz, normalize(viewNorm)), 0.0));\n \n outReflection = vec3(reflection[0], -reflection[2], reflection[1]);\n}\n",node_tex_environment_frag:"void node_tex_environment(vec3 vector, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_tex_gradient_frag:"void node_tex_gradient(vec3 vector, out vec4 outColor, out float fac)\n{\n outColor = vec4(0.0);\n}\n",node_tex_image_frag:"void node_tex_image(\n sampler2D ima, const int useSRGB, \n vec3 vector,\n out vec4 outColor, out float outAlpha)\n{\n vec2 uv = vector.xy;\n \n uv.y = 1.0 - uv.y;\n outColor = texture2D(ima, uv);\n outAlpha = outColor.a;\n if (useSRGB == 1)\n outColor = sRGBToLinear(outColor);\n}\n",node_tex_image_none_frag:"\nvoid node_tex_image_none(vec3 vector, out vec4 color, out float alpha)\n{\n color = vec4(1.0, 0.0, 1.0, 1.0);\n alpha = 1.0;\n}\n",node_tex_magic_frag:"void node_tex_magic(vec3 vector, float scale, float distortion,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}\n",node_tex_musgrave_frag:"void node_tex_musgrave(\n vec3 vector, float scale, float detail, float dimension, float lacunarity,\n float offset, float gain,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}\n",node_tex_noise_frag:"void node_tex_noise(\n vec3 vector, float scale, float detail, float distortion,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}\n",node_tex_pointdensity_frag:"void node_tex_pointdensity(\n vec3 vector,\n out vec4 outColor, out float outDensity)\n{\n outColor = vec4(0.0);\n outDensity = 0.0;\n}\n",node_tex_sky_frag:"void node_tex_sky(vec3 vector, out vec4 outColor)\n{\n outColor = vec4(1.0);\n}\n",node_tex_voronoi_frag:"void node_tex_voronoi(vec3 vector, float scale, \n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.5);\n outFac = 0.0;\n}\n",node_tex_wave_frag:"void node_tex_wave(\n vec3 vector, float scale, float distortion, float detail, float detailScale, \n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.5);\n}\n",node_texture_cube_frag:"\nuniform float flipCubeMap;\nvoid node_texture_cube(samplerCube ima, const int useSRGB, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec = vec3(flipCubeMap * vec.x, vec.z, -vec.y);\n color = textureCube(ima, vec);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n if (useSRGB == 1)\n color = sRGBToLinear(color);\n}\n",node_texture_frag:"\nvoid node_texture(sampler2D ima, const int useSRGB, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec2 uv = (vec.xy + vec2(1.0, 1.0)) * 0.5;\n \n uv.y = 1.0 - uv.y;\n color = texture2D(ima, uv);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n if (useSRGB == 1)\n color = sRGBToLinear(color);\n}\n",node_texture_none_frag:"\nvoid node_texture_none(vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n value = 0.0;\n color = vec4(0.0);\n normal = vec3(0.0);\n}\n",node_uvmap_frag:"void node_uvmap(vec2 uv, out vec3 outUV)\n{\n \n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n}\n",node_valtorgb_frag:"\nvoid node_valtorgb(sampler2D colormap, float fac, out vec4 colOut, out float alphaOut)\n{\n colOut = texture2D(colormap, vec2(fac, 0.0));\n alphaOut = colOut.a;\n}\n",node_value_frag:"\nuniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\n outVal = val;\n}\n",node_vect_math_frag:"\nvoid node_vect_math_add(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 - v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_average(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = length(outVec);\n outVec = normalize(outVec);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = vec3(0, 0, 0);\n outVal = dot(v1, v2);\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = cross(v1, v2);\n outVal = length(outVec);\n outVec /= outVal;\n}\nvoid node_vect_math_normalize(vec3 v, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVal = length(v);\n outVec = normalize(v);\n}\n",node_vect_transform_frag:"\n#define VEC_TRANS_NONE 0\n#define VEC_TRANS_W_O 1\n#define VEC_TRANS_W_C 2\n#define VEC_TRANS_O_W 3\n#define VEC_TRANS_O_C 4\n#define VEC_TRANS_C_W 5\n#define VEC_TRANS_C_O 6\n#define VEC_TRANS_W_O_DIR 7\n#define VEC_TRANS_W_C_DIR 8\n#define VEC_TRANS_O_W_DIR 9\n#define VEC_TRANS_O_C_DIR 10\n#define VEC_TRANS_C_W_DIR 11\n#define VEC_TRANS_C_O_DIR 12\nvoid node_vect_transform(const int vecTransType, vec3 vIn, out vec3 vOut)\n{\n if (vecTransType == VEC_TRANS_NONE)\n vOut = vIn;\n else {\n vec4 vec;\n if (vecTransType < VEC_TRANS_W_O_DIR)\n vec = vec4(vIn.xyz, 1.0);\n else\n vec = vec4(vIn.xyz, 0.0);\n if (vecTransType == VEC_TRANS_W_O || vecTransType == VEC_TRANS_W_O_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = invModelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_W_C || vecTransType == VEC_TRANS_W_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = viewMatrix * vec;\n } else if (vecTransType == VEC_TRANS_O_W || vecTransType == VEC_TRANS_O_W_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_O_C || vecTransType == VEC_TRANS_O_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelViewMatrix * vec;\n } else if (vecTransType == VEC_TRANS_C_W || vecTransType == VEC_TRANS_C_W_DIR) {\n vec = invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_C_O || vecTransType == VEC_TRANS_C_O_DIR) {\n vec = invModelMatrix * invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n }\n vOut = vec.xyz;\n }\n}\n",node_volume_absorption_frag:"void node_volume_absorption(vec4 color, float density, out vec4 outColor)\n{\n outColor = color;\n}\n",node_volume_scatter_frag:"void node_volume_scatter(vec4 color, float density, float anisotropy, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_wavelength_frag:"void node_wavelength(float wavelength, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_wireframe_frag:"void node_wireframe(float size, out float outFac)\n{\n outFac = 0.0;\n}\n",node_bitmap_none_max_frag:"\nvoid node_bitmap_none_max(out vec4 color)\n{\n color = vec4(1.0);\n}\n",node_bitmap_env_max_frag:"\nvoid node_bitmap_env_max(sampler2D envMap, vec3 viewNormal, float bumpFactor, \n int modeReflection, float IOR,\n const int useSRGB, const mat3 uvTransform, const int alphaAsMono,\n const int alphaAsRGB, vec3 bumpNormal, out vec4 color, out float value)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n if (modeReflection == 1)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n color = sampleEquirectangular(envMap, reflectVec, uvTransform, useSRGB);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}\n",node_bitmap_max_frag:"\nvoid node_bitmap_max(sampler2D map, const vec2 uvIn, const int useSRGB,\n const mat3 uvTransform, const int alphaAsMono, const int alphaAsRGB,\n out vec4 color, out float value)\n{\n vec2 uv = (uvTransform * vec3(uvIn, 1.0)).xy;\n color = texture2D(map, uv);\n if (useSRGB == 1)\n color = sRGBToLinear(color);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}\n",node_bump_max_frag:"\nvoid node_bump_max(sampler2D bumpMap, const vec3 eyePos, const vec3 normal, const vec2 uv,\n out vec3 normalOut)\n{\n vec2 dSTdx = dFdx(uv);\n vec2 dSTdy = dFdy(uv);\n if (any(equal(dSTdx, vec2(0.0))) || any(equal(dSTdy, vec2(0.0)))) {\n normalOut = normal;\n } else {\n const float bumpScale = 1.0;\n vec3 vSigmaX = vec3(dFdx(eyePos.x), dFdx(eyePos.y), dFdx(eyePos.z));\n vec3 vSigmaY = vec3(dFdy(eyePos.x), dFdy(eyePos.y), dFdy(eyePos.z));\n vec3 vN = normal;\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n float Hll = bumpScale * texture2D(bumpMap, uv).x;\n float dBx = bumpScale * texture2D(bumpMap, uv + dSTdx).x - Hll;\n float dBy = bumpScale * texture2D(bumpMap, uv + dSTdy).x - Hll;\n vec2 dHdxy = vec2(dBx, dBy);\n vec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\n normalOut = normalize(abs(fDet) * normal - vGrad);\n }\n}\n",node_color_correction_max_frag:"#define REWIRE_RED 0\n#define REWIRE_GREEN 1\n#define REWIRE_BLUE 2\n#define REWIRE_ALPHA 3\n#define REWIRE_RED_INV 4\n#define REWIRE_GREEN_INV 5\n#define REWIRE_BLUE_INV 6\n#define REWIRE_ALPHA_INV 7\n#define REWIRE_MONOCHROME 8\n#define REWIRE_ONE 9\n#define REWIRE_ZERO 10\nfloat rewireChannel(int type, vec4 color)\n{\n if (type == REWIRE_RED)\n return color.r;\n else if (type == REWIRE_GREEN)\n return color.g;\n else if (type == REWIRE_BLUE)\n return color.b;\n else if (type == REWIRE_ALPHA)\n return color.a;\n else if (type == REWIRE_RED_INV)\n return 1.0-color.r;\n else if (type == REWIRE_GREEN_INV)\n return 1.0-color.g;\n else if (type == REWIRE_BLUE_INV)\n return 1.0-color.b;\n else if (type == REWIRE_ALPHA_INV)\n return 1.0-color.a;\n else if (type == REWIRE_MONOCHROME)\n return average(color.rgb);\n else if (type == REWIRE_ONE)\n return 1.0;\n else\n return 0.0;\n}\nvoid node_color_correction_max(const ivec4 rewire,\n const float hueShift, const float saturation,\n const float brightness, const float contrast,\n const vec4 color, out vec4 outColor)\n{\n \n if (all(equal(rewire, ivec4(REWIRE_RED, REWIRE_GREEN, REWIRE_BLUE, REWIRE_ALPHA)))) {\n outColor = color;\n } else {\n outColor.r = rewireChannel(rewire.x, color);\n outColor.g = rewireChannel(rewire.y, color);\n outColor.b = rewireChannel(rewire.z, color);\n outColor.a = rewireChannel(rewire.w, color);\n }\n vec4 hsv;\n rgbToHSV(outColor, hsv);\n hsv[0] += (hueShift - 0.5);\n if (hsv[0] > 1.0)\n hsv[0] -= 1.0;\n else if (hsv[0] < 0.0)\n hsv[0] += 1.0;\n \n hsv[1] *= saturation;\n hsv[1] = saturate(hsv[1]);\n hsvToRGB(hsv, outColor);\n outColor = (outColor - 0.5) * contrast + 0.5 + brightness;\n}\n",node_color_map_max_frag:"\nvoid node_color_map_max(const vec4 colorIn, out vec4 color)\n{\n color = colorIn;\n}\n",node_falloff_max_frag:"\nvoid node_falloff_max(vec3 viewPos, float IOR, vec3 normal, float bumpFactor,\n const vec4 color1, const vec4 color2, vec3 bumpNormal, out vec4 color)\n{\n normal = normalize(mix(normal, bumpNormal, bumpFactor));\n float fac;\n \n vec3 dir = normalize(viewPos);\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(dir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n color = mix(color1, color2, fac);\n}\n",node_map_max_frag:"\nvoid node_map_max(const vec4 colorIn, out vec4 color)\n{\n color = colorIn;\n}\n",node_mask_max_frag:"\nvoid node_map_max(const vec4 colorIn, const vec4 mask, out vec4 color)\n{\n color = colorIn;\n}\n",node_material_max_frag:"\nvoid node_material_max(\n const vec3 viewNormal, \n const float bumpFactor, float reflectionRatio, const float refractionRatio,\n const int selfIllumColorOn,\n const vec4 ambientColor, const vec4 diffuseColor, const vec4 specularColor,\n const float glossiness, const float specularLevel, const vec4 selfIllum,\n const float opacity, const vec4 filterColor, const vec3 bumpNormal,\n const vec4 reflection, const vec4 refraction, const float displacement,\n out vec4 outColor, out float outAlpha)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 diffuse, specular;\n BlenderMaterial material;\n material.diffuseColor = diffuseColor.rgb;\n material.specularColor = specularColor.rgb;\n material.diffuseIntensity = 1.0;\n material.specularHardness = 4.0 * exp2(glossiness * 10.0);\n material.specularIntensity = specularLevel;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#include \n vec3 totalEmissiveRadiance;\n if (selfIllumColorOn == 1)\n totalEmissiveRadiance = selfIllum.rgb;\n else\n totalEmissiveRadiance = vec3(selfIllum[0] * material.diffuseColor);\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n float specularStrength = maxFromRGB(specular);\n outColor = vec4(saturate(diffuse + specular), 1.0);\n \n outAlpha = opacity - saturate(maxFromRGB(specular)) * (opacity - 1.0);\n outColor += reflection * specularColor * reflectionRatio;\n outColor += refraction * refractionRatio;\n \n outAlpha += saturate(maxFromRGB(reflection.rgb) * maxFromRGB(specularColor.rgb)) * reflectionRatio;\n outAlpha += saturate(maxFromRGB(refraction.rgb)) * refractionRatio;\n}\n",node_mix_max_frag:"\nvoid node_mix_max(const vec4 color1, const vec4 color2, const float amount, out vec4 color)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}\n",node_normal_bump_max_frag:"\nvoid node_normal_bump_max(const vec4 tangent, const vec3 normal, ivec2 flip,\n vec4 normalColor, const vec3 additionalBump, out vec3 normalOut)\n{\n if (flip[0] == 1)\n normalColor.x = 1.0 - normalColor.x;\n \n if (flip[1] == 0)\n normalColor.y = 1.0 - normalColor.y;\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz, tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = normalize(normalOut + additionalBump);\n}\n",node_reflect_refract_max_frag:"\nvoid node_reflect_refract_max(sampler2D envMap, vec3 viewNormal, float bumpFactor,\n int modeReflection, const float IOR, const int useSRGB,\n \n vec3 bumpNormal, out vec4 color)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n if (modeReflection == 1)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n reflectVec = normalize(reflectVec);\n color = sampleEquirectangular(envMap, reflectVec, mat3(1.0), useSRGB);\n}\n",node_reflect_refract_color_max_frag:"\nvoid node_reflect_refract_color_max(const vec4 colorIn, out vec4 color)\n{\n color = vec4(colorIn);\n}\n",node_rgb_multiply_max_frag:"\nvoid node_rgb_multiply_max(const vec4 color1, const vec4 color2, out vec4 color)\n{\n color = color1 * color2;\n}\n",node_shellac_max_frag:"\nvoid node_shellac_max(const vec4 color1, const vec4 color2, const float amount,\n out vec4 color, out float alpha)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n \n alpha = color.a;\n}\n",node_vertex_color_max_frag:"\nvoid node_vertex_color_max(vec3 color, out vec4 outColor)\n{\n outColor = vec4(color, 1.0);\n}\n",pp_plane_vert:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",pp_bokeh_frag:"#include \nvarying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur; \nuniform float aperture; \nuniform float nearClip;\nuniform float farClip;\nuniform float focus;\nuniform float aspect;\n#include \nfloat getDepth(const in vec2 screenPosition) {\n#if DEPTH_PACKING == 1\n return unpackRGBAToDepth(texture2D(tDepth, screenPosition));\n#else\n return texture2D(tDepth, screenPosition).x;\n#endif\n}\nfloat getViewZ(const in float depth) {\n#if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, nearClip, farClip);\n#else\n return orthoDepthToViewZ(depth, nearClip, farClip);\n#endif\n}\nvoid main() {\n vec2 aspectcorrect = vec2(1.0, aspect);\n \n float viewZ = getViewZ(getDepth(vUv));\n \n float factor = (focus + viewZ); \n \n vec2 dofblur = vec2 (clamp(factor * aperture, -maxblur, maxblur));\n \n vec2 dofblur9 = dofblur * 0.9;\n vec2 dofblur7 = dofblur * 0.7;\n vec2 dofblur4 = dofblur * 0.4;\n \n vec4 col = vec4(0.0);\n \n col += texture2D(tColor, vUv.xy);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.15, 0.37) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.29, 0.29) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.37, 0.15) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.37, -0.15) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.29, -0.29) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.15, -0.37) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.15, 0.37) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, 0.29) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.37, 0.15) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.37, -0.15) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, -0.29) * aspectcorrect) * dofblur);\n col += texture2D(tColor, vUv.xy + (vec2( 0.15, -0.37) * aspectcorrect) * dofblur);\n \n col += texture2D(tColor, vUv.xy + (vec2( 0.15, 0.37) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2(-0.37, 0.15) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2( 0.37, -0.15) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2(-0.15, -0.37) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2(-0.15, 0.37) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2( 0.37, 0.15) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2(-0.37, -0.15) * aspectcorrect) * dofblur9);\n col += texture2D(tColor, vUv.xy + (vec2( 0.15, -0.37) * aspectcorrect) * dofblur9);\n \n col += texture2D(tColor, vUv.xy + (vec2( 0.29, 0.29) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2( 0.29, -0.29) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, 0.29) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, -0.29) * aspectcorrect) * dofblur7);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur7);\n \n col += texture2D(tColor, vUv.xy + (vec2( 0.29, 0.29) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2( 0.4, 0.0 ) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2( 0.29, -0.29) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, 0.29) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2(-0.29, -0.29) * aspectcorrect) * dofblur4);\n col += texture2D(tColor, vUv.xy + (vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur4);\n \n gl_FragColor = col / 41.0;\n gl_FragColor.a = 1.0;\n}\n",pp_copy_frag:"uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n gl_FragColor = opacity * texel;\n}\n",pp_fxaa_frag:"\nprecision highp float;\nuniform sampler2D tDiffuse;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#define FXAA_PC 1\n#define FXAA_GLSL_100 1\n#define FXAA_QUALITY_PRESET 12\n#define FXAA_GREEN_AS_LUMA 1\n#ifndef FXAA_PC_CONSOLE\n \n \n \n \n \n #define FXAA_PC_CONSOLE 0\n#endif\n#ifndef FXAA_GLSL_120\n #define FXAA_GLSL_120 0\n#endif\n#ifndef FXAA_GLSL_130\n #define FXAA_GLSL_130 0\n#endif\n#ifndef FXAA_HLSL_3\n #define FXAA_HLSL_3 0\n#endif\n#ifndef FXAA_HLSL_4\n #define FXAA_HLSL_4 0\n#endif\n#ifndef FXAA_HLSL_5\n #define FXAA_HLSL_5 0\n#endif\n#ifndef FXAA_GREEN_AS_LUMA\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n #define FXAA_GREEN_AS_LUMA 0\n#endif\n#ifndef FXAA_EARLY_EXIT\n \n \n \n \n \n \n \n \n \n \n #define FXAA_EARLY_EXIT 1\n#endif\n#ifndef FXAA_DISCARD\n \n \n \n \n \n \n \n \n #define FXAA_DISCARD 0\n#endif\n#ifndef FXAA_FAST_PIXEL_OFFSET\n \n \n \n \n \n \n #ifdef GL_EXT_gpu_shader4\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifndef FXAA_FAST_PIXEL_OFFSET\n #define FXAA_FAST_PIXEL_OFFSET 0\n #endif\n#endif\n#ifndef FXAA_GATHER4_ALPHA\n \n \n \n \n #if (FXAA_HLSL_5 == 1)\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifndef FXAA_GATHER4_ALPHA\n #define FXAA_GATHER4_ALPHA 0\n #endif\n#endif\n#ifndef FXAA_QUALITY_PRESET\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n #define FXAA_QUALITY_PRESET 12\n#endif\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)\n #define FxaaBool bool\n #define FxaaDiscard discard\n #define FxaaFloat float\n #define FxaaFloat2 vec2\n #define FxaaFloat3 vec3\n #define FxaaFloat4 vec4\n #define FxaaHalf float\n #define FxaaHalf2 vec2\n #define FxaaHalf3 vec3\n #define FxaaHalf4 vec4\n #define FxaaInt2 ivec2\n #define FxaaSat(x) clamp(x, 0.0, 1.0)\n #define FxaaTex sampler2D\n#else\n #define FxaaBool bool\n #define FxaaDiscard clip(-1)\n #define FxaaFloat float\n #define FxaaFloat2 float2\n #define FxaaFloat3 float3\n #define FxaaFloat4 float4\n #define FxaaHalf half\n #define FxaaHalf2 half2\n #define FxaaHalf3 half3\n #define FxaaHalf4 half4\n #define FxaaSat(x) saturate(x)\n#endif\n#if (FXAA_GLSL_100 == 1)\n #define FxaaTexTop(t, p) texture2D(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)\n#endif\n#if (FXAA_GLSL_120 == 1)\n \n \n \n \n \n #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n #if (FXAA_FAST_PIXEL_OFFSET == 1)\n #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\n #else\n #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n #endif\n #if (FXAA_GATHER4_ALPHA == 1)\n \n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_GLSL_130 == 1)\n \n #define FxaaTexTop(t, p) textureLod(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\n #if (FXAA_GATHER4_ALPHA == 1)\n \n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_HLSL_3 == 1)\n #define FxaaInt2 float2\n #define FxaaTex sampler2D\n #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))\n #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))\n#endif\n#if (FXAA_HLSL_4 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n#endif\n#if (FXAA_HLSL_5 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)\n #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)\n #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)\n #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)\n#endif\n#if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }\n#else\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n#endif\n#if (FXAA_PC == 1)\nFxaaFloat4 FxaaPixelShader(\n \n \n \n FxaaFloat2 pos,\n \n \n \n \n \n FxaaFloat4 fxaaConsolePosPos,\n \n \n \n \n \n FxaaTex tex,\n \n \n \n \n \n FxaaTex fxaaConsole360TexExpBiasNegOne,\n \n \n \n \n \n FxaaTex fxaaConsole360TexExpBiasNegTwo,\n \n \n \n \n \n FxaaFloat2 fxaaQualityRcpFrame,\n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsoleRcpFrameOpt,\n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsoleRcpFrameOpt2,\n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsole360RcpFrameOpt2,\n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualitySubpix,\n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualityEdgeThreshold,\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualityEdgeThresholdMin,\n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeSharpness,\n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeThreshold,\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeThresholdMin,\n \n \n \n \n \n \n FxaaFloat4 fxaaConsole360ConstDir\n) {\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n #if (FXAA_GATHER4_ALPHA == 1)\n #if (FXAA_DISCARD == 0)\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #endif\n #if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));\n #else\n FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));\n #endif\n #if (FXAA_DISCARD == 1)\n #define lumaM luma4A.w\n #endif\n #define lumaE luma4A.z\n #define lumaS luma4A.x\n #define lumaSE luma4A.y\n #define lumaNW luma4B.w\n #define lumaN luma4B.z\n #define lumaW luma4B.x\n #else\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 0.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n #endif\n #endif\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n if(earlyExit)\n #if (FXAA_DISCARD == 1)\n FxaaDiscard;\n #else\n return rgbyM;\n #endif\n #if (FXAA_GATHER4_ALPHA == 0)\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n #else\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = (horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if(horzSpan) posB.y += lengthSign * 0.5;\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if(horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n #if (FXAA_DISCARD == 1)\n return FxaaTexTop(tex, posM);\n #else\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n #endif\n}\n#endif\nvoid main() {\n gl_FragColor = FxaaPixelShader(\n vUv,\n vec4(0.0),\n tDiffuse,\n tDiffuse,\n tDiffuse,\n resolution,\n vec4(0.0),\n vec4(0.0),\n vec4(0.0),\n 0.75,\n 0.166,\n 0.0833,\n 0.0,\n 0.0,\n 0.0,\n vec4(0.0)\n );\n \n gl_FragColor.a = texture2D(tDiffuse, vUv).a;\n}\n",pp_grayscale_frag:"uniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n float bw = texel.r * 0.35 + texel.g * 0.45 + texel.b * 0.2;\n texel = vec4(bw, bw, bw, texel.a);\n gl_FragColor = texel;\n}\n",pp_outline_edge_frag:"\nvarying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform vec2 texSize;\nuniform vec3 visibleEdgeColor;\nuniform vec3 hiddenEdgeColor;\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D(maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D(maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D(maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D(maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n}\n",pp_outline_blur_frag:"\n#include \nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nuniform float kernelRadius;\nfloat gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n float weightSum = gaussianPdf(0.0, kernelRadius);\n vec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\n vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n vec2 uvOffset = delta;\n for (int i = 1; i <= MAX_RADIUS; i ++) {\n float w = gaussianPdf(uvOffset.x, kernelRadius);\n vec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb;\n vec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb;\n diffuseSum += ((sample1 + sample2) * w);\n weightSum += (2.0 * w);\n uvOffset += delta;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n}\n",pp_outline_overlay_frag:"\nvarying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform sampler2D edgeTexture1;\nuniform sampler2D edgeTexture2;\nuniform sampler2D patternTexture;\nuniform float edgeStrength;\nuniform float edgeGlow;\nuniform bool usePatternTexture;\nvoid main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if (usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n}\n",pp_ssao_frag:"\nuniform float cameraNear;\nuniform float cameraFar;\n#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n#endif\nuniform float radius; \nuniform bool onlyAO; \nuniform vec2 size; \nuniform float aoClamp; \nuniform float lumInfluence; \nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nvarying vec2 vUv;\n#define DL 2.399963229728653 \n#define EULER 2.718281828459045\nconst int samples = 64; \nconst bool useNoise = true; \nconst float noiseAmount = 0.0004; \nconst float diffArea = 0.25; \nconst float gDisplace = 0.4; \n#include \nvec2 rand(const vec2 coord) {\n vec2 noise;\n if (useNoise) {\n float nx = dot (coord, vec2(12.9898, 78.233));\n float ny = dot (coord, vec2(12.9898, 78.233) * 2.0);\n noise = clamp(fract (43758.5453 * sin(vec2(nx, ny))), 0.0, 1.0);\n } else {\n float ff = fract(1.0 - coord.s * (size.x / 2.0));\n float gg = fract(coord.t * (size.y / 2.0));\n noise = vec2(0.25, 0.75) * vec2(ff) + vec2(0.75, 0.25) * gg;\n }\n return (noise * 2.0 - 1.0) * noiseAmount;\n}\nfloat readDepth(const in vec2 coord) {\n float cameraFarPlusNear = cameraFar + cameraNear;\n float cameraFarMinusNear = cameraFar - cameraNear;\n float cameraCoef = 2.0 * cameraNear;\n #ifdef USE_LOGDEPTHBUF\n float logz = unpackRGBAToDepth(texture2D(tDepth, coord));\n float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;\n float z = (logz / w) + 1.0;\n #else\n float z = unpackRGBAToDepth(texture2D(tDepth, coord));\n #endif\n return cameraCoef / (cameraFarPlusNear - z * cameraFarMinusNear);\n}\nfloat compareDepths(const in float depth1, const in float depth2, inout int far) {\n float garea = 8.0; \n float diff = (depth1 - depth2) * 100.0; \n \n if (diff < gDisplace) {\n garea = diffArea;\n } else {\n far = 1;\n }\n float dd = diff - gDisplace;\n float gauss = pow(EULER, -2.0 * (dd * dd) / (garea * garea));\n return gauss;\n}\nfloat calcAO(float depth, float dw, float dh) {\n vec2 vv = vec2(dw, dh);\n vec2 coord1 = vUv + radius * vv;\n vec2 coord2 = vUv - radius * vv;\n float temp1 = 0.0;\n float temp2 = 0.0;\n int far = 0;\n temp1 = compareDepths(depth, readDepth(coord1), far);\n \n if (far > 0) {\n temp2 = compareDepths(readDepth(coord2), depth, far);\n temp1 += (1.0 - temp1) * temp2;\n }\n return temp1;\n}\nvoid main() {\n vec2 noise = rand(vUv);\n float depth = readDepth(vUv);\n float tt = clamp(depth, aoClamp, 1.0);\n float w = (1.0 / size.x) / tt + (noise.x * (1.0 - noise.x));\n float h = (1.0 / size.y) / tt + (noise.y * (1.0 - noise.y));\n float ao = 0.0;\n float dz = 1.0 / float(samples);\n float l = 0.0;\n float z = 1.0 - dz / 2.0;\n for (int i = 0; i <= samples; i ++) {\n float r = sqrt(1.0 - z);\n float pw = cos(l) * r;\n float ph = sin(l) * r;\n ao += calcAO(depth, pw * w, ph * h);\n z = z - dz;\n l = l + DL;\n }\n ao /= float(samples);\n ao = 1.0 - ao;\n vec4 color = texture2D(tDiffuse, vUv);\n vec3 lumcoeff = vec3(0.299, 0.587, 0.114);\n float lum = dot(color.rgb, lumcoeff);\n vec3 luminance = vec3(lum);\n vec3 final = vec3(color.rgb * mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); \n if (onlyAO) {\n final = vec3(mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); \n }\n gl_FragColor = vec4(final, color.a);\n}\n",raw_meshline_frag:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D alphaMap;\nuniform float useMap;\nuniform float useAlphaMap;\nuniform float visibility;\nuniform float alphaTest;\nuniform vec2 repeat;\nuniform vec3 color;\nuniform float opacity;\nvarying vec2 vUV;\nvarying float vCounters;\nvec4 LinearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92,\n vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\nvoid main() {\n vec4 c = vec4(color, opacity);\n \n if (useMap == 1.0) {\n c *= texture2D(map, vUV * repeat);\n }\n if (useAlphaMap == 1.0) {\n c.a *= texture2D(alphaMap, vUV * repeat).a;\n }\n if (c.a < alphaTest) {\n discard;\n }\n gl_FragColor = c;\n gl_FragColor.a *= step(vCounters, visibility);\n gl_FragColor = LinearTosRGB(gl_FragColor);\n}",raw_meshline_vert:"precision highp float;\nattribute vec3 position;\nattribute vec3 previous;\nattribute vec3 next;\nattribute float side;\nattribute float width;\nattribute vec2 uv;\nattribute float counters;\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec2 resolution;\nuniform float lineWidth;\nuniform float sizeAttenuation;\nvarying float vCounters;\nvarying vec2 vUV;\nconst float EQ_EPS = 0.000001;\nvec2 fix(vec4 i, float aspect) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n}\nbool posEqual(vec2 pos0, vec2 pos1) {\n \n return length(pos0 - pos1) < EQ_EPS;\n}\nvoid main() {\n float aspect = resolution.x / resolution.y;\n vCounters = counters;\n vUV = uv;\n mat4 m = projectionMatrix * modelViewMatrix;\n vec4 finalPosition = m * vec4(position, 1.0);\n vec4 prevPos = m * vec4(previous, 1.0);\n vec4 nextPos = m * vec4(next, 1.0);\n vec2 currentP = fix(finalPosition, aspect);\n vec2 prevP = fix(prevPos, aspect);\n vec2 nextP = fix(nextPos, aspect);\n float w = lineWidth * width;\n if (sizeAttenuation == 0.0) {\n \n w *= finalPosition.w / resolution.x;\n }\n vec2 dir;\n if (posEqual(nextP, currentP)) {\n dir = normalize(currentP - prevP);\n } else if (posEqual(prevP, currentP)) {\n dir = normalize(nextP - currentP);\n } else {\n vec2 dir1 = normalize(currentP - prevP);\n vec2 dir2 = normalize(nextP - currentP);\n dir = normalize(dir1 + dir2);\n \n \n \n }\n \n vec2 offset = vec2(-dir.y, dir.x);\n offset.y *= aspect;\n offset *= w;\n finalPosition.xy += offset * side;\n gl_Position = finalPosition;\n}"},kn={basic:{uniforms:Un.merge([On.common,On.specularmap,On.envmap,On.aomap,On.lightmap,On.fog]),vertexShader:Bn.meshbasic_vert,fragmentShader:Bn.meshbasic_frag},lambert:{uniforms:Un.merge([On.common,On.specularmap,On.envmap,On.aomap,On.lightmap,On.emissivemap,On.fog,On.lights,{emissive:{value:new Nn(0)}}]),vertexShader:Bn.meshlambert_vert,fragmentShader:Bn.meshlambert_frag},phong:{uniforms:Un.merge([On.common,On.specularmap,On.envmap,On.aomap,On.lightmap,On.emissivemap,On.bumpmap,On.normalmap,On.displacementmap,On.gradientmap,On.fog,On.lights,{emissive:{value:new Nn(0)},specular:{value:new Nn(1118481)},shininess:{value:30}}]),vertexShader:Bn.meshphong_vert,fragmentShader:Bn.meshphong_frag},blender:{uniforms:Un.merge([On.common,On.blendercommon,On.specularmap,On.envmap,On.aomap,On.lightmap,On.emissivemap,On.bumpmap,On.normalmap,On.displacementmap,On.gradientmap,On.fog,On.lights,{emissive:{value:new Nn(0)},specular:{value:new Nn(1118481)},shininess:{value:30},diffuseIntensity:{value:.8},specularIntensity:{value:.5},specularHardness:{value:50},specularAlpha:{value:1}}]),vertexShader:Bn.meshblender_vert,fragmentShader:Bn.meshblender_frag},node:{uniforms:Un.merge([On.common,On.blendercommon,On.displacementmap,On.envmap,On.fog,On.lights,On.node,{envMapMaxMipLevel:{value:8},envMapIntensity:{value:1}}]),vertexShader:Bn.meshnode_vert,fragmentShader:Bn.meshnode_frag},standard:{uniforms:Un.merge([On.common,On.envmap,On.aomap,On.lightmap,On.emissivemap,On.bumpmap,On.normalmap,On.displacementmap,On.roughnessmap,On.metalnessmap,On.fog,On.lights,{emissive:{value:new Nn(0)},roughness:{value:.5},metalness:{value:.5},envMapMaxMipLevel:{value:8},envMapIntensity:{value:1}}]),vertexShader:Bn.meshphysical_vert,fragmentShader:Bn.meshphysical_frag},points:{uniforms:Un.merge([On.points,On.fog]),vertexShader:Bn.points_vert,fragmentShader:Bn.points_frag},dashed:{uniforms:Un.merge([On.common,On.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bn.linedashed_vert,fragmentShader:Bn.linedashed_frag},depth:{uniforms:Un.merge([On.common,On.displacementmap]),vertexShader:Bn.depth_vert,fragmentShader:Bn.depth_frag},mask:{uniforms:Un.merge([On.common,On.displacementmap,On.mask]),vertexShader:Bn.mask_vert,fragmentShader:Bn.mask_frag},normal:{uniforms:Un.merge([On.common,On.bumpmap,On.normalmap,On.displacementmap,{opacity:{value:1}}]),vertexShader:Bn.normal_vert,fragmentShader:Bn.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bn.cube_vert,fragmentShader:Bn.cube_frag},equirect:{uniforms:{tEquirect:{value:null},invertU:{value:!1},offsetU:{value:0}},vertexShader:Bn.equirect_vert,fragmentShader:Bn.equirect_frag},equicube:{uniforms:{tEquirect:{value:null},faceIndex:{value:0},invertU:{value:!1},offsetU:{value:0}},vertexShader:Bn.equicube_vert,fragmentShader:Bn.equicube_frag},distanceRGBA:{uniforms:Un.merge([On.common,On.displacementmap,{referencePosition:{value:new Dt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bn.distanceRGBA_vert,fragmentShader:Bn.distanceRGBA_frag},shadow:{uniforms:Un.merge([On.lights,On.fog,{color:{value:new Nn(0)},opacity:{value:1}}]),vertexShader:Bn.shadow_vert,fragmentShader:Bn.shadow_frag}};function zn(e,t){this.min=void 0!==e?e:new Rt(1/0,1/0),this.max=void 0!==t?t:new Rt(-1/0,-1/0)}function Vn(e,t,n,i,r){var a,o,s,l,c,u,h,d;function p(){var e,i,p,f,m,v=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),g=new Uint16Array([0,1,2,0,2,3]);a=t.createBuffer(),o=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,v,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,g,t.STATIC_DRAW),h=t.createTexture(),d=t.createTexture(),n.bindTexture(t.TEXTURE_2D,h),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),n.bindTexture(t.TEXTURE_2D,d),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {"," vUV = uv;"," vec2 pos = position;"," if (renderType == 2) {"," vec4 visibility = texture2D(occlusionMap, vec2(0.1, 0.1));"," visibility += texture2D(occlusionMap, vec2(0.5, 0.1));"," visibility += texture2D(occlusionMap, vec2(0.9, 0.1));"," visibility += texture2D(occlusionMap, vec2(0.9, 0.5));"," visibility += texture2D(occlusionMap, vec2(0.9, 0.9));"," visibility += texture2D(occlusionMap, vec2(0.5, 0.9));"," visibility += texture2D(occlusionMap, vec2(0.1, 0.9));"," visibility += texture2D(occlusionMap, vec2(0.1, 0.5));"," visibility += texture2D(occlusionMap, vec2(0.5, 0.5));"," vVisibility = visibility.r / 9.0;"," vVisibility *= 1.0 - visibility.g / 9.0;"," vVisibility *= visibility.b / 9.0;"," vVisibility *= 1.0 - visibility.a / 9.0;"," pos.x = cos(rotation) * position.x - sin(rotation) * position.y;"," pos.y = sin(rotation) * position.x + cos(rotation) * position.y;"," }"," gl_Position = vec4((pos * scale + screenPosition.xy).xy, screenPosition.z, 1.0);","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {"," if (renderType == 0) {"," gl_FragColor = vec4(1.0, 0.0, 1.0, 0.0);"," } else if (renderType == 1) {"," gl_FragColor = texture2D(map, vUV);"," } else {"," vec4 texture = texture2D(map, vUV);"," texture.a *= opacity * vVisibility;"," gl_FragColor = texture;"," gl_FragColor.rgb *= color;"," }","}"].join("\n")},e=s,i=t.createProgram(),p=t.createShader(t.FRAGMENT_SHADER),f=t.createShader(t.VERTEX_SHADER),m="precision "+r.precision+" float;\n",t.shaderSource(p,m+e.fragmentShader),t.shaderSource(f,m+e.vertexShader),t.compileShader(p),t.compileShader(f),t.attachShader(i,p),t.attachShader(i,f),t.linkProgram(i),l=i,c={vertex:t.getAttribLocation(l,"position"),uv:t.getAttribLocation(l,"uv")},u={renderType:t.getUniformLocation(l,"renderType"),map:t.getUniformLocation(l,"map"),occlusionMap:t.getUniformLocation(l,"occlusionMap"),opacity:t.getUniformLocation(l,"opacity"),color:t.getUniformLocation(l,"color"),scale:t.getUniformLocation(l,"scale"),rotation:t.getUniformLocation(l,"rotation"),screenPosition:t.getUniformLocation(l,"screenPosition")}}this.render=function(e,r,s,f){if(0!==e.length){var m=new Dt,v=f.w/f.z,g=.5*f.z,y=.5*f.w,x=16/f.w,_=new Rt(x*v,x),b=new Dt(1,1,0),w=new Rt(1,1),A=new zn;A.min.set(f.x,f.y),A.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===l&&p(),n.useProgram(l),n.initAttributes(),n.enableAttribute(c.vertex),n.enableAttribute(c.uv),n.disableUnusedAttributes(),t.uniform1i(u.occlusionMap,0),t.uniform1i(u.map,1),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(c.vertex,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(c.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),n.disable(t.CULL_FACE),n.buffers.depth.setMask(!1);for(var M=0,T=e.length;M.001&&C.scale>.001&&(b.x=C.x,b.y=C.y,b.z=C.z,x=C.size*C.scale/f.w,_.x=x*v,_.y=x,t.uniform3f(u.screenPosition,b.x,b.y,b.z),t.uniform2f(u.scale,_.x,_.y),t.uniform1f(u.rotation,C.rotation),t.uniform1f(u.opacity,C.opacity),t.uniform3f(u.color,C.color.r,C.color.g,C.color.b),n.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),i.setTexture2D(C.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}n.enable(t.CULL_FACE),n.enable(t.DEPTH_TEST),n.buffers.depth.setMask(!0),n.reset()}}}function Gn(e,t,n,i,r,a,o,s,l){zt.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function jn(e,t,n,i,r){var a,o,s,l,c,u,h=new Dt,d=new It,p=new Dt;function f(){var e,n,i,h=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),d=new Uint16Array([0,1,2,0,2,3]);a=t.createBuffer(),o=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,h,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,d,t.STATIC_DRAW),e=t.createProgram(),n=t.createShader(t.VERTEX_SHADER),i=t.createShader(t.FRAGMENT_SHADER),t.shaderSource(n,["precision "+r.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float fogDepth;","void main() {"," vUV = uvOffset + uv * uvScale;"," vec2 alignedPosition = position * scale;"," vec2 rotatedPosition;"," rotatedPosition.x = cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y;"," rotatedPosition.y = sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y;"," vec4 mvPosition;"," mvPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);"," mvPosition.xy += rotatedPosition;"," gl_Position = projectionMatrix * mvPosition;"," fogDepth = - mvPosition.z;","}"].join("\n")),t.shaderSource(i,["precision "+r.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","varying float fogDepth;","void main() {"," vec4 texture = texture2D(map, vUV);"," gl_FragColor = vec4(color * texture.xyz, texture.a * opacity);"," if (gl_FragColor.a < alphaTest) discard;"," if (fogType > 0) {"," float fogFactor = 0.0;"," if (fogType == 1) {"," fogFactor = smoothstep(fogNear, fogFar, fogDepth);"," } else {"," const float LOG2 = 1.442695;"," fogFactor = exp2(- fogDensity * fogDensity * fogDepth * fogDepth * LOG2);"," fogFactor = 1.0 - clamp(fogFactor, 0.0, 1.0);"," }"," gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);"," }","}"].join("\n")),t.compileShader(n),t.compileShader(i),t.attachShader(e,n),t.attachShader(e,i),t.linkProgram(e),s=e,l={position:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},c={uvOffset:t.getUniformLocation(s,"uvOffset"),uvScale:t.getUniformLocation(s,"uvScale"),rotation:t.getUniformLocation(s,"rotation"),scale:t.getUniformLocation(s,"scale"),color:t.getUniformLocation(s,"color"),map:t.getUniformLocation(s,"map"),opacity:t.getUniformLocation(s,"opacity"),modelViewMatrix:t.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(s,"projectionMatrix"),fogType:t.getUniformLocation(s,"fogType"),fogDensity:t.getUniformLocation(s,"fogDensity"),fogNear:t.getUniformLocation(s,"fogNear"),fogFar:t.getUniformLocation(s,"fogFar"),fogColor:t.getUniformLocation(s,"fogColor"),fogDepth:t.getUniformLocation(s,"fogDepth"),alphaTest:t.getUniformLocation(s,"alphaTest")};var p=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");p.width=8,p.height=8;var f=p.getContext("2d");f.fillStyle="white",f.fillRect(0,0,8,8),u=new Gn(p)}function m(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(r,v,g){if(0!==r.length){void 0===s&&f(),n.useProgram(s),n.initAttributes(),n.enableAttribute(l.position),n.enableAttribute(l.uv),n.disableUnusedAttributes(),n.disable(t.CULL_FACE),n.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(l.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(l.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.uniformMatrix4fv(c.projectionMatrix,!1,g.projectionMatrix.elements),n.activeTexture(t.TEXTURE0),t.uniform1i(c.map,0);var y=0,x=0,_=v.fog;_?(t.uniform3f(c.fogColor,_.color.r,_.color.g,_.color.b),_.isFog?(t.uniform1f(c.fogNear,_.near),t.uniform1f(c.fogFar,_.far),t.uniform1i(c.fogType,1),y=1,x=1):_.isFogExp2&&(t.uniform1f(c.fogDensity,_.density),t.uniform1i(c.fogType,2),y=2,x=2)):(t.uniform1i(c.fogType,0),y=0,x=0);for(var b=0,w=r.length;bthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new Rt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new Rt).copy(e).clamp(this.min,this.max)},distanceToPoint:(In=new Rt,function(e){return In.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Gn.prototype=Object.create(zt.prototype),Gn.prototype.constructor=Gn;var Xn,Wn,Hn,Yn,qn,Qn,Zn,Jn,Kn,$n,ei,ti,ni,ii,ri,ai,oi,si,li=0;function ci(){Object.defineProperty(this,"id",{value:li++}),this.uuid=Ft.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=O,this.side=C,this.flatShading=!1,this.vertexColors=R,this.opacity=1,this.transparent=!1,this.blendSrc=Z,this.blendDst=J,this.blendEquation=V,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oe,this.depthTest=!0,this.depthWrite=!0,this.receiveShadow=!1,this.castShadow=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function ui(e){ci.call(this),this.type="MeshDepthMaterial",this.depthPacking=Et,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function hi(e){ci.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Dt,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}function di(e,t){this.min=void 0!==e?e:new Dt(1/0,1/0,1/0),this.max=void 0!==t?t:new Dt(-1/0,-1/0,-1/0)}function pi(e,t){this.center=void 0!==e?e:new Dt,this.radius=void 0!==t?t:0}function fi(e,t){this.normal=void 0!==e?e:new Dt(1,0,0),this.constant=void 0!==t?t:0}function mi(e,t,n,i,r,a){this.planes=[void 0!==e?e:new fi,void 0!==t?t:new fi,void 0!==n?n:new fi,void 0!==i?i:new fi,void 0!==r?r:new fi,void 0!==a?a:new fi]}function vi(e,t,n){for(var i=new mi,r=new Nt,a=new Rt,o=new Rt(n,n),s=new Dt,l=new Dt,c=1,u=2,h=1+(c|u),d=new Array(h),p=new Array(h),f={},m=[new Dt(1,0,0),new Dt(-1,0,0),new Dt(0,0,1),new Dt(0,0,-1),new Dt(0,1,0),new Dt(0,-1,0)],v=[new Dt(0,1,0),new Dt(0,1,0),new Dt(0,1,0),new Dt(0,1,0),new Dt(0,0,1),new Dt(0,0,-1)],g=[new Vt,new Vt,new Vt,new Vt,new Vt,new Vt],y=0;y!==h;++y){var x=0!=(y&c),_=0!=(y&u),b=new ui({depthPacking:Lt,morphTargets:x,skinning:_});d[y]=b;var w=new hi({morphTargets:x,skinning:_});p[y]=w}var A=this;function M(t,n,i,r,a,o){var s=t.geometry,l=null,h=d,m=t.customDepthMaterial;if(i&&(h=p,m=t.customDistanceMaterial),m)l=m;else{var v=!1;n.morphTargets&&(s&&s.isBufferGeometry?v=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(v=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===n.skinning&&console.warn("v3d.WebGLShadowMap: v3d.SkinnedMesh with material.skinning set to false:",t);var g=t.isSkinnedMesh&&n.skinning,y=0;v&&(y|=c),g&&(y|=u),l=h[y]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var x=l.uuid,_=n.uuid,b=f[x];void 0===b&&(b={},f[x]=b);var w=b[_];void 0===w&&(w=l.clone(),b[_]=w),l=w}l.visible=n.visible,l.wireframe=n.wireframe;var M=n.side;return A.renderSingleSided&&M==F&&(M=C),A.renderReverseSided&&(M===C?M=P:M===P&&(M=C)),l.side=M,l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,i&&l.isMeshDistanceMaterial&&(l.referencePosition.copy(r),l.nearDistance=a,l.farDistance=o),l}function T(n,r,a,o){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var s=t.update(n),c=n.material;if(Array.isArray(c))for(var u=s.groups,h=0,d=u.length;ht&&(t=e[n]);return t}function bi(e){return void 0!==e}Object.assign(ci.prototype,t.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]="overdraw"===t?Number(n):n:console.warn("v3d."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("v3d.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==O&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==C&&(n.side=this.side),this.vertexColors!==R&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0!==this.rotation&&(n.rotation=this.rotation),1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.receiveShadow=e.receiveShadow,this.castShadow=e.castShadow,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ui.prototype=Object.create(ci.prototype),ui.prototype.constructor=ui,ui.prototype.isMeshDepthMaterial=!0,ui.prototype.copy=function(e){return ci.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},hi.prototype=Object.create(ci.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshDistanceMaterial=!0,hi.prototype.copy=function(e){return ci.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Object.assign(di.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;sr&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;sr&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new Dt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:(Yn=new Dt,function(e){return this.clampPoint(e.center,Yn),Yn.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new Dt).copy(e).clamp(this.min,this.max)},distanceToPoint:(Hn=new Dt,function(e){return Hn.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(Wn=new Dt,function(e){var t=e||new pi;return this.getCenter(t.center),t.radius=.5*this.getSize(Wn).length(),t}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Xn=[new Dt,new Dt,new Dt,new Dt,new Dt,new Dt,new Dt,new Dt],function(e){return this.isEmpty()?this:(Xn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Xn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Xn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Xn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Xn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Xn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Xn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Xn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Xn),this)}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(pi.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(Zn=new di,function(e,t){var n=this.center;void 0!==t?n.copy(t):Zn.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;rthis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new di;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(fi.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(ei=new Dt,ti=new Dt,function(e,t,n){var i=ei.subVectors(n,t).cross(ti.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return(t||new Dt).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:($n=new Dt,function(e,t){var n=t||new Dt,i=e.delta($n),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?n.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?void 0:n.copy(i).multiplyScalar(a).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new Dt).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(Jn=new Dt,Kn=new Ot,function(e,t){var n=t||Kn.getNormalMatrix(e),i=this.coplanarPoint(Jn).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(mi.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,u-s,f-h,y-m).normalize(),t[1].setComponents(o+i,u+s,f+h,y+m).normalize(),t[2].setComponents(o+r,u+l,f+d,y+v).normalize(),t[3].setComponents(o-r,u-l,f-d,y-v).normalize(),t[4].setComponents(o-a,u-c,f-p,y-g).normalize(),t[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},intersectsObject:(ai=new pi,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ai)}),intersectsSprite:(ri=new pi,function(e){return ri.center.set(0,0,0),ri.radius=.7071067811865476,ri.applyMatrix4(e.matrixWorld),this.intersectsSphere(ri)}),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.min.x:e.max.x,ii.x=i.normal.x>0?e.max.x:e.min.x,ni.y=i.normal.y>0?e.min.y:e.max.y,ii.y=i.normal.y>0?e.max.y:e.min.y,ni.z=i.normal.z>0?e.min.z:e.max.z,ii.z=i.normal.z>0?e.max.z:e.min.z;var r=i.distanceToPoint(ni),a=i.distanceToPoint(ii);if(r<0&&a<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),yi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],yi.DefaultOrder="XYZ",Object.defineProperties(yi.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(yi.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Ft.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a))):"ZYX"===t?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("v3d.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:(si=new Nt,function(e,t,n){return si.makeRotationFromQuaternion(e),this.setFromRotationMatrix(si,t,n)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(oi=new It,function(e){return oi.setFromEuler(this),this.setFromQuaternion(oi,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Dt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(xi.prototype,{set:function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0){i.children=[];for(o=0;o0&&(n.geometries=l),c.length>0&&(n.materials=c),u.length>0&&(n.textures=u),h.length>0&&(n.images=h)}return n.object=i,n;function d(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.disableChildRendering=e.disableChildRendering,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0?1:-1,c.push(C.x,C.y,C.z),u.push(y/m),u.push(1-x/v),E+=1}}for(x=0;x1&&n.sort(na),i.length>1&&i.sort(ia)}}},e[i]=r),r},dispose:function(){e={}}}}function aa(e,t){return Math.abs(t[1])-Math.abs(e[1])}function oa(){var e=new function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Dt,color:new Nn,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Rt};break;case"SpotLight":n={position:new Dt,direction:new Dt,color:new Nn,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Rt};break;case"PointLight":n={position:new Dt,color:new Nn,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Rt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new Dt,skyColor:new Nn,groundColor:new Nn};break;case"RectAreaLight":n={color:new Nn,position:new Dt,halfWidth:new Dt,halfHeight:new Dt}}return e[t.id]=n,n}}},t={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=new Dt,i=new Nt,r=new Nt;return{setup:function(a,o,s){for(var l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=s.matrixWorldInverse,g=0,y=a.length;g0)for(d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new di),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new pi),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.faceVertexUvs[0],u=e.faceVertexUvs[0],h=this.colors,d=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new Ot).getNormalMatrix(t));for(var p=0,f=o.length;p=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x,0,0),1,!0),2,!1),3,f),4,m),5,v),6,g),7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var _=this.faceVertexUvs[0][r];o.push(S(_[0]),S(_[1]),S(_[2]))}if(m&&o.push(M(p.normal)),v){var b=p.vertexNormals;o.push(M(b[0]),M(b[1]),M(b[2]))}if(g&&o.push(T(p.color)),y){var w=p.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function A(e,t,n){return n?e|1<0&&(e.data.colors=c),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Nr).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c0){u=[];for(c=0;c65535?Vr:kr)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("v3d.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this):(console.warn("v3d.BufferGeometry: .addAttribute() now expects (name, attribute)."),void this.addAttribute(e,new Ir(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Ot).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(or=new Nt,function(e){return or.makeRotationX(e),this.applyMatrix(or),this}),rotateY:(ar=new Nt,function(e){return ar.makeRotationY(e),this.applyMatrix(ar),this}),rotateZ:(rr=new Nt,function(e){return rr.makeRotationZ(e),this.applyMatrix(rr),this}),translate:(ir=new Nt,function(e,t,n){return ir.makeTranslation(e,t,n),this.applyMatrix(ir),this}),scale:(nr=new Nt,function(e,t,n){return nr.makeScale(e,t,n),this.applyMatrix(nr),this}),lookAt:(tr=new Gi,function(e){tr.lookAt(e),tr.updateMatrix(),this.applyMatrix(tr.matrix)}),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Gr(3*t.vertices.length,3),i=new Gr(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Gr(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Xr).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Ir(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Ir(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new Ir(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Ir(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Ir(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var o=new(_i(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new Ir(o,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var l=[],c=e.morphTargets[s],u=0,h=c.length;u0){var f=new Gr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new Gr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new di);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('v3d.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:($i=new di,er=new Dt,function(){null===this.boundingSphere&&(this.boundingSphere=new pi);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;$i.setFromBufferAttribute(e),$i.getCenter(t);for(var n=0,i=0,r=e.count;i0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Wr).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;n0)if(a=c*u-h,s=l*p,(r=c*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+c*(a*=f)+2*u)+a*(c*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-c*l+u)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(c*l+u)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=c>0?-l:l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(fr).multiplyScalar(a).add(pr),o}),intersectSphere:(dr=new Dt,function(e,t){dr.subVectors(e.center,this.origin);var n=dr.dot(this.direction),i=dr.dot(dr)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,a=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,a=(e.min.y-h.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s=0?n:i,t)))},intersectsBox:(hr=new Dt,function(e){return null!==this.intersectBox(e,hr)}),intersectTriangle:(sr=new Dt,lr=new Dt,cr=new Dt,ur=new Dt,function(e,t,n,i,r){lr.subVectors(t,e),cr.subVectors(n,e),ur.crossVectors(lr,cr);var a,o=this.direction.dot(ur);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}sr.subVectors(this.origin,e);var s=a*this.direction.dot(cr.crossVectors(sr,cr));if(s<0)return null;var l=a*this.direction.dot(lr.cross(sr));if(l<0)return null;if(s+l>o)return null;var c=-a*sr.dot(ur);return c<0?null:this.at(c/o,r)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign($r.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return(e||new Dt).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new Dt).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var n=t||new Dt;return this.delta(n).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(yr=new Dt,xr=new Dt,function(e,t){yr.subVectors(e,this.start),xr.subVectors(this.end,this.start);var n=xr.dot(xr),i=xr.dot(yr)/n;return t&&(i=Ft.clamp(i,0,1)),i}),closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t),r=n||new Dt;return this.delta(r).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Object.assign(ea,{normal:(Mr=new Dt,function(e,t,n,i){var r=i||new Dt;r.subVectors(n,t),Mr.subVectors(e,t),r.cross(Mr);var a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}),barycoordFromPoint:(br=new Dt,wr=new Dt,Ar=new Dt,function(e,t,n,i,r){br.subVectors(i,t),wr.subVectors(n,t),Ar.subVectors(e,t);var a=br.dot(br),o=br.dot(wr),s=br.dot(Ar),l=wr.dot(wr),c=wr.dot(Ar),u=a*l-o*o,h=r||new Dt;if(0===u)return h.set(-2,-1,-1);var d=1/u,p=(l*s-o*c)*d,f=(a*c-o*s)*d;return h.set(1-p-f,f,p)}),containsPoint:(_r=new Dt,function(e,t,n,i){var r=ea.barycoordFromPoint(e,t,n,i,_r);return r.x>=0&&r.y>=0&&r.x+r.y<=1})}),Object.assign(ea.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:(Cr=new Dt,Pr=new Dt,function(){return Cr.subVectors(this.c,this.b),Pr.subVectors(this.a,this.b),.5*Cr.cross(Pr).length()}),midpoint:function(e){return(e||new Dt).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return ea.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new fi).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return ea.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return ea.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:(Tr=new fi,Sr=[new $r,new $r,new $r],Er=new Dt,Lr=new Dt,function(e,t){var n=t||new Dt,i=1/0;if(Tr.setFromCoplanarPoints(this.a,this.b,this.c),Tr.projectPoint(e,Er),!0===this.containsPoint(Er))n.copy(Er);else{Sr[0].set(this.a,this.b),Sr[1].set(this.b,this.c),Sr[2].set(this.c,this.a);for(var r=0;r0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;en.far?null:{distance:l,point:f.clone(),object:e}}function g(e,t,n,o,s,l,d,f){i.fromBufferAttribute(o,l),r.fromBufferAttribute(o,d),a.fromBufferAttribute(o,f);var g=v(e,e.material,t,n,i,r,a,p);return g&&(s&&(c.fromBufferAttribute(s,l),u.fromBufferAttribute(s,d),h.fromBufferAttribute(s,f),g.uv=m(p,i,r,a,c,u,h)),g.face=new Wi(l,d,f,ea.normal(i,r,a)),g.faceIndex=l),g}return function(d,f){var y,x=this.geometry,_=this.material,b=this.matrixWorld;if(void 0!==_&&(null===x.boundingSphere&&x.computeBoundingSphere(),n.copy(x.boundingSphere),n.applyMatrix4(b),!1!==d.ray.intersectsSphere(n)&&(e.getInverse(b),t.copy(d.ray).applyMatrix4(e),null===x.boundingBox||!1!==t.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var w,A,M,T,S,E=x.index,L=x.attributes.position,C=x.attributes.uv;if(null!==E)for(T=0,S=E.count;T0&&(N=U);for(var B=0,k=O.length;B/gm,function(e,t){var n=Bn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return $a(n)})}function eo(e,t){for(var n in t)e=e.replace("#include <"+n+">",t[n]);return e}function to(e){return e.replace(/for \(int i \= (\d+)\; i < (\d+)\; i \+\+\) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,i){for(var r="",a=parseInt(t);a0?e.gammaFactor:1,A=(f=i.extensions,m=a,v=t,[(f=f||{}).derivatives||m.envMapCubeUV||m.bumpMap||m.normalMap||m.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(f.fragDepth||m.logarithmicDepthBuffer)&&v.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",f.drawBuffers&&v.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(f.shaderTextureLOD||m.envMap)&&v.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ja).join("\n")),M=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),T=o.createProgram();i.isRawShaderMaterial?((g=[M].filter(Ja).join("\n")).length>0&&(g+="\n"),(y=[A,M].filter(Ja).join("\n")).length>0&&(y+="\n")):(g=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,M,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMapTangents?"#define USE_NORMALMAP_TANGENTS":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Ja).join("\n"),y=[A,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,M,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"","#define GAMMA_FACTOR "+w,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+h:"",a.envMap?"#define "+d:"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMapTangents?"#define USE_NORMALMAP_TANGENTS":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(a.numClippingPlanes-a.numClipIntersection),a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&t.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==fe?"#define TONE_MAPPING":"",a.toneMapping!==fe?Bn.tonemapping_pars_fragment:"",a.toneMapping!==fe?function(e,t){var n;switch(t){case me:n="Linear";break;case ve:n="Reinhard";break;case ge:n="Uncharted2";break;case ye:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"(vec3 color) { return "+n+"ToneMapping(color); }"}("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Bn.encodings_pars_fragment:"",a.mapEncoding?Za("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?Za("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Za("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(x="linearToOutputTexel",_=a.outputEncoding,b=Qa(_),"vec4 "+x+"(vec4 value) { return LinearTo"+b[0]+b[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ja).join("\n")),i.isMeshNodeMaterial&&(l=eo(l,i.nodeChunks),c=eo(c,i.nodeChunks)),l=Ka(l=$a(l),a),c=Ka(c=$a(c),a),i.isShaderMaterial||(l=to(l),c=to(c));var S=g+l,C=y+c,P=sa(o,o.VERTEX_SHADER,S),F=sa(o,o.FRAGMENT_SHADER,C);o.attachShader(T,P),o.attachShader(T,F),void 0!==i.index0AttributeName?o.bindAttribLocation(T,0,i.index0AttributeName):!0===a.morphTargets&&o.bindAttribLocation(T,0,"position"),o.linkProgram(T);var R,N,I=o.getProgramInfoLog(T),D=o.getShaderInfoLog(P),O=o.getShaderInfoLog(F),U=!0,B=!0;return!1===o.getProgramParameter(T,o.LINK_STATUS)?(U=!1,console.error("v3d.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(T,o.VALIDATE_STATUS),"gl.getProgramInfoLog",I,D,O)):""!==I?console.warn("v3d.WebGLProgram: gl.getProgramInfoLog()",I):""!==D&&""!==O||(B=!1),B&&(this.diagnostics={runnable:U,material:i,programLog:I,vertexShader:{log:D,prefix:g},fragmentShader:{log:O,prefix:y}}),o.deleteShader(P),o.deleteShader(F),this.getUniforms=function(){return void 0===R&&(R=new Fn(o,T,e)),R},this.getAttributes=function(){return void 0===N&&(N=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numClippingPlanes:l,numClipIntersection:c,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.receiveShadow&&a.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===F,flipSided:t.side===P,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var o=0;ot||e.height>t){var n=t/Math.max(e.width,e.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(e.width*n),i.height=Math.floor(e.height*n),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("v3d.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function c(e){return Ft.isPowerOfTwo(e.width)&&Ft.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&e.minFilter!==Ce&&e.minFilter!==Re}function h(t){return t===Ce||t===Pe||t===Fe?e.NEAREST:e.LINEAR}function d(t){var n=t.target;n.removeEventListener("dispose",d),function(t){var n=i.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}i.remove(t)}(n),o.textures--}function p(t){var n=t.target;n.removeEventListener("dispose",p),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(t.texture),i.remove(t)}(n),o.textures--}function f(t,h){var p=i.get(t);if(t.version>0&&p.__version!==t.version){var f=t.image;if(void 0===f)console.warn("v3d.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==f.complete)return void function(t,i,h){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",d),t.__webglTexture=e.createTexture(),o.textures++);n.activeTexture(e.TEXTURE0+h),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var p=l(i.image,r.maxTextureSize);f=i,(f.wrapS!==Ee||f.wrapT!==Ee||f.minFilter!==Ce&&f.minFilter!==Re)&&!1===c(p)&&(p=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=Ft.floorPowerOfTwo(e.width),t.height=Ft.floorPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("v3d.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(p));var f;var v=c(p),g=a.convert(i.format),y=a.convert(i.type);m(e.TEXTURE_2D,i,v);var x,_=i.mipmaps;if(i.isDepthTexture){var b=e.DEPTH_COMPONENT;if(i.type===Ve){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");b=e.DEPTH_COMPONENT32F}else s&&(b=e.DEPTH_COMPONENT16);i.format===$e&&b===e.DEPTH_COMPONENT&&i.type!==Be&&i.type!==ze&&(console.warn("v3d.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Be,y=a.convert(i.type)),i.format===et&&(b=e.DEPTH_STENCIL,i.type!==He&&(console.warn("v3d.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=He,y=a.convert(i.type))),n.texImage2D(e.TEXTURE_2D,0,b,p.width,p.height,0,g,y,null)}else if(i.isDataTexture)if(_.length>0&&v){for(var w=0,A=_.length;w-1?n.compressedTexImage2D(e.TEXTURE_2D,w,g,x.width,x.height,0,x.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,w,g,x.width,x.height,0,g,y,x.data);else if(_.length>0&&v){for(var w=0,A=_.length;w1||i.get(o).__currentAnisotropy)&&(e.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function v(t,r,o,s){var l=a.convert(r.texture.format),c=a.convert(r.texture.type);n.texImage2D(s,0,l,r.width,r.height,0,l,c,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function g(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function y(t){var n=i.get(t),r=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of v3d.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),f(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===$e)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==et)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),g(n.__webglDepthbuffer[a],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),g(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=f,this.setTextureCube=function(t,s){var h=i.get(t);if(6===t.image.length)if(t.version>0&&h.__version!==t.version){h.__image__webglTextureCube||(t.addEventListener("dispose",d),h.__image__webglTextureCube=e.createTexture(),o.textures++),n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);for(var p=t&&t.isCompressedTexture,f=t.image[0]&&t.image[0].isDataTexture,v=[],g=0;g<6;g++)v[g]=p||f?f?t.image[g].image:t.image[g]:l(t.image[g],r.maxCubemapSize);var y=c(v[0]),x=a.convert(t.format),_=a.convert(t.type);for(m(e.TEXTURE_CUBE_MAP,t,y),g=0;g<6;g++)if(p)for(var b,w=v[g].mipmaps,A=0,M=w.length;A-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,A,x,b.width,b.height,0,b.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,A,x,b.width,b.height,0,x,_,b.data);else f?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,v[g].width,v[g].height,0,x,_,v[g].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,x,_,v[g]);u(t,y)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),h.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,r){n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,i.get(t).__webglTexture)},this.setupRenderTarget=function(t){var r=i.get(t),a=i.get(t.texture);t.addEventListener("dispose",p),a.__webglTexture=e.createTexture(),o.textures++;var s=!0===t.isWebGLRenderTargetCube,l=c(t);if(s){r.__webglFramebuffer=[];for(var h=0;h<6;h++)r.__webglFramebuffer[h]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(s){for(n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture),m(e.TEXTURE_CUBE_MAP,t.texture,l),h=0;h<6;h++)v(r.__webglFramebuffer[h],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+h);u(t.texture,l)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,a.__webglTexture),m(e.TEXTURE_2D,t.texture,l),v(r.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,l)&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&y(t)},this.updateRenderTargetMipmap=function(t){var r=t.texture;if(u(r,c(t))){var a=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,o=i.get(r).__webglTexture;n.bindTexture(a,o),e.generateMipmap(a),n.bindTexture(a,null)}}}function ao(e,t,n,i){ji.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function oo(e){ao.call(this),this.cameras=e||[]}function so(e,t){return{convert:function(n){var i;if(n===Se)return e.REPEAT;if(n===Ee)return e.CLAMP_TO_EDGE;if(n===Le)return e.MIRRORED_REPEAT;if(n===Ce)return e.NEAREST;if(n===Pe)return e.NEAREST_MIPMAP_NEAREST;if(n===Fe)return e.NEAREST_MIPMAP_LINEAR;if(n===Re)return e.LINEAR;if(n===Ne)return e.LINEAR_MIPMAP_NEAREST;if(n===Ie)return e.LINEAR_MIPMAP_LINEAR;if(n===De)return e.UNSIGNED_BYTE;if(n===je)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Xe)return e.UNSIGNED_SHORT_5_5_5_1;if(n===We)return e.UNSIGNED_SHORT_5_6_5;if(n===Oe)return e.BYTE;if(n===Ue)return e.SHORT;if(n===Be)return e.UNSIGNED_SHORT;if(n===ke)return e.INT;if(n===ze)return e.UNSIGNED_INT;if(n===Ve)return e.FLOAT;if(n===Ge&&null!==(i=t.get("OES_texture_half_float")))return i.HALF_FLOAT_OES;if(n===Ye)return e.ALPHA;if(n===qe)return e.RGB;if(n===Qe)return e.RGBA;if(n===Ze)return e.LUMINANCE;if(n===Je)return e.LUMINANCE_ALPHA;if(n===$e)return e.DEPTH_COMPONENT;if(n===et)return e.DEPTH_STENCIL;if(n===V)return e.FUNC_ADD;if(n===G)return e.FUNC_SUBTRACT;if(n===j)return e.FUNC_REVERSE_SUBTRACT;if(n===H)return e.ZERO;if(n===Y)return e.ONE;if(n===q)return e.SRC_COLOR;if(n===Q)return e.ONE_MINUS_SRC_COLOR;if(n===Z)return e.SRC_ALPHA;if(n===J)return e.ONE_MINUS_SRC_ALPHA;if(n===K)return e.DST_ALPHA;if(n===$)return e.ONE_MINUS_DST_ALPHA;if(n===ee)return e.DST_COLOR;if(n===te)return e.ONE_MINUS_DST_COLOR;if(n===ne)return e.SRC_ALPHA_SATURATE;if((n===tt||n===nt||n===it||n===rt)&&null!==(i=t.get("WEBGL_compressed_texture_s3tc"))){if(n===tt)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===nt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===it)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===rt)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((n===at||n===ot||n===st||n===lt)&&null!==(i=t.get("WEBGL_compressed_texture_pvrtc"))){if(n===at)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ot)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===st)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===lt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ct&&null!==(i=t.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((n===X||n===W)&&null!==(i=t.get("EXT_blend_minmax"))){if(n===X)return i.MIN_EXT;if(n===W)return i.MAX_EXT}return n===He&&null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:0}}}function lo(e){console.log("Verge3D",w);var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=[],u=[],h=null,d=[],p=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=me,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var f,m,v,g,y,x,_,b,E,L,C,N,I,V,G,j,X,W,H,Y=this,q=!1,Q=null,Z=null,J=-1,K="",$=null,ee=null,te=new Vt,ne=new Vt,he=null,de=0,pe=t.width,fe=t.height,ve=1,ge=new Vt(0,0,pe,fe),ye=new Vt(0,0,pe,fe),xe=!1,_e=new mi,we=new function(){var e=this,t=null,n=0,i=!1,r=!1,a=new fi,o=new Ot,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,i,r){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==r||null===c){var u=i+4*l,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===c||c.length0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a=void 0!==n.precision?n.precision:"highp",o=r(a);o!==a&&(console.warn("v3d.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);var s=!0===n.logarithmicDepthBuffer,l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),h=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,g=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:s,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:h,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:g,floatVertexTextures:v&&g}}(f,m,e),(g=new function(e,t,n){var i=new function(){var t=!1,n=new Vt,i=null,r=new Vt(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},r=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?H(e.DEPTH_TEST):Y(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case ie:e.depthFunc(e.NEVER);break;case re:e.depthFunc(e.ALWAYS);break;case ae:e.depthFunc(e.LESS);break;case oe:e.depthFunc(e.LEQUAL);break;case se:e.depthFunc(e.EQUAL);break;case le:e.depthFunc(e.GEQUAL);break;case ce:e.depthFunc(e.GREATER);break;case ue:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},a=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(t){t?H(e.STENCIL_TEST):Y(e.STENCIL_TEST)},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},o=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(o),l=new Uint8Array(o),c=new Uint8Array(o),u={},h=null,d=null,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=!1,b=null,w=null,S=null,E=null,L=null,C=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),R=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),N=parseFloat(R)>=1,I=null,V={},G=new Vt,j=new Vt;function X(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;o65535?Vr:kr)(o,1),t.update(i,e.ELEMENT_ARRAY_BUFFER),r[n.id]=i,i}}}(f,_,Le),E=new function(e,t){var n={};return{update:function(i){var r=t.frame,a=i.geometry,o=e.get(i,a);return n[o.id]!==r&&(a.isGeometry&&o.updateFromObject(i),e.update(o),n[o.id]=r),o},clear:function(){n={}}}}(b,Ce),V=new function(e){var t={},n=new Float32Array(8);return{update:function(i,r,a,o){var s=i.morphTargetInfluences,l=s.length,c=t[r.id];if(void 0===c){c=[];for(var u=0;u=0){var c=r[s];if(void 0!==c){var u=c.normalized,h=c.itemSize,d=_.get(c);if(void 0===d)continue;var p=d.buffer,v=d.type,y=d.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,b=x.stride,w=c.offset;x&&x.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=x.meshPerAttribute*x.count)):g.enableAttribute(l),f.bindBuffer(f.ARRAY_BUFFER,p),f.vertexAttribPointer(l,h,v,u,b*y,(i*b+w)*y)}else c.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):g.enableAttribute(l),f.bindBuffer(f.ARRAY_BUFFER,p),f.vertexAttribPointer(l,h,v,u,0,i*h*y)}else if(void 0!==o){var A=o[s];if(void 0!==A)switch(A.length){case 2:f.vertexAttrib2fv(l,A);break;case 3:f.vertexAttrib3fv(l,A);break;case 4:f.vertexAttrib4fv(l,A);break;default:f.vertexAttrib1fv(l,A)}}}}g.disableUnusedAttributes()}(i,o,n),null!==u&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c.buffer));var v=0;null!==u?v=u.count:void 0!==h&&(v=h.count);var y=n.drawRange.start*d,x=n.drawRange.count*d,w=null!==a?a.start*d:0,A=null!==a?a.count*d:1/0,M=Math.max(y,w),T=Math.min(v,y+x,w+A)-1,S=Math.max(0,T-M+1);if(0!==S){if(r.isMesh)if(!0===i.wireframe)g.setLineWidth(i.wireframeLinewidth*Pe()),p.setMode(f.LINES);else switch(r.drawMode){case gt:p.setMode(f.TRIANGLES);break;case yt:p.setMode(f.TRIANGLE_STRIP);break;case xt:p.setMode(f.TRIANGLE_FAN)}else if(r.isLine){var E=i.linewidth;void 0===E&&(E=1),g.setLineWidth(E*Pe()),r.isLineSegments?p.setMode(f.LINES):r.isLineLoop?p.setMode(f.LINE_LOOP):p.setMode(f.LINE_STRIP)}else r.isPoints&&p.setMode(f.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&p.renderInstances(n,M,S):p.render(M,S)}},this.compile=function(e,t){c.length=0,u.length=0,e.traverse(function(e){e.isLight&&(c.push(e),e.castShadow&&u.push(e))}),L.setup(c,u,t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(h=0;h=0&&e.numSupportedMorphNormals++}var d=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=we.numPlanes,i.numIntersection=we.numIntersection,d.clippingPlanes=we.uniform),i.fog=t,i.lightsHash=L.state.hash,e.lights&&(d.ambientLightColor.value=L.state.ambient,d.directionalLights.value=L.state.directional,d.spotLights.value=L.state.spot,d.rectAreaLights.value=L.state.rectArea,d.pointLights.value=L.state.point,d.hemisphereLights.value=L.state.hemi,d.directionalShadowMap.value=L.state.directionalShadowMap,d.directionalShadowMatrix.value=L.state.directionalShadowMatrix,d.spotShadowMap.value=L.state.spotShadowMap,d.spotShadowMatrix.value=L.state.spotShadowMatrix,d.pointShadowMap.value=L.state.pointShadowMap,d.pointShadowMatrix.value=L.state.pointShadowMatrix),e.nodeValue&&(d.nodeValue.value=e.nodeValue),e.nodeRGBArr&&(d.nodeRGB.value=e.nodeRGBArr);var p=i.program.getUniforms(),f=Fn.seqWithValue(p.seq,d);i.uniformsList=f}function Ke(e,t,n,i){de=0;var r=y.get(n);if(Ae&&(Me||e!==$)){var a=e===$&&n.id===J;we.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,a)}if(!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==t?n.needsUpdate=!0:n.lights&&r.lightsHash!==L.state.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===we.numPlanes&&r.numIntersection===we.numIntersection||(n.needsUpdate=!0)),n.needsUpdate){if(Je(n,t,i),n.needsUpdate=!1,n.nodeRGBArr)for(var o=0;o=v.maxTextures&&console.warn("v3d.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+v.maxTextures),de+=1,e},this.setTexture2D=(ze=!1,function(e,t){e&&e.isWebGLRenderTarget&&(ze||(console.warn("v3d.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ze=!0),e=e.texture),x.setTexture2D(e,t)}),this.setTexture=(je=!1,function(e,t){je||(console.warn("v3d.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),je=!0),x.setTexture2D(e,t)}),this.setTextureCube=(Xe=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(Xe||(console.warn("v3d.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Xe=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?x.setTextureCube(e,t):x.setTextureCubeDynamic(e,t)}),this.getRenderTarget=function(){return Q},this.setRenderTarget=function(e){Q=e,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var t=null,n=!1;if(e){var i=y.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=i[e.activeCubeFace],n=!0):t=i,te.copy(e.viewport),ne.copy(e.scissor),he=e.scissorTest}else te.copy(ge).multiplyScalar(ve),ne.copy(ye).multiplyScalar(ve),he=xe;if(Z!==t&&(f.bindFramebuffer(f.FRAMEBUFFER,t),Z=t),g.viewport(te),g.scissor(ne),g.setScissorTest(he),n){var r=y.get(e.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,i,r,a){if(e&&e.isWebGLRenderTarget){var o=y.get(e).__webglFramebuffer;if(o){var s=!1;o!==Z&&(f.bindFramebuffer(f.FRAMEBUFFER,o),s=!0);try{var l=e.texture,c=l.format,u=l.type;if(c!==Qe&&H.convert(c)!==f.getParameter(f.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===De||H.convert(u)===f.getParameter(f.IMPLEMENTATION_COLOR_READ_TYPE)||u===Ve&&(m.get("OES_texture_float")||m.get("WEBGL_color_buffer_float"))||u===Ge&&m.get("EXT_color_buffer_half_float")))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");f.checkFramebufferStatus(f.FRAMEBUFFER)===f.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&f.readPixels(t,n,i,r,H.convert(c),H.convert(u),a):console.error("v3d.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&f.bindFramebuffer(f.FRAMEBUFFER,Z)}}}else console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not v3d.WebGLRenderTarget.")},this.updateGeometry=function(e){return E.update(e)}}function co(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}function uo(){Gi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.ambientColor=new Nn(0,0,0),this.postprocessing=[],this.autoUpdate=!0}function ho(e,t,n){co.call(this),this.scene=e,this.camera=t;var i=void 0!==n.focus?n.focus:1,r=void 0!==n.aspect?n.aspect:t.aspect,a=void 0!==n.aperture?n.aperture:.025,o=void 0!==n.maxblur?n.maxblur:1,s=n.width||window.innerWidth||1,l=n.height||window.innerHeight||1;this.renderTargetColor=new Gt(s,l,{minFilter:Re,magFilter:Re,format:Qe}),this.renderTargetColor.texture.name="BokehPass.color",this.renderTargetDepth=this.renderTargetColor.clone(),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new ui,this.materialDepth.depthPacking=Lt,this.materialDepth.blending=D;var c=kn.bokeh,u=Un.clone(c.uniforms);u.tDepth.value=this.renderTargetDepth.texture,u.focus.value=i,u.aspect.value=r,u.aperture.value=a,u.maxblur.value=o,u.nearClip.value=t.near,u.farClip.value=t.far,this.materialBokeh=new Jr({defines:c.defines,uniforms:u,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}),this.uniforms=u,this.camera2=new Xi(-1,1,1,-1,0,1),this.scene2=new uo,this.quad2=new ta(new Qr(2,2),null),this.quad2.frustumCulled=!1,this.scene2.add(this.quad2),this.oldClearColor=new Nn,this.oldClearAlpha=1}function po(e,t){co.call(this),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}function fo(){co.call(this),this.needsSwap=!1}function mo(e,t){co.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Jr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Un.clone(e.uniforms),this.material=new Jr({defines:e.defines||{},uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.camera=new Xi(-1,1,1,-1,0,1),this.scene=new uo,this.quad=new ta(new Qr(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}function vo(e,t){if(this.renderer=e,void 0===t){var n={minFilter:Re,magFilter:Re,format:Qe,stencilBuffer:!1},i=e.getDrawingBufferSize();(t=new Gt(i.width,i.height,n)).texture.name="EffectComposer.rt1",t.texture.encoding=bt}this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],this.copyPass=new mo(kn.copy)}function go(e,t,n,i){mo.call(this,kn.fxaa),this.width=void 0!==n?n:512,this.height=void 0!==i?i:256,this.needsSwap=!1}function yo(){mo.call(this,kn.grayscale)}function xo(e){ci.call(this),this.type="MeshMaskMaterial",this.skinning=!1,this.morphTargets=!1,this.side=F,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function _o(e,t,n,i){this.renderScene=t,this.renderCamera=n,this.selectedObjects=void 0!==i?i:[],this.visibleEdgeColor=new Nn(1,1,1),this.hiddenEdgeColor=new Nn(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this.renderToScreen=!1,co.call(this),this.resolution=void 0!==e?new Rt(e.x,e.y):new Rt(256,256);var r={minFilter:Re,magFilter:Re,format:Qe},a=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new Gt(this.resolution.x,this.resolution.y,r),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.renderTargetDepthBuffer=new Gt(this.resolution.x,this.resolution.y,r),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new Gt(a,o,r),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new Gt(a,o,r),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new Gt(Math.round(a/2),Math.round(o/2),r),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new Gt(a,o,r),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new Gt(Math.round(a/2),Math.round(o/2),r),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value=new Rt(a,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value=new Rt(Math.round(a/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial();var s=kn.copy;this.copyUniforms=Un.clone(s.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Jr({uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:D,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Nn,this.oldClearAlpha=1,this.camera=new Xi(-1,1,1,-1,0,1),this.scene=new uo,this.quad=new ta(new Qr(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad),this.tempPulseColor1=new Nn,this.tempPulseColor2=new Nn,this.textureMatrix=new Nt,this._MorphingFlag=1,this._SkinningFlag=2,this._NumberOfMaterialVariants=1+(this._MorphingFlag|this._SkinningFlag),this._depthMaterials=new Array(this._NumberOfMaterialVariants),this._maskMaterials=new Array(this._NumberOfMaterialVariants);for(var l=0;l!==this._NumberOfMaterialVariants;++l){var c=0!=(l&this._MorphingFlag),u=0!=(l&this._SkinningFlag),h=new ui({blending:D,depthPacking:Lt,side:F,morphTargets:c,skinning:u});this._depthMaterials[l]=h;var d=new xo({side:F,morphTargets:c,skinning:u});this._maskMaterials[l]=d}}function bo(e,t,n,i,r){co.call(this),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=void 0!==r?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1}function wo(e,t,n,i){mo.call(this,kn.ssao),this.width=void 0!==n?n:512,this.height=void 0!==i?i:256,this.renderToScreen=!1,this.camera2=t,this.scene2=e,this.depthMaterial=new ui,this.depthMaterial.depthPacking=Lt,this.depthMaterial.blending=D,this.depthRenderTarget=new Gt(this.width,this.height,{minFilter:Re,magFilter:Re}),this.uniforms.tDepth.value=this.depthRenderTarget.texture,this.uniforms.size.value.set(this.width,this.height),this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far,this.uniforms.radius.value=4,this.uniforms.onlyAO.value=!1,this.uniforms.aoClamp.value=.25,this.uniforms.lumInfluence.value=.7;Object.defineProperties(this,{radius:{get:function(){return this.uniforms.radius.value},set:function(e){this.uniforms.radius.value=e}},onlyAO:{get:function(){return this.uniforms.onlyAO.value},set:function(e){this.uniforms.onlyAO.value=e}},aoClamp:{get:function(){return this.uniforms.aoClamp.value},set:function(e){this.uniforms.aoClamp.value=e}},lumInfluence:{get:function(){return this.uniforms.lumInfluence.value},set:function(e){this.uniforms.lumInfluence.value=e}}})}function Ao(e,t){this.name="",this.color=new Nn(e),this.density=void 0!==t?t:25e-5}function Mo(e,t,n){this.name="",this.color=new Nn(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function To(e){this.data=void 0!==e?e:null,this.equirecInvertU=!1,this.equirecOffsetU=0}function So(e){Gi.call(this),this.projected=new Dt,this.container=e,this.updatedCallback=null}function Eo(e,t,n){So.call(this,e),this.type="Annotation",this.character=t,this.text=n;var i=["position: absolute;","top: -26px;","left: -26px;","width: auto;","min-width: 14px;","height: 26px;","padding: 2px 8px;","border: 1px solid #fff;","border-radius: 18px;","font-size: 16px;","font-family: sans-serif;","line-height: 26px;","color: #fff;","text-align: center;","user-select: none;","background: rgba(0, 0, 0, 0.8);"].join("\n"),r=["position: absolute;","top: 0;","left: 0;","z-index: 1;","margin-left: 25px;","margin-top: 25px;","font-family: sans-serif;","user-select: none;","padding: 1em;","min-width: 200px;","color: #fff;","background: rgba(0, 0, 0, 0.8);","border-radius: .5em;","font-size: 12px;","line-height: 1.2;","transition: opacity .5s;","visibility: hidden;"].join("\n");this.annotation=document.createElement("div"),this.annotation.innerHTML=t,this.annotation.setAttribute("style",i),this.container.appendChild(this.annotation),this.annotationTextVisible=!1,this.annotationText=document.createElement("div"),this.annotationText.innerHTML=n,this.annotationText.setAttribute("style",r),this.annotation.appendChild(this.annotationText);var a=this;this.annotation.addEventListener("mousedown",function(e){e.target==a.annotation&&0!=a.annotationText.innerHTML.length&&(a.annotationTextVisible=!a.annotationTextVisible,a.annotationText.style.visibility=a.annotationTextVisible?"visible":"hidden")},!1)}function Lo(e,t,n,i,r){Gi.call(this),this.lensFlares=[],this.positionScreen=new Dt,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,i,r)}function Co(e){ci.call(this),this.type="SpriteMaterial",this.color=new Nn(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function Po(e){Gi.call(this),this.type="Sprite",this.material=void 0!==e?e:new Co}function Fo(){Gi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ro(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("v3d.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n=e.HAVE_CURRENT_DATA&&(c.needsUpdate=!0),requestAnimationFrame(t)})}function jo(e,t,n,i,r,a,o,s,l,c,u,h){zt.call(this,null,a,o,s,l,c,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Xo(e,t,n,i,r,a,o,s,l,c){if((c=void 0!==c?c:$e)!==$e&&c!==et)throw new Error("DepthTexture format must be either v3d.DepthFormat or v3d.DepthStencilFormat");void 0===n&&c===$e&&(n=Be),void 0===n&&c===et&&(n=He),zt.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Ce,this.minFilter=void 0!==s?s:Ce,this.flipY=!1,this.generateMipmaps=!1}function Wo(){this.name="",this.type="Constraint",this.mute=!1}function Ho(e){Wo.call(this),this.type="TargetConstraint",this.target=e}function Yo(e){Ho.call(this,e),this.type="ChildOfConstraint",this.offsetMatrix=new Nt}function qo(e){Ho.call(this,e),this.type="CopyLocationConstraint"}function Qo(e){Ho.call(this,e),this.type="CopyRotationConstraint"}function Zo(e){Ho.call(this,e),this.type="CopyScaleConstraint"}function Jo(e){Ho.call(this,e),this.type="FloorConstraint",this.floorLocation="Y",this.offset=0}function Ko(){Wo.call(this),this.type="LimitLocationConstraint",this.min=(new Dt).setScalar(-1/0),this.max=(new Dt).setScalar(1/0)}function $o(){Wo.call(this),this.type="LimitRotationConstraint",this.axis="Y",this.min=0,this.max=2*Math.PI}function es(){Wo.call(this),this.type="LimitScaleConstraint",this.min=(new Dt).setScalar(-1/0),this.max=(new Dt).setScalar(1/0)}function ts(e){Ho.call(this,e),this.type="LockedTrackConstraint",this.trackAxis="X",this.lockAxis="Y"}function ns(e){Ho.call(this,e),this.type="TrackToConstraint",this.trackAxis="X",this.upAxis="Y"}function is(e){Wr.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,l,c,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t=0?(h=e(v-1e-5,m,h),d.subVectors(u,h)):(h=e(v+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(h=e(v,m-1e-5,h),p.subVectors(u,h)):(h=e(v,m+1e-5,h),p.subVectors(h,u)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(i=0;i.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.addAttribute("position",new Gr(r,3)),this.addAttribute("normal",new Gr(r.slice(),3)),this.addAttribute("uv",new Gr(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function ls(e,t){Nr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new cs(e,t)),this.mergeVertices()}function cs(e,t){ss.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function us(e,t){Nr.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new hs(e,t)),this.mergeVertices()}function hs(e,t){ss.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ds(e,t){Nr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ps(e,t)),this.mergeVertices()}function ps(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];ss.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function fs(e,t){Nr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ms(e,t)),this.mergeVertices()}function ms(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];ss.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function vs(e,t,n,i,r,a){Nr.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("v3d.TubeGeometry: taper has been removed.");var o=new gs(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function gs(e,t,n,i,r){Wr.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new Dt,c=new Dt,u=new Rt,h=[],d=[],p=[],f=[];function m(r){var o=e.getPointAt(r/t),u=a.normals[r],p=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*u.x+m*p.x,c.y=v*u.y+m*p.y,c.z=v*u.z+m*p.z,c.normalize(),d.push(c.x,c.y,c.z),l.x=o.x+n*c.x,l.y=o.y+n*c.y,l.z=o.z+n*c.z,h.push(l.x,l.y,l.z)}}!function(){for(o=0;o0:i&&i.isGeometry&&(s=i.morphTargets&&i.morphTargets.length>0)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("v3d.OutlinePass: v3d.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&t.skinning,c=0;s&&(c|=this._MorphingFlag),l&&(c|=this._SkinningFlag),r=a[c]}r.visible=t.visible,r.wireframe=t.wireframe;var u=t.side;return r.side=u,r.clipShadows=t.clipShadows,r.clippingPlanes=t.clippingPlanes,r.clipIntersection=t.clipIntersection,r.wireframeLinewidth=t.wireframeLinewidth,r.linewidth=t.linewidth,n&&(r.cameraNearFar=new Rt(this.renderCamera.near,this.renderCamera.far),r.depthTexture=this.renderTargetDepthBuffer.texture,r.textureMatrix=this.textureMatrix),r},renderObject:function(e,t,n,i){if(t.outlineVisible&&t.isVisible()&&t.layers.test(n.layers)){var r=e.updateGeometry(t),a=t.material;if(a.visible){var o=this.getDepthMaterial(t,a,i);e.renderBufferDirect(n,null,r,o,t,null)}}for(var s=t.children,l=0,c=s.length;l0){var s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)}this.quad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value=new Rt(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer1,!0),this.quad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=_o.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.render(this.scene,this.camera,this.renderTargetBlurBuffer1,!0),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=_o.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer1,!0),this.quad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=_o.BlurDirectionX,e.render(this.scene,this.camera,this.renderTargetBlurBuffer2,!0),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=_o.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer2,!0),this.quad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,r&&e.context.enable(e.context.STENCIL_TEST),e.render(this.scene,this.camera,n,!1),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a}},getEdgeDetectionMaterial:function(){return new Jr(kn.outline_edge)},getSeperableBlurMaterial:function(e){var t=new Jr(kn.outline_blur);return t.defines.MAX_RADIUS=e,t},getOverlayMaterial:function(){var e=new Jr(kn.outline_overlay);return e.blending=U,e.depthTest=!1,e.depthWrite=!1,e.transparent=!0,e},setCamera:function(e){this.renderCamera=e}}),_o.BlurDirectionX=new Rt(1,0),_o.BlurDirectionY=new Rt(0,1),bo.prototype=Object.assign(Object.create(co.prototype),{constructor:bo,render:function(e,t,n,i,r){var a,o,s=e.autoClear;e.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(a=e.getClearColor().getHex(),o=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.render(this.scene,this.camera,this.renderToScreen?null:n,this.clear),this.clearColor&&e.setClearColor(a,o),this.scene.overrideMaterial=null,e.autoClear=s},setCamera:function(e){this.camera=e}}),wo.prototype=Object.create(mo.prototype),wo.prototype.render=function(e,t,n,i,r){this.scene2.overrideMaterial=this.depthMaterial,e.render(this.scene2,this.camera2,this.depthRenderTarget,!0),this.scene2.overrideMaterial=null,mo.prototype.render.call(this,e,t,n,i,r)},wo.prototype.setScene=function(e){this.scene2=e},wo.prototype.setCamera=function(e){this.camera2=e,this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far},wo.prototype.setSize=function(e,t){this.width=e,this.height=t,this.uniforms.size.value.set(this.width,this.height),this.depthRenderTarget.setSize(this.width,this.height)},Ao.prototype.isFogExp2=!0,Ao.prototype.clone=function(){return new Ao(this.color.getHex(),this.density)},Ao.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Mo.prototype.isFog=!0,Mo.prototype.clone=function(){return new Mo(this.color.getHex(),this.near,this.far)},Mo.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Object.assign(To.prototype,{isSceneBackground:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){null===e.data?this.data=null:e.data.isColor?this.data=e.data.clone():e.data.isCubeTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):this.data=e.data,this.equirecInvertU=e.equirecInvertU,this.equirecOffsetU=e.equirecOffsetU},toJSON:function(e){var t={metadata:{version:4.5,type:"SceneBackground",generator:"SceneBackground.toJSON"}};return null!==this.data&&(t.data=this.data.toJSON(e)),!0===this.equirecInvertU&&(t.equirecInvertU=!0),0!==this.equirecOffsetU&&(t.equirecOffsetU=this.equirecOffsetU),t}}),So.prototype=Object.assign(Object.create(Gi.prototype),{constructor:So,isAnnotation:!0,clone:function(){return new this.constructor(this.container).copy(this)},update:function(e){var t=this.projected;this.getWorldPosition(t).project(e);var n=this.container.offsetWidth,i=this.container.offsetHeight,r=(.5+t.x/2)*n,a=(.5-t.y/2)*i;t.x=r,t.y=a;var o=t.z<=1&&r>=0&&r<=n&&a>=0&&a<=i;this.visible=o,this.updatedCallback&&this.updatedCallback(t.x,t.y,o)}}),Eo.prototype=Object.assign(Object.create(So.prototype),{constructor:Eo,isAnnotation:!0,raycast:function(){},clone:function(){return new this.constructor(this.container,this.character,this.text).copy(this)},update:function(e){So.prototype.update.call(this,e);var t=this.projected,n=this.annotation;n.style.transform="translate("+t.x+"px, "+t.y+"px)",n.style.visibility=this.visible?"visible":"hidden"}}),Lo.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Lo,isLensFlare:!0,copy:function(e){Gi.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,n=e.lensFlares.length;tn)){var i=e.ray.origin.distanceTo(la);ie.far||t.push({distance:i,point:la.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),Fo.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Fo,copy:function(e){Gi.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){ha.setFromMatrixPosition(e.matrixWorld),da.setFromMatrixPosition(this.matrixWorld);var n=ha.distanceTo(da);t[0].object.visible=!0;for(var i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(;ii||(c.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(c))e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,m=d.length/3-1;fi||(c.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(c))e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(r.isGeometry){var y=r.vertices,x=y.length;for(f=0;fi||(c.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(c))e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Uo.prototype=Object.assign(Object.create(Oo.prototype),{constructor:Uo,isLineSegments:!0}),Bo.prototype=Object.assign(Object.create(Oo.prototype),{constructor:Bo,isLineLoop:!0}),ko.prototype=Object.create(ci.prototype),ko.prototype.constructor=ko,ko.prototype.isPointsMaterial=!0,ko.prototype.copy=function(e){return ci.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},zo.prototype=Object.assign(Object.create(Gi.prototype),{constructor:zo,isPoints:!0,raycast:(xa=new Nt,_a=new Kr,ba=new pi,function(e,t){var n=this,i=this.geometry,r=this.matrixWorld,a=e.params.Points.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),ba.copy(i.boundingSphere),ba.applyMatrix4(r),ba.radius+=a,!1!==e.ray.intersectsSphere(ba)){xa.getInverse(r),_a.copy(e.ray).applyMatrix4(xa);var o=a/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new Dt;if(i.isBufferGeometry){var c=i.index,u=i.attributes.position.array;if(null!==c)for(var h=c.array,d=0,p=h.length;de.far)return;t.push({distance:c,distanceToRay:Math.sqrt(o),point:l.clone(),index:a,face:null,object:n})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Vo.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Vo}),Go.prototype=Object.create(zt.prototype),Go.prototype.constructor=Go,jo.prototype=Object.create(zt.prototype),jo.prototype.constructor=jo,jo.prototype.isCompressedTexture=!0,Xo.prototype=Object.create(zt.prototype),Xo.prototype.constructor=Xo,Xo.prototype.isDepthTexture=!0,Object.assign(Wo.prototype,{isConstraint:!0,update:function(e){this.mute},copy:function(e){return this.name=e.name,this.mute=e.mute,this},clone:function(){return(new this.constructor).copy(this)}}),Ho.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Ho,isTargetConstraint:!0,copy:function(e){Wo.prototype.copy.call(this,e),this.target=e.target}}),Yo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:Yo,isChildOfConstraint:!0,copy:function(e){Ho.prototype.copy.call(this,e),this.offsetMatrix.copy(e.offsetMatrix)},update:(wa=new Nt,function(e){Ho.prototype.update.call(this,e),this.mute||(wa.multiplyMatrices(this.target.matrixWorld,this.offsetMatrix),wa.decompose(e.position,e.quaternion,e.scale))})}),qo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:qo,isCopyLocationConstraint:!0,update:(Aa=new It,Ma=new Dt,function(e){Ho.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(e.position,Aa,Ma),e.parent&&e.parent.worldToLocal(e.position))})}),Qo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:Qo,isCopyRotationConstraint:!0,update:(Ta=new Dt,Sa=new It,Ea=new Dt,function(e){Ho.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(Ta,e.quaternion,Ea),e.parent&&(e.parent.matrixWorld.decompose(Ta,Sa,Ea),e.quaternion.premultiply(Sa.inverse())))})}),Zo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:Zo,isCopyScaleConstraint:!0,update:function(e){Ho.prototype.update.call(this,e),this.mute||e.scale.copy(this.target.scale)}}),Jo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:Jo,isFloorConstraint:!0,copy:function(e){Ho.prototype.copy.call(this,e),this.floorLocation=e.floorLocation,this.offset=e.offset},update:function(e){if(Ho.prototype.update.call(this,e),!this.mute){var t=e.position,n=this.target.position,i=this.offset;switch(this.floorLocation){case"X":t.x=Math.max(t.x,n.x+i);break;case"Y":t.y=Math.max(t.y,n.y+i);break;case"Z":t.z=Math.max(t.z,n.z+i);break;case"-X":t.x=Math.min(t.x,n.x+i);break;case"-Y":t.y=Math.min(t.y,n.y+i);break;case"-Z":t.z=Math.min(t.z,n.z+i)}}}}),Ko.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Ko,isLimitLocationConstraint:!0,copy:function(e){Wo.prototype.copy.call(this,e),this.min.copy(e.min),this.max.copy(e.max)},update:function(e){Wo.prototype.update.call(this,e),this.mute||e.position.clamp(this.min,this.max)}}),$o.prototype=Object.assign(Object.create(Wo.prototype),{constructor:$o,isLimitRotationConstraint:!0,copy:function(e){Wo.prototype.copy.call(this,e),this.axis=e.axis,this.min=e.min,this.max=e.max},update:(La=new yi,function(e){Wo.prototype.update.call(this,e),this.mute||("X"==this.axis?(La.setFromQuaternion(e.quaternion,"XYZ"),La.x=this._clampAngle(La.x,this.min,this.max)):"Y"==this.axis?(La.setFromQuaternion(e.quaternion,"YZX"),La.y=this._clampAngle(La.y,this.min,this.max)):"Z"==this.axis&&(La.setFromQuaternion(e.quaternion,"ZXY"),La.z=this._clampAngle(La.z,this.min,this.max)),e.quaternion.setFromEuler(La))}),_clampAngle:function(e,t,n){return Math.abs(n-t)<2*Math.PI&&((e=Ft.angleToRange_0_2Pi(e-t))>(n=Ft.angleToRange_0_2Pi(n-t))&&(e=e0?1:-1;e.setRotationFromAxisAngle(Ia.normal,t*Fa.angleTo(Na)),e.parent&&(e.parent.matrixWorld.decompose(Oa,Ua,Oa),e.quaternion.premultiply(Ua.inverse()))}})}),ns.prototype=Object.assign(Object.create(Ho.prototype),{constructor:ns,isTrackToConstraint:!0,copy:function(e){Ho.prototype.copy.call(this,e),this.trackAxis=e.trackAxis,this.upAxis=e.upAxis},update:(Ba=new fi,ka=new Dt,za=new Dt,Va=new Dt,Ga=new Dt,ja=new Dt,Xa=new Nt,Wa=new Dt,Ha=new It,Ya=new Dt(0,1,0),function(e){if(Ho.prototype.update.call(this,e),!this.mute){var t=this.trackAxis[this.trackAxis.length-1],n=this.upAxis[this.upAxis.length-1],i="-"==this.trackAxis[0],r="-"==this.upAxis[0];if(t!=n){ka.setFromMatrixPosition(e.matrixWorld),za.setFromMatrixPosition(this.target.matrixWorld),Va.subVectors(za,ka),Va.lengthSq()?Va.normalize():Va.set(0,-1,0),Ba.set(Va,0),1!=Math.abs(Va.dot(Ya))?Ba.projectPoint(Ya,Ga).normalize():Ga.set(0,0,-1),i&&Va.negate(),r&&Ga.negate();var a="X"==t?Va:"X"==n?Ga:null,o="Y"==t?Va:"Y"==n?Ga:null,s="Z"==t?Va:"Z"==n?Ga:null;a?o?s||(s=ja.crossVectors(a,o)):o=ja.crossVectors(s,a):a=ja.crossVectors(o,s),Xa.makeBasis(a,o,s),e.setRotationFromMatrix(Xa),e.parent&&(e.parent.matrixWorld.decompose(Wa,Ha,Wa),e.quaternion.premultiply(Ha.inverse()))}}})}),is.prototype=Object.create(Wr.prototype),is.prototype.constructor=is,rs.prototype=Object.create(Nr.prototype),rs.prototype.constructor=rs,as.prototype=Object.create(Wr.prototype),as.prototype.constructor=as,os.prototype=Object.create(Nr.prototype),os.prototype.constructor=os,ss.prototype=Object.create(Wr.prototype),ss.prototype.constructor=ss,ls.prototype=Object.create(Nr.prototype),ls.prototype.constructor=ls,cs.prototype=Object.create(ss.prototype),cs.prototype.constructor=cs,us.prototype=Object.create(Nr.prototype),us.prototype.constructor=us,hs.prototype=Object.create(ss.prototype),hs.prototype.constructor=hs,ds.prototype=Object.create(Nr.prototype),ds.prototype.constructor=ds,ps.prototype=Object.create(ss.prototype),ps.prototype.constructor=ps,fs.prototype=Object.create(Nr.prototype),fs.prototype.constructor=fs,ms.prototype=Object.create(ss.prototype),ms.prototype.constructor=ms,vs.prototype=Object.create(Nr.prototype),vs.prototype.constructor=vs,gs.prototype=Object.create(Wr.prototype),gs.prototype.constructor=gs,ys.prototype=Object.create(Nr.prototype),ys.prototype.constructor=ys,xs.prototype=Object.create(Wr.prototype),xs.prototype.constructor=xs,_s.prototype=Object.create(Nr.prototype),_s.prototype.constructor=_s,bs.prototype=Object.create(Wr.prototype),bs.prototype.constructor=bs;var ws={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r=-Number.EPSILON&&w>=-Number.EPSILON&&b>=-Number.EPSILON))return!1;return!0}return function(t,n){var i=t.length;if(i<3)return null;var r,a,o,s=[],l=[],c=[];if(ws.area(t)>0)for(a=0;a2;){if(h--<=0)return console.warn("v3d.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?c:s;if(u<=(r=a)&&(r=0),u<=(a=r+1)&&(a=0),u<=(o=a+1)&&(o=0),e(t,r,a,o,u,l)){var d,p,f,m,v;for(d=l[r],p=l[a],f=l[o],s.push([t[d],t[p],t[f]]),c.push([l[r],l[a],l[o]]),m=a,v=a+1;v2&&e[t-1].equals(e[0])&&e.pop()}function i(e,t,n){return e.x!==t.x?e.xNumber.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=c*u-l*h)<0||f>d)return[]}else{if(p>0||p0||fA?[]:y===A?a?[]:[v]:x<=A?[v,g]:[v,b])}function a(e,t,n,i){var r=t.x-e.x,a=t.y-e.y,o=n.x-e.x,s=n.y-e.y,l=i.x-e.x,c=i.y-e.y,u=r*s-a*o,h=r*c-a*l;if(Math.abs(u)>Number.EPSILON){var d=l*s-c*o;return u>0?h>=0&&d>=0:h>=0||d>=0}return h>0}n(e),t.forEach(n);for(var o,s,l,c,u,h,d={},p=e.concat(),f=0,m=t.length;fr&&(s=0);var l=a(i[e],i[o],i[s],n[t]);if(!l)return!1;var c=n.length-1,u=t-1;u<0&&(u=c);var h=t+1;return h>c&&(h=0),!!(l=a(n[t],n[u],n[h],i[e]))}function s(e,t){var n,a;for(n=0;n0)return!0;return!1}var l=[];function c(e,n){var i,a,o,s;for(i=0;i0)return!0;return!1}for(var u,h,d,p,f,m,v,g,y,x,_=[],b=0,w=t.length;b0;){if(--M<0){console.log('v3d.ShapeUtils: Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!');break}for(h=A;h=0)break;_[m]=!0}if(u>=0)break}}return i}(e,t),g=ws.triangulate(v,!1);for(o=0,s=g.length;o0)&&f.push(b,w,M),(l!==n-1||c0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.addAttribute("position",new Gr(u,3)),this.addAttribute("normal",new Gr(h,3)),this.addAttribute("uv",new Gr(d,2))}function Bs(e,t,n,i,r,a,o){Os.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function ks(e,t,n,i,r,a,o){Us.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function zs(e,t,n,i){Nr.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new Vs(e,t,n,i)),this.mergeVertices()}function Vs(e,t,n,i){Wr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],l=[],c=[],u=new Dt,h=new Rt;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[r]/e+1)/2,h.y=(s[r+1]/e+1)/2,c.push(h.x,h.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new Gr(s,3)),this.addAttribute("normal",new Gr(l,3)),this.addAttribute("uv",new Gr(c,2))}As.prototype=Object.create(Nr.prototype),As.prototype.constructor=As,Ms.prototype=Object.create(Wr.prototype),Ms.prototype.constructor=Ms,Ms.prototype.getArrays=function(){var e=this.getAttribute("position"),t=e?Array.prototype.slice.call(e.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:t,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},Ms.prototype.addShapeList=function(e,t){var n=e.length;t.arrays=this.getArrays();for(var i=0;iNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(i=f+o*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new Rt(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(u)):(i=o,r=s,a=Math.sqrt(u/2))}return new Rt(i/a,r/a)}for(var V=[],G=0,j=P.length,X=j-1,W=G+1;G=0;R--){for(I=R/y,D=v*Math.cos(I*Math.PI/2),N=g*Math.sin(I*Math.PI/2),G=0,j=P.length;G=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,a=b+2*y;for(r=0;r1;){var n=Math.floor(t/2);if(!e.less(this.s[t],this.s[n],this.compare))break;e.exchange(this.s,t,n),t=n}},r.prototype.delMin=function(){if(0!=this.N){var t=this.s[1];return e.exchange(this.s,1,this.N--),this.sink(1),t}},r.prototype.sink=function(t){for(;2*t<=this.N;){var n=2*t;if(n1;){var n=Math.floor(t/2);if(!e.less(this.keys[this.pq[t]],this.keys[this.pq[n]],this.compare))break;e.exchange(this.pq,t,n),this.qp[this.pq[t]]=t,this.qp[this.pq[n]]=n,t=n}},o.prototype.sink=function(t){for(;2*t<=this.N;){var n=2*t;if(nn&&(i=n+"_"+t),this.edges[i]=new e.Edge(t,n,0)},l.prototype.adj=function(e){return this.adjList[e]},l.prototype.node=function(e){return this.nodeInfo[e]},l.prototype.len=function(){return this.V},l.prototype.edge=function(e,t){var n=e+"_"+t;return e>t&&(n=t+"_"+e),n in this.edges?this.edges[n]:null},e.Graph=l;var c=function(e){this.V=e,this.adjList=[],this.nodeInfo=[],this.edges={};for(var t=0;te?n-1:n,u=s>e?s-1:s,h=this.edge(n,s).copy();h.v=l,h.w=u,o.addEdge(h)}this.V--,this.adjList=o.adjList,this.nodeInfo.splice(e,1),this.edges=o.edges}},c.prototype.insert=function(e,n,i){for(var r=this.V,a=e.V,o=0;o "+i[r]+";"}}t+="}",console.log(t)},e.DiGraph=c;var u=function(e,t,n){this.v=e,this.w=t,this.weight=n};u.prototype.either=function(){return this.v},u.prototype.other=function(e){return e==this.v?this.w:this.v},u.prototype.from=function(){return this.v},u.prototype.to=function(){return this.w},u.prototype.copy=function(){var e=new u(0,0,0);for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},e.Edge=u;var h=function(e){this.V=e,this.adjList=[],this.nodeInfo=[];for(var t=0;tthis.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.edgeTo[n]=e,this.pq.containsIndex(n)?this.pq.decreaseKey(n,this.cost[n]):this.pq.insert(n,this.cost[n]))},w.prototype.hasPathTo=function(e){return this.marked[e]},w.prototype.pathTo=function(t){for(var n=new e.Stack,i=t;i!=this.s;i=this.edgeTo[i].from())n.push(this.edgeTo[i]);return n.toArray()},w.prototype.distanceTo=function(e){return this.cost[e]},e.Dijkstra=w;var A=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[];for(var i=0;ithis.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},A.prototype.hasPathTo=function(e){return this.marked[e]},A.prototype.pathTo=function(t){for(var n=new e.Stack,i=t;i!=this.s;i=this.edgeTo[i].from())n.push(this.edgeTo[i]);return n.toArray()},A.prototype.distanceTo=function(e){return this.cost[e]},e.BellmanFord=A;var M=function(t,n){var i=t.V;this.s=n,this.marked=[],this.edgeTo=[],this.cost=[];for(var r=0;rthis.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},M.prototype.hasPathTo=function(e){return this.marked[e]},M.prototype.pathTo=function(t){for(var n=new e.Stack,i=t;i!=this.s;i=this.edgeTo[i].from())n.push(this.edgeTo[i]);return n.toArray()},M.prototype.distanceTo=function(e){return this.cost[e]},e.TopologicalSortShortestPaths=M;var T=function(e,t,n){this.value=0;e.V;var i=Number.MAX_VALUE;for(this.marked=null,this.edgeTo=null,this.s=t,this.t=n;this.hasAugmentedPath(e);){for(var r=this.t;r!=this.s;r=this.edgeTo[r].from())i=Math.min(i,this.edgeTo[r].residualCapacityTo(r));for(r=this.t;r!=this.s;r=this.edgeTo[r].from())this.edgeTo[r].addResidualFlowTo(r,i);this.value+=i}};T.prototype.hasAugmentedPath=function(t){var n=t.V;this.marked=[],this.edgeTo=[];for(var i=0;i0){if(this.edgeTo[l]=s,this.marked[l]=!0,l==this.t)return!0;r.enqueue(l)}}}return!1},T.prototype.minCut=function(e){for(var t=[],n=e.V,i=0;i=r)break e;var s=t[1];e=(r=t[--n-1]))break t}a=n,n=0}for(;n>>1;e-1){i.removedNodes.push(a+e.len());for(var s=e.findInEdges(n),l=t.findOutEdges(a),c=0;c0||f(e,a,el))&&(t.advancedPBR=!0);break;case"BUMP":Q.params.push(x("1"));break;case"CURVE_RGB":case"CURVE_VEC":var p,A,S,E,L=new Uint8Array(4*sl),C=Z.curveData.length/sl;for(s=0;s3?(p=255*Z.curveData[C*s],A=255*Z.curveData[C*s+1],S=255*Z.curveData[C*s+2],E=255*Z.curveData[C*s+3]):(p=255*(Z.curveData[C*s]/2+.5),A=255*(Z.curveData[C*s+1]/2+.5),S=255*(Z.curveData[C*s+2]/2+.5),E=255),L[4*s]=Ft.clamp(p,0,255),L[4*s+1]=Ft.clamp(A,0,255),L[4*s+2]=Ft.clamp(S,0,255),L[4*s+3]=Ft.clamp(E,0,255);var P=d(L),F=ll.nodeTexUniName(o,n);t.nodeTextures[F]=P,Q.params.push(y(o,n)),n++;break;case"FRESNEL":case"LAYER_WEIGHT":Q.params.push(x("vViewPosition"));break;case"GEOMETRY":if(Q.params.push(x("vViewPosition")),Q.params.push(x("normal")),Q.params.push(x("vec3(0.0)")),m(e,a,Qs)){c=_(o,a,2,"uv");var R=u(Z.uvLayer);Q.attributes.push({name:R,type:"attribute vec2",paramVary:c}),Q.params.push(c)}else Q.params.push(x("vec2(0.5)"));if(m(e,a,Zs)){c=_(o,a,4,"vc");var N=h(Z.colorLayer);Q.attributes.push({name:N,type:"attribute vec4",paramVary:c}),Q.params.push(c)}else Q.params.push(x("vec4(0.0)"));break;case"MAPPING":var I=new Nt,D=new yi;switch(D.set(Z.rotation[0],Z.rotation[1],Z.rotation[2],"ZYX"),I.makeRotationFromEuler(D),I.scale((new Dt).fromArray(Z.scale)),Z.vectorType){case"TEXTURE":I.setPosition((new Dt).fromArray(Z.translation)),I.getInverse(I);break;case"POINT":I.setPosition((new Dt).fromArray(Z.translation));break;case"VECTOR":break;case"NORMAL":Q.outputs[0].normalize=!0,I.getInverse(I),I.transpose();break;default:throw new Error("v3d.MeshNodeMaterial: Unknown MAPPING vector type")}Q.params.push(g(o,a,I.toArray(),"mat")),Q.params.push(g(o,a,Z.min,"min")),Q.params.push(g(o,a,Z.max,"max")),Q.params.push(g(o,a,Z.useMin,"use_min")),Q.params.push(g(o,a,Z.useMax,"use_max"));break;case"MATERIAL":case"MATERIAL_EXT":bi(Z.materialName)?(Q.params.push(g(o,a,Z.useDiffuse,"use_diff")),Q.params.push(g(o,a,Z.useSpecular,"use_spec")),Q.params.push(g(o,a,Z.invertNormal,"inv_nor")),Q.params.push(g(o,a,Z.specularIntensity,"spec_int")),Q.params.push(g(o,a,Z.specularHardness,"spec_hard")),"MATERIAL"==o&&(Q.params.push(g(o,a,Z.ambient,"ambient")),Q.params.push(g(o,a,Z.emit,"emit")),Q.params.push(g(o,a,Z.alpha,"alpha"))),Q.params.push(g(o,a,Z.useShadeless,"use_shless"))):(Q.params.push(g(o,a,!1,"use_diff")),Q.params.push(g(o,a,!1,"use_spec")),Q.params.push(g(o,a,!1,"inv_nor")),Q.params.push(g(o,a,0,"spec_int")),Q.params.push(g(o,a,0,"spec_hard")),"MATERIAL"==o&&(Q.params.push(g(o,a,0,"ambient")),Q.params.push(g(o,a,0,"emit")),Q.params.push(g(o,a,0,"alpha"))),Q.params.push(g(o,a,!1,"use_shless"))),Q.params.push(x("1"));break;case"NEW_GEOMETRY":Q.params.push(x("vViewPosition")),Q.params.push(x("normal"));break;case"NORMAL_MAP":c=_(o,a,4,"tangent"),Q.attributes.push({name:"tangent",type:"attribute vec4",paramVary:c}),Q.params.push(c),Q.params.push(x("vNormal"));break;case"TEX_COORD":Q.params.push(x("vViewPosition")),Q.params.push(x("normal")),c=_(o,a,2,"uv"),Q.attributes.push({name:"uv",type:"attribute vec2",paramVary:c}),Q.params.push(c);break;case"TEX_IMAGE":var O=y(o,Z.texture);Q.params.push(O);var U=t.nodeTextures[O.name].encoding;Q.params.push(g(o,a,U==bt,"use_srgb"));break;case"TEXTURE":case"TEXTURE_CUBE":O=y("TEXTURE",Z.texture),Q.params.push(O),U=t.nodeTextures[O.name].encoding,Q.params.push(g("TEXTURE",a,U==bt,"use_srgb")),Z.type=O.type.indexOf("samplerCube")>-1?"TEXTURE_CUBE":"TEXTURE";break;case"MATH":case"MIX_RGB":Q.outputs[0].clamp=Z.useClamp;break;case"NORMAL":Q.params.push(g(o,a,Z.outputs[0],"out"));break;case"RGB":O=(new Vt).fromArray(Z.outputs[0]),t.nodeRGB.push(O),t.nodeRGBMap[Z.name]=i,Q.params.push(x("nodeRGB["+i+"]")),i++;break;case"UVMAP":c=_(o,a,2,"uv"),R=u(Z.uvLayer),Q.attributes.push({name:R,type:"attribute vec2",paramVary:c}),Q.params.push(c);break;case"VALUE":O=Z.outputs[0],t.nodeValue[r]=O,t.nodeValueMap[Z.name]=r,Q.params.push(x("nodeValue["+r+"]")),r++;break;case"VALTORGB":var B=Z.curve,k=new qs(new Float32Array(B.input),new Float32Array(B.output),4);for(L=new Uint8Array(4*sl),s=0;s-1){var p=y.type+" "+y.name+";";r.indexOf(p)<0&&r.push(p)}else y.type.indexOf("varying")>-1?(n.push(y.type+" "+y.name+";"),r.push(y.type+" "+y.name+";")):y.type&&a.push(y.type+" "+y.name+"="+M(y.type,y.value)+";");for(h=0;h0||0===e.search(/^data\:image\/jpeg/);a.format=n?qe:Qe,a.needsUpdate=!0,void 0!==t&&t(a)},n,i),a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Rl.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Rl,isLight:!0,copy:function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this.receiveShadow=e.receiveShadow,this.isFreeLight=e.isFreeLight,this},toJSON:function(e){var t=Gi.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Nl.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Nl,isHemisphereLight:!0,copy:function(e){return Rl.prototype.copy.call(this,e),this.target=e.target.clone(),this.groundColor.copy(e.groundColor),this},updateMatrixWorld:function(e){Gi.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(wl=new Dt,function(){wl.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,wl),this.target.updateMatrix()})}),Object.assign(Il.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Dl.prototype=Object.assign(Object.create(Il.prototype),{constructor:Dl,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*Ft.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix())}}),Ol.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Ol,isSpotLight:!0,copy:function(e){return Rl.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},updateMatrixWorld:function(e){Gi.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(Al=new Dt,function(){Al.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,Al),this.target.updateMatrix()})}),Ul.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Ul,isPointLight:!0,copy:function(e){return Rl.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Bl.prototype=Object.assign(Object.create(Il.prototype),{constructor:Bl}),kl.prototype=Object.assign(Object.create(Rl.prototype),{constructor:kl,isDirectionalLight:!0,copy:function(e){return Rl.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},updateMatrixWorld:function(e){Gi.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(Ml=new Dt,function(){Ml.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,Ml),this.target.updateMatrix()})}),zl.prototype=Object.assign(Object.create(Rl.prototype),{constructor:zl,isAmbientLight:!0}),Vl.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Vl,isRectAreaLight:!0,copy:function(e){return Rl.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Rl.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});var Gl,jl={arraySlice:function(e,t,n){return jl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}};function Xl(e,t,n,i){Ys.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Wl(e,t,n,i){Ys.call(this,e,t,n,i)}function Hl(e,t,n,i){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=jl.convertArray(t,this.TimeBufferType),this.values=jl.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Yl(e,t,n,i){Hl.call(this,e,t,n,i)}function ql(e,t,n,i){Ys.call(this,e,t,n,i)}function Ql(e,t,n,i){Hl.call(this,e,t,n,i)}function Zl(e,t,n,i){Hl.call(this,e,t,n,i)}function Jl(e,t,n,i){Hl.call(this,e,t,n,i)}function Kl(e,t,n){Hl.call(this,e,t,n)}function $l(e,t,n,i){Hl.call(this,e,t,n,i)}function ec(e,t,n,i){Hl.apply(this,e,t,n,i)}function tc(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Ft.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function nc(e){this.manager=void 0!==e?e:_l,this.textures={}}function ic(e){this.manager=void 0!==e?e:_l}Xl.prototype=Object.assign(Object.create(Ys.prototype),{constructor:Xl,DefaultSettings_:{endingStart:ft,endingEnd:ft},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case mt:r=e,o=2*t-n;break;case vt:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case mt:a=e,s=2*n-t;break;case vt:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)r[_]=v*a[c+_]+g*a[l+_]+y*a[s+_]+x*a[u+_];return r}}),Wl.prototype=Object.assign(Object.create(Ys.prototype),{constructor:Wl,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Gl={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:dt,InterpolantFactoryMethodDiscrete:function(e){return new Wl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new qs(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Xl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case ht:t=this.InterpolantFactoryMethodDiscrete;break;case dt:t=this.InterpolantFactoryMethodLinear;break;case pt:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)this.createInterpolant=t;else{var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}console.warn("v3d.KeyframeTrackPrototype:",n)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ht;case this.InterpolantFactoryMethodLinear:return dt;case this.InterpolantFactoryMethodSmooth:return pt}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=jl.arraySlice(n,r,a),this.values=jl.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("v3d.KeyframeTrackPrototype: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("v3d.KeyframeTrackPrototype: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("v3d.KeyframeTrackPrototype: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("v3d.KeyframeTrackPrototype: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&jl.isTypedArray(i)){o=0;for(var l=i.length;o!==l;++o){var c=i[o];if(isNaN(c)){console.error("v3d.KeyframeTrackPrototype: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===pt,r=1,a=e.length-1,o=1;o0){e[r]=e[a];for(f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length&&(this.times=jl.arraySlice(e,0,r),this.values=jl.arraySlice(t,0,r*n)),this}},Yl.prototype=Object.assign(Object.create(Gl),{constructor:Yl,ValueTypeName:"vector"}),ql.prototype=Object.assign(Object.create(Ys.prototype),{constructor:ql,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),c=s+o;s!==c;s+=4)It.slerpFlat(r,0,a,s-o,a,s,l);return r}}),Ql.prototype=Object.assign(Object.create(Gl),{constructor:Ql,ValueTypeName:"quaternion",DefaultInterpolation:dt,InterpolantFactoryMethodLinear:function(e){return new ql(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Zl.prototype=Object.assign(Object.create(Gl),{constructor:Zl,ValueTypeName:"number"}),Jl.prototype=Object.assign(Object.create(Gl),{constructor:Jl,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ht,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kl.prototype=Object.assign(Object.create(Gl),{constructor:Kl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ht,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$l.prototype=Object.assign(Object.create(Gl),{constructor:$l,ValueTypeName:"color"}),ec.prototype=Gl,Gl.constructor=ec,Object.assign(ec,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=ec._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],i=[];jl.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:jl.convertArray(e.times,Array),values:jl.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zl;case"vector":case"vector2":case"vector3":case"vector4":return Yl;case"color":return $l;case"quaternion":return Ql;case"bool":case"boolean":return Kl;case"string":return Jl}throw new Error("Unsupported typeName: "+e)}}),Object.assign(tc,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(ec.parse(n[r]).scale(i));return new tc(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t},r=0,a=n.length;r!==a;++r)t.push(ec.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o1){var c=i[h=l[1]];c||(i[h]=c=[]),c.push(s)}}var u=[];for(var h in i)u.push(tc.CreateFromMorphTargetSequence(h,i[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("v3d.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];jl.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l1?e.skinWeights[i+1]:0,s=n>2?e.skinWeights[i+2]:0,l=n>3?e.skinWeights[i+3]:0;t.skinWeights.push(new Vt(a,o,s,l))}if(e.skinIndices)for(i=0,r=e.skinIndices.length;i1?e.skinIndices[i+1]:0,h=n>2?e.skinIndices[i+2]:0,d=n>3?e.skinIndices[i+3]:0;t.skinIndices.push(new Vt(c,u,h,d))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,n),function(e,t){var n=e.scale;if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;i0){console.warn('v3d.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var u=t.faces,h=e.morphColors[0].colors;for(i=0,r=u.length;i0&&(t.animations=n)}(e,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:{geometry:n,materials:uc.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}()}),Object.assign(dc.prototype,{load:function(e,t,n,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this;new El(r.manager).load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("v3d:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("v3d.ObjectLoader: Can't load "+e+". Use v3d.JSONLoader instead.")},n,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(o)}),r=this.parseTextures(e.textures,i),a=this.parseMaterials(e.materials,r),o=this.parseObject(e.object,n,a);return e.animations&&(o.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new hc,i=new ic,r=0,a=e.length;r0){var a=new bl(new xl(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o0?new Io(o,s):new ta(o,s);break;case"LOD":i=new Fo;break;case"Line":i=new Oo(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new Bo(r(e.geometry),a(e.material));break;case"LineSegments":i=new Uo(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new zo(r(e.geometry),a(e.material));break;case"Sprite":i=new Po(a(e.material));break;case"Group":i=new Vo;break;default:i=new Gi}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(lc.fromArray(e.matrix),lc.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.children)for(var l=e.children,c=0;c1&&(bc.thisProgram=process.argv[1].replace(/\\/g,"/")),bc.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=bc),process.on("uncaughtException",function(e){if(!(e instanceof Su))throw e}),process.on("unhandledRejection",function(e,t){process.exit(1)}),bc.inspect=function(){return"[Emscripten Module object]"}):Lc?("undefined"!=typeof read&&(bc.read=function(e){var t=mu(e);return t?pu(t):read(e)}),bc.readBinary=function(e){var t;return(t=mu(e))?t:"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(Rc("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?bc.arguments=scriptArgs:void 0!==arguments&&(bc.arguments=arguments),"function"==typeof quit&&(bc.quit=function(e,t){quit(e)})):(Tc||Sc)&&(bc.read=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText}catch(t){var n=mu(e);if(n)return pu(n);throw t}},Sc&&(bc.readBinary=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}catch(t){var n=mu(e);if(n)return n;throw t}}),bc.readAsync=function(e,t,n){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){if(200==i.status||0==i.status&&i.response)t(i.response);else{var r=mu(e);r?t(r.buffer):n()}},i.onerror=n,i.send(null)},void 0!==arguments&&(bc.arguments=arguments),bc.setWindowTitle=function(e){document.title=e});for(_c in bc.print="undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null,bc.printErr="undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||bc.print,bc.print=bc.print,bc.printErr=bc.printErr,wc)wc.hasOwnProperty(_c)&&(bc[_c]=wc[_c]);wc=void 0;var Cc=16;function Pc(e,t){return t||(t=Cc),e=Math.ceil(e/t)*t}var Fc=0;function Rc(e,t){e||Lu("Assertion failed: "+t)}function Nc(e){var t=bc["_"+e];return Rc(t,"Cannot call unknown function "+e+", make sure it is exported"),t}var Ic={stackSave:function(){_u()},stackRestore:function(){xu()},arrayToC:function(e){var t,n,i=yu(e.length);return t=e,n=i,kc.set(t,n),i},stringToC:function(e){var t=0;if(null!==e&&void 0!==e&&0!==e){var n=1+(e.length<<2);t=yu(n),function(e,t,n,i){if(!(i>0))return 0;for(var r=n,a=n+i-1,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=2097151){if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=67108863){if(n+4>=a)break;t[n++]=248|s>>24,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+5>=a)break;t[n++]=252|s>>30,t[n++]=128|s>>24&63,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}t[n]=0}(e,zc,t,n)}return t}},Dc={string:Ic.stringToC,array:Ic.arrayToC};function Oc(e,t,n,i,r){var a=Nc(e),o=[],s=0;if(i)for(var l=0;l>0],i|=n,(0!=n||t)&&(r++,!t||r!=t););t||(t=r);var a="";if(i<128){for(var o;t>0;)o=String.fromCharCode.apply(String,zc.subarray(e,e+Math.min(t,1024))),a=a?a+o:o,e+=1024,t-=1024;return a}return s=e,function(e,t){for(var n=t;e[n];)++n;if(n-t>16&&e.subarray&&Uc)return Uc.decode(e.subarray(t,n));for(var i,r,a,o,s,l,c="";;){if(!(i=e[t++]))return c;if(128&i)if(r=63&e[t++],192!=(224&i))if(a=63&e[t++],224==(240&i)?i=(15&i)<<12|r<<6|a:(o=63&e[t++],240==(248&i)?i=(7&i)<<18|r<<12|a<<6|o:(s=63&e[t++],248==(252&i)?i=(3&i)<<24|r<<18|a<<12|o<<6|s:(l=63&e[t++],i=(1&i)<<30|r<<24|a<<18|o<<12|s<<6|l))),i<65536)c+=String.fromCharCode(i);else{var u=i-65536;c+=String.fromCharCode(55296|u>>10,56320|1023&u)}else c+=String.fromCharCode((31&i)<<6|r);else c+=String.fromCharCode(i)}}(zc,s);var s}(u)),0!==s&&xu(s),u}var Uc="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;var Bc,kc,zc,Vc,Gc,jc,Xc,Wc,Hc,Yc,qc;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function Qc(){Lu("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+Jc+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}jc=Wc=0,Xc=!1;var Zc=bc.TOTAL_STACK||5242880,Jc=bc.TOTAL_MEMORY||16777216;if(Jc0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?bc.dynCall_v(n):bc.dynCall_vi(n,t.arg):n(void 0===t.arg?null:t.arg)}else t()}}var $c=[],eu=[],tu=[],nu=[],iu=[],ru=!1;var au=0,ou=null,su=null;bc.preloadedImages={},bc.preloadedAudios={};var lu=null,cu="data:application/octet-stream;base64,";function uu(e){return String.prototype.startsWith?e.startsWith(cu):0===e.indexOf(cu)}jc=1052232,eu.push(),lu="data:application/octet-stream;base64,/Td6WFoAAAQEBAgICBAQECAgIEBAQFla";var hu=jc;jc+=16,qc=function(e){Rc(!Xc);var t=jc;return jc=jc+e+15&-16,t}(4),Yc=Pc(Hc=(Wc=Pc(jc))+Zc),Gc[qc>>2]=Yc,Xc=!0;var du=!1;function pu(e){for(var t=[],n=0;n255&&(du&&Rc(!1,"Character code "+i+" ("+String.fromCharCode(i)+") at offset "+n+" not in 0x00-0xFF."),i&=255),t.push(String.fromCharCode(i))}return t.join("")}var fu="function"==typeof atob?atob:function(e){var t,n,i,r,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=s.indexOf(e.charAt(c++))<<2|(r=s.indexOf(e.charAt(c++)))>>4,n=(15&r)<<4|(a=s.indexOf(e.charAt(c++)))>>2,i=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(n)),64!==o&&(l+=String.fromCharCode(i))}while(c>2]=e),e},_emscripten_memcpy_big:function(e,t,n){return zc.set(zc.subarray(t,t+n),e),e},DYNAMICTOP_PTR:qc,tempDoublePtr:hu,ABORT:Fc,STACKTOP:Wc,STACK_MAX:Hc};var vu,gu=function(e,t,n){"use asm";var i=new e.Int8Array(n);var r=new e.Int16Array(n);var a=new e.Int32Array(n);var o=new e.Uint8Array(n);var s=new e.Uint16Array(n);var l=new e.Uint32Array(n);var c=new e.Float32Array(n);var u=new e.Float64Array(n);var h=t.DYNAMICTOP_PTR|0;var d=t.tempDoublePtr|0;var p=t.ABORT|0;var f=t.STACKTOP|0;var m=t.STACK_MAX|0;var v=0;var g=0;var y=0;var x=0;var _=e.NaN,b=e.Infinity;var w=0,A=0,M=0,T=0,S=0.0;var E=0;var L=e.Math.floor;var C=e.Math.abs;var P=e.Math.sqrt;var F=e.Math.pow;var R=e.Math.cos;var N=e.Math.sin;var I=e.Math.tan;var D=e.Math.acos;var O=e.Math.asin;var U=e.Math.atan;var B=e.Math.atan2;var k=e.Math.exp;var z=e.Math.log;var V=e.Math.ceil;var G=e.Math.imul;var j=e.Math.min;var X=e.Math.max;var W=e.Math.clz32;var H=t.abort;var Y=t.assert;var q=t.enlargeMemory;var Q=t.getTotalMemory;var Z=t.abortOnCannotGrowMemory;var J=t.___setErrNo;var K=t._emscripten_memcpy_big;var $=0.0;function ee(e){e=e|0;var t=0;t=f;f=f+e|0;f=f+15&-16;return t|0}function te(){return f|0}function ne(e){e=e|0;f=e}function ie(e,t){e=e|0;t=t|0;f=e;m=t}function re(e,t){e=e|0;t=t|0;if(!v){v=e;g=t}}function ae(e){e=e|0;E=e}function oe(){return E|0}function se(){var e=0,t=0,n=0;e=0;do{t=e>>>1;n=(0-(e&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;a[2088+(e<<2)>>2]=0-(t&1)&-306674912^(0-(n&1)&-306674912^t)>>>1;e=e+1|0}while((e|0)!=256);return}function le(e,t,n){e=e|0;t=t|0;n=n|0;n=~n;if(!t){t=n;t=~t;return t|0}while(1){n=a[2088+((n&255^(o[e>>0]|0))<<2)>>2]^n>>>8;t=t+-1|0;if(!t)break;else e=e+1|0}t=~n;return t|0}function ce(){var e=0,t=0,n=0,i=0,r=0;e=0;do{r=De(e|0,0,1)|0;i=E;n=Be(0,0,e&1|0,0)|0;i=De(n&-679014590^r|0,E&-915646571^i|0,1)|0;n=E;r=Be(0,0,r&1|0,0)|0;n=De(r&-679014590^i|0,E&-915646571^n|0,1)|0;r=E;i=Be(0,0,i&1|0,0)|0;r=De(i&-679014590^n|0,E&-915646571^r|0,1)|0;i=E;n=Be(0,0,n&1|0,0)|0;i=De(n&-679014590^r|0,E&-915646571^i|0,1)|0;n=E;r=Be(0,0,r&1|0,0)|0;n=De(r&-679014590^i|0,E&-915646571^n|0,1)|0;r=E;i=Be(0,0,i&1|0,0)|0;r=De(i&-679014590^n|0,E&-915646571^r|0,1)|0;i=E;n=Be(0,0,n&1|0,0)|0;i=De(n&-679014590^r|0,E&-915646571^i|0,1)|0;n=E;r=Be(0,0,r&1|0,0)|0;t=40+(e<<3)|0;a[t>>2]=r&-679014590^i;a[t+4>>2]=E&-915646571^n;e=e+1|0}while((e|0)!=256);return}function ue(e,t,n,i){e=e|0;t=t|0;n=n|0;i=i|0;var r=0,s=0;r=~n;n=~i;if(!t){e=r;t=n;e=~e;t=~t;E=t;return e|0}while(1){i=40+((r&255^(o[e>>0]|0))<<3)|0;s=a[i>>2]|0;i=a[i+4>>2]|0;r=De(r|0,n|0,8)|0;r=s^r;n=i^E;t=t+-1|0;if(!t)break;else e=e+1|0}s=~r;e=~n;E=e;return s|0}function he(e,t){e=e|0;t=t|0;var n=0,r=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,L=0,C=0,P=0,F=0,R=0,N=0,I=0,D=0,O=0,U=0,B=0,k=0,z=0,V=0,G=0,j=0,X=0,W=0,H=0,Y=0,q=0,Q=0;Y=e+36|0;if(!(a[Y>>2]|0)){a[e>>2]=0;i[e+40>>0]=0;l=e+4|0;a[l>>2]=0;c=e+24|0;s=c;a[s>>2]=0;a[s+4>>2]=0;s=e+172|0;n=e+72|0;r=n+100|0;do{a[n>>2]=0;n=n+4|0}while((n|0)<(r|0));a[s>>2]=12;n=0}else{n=a[e>>2]|0;s=e+172|0;l=e+4|0;c=e+24|0}V=t+4|0;G=a[V>>2]|0;j=t+16|0;X=a[j>>2]|0;C=e+16|0;a[C>>2]=G;z=t+8|0;F=e+168|0;R=e+176|0;N=e+182|0;I=e+184|0;D=e+185|0;O=e+186|0;m=e+187|0;U=e+183|0;B=e+32|0;v=e+64|0;k=e+177|0;g=e+48|0;S=e+8|0;y=e+56|0;x=e+1200|0;_=e+72|0;b=e+20|0;w=e+80|0;P=e+96|0;A=e+104|0;M=e+112|0;L=e+88|0;T=t+12|0;e:while(1){switch(n|0){case 6:{H=79;break e}case 7:{H=94;break e}case 8:{H=101;break e}case 9:{H=106;break e}case 0:{f=a[V>>2]|0;h=(a[z>>2]|0)-f|0;d=a[F>>2]|0;p=(a[s>>2]|0)-d|0;p=h>>>0

>>0?h:p;ke(e+176+d|0,(a[t>>2]|0)+f|0,p|0)|0;a[V>>2]=(a[V>>2]|0)+p;p=(a[F>>2]|0)+p|0;f=(p|0)==(a[s>>2]|0);a[F>>2]=f?0:p;if(!f){n=0;break e}a[e>>2]=1;if(Ne(R,8,6)|0){n=5;break e}if((le(N,2,0)|0)!=(o[D>>0]<<8|o[I>>0]|o[O>>0]<<16|o[m>>0]<<24|0)){n=7;break e}if(i[N>>0]|0){n=6;break e}n=i[U>>0]|0;a[B>>2]=n&255;if((n&255)>15){n=6;break e}switch(n<<24>>24){case 0:case 1:case 4:{H=13;break}default:{n=2;break e}}break}case 1:{H=13;break}case 2:{r=a[t>>2]|0;n=a[z>>2]|0;u=a[F>>2]|0;h=a[s>>2]|0;H=17;break}case 3:{H=45;break}case 4:{H=57;break}case 5:{H=63;break}default:{H=125;break e}}do{if((H|0)==13){H=0;n=a[V>>2]|0;h=a[z>>2]|0;if((n|0)==(h|0)){n=0;break e}r=a[t>>2]|0;u=i[r+n>>0]|0;if(!(u<<24>>24)){a[V>>2]=n+1;a[C>>2]=n;n=6;break}else{H=((u&255)<<2)+4|0;a[v>>2]=H;a[s>>2]=H;a[F>>2]=0;a[e>>2]=2;n=h;u=0;h=H;H=17;break}}}while(0);if((H|0)==17){H=0;f=a[V>>2]|0;p=n-f|0;n=h-u|0;n=p>>>0>>0?p:n;ke(e+176+u|0,r+f|0,n|0)|0;a[V>>2]=n+(a[V>>2]|0);n=(a[F>>2]|0)+n|0;f=(n|0)==(a[s>>2]|0);a[F>>2]=f?0:n;if(!f){n=0;break}d=n+-4|0;a[s>>2]=d;d=le(R,d,0)|0;f=a[s>>2]|0;p=e+176+f|0;if((d|0)!=(o[p+1>>0]<<8|o[p>>0]|o[p+2>>0]<<16|o[p+3>>0]<<24|0)){n=7;break}a[F>>2]=2;p=i[k>>0]|0;n=p&255;if(n&63|0){n=6;break}if(!(n&64)){u=-1;n=-1;h=2}else{n=a[l>>2]|0;if(!n){h=S;a[h>>2]=0;a[h+4>>2]=0;h=2;n=0}else h=2;while(1){if(h>>>0>=f>>>0){n=7;break e}r=i[e+176+h>>0]|0;h=h+1|0;a[F>>2]=h;q=r&255;u=Oe(q&127|0,0,n|0)|0;d=S;u=u|a[d>>2];d=E|a[d+4>>2];Q=S;a[Q>>2]=u;a[Q+4>>2]=d;if(!(q&128))break;n=n+7|0;a[l>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}a[l>>2]=0;n=d}Q=g;a[Q>>2]=u;a[Q+4>>2]=n;if(p<<24>>24<0){n=a[l>>2]|0;if(!n){n=S;a[n>>2]=0;a[n+4>>2]=0;n=0}while(1){if(h>>>0>=f>>>0){n=7;break e}r=i[e+176+h>>0]|0;h=h+1|0;a[F>>2]=h;Q=r&255;u=Oe(Q&127|0,0,n|0)|0;d=S;u=u|a[d>>2];d=E|a[d+4>>2];q=S;a[q>>2]=u;a[q+4>>2]=d;if(!(Q&128))break;n=n+7|0;a[l>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}a[l>>2]=0;n=d}else{u=-1;n=-1}Q=y;a[Q>>2]=u;a[Q+4>>2]=n;if((f-h|0)>>>0<2){n=7;break}n=h+1|0;a[F>>2]=n;if((i[e+176+h>>0]|0)!=33){n=6;break}r=h+2|0;a[F>>2]=r;if((i[e+176+n>>0]|0)!=1){n=6;break}if((f|0)==(r|0)){n=7;break}n=a[x>>2]|0;a[F>>2]=h+3;n=ye(n,i[e+176+r>>0]|0)|0;if(n|0)break;n=a[s>>2]|0;r=a[F>>2]|0;while(1){if(r>>>0>=n>>>0)break;Q=r;r=r+1|0;a[F>>2]=r;if(i[e+176+Q>>0]|0){n=6;break e}}a[F>>2]=0;a[_>>2]=0;a[_+4>>2]=0;a[_+8>>2]=0;a[_+12>>2]=0;a[e>>2]=3;H=45}if((H|0)==45){H=0;a[C>>2]=a[V>>2];a[b>>2]=a[j>>2];n=fe(a[x>>2]|0,t)|0;q=_;q=Ue(a[q>>2]|0,a[q+4>>2]|0,(a[V>>2]|0)-(a[C>>2]|0)|0,0)|0;p=E;r=_;a[r>>2]=q;a[r+4>>2]=p;r=a[b>>2]|0;u=(a[j>>2]|0)-r|0;h=w;h=Ue(a[h>>2]|0,a[h+4>>2]|0,u|0,0)|0;d=E;Q=w;a[Q>>2]=h;a[Q+4>>2]=d;Q=g;f=a[Q+4>>2]|0;if(p>>>0>f>>>0|((p|0)==(f|0)?q>>>0>(a[Q>>2]|0)>>>0:0)){n=7;break}Q=y;q=a[Q+4>>2]|0;if(d>>>0>q>>>0|((d|0)==(q|0)?h>>>0>(a[Q>>2]|0)>>>0:0)){n=7;break}switch(a[B>>2]|0){case 1:{r=le((a[T>>2]|0)+r|0,u,a[c>>2]|0)|0;u=0;H=50;break}case 4:{H=c;r=ue((a[T>>2]|0)+r|0,u,a[H>>2]|0,a[H+4>>2]|0)|0;u=E;H=50;break}default:{}}if((H|0)==50){H=0;Q=c;a[Q>>2]=r;a[Q+4>>2]=u}if((n|0)!=1)break;r=g;n=a[r>>2]|0;r=a[r+4>>2]|0;if(!((n|0)==-1&(r|0)==-1)?(Q=_,!((n|0)==(a[Q>>2]|0)?(r|0)==(a[Q+4>>2]|0):0)):0){n=7;break}n=y;r=a[n>>2]|0;n=a[n+4>>2]|0;h=w;u=a[h>>2]|0;h=a[h+4>>2]|0;if(!((r|0)==-1&(n|0)==-1)){if(!((r|0)==(u|0)&(n|0)==(h|0))){n=7;break}}else{r=u;n=h}H=_;H=Ue(a[H>>2]|0,a[H+4>>2]|0,a[v>>2]|0,0)|0;Q=P;Q=Ue(H|0,E|0,a[Q>>2]|0,a[Q+4>>2]|0)|0;Q=Ue(Q|0,E|0,o[14+(a[B>>2]|0)>>0]|0,0)|0;H=P;a[H>>2]=Q;a[H+4>>2]=E;H=A;H=Ue(a[H>>2]|0,a[H+4>>2]|0,r|0,n|0)|0;Q=A;a[Q>>2]=H;a[Q+4>>2]=E;a[M>>2]=le(P,24,a[M>>2]|0)|0;Q=L;Q=Ue(a[Q>>2]|0,a[Q+4>>2]|0,1,0)|0;H=L;a[H>>2]=Q;a[H+4>>2]=E;a[e>>2]=4;H=57}if((H|0)==57){H=0;r=_;n=a[r>>2]|0;if(!((n&3|0)==0&0==0)){u=a[z>>2]|0;h=a[V>>2]|0;r=a[r+4>>2]|0;do{if((h|0)==(u|0)){n=0;break e}q=a[t>>2]|0;Q=h;h=h+1|0;a[V>>2]=h;if(i[q+Q>>0]|0){n=7;break e}n=Ue(n|0,r|0,1,0)|0;r=E;Q=_;a[Q>>2]=n;a[Q+4>>2]=r}while(!((n&3|0)==0&0==0))}a[e>>2]=5;H=63}t:do{if((H|0)==63){H=0;n=a[B>>2]|0;switch(n|0){case 1:{n=a[z>>2]|0;r=a[V>>2]|0;do{if((r|0)==(n|0)){n=0;break e}Q=c;u=a[l>>2]|0;Q=De(a[Q>>2]|0,a[Q+4>>2]|0,u|0)|0;f=a[t>>2]|0;q=r;r=r+1|0;a[V>>2]=r;if((i[f+q>>0]|0)!=(Q&255)<<24>>24){n=7;break e}Q=u+8|0;a[l>>2]=Q}while(Q>>>0<32);n=c;a[n>>2]=0;a[n+4>>2]=0;a[l>>2]=0;n=1;break t}case 4:{n=a[z>>2]|0;r=a[V>>2]|0;do{if((r|0)==(n|0)){n=0;break e}Q=c;u=a[l>>2]|0;Q=De(a[Q>>2]|0,a[Q+4>>2]|0,u|0)|0;f=a[t>>2]|0;q=r;r=r+1|0;a[V>>2]=r;if((i[f+q>>0]|0)!=(Q&255)<<24>>24){n=7;break e}Q=u+8|0;a[l>>2]=Q}while(Q>>>0<64);n=c;a[n>>2]=0;a[n+4>>2]=0;a[l>>2]=0;n=1;break t}default:{r=a[l>>2]|0;u=o[14+n>>0]|0;if(r>>>0>>0){h=a[z>>2]|0;d=a[V>>2]|0;n=r;do{if((d|0)==(h|0)){n=0;break e}d=d+1|0;a[V>>2]=d;n=n+1|0;a[l>>2]=n}while(n>>>0>>0)}a[l>>2]=0;n=1;break t}}}}while(0);a[e>>2]=n}e:do{if((H|0)==79){m=e+120|0;v=e+136|0;g=e+144|0;y=e+144|0;x=e+152|0;_=e+160|0;t:while(1){p=a[t>>2]|0;h=a[z>>2]|0;if(!(a[l>>2]|0)){Q=S;a[Q>>2]=0;a[Q+4>>2]=0}while(1){r=a[V>>2]|0;if(r>>>0>=h>>>0){n=0;H=86;break t}d=i[p+r>>0]|0;r=r+1|0;a[V>>2]=r;Q=d&255;n=a[l>>2]|0;u=Oe(Q&127|0,0,n|0)|0;f=S;u=u|a[f>>2];f=E|a[f+4>>2];q=S;a[q>>2]=u;a[q+4>>2]=f;if(!(Q&128))break;Q=n+7|0;a[l>>2]=Q;if((Q|0)==63){n=7;H=86;break t}}if(!(d<<24>>24!=0|(n|0)==0)){n=7;H=86;break}a[l>>2]=0;switch(a[m>>2]|0){case 0:{Q=v;a[Q>>2]=u;a[Q+4>>2]=f;Q=L;if((u|0)==(a[Q>>2]|0)?(f|0)==(a[Q+4>>2]|0):0){n=1;H=91}else{n=7;break e}break}case 1:{n=2;h=g;r=f;H=90;break}case 2:{h=x;n=x;a[n>>2]=Ue(a[h>>2]|0,a[h+4>>2]|0,u|0,f|0)|0;a[n+4>>2]=E;a[_>>2]=le(y,24,a[_>>2]|0)|0;n=1;h=v;u=-1;r=-1;H=90;break}default:{}}if((H|0)==90){q=h;q=Ue(a[q>>2]|0,a[q+4>>2]|0,u|0,r|0)|0;Q=h;a[Q>>2]=q;a[Q+4>>2]=E;H=91}if((H|0)==91){H=0;a[m>>2]=n}Q=v;if((a[Q>>2]|0)==0&(a[Q+4>>2]|0)==0){H=93;break}}if((H|0)==86){W=a[C>>2]|0;q=r-W|0;Q=e+128|0;t=Q;t=Ue(a[t>>2]|0,a[t+4>>2]|0,q|0,0)|0;a[Q>>2]=t;a[Q+4>>2]=E;Q=c;a[Q>>2]=le(p+W|0,q,a[c>>2]|0)|0;a[Q+4>>2]=0;break}else if((H|0)==93){a[e>>2]=7;H=94;break}}else if((H|0)==106){u=a[V>>2]|0;r=a[z>>2]|0;l=a[s>>2]|0;n=a[t>>2]|0;H=107}else if((H|0)==125)while(1)H=125}while(0);e:do{if((H|0)==94){f=e+128|0;v=f;m=a[v>>2]|0;v=a[v+4>>2]|0;u=a[C>>2]|0;n=a[V>>2]|0;while(1){h=n-u|0;d=Ue(m|0,v|0,h|0,0)|0;p=E;if((d&3|0)==0&0==0)break;r=a[t>>2]|0;if((n|0)==(a[z>>2]|0)){H=97;break}Q=n;n=n+1|0;a[V>>2]=n;if(i[r+Q>>0]|0){n=7;break e}}if((H|0)==97){n=f;a[n>>2]=d;a[n+4>>2]=p;n=c;a[n>>2]=le(r+u|0,h,a[c>>2]|0)|0;a[n+4>>2]=0;n=0;break}q=a[t>>2]|0;Q=f;a[Q>>2]=d;a[Q+4>>2]=p;Q=c;a[Q>>2]=le(q+u|0,h,a[c>>2]|0)|0;a[Q+4>>2]=0;if(!(Ne(P,e+144|0,24)|0)){a[e>>2]=8;H=101}else n=7}}while(0);e:do{if((H|0)==101){r=a[z>>2]|0;u=a[V>>2]|0;do{if((u|0)==(r|0)){n=0;break e}Q=c;h=a[l>>2]|0;Q=De(a[Q>>2]|0,a[Q+4>>2]|0,h|0)|0;n=a[t>>2]|0;q=u;u=u+1|0;a[V>>2]=u;if((i[n+q>>0]|0)!=(Q&255)<<24>>24){n=7;break e}Q=h+8|0;a[l>>2]=Q}while(Q>>>0<32);H=c;a[H>>2]=0;a[H+4>>2]=0;a[l>>2]=0;a[s>>2]=12;a[e>>2]=9;l=12;H=107}}while(0);if((H|0)==107){H=r-u|0;Q=a[F>>2]|0;q=l-Q|0;q=H>>>0>>0?H:q;ke(e+176+Q|0,n+u|0,q|0)|0;a[V>>2]=q+(a[V>>2]|0);q=(a[F>>2]|0)+q|0;Q=(q|0)==(a[s>>2]|0);a[F>>2]=Q?0:q;if(Q)if((((Ne(O,30,2)|0)==0?(W=e+180|0,Q=le(W,6,0)|0,(Q|0)==(o[k>>0]<<8|o[R>>0]|o[e+178>>0]<<16|o[e+179>>0]<<24|0)):0)?(Q=e+128|0,Q=De(a[Q>>2]|0,a[Q+4>>2]|0,2)|0,(E|0)==0?(Q|0)==(o[e+181>>0]<<8|o[W>>0]|o[N>>0]<<16|o[U>>0]<<24|0):0):0)?(i[I>>0]|0)==0:0)n=(a[B>>2]|0)==(o[D>>0]|0)?1:7;else n=7;else n=0}r=(n|0)==0;if(!(a[Y>>2]|0)){if(!r){if((n|0)==1){Q=1;return Q|0}}else n=(a[V>>2]|0)==(a[z>>2]|0)?7:8;a[V>>2]=G;a[j>>2]=X;Q=n;return Q|0}else{if(r)if((G|0)==(a[V>>2]|0)?(X|0)==(a[j>>2]|0):0){n=(i[e+40>>0]|0)==0?0:8;r=1}else{n=0;r=0}else r=0;i[e+40>>0]=r;Q=n;return Q|0}return 0}function de(e,t){e=e|0;t=t|0;var n=0,r=0;r=Pe(1208)|0;if(!r){r=0;return r|0}a[r+36>>2]=e;n=ge(e,t)|0;a[r+1200>>2]=n;if(!n){Fe(r);r=0;return r|0}else{a[r>>2]=0;i[r+40>>0]=0;a[r+4>>2]=0;e=r+24|0;a[e>>2]=0;a[e+4>>2]=0;e=r+172|0;t=r+72|0;n=t+100|0;do{a[t>>2]=0;t=t+4|0}while((t|0)<(n|0));a[e>>2]=12;return r|0}return 0}function pe(e){e=e|0;if(!e)return;xe(a[e+1200>>2]|0);Fe(e);return}function fe(e,t){e=e|0;t=t|0;var n=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,E=0,L=0,C=0,P=0,F=0,R=0,N=0,I=0,D=0,O=0,U=0,B=0,k=0,z=0,V=0,G=0;b=t+4|0;R=t+8|0;D=e+64|0;O=e+81|0;U=e+80|0;B=e+60|0;k=t+12|0;z=t+16|0;h=e+24|0;d=t+20|0;p=e+44|0;f=e+28|0;m=e+72|0;v=e+68|0;g=e+84|0;y=e+4|0;x=e+8|0;_=e+76|0;w=e+116|0;A=e+112|0;M=e+108|0;T=e+32|0;S=e+40|0;E=e+28388|0;L=e+28392|0;C=e+20|0;P=e+12|0;F=e+16|0;N=e+104|0;I=e+36|0;e:while(1){l=a[b>>2]|0;s=a[R>>2]|0;n=a[D>>2]|0;t:do{if(l>>>0>=s>>>0)if((n|0)==7)V=5;else{n=0;V=86;break e}else{switch(n|0){case 7:{V=5;break t}case 0:{n=a[t>>2]|0;a[b>>2]=l+1;n=i[n+l>>0]|0;s=n&255;if(!(n<<24>>24)){n=1;V=86;break e}if(!((n&255)>223|n<<24>>24==1)){if(i[U>>0]|0){n=7;V=86;break e}}else{i[O>>0]=1;i[U>>0]=0;if(!(a[B>>2]|0)){u=a[z>>2]|0;a[h>>2]=(a[k>>2]|0)+u;a[p>>2]=(a[d>>2]|0)-u}a[f>>2]=0;a[f+4>>2]=0;a[f+8>>2]=0;a[f+12>>2]=0}if(n<<24>>24>=0){if((n&255)>2){n=7;V=86;break e}a[D>>2]=3;a[v>>2]=8;continue e}a[m>>2]=s<<16&2031616;a[D>>2]=1;if((n&255)>191){i[O>>0]=0;a[v>>2]=5;continue e}if(i[O>>0]|0){n=7;V=86;break e}a[v>>2]=6;if((n&255)<=159)continue e;a[g>>2]=0;a[g+4>>2]=0;a[g+8>>2]=0;a[g+12>>2]=0;a[g+16>>2]=0;n=0;do{r[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);a[e>>2]=-1;a[y>>2]=0;a[x>>2]=5;continue e}case 1:{u=a[t>>2]|0;a[b>>2]=l+1;a[m>>2]=(o[u+l>>0]<<8)+(a[m>>2]|0);a[D>>2]=2;continue e}case 2:{u=a[t>>2]|0;a[b>>2]=l+1;a[m>>2]=(o[u+l>>0]|0)+1+(a[m>>2]|0);a[D>>2]=3;continue e}case 3:{u=a[t>>2]|0;a[b>>2]=l+1;a[_>>2]=o[u+l>>0]<<8;a[D>>2]=4;continue e}case 4:{u=a[t>>2]|0;a[b>>2]=l+1;a[_>>2]=(o[u+l>>0]|0)+1+(a[_>>2]|0);a[D>>2]=a[v>>2];continue e}case 5:{n=a[t>>2]|0;a[b>>2]=l+1;n=i[n+l>>0]|0;if((n&255)>224){n=7;V=86;break e}if((n&255)>44){n=n+-45<<24>>24;s=(n&255)/45|0;n=(s*211|0)+n<<24>>24;s=s+1&255}else s=0;a[w>>2]=(1<>2]=0;s=n&255;if((n&255)>8){n=0;do{u=s+247|0;n=n+1|0;s=u&255}while((u&255)>8);a[A>>2]=n}else n=0;a[M>>2]=s;if((s+n|0)>>>0>4){n=7;V=86;break e}a[A>>2]=(1<>2]=0;a[g+4>>2]=0;a[g+8>>2]=0;a[g+12>>2]=0;a[g+16>>2]=0;n=0;do{r[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);a[e>>2]=-1;a[y>>2]=0;a[x>>2]=5;a[D>>2]=6;break}case 6:break;case 8:{n=a[_>>2]|0;n:do{if(n|0){if(s>>>0>l>>>0)u=l;else{n=0;V=86;break e}while(1){l=a[z>>2]|0;c=a[d>>2]|0;if(c>>>0<=l>>>0){n=0;V=86;break e}u=(s-u|0)>>>0<(c-l|0)>>>0;s=(u?s:c)-(a[(u?b:z)>>2]|0)|0;u=a[T>>2]|0;c=(a[p>>2]|0)-u|0;s=s>>>0>c>>>0?c:s;s=s>>>0>n>>>0?n:s;a[_>>2]=n-s;ke((a[h>>2]|0)+u|0,(a[t>>2]|0)+(a[b>>2]|0)|0,s|0)|0;n=(a[T>>2]|0)+s|0;a[T>>2]=n;if((a[I>>2]|0)>>>0>>0)a[I>>2]=n;if(a[B>>2]|0){if((n|0)==(a[p>>2]|0))a[T>>2]=0;ke((a[k>>2]|0)+(a[z>>2]|0)|0,(a[t>>2]|0)+(a[b>>2]|0)|0,s|0)|0;n=a[T>>2]|0}a[f>>2]=n;a[z>>2]=(a[z>>2]|0)+s;u=(a[b>>2]|0)+s|0;a[b>>2]=u;n=a[_>>2]|0;if(!n)break n;s=a[R>>2]|0;if(s>>>0<=u>>>0){n=0;V=86;break e}}}}while(0);a[D>>2]=0;continue e}default:continue e}c=a[_>>2]|0;if(c>>>0<5){n=7;V=86;break e}n=a[x>>2]|0;if(!n){s=a[R>>2]|0;l=a[b>>2]|0;n=c}else{s=a[R>>2]|0;l=a[b>>2]|0;do{if((l|0)==(s|0)){n=0;V=86;break e}G=a[y>>2]<<8;c=a[t>>2]|0;u=l;l=l+1|0;a[b>>2]=l;a[y>>2]=G|o[c+u>>0];n=n+-1|0;a[x>>2]=n}while((n|0)!=0);n=a[_>>2]|0}c=n+-5|0;a[_>>2]=c;a[D>>2]=7;n=l}}while(0);if((V|0)==5){n=l;c=a[_>>2]|0}l=(a[d>>2]|0)-(a[z>>2]|0)|0;u=a[m>>2]|0;u=l>>>0>>0?l:u;l=a[p>>2]|0;G=a[T>>2]|0;a[S>>2]=(l-G|0)>>>0>u>>>0?G+u|0:l;l=s-n|0;u=a[E>>2]|0;if(!u)if(!c){s=0;V=46}else V=56;else{s=c;V=46}t:do{if((V|0)==46){V=0;G=42-u|0;s=s-u|0;s=G>>>0>s>>>0?s:G;l=s>>>0>l>>>0?l:s;ke(e+28392+u|0,(a[t>>2]|0)+n|0,l|0)|0;n=a[E>>2]|0;s=l+n|0;do{if((s|0)!=(a[_>>2]|0))if(s>>>0<21){a[E>>2]=s;a[b>>2]=(a[b>>2]|0)+l;break t}else{n=s+-21|0;break}else{Ve(e+28392+n+l|0,0,63-n-l|0)|0;n=(a[E>>2]|0)+l|0}}while(0);a[C>>2]=n;a[P>>2]=L;a[F>>2]=0;if(!(me(e)|0)){n=7;V=86;break e}n=a[F>>2]|0;s=a[E>>2]|0;if(n>>>0>(s+l|0)>>>0){n=7;V=86;break e}l=(a[_>>2]|0)-n|0;a[_>>2]=l;if(s>>>0>n>>>0){G=s-n|0;a[E>>2]=G;ze(L|0,e+28392+n|0,G|0)|0;break}else{n=(a[b>>2]|0)+(n-s)|0;a[b>>2]=n;a[E>>2]=0;s=a[R>>2]|0;c=l;V=56;break}}}while(0);if((V|0)==56){V=0;l=s-n|0;if(l>>>0>20){a[P>>2]=a[t>>2];a[F>>2]=n;G=l>>>0<(c+21|0)>>>0;a[C>>2]=(a[(G?R:b)>>2]|0)+(G?-21:c);if(!(me(e)|0)){n=7;V=86;break}n=a[F>>2]|0;s=n-(a[b>>2]|0)|0;l=a[_>>2]|0;if(l>>>0>>0){n=7;V=86;break}l=l-s|0;a[_>>2]=l;a[b>>2]=n;s=a[R>>2]|0}else l=c;s=s-n|0;if(s>>>0<21){G=s>>>0>l>>>0?l:s;ke(L|0,(a[t>>2]|0)+n|0,G|0)|0;a[E>>2]=G;a[b>>2]=(a[b>>2]|0)+G}}n=a[T>>2]|0;s=a[f>>2]|0;l=n-s|0;if(a[B>>2]|0){if((n|0)==(a[p>>2]|0))a[T>>2]=0;ke((a[k>>2]|0)+(a[z>>2]|0)|0,(a[h>>2]|0)+s|0,l|0)|0;n=a[T>>2]|0}a[f>>2]=n;n=(a[z>>2]|0)+l|0;a[z>>2]=n;G=(a[m>>2]|0)-l|0;a[m>>2]=G;if(G|0){if((n|0)==(a[d>>2]|0)){n=0;V=86;break}if((a[b>>2]|0)!=(a[R>>2]|0))continue;if((a[E>>2]|0)>>>0<(a[_>>2]|0)>>>0){n=0;V=86;break}else continue}if(a[_>>2]|0){n=7;V=86;break}if(a[N>>2]|0){n=7;V=86;break}if(a[y>>2]|0){n=7;V=86;break}a[e>>2]=-1;a[y>>2]=0;a[x>>2]=5;a[D>>2]=0}if((V|0)==86)return n|0;return 0}function me(e){e=e|0;var t=0,n=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,E=0,L=0,C=0,P=0,F=0,R=0,N=0,I=0,D=0,O=0,U=0,B=0;B=e+24|0;O=e+32|0;t=a[O>>2]|0;U=e+40|0;n=a[U>>2]|0;if(((n>>>0>t>>>0?(l=e+104|0,c=a[l>>2]|0,(c|0)!=0):0)?(h=a[e+84>>2]|0,d=e+36|0,(a[d>>2]|0)>>>0>h>>>0):0)?(a[e+48>>2]|0)>>>0>h>>>0:0){u=n-t|0;u=u>>>0>>0?u:c;a[l>>2]=c-u;n=t-h+-1|0;l=e+44|0;if(t>>>0<=h>>>0)n=(a[l>>2]|0)+n|0;D=a[B>>2]|0;I=i[D+n>>0]|0;a[O>>2]=t+1;i[D+t>>0]=I;t=u+-1|0;if(t|0)do{D=n+1|0;n=(D|0)==(a[l>>2]|0)?0:D;D=a[O>>2]|0;I=a[B>>2]|0;N=i[I+n>>0]|0;a[O>>2]=D+1;i[I+D>>0]=N;t=t+-1|0}while((t|0)!=0);t=a[O>>2]|0;if((a[d>>2]|0)>>>0>>0)a[d>>2]=t}e:do{if(t>>>0<(a[U>>2]|0)>>>0){v=e+16|0;g=e+20|0;y=e+116|0;x=e+100|0;_=e+4|0;b=e+12|0;w=e+44|0;A=e+36|0;M=e+108|0;T=e+112|0;S=e+24|0;E=e+84|0;L=e+92|0;C=e+96|0;P=e+88|0;F=e+1756|0;R=e+104|0;N=e+1726|0;I=e+48|0;D=e+2784|0;while(1){n=a[v>>2]|0;if(n>>>0>(a[g>>2]|0)>>>0){n=e;break e}h=a[y>>2]&t;u=e+120+(a[x>>2]<<5)+(h<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;m=a[_>>2]<<8;c=a[b>>2]|0;a[v>>2]=n+1;c=m|(o[c+n>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;if(c>>>0>=l>>>0){a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);u=e+504+(a[x>>2]<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;t:do{if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;a[x>>2]=(a[x>>2]|0)>>>0<7?7:10;a[C>>2]=a[L>>2];a[L>>2]=a[P>>2];a[P>>2]=a[E>>2];ve(e,F,h);h=a[R>>2]|0;h=h>>>0<6?h+-2|0:3;p=1;t=a[e>>2]|0;do{d=e+984+(h<<7)+(p<<1)|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;n=a[v>>2]|0;a[v>>2]=n+1;n=f|(o[m+n>>0]|0);a[_>>2]=n}else n=a[_>>2]|0;u=s[d>>1]|0;c=G(t>>>11,u)|0;if(n>>>0>>0){a[e>>2]=c;l=0;t=c;n=(2048-u>>5)+u|0}else{t=t-c|0;a[e>>2]=t;a[_>>2]=n-c;l=1;n=u-(u>>>5)|0}r[d>>1]=n;p=l|p<<1}while(p>>>0<64);t=p+-64|0;if(t>>>0<4){a[E>>2]=t;break}n=t>>>1;f=n+-1|0;l=t&1|2;a[E>>2]=l;if(t>>>0<14){d=l<>2]=d;p=e+1496+(d<<1)+(64-p<<1)+-2|0;d=0;t=1;while(1){h=p+(t<<1)|0;n=a[e>>2]|0;if(n>>>0<16777216){n=n<<8;a[e>>2]=n;c=a[_>>2]<<8;m=a[b>>2]|0;u=a[v>>2]|0;a[v>>2]=u+1;u=c|(o[m+u>>0]|0);a[_>>2]=u}else u=a[_>>2]|0;l=s[h>>1]|0;c=G(n>>>11,l)|0;if(u>>>0>>0){a[e>>2]=c;r[h>>1]=((2048-l|0)>>>5)+l;t=t<<1}else{a[e>>2]=n-c;a[_>>2]=u-c;r[h>>1]=l-(l>>>5);a[E>>2]=(a[E>>2]|0)+(1<>>0>=f>>>0)break t}}c=n+-5|0;h=a[e>>2]|0;do{if(h>>>0<16777216){u=h<<8;a[e>>2]=u;f=a[_>>2]<<8;m=a[b>>2]|0;t=a[v>>2]|0;a[v>>2]=t+1;t=f|(o[m+t>>0]|0);a[_>>2]=t}else{u=h;t=a[_>>2]|0}h=u>>>1;a[e>>2]=h;n=t-h|0;m=n>>31;n=(m&h)+n|0;a[_>>2]=n;l=(l<<1|1)+m|0;a[E>>2]=l;c=c+-1|0}while((c|0)!=0);d=l<<4;a[E>>2]=d;if(u>>>0<33554432){l=h<<8;a[e>>2]=l;f=a[b>>2]|0;m=a[v>>2]|0;a[v>>2]=m+1;n=n<<8|(o[f+m>>0]|0);a[_>>2]=n}else l=h;t=s[N>>1]|0;c=G(l>>>11,t)|0;if(n>>>0>>0){a[e>>2]=c;r[N>>1]=((2048-t|0)>>>5)+t;p=2;h=d}else{m=l-c|0;a[e>>2]=m;n=n-c|0;a[_>>2]=n;r[N>>1]=t-(t>>>5);h=d|1;a[E>>2]=h;p=3;c=m}u=e+1724+(p<<1)|0;if(c>>>0<16777216){c=c<<8;a[e>>2]=c;f=a[b>>2]|0;m=a[v>>2]|0;a[v>>2]=m+1;n=n<<8|(o[f+m>>0]|0);a[_>>2]=n}l=s[u>>1]|0;t=G(c>>>11,l)|0;if(n>>>0>>0){a[e>>2]=t;r[u>>1]=((2048-l|0)>>>5)+l;h=p<<1}else{m=c-t|0;a[e>>2]=m;n=n-t|0;a[_>>2]=n;r[u>>1]=l-(l>>>5);a[E>>2]=h+2;h=p<<1|1;t=m}u=e+1724+(h<<1)|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[b>>2]|0;m=a[v>>2]|0;a[v>>2]=m+1;n=n<<8|(o[f+m>>0]|0);a[_>>2]=n}l=s[u>>1]|0;c=G(t>>>11,l)|0;if(n>>>0>>0){a[e>>2]=c;r[u>>1]=((2048-l|0)>>>5)+l;t=h<<1}else{a[e>>2]=t-c;a[_>>2]=n-c;r[u>>1]=l-(l>>>5);a[E>>2]=(a[E>>2]|0)+4;t=h<<1|1}u=e+1724+(t<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;break}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);a[E>>2]=(a[E>>2]|0)+8;break}}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);u=e+528+(a[x>>2]<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;do{if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;u=e+600+(a[x>>2]<<5)+(h<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;a[x>>2]=(a[x>>2]|0)>>>0<7?9:11;a[R>>2]=1;break t}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);break}}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);u=e+552+(a[x>>2]<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;t=a[P>>2]|0}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);u=e+576+(a[x>>2]<<1)|0;t=a[e>>2]|0;if(t>>>0<16777216){t=t<<8;a[e>>2]=t;f=a[_>>2]<<8;m=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=f|(o[m+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;n=s[u>>1]|0;l=G(t>>>11,n)|0;if(c>>>0>>0){a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;t=a[L>>2]|0}else{a[e>>2]=t-l;a[_>>2]=c-l;r[u>>1]=n-(n>>>5);t=a[C>>2]|0;a[C>>2]=a[L>>2]}a[L>>2]=a[P>>2]}a[P>>2]=a[E>>2];a[E>>2]=t}}while(0);a[x>>2]=(a[x>>2]|0)>>>0<7?8:11;ve(e,D,h)}}while(0);t=a[E>>2]|0;if((a[A>>2]|0)>>>0<=t>>>0){t=0;l=130;break}if((a[I>>2]|0)>>>0<=t>>>0){t=0;l=130;break}c=a[O>>2]|0;l=(a[U>>2]|0)-c|0;n=a[R>>2]|0;l=l>>>0>>0?l:n;a[R>>2]=n-l;n=c-t+-1|0;if(c>>>0<=t>>>0)n=(a[w>>2]|0)+n|0;t=a[B>>2]|0;m=i[t+n>>0]|0;a[O>>2]=c+1;i[t+c>>0]=m;t=l+-1|0;if(t|0)do{m=n+1|0;n=(m|0)==(a[w>>2]|0)?0:m;m=a[O>>2]|0;f=a[B>>2]|0;p=i[f+n>>0]|0;a[O>>2]=m+1;i[f+m>>0]=p;t=t+-1|0}while((t|0)!=0);t=a[O>>2]|0;if((a[A>>2]|0)>>>0>>0)a[A>>2]=t}else{a[e>>2]=l;r[u>>1]=((2048-n|0)>>>5)+n;n=a[O>>2]|0;t=n+-1|0;if(!n)t=(a[w>>2]|0)+t|0;l=(a[A>>2]|0)==0;if(l)t=0;else t=o[(a[S>>2]|0)+t>>0]|0;m=a[M>>2]|0;m=((a[T>>2]&n)<>>(8-m|0))|0;if((a[x>>2]|0)>>>0<7){t=1;n=a[e>>2]|0;do{d=e+3812+(m*1536|0)+(t<<1)|0;if(n>>>0<16777216){n=n<<8;a[e>>2]=n;p=a[_>>2]<<8;f=a[b>>2]|0;l=a[v>>2]|0;a[v>>2]=l+1;l=p|(o[f+l>>0]|0);a[_>>2]=l}else l=a[_>>2]|0;h=s[d>>1]|0;u=G(n>>>11,h)|0;if(l>>>0>>0){a[e>>2]=u;c=0;n=u;l=(2048-h>>5)+h|0}else{n=n-u|0;a[e>>2]=n;a[_>>2]=l-u;c=1;l=h-(h>>>5)|0}r[d>>1]=l;t=c|t<<1}while(t>>>0<256)}else{f=a[E>>2]|0;t=n-f+-1|0;if(n>>>0>f>>>0)n=t;else n=(a[w>>2]|0)+t|0;if(l){t=1;f=256;d=0}else{t=1;f=256;d=o[(a[S>>2]|0)+n>>0]|0}while(1){d=d<<1;p=d&f;h=e+3812+(m*1536|0)+(p+f+t<<1)|0;n=a[e>>2]|0;if(n>>>0<16777216){n=n<<8;a[e>>2]=n;l=a[_>>2]<<8;u=a[b>>2]|0;c=a[v>>2]|0;a[v>>2]=c+1;c=l|(o[u+c>>0]|0);a[_>>2]=c}else c=a[_>>2]|0;u=s[h>>1]|0;l=G(n>>>11,u)|0;if(c>>>0>>0){a[e>>2]=l;l=1;n=(2048-u>>5)+u|0}else{a[e>>2]=n-l;a[_>>2]=c-l;l=0;n=u-(u>>>5)|0}r[h>>1]=n;t=t<<1|(l^1)&1;if(t>>>0>=256)break;else f=(l?f:0)^p}}f=a[S>>2]|0;m=a[O>>2]|0;a[O>>2]=m+1;i[f+m>>0]=t;t=a[O>>2]|0;if((a[A>>2]|0)>>>0>>0)a[A>>2]=t;m=a[x>>2]|0;a[x>>2]=m>>>0<4?0:m-(m>>>0<10?3:6)|0}if(t>>>0>=(a[U>>2]|0)>>>0){n=e;break e}}if((l|0)==130)return t|0}else n=e}while(0);t=a[n>>2]|0;if(t>>>0>=16777216){e=1;return e|0}a[n>>2]=t<<8;B=e+4|0;O=a[B>>2]<<8;U=a[e+12>>2]|0;D=e+16|0;e=a[D>>2]|0;a[D>>2]=e+1;a[B>>2]=O|(o[U+e>>0]|0);e=1;return e|0}function ve(e,t,n){e=e|0;t=t|0;n=n|0;var i=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0;i=a[e>>2]|0;if(i>>>0<16777216){i=i<<8;a[e>>2]=i;c=e+4|0;g=a[c>>2]<<8;y=a[e+12>>2]|0;v=e+16|0;u=a[v>>2]|0;a[v>>2]=u+1;u=g|(o[y+u>>0]|0);a[c>>2]=u}else{u=e+4|0;c=u;u=a[u>>2]|0}l=s[t>>1]|0;d=G(i>>>11,l)|0;do{if(u>>>0>=d>>>0){h=i-d|0;a[e>>2]=h;i=u-d|0;a[c>>2]=i;r[t>>1]=l-(l>>>5);d=t+2|0;if(h>>>0<16777216){l=h<<8;a[e>>2]=l;c=e+4|0;y=a[e+12>>2]|0;g=e+16|0;u=a[g>>2]|0;a[g>>2]=u+1;u=i<<8|(o[y+u>>0]|0);a[c>>2]=u}else{c=e+4|0;l=h;u=i}i=s[d>>1]|0;h=G(l>>>11,i)|0;if(u>>>0>>0){a[e>>2]=h;r[d>>1]=((2048-i|0)>>>5)+i;y=8;g=t+260+(n<<4)|0;i=h;p=10;break}else{p=l-h|0;a[e>>2]=p;u=u-h|0;a[c>>2]=u;r[d>>1]=i-(i>>>5);y=256;g=t+516|0;i=p;p=18;break}}else{a[e>>2]=d;r[t>>1]=((2048-l|0)>>>5)+l;y=8;g=t+4+(n<<4)|0;i=d;p=2}}while(0);n=e+104|0;a[n>>2]=p;f=e+4|0;m=e+12|0;v=e+16|0;t=1;do{d=g+(t<<1)|0;if(i>>>0<16777216){i=i<<8;a[e>>2]=i;c=a[m>>2]|0;h=a[v>>2]|0;a[v>>2]=h+1;u=u<<8|(o[c+h>>0]|0);a[f>>2]=u}h=s[d>>1]|0;l=G(i>>>11,h)|0;if(u>>>0>>0){a[e>>2]=l;c=0;i=l;l=(2048-h>>5)+h|0}else{i=i-l|0;a[e>>2]=i;u=u-l|0;a[f>>2]=u;c=1;l=h-(h>>>5)|0}r[d>>1]=l;t=c|t<<1}while(t>>>0>>0);a[n>>2]=t-y+p;return}function ge(e,t){e=e|0;t=t|0;var n=0,i=0;n=Pe(28456)|0;e:do{if(n){i=n+24|0;a[n+60>>2]=e;a[n+52>>2]=t;switch(e|0){case 1:break;case 2:{a[i>>2]=0;a[n+56>>2]=0;break e}default:break e}t=Pe(t)|0;a[i>>2]=t;if(!t){Fe(n);n=0}}else n=0}while(0);return n|0}function ye(e,t){e=e|0;t=t|0;var n=0,r=0,o=0;n=t&255;if((t&255)>39){o=6;return o|0}r=e+48|0;n=(n&1|2)<<(n>>>1)+11;a[r>>2]=n;t=a[e+60>>2]|0;if(t|0){if(n>>>0>(a[e+52>>2]|0)>>>0){o=4;return o|0}a[e+44>>2]=n;if(((t|0)==2?(o=e+56|0,(a[o>>2]|0)>>>0>>0):0)?(n=e+24|0,Fe(a[n>>2]|0),r=Pe(a[r>>2]|0)|0,a[n>>2]=r,(r|0)==0):0){a[o>>2]=0;o=3;return o|0}}a[e+104>>2]=0;a[e+64>>2]=0;i[e+80>>0]=1;a[e+28388>>2]=0;o=0;return o|0}function xe(e){e=e|0;if(!(a[e+60>>2]|0)){Fe(e);return}Fe(a[e+24>>2]|0);Fe(e);return}function _e(){var e=0;a[778]=3640;a[779]=0;a[780]=0;a[781]=527928;a[782]=0;a[783]=524288;se();ce();e=de(2,8388608)|0;a[784]=e;if(e|0){e=0;return e|0}pe(0);e=1;return e|0}function be(){var e=0;switch(he(a[784]|0,3112)|0){case 2:case 0:{e=0;break}case 1:{pe(a[784]|0);e=0;break}case 3:{pe(a[784]|0);e=1;break}case 4:{pe(a[784]|0);e=2;break}case 5:{pe(a[784]|0);e=4;break}case 6:{pe(a[784]|0);e=5;break}case 8:case 7:{pe(a[784]|0);e=6;break}default:{pe(a[784]|0);e=7}}return e|0}function we(){return a[778]|0}function Ae(){return a[781]|0}function Me(e){e=e|0;a[779]=e;return}function Te(e){e=e|0;a[780]=e>>>0<524288?e:524288;return}function Se(e){e=e|0;a[782]=e;return}function Ee(e){e=e|0;a[783]=e>>>0<524288?e:524288;return}function Le(){return a[782]|0}function Ce(){return(a[779]|0)==(a[780]|0)|0}function Pe(e){e=e|0;var t=0,n=0,i=0,r=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0;A=f;f=f+16|0;m=A;do{if(e>>>0<245){h=e>>>0<11?16:e+11&-8;e=h>>>3;p=a[785]|0;n=p>>>e;if(n&3|0){t=(n&1^1)+e|0;e=3180+(t<<1<<2)|0;n=e+8|0;i=a[n>>2]|0;r=i+8|0;o=a[r>>2]|0;if((o|0)==(e|0))a[785]=p&~(1<>2]=e;a[n>>2]=o}w=t<<3;a[i+4>>2]=w|3;w=i+w+4|0;a[w>>2]=a[w>>2]|1;w=r;f=A;return w|0}d=a[787]|0;if(h>>>0>d>>>0){if(n|0){t=2<>>12&16;t=t>>>l;n=t>>>5&8;t=t>>>n;o=t>>>2&4;t=t>>>o;e=t>>>1&2;t=t>>>e;i=t>>>1&1;i=(n|l|o|e|i)+(t>>>i)|0;t=3180+(i<<1<<2)|0;e=t+8|0;o=a[e>>2]|0;l=o+8|0;n=a[l>>2]|0;if((n|0)==(t|0)){e=p&~(1<>2]=t;a[e>>2]=n;e=p}w=i<<3;s=w-h|0;a[o+4>>2]=h|3;r=o+h|0;a[r+4>>2]=s|1;a[o+w>>2]=s;if(d|0){i=a[790]|0;t=d>>>3;n=3180+(t<<1<<2)|0;t=1<>2]|0}a[e>>2]=i;a[t+12>>2]=i;a[i+8>>2]=t;a[i+12>>2]=n}a[787]=s;a[790]=r;w=l;f=A;return w|0}c=a[786]|0;if(c){n=(c&0-c)+-1|0;l=n>>>12&16;n=n>>>l;s=n>>>5&8;n=n>>>s;u=n>>>2&4;n=n>>>u;i=n>>>1&2;n=n>>>i;e=n>>>1&1;e=a[3444+((s|l|u|i|e)+(n>>>e)<<2)>>2]|0;n=(a[e+4>>2]&-8)-h|0;i=a[e+16+(((a[e+16>>2]|0)==0&1)<<2)>>2]|0;if(!i){u=e;s=n}else{do{l=(a[i+4>>2]&-8)-h|0;u=l>>>0>>0;n=u?l:n;e=u?i:e;i=a[i+16+(((a[i+16>>2]|0)==0&1)<<2)>>2]|0}while((i|0)!=0);u=e;s=n}l=u+h|0;if(l>>>0>u>>>0){r=a[u+24>>2]|0;t=a[u+12>>2]|0;do{if((t|0)==(u|0)){e=u+20|0;t=a[e>>2]|0;if(!t){e=u+16|0;t=a[e>>2]|0;if(!t){n=0;break}}while(1){n=t+20|0;i=a[n>>2]|0;if(i|0){t=i;e=n;continue}n=t+16|0;i=a[n>>2]|0;if(!i)break;else{t=i;e=n}}a[e>>2]=0;n=t}else{n=a[u+8>>2]|0;a[n+12>>2]=t;a[t+8>>2]=n;n=t}}while(0);do{if(r|0){t=a[u+28>>2]|0;e=3444+(t<<2)|0;if((u|0)==(a[e>>2]|0)){a[e>>2]=n;if(!n){a[786]=c&~(1<>2]|0)!=(u|0)&1)<<2)>>2]=n;if(!n)break}a[n+24>>2]=r;t=a[u+16>>2]|0;if(t|0){a[n+16>>2]=t;a[t+24>>2]=n}t=a[u+20>>2]|0;if(t|0){a[n+20>>2]=t;a[t+24>>2]=n}}}while(0);if(s>>>0<16){w=s+h|0;a[u+4>>2]=w|3;w=u+w+4|0;a[w>>2]=a[w>>2]|1}else{a[u+4>>2]=h|3;a[l+4>>2]=s|1;a[l+s>>2]=s;if(d|0){i=a[790]|0;t=d>>>3;n=3180+(t<<1<<2)|0;t=1<>2]|0}a[e>>2]=i;a[t+12>>2]=i;a[i+8>>2]=t;a[i+12>>2]=n}a[787]=s;a[790]=l}w=u+8|0;f=A;return w|0}else d=h}else d=h}else d=h}else if(e>>>0<=4294967231){e=e+11|0;h=e&-8;u=a[786]|0;if(u){i=0-h|0;e=e>>>8;if(e)if(h>>>0>16777215)c=31;else{p=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;c=14-(d|p|c)+(b<>>15)|0;c=h>>>(c+7|0)&1|c<<1}else c=0;n=a[3444+(c<<2)>>2]|0;e:do{if(!n){n=0;e=0;b=57}else{e=0;l=n;s=h<<((c|0)==31?0:25-(c>>>1)|0);n=0;while(1){r=(a[l+4>>2]&-8)-h|0;if(r>>>0>>0)if(!r){i=0;n=l;e=l;b=61;break e}else{e=l;i=r}r=a[l+20>>2]|0;l=a[l+16+(s>>>31<<2)>>2]|0;n=(r|0)==0|(r|0)==(l|0)?n:r;r=(l|0)==0;if(r){b=57;break}else s=s<<((r^1)&1)}}}while(0);if((b|0)==57){if((n|0)==0&(e|0)==0){e=2<>>12&16;p=p>>>l;s=p>>>5&8;p=p>>>s;c=p>>>2&4;p=p>>>c;d=p>>>1&2;p=p>>>d;n=p>>>1&1;e=0;n=a[3444+((s|l|c|d|n)+(p>>>n)<<2)>>2]|0}if(!n){l=e;s=i}else b=61}if((b|0)==61)while(1){b=0;d=(a[n+4>>2]&-8)-h|0;p=d>>>0>>0;i=p?d:i;e=p?n:e;n=a[n+16+(((a[n+16>>2]|0)==0&1)<<2)>>2]|0;if(!n){l=e;s=i;break}else b=61}if((l|0)!=0?s>>>0<((a[787]|0)-h|0)>>>0:0){o=l+h|0;if(o>>>0<=l>>>0){w=0;f=A;return w|0}r=a[l+24>>2]|0;t=a[l+12>>2]|0;do{if((t|0)==(l|0)){e=l+20|0;t=a[e>>2]|0;if(!t){e=l+16|0;t=a[e>>2]|0;if(!t){t=0;break}}while(1){n=t+20|0;i=a[n>>2]|0;if(i|0){t=i;e=n;continue}n=t+16|0;i=a[n>>2]|0;if(!i)break;else{t=i;e=n}}a[e>>2]=0}else{w=a[l+8>>2]|0;a[w+12>>2]=t;a[t+8>>2]=w}}while(0);do{if(r){e=a[l+28>>2]|0;n=3444+(e<<2)|0;if((l|0)==(a[n>>2]|0)){a[n>>2]=t;if(!t){i=u&~(1<>2]|0)!=(l|0)&1)<<2)>>2]=t;if(!t){i=u;break}}a[t+24>>2]=r;e=a[l+16>>2]|0;if(e|0){a[t+16>>2]=e;a[e+24>>2]=t}e=a[l+20>>2]|0;if(e){a[t+20>>2]=e;a[e+24>>2]=t;i=u}else i=u}else i=u}while(0);do{if(s>>>0>=16){a[l+4>>2]=h|3;a[o+4>>2]=s|1;a[o+s>>2]=s;t=s>>>3;if(s>>>0<256){n=3180+(t<<1<<2)|0;e=a[785]|0;t=1<>2]|0}a[e>>2]=o;a[t+12>>2]=o;a[o+8>>2]=t;a[o+12>>2]=n;break}t=s>>>8;if(t)if(s>>>0>16777215)t=31;else{b=(t+1048320|0)>>>16&8;w=t<>>16&4;w=w<<_;t=(w+245760|0)>>>16&2;t=14-(_|b|t)+(w<>>15)|0;t=s>>>(t+7|0)&1|t<<1}else t=0;n=3444+(t<<2)|0;a[o+28>>2]=t;e=o+16|0;a[e+4>>2]=0;a[e>>2]=0;e=1<>2]=o;a[o+24>>2]=n;a[o+12>>2]=o;a[o+8>>2]=o;break}e=s<<((t|0)==31?0:25-(t>>>1)|0);n=a[n>>2]|0;while(1){if((a[n+4>>2]&-8|0)==(s|0)){b=97;break}i=n+16+(e>>>31<<2)|0;t=a[i>>2]|0;if(!t){b=96;break}else{e=e<<1;n=t}}if((b|0)==96){a[i>>2]=o;a[o+24>>2]=n;a[o+12>>2]=o;a[o+8>>2]=o;break}else if((b|0)==97){b=n+8|0;w=a[b>>2]|0;a[w+12>>2]=o;a[b>>2]=o;a[o+8>>2]=w;a[o+12>>2]=n;a[o+24>>2]=0;break}}else{w=s+h|0;a[l+4>>2]=w|3;w=l+w+4|0;a[w>>2]=a[w>>2]|1}}while(0);w=l+8|0;f=A;return w|0}else d=h}else d=h}else d=-1}while(0);n=a[787]|0;if(n>>>0>=d>>>0){t=n-d|0;e=a[790]|0;if(t>>>0>15){w=e+d|0;a[790]=w;a[787]=t;a[w+4>>2]=t|1;a[e+n>>2]=t;a[e+4>>2]=d|3}else{a[787]=0;a[790]=0;a[e+4>>2]=n|3;w=e+n+4|0;a[w>>2]=a[w>>2]|1}w=e+8|0;f=A;return w|0}l=a[788]|0;if(l>>>0>d>>>0){_=l-d|0;a[788]=_;w=a[791]|0;b=w+d|0;a[791]=b;a[b+4>>2]=_|1;a[w+4>>2]=d|3;w=w+8|0;f=A;return w|0}if(!(a[903]|0)){a[905]=4096;a[904]=4096;a[906]=-1;a[907]=-1;a[908]=0;a[896]=0;a[903]=m&-16^1431655768;e=4096}else e=a[905]|0;c=d+48|0;u=d+47|0;s=e+u|0;r=0-e|0;h=s&r;if(h>>>0<=d>>>0){w=0;f=A;return w|0}e=a[895]|0;if(e|0?(p=a[893]|0,m=p+h|0,m>>>0<=p>>>0|m>>>0>e>>>0):0){w=0;f=A;return w|0}e:do{if(!(a[896]&4)){n=a[791]|0;t:do{if(n){i=3588;while(1){e=a[i>>2]|0;if(e>>>0<=n>>>0?(y=i+4|0,(e+(a[y>>2]|0)|0)>>>0>n>>>0):0)break;e=a[i+8>>2]|0;if(!e){b=118;break t}else i=e}t=s-l&r;if(t>>>0<2147483647){e=Ge(t|0)|0;if((e|0)==((a[i>>2]|0)+(a[y>>2]|0)|0)){if((e|0)!=(-1|0)){s=t;o=e;b=135;break e}}else{i=e;b=126}}else t=0}else b=118}while(0);do{if((b|0)==118){n=Ge(0)|0;if((n|0)!=(-1|0)?(t=n,v=a[904]|0,g=v+-1|0,t=((g&t|0)==0?0:(g+t&0-v)-t|0)+h|0,v=a[893]|0,g=t+v|0,t>>>0>d>>>0&t>>>0<2147483647):0){y=a[895]|0;if(y|0?g>>>0<=v>>>0|g>>>0>y>>>0:0){t=0;break}e=Ge(t|0)|0;if((e|0)==(n|0)){s=t;o=n;b=135;break e}else{i=e;b=126}}else t=0}}while(0);do{if((b|0)==126){n=0-t|0;if(!(c>>>0>t>>>0&(t>>>0<2147483647&(i|0)!=(-1|0))))if((i|0)==(-1|0)){t=0;break}else{s=t;o=i;b=135;break e}e=a[905]|0;e=u-t+e&0-e;if(e>>>0>=2147483647){s=t;o=i;b=135;break e}if((Ge(e|0)|0)==(-1|0)){Ge(n|0)|0;t=0;break}else{s=e+t|0;o=i;b=135;break e}}}while(0);a[896]=a[896]|4;b=133}else{t=0;b=133}}while(0);if(((b|0)==133?h>>>0<2147483647:0)?(o=Ge(h|0)|0,y=Ge(0)|0,x=y-o|0,_=x>>>0>(d+40|0)>>>0,!((o|0)==(-1|0)|_^1|o>>>0>>0&((o|0)!=(-1|0)&(y|0)!=(-1|0))^1)):0){s=_?x:t;b=135}if((b|0)==135){t=(a[893]|0)+s|0;a[893]=t;if(t>>>0>(a[894]|0)>>>0)a[894]=t;c=a[791]|0;do{if(c){t=3588;while(1){e=a[t>>2]|0;n=t+4|0;i=a[n>>2]|0;if((o|0)==(e+i|0)){b=143;break}r=a[t+8>>2]|0;if(!r)break;else t=r}if(((b|0)==143?(a[t+12>>2]&8|0)==0:0)?o>>>0>c>>>0&e>>>0<=c>>>0:0){a[n>>2]=i+s;w=(a[788]|0)+s|0;_=c+8|0;_=(_&7|0)==0?0:0-_&7;b=c+_|0;_=w-_|0;a[791]=b;a[788]=_;a[b+4>>2]=_|1;a[c+w+4>>2]=40;a[792]=a[907];break}if(o>>>0<(a[789]|0)>>>0)a[789]=o;e=o+s|0;t=3588;while(1){if((a[t>>2]|0)==(e|0)){b=151;break}t=a[t+8>>2]|0;if(!t){e=3588;break}}if((b|0)==151)if(!(a[t+12>>2]&8)){a[t>>2]=o;h=t+4|0;a[h>>2]=(a[h>>2]|0)+s;h=o+8|0;h=o+((h&7|0)==0?0:0-h&7)|0;t=e+8|0;t=e+((t&7|0)==0?0:0-t&7)|0;u=h+d|0;l=t-h-d|0;a[h+4>>2]=d|3;do{if((c|0)!=(t|0)){if((a[790]|0)==(t|0)){w=(a[787]|0)+l|0;a[787]=w;a[790]=u;a[u+4>>2]=w|1;a[u+w>>2]=w;break}e=a[t+4>>2]|0;if((e&3|0)==1){s=e&-8;i=e>>>3;e:do{if(e>>>0<256){e=a[t+8>>2]|0;n=a[t+12>>2]|0;if((n|0)==(e|0)){a[785]=a[785]&~(1<>2]=n;a[n+8>>2]=e;break}}else{o=a[t+24>>2]|0;e=a[t+12>>2]|0;do{if((e|0)==(t|0)){i=t+16|0;n=i+4|0;e=a[n>>2]|0;if(!e){e=a[i>>2]|0;if(!e){e=0;break}else n=i}while(1){i=e+20|0;r=a[i>>2]|0;if(r|0){e=r;n=i;continue}i=e+16|0;r=a[i>>2]|0;if(!r)break;else{e=r;n=i}}a[n>>2]=0}else{w=a[t+8>>2]|0;a[w+12>>2]=e;a[e+8>>2]=w}}while(0);if(!o)break;n=a[t+28>>2]|0;i=3444+(n<<2)|0;do{if((a[i>>2]|0)!=(t|0)){a[o+16+(((a[o+16>>2]|0)!=(t|0)&1)<<2)>>2]=e;if(!e)break e}else{a[i>>2]=e;if(e|0)break;a[786]=a[786]&~(1<>2]=o;n=t+16|0;i=a[n>>2]|0;if(i|0){a[e+16>>2]=i;a[i+24>>2]=e}n=a[n+4>>2]|0;if(!n)break;a[e+20>>2]=n;a[n+24>>2]=e}}while(0);t=t+s|0;r=s+l|0}else r=l;t=t+4|0;a[t>>2]=a[t>>2]&-2;a[u+4>>2]=r|1;a[u+r>>2]=r;t=r>>>3;if(r>>>0<256){n=3180+(t<<1<<2)|0;e=a[785]|0;t=1<>2]|0}a[e>>2]=u;a[t+12>>2]=u;a[u+8>>2]=t;a[u+12>>2]=n;break}t=r>>>8;do{if(!t)t=0;else{if(r>>>0>16777215){t=31;break}b=(t+1048320|0)>>>16&8;w=t<>>16&4;w=w<<_;t=(w+245760|0)>>>16&2;t=14-(_|b|t)+(w<>>15)|0;t=r>>>(t+7|0)&1|t<<1}}while(0);i=3444+(t<<2)|0;a[u+28>>2]=t;e=u+16|0;a[e+4>>2]=0;a[e>>2]=0;e=a[786]|0;n=1<>2]=u;a[u+24>>2]=i;a[u+12>>2]=u;a[u+8>>2]=u;break}e=r<<((t|0)==31?0:25-(t>>>1)|0);n=a[i>>2]|0;while(1){if((a[n+4>>2]&-8|0)==(r|0)){b=192;break}i=n+16+(e>>>31<<2)|0;t=a[i>>2]|0;if(!t){b=191;break}else{e=e<<1;n=t}}if((b|0)==191){a[i>>2]=u;a[u+24>>2]=n;a[u+12>>2]=u;a[u+8>>2]=u;break}else if((b|0)==192){b=n+8|0;w=a[b>>2]|0;a[w+12>>2]=u;a[b>>2]=u;a[u+8>>2]=w;a[u+12>>2]=n;a[u+24>>2]=0;break}}else{w=(a[788]|0)+l|0;a[788]=w;a[791]=u;a[u+4>>2]=w|1}}while(0);w=h+8|0;f=A;return w|0}else e=3588;while(1){t=a[e>>2]|0;if(t>>>0<=c>>>0?(w=t+(a[e+4>>2]|0)|0,w>>>0>c>>>0):0)break;e=a[e+8>>2]|0}r=w+-47|0;e=r+8|0;e=r+((e&7|0)==0?0:0-e&7)|0;r=c+16|0;e=e>>>0>>0?c:e;t=e+8|0;n=s+-40|0;_=o+8|0;_=(_&7|0)==0?0:0-_&7;b=o+_|0;_=n-_|0;a[791]=b;a[788]=_;a[b+4>>2]=_|1;a[o+n+4>>2]=40;a[792]=a[907];n=e+4|0;a[n>>2]=27;a[t>>2]=a[897];a[t+4>>2]=a[898];a[t+8>>2]=a[899];a[t+12>>2]=a[900];a[897]=o;a[898]=s;a[900]=0;a[899]=t;t=e+24|0;do{b=t;t=t+4|0;a[t>>2]=7}while((b+8|0)>>>0>>0);if((e|0)!=(c|0)){o=e-c|0;a[n>>2]=a[n>>2]&-2;a[c+4>>2]=o|1;a[e>>2]=o;t=o>>>3;if(o>>>0<256){n=3180+(t<<1<<2)|0;e=a[785]|0;t=1<>2]|0}a[e>>2]=c;a[t+12>>2]=c;a[c+8>>2]=t;a[c+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{b=(t+1048320|0)>>>16&8;w=t<>>16&4;w=w<<_;n=(w+245760|0)>>>16&2;n=14-(_|b|n)+(w<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;i=3444+(n<<2)|0;a[c+28>>2]=n;a[c+20>>2]=0;a[r>>2]=0;t=a[786]|0;e=1<>2]=c;a[c+24>>2]=i;a[c+12>>2]=c;a[c+8>>2]=c;break}e=o<<((n|0)==31?0:25-(n>>>1)|0);n=a[i>>2]|0;while(1){if((a[n+4>>2]&-8|0)==(o|0)){b=213;break}i=n+16+(e>>>31<<2)|0;t=a[i>>2]|0;if(!t){b=212;break}else{e=e<<1;n=t}}if((b|0)==212){a[i>>2]=c;a[c+24>>2]=n;a[c+12>>2]=c;a[c+8>>2]=c;break}else if((b|0)==213){b=n+8|0;w=a[b>>2]|0;a[w+12>>2]=c;a[b>>2]=c;a[c+8>>2]=w;a[c+12>>2]=n;a[c+24>>2]=0;break}}}else{w=a[789]|0;if((w|0)==0|o>>>0>>0)a[789]=o;a[897]=o;a[898]=s;a[900]=0;a[794]=a[903];a[793]=-1;a[798]=3180;a[797]=3180;a[800]=3188;a[799]=3188;a[802]=3196;a[801]=3196;a[804]=3204;a[803]=3204;a[806]=3212;a[805]=3212;a[808]=3220;a[807]=3220;a[810]=3228;a[809]=3228;a[812]=3236;a[811]=3236;a[814]=3244;a[813]=3244;a[816]=3252;a[815]=3252;a[818]=3260;a[817]=3260;a[820]=3268;a[819]=3268;a[822]=3276;a[821]=3276;a[824]=3284;a[823]=3284;a[826]=3292;a[825]=3292;a[828]=3300;a[827]=3300;a[830]=3308;a[829]=3308;a[832]=3316;a[831]=3316;a[834]=3324;a[833]=3324;a[836]=3332;a[835]=3332;a[838]=3340;a[837]=3340;a[840]=3348;a[839]=3348;a[842]=3356;a[841]=3356;a[844]=3364;a[843]=3364;a[846]=3372;a[845]=3372;a[848]=3380;a[847]=3380;a[850]=3388;a[849]=3388;a[852]=3396;a[851]=3396;a[854]=3404;a[853]=3404;a[856]=3412;a[855]=3412;a[858]=3420;a[857]=3420;a[860]=3428;a[859]=3428;w=s+-40|0;_=o+8|0;_=(_&7|0)==0?0:0-_&7;b=o+_|0;_=w-_|0;a[791]=b;a[788]=_;a[b+4>>2]=_|1;a[o+w+4>>2]=40;a[792]=a[907]}}while(0);t=a[788]|0;if(t>>>0>d>>>0){_=t-d|0;a[788]=_;w=a[791]|0;b=w+d|0;a[791]=b;a[b+4>>2]=_|1;a[w+4>>2]=d|3;w=w+8|0;f=A;return w|0}}a[(Re()|0)>>2]=12;w=0;f=A;return w|0}function Fe(e){e=e|0;var t=0,n=0,i=0,r=0,o=0,s=0,l=0,c=0;if(!e)return;n=e+-8|0;r=a[789]|0;e=a[e+-4>>2]|0;t=e&-8;c=n+t|0;do{if(!(e&1)){i=a[n>>2]|0;if(!(e&3))return;s=n+(0-i)|0;o=i+t|0;if(s>>>0>>0)return;if((a[790]|0)==(s|0)){e=c+4|0;t=a[e>>2]|0;if((t&3|0)!=3){l=s;t=o;break}a[787]=o;a[e>>2]=t&-2;a[s+4>>2]=o|1;a[s+o>>2]=o;return}n=i>>>3;if(i>>>0<256){e=a[s+8>>2]|0;t=a[s+12>>2]|0;if((t|0)==(e|0)){a[785]=a[785]&~(1<>2]=t;a[t+8>>2]=e;l=s;t=o;break}}r=a[s+24>>2]|0;e=a[s+12>>2]|0;do{if((e|0)==(s|0)){n=s+16|0;t=n+4|0;e=a[t>>2]|0;if(!e){e=a[n>>2]|0;if(!e){e=0;break}else t=n}while(1){n=e+20|0;i=a[n>>2]|0;if(i|0){e=i;t=n;continue}n=e+16|0;i=a[n>>2]|0;if(!i)break;else{e=i;t=n}}a[t>>2]=0}else{l=a[s+8>>2]|0;a[l+12>>2]=e;a[e+8>>2]=l}}while(0);if(r){t=a[s+28>>2]|0;n=3444+(t<<2)|0;if((a[n>>2]|0)==(s|0)){a[n>>2]=e;if(!e){a[786]=a[786]&~(1<>2]|0)!=(s|0)&1)<<2)>>2]=e;if(!e){l=s;t=o;break}}a[e+24>>2]=r;t=s+16|0;n=a[t>>2]|0;if(n|0){a[e+16>>2]=n;a[n+24>>2]=e}t=a[t+4>>2]|0;if(t){a[e+20>>2]=t;a[t+24>>2]=e;l=s;t=o}else{l=s;t=o}}else{l=s;t=o}}else{l=n;s=n}}while(0);if(s>>>0>=c>>>0)return;e=c+4|0;i=a[e>>2]|0;if(!(i&1))return;if(!(i&2)){if((a[791]|0)==(c|0)){c=(a[788]|0)+t|0;a[788]=c;a[791]=l;a[l+4>>2]=c|1;if((l|0)!=(a[790]|0))return;a[790]=0;a[787]=0;return}if((a[790]|0)==(c|0)){c=(a[787]|0)+t|0;a[787]=c;a[790]=s;a[l+4>>2]=c|1;a[s+c>>2]=c;return}r=(i&-8)+t|0;n=i>>>3;do{if(i>>>0<256){t=a[c+8>>2]|0;e=a[c+12>>2]|0;if((e|0)==(t|0)){a[785]=a[785]&~(1<>2]=e;a[e+8>>2]=t;break}}else{o=a[c+24>>2]|0;e=a[c+12>>2]|0;do{if((e|0)==(c|0)){n=c+16|0;t=n+4|0;e=a[t>>2]|0;if(!e){e=a[n>>2]|0;if(!e){n=0;break}else t=n}while(1){n=e+20|0;i=a[n>>2]|0;if(i|0){e=i;t=n;continue}n=e+16|0;i=a[n>>2]|0;if(!i)break;else{e=i;t=n}}a[t>>2]=0;n=e}else{n=a[c+8>>2]|0;a[n+12>>2]=e;a[e+8>>2]=n;n=e}}while(0);if(o|0){e=a[c+28>>2]|0;t=3444+(e<<2)|0;if((a[t>>2]|0)==(c|0)){a[t>>2]=n;if(!n){a[786]=a[786]&~(1<>2]|0)!=(c|0)&1)<<2)>>2]=n;if(!n)break}a[n+24>>2]=o;e=c+16|0;t=a[e>>2]|0;if(t|0){a[n+16>>2]=t;a[t+24>>2]=n}e=a[e+4>>2]|0;if(e|0){a[n+20>>2]=e;a[e+24>>2]=n}}}}while(0);a[l+4>>2]=r|1;a[s+r>>2]=r;if((l|0)==(a[790]|0)){a[787]=r;return}}else{a[e>>2]=i&-2;a[l+4>>2]=t|1;a[s+t>>2]=t;r=t}e=r>>>3;if(r>>>0<256){n=3180+(e<<1<<2)|0;t=a[785]|0;e=1<>2]|0}a[t>>2]=l;a[e+12>>2]=l;a[l+8>>2]=e;a[l+12>>2]=n;return}e=r>>>8;if(e)if(r>>>0>16777215)e=31;else{s=(e+1048320|0)>>>16&8;c=e<>>16&4;c=c<>>16&2;e=14-(o|s|e)+(c<>>15)|0;e=r>>>(e+7|0)&1|e<<1}else e=0;i=3444+(e<<2)|0;a[l+28>>2]=e;a[l+20>>2]=0;a[l+16>>2]=0;t=a[786]|0;n=1<>>1)|0);n=a[i>>2]|0;while(1){if((a[n+4>>2]&-8|0)==(r|0)){e=73;break}i=n+16+(t>>>31<<2)|0;e=a[i>>2]|0;if(!e){e=72;break}else{t=t<<1;n=e}}if((e|0)==72){a[i>>2]=l;a[l+24>>2]=n;a[l+12>>2]=l;a[l+8>>2]=l;break}else if((e|0)==73){s=n+8|0;c=a[s>>2]|0;a[c+12>>2]=l;a[s>>2]=l;a[l+8>>2]=c;a[l+12>>2]=n;a[l+24>>2]=0;break}}else{a[786]=t|n;a[i>>2]=l;a[l+24>>2]=i;a[l+12>>2]=l;a[l+8>>2]=l}}while(0);c=(a[793]|0)+-1|0;a[793]=c;if(!c)e=3596;else return;while(1){e=a[e>>2]|0;if(!e)break;else e=e+8|0}a[793]=-1;return}function Re(){return 3636}function Ne(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,a=0;e:do{if(!n)e=0;else{while(1){r=i[e>>0]|0;a=i[t>>0]|0;if(r<<24>>24!=a<<24>>24)break;n=n+-1|0;if(!n){e=0;break e}else{e=e+1|0;t=t+1|0}}e=(r&255)-(a&255)|0}}while(0);return e|0}function Ie(){}function De(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){E=t>>>n;return e>>>n|(t&(1<>>n-32|0}function Oe(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){E=t<>>32-n;return e<>>0;return(E=t+i+(n>>>0>>0|0)>>>0,n|0)|0}function Be(e,t,n,i){e=e|0;t=t|0;n=n|0;i=i|0;i=t-i-(n>>>0>e>>>0|0)>>>0;return(E=i,e-n>>>0|0)|0}function ke(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,o=0,s=0;if((n|0)>=8192)return K(e|0,t|0,n|0)|0;s=e|0;o=e+n|0;if((e&3)==(t&3)){while(e&3){if(!n)return s|0;i[e>>0]=i[t>>0]|0;e=e+1|0;t=t+1|0;n=n-1|0}n=o&-4|0;r=n-64|0;while((e|0)<=(r|0)){a[e>>2]=a[t>>2];a[e+4>>2]=a[t+4>>2];a[e+8>>2]=a[t+8>>2];a[e+12>>2]=a[t+12>>2];a[e+16>>2]=a[t+16>>2];a[e+20>>2]=a[t+20>>2];a[e+24>>2]=a[t+24>>2];a[e+28>>2]=a[t+28>>2];a[e+32>>2]=a[t+32>>2];a[e+36>>2]=a[t+36>>2];a[e+40>>2]=a[t+40>>2];a[e+44>>2]=a[t+44>>2];a[e+48>>2]=a[t+48>>2];a[e+52>>2]=a[t+52>>2];a[e+56>>2]=a[t+56>>2];a[e+60>>2]=a[t+60>>2];e=e+64|0;t=t+64|0}while((e|0)<(n|0)){a[e>>2]=a[t>>2];e=e+4|0;t=t+4|0}}else{n=o-4|0;while((e|0)<(n|0)){i[e>>0]=i[t>>0]|0;i[e+1>>0]=i[t+1>>0]|0;i[e+2>>0]=i[t+2>>0]|0;i[e+3>>0]=i[t+3>>0]|0;e=e+4|0;t=t+4|0}}while((e|0)<(o|0)){i[e>>0]=i[t>>0]|0;e=e+1|0;t=t+1|0}return s|0}function ze(e,t,n){e=e|0;t=t|0;n=n|0;var r=0;if((t|0)<(e|0)&(e|0)<(t+n|0)){r=e;t=t+n|0;e=e+n|0;while((n|0)>0){e=e-1|0;t=t-1|0;n=n-1|0;i[e>>0]=i[t>>0]|0}e=r}else ke(e,t,n)|0;return e|0}function Ve(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,o=0,s=0,l=0;s=e+n|0;t=t&255;if((n|0)>=67){while(e&3){i[e>>0]=t;e=e+1|0}r=s&-4|0;o=r-64|0;l=t|t<<8|t<<16|t<<24;while((e|0)<=(o|0)){a[e>>2]=l;a[e+4>>2]=l;a[e+8>>2]=l;a[e+12>>2]=l;a[e+16>>2]=l;a[e+20>>2]=l;a[e+24>>2]=l;a[e+28>>2]=l;a[e+32>>2]=l;a[e+36>>2]=l;a[e+40>>2]=l;a[e+44>>2]=l;a[e+48>>2]=l;a[e+52>>2]=l;a[e+56>>2]=l;a[e+60>>2]=l;e=e+64|0}while((e|0)<(r|0)){a[e>>2]=l;e=e+4|0}}while((e|0)<(s|0)){i[e>>0]=t;e=e+1|0}return s-n|0}function Ge(e){e=e|0;var t=0,n=0;n=e+15&-16|0;t=a[h>>2]|0;e=t+n|0;if((n|0)>0&(e|0)<(t|0)|(e|0)<0){Z()|0;J(12);return-1}a[h>>2]=e;if((e|0)>(Q()|0)?(q()|0)==0:0){a[h>>2]=t;J(12);return-1}return t|0}return{_bitshift64Lshr:De,_bitshift64Shl:Oe,_decompress:be,_free:Fe,_get_curr_output_length:Le,_get_in_buffer_ptr:we,_get_out_buffer_ptr:Ae,_i64Add:Ue,_i64Subtract:Be,_in_buffer_set_pos:Me,_in_buffer_set_size:Te,_init_decompressor:_e,_is_input_end_reached:Ce,_malloc:Pe,_memcpy:ke,_memmove:ze,_memset:Ve,_out_buffer_set_pos:Se,_out_buffer_set_size:Ee,_sbrk:Ge,establishStackSpace:ie,getTempRet0:oe,runPostSets:Ie,setTempRet0:ae,setThrew:re,stackAlloc:ee,stackRestore:ne,stackSave:te}}(bc.asmGlobalArg,bc.asmLibraryArg,Bc),yu=(bc._bitshift64Lshr=gu._bitshift64Lshr,bc._bitshift64Shl=gu._bitshift64Shl,bc._decompress=gu._decompress,bc._free=gu._free,bc._get_curr_output_length=gu._get_curr_output_length,bc._get_in_buffer_ptr=gu._get_in_buffer_ptr,bc._get_out_buffer_ptr=gu._get_out_buffer_ptr,bc._i64Add=gu._i64Add,bc._i64Subtract=gu._i64Subtract,bc._in_buffer_set_pos=gu._in_buffer_set_pos,bc._in_buffer_set_size=gu._in_buffer_set_size,bc._init_decompressor=gu._init_decompressor,bc._is_input_end_reached=gu._is_input_end_reached,bc._malloc=gu._malloc,bc._memcpy=gu._memcpy,bc._memmove=gu._memmove,bc._memset=gu._memset,bc._out_buffer_set_pos=gu._out_buffer_set_pos,bc._out_buffer_set_size=gu._out_buffer_set_size,bc._sbrk=gu._sbrk,bc.establishStackSpace=gu.establishStackSpace,bc.getTempRet0=gu.getTempRet0,bc.runPostSets=gu.runPostSets,bc.setTempRet0=gu.setTempRet0,bc.setThrew=gu.setThrew,bc.stackAlloc=gu.stackAlloc),xu=bc.stackRestore=gu.stackRestore,_u=bc.stackSave=gu.stackSave;if(bc.asm=gu,bc.cwrap=function(e,t,n){n=n||[];var i=Nc(e),r=n.every(function(e){return"number"===e});return"string"!==t&&r?i:function(){return Oc(e,t,n,arguments)}},lu)if(uu(lu)||("function"==typeof bc.locateFile?lu=bc.locateFile(lu):bc.memoryInitializerPrefixURL&&(lu=bc.memoryInitializerPrefixURL+lu)),Ec||Lc){var bu=bc.readBinary(lu);zc.set(bu,8)}else{au++,bc.monitorRunDependencies&&bc.monitorRunDependencies(au);var wu=function(e){e.byteLength&&(e=new Uint8Array(e)),zc.set(e,8),bc.memoryInitializerRequest&&delete bc.memoryInitializerRequest.response,function(e){if(au--,bc.monitorRunDependencies&&bc.monitorRunDependencies(au),0==au&&(null!==ou&&(clearInterval(ou),ou=null),su)){var t=su;su=null,t()}}()},Au=function(){bc.readAsync(lu,wu,function(){throw"could not load memory initializer "+lu})},Mu=mu(lu);if(Mu)wu(Mu.buffer);else if(bc.memoryInitializerRequest){var Tu=function(){var e=bc.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var n=mu(bc.memoryInitializerRequestURL);if(!n)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+lu),void Au();t=n.buffer}wu(t)};bc.memoryInitializerRequest.response?setTimeout(Tu,0):bc.memoryInitializerRequest.addEventListener("load",Tu)}else Au()}function Su(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Eu(e){function t(){bc.calledRun||(bc.calledRun=!0,Fc||(ru||(ru=!0,Kc(eu)),Kc(tu),bc.onRuntimeInitialized&&bc.onRuntimeInitialized(),function(){if(bc.postRun)for("function"==typeof bc.postRun&&(bc.postRun=[bc.postRun]);bc.postRun.length;)e=bc.postRun.shift(),iu.unshift(e);var e;Kc(iu)}()))}e=e||bc.arguments,au>0||(!function(){if(bc.preRun)for("function"==typeof bc.preRun&&(bc.preRun=[bc.preRun]);bc.preRun.length;)e=bc.preRun.shift(),$c.unshift(e);var e;Kc($c)}(),au>0||bc.calledRun||(bc.setStatus?(bc.setStatus("Running..."),setTimeout(function(){setTimeout(function(){bc.setStatus("")},1),t()},1)):t()))}function Lu(e){throw bc.onAbort&&bc.onAbort(e),void 0!==e?(bc.print(e),bc.printErr(e),e=JSON.stringify(e)):e="",Fc=!0,1,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(Su.prototype=new Error,Su.prototype.constructor=Su,su=function e(){bc.calledRun||Eu(),bc.calledRun||(su=e)},bc.run=Eu,bc.exit=function(e,t){t&&bc.noExitRuntime&&0===e||(bc.noExitRuntime||(Fc=!0,e,Wc=vu,Kc(nu),!0,bc.onExit&&bc.onExit(e)),Ec&&process.exit(e),bc.quit(e,new Su(e)))},bc.abort=Lu,bc.preInit)for("function"==typeof bc.preInit&&(bc.preInit=[bc.preInit]);bc.preInit.length>0;)bc.preInit.pop()();bc.noExitRuntime=!0,Eu();var Cu=bc,Pu=524288,Fu=["","Memory allocation failed","Memory usage limit reached","Unsupported check; not verifying file integrity","Not an .xz file","Unsupported options in the .xz headers","File is corrupt","Unknown decompression bug"];function Ru(e){this.manager=void 0!==e?e:_l}function Nu(e,t){this.uuid=Ft.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Iu(e,t,n,i){this.uuid=Ft.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Du(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function Ou(e,t,n,i){return(o=1-e)*o*t+2*(1-(a=e))*a*n+(r=e)*r*i;var r,a,o}function Uu(e,t,n,i,r){return(c=1-e)*c*c*t+3*(l=1-(s=e))*l*s*n+3*(1-(o=e))*o*o*i+(a=e)*a*a*r;var a,o,s,l,c}function Bu(){this.arcLengthDivisions=200}function ku(e,t){Bu.call(this),this.v1=e,this.v2=t}function zu(){Bu.call(this),this.curves=[],this.autoClose=!1}function Vu(e,t,n,i,r,a,o,s){Bu.call(this),this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function Gu(e){Bu.call(this),this.points=void 0===e?[]:e}function ju(e,t,n,i){Bu.call(this),this.v0=e,this.v1=t,this.v2=n,this.v3=i}function Xu(e,t,n){Bu.call(this),this.v0=e,this.v1=t,this.v2=n}Object.assign(Ru.prototype,{crossOrigin:"Anonymous",load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e);var r=this,a=yl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=new XMLHttpRequest;return o.open("GET",e,!0),o.addEventListener("load",function(n){var a=n.target.response;200===this.status||0===this.status?(0===this.status&&console.warn("v3d.XZLoader: HTTP Status 0 received."),r.decompressArrayBuffer(a,function(n){t&&t(n),r.manager.itemEnd(e),yl.add(e,n)},function(t){i&&i(t),r.manager.itemEnd(e),r.manager.itemError(e)})):(i&&i(n),r.manager.itemEnd(e),r.manager.itemError(e))},!1),n&&o.addEventListener("progress",function(e){n(e)},!1),o.addEventListener("error",function(t){i&&i(t),r.manager.itemEnd(e),r.manager.itemError(e)},!1),o.responseType="arraybuffer",o.send(null),r.manager.itemStart(e),o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},decompressArrayBuffer:function(e,t,n){var i=this;function r(e){var t=i._emGetInBufferPtr();Cu.HEAPU8.set(e,t),i._emInBufferSetPos(0),i._emInBufferSetSize(e.length),a()}function a(){i._emOutBufferSetPos(0)}var o=i._emInitDecompressor();if(0!=o)return console.error("XZLoader._emInitDecompressor: error code "+o+" ("+Fu[o]+")"),void(n&&n(o));var s=new Uint8Array(e),l=s.length,c=[],u=0,h=Math.min(Pu,l),d=0;r(s.subarray(u,h)),function e(){var o,p,f=i._emDecompress();if(f)console.error("XZLoader._emDecompress: error code "+f+" ("+Fu[f]+")"),n&&n(f);else{var m=i._emGetCurrOutputLength();if(c.push((o=m,p=i._emGetOutBufferPtr(),new Uint8Array(Cu.HEAPU8.subarray(p,p+o)))),a(),i._emIsInputEndReached()&&(u=h,h=Math.min(h+Pu,l),r(s.subarray(u,h))),u==h){var v=c.reduce(function(e,t,n,i){return e+t.length},0),g=new Uint8Array(v),y=0;c.forEach(function(e){g.set(e,y),y+=e.length}),t&&t(g.buffer)}else++d%2==0?setTimeout(e,1):e()}}()},_emInitDecompressor:Cu.cwrap("init_decompressor","number"),_emDecompress:Cu.cwrap("decompress","number"),_emGetInBufferPtr:Cu.cwrap("get_in_buffer_ptr","number"),_emGetOutBufferPtr:Cu.cwrap("get_out_buffer_ptr","number"),_emInBufferSetPos:Cu.cwrap("in_buffer_set_pos",null,["number"]),_emInBufferSetSize:Cu.cwrap("in_buffer_set_size",null,["number"]),_emOutBufferSetPos:Cu.cwrap("out_buffer_set_pos",null,["number"]),_emOutBufferSetSize:Cu.cwrap("out_buffer_set_size",null,["number"]),_emGetCurrOutputLength:Cu.cwrap("get_curr_output_length","number"),_emIsInputEndReached:Cu.cwrap("is_input_end_reached","number")}),Object.defineProperty(Nu.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Nu.prototype,{isInterleavedBuffer:!0,setArray:function(e){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.stride:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,a=new Dt,o=[],s=[],l=[],c=new Dt,u=new Nt;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i),o[n].normalize();s[0]=new Dt,l[0]=new Dt;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),r=Math.acos(Ft.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(c,r))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(Ft.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],r*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}}}),ku.prototype=Object.create(Bu.prototype),ku.prototype.constructor=ku,ku.prototype.isLineCurve=!0,ku.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},ku.prototype.getPointAt=function(e){return this.getPoint(e)},ku.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},zu.prototype=Object.assign(Object.create(Bu.prototype),{constructor:zu,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ku(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Nr,n=0,i=e.length;nt;)n-=t;nt.length-2?t.length-1:i+1],l=t[i>t.length-3?t.length-1:i+2];return new Rt(Du(r,a.x,o.x,s.x,l.x),Du(r,a.y,o.y,s.y,l.y))},ju.prototype=Object.create(Bu.prototype),ju.prototype.constructor=ju,ju.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2,r=this.v3;return new Rt(Uu(e,t.x,n.x,i.x,r.x),Uu(e,t.y,n.y,i.y,r.y))},Xu.prototype=Object.create(Bu.prototype),Xu.prototype.constructor=Xu,Xu.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2;return new Rt(Ou(e,t.x,n.x,i.x),Ou(e,t.y,n.y,i.y))};var Wu=Object.assign(Object.create(zu.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);this.currentPoint.copy(u)}});function Hu(e){zu.call(this),this.currentPoint=new Rt,e&&this.fromPoints(e)}function Yu(){Hu.apply(this,arguments),this.holes=[]}function qu(){this.subPaths=[],this.currentPath=null}function Qu(e){this.data=e}function Zu(e,t){Ts.call(this,e,t),this.type="BlenderTextGeometry",this.computeBoundingBox();var n,i,r=this.boundingBox.max.x-this.boundingBox.min.x,a=this.boundingBox.max.y-this.boundingBox.min.y;switch(t.alignX){case"left":n=0;break;case"center":n=-.5*r;break;case"right":n=-r}switch(t.alignY){case"bottom":i=0;break;case"center":i=-.5*a;break;case"top":i=-a}(Math.abs(n)>0||Math.abs(i)>0)&&this.translate(n,i,0)}function Ju(){this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this.geometry=new Wr,this.widthCallback=null}function Ku(e,t,n,i,r){var a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,r&&t+r):e.slice(t,r&&t+r):e,n.set)n.set(e,i);else for(a=0;aNumber.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[r],c=-c),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=c*(e.x-o.x)-l*(e.y-o.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=ws.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new Yu).curves=s.curves,c.push(l),c;var u=!r(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g1){for(var x=!1,_=[],b=0,w=f.length;b0&&(x||(m=p))}g=0;for(var L=f.length;g65535?Uint32Array:Uint16Array;this.geometry.setIndex(new Ir(new m(p),1))}}}()}),nh.prototype=Object.assign(Object.create(Xs.prototype),{constructor:nh,isMeshLineMaterial:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.sizeAttenuation=e.sizeAttenuation,this.color.copy(e.color),this.opacity=e.opacity,this.useMap=e.useMap,this.map=e.map,this.useAlphaMap=e.useAlphaMap,this.alphaMap=e.alphaMap,this.resolution.copy(e.resolution),this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}});var ih=["TEXTURE","TEX_IMAGE","BITMAP_MAX","BITMAP_ENV_MAX","REFLECT_REFRACT_MAX"];function rh(e){this.manager=void 0!==e?e:_l,this.crossOrigin="Anonymous",this.onProgress=null}Object.assign(rh.prototype,{load:function(e,t,n,i){var r=this;r.onProgress=n||function(){};var a=this.path&&"string"==typeof this.path?this.path:uc.prototype.extractUrlBase(e),o=-1!=e.indexOf(".xz",e.length-3);if(o)var s=new Ru(r.manager);else(s=new El(r.manager)).setResponseType("arraybuffer");s.load(e,function(e){r.parse(e,a,t,i,o)},function(e){if(e.lengthComputable)var t=e.loaded/e.total*100;else t=100;r.onProgress(.3*t)},i)},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e},parse:function(e,t,n,i,r){var a,o=this,s={};Ph(new Uint8Array(e,0,4))===lh?(s[ah.KHR_BINARY_GLTF]=new function(e){this.name=ah.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,ch);{if(this.header={magic:Ph(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lh)throw new Error("v3d.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("v3d.GLTFLoader: Legacy binary file detected. Use GLTFLoader instead.")}var n=new DataView(e,ch),i=0;for(;i=2.0 are supported.")):(l.extensionsUsed&&(l.extensionsUsed.indexOf(ah.S8S_V3D_DATA)>=0&&(s[ah.S8S_V3D_DATA]=new oh(l)),l.extensionsUsed.indexOf(ah.S8S_V3D_MATERIAL_DATA)>=0&&(s[ah.S8S_V3D_MATERIAL_DATA]=new sh(l))),new Rh(l,s,{path:t||this.path,crossOrigin:this.crossOrigin,loadBinXZ:r,onProgress:function(e){o.onProgress(e)}}).parse(function(e,t,i,r,a){var s={scene:e,scenes:t,cameras:i,animations:r,renderer:a};o.onProgress(100),n(s)},i))}});var ah={KHR_BINARY_GLTF:"KHR_binary_glTF",S8S_V3D_ANIMATION_DATA:"S8S_v3d_animation_data",S8S_V3D_DATA:"S8S_v3d_data",S8S_V3D_CAMERA_DATA:"S8S_v3d_camera_data",S8S_V3D_MATERIAL_DATA:"S8S_v3d_material_data",S8S_V3D_MESH_DATA:"S8S_v3d_mesh_data",S8S_V3D_NODE_DATA:"S8S_v3d_node_data",S8S_V3D_SCENE_DATA:"S8S_v3d_scene_data",S8S_V3D_TEXTURE_DATA:"S8S_v3d_texture_data"};function oh(e){this.name=ah.S8S_V3D_DATA;var t=e.extensions&&e.extensions[ah.S8S_V3D_DATA]||{};this.lights={};var n=t.lights||{};for(var i in n){var r,a=n[i],o=(new Nn).fromArray(a.color),s=bi(a.intensity)?a.intensity:1;switch(a.type){case"point":r=new Ul(o,s);break;case"directional":r=new kl(o,s);break;case"spot":r=new Ol(o,s);break;case"hemisphere":r=new Nl(o,new Nn(0,0,0),s);break;case"ambient":r=new zl(o,s)}if(r){if(bi(a.distance)&&(r.distance=a.distance),bi(a.decay)&&(r.decay=a.decay,a.decay>=2&&(r.intensity/=4*Math.PI)),bi(a.angle)&&(r.angle=a.angle),bi(a.penumbra)&&(r.penumbra=a.penumbra),bi(a.shadow)){r.castShadow=!0,r.shadow.bias=a.shadow.bias,r.shadow.radius=a.shadow.radius,r.shadow.mapSize.width=a.shadow.mapSize,r.shadow.mapSize.height=a.shadow.mapSize,r.shadow.camera.near=a.shadow.cameraNear,r.shadow.camera.far=a.shadow.cameraFar,r.shadow.camera.fov=a.shadow.cameraFov;var l=a.shadow.cameraSize/2;r.shadow.camera.bottom=-l,r.shadow.camera.left=-l,r.shadow.camera.top=l,r.shadow.camera.right=l}else r.castShadow=!1;r.name=a.name||"light_"+i,this.lights[i]=r}}this.nodeGraphs={};var c=t.nodeGraphs||[];for(var u in c){var h=c[u];this.nodeGraphs[u]=h}}function sh(e){this.name=ah.S8S_V3D_MATERIAL_DATA}oh.prototype.loadCurves=function(e,t){var n=e.extensions&&e.extensions[ah.S8S_V3D_DATA]||{};this.curves={};var i=n.curves||{};for(var r in i){var a,o=i[r];switch(o.type){case"font":var s=new Qu(o.font),l=o.bevelSize>0||o.bevelThickness>0,c=new Zu(o.text,{font:s,size:o.size,height:o.height,curveSegments:o.curveSegments,bevelEnabled:l,bevelThickness:o.bevelThickness,bevelSize:o.bevelSize,bevelSegments:o.bevelSegments,alignX:o.alignX,alignY:o.alignY});if(t&&t[o.material])var u=t[o.material];else u=sh.createDefaultBlenderMaterial();a=new ta(c,u)}a&&(a.name=o.name||"curve_"+r,this.curves[r]=a)}},sh.prototype.getMaterialType=function(e){var t=e.extensions[this.name];return bi(t.nodeGraph)||t.useShadeless?ll:Ws},sh.prototype.extendParams=function(e,t,n){var i=t.extensions[this.name],r=[];if(bi(i.nodeGraph)){var a=i.nodeGraph;e.nodeGraph=ll.nodeGraphFromGLTF(a);for(var o=0;o-1){var l=ll.nodeTexUniName(s.type,s.texture);r.push(n.assignTextureNode(e,l,s.texture))}}var c=n.extensions[ah.S8S_V3D_DATA];if(c)for(var u in e.additionalNodeGraphs={},c.nodeGraphs){a=c.nodeGraphs[u];e.additionalNodeGraphs[u]=ll.nodeGraphFromGLTF(a);for(o=0;o-1){l=ll.nodeTexUniName(s.type,s.texture);r.push(n.assignTextureNode(e,l,s.texture))}}}bi(i.profile)&&(e.profile=i.profile)}else if(i.useShadeless){if(e.diffuseColor=(new Nn).fromArray(i.diffuseColor),e.alpha=i.alpha,bi(i.diffuseTexture)){l=ll.nodeTexUniName("TEXTURE",0);r.push(n.assignTextureNode(e,l,i.diffuseTexture.index))}bi(i.profile)&&(e.profile=i.profile)}else e.diffuseShader=i.diffuseShader,e.diffuseColor=(new Nn).fromArray(i.diffuseColor),e.alpha=i.alpha,bi(i.diffuseTexture)&&r.push(n.assignTexture(e,"map",i.diffuseTexture.index)),e.diffuseIntensity=i.diffuseIntensity,bi(i.alphaTexture)&&r.push(n.assignTexture(e,"alphaMap",i.alphaTexture.index)),e.specularShader=i.specularShader,e.specularColor=(new Nn).fromArray(i.specularColor),bi(i.specularTexture)&&r.push(n.assignTexture(e,"specularMap",i.specularTexture.index)),e.specularIntensity=i.specularIntensity,e.specularHardness=i.specularHardness,bi(i.specularAlpha)&&(e.specularAlpha=i.specularAlpha);return bi(i.depthWrite)&&(e.depthWrite=i.depthWrite),Promise.all(r)},sh.createDefaultBlenderMaterial=function(){return new Ws({diffuseColor:new Nn(.8,.8,.8),diffuseIntensity:.8,specularColor:new Nn(1,1,1),specularIntensity:.5,specularHardness:50})};var lh="glTF",ch=12,uh={JSON:1313821514,BIN:5130562};var hh,dh=0,ph=1,fh=2,mh=3,vh=4,gh=5,yh=6,xh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_h={9728:Ce,9729:Re,9984:Pe,9985:Ne,9986:Fe,9987:Ie},bh={33071:Ee,33648:Le,10497:Se},wh={6406:Ye,6407:qe,6408:Qe,6409:Ze,6410:Je},Ah={5121:De,32819:je,32820:Xe,33635:We},Mh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Th={CATMULLROMSPLINE:pt,CUBICSPLINE:pt,LINEAR:dt,STEP:ht},Sh="OPAQUE",Eh="MASK";function Lh(e,t,n){if(!e)return Promise.resolve();var i,r=[];if("[object Array]"===Object.prototype.toString.call(e)){i=[];for(var a=e.length,o=0;o-1&&i.addAttribute(t.texcoordToAttrName(a),s),a.indexOf("COLOR_")>-1&&i.addAttribute(t.colorToAttrName(a),s)}}return void 0!==e.indices&&i.setIndex(n.accessors[e.indices]),i})})},Rh.prototype.loadMeshes=function(){var e=this,t=this.json;return this._withDependencies(["accessors","materials"]).then(function(n){return Lh(t.meshes,function(t,i){var r=new Vo,a=t.primitives||[],o=e.getExt(t,ah.S8S_V3D_MESH_DATA);return e.loadGeometries(a).then(function(s){for(var l=0;l1))return m;m.name+="_"+l,m.isMaterialGeneratedMesh=!0,r.add(m)}return r})})})},Rh.prototype.loadCameras=function(){var e=this;return Lh(this.json.cameras,function(t){var n,i=t[t.type];if(i){if("perspective"===t.type){var r=i.aspectRatio||1,a=i.yfov;n=new ao(Ft.radToDeg(a),r,i.znear||1,i.zfar||2e6)}else"orthographic"===t.type&&(n=new Xi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar));bi(t.name)||(n.name=t.name);var o=e.getExt(t,ah.S8S_V3D_CAMERA_DATA);if(o){if(n.controls={},n.controls.type=o.controls,n.viewportFit.type=3,bi(o.viewportFitType))switch(o.viewportFitType){case"VERTICAL":n.viewportFit.type=1;break;case"HORIZONTAL":n.viewportFit.type=2;break;case"AUTO":n.viewportFit.type=3}bi(o.viewportFitInitialAspect)&&(n.viewportFit.initialAspect=o.viewportFitInitialAspect),bi(o.enablePan)?n.controls.enablePan=o.enablePan:n.controls.enablePan=!0,bi(o.rotateSpeed)?n.controls.rotateSpeed=o.rotateSpeed:n.controls.rotateSpeed=1,bi(o.moveSpeed)?n.controls.moveSpeed=o.moveSpeed:n.controls.moveSpeed=1,bi(o.orbitMinDistance)&&(n.controls.orbitMinDistance=o.orbitMinDistance),bi(o.orbitMaxDistance)&&(n.controls.orbitMaxDistance=o.orbitMaxDistance),bi(o.orbitMinPolarAngle)&&(n.controls.orbitMinPolarAngle=o.orbitMinPolarAngle),bi(o.orbitMaxPolarAngle)&&(n.controls.orbitMaxPolarAngle=o.orbitMaxPolarAngle),bi(o.orbitTarget)&&(n.controls.orbitTarget=new Dt,n.controls.orbitTarget.fromArray(o.orbitTarget))}return t.extras&&(n.userData.v3d=t.extras),n}console.warn("v3d.GLTFLoader: Missing camera parameters.")})},Rh.prototype.loadSkins=function(){var e=this.json;return this._withDependencies(["accessors"]).then(function(t){return Lh(e.skins,function(e){return{joints:e.joints,inverseBindMatrices:t.accessors[e.inverseBindMatrices]}})})},Rh.prototype.loadAnimations=function(){var e=this,t=this.json;return this._withDependencies(["accessors","nodes"]).then(function(n){return Lh(t.animations,function(t,i){for(var r=[],a=-1,o=0;o-1&&l.output>-1){var c=s.target,u=void 0!==c.node?c.node:c.id,h=void 0!==t.parameters?t.parameters[l.input]:l.input,d=void 0!==t.parameters?t.parameters[l.output]:l.output,p=n.accessors[h];if(p.count<=1)continue;var f=n.accessors[d],m=n.nodes[u];if(m){var v;a=m.id,m.updateMatrix(),m.matrixAutoUpdate=!0;var g="";switch(c.path){case"weights":v=Zl,g="morphTargetInfluences";break;case"rotation":v=Ql,g="quaternion";break;case"translation":v=Yl,g="position";break;case"scale":v=Yl,g="scale";break;case"intensity":v=Zl,g="intensity";break;default:if(v=Yl,c.path.indexOf("nodeValue")>-1)g="material.nodeValue["+c.path.match(/".*"/g)[0]+"]";else if(c.path.indexOf("nodeRGB")>-1){g="material.nodeRGB["+c.path.match(/".*"/g)[0]+"]"}}var y=m.name?m.name:m.uuid;"CATMULLROMSPLINE"==l.interpolation&&console.warn("v3d.GLTFLoader: CATMULLROMSPLINE interpolation is not supported. Using CUBICSPLINE instead.");var x=bi(l.interpolation)?Th[l.interpolation]:dt,_=[];"weights"==c.path?m.traverse(function(e){e.isMesh&&e.material.morphTargets&&_.push(e.name?e.name:e.uuid)}):c.path.indexOf("material")>-1?m.traverse(function(e){e.isMesh&&e.material.isMeshNodeMaterial&&_.push(e.name?e.name:e.uuid)}):_.push(y);for(var b=0,w=_.length;b1&&(o.name+="_instance_"+a[e.mesh]++),o}return void 0!==e.camera?n.cameras[e.camera]:i&&bi(i.curve)?t.getExt(t,ah.S8S_V3D_DATA).curves[i.curve]:i&&bi(i.light)?t.getExt(t,ah.S8S_V3D_DATA).lights[i.light].clone():new Gi}).then(function(i){return Lh(i,function(r,a){var o=e.nodes[a];if(void 0!==o.skin){for(var s=[],l=r.children.length>0?r.children:[r],c=0;c0?(r.remove.apply(r,r.children),r.add.apply(r,s)):r=s[0]}return r.traverse(function(e){var n=r==e,a=t.getExt(o,ah.S8S_V3D_NODE_DATA);if(n){if(void 0!==o.name&&(e.name=o.name),void 0!==o.matrix){var s=new Nt;s.fromArray(o.matrix),e.applyMatrix(s)}else void 0!==o.translation&&e.position.fromArray(o.translation),void 0!==o.rotation&&e.quaternion.fromArray(o.rotation),void 0!==o.scale&&e.scale.fromArray(o.scale);if((e.isDirectionalLight||e.isSpotLight||e.isHemisphereLight)&&(e.isFreeLight=!0),a&&a.hidden&&(e.visible=!1),a&&bi(a.constraints))for(var l=0;l0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){It.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}}),Object.assign(rd.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=0,c=arguments.length;l!==c;++l){var u=arguments[l],h=u.uuid,d=i[h],p=void 0;if(void 0===d){d=t++,i[h]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new xc(u,r[f],a[f]))}else if(d=t){var u=t++,h=e[u];n[h.uuid]=c,e[c]=h,n[l]=u,e[u]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,c=i[l];if(void 0!==c)if(delete i[l],c0)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var a=2202===i;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&r))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=mt,i.endingEnd=mt):(i.endingStart=e?this.zeroSlopeAtStart?mt:ft:vt,i.endingEnd=t?this.zeroSlopeAtEnd?mt:ft:vt)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),Object.assign(od.prototype,t.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==r;++u){var h=i[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new id(xc.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t",'Find out how to get it here.'].join("\n"):["Your browser does not seem to support WebGL.
",'Find out how to get it here.'].join("\n"),e},showWebGLErrorMessage:function(e){(e=e||document.body).appendChild(Cd.genWebGLErrorMessage())},checkIOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)}};function Pd(e){"string"==typeof e&&(console.warn("v3d.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Fd(){Wr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Rd(e,t,n){Nu.call(this,e,t),this.meshPerAttribute=n||1}function Nd(e,t,n){Ir.call(this,e,t),this.meshPerAttribute=n||1}function Id(e,t,n,i){this.ray=new Kr(e,t),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("v3d.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Dd(e,t){return e.distance-t.distance}function Od(e,t,n,i){if(!(!1===e.visible||e.isMesh&&e.isMaterialGeneratedMesh&&e.parent&&!e.parent.visible)&&(e.raycast(t,n),!0===i))for(var r=e.children,a=0,o=r.length;a.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Ld.set(e.z,0,-e.x).normalize(),Ed=Math.acos(e.y),this.quaternion.setFromAxisAngle(Ld,Ed))}),tp.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},tp.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},np.prototype=Object.create(Uo.prototype),np.prototype.constructor=np;var rp=new Dt,ap=new ip,op=new ip,sp=new ip;function lp(e){Bu.call(this),e.length<2&&console.warn("v3d.CatmullRomCurve3: Points array needs at least two entries."),this.points=e||[],this.closed=!1}function cp(e,t,n,i){Bu.call(this),this.v0=e,this.v1=t,this.v2=n,this.v3=i}function up(e,t,n){Bu.call(this),this.v0=e,this.v1=t,this.v2=n}function hp(e,t){Bu.call(this),this.v1=e,this.v2=t}function dp(e,t,n,i,r,a){Vu.call(this,e,t,n,n,i,r,a)}lp.prototype=Object.create(Bu.prototype),lp.prototype.constructor=lp,lp.prototype.getPoint=function(e){var t,n,i,r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),c=s-l;if(this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a.length)+1)*a.length:0===c&&l===o-1&&(l=o-2,c=1),this.closed||l>0?t=a[(l-1)%o]:(rp.subVectors(a[0],a[1]).add(a[0]),t=rp),n=a[l%o],i=a[(l+1)%o],this.closed||l+2v)var g=((y=f>s?Math.min(i.bottom+a,f):Math.max(i.top-a,f))-f)/m+p;else var y=((g=pMath.abs(c)&&(b+=a,w=n.zoomSpeedTouch,A=n.zoomInertiaTouch),n.enablePan&&Math.abs(a)<=Math.abs(c)&&(E.add(s),L=n.panSpeedTouch,C=n.panInertiaTouch)}}}function H(e){if(!1!==n.enabled){switch(e.touches.length){case 0:h=i.NONE;break;case 1:if(!1===n.enableRotate)return;h=i.TOUCH_ROTATE,x.copy(B(e.touches[0].pageX,e.touches[0].pageY).negate()),y.copy(x)}n.dispatchEvent(I)}}function Y(e){!1!==n.enabled&&e.preventDefault()}this.update=function(){n.object.isCamera||n.object.isLight?d.set(0,0,-1):d.set(0,0,1),d.applyQuaternion(n.object.quaternion).normalize(),p.setFromVector3(d),p.theta+=f.theta*v,p.phi+=f.phi*v,p.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),d.setFromSpherical(p),a.copy(d).add(n.object.position),n.object.lookAt(a),n.object.isPerspectiveCamera?n.object.position.addScaledVector(d,_*w):n.object.isOrthographicCamera&&(n.object.zoom*=1+_*w*.15,n.object.updateProjectionMatrix()),o.copy(d).cross(n.object.up).setLength(-S.x),o.add(s.copy(n.object.up).setLength(S.y)),n.object.position.addScaledVector(o,L);var e,t=!1;c.distanceToSquared(n.object.position)>1e-6&&(c.copy(n.object.position),t=!0),u.dot(n.object.quaternion)<1-1e-6&&(u.copy(n.object.quaternion),t=!0),t&&n.dispatchEvent(R),e=r.getDelta(),f.set(f.radius,m.y,m.x),m.x=n.enableDamping?Ft.expAverage(m.x,0,e,g):0,m.y=n.enableDamping?Ft.expAverage(m.y,0,e,g):0,f.set(f.radius,f.phi-m.y,f.theta-m.x),S.copy(E),E.x=n.enableDamping?Ft.expAverage(E.x,0,e,C):0,E.y=n.enableDamping?Ft.expAverage(E.y,0,e,C):0,S.sub(E),_=b,b=n.enableDamping?Ft.expAverage(b,0,e,A):0,_-=b},this.dispose=function(){this.domElement.removeEventListener("contextmenu",Y,!1),this.domElement.removeEventListener("mousedown",z,!1),this.domElement.removeEventListener("wheel",j,!1),this.domElement.removeEventListener("touchstart",X,!1),this.domElement.removeEventListener("touchend",H,!1),this.domElement.removeEventListener("touchmove",W,!1),document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",G,!1),window.removeEventListener("keydown",k,!1)},this.domElement.addEventListener("contextmenu",Y,!1),this.domElement.addEventListener("mousedown",z,!1),this.domElement.addEventListener("wheel",j,!1),this.domElement.addEventListener("touchstart",X,!1),this.domElement.addEventListener("touchend",H,!1),this.domElement.addEventListener("touchmove",W,!1),window.addEventListener("keydown",k,!1),this.handleResize(),this.update()}function yp(e,t){var n,i,r,a,o;this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new Dt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!0,this.enableZoom=!0,this.zoomSpeed=5,this.zoomSpeedTouch=1,this.zoomInertia=.05,this.zoomInertiaTouch=.05,this.enableRotate=!0,this.rotateSpeed=1.2,this.rotateSpeedTouch=.7,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enablePan=!0,this.panSpeed=1.3,this.panSpeedKey=30,this.panInertia=.05,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.mouseButtons={ROTATE:v3d.MOUSE.LEFT,ZOOM:v3d.MOUSE.MIDDLE,PAN:v3d.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return f.phi},this.getAzimuthalAngle=function(){return f.theta},this.saveState=function(){s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=function(){s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(l),s.update(),d=h.NONE},this.update=(n=new Dt,i=(new It).setFromUnitVectors(e.up,new Dt(0,1,0)),r=i.clone().inverse(),a=new Dt,o=new It,function(){var e,t,c,u=s.object.position;if(this.inTween){var x=G.getElapsedTime()/V;x=Ft.smootherstep(x,0,1),u.lerpVectors(U,k,x),s.target.lerpVectors(B,z,x),s.object.lookAt(s.target),x>=1&&(this.inTween=!1,m.set(0,0,0),g.set(0,0,0),v=1,L.set(0,0),w.set(0,0))}else n.copy(u).sub(s.target),n.applyQuaternion(i),f.setFromVector3(n),s.autoRotate&&d===h.NONE&&X(2*Math.PI/60/60*s.autoRotateSpeed),f.theta+=m.theta,f.phi+=m.phi,f.theta=Math.max(s.minAzimuthAngle,Math.min(s.maxAzimuthAngle,f.theta)),f.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,f.phi)),f.makeSafe(),s.object.isPerspectiveCamera?(f.radius*=v,f.radius=Math.max(s.minDistance,Math.min(s.maxDistance,f.radius))):s.object.isOrthographicCamera&&(s.object.zoom/=v,s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom)),s.object.updateProjectionMatrix()),s.target.add(g),n.setFromSpherical(f),n.applyQuaternion(r),u.copy(s.target).add(n),s.object.lookAt(s.target),m.set(0,0,0),g.set(0,0,0),e=O.getDelta(),b.copy(w),w.x=s.enableDamping?Ft.expAverage(w.x,0,e,M):0,w.y=s.enableDamping?Ft.expAverage(w.y,0,e,M):0,b.sub(w),t=s.domElement===document?s.domElement.body:s.domElement,X(2*Math.PI*b.x/t.clientWidth*A),c=2*Math.PI*b.y/t.clientHeight*A,m.phi-=c,E.copy(L),L.x=s.enableDamping?Ft.expAverage(L.x,0,e,s.panInertia):0,L.y=s.enableDamping?Ft.expAverage(L.y,0,e,s.panInertia):0,E.sub(L),K(E.x,E.y),v=N,N=s.enableDamping?Ft.expAverage(N,1,e,D):1,v/=N;return!!(y||a.distanceToSquared(s.object.position)>p||8*(1-o.dot(s.object.quaternion))>p)&&(s.dispatchEvent(l),a.copy(s.object.position),o.copy(s.object.quaternion),y=!1,!0)}),this.dispose=function(){s.domElement.removeEventListener("contextmenu",ce,!1),s.domElement.removeEventListener("mousedown",te,!1),s.domElement.removeEventListener("wheel",re,!1),s.domElement.removeEventListener("touchstart",oe,!1),s.domElement.removeEventListener("touchend",le,!1),s.domElement.removeEventListener("touchmove",se,!1),document.removeEventListener("mousemove",ne,!1),document.removeEventListener("mouseup",ie,!1),window.removeEventListener("keydown",ae,!1)},this.tween=function(e,t,n){e.distanceToManhattan(s.object.position)<1e-5&&t.distanceToManhattan(s.target)<1e-5||(s.inTween=!0,U.copy(s.object.position),B.copy(s.target),k.copy(e),z.copy(t),V=n,G.start())};var s=this,l={type:"change"},c={type:"start"},u={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},d=h.NONE,p=1e-6,f=new Bd,m=new Bd,v=1,g=new Dt,y=!1,x=new Rt,_=new Rt,b=new Rt,w=new Rt,A=1,M=1,T=new Rt,S=new Rt,E=new Rt,L=new Rt,C=1,P=new Rt,F=new Rt,R=new Rt,N=1,I=1,D=1,O=new Ud,U=new Dt,B=new Dt,k=new Dt,z=new Dt,V=0,G=new Ud;function j(){return Math.pow(.95,I)}function X(e){m.theta-=e}function W(e,t){_.set(e,t),w.add(_).sub(x),x.copy(_)}function H(e,t){S.set(e,t),L.add(S).sub(T),T.copy(S)}var Y,q,Q,Z=(Y=new Dt,function(e,t){Y.setFromMatrixColumn(t,0),Y.multiplyScalar(-e),g.add(Y)}),J=(q=new Dt,function(e,t){q.setFromMatrixColumn(t,1),q.multiplyScalar(e),g.add(q)}),K=(Q=new Dt,function(e,t){var n=s.domElement===document?s.domElement.body:s.domElement;if(s.object instanceof v3d.PerspectiveCamera){var i=s.object.position;Q.copy(i).sub(s.target);var r=Q.length();r*=Math.tan(s.object.fov/2*Ft.DEG2RAD),Z(2*e*C*r/n.clientHeight,s.object.matrix),J(2*t*C*r/n.clientHeight,s.object.matrix)}else s.object instanceof v3d.OrthographicCamera?(Z(e*C*(s.object.right-s.object.left)/s.object.zoom/n.clientWidth,s.object.matrix),J(t*C*(s.object.top-s.object.bottom)/s.object.zoom/n.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)});function $(e){s.object instanceof v3d.PerspectiveCamera?N/=e:s.object instanceof v3d.OrthographicCamera?(N/=e,y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function ee(e){s.object instanceof v3d.PerspectiveCamera?N*=e:s.object instanceof v3d.OrthographicCamera?(N*=e,y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function te(e){if(!1!==s.enabled){switch(e.preventDefault(),e.button){case s.mouseButtons.ROTATE:if(!1===s.enableRotate)return;n=e,x.set(n.clientX,n.clientY),d=h.ROTATE;break;case s.mouseButtons.ZOOM:case s.mouseButtons.PAN:if(!1===s.enablePan)return;t=e,T.set(t.clientX,t.clientY),d=h.PAN}var t,n;d!==h.NONE&&(document.addEventListener("mousemove",ne,!1),document.addEventListener("mouseup",ie,!1),s.dispatchEvent(c))}}function ne(e){var t,n,i;if(!1!==s.enabled)switch(e.preventDefault(),d){case h.ROTATE:if(!1===s.enableRotate)return;W((i=e).clientX,i.clientY),A=s.rotateSpeed,M=s.rotateInertia;break;case h.DOLLY:if(!1===s.enableZoom)return;n=e,F.set(n.clientX,n.clientY),R.subVectors(F,P),R.y>0?$(j()):R.y<0&&ee(j()),P.copy(F),s.update();break;case h.PAN:if(!1===s.enablePan)return;H((t=e).clientX,t.clientY),C=s.panSpeed}}function ie(e){!1!==s.enabled&&(document.removeEventListener("mousemove",ne,!1),document.removeEventListener("mouseup",ie,!1),s.dispatchEvent(u),d=h.NONE)}function re(e){var t;!1===s.enabled||!1===s.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),t=e,I=s.zoomSpeed,D=s.zoomInertia,t.deltaY<0?ee(j()):t.deltaY>0&&$(j()),s.update(),s.dispatchEvent(c),s.dispatchEvent(u))}function ae(e){s.enabled&&s.enableKeys&&s.enablePan&&function(e){switch(e.keyCode){case vp.W:case vp.UP_ARROW:L.y+=1,C=s.panSpeedKey;break;case vp.S:case vp.DOWN_ARROW:L.y-=1,C=s.panSpeedKey;break;case vp.A:case vp.LEFT_ARROW:L.x+=1,C=s.panSpeedKey;break;case vp.D:case vp.RIGHT_ARROW:L.x-=1,C=s.panSpeedKey}}(e)}function oe(e){if(!1!==s.enabled){switch(e.touches.length){case 1:if(!1===s.enableRotate)return;n=e,x.set(n.touches[0].pageX,n.touches[0].pageY),d=h.TOUCH_ROTATE;break;case 2:if(!1===s.enableZoom)return;!function(e){I=s.zoomSpeedTouch,D=s.zoomInertiaTouch;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);P.set(0,i)}(e),d=h.TOUCH_DOLLY;break;case 3:if(!1===s.enablePan)return;t=e,T.set(t.touches[0].pageX,t.touches[0].pageY),d=h.TOUCH_PAN;break;default:d=h.NONE}var t,n;d!==h.NONE&&s.dispatchEvent(c)}}function se(e){var t,n,i,r,a,o;if(!1!==s.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(!1===s.enableRotate)return;if(d!==h.TOUCH_ROTATE)return;W((o=e).touches[0].pageX,o.touches[0].pageY),A=s.rotateSpeedTouch,M=s.rotateInertiaTouch;break;case 2:if(!1===s.enableZoom)return;if(d!==h.TOUCH_DOLLY)return;i=(n=e).touches[0].pageX-n.touches[1].pageX,r=n.touches[0].pageY-n.touches[1].pageY,a=Math.sqrt(i*i+r*r),F.set(0,a),R.subVectors(F,P),R.y>0?ee(j()):R.y<0&&$(j()),P.copy(F),s.update();break;case 3:if(!1===s.enablePan)return;if(d!==h.TOUCH_PAN)return;H((t=e).touches[0].pageX,t.touches[0].pageY),C=s.panSpeed;break;default:d=h.NONE}}function le(e){!1!==s.enabled&&(s.dispatchEvent(u),d=h.NONE)}function ce(e){!1!==s.enabled&&e.preventDefault()}s.domElement.addEventListener("contextmenu",ce,!1),s.domElement.addEventListener("mousedown",te,!1),s.domElement.addEventListener("wheel",re,!1),s.domElement.addEventListener("touchstart",oe,!1),s.domElement.addEventListener("touchend",le,!1),s.domElement.addEventListener("touchmove",se,!1),window.addEventListener("keydown",ae,!1),this.update()}function xp(e,t,n){this.sourceTexture=e,this.resolution=void 0!==n?n:256,this.samplesPerLevel=void 0!==t?t:16;var i=e.encoding===v3d.LinearEncoding||e.encoding===v3d.GammaEncoding||e.encoding===v3d.sRGBEncoding;this.sourceTexture.minFilter=i?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.magFilter=i?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.generateMipmaps=this.sourceTexture.generateMipmaps&&i,this.cubeLods=[];var r=this.resolution,a={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.numLods=Math.log(r)/Math.log(2)-2;for(var o=0;o16&&(l*=2);for(var h=t>16?6:1,d=0,p=0,f=t,m=0;m16&&(t/=2)}}function bp(e,t,n){(this.container=document.getElementById(e),Cd.checkWebGL())?(this.scene=null,this.camera=null,this.clock=new Ud,this.mixer=null,this.renderCallbacks=[],this.elapsed=0,this.preloader=n,t=t||{},this.renderer=new lo({alpha:t.alpha,depth:t.depth,stencil:t.stencil,antialias:void 0===t.antialias||t.antialias,premultipliedAlpha:t.premultipliedAlpha,preserveDrawingBuffer:t.preserveDrawingBuffer}),this.renderer.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(this.renderer.domElement),this.renderer.domElement.style.position="absolute",this.loader=new rh,"0000000000"==Ct.replace("__V3DL__","")&&fp.drawWatermark(this.container,"VERGE3D TRIAL - USE IN PRODUCTION PROHIBITED")):Cd.showWebGLErrorMessage(this.container)}Object.assign(gp.prototype,t.prototype),yp.prototype=Object.create(t.prototype),yp.prototype.constructor=yp,Object.defineProperties(yp.prototype,{center:{get:function(){return console.warn("v3d.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}}}),xp.prototype={constructor:xp,update:function(e){this.shader.uniforms.envMap.value=this.sourceTexture,this.shader.envMap=this.sourceTexture;var t=e.gammaInput,n=e.gammaOutput,i=e.toneMapping,r=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=v3d.LinearToneMapping,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1;for(var o=0;o\n varying vec2 vUv;\n uniform int faceIndex;\n uniform float roughness;\n uniform samplerCube envMap;\n uniform float mapSize;\n uniform vec3 testColor;\n uniform vec3 queryScale;\n \n float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n float a = ggxRoughness + 0.0001;\n a *= a;\n return (2.0 / a - 2.0);\n }\n vec3 ImportanceSamplePhong(vec2 uv, mat3 vecSpace, float specPow) {\n float phi = uv.y * 2.0 * PI;\n float cosTheta = pow(1.0 - uv.x, 1.0 / (specPow + 1.0));\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n vec3 sampleDir = vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);\n return vecSpace * sampleDir;\n }\n vec3 ImportanceSampleGGX(vec2 uv, mat3 vecSpace, float Roughness)\n {\n float a = Roughness * Roughness;\n float Phi = 2.0 * PI * uv.x;\n float CosTheta = sqrt((1.0 - uv.y) / (1.0 + (a*a - 1.0) * uv.y));\n float SinTheta = sqrt(1.0 - CosTheta * CosTheta);\n return vecSpace * vec3(SinTheta * cos(Phi), SinTheta * sin(Phi), CosTheta);\n }\n mat3 matrixFromVector(vec3 n) {\n float a = 1.0 / (1.0 + n.z);\n float b = -n.x * n.y * a;\n vec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n vec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n return mat3(b1, b2, n);\n }\n \n vec4 testColorMap(float Roughness) {\n vec4 color;\n if(faceIndex == 0)\n color = vec4(1.0,0.0,0.0,1.0);\n else if(faceIndex == 1)\n color = vec4(0.0,1.0,0.0,1.0);\n else if(faceIndex == 2)\n color = vec4(0.0,0.0,1.0,1.0);\n else if(faceIndex == 3)\n color = vec4(1.0,1.0,0.0,1.0);\n else if(faceIndex == 4)\n color = vec4(0.0,1.0,1.0,1.0);\n else\n color = vec4(1.0,0.0,1.0,1.0);\n color *= (1.0 - Roughness);\n return color;\n }\n void main() {\n vec3 sampleDirection;\n vec2 uv = vUv*2.0 - 1.0;\n float offset = -1.0/mapSize;\n const float a = -1.0;\n const float b = 1.0;\n float c = -1.0 + offset;\n float d = 1.0 - offset;\n float bminusa = b - a;\n uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n if (faceIndex==0) {\n sampleDirection = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n sampleDirection = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n sampleDirection = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n sampleDirection = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n sampleDirection = vec3(uv.x, -uv.y, 1.0);\n } else {\n sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n }\n mat3 vecSpace = matrixFromVector(normalize(sampleDirection * queryScale));\n vec3 rgbColor = vec3(0.0);\n const int NumSamples = SAMPLES_PER_LEVEL;\n vec3 vect;\n float weight = 0.0;\n for(int i = 0; i < NumSamples; i++) {\n float sini = sin(float(i));\n float cosi = cos(float(i));\n float r = rand(vec2(sini, cosi));\n vect = ImportanceSampleGGX(vec2(float(i) / float(NumSamples), r), vecSpace, roughness);\n float dotProd = dot(vect, normalize(sampleDirection));\n weight += dotProd;\n vec3 color = envMapTexelToLinear(textureCube(envMap,vect)).rgb;\n rgbColor.rgb += color;\n }\n rgbColor /= float(NumSamples);\n //rgbColor = testColorMap(roughness).rgb;\n gl_FragColor = linearToOutputTexel(vec4(rgbColor, 1.0));\n }",blending:v3d.CustomBlending,premultipliedAlpha:!1,blendSrc:v3d.OneFactor,blendDst:v3d.ZeroFactor,blendSrcAlpha:v3d.OneFactor,blendDstAlpha:v3d.ZeroFactor,blendEquation:v3d.AddEquation});return e.type="PMREMGenerator",e},dispose:function(){for(var e=0,t=this.cubeLods.length;e10&&e<100?.001:1e-4),maxblur:1,width:this.getWidth(),height:this.getHeight()});n.addPass(s),this.postprocessing.bokehPass=s;break;default:console.error("v3d.App: wrong postprocessing effect")}}var l=new go(this.scene,this.camera);l.renderToScreen=!0,n.addPass(l),this.postprocessing.fxaaPass=l}else this.postprocessing=null},initPMREM:function(){if(!Cd.checkIOS()){var e=this;e.scene.traverse(function(t){if(t.isMesh&&t.material&&(t.material.isMeshStandardMaterial||t.material.isMeshPhysicalMaterial||t.material.isMeshNodeMaterial)&&t.material.envMap){var n=t.material.envMap;if("PMREMCubeUVPacker.cubeUv"==n.name)return;var i=new mp(n);i.invertU=!0,i.offsetU=.5,i.update(e.renderer);var r=new xp(i.renderTarget.texture);r.update(e.renderer);var a=new _p(r.cubeLods);a.update(e.renderer);var o=a.CubeUVRenderTarget;t.material.envMap=o.texture,t.material.needsUpdate=!0}})}}});var wp="SceneLoadError",Ap="LogicLoadError",Mp="EditorLoadError";function Tp(e,t,n){bp.call(this,e,t,n),this._editorJSFile="puzzles.min.js",this._editorCSSFile="puzzles.css",this._editorMediaDir="media/",this._libraryXML="library.xml",this.ExternalInterface={}}Tp.prototype=Object.assign(Object.create(bp.prototype),{constructor:Tp,onSceneLoad:function(){},onEditorLoad:function(){},onLogicLoad:function(){},onLoadFinished:function(e,t,n){e&&this.run()},onError:function(e){console.error(e)},run:function(){this.enableControls(),bp.prototype.run.call(this),v3d.PL&&v3d.PL.init(this)},_createSceneLoadError:function(e){var t=new Error(e);return t.name=wp,t},_createLogicLoadError:function(e){var t=new Error(e);return t.name=Ap,t},_createEditorLoadError:function(e){var t=new Error(e);return t.name=Mp,t},_getScenePromise:function(e){var t=this;return new Promise(function(n,i){bp.prototype.load.call(t,e,function(){n()},function(){i(t._createSceneLoadError("Unable to load the scene file: '"+e+"'."))},!1)})},_getLogicPromise:function(e){var t=this;return new Promise(function(n,i){fp.loadScript(e,document.body,function(){n()},function(){i(t._createLogicLoadError("Unable to load the logic file: '"+e+"'."))})})},_getEditorPromise:function(e,t){var n=this;return new Promise(function(i,r){var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=t,document.head.appendChild(a),fp.loadScript(e,document.body,function(){i()},function(){r(n._createEditorLoadError("Unable to load the Puzzles Editor: '"+e+"'."))})})},_getLogicViaEditorPromise:function(e,t,n){var i=this;return new Promise(function(r,a){var o=e.match(/(.*)\.js$/);if(o)if(v3d.PE){var s=o[1]+".xml";v3d.PE.init(t,function(e){e?r():a(i._createLogicLoadError("Unable to load The Puzzles Editor's XML logic file: '"+s+"'."))},i,s,n)}else a(i._createLogicLoadError("Unable to load Puzzles' logic. The Puzzles Editor isn't loaded."));else a(i._createLogicLoadError("Unable to load Puzzles' logic. The provided file should be of type JS: '"+e+"'."))})},loadScene:function(e){var t=this;t._getScenePromise(e).then(function(){t.onSceneLoad(),t.onLoadFinished(!0,!1,!1)}).catch(function(e){switch(t.onError(e),e.name){case wp:t.onLoadFinished(!1,!1,!1)}})},loadSceneWithLogic:function(e,t){var n=this;n._getScenePromise(e).then(function(){return n.onSceneLoad(),n._getLogicPromise(t)}).then(function(){n.onLogicLoad(),n.onLoadFinished(!0,!0,!1)}).catch(function(e){switch(n.onError(e),e.name){case wp:n.onLoadFinished(!1,!1,!1);break;case Ap:n.onLoadFinished(!0,!1,!1)}})},loadSceneWithEditor:function(e,t,n){var i=this,r=n+i._editorJSFile,a=n+i._editorCSSFile,o=n+i._editorMediaDir,s=n+i._libraryXML;i._getScenePromise(e).then(function(){return i.onSceneLoad(),i._getEditorPromise(r,a)}).then(function(){return i.onEditorLoad(),i._getLogicViaEditorPromise(t,o,s)}).then(function(){i.onLogicLoad(),i.onLoadFinished(!0,!0,!0)}).catch(function(e){switch(i.onError(e),e.name){case wp:i.onLoadFinished(!1,!1,!1);break;case Mp:i.onLoadFinished(!0,!1,!1);break;case Ap:i.onLoadFinished(!0,!1,!0)}})}});var Sp="data:image/png;base64,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";function Ep(){}function Lp(e){for(var t in Ep.call(this),this.backgroundColor=new Nn(16777215),this.textColor=new Nn(24242),this.imageRotationSpeed=200,this.imageURL=Sp,e){var n=e[t];switch(t){case"container":void 0===n?this.container=document.body:n instanceof HTMLElement?this.container=n:this.container=document.getElementById(n);break;case"textColor":this.textColor=n;break;case"backgroundColor":this.backgroundColor=n;break;case"imageURL":this.imageURL=n;break;case"imageRotationSpeed":this.imageRotationSpeed=n}}var i=["background-color: "+this.backgroundColor.getStyle()+";","position: fixed;","z-index: 1;","height: 100%;","width: 100%;"].join("\n"),r=["position: fixed;","top: 50%;","left: 50%;","margin-top: -75px;","margin-left: -75px;","width: 150px;","height: 150px;"].join("\n"),a=["width: 150px;","height: 150px;",'background-image: url("'+this.imageURL+'");',"background-repeat: no-repeat;","background-size: 150px;"].join("\n"),o=["color: "+this.textColor.getStyle()+";","text-align: center;","position: absolute;","top: 50%;","left: 50%;","margin-top: -18px;","margin-left: -43px;","min-width: 90px;","font-size: 30px;","font-family: sans-serif;","font-weight: bold;"].join("\n");this.text=document.createElement("div"),this.text.setAttribute("style",o),this.text.innerHTML="0%",this.gear=document.createElement("div"),this.gear.setAttribute("style",a),this.gearCont=document.createElement("div"),this.gearCont.setAttribute("style",r),this.background=document.createElement("div"),this.background.setAttribute("style",i),this.background.appendChild(this.gearCont),this.gearCont.appendChild(this.gear),this.gearCont.appendChild(this.text),this.container.appendChild(this.background),this.clock=new Ud;var s=this,l=function(){s.imageRotationSpeed>0&&requestAnimationFrame(l);var e=s.clock.getElapsedTime()*s.imageRotationSpeed;s.gear.style.transform="rotate("+e+"deg)"};l()}Object.assign(Ep.prototype,{onUpdate:function(e){},onFinish:function(){}}),Lp.prototype=Object.assign(Object.create(Ep.prototype),{constructor:Lp,onUpdate:function(e){e=Math.round(e),this.text.innerHTML=e+"%"},onFinish:function(){this.container.removeChild(this.background),this.imageRotationSpeed=0}});var Cp;function Pp(e){console.warn("v3d.ClosedSplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),lp.call(this,e),this.type="catmullrom",this.closed=!0}function Fp(e){console.warn("v3d.SplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),lp.call(this,e),this.type="catmullrom"}function Rp(e){console.warn("v3d.Spline has been removed. Use v3d.CatmullRomCurve3 instead."),lp.call(this,e),this.type="catmullrom"}Bu.create=function(e,t){return console.log("v3d.Curve.create() has been deprecated"),e.prototype=Object.create(Bu.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Pp.prototype=Object.create(lp.prototype),Fp.prototype=Object.create(lp.prototype),Rp.prototype=Object.create(lp.prototype),Object.assign(Rp.prototype,{initFromArray:function(){console.error("v3d.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("v3d.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("v3d.Spline: .reparametrizeByArcLength() has been removed.")}}),Yd.prototype.setColors=function(){console.error("v3d.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},jd.prototype.update=function(){console.error("v3d.SkeletonHelper: update() no longer needs to be called.")},Object.assign(zn.prototype,{center:function(e){return console.warn("v3d.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("v3d.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(di.prototype,{center:function(e){return console.warn("v3d.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("v3d.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("v3d.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),$r.prototype.center=function(e){return console.warn("v3d.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Ft,{random16:function(){return console.warn("v3d.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("v3d.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Ft.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("v3d.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Ft.ceilPowerOfTwo(e)}}),Object.assign(Ot.prototype,{flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("v3d.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3(matrix) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("v3d.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Nt.prototype,{extractPosition:function(e){return console.warn("v3d.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===Cp&&(Cp=new Dt),console.warn("v3d.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition(matrix) instead."),Cp.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("v3d.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("v3d.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("v3d.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("v3d.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("v3d.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("v3d.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection(matrix) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("v3d.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},translate:function(){console.error("v3d.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("v3d.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("v3d.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("v3d.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("v3d.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("v3d.Matrix4: .makeFrustum() has been removed. Use .makePerspective(left, right, top, bottom, near, far) instead."),this.makePerspective(e,t,i,n,r,a)}}),fi.prototype.isIntersectionLine=function(e){return console.warn("v3d.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},It.prototype.multiplyVector3=function(e){return console.warn("v3d.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion(quaternion) instead."),e.applyQuaternion(this)},Object.assign(Kr.prototype,{isIntersectionBox:function(e){return console.warn("v3d.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("v3d.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("v3d.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Yu.prototype,{extrude:function(e){return console.warn("v3d.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new As(this,e)},makeGeometry:function(e){return console.warn("v3d.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ns(this,e)}}),Object.assign(Rt.prototype,{fromAttribute:function(e,t,n){return console.error("v3d.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)}}),Object.assign(Dt.prototype,{setEulerFromRotationMatrix:function(){console.error("v3d.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("v3d.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("v3d.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("v3d.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("v3d.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("v3d.Vector3: .applyProjection() has been removed. Use .applyMatrix4(m) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.error("v3d.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)}}),Object.assign(Vt.prototype,{fromAttribute:function(e,t,n){return console.error("v3d.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)}}),Nr.prototype.computeTangents=function(){console.warn("v3d.Geometry: .computeTangents() has been removed.")},Object.assign(Gi.prototype,{getChildByName:function(e){return console.warn("v3d.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("v3d.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("v3d.Object3D: .translate() has been removed. Use .translateOnAxis(axis, distance) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(Gi.prototype,{eulerOrder:{get:function(){return console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Fo.prototype,{objects:{get:function(){return console.warn("v3d.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ro.prototype,"useVertexTexture",{get:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Bu.prototype,"__arcLengthDivisions",{get:function(){return console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),ao.prototype.setLens=function(e,t){console.warn("v3d.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Rl.prototype,{onlyShadow:{set:function(){console.warn("v3d.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("v3d.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("v3d.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("v3d.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("v3d.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("v3d.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("v3d.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("v3d.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("v3d.Light: .shadowCameraVisible has been removed. Use new v3d.CameraHelper(light.shadow.camera) instead.")}},shadowBias:{set:function(e){console.warn("v3d.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("v3d.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("v3d.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("v3d.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Ir.prototype,{length:{get:function(){return console.warn("v3d.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Wr.prototype,{addIndex:function(e){console.warn("v3d.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){void 0!==n&&console.warn("v3d.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("v3d.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("v3d.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("v3d.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("v3d.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Wr.prototype,{drawcalls:{get:function(){return console.error("v3d.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("v3d.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Pd.prototype,{dynamic:{set:function(){console.warn("v3d.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("v3d.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(ci.prototype,{wrapAround:{get:function(){console.warn("v3d.Material: .wrapAround has been removed.")},set:function(){console.warn("v3d.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("v3d.Material: .wrapRGB has been removed."),new Nn}},shading:{get:function(){console.error("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(ul.prototype,{metal:{get:function(){return console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead."),!1},set:function(){console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead")}}}),Object.defineProperties(Jr.prototype,{derivatives:{get:function(){return console.warn("v3d.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("v3d. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(lo.prototype,{getCurrentRenderTarget:function(){return console.warn("v3d.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("v3d.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("v3d.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("v3d.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsFloatTextures() is now .extensions.get('OES_texture_float')."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get('OES_texture_half_float')."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("v3d.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get('OES_standard_derivatives')."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get('WEBGL_compressed_texture_s3tc')."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get('WEBGL_compressed_texture_pvrtc')."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("v3d.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get('EXT_blend_minmax')."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("v3d.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get('ANGLE_instanced_arrays')."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("v3d.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("v3d.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("v3d.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("v3d.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("v3d.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(lo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(vi.prototype,{cullFace:{get:function(){return this.renderReverseSided?T:M},set:function(e){var t=e!==M;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(Gt.prototype,{wrapS:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),ed.prototype.load=function(e){console.warn("v3d.Audio: .load has been deprecated. Use v3d.AudioLoader instead.");var t=this;return(new Zh).load(e,function(e){t.setBuffer(e)}),this},nd.prototype.getData=function(){return console.warn("v3d.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Kh.prototype.updateCubeMap=function(e,t){return console.warn("v3d.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var Np={merge:function(e,t,n){var i;console.warn("v3d.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge(geometry2, matrix, materialIndexOffset) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("v3d.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},Ip={crossOrigin:void 0,loadTexture:function(e,t,n,i){console.warn("v3d.ImageUtils.loadTexture has been deprecated. Use v3d.TextureLoader() instead.");var r=new Fl;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,n,i){console.warn("v3d.ImageUtils.loadTextureCube has been deprecated. Use v3d.CubeTextureLoader() instead.");var r=new Pl;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},loadCompressedTexture:function(){console.error("v3d.ImageUtils.loadCompressedTexture has been removed. Use v3d.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("v3d.ImageUtils.loadCompressedTextureCube has been removed. Use v3d.DDSLoader instead.")}};window.THREE=v3d,e.WebGLRenderTargetCube=jt,e.WebGLRenderTarget=Gt,e.WebGLRenderer=lo,e.BokehPass=ho,e.EffectComposer=vo,e.FXAAPass=go,e.GrayscalePass=yo,e.MaskPass=po,e.OutlinePass=_o,e.Pass=co,e.RenderPass=bo,e.ShaderPass=mo,e.SSAOPass=wo,e.ShaderLib=kn,e.UniformsLib=On,e.UniformsUtils=Un,e.ShaderChunk=Bn,e.FogExp2=Ao,e.Fog=Mo,e.Scene=uo,e.SceneBackground=To,e.Annotation=Eo,e.AnnotationControl=So,e.LensFlare=Lo,e.Sprite=Po,e.LOD=Fo,e.SkinnedMesh=Io,e.Skeleton=Ro,e.Bone=No,e.Mesh=ta,e.LineSegments=Uo,e.LineLoop=Bo,e.Line=Oo,e.Points=zo,e.Group=Vo,e.VideoTexture=Go,e.DataTexture=Xt,e.CompressedTexture=jo,e.CubeTexture=Wt,e.CanvasTexture=Gn,e.DepthTexture=Xo,e.Texture=zt,e.BlenderCubeTextureLoader=Sl,e.CompressedTextureLoader=Ll,e.DataTextureLoader=Cl,e.CubeTextureLoader=Pl,e.TextureLoader=Fl,e.ObjectLoader=dc,e.MaterialLoader=nc,e.BufferGeometryLoader=ic,e.DefaultLoadingManager=_l,e.LoadingManager=xl,e.JSONLoader=hc,e.GLTFLoader=rh,e.ImageLoader=bl,e.FontLoader=Nh,e.FileLoader=El,e.XZLoader=Ru,e.Loader=uc,e.Cache=yl,e.AudioLoader=Zh,e.SpotLightShadow=Dl,e.SpotLight=Ol,e.PointLight=Ul,e.RectAreaLight=Vl,e.HemisphereLight=Nl,e.DirectionalLightShadow=Bl,e.DirectionalLight=kl,e.AmbientLight=zl,e.LightShadow=Il,e.Light=Rl,e.StereoCamera=Jh,e.PerspectiveCamera=ao,e.OrthographicCamera=Xi,e.CubeCamera=Kh,e.ArrayCamera=oo,e.Camera=ji,e.AudioListener=$h,e.PositionalAudio=td,e.AudioContext=Qh,e.AudioAnalyser=nd,e.Audio=ed,e.VectorKeyframeTrack=Yl,e.StringKeyframeTrack=Jl,e.QuaternionKeyframeTrack=Ql,e.NumberKeyframeTrack=Zl,e.ColorKeyframeTrack=$l,e.BooleanKeyframeTrack=Kl,e.PropertyMixer=id,e.PropertyBinding=xc,e.KeyframeTrack=ec,e.AnimationUtils=jl,e.AnimationObjectGroup=rd,e.AnimationMixer=od,e.AnimationClip=tc,e.Detector=Cd,e.Uniform=Pd,e.InstancedBufferGeometry=Fd,e.BufferGeometry=Wr,e.GeometryIdCount=Rr,e.Geometry=Nr,e.InterleavedBufferAttribute=Iu,e.InstancedInterleavedBuffer=Rd,e.InterleavedBuffer=Nu,e.InstancedBufferAttribute=Nd,e.Face3=Wi,e.Object3D=Gi,e.Raycaster=Id,e.Layers=xi,e.EventDispatcher=t,e.Clock=Ud,e.XZ=Cu,e.QuaternionLinearInterpolant=ql,e.LinearInterpolant=qs,e.DiscreteInterpolant=Wl,e.CubicInterpolant=Xl,e.Interpolant=Ys,e.Triangle=ea,e.Math=Ft,e.Spherical=Bd,e.Cylindrical=kd,e.Plane=fi,e.Frustum=mi,e.Sphere=pi,e.Ray=Kr,e.Matrix4=Nt,e.Matrix3=Ot,e.Box3=di,e.Box2=zn,e.Line3=$r,e.Euler=yi,e.Vector4=Vt,e.Vector3=Dt,e.Vector2=Rt,e.Quaternion=It,e.Color=Nn,e.ImmediateRenderObject=zd,e.MeshLine=Ju,e.MeshLineIndexed=th,e.MeshLineMaterial=nh,e.VertexNormalsHelper=Vd,e.SpotLightHelper=Gd,e.SkeletonHelper=jd,e.PointLightHelper=Xd,e.RectAreaLightHelper=Wd,e.HemisphereLightHelper=Hd,e.GridHelper=Yd,e.PolarGridHelper=qd,e.FaceNormalsHelper=Qd,e.DirectionalLightHelper=Zd,e.CameraHelper=Jd,e.BoxHelper=Kd,e.Box3Helper=$d,e.PlaneHelper=ep,e.ArrowHelper=tp,e.AxisHelper=np,e.CatmullRomCurve3=lp,e.CubicBezierCurve3=cp,e.QuadraticBezierCurve3=up,e.LineCurve3=hp,e.ArcCurve=dp,e.EllipseCurve=Vu,e.SplineCurve=Gu,e.CubicBezierCurve=ju,e.QuadraticBezierCurve=Xu,e.LineCurve=ku,e.Shape=Yu,e.Path=Hu,e.ShapePath=qu,e.Font=Qu,e.CurvePath=zu,e.Curve=Bu,e.ShapeUtils=ws,e.SceneUtils=pp,e.App=bp,e.AppPuzzles=Tp,e.AppUtils=fp,e.FlyingControls=gp,e.OrbitControls=yp,e.Keys=vp,e.Preloader=Ep,e.SimplePreloader=Lp,e.EquiCube=mp,e.PMREMCubeUVPacker=_p,e.PMREMGenerator=xp,e.GraphUtils=Hs,e.WebGLUtils=so,e.ChildOfConstraint=Yo,e.Constraint=Wo,e.CopyLocationConstraint=qo,e.CopyRotationConstraint=Qo,e.CopyScaleConstraint=Zo,e.FloorConstraint=Jo,e.LimitLocationConstraint=Ko,e.LimitRotationConstraint=$o,e.LimitScaleConstraint=es,e.LockedTrackConstraint=ts,e.TargetConstraint=Ho,e.TrackToConstraint=ns,e.WireframeGeometry=is,e.ParametricGeometry=rs,e.ParametricBufferGeometry=as,e.TetrahedronGeometry=ls,e.TetrahedronBufferGeometry=cs,e.OctahedronGeometry=us,e.OctahedronBufferGeometry=hs,e.IcosahedronGeometry=ds,e.IcosahedronBufferGeometry=ps,e.DodecahedronGeometry=fs,e.DodecahedronBufferGeometry=ms,e.PolyhedronGeometry=os,e.PolyhedronBufferGeometry=ss,e.TubeGeometry=vs,e.TubeBufferGeometry=gs,e.TorusKnotGeometry=ys,e.TorusKnotBufferGeometry=xs,e.TorusGeometry=_s,e.TorusBufferGeometry=bs,e.TextGeometry=Ts,e.TextBufferGeometry=Ss,e.SphereGeometry=Es,e.SphereBufferGeometry=Ls,e.RingGeometry=Cs,e.RingBufferGeometry=Ps,e.PlaneGeometry=qr,e.PlaneBufferGeometry=Qr,e.LatheGeometry=Fs,e.LatheBufferGeometry=Rs,e.ShapeGeometry=Ns,e.ShapeBufferGeometry=Is,e.ExtrudeGeometry=As,e.ExtrudeBufferGeometry=Ms,e.EdgesGeometry=Ds,e.ConeGeometry=Bs,e.ConeBufferGeometry=ks,e.CylinderGeometry=Os,e.CylinderBufferGeometry=Us,e.CircleGeometry=zs,e.CircleBufferGeometry=Vs,e.BoxGeometry=Hr,e.BoxBufferGeometry=Yr,e.ShadowMaterial=js,e.SpriteMaterial=Co,e.RawShaderMaterial=Xs,e.ShaderMaterial=Jr,e.PointsMaterial=ko,e.MeshBasicMaterial=Zr,e.MeshBlenderMaterial=Ws,e.MeshNodeMaterial=ll,e.MeshPhongMaterial=ul,e.MeshPhysicalMaterial=dl,e.MeshStandardMaterial=hl,e.MeshToonMaterial=pl,e.MeshNormalMaterial=fl,e.MeshLambertMaterial=ml,e.MeshDepthMaterial=ui,e.MeshDistanceMaterial=hi,e.MeshMaskMaterial=xo,e.LineDashedMaterial=vl,e.LineBasicMaterial=Do,e.Material=ci,e.Float64BufferAttribute=jr,e.Float32BufferAttribute=Gr,e.Uint32BufferAttribute=Vr,e.Int32BufferAttribute=zr,e.Uint16BufferAttribute=kr,e.Int16BufferAttribute=Br,e.Uint8ClampedBufferAttribute=Ur,e.Uint8BufferAttribute=Or,e.Int8BufferAttribute=Dr,e.BufferAttribute=Ir,e.REVISION=w,e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=A,e.CullFaceBack=M,e.CullFaceFront=T,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=S,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=E,e.PCFSoftShadowMap=L,e.FrontSide=C,e.BackSide=P,e.DoubleSide=F,e.FlatShading=1,e.SmoothShading=2,e.NoColors=R,e.FaceColors=N,e.VertexColors=I,e.NoBlending=D,e.NormalBlending=O,e.AdditiveBlending=U,e.SubtractiveBlending=B,e.MultiplyBlending=k,e.CustomBlending=z,e.AddEquation=V,e.SubtractEquation=G,e.ReverseSubtractEquation=j,e.MinEquation=X,e.MaxEquation=W,e.ZeroFactor=H,e.OneFactor=Y,e.SrcColorFactor=q,e.OneMinusSrcColorFactor=Q,e.SrcAlphaFactor=Z,e.OneMinusSrcAlphaFactor=J,e.DstAlphaFactor=K,e.OneMinusDstAlphaFactor=$,e.DstColorFactor=ee,e.OneMinusDstColorFactor=te,e.SrcAlphaSaturateFactor=ne,e.NeverDepth=ie,e.AlwaysDepth=re,e.LessDepth=ae,e.LessEqualDepth=oe,e.EqualDepth=se,e.GreaterEqualDepth=le,e.GreaterDepth=ce,e.NotEqualDepth=ue,e.MultiplyOperation=he,e.MixOperation=de,e.AddOperation=pe,e.NoToneMapping=fe,e.LinearToneMapping=me,e.ReinhardToneMapping=ve,e.Uncharted2ToneMapping=ge,e.CineonToneMapping=ye,e.UVMapping=300,e.CubeReflectionMapping=xe,e.CubeRefractionMapping=_e,e.EquirectangularReflectionMapping=be,e.EquirectangularRefractionMapping=we,e.SphericalReflectionMapping=Ae,e.CubeUVReflectionMapping=Me,e.CubeUVRefractionMapping=Te,e.RepeatWrapping=Se,e.ClampToEdgeWrapping=Ee,e.MirroredRepeatWrapping=Le,e.NearestFilter=Ce,e.NearestMipMapNearestFilter=Pe,e.NearestMipMapLinearFilter=Fe,e.LinearFilter=Re,e.LinearMipMapNearestFilter=Ne,e.LinearMipMapLinearFilter=Ie,e.UnsignedByteType=De,e.ByteType=Oe,e.ShortType=Ue,e.UnsignedShortType=Be,e.IntType=ke,e.UnsignedIntType=ze,e.FloatType=Ve,e.HalfFloatType=Ge,e.UnsignedShort4444Type=je,e.UnsignedShort5551Type=Xe,e.UnsignedShort565Type=We,e.UnsignedInt248Type=He,e.AlphaFormat=Ye,e.RGBFormat=qe,e.RGBAFormat=Qe,e.LuminanceFormat=Ze,e.LuminanceAlphaFormat=Je,e.RGBEFormat=Ke,e.DepthFormat=$e,e.DepthStencilFormat=et,e.RGB_S3TC_DXT1_Format=tt,e.RGBA_S3TC_DXT1_Format=nt,e.RGBA_S3TC_DXT3_Format=it,e.RGBA_S3TC_DXT5_Format=rt,e.RGB_PVRTC_4BPPV1_Format=at,e.RGB_PVRTC_2BPPV1_Format=ot,e.RGBA_PVRTC_4BPPV1_Format=st,e.RGBA_PVRTC_2BPPV1_Format=lt,e.RGB_ETC1_Format=ct,e.LoopOnce=2200,e.LoopRepeat=ut,e.LoopPingPong=2202,e.InterpolateDiscrete=ht,e.InterpolateLinear=dt,e.InterpolateSmooth=pt,e.ZeroCurvatureEnding=ft,e.ZeroSlopeEnding=mt,e.WrapAroundEnding=vt,e.TrianglesDrawMode=gt,e.TriangleStripDrawMode=yt,e.TriangleFanDrawMode=xt,e.LinearEncoding=_t,e.sRGBEncoding=bt,e.GammaEncoding=wt,e.RGBEEncoding=At,e.LogLuvEncoding=3003,e.RGBM7Encoding=Mt,e.RGBM16Encoding=Tt,e.RGBDEncoding=St,e.BasicDepthPacking=Et,e.RGBADepthPacking=Lt,e.V3DL=Ct,e.ViewportFitNone=Pt,e.ViewportFitVertical=1,e.ViewportFitHorizontal=2,e.ViewportFitAuto=3,e.CubeGeometry=Hr,e.Face4=function(e,t,n,i,r,a,o){return console.warn("v3d.Face4 has been removed. A v3d.Face3 will be created instead."),new Wi(e,t,n,r,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("v3d.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("v3d.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("v3d.PointCloud has been renamed to v3d.Points."),new zo(e,t)},e.Particle=function(e){return console.warn("v3d.Particle has been renamed to v3d.Sprite."),new Po(e)},e.ParticleSystem=function(e,t){return console.warn("v3d.ParticleSystem has been renamed to v3d.Points."),new zo(e,t)},e.PointCloudMaterial=function(e){return console.warn("v3d.PointCloudMaterial has been renamed to v3d.PointsMaterial."),new ko(e)},e.ParticleBasicMaterial=function(e){return console.warn("v3d.ParticleBasicMaterial has been renamed to v3d.PointsMaterial."),new ko(e)},e.ParticleSystemMaterial=function(e){return console.warn("v3d.ParticleSystemMaterial has been renamed to v3d.PointsMaterial."),new ko(e)},e.Vertex=function(e,t,n){return console.warn("v3d.Vertex has been removed. Use v3d.Vector3 instead."),new Dt(e,t,n)},e.DynamicBufferAttribute=function(e,t){return console.warn("v3d.DynamicBufferAttribute has been removed. Use new v3d.BufferAttribute().setDynamic(true) instead."),new Ir(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("v3d.Int8Attribute has been removed. Use new v3d.Int8BufferAttribute() instead."),new Dr(e,t)},e.Uint8Attribute=function(e,t){return console.warn("v3d.Uint8Attribute has been removed. Use new v3d.Uint8BufferAttribute() instead."),new Or(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("v3d.Uint8ClampedAttribute has been removed. Use new v3d.Uint8ClampedBufferAttribute() instead."),new Ur(e,t)},e.Int16Attribute=function(e,t){return console.warn("v3d.Int16Attribute has been removed. Use new v3d.Int16BufferAttribute() instead."),new Br(e,t)},e.Uint16Attribute=function(e,t){return console.warn("v3d.Uint16Attribute has been removed. Use new v3d.Uint16BufferAttribute() instead."),new kr(e,t)},e.Int32Attribute=function(e,t){return console.warn("v3d.Int32Attribute has been removed. Use new v3d.Int32BufferAttribute() instead."),new zr(e,t)},e.Uint32Attribute=function(e,t){return console.warn("v3d.Uint32Attribute has been removed. Use new v3d.Uint32BufferAttribute() instead."),new Vr(e,t)},e.Float32Attribute=function(e,t){return console.warn("v3d.Float32Attribute has been removed. Use new v3d.Float32BufferAttribute() instead."),new Gr(e,t)},e.Float64Attribute=function(e,t){return console.warn("v3d.Float64Attribute has been removed. Use new v3d.Float64BufferAttribute() instead."),new jr(e,t)},e.ClosedSplineCurve3=Pp,e.SplineCurve3=Fp,e.Spline=Rp,e.BoundingBoxHelper=function(e,t){return console.warn("v3d.BoundingBoxHelper has been deprecated. Creating a v3d.BoxHelper instead."),new Kd(e,t)},e.EdgesHelper=function(e,t){return console.warn("v3d.EdgesHelper has been removed. Use v3d.EdgesGeometry instead."),new Uo(new Ds(e.geometry),new Do({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("v3d.WireframeHelper has been removed. Use v3d.WireframeGeometry instead."),new Uo(new is(e.geometry),new Do({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("v3d.XHRLoader has been renamed to v3d.FileLoader."),new El(e)},e.BinaryTextureLoader=function(e){return console.warn("v3d.BinaryTextureLoader has been renamed to v3d.DataTextureLoader."),new Cl(e)},e.GeometryUtils=Np,e.ImageUtils=Ip,e.Projector=function(){console.error("v3d.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("v3d.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("v3d.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("v3d.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.CanvasRenderer=function(){console.error("v3d.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},Object.defineProperty(e,"__esModule",{value:!0})});