PageSourceSearch

https://getblock.io/_nuxt/lWwIPSaR.js

js getblock.io collected 2026-10-03 19:13:39 UTC 536,519 bytes, 4,254 lines download raw bytes

1/**
2 * @license
3 * Copyright 2010-2026 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const Qr="185";const Rn="",$t="srgb",rr="srgb-linear",sr="linear",je="srgb";const as="300 es";function Oa(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function ar(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Ga(){const i=ar("canvas");return i.style.display="block",i}const os={};function ls(...i){const e="THREE."+i.shift();console.log(e,...i)}function ma(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Le(...i){i=ma(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function $e(...i){i=ma(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ri(...i){const e=i.join(" ");e in os||(os[e]=!0,Le(...i))}function za(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const Va={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class Nn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Lt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],fr=Math.PI/180,qr=180/Math.PI;function Ti(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Lt[i&255]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]+"-"+Lt[e&255]+Lt[e>>8&255]+"-"+Lt[e>>16&15|64]+Lt[e>>24&255]+"-"+Lt[t&63|128]+Lt[t>>8&255]+"-"+Lt[t>>16&255]+Lt[t>>24&255]+Lt[n&255]+Lt[n>>8&255]+Lt[n>>16&255]+Lt[n>>24&255]).toLowerCase()}function Ke(i,e,t){return Math.max(e,Math.min(t,i))}function Ha(i,e){return(i%e+e)%e}function pr(i,e,t){return(1-t)*i+t*e}function di(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Ot(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}class We{static{We.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 23,177 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ke(this.x,e.x,t.x),this.y=Ke(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ke(this.x,e,t),this.y=Ke(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ke(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ke(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class cn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],f=n[r+2],g=n[r+3],u=s[a+0],m=s[a+1],x=s[a+2],S=s[a+3];if(g!==S||l!==u||c!==m||f!==x){let p=l*u+c*m+f*x+g*S;p<0&&(u=-u,m=-m,x=-x,S=-S,p=-p);let h=1-o;if(p<.9995){const b=Math.acos(p),R=Math.sin(b);h=Math.sin(h*b)/R,o=Math.sin(o*b)/R,l=l*h+u*o,c=c*h+m*o,f=f*h+x*o,g=g*h+S*o}else{l=l*h+u*o,c=c*h+m*o,f=f*h+x*o,g=g*h+S*o;const b=1/Math.sqrt(l*l+c*c+f*f+g*g);l*=b,c*=b,f*=b,g*=b}}e[t]=l,e[t+1]=c,e[t+2]=f,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],f=n[r+3],g=s[a],u=s[a+1],m=s[a+2],x=s[a+3];return e[t]=o*x+f*g+l*m-c*u,e[t+1]=l*x+f*u+c*g-o*m,e[t+2]=c*x+f*m+o*u-l*g,e[t+3]=f*x-o*g-l*u-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),f=o(r/2),g=o(s/2),u=l(n/2),m=l(r/2),x=l(s/2);switch(a){case"XYZ":this._x=u*f*g+c*m*x,this._y=c*m*g-u*f*x,this._z=c*f*x+u*m*g,this._w=c*f*g-u*m*x;break;case"YXZ":this._x=u*f*g+c*m*x,this._y=c*m*g-u*f*x,this._z=c*f*x-u*m*g,this._w=c*f*g+u*m*x;break;case"ZXY":this._x=u*f*g-c*m*x,this._y=c*m*g+u*f*x,this._z=c*f*x+u*m*g,this._w=c*f*g-u*m*x;break;case"ZYX":this._x=u*f*g-c*m*x,this._y=c*m*g+u*f*x,this._z=c*f*x-u*m*g,this._w=c*f*g+u*m*x;break;case"YZX":this._x=u*f*g+c*m*x,this._y=c*m*g+u*f*x,this._z=c*f*x-u*m*g,this._w=c*f*g-u*m*x;break;case"XZY":this._x=u*f*g-c*m*x,this._y=c*m*g-u*f*x,this._z=c*f*x+u*m*g,this._w=c*f*g+u*m*x;break;default:Le("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],f=t[6],g=t[10],u=n+o+g;if(u>0){const m=.5/Math.sqrt(u+1);this._w=.25/m,this._x=(f-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>g){const m=2*Math.sqrt(1+n-o-g);this._w=(f-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>g){const m=2*Math.sqrt(1+o-n-g);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+f)/m}else{const m=2*Math.sqrt(1+g-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+f)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ke(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(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(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,f=t._w;return this._x=n*f+a*o+r*c-s*l,this._y=r*f+a*l+s*o-n*c,this._z=s*f+a*c+n*l-r*o,this._w=a*f-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),f=Math.sin(c);l=Math.sin(l*c)/f,t=Math.sin(t*c)/f,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class P{static{P.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(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("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(cs.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cs.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),f=2*(o*t-s*r),g=2*(s*n-a*t);return this.x=t+l*c+a*g-o*f,this.y=n+l*f+o*c-s*g,this.z=r+l*g+s*f-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(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(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(e,t){return this.x=Ke(this.x,e.x,t.x),this.y=Ke(this.y,e.y,t.y),this.z=Ke(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ke(this.x,e,t),this.y=Ke(this.y,e,t),this.z=Ke(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ke(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return mr.copy(this).projectOnVector(e),this.sub(mr)}reflect(e){return this.sub(mr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ke(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const mr=new P,cs=new cn;class Be{static{Be.prototype.isMatrix3=!0}constructor(e,t,n,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const f=this.elements;return f[0]=e,f[1]=r,f[2]=o,f[3]=t,f[4]=s,f[5]=l,f[6]=n,f[7]=a,f[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],f=n[4],g=n[7],u=n[2],m=n[5],x=n[8],S=r[0],p=r[3],h=r[6],b=r[1],R=r[4],M=r[7],A=r[2],y=r[5],C=r[8];return s[0]=a*S+o*b+l*A,s[3]=a*p+o*R+l*y,s[6]=a*h+o*M+l*C,s[1]=c*S+f*b+g*A,s[4]=c*p+f*R+g*y,s[7]=c*h+f*M+g*C,s[2]=u*S+m*b+x*A,s[5]=u*p+m*R+x*y,s[8]=u*h+m*M+x*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],f=e[8];return t*a*f-t*o*c-n*s*f+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],f=e[8],g=f*a-o*c,u=o*l-f*s,m=c*s-a*l,x=t*g+n*u+r*m;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=g*S,e[1]=(r*c-f*n)*S,e[2]=(o*n-r*a)*S,e[3]=u*S,e[4]=(f*t-r*l)*S,e[5]=(r*s-o*t)*S,e[6]=m*S,e[7]=(n*l-c*t)*S,e[8]=(a*t-n*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return ri("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(gr.makeScale(e,t)),this}rotate(e){return ri("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(gr.makeRotation(-e)),this}translate(e,t){return ri("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(gr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const gr=new Be,us=new Be().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),hs=new Be().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ka(){const i={enabled:!0,workingColorSpace:rr,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===je&&(r.r=_n(r.r),r.g=_n(r.g),r.b=_n(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===je&&(r.r=si(r.r),r.g=si(r.g),r.b=si(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Rn?sr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ri("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ri("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[rr]:{primaries:e,whitePoint:n,transfer:sr,toXYZ:us,fromXYZ:hs,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:$t},outputColorSpaceConfig:{drawingBufferColorSpace:$t}},[$t]:{primaries:e,whitePoint:n,transfer:je,toXYZ:us,fromXYZ:hs,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:$t}}}),i}const Ye=ka();function _n(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function si(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class Wa{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Wn===void 0&&(Wn=ar("canvas")),Wn.width=e.width,Wn.height=e.height;const r=Wn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Wn}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ar("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=_n(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(_n(t[n]/255)*255):t[n]=_n(t[n]);return{data:t,width:e.width,height:e.height}}else return Le("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Xa=0;class jr{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xa++}),this.uuid=Ti(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(_r(r[a].image)):s.push(_r(r[a]))}else s=_r(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function _r(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Wa.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Le("Texture: Unable to serialize Texture."),{})}let qa=0;const xr=new P;class Ut extends Nn{constructor(e=Ut.DEFAULT_IMAGE,t=Ut.DEFAULT_MAPPING,n=1001,r=1001,s=1006,a=1008,o=1023,l=1009,c=Ut.DEFAULT_ANISOTROPY,f=Rn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:qa++}),this.uuid=Ti(),this.name="",this.source=new jr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new We(0,0),this.repeat=new We(1,1),this.center=new We(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace
5=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(xr).x}get height(){return this.source.getSize(xr).y}get depth(){return this.source.getSize(xr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Le(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Le(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ut.DEFAULT_IMAGE=null;Ut.DEFAULT_MAPPING=300;Ut.DEFAULT_ANISOTROPY=1;class ft{static{ft.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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("THREE.Vector4: index is out of range: "+e)}return this}getComponent(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("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(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(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}
vendor: 11,628 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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(e){let t,n,r,s;const l=e.elements,c=l[0],f=l[4],g=l[8],u=l[1],m=l[5],x=l[9],S=l[2],p=l[6],h=l[10];if(Math.abs(f-u)<.01&&Math.abs(g-S)<.01&&Math.abs(x-p)<.01){if(Math.abs(f+u)<.1&&Math.abs(g+S)<.1&&Math.abs(x+p)<.1&&Math.abs(c+m+h-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const R=(c+1)/2,M=(m+1)/2,A=(h+1)/2,y=(f+u)/4,C=(g+S)/4,_=(x+p)/4;return R>M&&R>A?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=y/n,s=C/n):M>A?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=y/r,s=_/r):A<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(A),n=C/s,r=_/s),this.set(n,r,s,t),this}let b=Math.sqrt((p-x)*(p-x)+(g-S)*(g-S)+(u-f)*(u-f));return Math.abs(b)<.001&&(b=1),this.x=(p-x)/b,this.y=(g-S)/b,this.z=(u-f)/b,this.w=Math.acos((c+m+h-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(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(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(e,t){return this.x=Ke(this.x,e.x,t.x),this.y=Ke(this.y,e.y,t.y),this.z=Ke(this.z,e.z,t.z),this.w=Ke(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ke(this.x,e,t),this.y=Ke(this.y,e,t),this.z=Ke(this.z,e,t),this.w=Ke(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ke(n,e,t))}floor(){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(){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(){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(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ya extends Nn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ft(0,0,e,t),this.scissorTest=!1,this.viewport=new ft(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new Ut(r),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new jr(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ln extends Ya{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ga extends Ut{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ka extends Ut{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class et{static{et.prototype.isMatrix4=!0}constructor(e,t,n,r,s,a,o,l,c,f,g,u,m,x,S,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,f,g,u,m,x,S,p)}set(e,t,n,r,s,a,o,l,c,f,g,u,m,x,S,p){const h=this.elements;return h[0]=e,h[4]=t,h[8]=n,h[12]=r,h[1]=s,h[5]=a,h[9]=o,h[13]=l,h[2]=c,h[6]=f,h[10]=g,h[14]=u,h[3]=m,h[7]=x,h[11]=S,h[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new et().fromArray(this.elements)}copy(e){const 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(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(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(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/Xn.setFromMatrixColumn(e,0).length(),s=1/Xn.setFromMatrixColumn(e,1).length(),a=1/Xn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),f=Math.cos(s),g=Math.sin(s);if(e.order==="XYZ"){const u=a*f,m=a*g,x=o*f,S=o*g;t[0]=l*f,t[4]=-l*g,t[8]=c,t[1]=m+x*c,t[5]=u-S*c,t[9]=-o*l,t[2]=S-u*c,t[6]=x+m*c,t[10]=a*l}else if(e.order==="YXZ"){const u=l*f,m=l*g,x=c*f,S=c*g;t[0]=u+S*o,t[4]=x*o-m,t[8]=a*c,t[1]=a*g,t[5]=a*f,t[9]=-o,t[2]=m*o-x,t[6]=S+u*o,t[10]=a*l}else if(e.order==="ZXY"){const u=l*f,m=l*g,x=c*f,S=c*g;t[0]=u-S*o,t[4]=-a*g,t[8]=x+m*o,t[1]=m+x*o,t[5]=a*f,t[9]=S-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const u=a*f,m=a*g,x=o*f,S=o*g;t[0]=l*f,t[4]=x*c-m,t[8]=u*c+S,t[1]=l*g,t[5]=S*c+u,t[9]=m*c-x,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const u=a*l,m=a*c,x=o*l,S=o*c;t[0]=l*f,t[4]=S-u*g,t[8]=x*g+m,t[1]=g,t[5]=a*f,t[9]=-o*f,t[2]=-c*f,t[6]=m*g+x,t[10]=u-S*g}else if(e.order==="XZY"){const u=a*l,m=a*c,x=o*l,S=o*c;t[0]=l*f,t[4]=-g,t[8]=c*f,t[1]=u*g+S,t[5]=a*f,t[9]=m*g-x,t[2]=x*g-m,t[6]=o*f,t[10]=S*g+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Za,e,$a)}lookAt(e,t,n){const r=this.elements;return kt.subVectors(e,t),kt.lengthSq()===0&&(kt.z=1),kt.normalize(),Sn.crossVectors(n,kt),Sn.lengthSq()===0&&(Math.abs(n.z)===1?kt.x+=1e-4:kt.z+=1e-4,kt.normalize(),Sn.crossVectors(n,kt)),Sn.normalize(),Ci.crossVectors(kt,Sn),r[0]=Sn.x,r[4]=Ci.x,r[8]=kt.x,r[1]=Sn.y,r[5]=Ci.y,r[9]=kt.y,r[2]=Sn.z,r[6]=Ci.z,r[10]=kt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],f=n[1],g=n[5],u=n[9],m=n[13],x=n[2],S=n[6],p=n[10],h=n[14],b=n[3],R=n[7],M=n[11],A=n[15],y=r[0],C=r[4],_=r[8],T=r[12],I=r[1],D=r[5],N=r[9],K=r[13],$=r[2],z=r[6],q=r[10],k=r[14],Q=r[3],ee=r[7],ue=r[11],pe=r[15];
vendor: 4,508 bytes, line 5
5return s[0]=a*y+o*I+l*$+c*Q,s[4]=a*C+o*D+l*z+c*ee,s[8]=a*_+o*N+l*q+c*ue,s[12]=a*T+o*K+l*k+c*pe,s[1]=f*y+g*I+u*$+m*Q,s[5]=f*C+g*D+u*z+m*ee,s[9]=f*_+g*N+u*q+m*ue,s[13]=f*T+g*K+u*k+m*pe,s[2]=x*y+S*I+p*$+h*Q,s[6]=x*C+S*D+p*z+h*ee,s[10]=x*_+S*N+p*q+h*ue,s[14]=x*T+S*K+p*k+h*pe,s[3]=b*y+R*I+M*$+A*Q,s[7]=b*C+R*D+M*z+A*ee,s[11]=b*_+R*N+M*q+A*ue,s[15]=b*T+R*K+M*k+A*pe,this}multiplyScalar(e){const 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}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],f=e[2],g=e[6],u=e[10],m=e[14],x=e[3],S=e[7],p=e[11],h=e[15],b=l*m-c*u,R=o*m-c*g,M=o*u-l*g,A=a*m-c*f,y=a*u-l*f,C=a*g-o*f;return t*(S*b-p*R+h*M)-n*(x*b-p*A+h*y)+r*(x*R-S*A+h*C)-s*(x*M-S*y+p*C)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],f=e[10];return t*(a*f-o*c)-n*(s*f-o*l)+r*(s*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],f=e[8],g=e[9],u=e[10],m=e[11],x=e[12],S=e[13],p=e[14],h=e[15],b=t*o-n*a,R=t*l-r*a,M=t*c-s*a,A=n*l-r*o,y=n*c-s*o,C=r*c-s*l,_=f*S-g*x,T=f*p-u*x,I=f*h-m*x,D=g*p-u*S,N=g*h-m*S,K=u*h-m*p,$=b*K-R*N+M*D+A*I-y*T+C*_;if($===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/$;return e[0]=(o*K-l*N+c*D)*z,e[1]=(r*N-n*K-s*D)*z,e[2]=(S*C-p*y+h*A)*z,e[3]=(u*y-g*C-m*A)*z,e[4]=(l*I-a*K-c*T)*z,e[5]=(t*K-r*I+s*T)*z,e[6]=(p*M-x*C-h*R)*z,e[7]=(f*C-u*M+m*R)*z,e[8]=(a*N-o*I+c*_)*z,e[9]=(n*I-t*N-s*_)*z,e[10]=(x*y-S*M+h*b)*z,e[11]=(g*M-f*y-m*b)*z,e[12]=(o*T-a*D-l*_)*z,e[13]=(t*D-n*T+r*_)*z,e[14]=(S*R-x*A-p*b)*z,e[15]=(f*A-g*R+u*b)*z,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,f=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+n,f*l-r*a,0,c*l-r*o,f*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,f=a+a,g=o+o,u=s*c,m=s*f,x=s*g,S=a*f,p=a*g,h=o*g,b=l*c,R=l*f,M=l*g,A=n.x,y=n.y,C=n.z;return r[0]=(1-(S+h))*A,r[1]=(m+M)*A,r[2]=(x-R)*A,r[3]=0,r[4]=(m-M)*y,r[5]=(1-(u+h))*y,r[6]=(p+b)*y,r[7]=0,r[8]=(x+R)*C,r[9]=(p-b)*C,r[10]=(1-(u+S))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=Xn.set(r[0],r[1],r[2]).length();const o=Xn.set(r[4],r[5],r[6]).length(),l=Xn.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Qt.copy(this);const c=1/a,f=1/o,g=1/l;return Qt.elements[0]*=c,Qt.elements[1]*=c,Qt.elements[2]*=c,Qt.elements[4]*=f,Qt.elements[5]*=f,Qt.elements[6]*=f,Qt.elements[8]*=g,Qt.elements[9]*=g,Qt.elements[10]*=g,t.setFromRotationMatrix(Qt),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,r,s,a,o=2e3,l=!1){const c=this.elements,f=2*s/(t-e),g=2*s/(n-r),u=(t+e)/(t-e),m=(n+r)/(n-r);let x,S;if(l)x=s/(a-s),S=a*s/(a-s);else if(o===2e3)x=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===2001)x=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=f,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=g,c[9]=m,c[13]=0,c[2]=0,c[6]=0,c[10]=x,c[14]=S,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}
vendor: 24,947 bytes, line 5
5makeOrthographic(e,t,n,r,s,a,o=2e3,l=!1){const c=this.elements,f=2/(t-e),g=2/(n-r),u=-(t+e)/(t-e),m=-(n+r)/(n-r);let x,S;if(l)x=1/(a-s),S=a/(a-s);else if(o===2e3)x=-2/(a-s),S=-(a+s)/(a-s);else if(o===2001)x=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=f,c[4]=0,c[8]=0,c[12]=u,c[1]=0,c[5]=g,c[9]=0,c[13]=m,c[2]=0,c[6]=0,c[10]=x,c[14]=S,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Xn=new P,Qt=new et,Za=new P(0,0,0),$a=new P(1,1,1),Sn=new P,Ci=new P,kt=new P,ds=new et,fs=new cn;class Cn{constructor(e=0,t=0,n=0,r=Cn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],f=r[9],g=r[2],u=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Ke(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ke(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ke(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-g,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ke(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(u,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ke(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-Ke(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-f,m),this._y=0);break;default:Le("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ds.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ds,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fs.setFromEuler(this),this.setFromQuaternion(fs,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Cn.DEFAULT_ORDER="XYZ";class _a{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Ja=0;const ps=new P,qn=new cn,hn=new et,Pi=new P,fi=new P,Qa=new P,ja=new cn,ms=new P(1,0,0),gs=new P(0,1,0),_s=new P(0,0,1),xs={type:"added"},eo={type:"removed"},Yn={type:"childadded",child:null},vr={type:"childremoved",child:null};class wt extends Nn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ja++}),this.uuid=Ti(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wt.DEFAULT_UP.clone();const e=new P,t=new Cn,n=new cn,r=new P(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Be}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=wt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new _a,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return qn.setFromAxisAngle(e,t),this.quaternion.multiply(qn),this}rotateOnWorldAxis(e,t){return qn.setFromAxisAngle(e,t),this.quaternion.premultiply(qn),this}rotateX(e){return this.rotateOnAxis(ms,e)}rotateY(e){return this.rotateOnAxis(gs,e)}rotateZ(e){return this.rotateOnAxis(_s,e)}translateOnAxis(e,t){return ps.copy(e).applyQuaternion(this.quaternion),this.position.add(ps.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ms,e)}translateY(e){return this.translateOnAxis(gs,e)}translateZ(e){return this.translateOnAxis(_s,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(hn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Pi.copy(e):Pi.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),fi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hn.lookAt(fi,Pi,this.up):hn.lookAt(Pi,fi,this.up),this.quaternion.setFromRotationMatrix(hn),r&&(hn.extractRotation(r.matrixWorld),qn.setFromRotationMatrix(hn),this.quaternion.premultiply(qn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?($e("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(xs),Yn.child=e,this.dispatchEvent(Yn),Yn.child=null):$e("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(eo),vr.child=e,this.dispatchEvent(vr),vr.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),hn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),hn.multiply(e.parent.matrixWorld)),e.applyMatrix4(hn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xs),Yn.child=e,this.dispatchEvent(Yn),Yn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fi,e,Qa),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fi,ja,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,f=l.length;c<f;c++){const g=l[c];s(e.shapes,g)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),f=a(e.images),g=a(e.shapes),u=a(e.skeletons),m=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),f.length>0&&(n.images=f),g.length>0&&(n.shapes=g),u.length>0&&(n.skeletons=u),m.length>0&&(n.animations=m),x.length>0&&(n.nodes=x)}return n.object=r,n;function a(o){const l=[];for(const c in o){const f=o[c];delete f.metadata,l.push(f)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}wt.DEFAULT_UP=new P(0,1,0);wt.DEFAULT_MATRIX_AUTO_UPDATE=!0;wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Ei extends wt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const to={type:"move"};class Mr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ei,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ei,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ei,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const p=t.getJointPose(S,n),h=this._getHandJoint(c,S);p!==null&&(h.matrix.fromArray(p.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,h.jointRadius=p.radius),h.visible=p!==null}const f=c.joints["index-finger-tip"],g=c.joints["thumb-tip"],u=f.position.distanceTo(g.position),m=.02,x=.005;c.inputState.pinching&&u>m+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=m-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(to)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ei;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const xa={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},En={h:0,s:0,l:0},Di={h:0,s:0,l:0};function Sr(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ie{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=$t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ye.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Ye.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ye.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Ye.workingColorSpace){if(e=Ha(e,1),t=Ke(t,0,1),n=Ke(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Sr(a,s,e+1/3),this.g=Sr(a,s,e),this.b=Sr(a,s,e-1/3)}return Ye.colorSpaceToWorking(this,r),this}setStyle(e,t=$t){function n(s){s!==void 0&&parseFloat(s)<1&&Le("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Le("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Le("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=$t){const n=xa[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Le("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=_n(e.r),this.g=_n(e.g),this.b=_n(e.b),this}copyLinearToSRGB(e){return this.r=si(e.r),this.g=si(e.g),this.b=si(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$t){return Ye.workingToColorSpace(Ft.copy(this),e),Math.round(Ke(Ft.r*255,0,255))*65536+Math.round(Ke(Ft.g*255,0,255))*256+Math.round(Ke(Ft.b*255,0,255))}getHexString(e=$t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ye.workingColorSpace){Ye.workingToColorSpace(Ft.copy(this),t);const n=Ft.r,r=Ft.g,s=Ft.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const f=(o+a)/2;if(o===a)l=0,c=0;else{const g=a-o;switch(c=f<=.5?g/(a+o):g/(2-a-o),a){case n:l=(r-s)/g+(r<s?6:0);break;case r:l=(s-n)/g+2;break;case s:l=(n-r)/g+4;break}l/=6}return e.h=l,e.s=c,e.l=f,e}getRGB(e,t=Ye.workingColorSpace){return Ye.workingToColorSpace(Ft.copy(this),t),e.r=Ft.r,e.g=Ft.g,e.b
vendor: 5,524 bytes, line 5
5=Ft.b,e}getStyle(e=$t){Ye.workingToColorSpace(Ft.copy(this),e);const t=Ft.r,n=Ft.g,r=Ft.b;return e!==$t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(En),this.setHSL(En.h+e,En.s+t,En.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(En),e.getHSL(Di);const n=pr(En.h,Di.h,t),r=pr(En.s,Di.s,t),s=pr(En.l,Di.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ft=new Ie;Ie.NAMES=xa;class es{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ie(e),this.near=t,this.far=n}clone(){return new es(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class vs extends wt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Cn,this.environmentIntensity=1,this.environmentRotation=new Cn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const jt=new P,dn=new P,Er=new P,fn=new P,Kn=new P,Zn=new P,Ms=new P,yr=new P,Tr=new P,br=new P,Ar=new ft,Rr=new ft,wr=new ft;class nn{constructor(e=new P,t=new P,n=new P){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),jt.subVectors(e,t),r.cross(jt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){jt.subVectors(r,t),dn.subVectors(n,t),Er.subVectors(e,t);const a=jt.dot(jt),o=jt.dot(dn),l=jt.dot(Er),c=dn.dot(dn),f=dn.dot(Er),g=a*c-o*o;if(g===0)return s.set(0,0,0),null;const u=1/g,m=(c*l-o*f)*u,x=(a*f-o*l)*u;return s.set(1-m-x,x,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,fn)===null?!1:fn.x>=0&&fn.y>=0&&fn.x+fn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,fn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,fn.x),l.addScaledVector(a,fn.y),l.addScaledVector(o,fn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return Ar.setScalar(0),Rr.setScalar(0),wr.setScalar(0),Ar.fromBufferAttribute(e,t),Rr.fromBufferAttribute(e,n),wr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ar,s.x),a.addScaledVector(Rr,s.y),a.addScaledVector(wr,s.z),a}static isFrontFacing(e,t,n,r){return jt.subVectors(n,t),dn.subVectors(e,t),jt.cross(dn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return jt.subVectors(this.c,this.b),dn.subVectors(this.a,this.b),jt.cross(dn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 6,180 bytes, line 5
5getInterpolation(e,t,n,r,s){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Kn.subVectors(r,n),Zn.subVectors(s,n),yr.subVectors(e,n);const l=Kn.dot(yr),c=Zn.dot(yr);if(l<=0&&c<=0)return t.copy(n);Tr.subVectors(e,r);const f=Kn.dot(Tr),g=Zn.dot(Tr);if(f>=0&&g<=f)return t.copy(r);const u=l*g-f*c;if(u<=0&&l>=0&&f<=0)return a=l/(l-f),t.copy(n).addScaledVector(Kn,a);br.subVectors(e,s);const m=Kn.dot(br),x=Zn.dot(br);if(x>=0&&m<=x)return t.copy(s);const S=m*c-l*x;if(S<=0&&c>=0&&x<=0)return o=c/(c-x),t.copy(n).addScaledVector(Zn,o);const p=f*x-m*g;if(p<=0&&g-f>=0&&m-x>=0)return Ms.subVectors(s,r),o=(g-f)/(g-f+(m-x)),t.copy(r).addScaledVector(Ms,o);const h=1/(p+S+u);return a=S*h,o=u*h,t.copy(n).addScaledVector(Kn,a).addScaledVector(Zn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Bn{constructor(e=new P(1/0,1/0,1/0),t=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(en.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(en.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=en.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,en):en.fromBufferAttribute(s,a),en.applyMatrix4(e.matrixWorld),this.expandByPoint(en);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Li.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Li.copy(n.boundingBox)),Li.applyMatrix4(e.matrixWorld),this.union(Li)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(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(e,t){return t.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(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,en),en.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let 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}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pi),Fi.subVectors(this.max,pi),$n.subVectors(e.a,pi),Jn.subVectors(e.b,pi),Qn.subVectors(e.c,pi),yn.subVectors(Jn,$n),Tn.subVectors(Qn,Jn),Pn.subVectors($n,Qn);let t=[0,-yn.z,yn.y,0,-Tn.z,Tn.y,0,-Pn.z,Pn.y,yn.z,0,-yn.x,Tn.z,0,-Tn.x,Pn.z,0,-Pn.x,-yn.y,yn.x,0,-Tn.y,Tn.x,0,-Pn.y,Pn.x,0];return!Cr(t,$n,Jn,Qn,Fi)||(t=[1,0,0,0,1,0,0,0,1],!Cr(t,$n,Jn,Qn,Fi))?!1:(Ii.crossVectors(yn,Tn),t=[Ii.x,Ii.y,Ii.z],Cr(t,$n,Jn,Qn,Fi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,en).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(en).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(pn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const pn=[new P,new P,new P,new P,new P,new P,new P,new P],en=new P,Li=new Bn,$n=new P,Jn=new P,Qn=new P,yn=new P,Tn=new P,Pn=new P,pi=new P,Fi=new P,Ii=new P,Dn=new P;function Cr(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Dn.fromArray(i,s);const o=r.x*Math.abs(Dn.x)+r.y*Math.abs(Dn.y)+r.z*Math.abs(Dn.z),l=e.dot
vendor: 5,139 bytes, line 5
5(Dn),c=t.dot(Dn),f=n.dot(Dn);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>o)return!1}return!0}const Et=new P,Ui=new We;let no=0;class Gt extends Nn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:no++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Ui.fromBufferAttribute(this,t),Ui.applyMatrix3(e),this.setXY(t,Ui.x,Ui.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix3(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix4(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyNormalMatrix(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.transformDirection(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=di(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ot(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=di(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=di(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=di(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=di(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class va extends Gt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ma extends Gt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Nt extends Gt{constructor(e,t,n){super(new Float32Array(e),t,n)}}const io=new Bn,mi=new P,Pr=new P;class On{constructor(e=new P,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):io.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}
vendor: 13,282 bytes, line 5
5applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mi.subVectors(e,this.center);const t=mi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(mi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Pr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mi.copy(e.center).add(Pr)),this.expandByPoint(mi.copy(e.center).sub(Pr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let ro=0;const Zt=new et,Dr=new wt,jn=new P,Wt=new Bn,gi=new Bn,Rt=new P;class Bt extends Nn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ro++}),this.uuid=Ti(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Oa(e)?Ma:va)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Be().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Zt.makeRotationFromQuaternion(e),this.applyMatrix4(Zt),this}rotateX(e){return Zt.makeRotationX(e),this.applyMatrix4(Zt),this}rotateY(e){return Zt.makeRotationY(e),this.applyMatrix4(Zt),this}rotateZ(e){return Zt.makeRotationZ(e),this.applyMatrix4(Zt),this}translate(e,t,n){return Zt.makeTranslation(e,t,n),this.applyMatrix4(Zt),this}scale(e,t,n){return Zt.makeScale(e,t,n),this.applyMatrix4(Zt),this}lookAt(e){return Dr.lookAt(e),Dr.updateMatrix(),this.applyMatrix4(Dr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jn).negate(),this.translate(jn.x,jn.y,jn.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Nt(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Le("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$e("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Wt.setFromBufferAttribute(s),this.morphTargetsRelative?(Rt.addVectors(this.boundingBox.min,Wt.min),this.boundingBox.expandByPoint(Rt),Rt.addVectors(this.boundingBox.max,Wt.max),this.boundingBox.expandByPoint(Rt)):(this.boundingBox.expandByPoint(Wt.min),this.boundingBox.expandByPoint(Wt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&$e('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new On);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$e("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(e){const n=this.boundingSphere.center;if(Wt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gi.setFromBufferAttribute(o),this.morphTargetsRelative?(Rt.addVectors(Wt.min,gi.min),Wt.expandByPoint(Rt),Rt.addVectors(Wt.max,gi.max),Wt.expandByPoint(Rt)):(Wt.expandByPoint(gi.min),Wt.expandByPoint(gi.max))}Wt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Rt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Rt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,f=o.count;c<f;c++)Rt.fromBufferAttribute(o,c),l&&(jn.fromBufferAttribute(e,c),Rt.add(jn)),r=Math.max(r,n.distanceToSquared(Rt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&$e('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){$e("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new Gt(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let _=0;_<n.count;_++)o[_]=new P,l[_]=new P;const c=new P,f=new P,g=new P,u=new We,m=new We,x=new We,S=new P,p=new P;function h(_,T,I){c.fromBufferAttribute(n,_),f.fromBufferAttribute(n,T),g.fromBufferAttribute(n,I),u.fromBufferAttribute(s,_),m.fromBufferAttribute(s,T),x.fromBufferAttribute(s,I),f.sub(c),g.sub(c),m.sub(u),x.sub(u);const D=1/(m.x*x.y-x.x*m.y);isFinite(D)&&(S.copy(f).multiplyScalar(x.y).addScaledVector(g,-m.y).multiplyScalar(D),p.copy(g).multiplyScalar(m.x).addScaledVector(f,-x.x).multiplyScalar(D),o[_].add(S),o[T].add(S),o[I].add(S),l[_].add(p),l[T].add(p),l[I].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let _=0,T=b.length;_<T;++_){const I=b[_],D=I.start,N=I.count;for(let K=D,$=D+N;K<$;K+=3)h(e.getX(K+0),e.getX(K+1),e.getX(K+2))}const R=new P,M=new P,A=new P,y=new P;function C(_){A.fromBufferAttribute(r,_),y.copy(A);const T=o[_];R.copy(T),R.sub(A.multiplyScalar(A.dot(T))).normalize(),M.crossVectors(y,T);const D=M.dot(l[_])<0?-1:1;a.setXYZW(_,R.x,R.y,R.z,D)}for(let _=0,T=b.length;_<T;++_){const I=b[_],D=I.start,N=I.count;for(let K=D,$=D+N;K<$;K+=3)C(e.getX(K+0)),C(e.getX(K+1)),C(e.getX(K+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Gt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,m=n.count;u<m;u++)n.setXYZ(u,0,0,0);const r=new P,s=new P,a=new P,o=new P,l=new P,c=new P,f=new P,g=new P;if(e)for(let u=0,m=e.count;u<m;u+=3){const x=e.getX(u+0),S=e.getX(u+1),p=e.getX(u+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,p),f.subVectors(a,s),g.subVectors(r,s),f.cross(g),o.fromBufferAttribute(n,x),l.fromBufferAttribute(n,S),c.fromBufferAttribute(n,p),o.add(f),l.add(f),c.add(f),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(S,l.x,l.y,l.z),n.setXYZ(p,c.x,c.y,c.z)}else for(let u=0,m=t.count;u<m;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),f.subVectors(a,s),g.subVectors(r,s),f.cross(g),n.setXYZ(u+0,f.x,f.y,f.z),n.setXYZ(u+1,f.x,f.y,f.z),n.setXYZ(u+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Rt.fromBufferAttribute(e,t),Rt.normalize(),e.setXYZ(t,Rt.x,Rt.y,Rt.z)}toNonIndexed(){function e(o,l){const c=o.array,f=o.itemSize,g=o.normalized,u=new c.constructor(l.length*f);let m=0,x=0;for(let S=0,p=l.length;S<p;S++){o.isInterleavedBufferAttribute?m=l[S]*o.data.stride+o.offset:m=l[S]*f;for(let h=0;h<f;h++)u[x++]=c[m++]}return new Gt(u,f,g)}if(this.index===null)return Le("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let f=0,g=c.length;f<g;f++){const u=c[f],m=e(u,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],f=[];for(let g=0,u=c.length;g<u;g++){const m=c[g];f.push(m.toJSON(e.data))}f.length>0&&(r[l]=f,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const f=r[c];this.setAttribute(c,f.clone(t))}const s=e.morphAttributes;for(const c in s){const f=[],g=s[c];for(let u=0,m=g.length;u<m;u++)f.push(g[u].clone(t));this.morphAttributes[c]=f}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,f=a.length;c<f;c++){const g=a[c];this.addGroup(g.start,g.count,g.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let so=0;class Gn extends Nn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:so++}),this.uuid=Ti(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ie(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Le(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Le(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 16,668 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.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,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),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.normalMapType=this.normalMapType,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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ie().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new We().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new We().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 7,392 bytes, line 5
5adows,this.shadowSide=e.shadowSide,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const mn=new P,Lr=new P,Ni=new P,bn=new P,Fr=new P,Bi=new P,Ir=new P;class ts{constructor(e=new P,t=new P(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=mn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mn.copy(this.origin).addScaledVector(this.direction,t),mn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Lr.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(Lr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ni),o=bn.dot(this.direction),l=-bn.dot(Ni),c=bn.lengthSq(),f=Math.abs(1-a*a);let g,u,m,x;if(f>0)if(g=a*l-o,u=a*o-l,x=s*f,g>=0)if(u>=-x)if(u<=x){const S=1/f;g*=S,u*=S,m=g*(g+a*u+2*o)+u*(a*g+u+2*l)+c}else u=s,g=Math.max(0,-(a*u+o)),m=-g*g+u*(u+2*l)+c;else u=-s,g=Math.max(0,-(a*u+o)),m=-g*g+u*(u+2*l)+c;else u<=-x?(g=Math.max(0,-(-a*s+o)),u=g>0?-s:Math.min(Math.max(-s,-l),s),m=-g*g+u*(u+2*l)+c):u<=x?(g=0,u=Math.min(Math.max(-s,-l),s),m=u*(u+2*l)+c):(g=Math.max(0,-(a*s+o)),u=g>0?s:Math.min(Math.max(-s,-l),s),m=-g*g+u*(u+2*l)+c);else u=a>0?-s:s,g=Math.max(0,-(a*u+o)),m=-g*g+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,g),r&&r.copy(Lr).addScaledVector(Ni,u),m}intersectSphere(e,t){mn.subVectors(e.center,this.origin);const n=mn.dot(this.direction),r=mn.dot(mn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,f=1/this.direction.y,g=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),f>=0?(s=(e.min.y-u.y)*f,a=(e.max.y-u.y)*f):(s=(e.max.y-u.y)*f,a=(e.min.y-u.y)*f),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),g>=0?(o=(e.min.z-u.z)*g,l=(e.max.z-u.z)*g):(o=(e.max.z-u.z)*g,l=(e.min.z-u.z)*g),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,mn)!==null}intersectTriangle(e,t,n,r,s){Fr.subVectors(t,e),Bi.subVectors(n,e),Ir.crossVectors(Fr,Bi);let a=this.direction.dot(Ir),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bn.subVectors(this.origin,e);const l=o*this.direction.dot(Bi.crossVectors(bn,Bi));if(l<0)return null;const c=o*this.direction.dot(Fr.cross(bn));if(c<0||l+c>a)return null;const f=-o*bn.dot(Ir);return f<0?null:this.at(f/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Sa extends Gn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Cn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ss=new et,Ln=new ts,Oi=new On,Es=new P,Gi=new P,zi=new P,Vi=new P,Ur=new P,Hi=new P,ys=new P,ki=new P;class qt extends wt{constructor(e=new Bt,t=new Sa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Hi.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const f=o[l],g=s[l];f!==0&&(Ur.fromBufferAttribute(g,e),a?Hi.addScaledVector(Ur,f):Hi.addScaledVector(Ur.sub(t),f))}t.add(Hi)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Oi.copy(n.boundingSphere),Oi.applyMatrix4(s),Ln.copy(e.ray).recast(e.near),!(Oi.containsPoint(Ln.origin)===!1&&(Ln.intersectSphere(Oi,Es)===null||Ln.origin.distanceToSquared(Es)>(e.far-e.near)**2))&&(Ss.copy(s).invert(),Ln.copy(e.ray).applyMatrix4(Ss),!(n.boundingBox!==null&&Ln.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ln)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,f
5=s.attributes.uv1,g=s.attributes.normal,u=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const p=u[x],h=a[p.materialIndex],b=Math.max(p.start,m.start),R=Math.min(o.count,Math.min(p.start+p.count,m.start+m.count));for(let M=b,A=R;M<A;M+=3){const y=o.getX(M),C=o.getX(M+1),_=o.getX(M+2);r=Wi(this,h,e,n,c,f,g,y,C,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),S=Math.min(o.count,m.start+m.count);for(let p=x,h=S;p<h;p+=3){const b=o.getX(p),R=o.getX(p+1),M=o.getX(p+2);r=Wi(this,a,e,n,c,f,g,b,R,M),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let x=0,S=u.length;x<S;x++){const p=u[x],h=a[p.materialIndex],b=Math.max(p.start,m.start),R=Math.min(l.count,Math.min(p.start+p.count,m.start+m.count));for(let M=b,A=R;M<A;M+=3){const y=M,C=M+1,_=M+2;r=Wi(this,h,e,n,c,f,g,y,C,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),S=Math.min(l.count,m.start+m.count);for(let p=x,h=S;p<h;p+=3){const b=p,R=p+1,M=p+2;r=Wi(this,a,e,n,c,f,g,b,R,M),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}}}function ao(i,e,t,n,r,s,a,o){let l;if(e.side===1?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===0,o),l===null)return null;ki.copy(o),ki.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(ki);return c<t.near||c>t.far?null:{distance:c,point:ki.clone(),object:i}}function Wi(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Gi),i.getVertexPosition(l,zi),i.getVertexPosition(c,Vi);const f=ao(i,e,t,n,Gi,zi,Vi,ys);if(f){const g=new P;nn.getBarycoord(ys,Gi,zi,Vi,g),r&&(f.uv=nn.getInterpolatedAttribute(r,o,l,c,g,new We)),s&&(f.uv1=nn.getInterpolatedAttribute(s,o,l,c,g,new We)),a&&(f.normal=nn.getInterpolatedAttribute(a,o,l,c,g,new P),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new P,materialIndex:0};nn.getNormal(Gi,zi,Vi,u.normal),f.face=u,f.barycoord=g}return f}class Ea extends Ut{constructor(e=null,t=1,n=1,r,s,a,o,l,c=1003,f=1003,g,u){super(null,a,o,l,c,f,r,s,g,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yr extends Gt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ei=new et,Ts=new et,Xi=[],bs=new Bn,oo=new et,_i=new qt,xi=new On;class lo extends qt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Yr(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,oo)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Bn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ei),bs.copy(e.boundingBox).applyMatrix4(ei),this.boundingBox.union(bs)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new On),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ei),xi.copy(e.boundingSphere).applyMatrix4(ei),this.boundingSphere.union(xi)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(_i.geometry=this.geometry,_i.material=this.material,_i.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),xi.copy(this.boundingSphere),xi.applyMatrix4(n),e.ray.intersectsSphere(xi)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,ei),Ts.multiplyMatrices(n,ei),_i.matrixWorld=Ts,_i.raycast(e,Xi);for(let a=0,o=Xi.length;a<o;a++){const l=Xi[a];l.instanceId=s,l.object=this,t.push(l)}Xi.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Yr(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new Ea(new Float32Array(r*this.count),r,this.count,1028,1015));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;return s[l]=o,s.set(n,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Nr=new P,co=new P,uo=new Be;class In{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 10,558 bytes, line 5
5setFromCoplanarPoints(e,t,n){const r=Nr.subVectors(n,t).cross(co.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const r=e.delta(Nr),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||uo.getNormalMatrix(e),r=this.coplanarPoint(Nr).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Fn=new On,ho=new We(.5,.5),qi=new P;class ns{constructor(e=new In,t=new In,n=new In,r=new In,s=new In,a=new In){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],f=s[4],g=s[5],u=s[6],m=s[7],x=s[8],S=s[9],p=s[10],h=s[11],b=s[12],R=s[13],M=s[14],A=s[15];if(r[0].setComponents(c-a,m-f,h-x,A-b).normalize(),r[1].setComponents(c+a,m+f,h+x,A+b).normalize(),r[2].setComponents(c+o,m+g,h+S,A+R).normalize(),r[3].setComponents(c-o,m-g,h-S,A-R).normalize(),n)r[4].setComponents(l,u,p,M).normalize(),r[5].setComponents(c-l,m-u,h-p,A-M).normalize();else if(r[4].setComponents(c-l,m-u,h-p,A-M).normalize(),t===2e3)r[5].setComponents(c+l,m+u,h+p,A+M).normalize();else if(t===2001)r[5].setComponents(l,u,p,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Fn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Fn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Fn)}intersectsSprite(e){Fn.center.set(0,0,0);const t=ho.distanceTo(e.center);return Fn.radius=.7071067811865476+t,Fn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(qi.x=r.normal.x>0?e.max.x:e.min.x,qi.y=r.normal.y>0?e.max.y:e.min.y,qi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(qi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ya extends Gn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ie(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const or=new P,lr=new P,As=new et,vi=new ts,Yi=new On,Br=new P,Rs=new P;class fo extends wt{constructor(e=new Bt,t=new ya){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)or.fromBufferAttribute(t,r-1),lr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=or.distanceTo(lr);e.setAttribute("lineDistance",new Nt(n,1))}else Le("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Yi.copy(n.boundingSphere),Yi.applyMatrix4(r),Yi.radius+=s,e.ray.intersectsSphere(Yi)===!1)return;As.copy(r).invert(),vi.copy(e.ray).applyMatrix4(As);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,f=n.index,u=n.attributes.position;if(f!==null){const m=Math.max(0,a.start),x=Math.min(f.count,a.start+a.count);for(let S=m,p=x-1;S<p;S+=c){const h=f.getX(S),b=f.getX(S+1),R=Ki(this,e,vi,l,h,b,S);R&&t.push(R)}if(this.isLineLoop){const S=f.getX(x-1),p=f.getX(m),h=Ki(this,e,vi,l,S,p,x-1);h&&t.push(h)}}else{const m=Math.max(0,a.start),x=Math.min(u.count,a.start+a.count);for(let S=m,p=x-1;S<p;S+=c){const h=Ki(this,e,vi,l,S,S+1,S);h&&t.push(h)}if(this.isLineLoop){const S=Ki(this,e,vi,l,x-1,m,x-1);S&&t.push(S)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Ki(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(or.fromBufferAttribute(o,r),lr.fromBufferAttribute(o,s),t.distanceSqToSegment(or,lr,Br,Rs)>n)return;Br.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(Br);if(!(c<e.near||c>e.far))return{distance:c,point:Rs.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const ws=new P,Cs=new P;class po extends fo{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)ws.fromBufferAttribute(t,r),Cs.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ws.distanceTo(Cs);e.setAttribute("lineDistance",new Nt(n,1))}else Le("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Kr extends Gn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ie(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Ps=new et,Zr=new ts,Zi=new On,$i=new P;class Ds extends wt{constructor(e=new Bt,t=new Kr){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Zi.copy(n.boundingSphere),Zi.applyMatrix4(r),Zi.radius+=s,e.ray.intersectsSphere(Zi)===!1)return;Ps.copy(r).invert(),Zr.copy(e.ray).applyMatrix4(Ps);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,g=n.attributes.position;if(c!==null){const u=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let x=u,S=m;x<S;x++){const p=c.getX(x);$i.fromBufferAttribute(g,p),Ls($i,p,l,r,e,t,this)}}else{const u=Math.max(0,a.start),m=Math.min(g.count,a.start+a.count);for(let x=u,S=m;x<S;x++)$i.fromBufferAttribute(g,x),Ls($i,x,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Ls(i,e,t,n,r,s,a){const o=Zr.distanceSqToPoint(i);if(o<t){const l=new P;Zr.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ta extends Ut{constructor(e=[],t=301,n,r,s,a,o,l,c,f){super(e,t,n,r,s,a,o,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ai extends Ut{constructor(e,t,n=1014,r,s,a,o=1003,l=1003,c,f=1026,g=1){if(f!==1026&&f!==1027)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:g};super(u,r,s,a,o,l,f,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new jr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class mo extends ai{constructor(e,t=1014,n=301,r,s,a=1003,o=1003,l,c=1026){const f={width:e,height:e,depth:1},g=[f,f,f,f,f,f];super(e,e,t,n,r,s,a,o,l,c),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ba extends Ut{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class li extends Bt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],f=[],g=[];let u=0,m=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1
vendor: 6,574 bytes, lines 5-9
5),x("x","z","y",1,1,e,n,t,r,a,2),x("x","z","y",1,-1,e,n,-t,r,a,3),x("x","y","z",1,-1,e,t,n,r,s,4),x("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Nt(c,3)),this.setAttribute("normal",new Nt(f,3)),this.setAttribute("uv",new Nt(g,2));function x(S,p,h,b,R,M,A,y,C,_,T){const I=M/C,D=A/_,N=M/2,K=A/2,$=y/2,z=C+1,q=_+1;let k=0,Q=0;const ee=new P;for(let ue=0;ue<q;ue++){const pe=ue*D-K;for(let ve=0;ve<z;ve++){const Xe=ve*I-N;ee[S]=Xe*b,ee[p]=pe*R,ee[h]=$,c.push(ee.x,ee.y,ee.z),ee[S]=0,ee[p]=0,ee[h]=y>0?1:-1,f.push(ee.x,ee.y,ee.z),g.push(ve/C),g.push(1-ue/_),k+=1}}for(let ue=0;ue<_;ue++)for(let pe=0;pe<C;pe++){const ve=u+pe+z*ue,Xe=u+pe+z*(ue+1),tt=u+(pe+1)+z*(ue+1),Ne=u+(pe+1)+z*ue;l.push(ve,Xe,Ne),l.push(Xe,tt,Ne),Q+=6}o.addGroup(m,Q,T),m+=Q,u+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new li(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class bi extends Bt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,f=l+1,g=e/o,u=t/l,m=[],x=[],S=[],p=[];for(let h=0;h<f;h++){const b=h*u-a;for(let R=0;R<c;R++){const M=R*g-s;x.push(M,-b,0),S.push(0,0,1),p.push(R/o),p.push(1-h/l)}}for(let h=0;h<l;h++)for(let b=0;b<o;b++){const R=b+c*h,M=b+c*(h+1),A=b+1+c*(h+1),y=b+1+c*h;m.push(R,M,y),m.push(M,A,y)}this.setIndex(m),this.setAttribute("position",new Nt(x,3)),this.setAttribute("normal",new Nt(S,3)),this.setAttribute("uv",new Nt(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bi(e.width,e.height,e.widthSegments,e.heightSegments)}}class is extends Bt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const f=[],g=new P,u=new P,m=[],x=[],S=[],p=[];for(let h=0;h<=n;h++){const b=[],R=h/n,M=a+R*o,A=e*Math.cos(M),y=Math.sqrt(e*e-A*A);let C=0;h===0&&a===0?C=.5/t:h===n&&l===Math.PI&&(C=-.5/t);for(let _=0;_<=t;_++){const T=_/t,I=r+T*s;g.x=-y*Math.cos(I),g.y=A,g.z=y*Math.sin(I),x.push(g.x,g.y,g.z),u.copy(g).normalize(),S.push(u.x,u.y,u.z),p.push(T+C,1-R),b.push(c++)}f.push(b)}for(let h=0;h<n;h++)for(let b=0;b<t;b++){const R=f[h][b+1],M=f[h][b],A=f[h+1][b],y=f[h+1][b+1];(h!==0||a>0)&&m.push(R,M,y),(h!==n-1||l<Math.PI)&&m.push(M,A,y)}this.setIndex(m),this.setAttribute("position",new Nt(x,3)),this.setAttribute("normal",new Nt(S,3)),this.setAttribute("uv",new Nt(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new is(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function oi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(Fs(r))r.isRenderTargetTexture?(Le("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(Fs(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function It(i){const e={};for(let t=0;t<i.length;t++){const n=oi(i[t]);for(const r in n)e[r]=n[r]}return e}function Fs(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function go(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Aa(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ye.workingColorSpace}const _o={clone:oi,merge:It};var xo=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,vo=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class Jt extends Gn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=xo,this.fragmentShader=vo,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=oi(e.uniforms),this.uniformsGroups=go(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ie().setHex(r.value);break;case"v2":this.uniforms[n].value=new We().fromArray(r.value);break;case"v3":this.uniforms[n].value=new P().fromArray(r.value);break;case"v4":this.uniforms[n].value=new ft().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Be().fromArray(r.value);break;
9case"m4":this.uniforms[n].value=new et().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Mo extends Jt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Is extends Gn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Cn,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class So extends Gn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}class Eo extends Gn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class rs extends wt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ie(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const Or=new et,Us=new P,Ns=new P;class Ra{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new et,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ns,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new ft(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Us.setFromMatrixPosition(e.matrixWorld),t.position.copy(Us),Ns.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ns),t.updateMatrixWorld(),Or.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Or,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Or)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 4,192 bytes, line 9
9ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Ji=new P,Qi=new cn,sn=new P;class wa extends wt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Ji,Qi,sn),sn.x===1&&sn.y===1&&sn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ji,Qi,sn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Ji,Qi,sn),sn.x===1&&sn.y===1&&sn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ji,Qi,sn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const An=new P,Bs=new We,Os=new We;class Xt extends wa{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=qr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(fr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return qr*2*Math.atan(Math.tan(fr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){An.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(An.x,An.y).multiplyScalar(-e/An.z),An.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(An.x,An.y).multiplyScalar(-e/An.z)}getViewSize(e,t){return this.getViewBounds(e,Bs,Os),t.subVectors(Os,Bs)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(fr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class yo extends Ra{constructor(){super(new Xt(90,1,.5,500)),this.isPointLightShadow=!0}
9}class To extends rs{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new yo}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class cr extends wa{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=f*this.view.offsetY,l=o-f*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class bo extends Ra{constructor(){super(new cr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Gs extends rs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wt.DEFAULT_UP),this.updateMatrix(),this.target=new wt,this.shadow=new bo}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Ao extends rs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const ti=-90,ni=1;class Ro extends wt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Xt(ti,ni,e,t);r.layers=this.layers,this.add(r);const s=new Xt(ti,ni,e,t);s.layers=this.layers,this.add(s);const a=new Xt(ti,ni,e,t);a.layers=this.layers,this.add(a);const o=new Xt(ti,ni,e,t);o.layers=this.layers,this.add(o);const l=new Xt(ti,ni,e,t);l.layers=this.layers,this.add(l);const c=new Xt(ti,ni,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,f]=this.children,g=e.getRenderTarget(),u=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let p=!1;e.isWebGLRenderer===!0?p=e.state.buffers.depth.getReversed():p=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=S,e.setRenderTarget(n,5,r),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),e.setRenderTarget(g,u,m),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class wo extends Xt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ca{static{Ca.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}}function zs(i,e,t,n){const r=Co(n);switch(t){case 1021:return i*e;case 1028:return i*e/r.components*r.byteLength;case 1029:return i*e/r.components*r.byteLength;case 1030:return i*e*2/r.components*r.byteLength;case 1031:return i*e*2/r.components*r.byteLength;case 1022:return i*e*3/r.components*r.byteLength;case 1023:return i*e*4/r.components*r.byteLength;case 1033:return i*e*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case 33778:case 33779:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case 35841:case 35843:return Math.max(i,16)*Math.max(e,8)/4;case 35840:case 35842:return Math.max(i,8)*Math.max(e,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case 37808:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;
9case 37809:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case 37810:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case 37811:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case 37812:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case 37813:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case 37814:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case 37815:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case 37816:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case 37817:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case 37818:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case 37819:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case 37820:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case 37821:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(i/4)*Math.ceil(e/4)*16;case 36283:case 36284:return Math.ceil(i/4)*Math.ceil(e/4)*8;case 36285:case 36286:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Co(i){switch(i){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Qr}}));typeof window<"u"&&(window.__THREE__?Le("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Qr);/**
10 * @license
11 * Copyright 2010-2026 Three.js Authors
12 * SPDX-License-Identifier: MIT
13 */function Pa(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Po(i){const e=new WeakMap;function t(o,l){const c=o.array,f=o.usage,g=c.byteLength,u=i.createBuffer();i.bindBuffer(l,u),i.bufferData(l,c,f),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)m=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:g}}function n(o,l,c){const f=l.array,g=l.updateRanges;if(i.bindBuffer(c,o),g.length===0)i.bufferSubData(c,0,f);else{g.sort((m,x)=>m.start-x.start);let u=0;for(let m=1;m<g.length;m++){const x=g[u],S=g[m];S.start<=x.start+x.count+1?x.count=Math.max(x.count,S.start+S.count-x.start):(++u,g[u]=S)}g.length=u+1;for(let m=0,x=g.length;m<x;m++){const S=g[m];i.bufferSubData(c,S.start*f.BYTES_PER_ELEMENT,f,S.start,S.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const f=e.get(o);(!f||f.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Do=`#ifdef USE_ALPHAHASH
14	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
15#endif`,Lo=`#ifdef USE_ALPHAHASH
16	const float ALPHA_HASH_SCALE = 0.05;
17	float hash2D( vec2 value ) {
18		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
19	}
20	float hash3D( vec3 value ) {
21		return hash2D( vec2( hash2D( value.xy ), value.z ) );
22	}
23	float getAlphaHashThreshold( vec3 position ) {
24		float maxDeriv = max(
25			length( dFdx( position.xyz ) ),
26			length( dFdy( position.xyz ) )
27		);
28		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
29		vec2 pixScales = vec2(
30			exp2( floor( log2( pixScale ) ) ),
31			exp2( ceil( log2( pixScale ) ) )
32		);
33		vec2 alpha = vec2(
34			hash3D( floor( pixScales.x * position.xyz ) ),
35			hash3D( floor( pixScales.y * position.xyz ) )
36		);
37		float lerpFactor = fract( log2( pixScale ) );
38		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
39		float a = min( lerpFactor, 1.0 - lerpFactor );
40		vec3 cases = vec3(
41			x * x / ( 2.0 * a * ( 1.0 - a ) ),
42			( x - 0.5 * a ) / ( 1.0 - a ),
43			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
44		);
45		float threshold = ( x < ( 1.0 - a ) )
46			? ( ( x < a ) ? cases.x : cases.y )
47			: cases.z;
48		return clamp( threshold , 1.0e-6, 1.0 );
49	}
50#endif`,Fo=`#ifdef USE_ALPHAMAP
51	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
52#endif`,Io=`#ifdef USE_ALPHAMAP
53	uniform sampler2D alphaMap;
54#endif`,Uo=`#ifdef USE_ALPHATEST
55	#ifdef ALPHA_TO_COVERAGE
56	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
57	if ( diffuseColor.a == 0.0 ) discard;
58	#else
59	if ( diffuseColor.a < alphaTest ) discard;
60	#endif
61#endif`,No=`#ifdef USE_ALPHATEST
62	uniform float alphaTest;
63#endif`,Bo=`#ifdef USE_AOMAP
64	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
65	reflectedLight.indirectDiffuse *= ambientOcclusion;
66	#if defined( USE_CLEARCOAT ) 
67		clearcoatSpecularIndirect *= ambientOcclusion;
68	#endif
69	#if defined( USE_SHEEN ) 
70		sheenSpecularIndirect *= ambientOcclusion;
71	#endif
72	#if defined( USE_ENVMAP ) && defined( STANDARD )
73		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
74		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
75	#endif
76#endif`,Oo=`#ifdef USE_AOMAP
77	uniform sampler2D aoMap;
78	uniform float aoMapIntensity;
79#endif`,Go=`#ifdef USE_BATCHING
80	#if ! defined( GL_ANGLE_multi_draw )
81	#define gl_DrawID _gl_DrawID
82	uniform int _gl_DrawID;
83	#endif
84	uniform highp sampler2D batchingTexture;
85	uniform highp usampler2D batchingIdTexture;
86	mat4 getBatchingMatrix( const in float i ) {
87		int size = textureSize( batchingTexture, 0 ).x;
88		int j = int( i ) * 4;
89		int x = j % size;
90		int y = j / size;
91		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
92		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
93		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
94		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
95		return mat4( v1, v2, v3, v4 );
96	}
97	float getIndirectIndex( const in int i ) {
98		int size = textureSize( batchingIdTexture, 0 ).x;
99		int x = i % size;
100		int y = i / size;
101		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
102	}
103#endif
104#ifdef USE_BATCHING_COLOR
105	uniform sampler2D batchingColorTexture;
106	vec4 getBatchingColor( const in float i ) {
107		int size = textureSize( batchingColorTexture, 0 ).x;
108		int j = int( i );
109		int x = j % size;
110		int y = j / size;
111		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
112	}
113#endif`,zo=`#ifdef USE_BATCHING
114	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
115#endif`,Vo=`vec3 transformed = vec3( position );
116#ifdef USE_ALPHAHASH
117	vPosition = vec3( position );
118#endif`,Ho=`vec3 objectNormal = vec3( normal );
119#ifdef USE_TANGENT
120	vec3 objectTangent = vec3( tangent.xyz );
121#endif`,ko=`float G_BlinnPhong_Implicit( ) {
122	return 0.25;
123}
124float D_BlinnPhong( const in float shininess, const in float dotNH ) {
125	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
128	vec3 halfDir = normalize( lightDir + viewDir );
129	float dotNH = saturate( dot( normal, halfDir ) );
130	float dotVH = saturate( dot( viewDir, halfDir ) );
131	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
132	float G = G_BlinnPhong_Implicit( );
133	float D = D_BlinnPhong( shininess, dotNH );
134	return F * ( G * D );
135} // validated`,Wo=`#ifdef USE_IRIDESCENCE
136	const mat3 XYZ_TO_REC709 = mat3(
137		 3.2404542, -0.9692660,  0.0556434,
138		-1.5371385,  1.8760108, -0.2040259,
139		-0.4985314,  0.0415560,  1.0572252
140	);
141	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
142		vec3 sqrtF0 = sqrt( fresnel0 );
143		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
144	}
145	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
146		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
147	}
148	float IorToFresnel0( float transmittedIor, float incidentIor ) {
149		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
150	}
151	vec3 evalSensitivity( float OPD, vec3 shift ) {
152		float phase = 2.0 * PI * OPD * 1.0e-9;
153		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
154		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
155		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
156		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
157		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
158		xyz /= 1.0685e-7;
159		vec3 rgb = XYZ_TO_REC709 * xyz;
160		return rgb;
161	}
162	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
163		vec3 I;
164		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
165		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
166		float cosTheta2Sq = 1.0 - sinTheta2Sq;
167		if ( cosTheta2Sq < 0.0 ) {
168			return vec3( 1.0 );
169		}
170		float cosTheta2 = sqrt( cosTheta2Sq );
171		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
172		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173		float T121 = 1.0 - R12;
174		float phi12 = 0.0;
175		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
176		float phi21 = PI - phi12;
177		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
178		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
179		vec3 phi23 = vec3( 0.0 );
180		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
181		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
182		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
183		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
184		vec3 phi = vec3( phi21 ) + phi23;
185		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
186		vec3 r123 = sqrt( R123 );
187		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
188		vec3 C0 = R12 + Rs;
189		I = C0;
190		vec3 Cm = Rs - T121;
191		for ( int m = 1; m <= 2; ++ m ) {
192			Cm *= r123;
193			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
194			I += Cm * Sm;
195		}
196		return max( I, vec3( 0.0 ) );
197	}
198#endif`,Xo=`#ifdef USE_BUMPMAP
199	uniform sampler2D bumpMap;
200	uniform float bumpScale;
201	vec2 dHdxy_fwd() {
202		vec2 dSTdx = dFdx( vBumpMapUv );
203		vec2 dSTdy = dFdy( vBumpMapUv );
204		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
205		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
206		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
207		return vec2( dBx, dBy );
208	}
209	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
210		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
211		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
212		vec3 vN = surf_norm;
213		vec3 R1 = cross( vSigmaY, vN );
214		vec3 R2 = cross( vN, vSigmaX );
215		float fDet = dot( vSigmaX, R1 ) * faceDirection;
216		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
217		return normalize( abs( fDet ) * surf_norm - vGrad );
218	}
219#endif`,qo=`#if NUM_CLIPPING_PLANES > 0
220	vec4 plane;
221	#ifdef ALPHA_TO_COVERAGE
222		float distanceToPlane, distanceGradient;
223		float clipOpacity = 1.0;
224		#pragma unroll_loop_start
225		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
226			plane = clippingPlanes[ i ];
227			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
228			distanceGradient = fwidth( distanceToPlane ) / 2.0;
229			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
230			if ( clipOpacity == 0.0 ) discard;
231		}
232		#pragma unroll_loop_end
233		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
234			float unionClipOpacity = 1.0;
235			#pragma unroll_loop_start
236			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
237				plane = clippingPlanes[ i ];
238				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
239				distanceGradient = fwidth( distanceToPlane ) / 2.0;
240				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
241			}
242			#pragma unroll_loop_end
243			clipOpacity *= 1.0 - unionClipOpacity;
244		#endif
245		diffuseColor.a *= clipOpacity;
246		if ( diffuseColor.a == 0.0 ) discard;
247	#else
248		#pragma unroll_loop_start
249		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
250			plane = clippingPlanes[ i ];
251			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
252		}
253		#pragma unroll_loop_end
254		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
255			bool clipped = true;
256			#pragma unroll_loop_start
257			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
258				plane = clippingPlanes[ i ];
259				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
260			}
261			#pragma unroll_loop_end
262			if ( clipped ) discard;
263		#endif
264	#endif
265#endif`,Yo=`#if NUM_CLIPPING_PLANES > 0
266	varying vec3 vClipPosition;
267	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
268#endif`,Ko=`#if NUM_CLIPPING_PLANES > 0
269	varying vec3 vClipPosition;
270#endif`,Zo=`#if NUM_CLIPPING_PLANES > 0
271	vClipPosition = - mvPosition.xyz;
272#endif`,$o=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
273	diffuseColor *= vColor;
274#endif`,Jo=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
275	varying vec4 vColor;
276#endif`,Qo=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
277	varying vec4 vColor;
278#endif`,jo=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
279	vColor = vec4( 1.0 );
280#endif
281#ifdef USE_COLOR_ALPHA
282	vColor *= color;
283#elif defined( USE_COLOR )
284	vColor.rgb *= color;
285#endif
286#ifdef USE_INSTANCING_COLOR
287	vColor.rgb *= instanceColor.rgb;
288#endif
289#ifdef USE_BATCHING_COLOR
290	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
291#endif`,el=`#define PI 3.141592653589793
292#define PI2 6.283185307179586
293#define PI_HALF 1.5707963267948966
294#define RECIPROCAL_PI 0.3183098861837907
295#define RECIPROCAL_PI2 0.15915494309189535
296#define EPSILON 1e-6
297#ifndef saturate
298#define saturate( a ) clamp( a, 0.0, 1.0 )
299#endif
300#define whiteComplement( a ) ( 1.0 - saturate( a ) )
301float pow2( const in float x ) { return x*x; }
302vec3 pow2( const in vec3 x ) { return x*x; }
303float pow3( const in float x ) { return x*x*x; }
304float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
307highp float rand( const in vec2 uv ) {
308	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
309	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
310	return fract( sin( sn ) * c );
311}
312#ifdef HIGH_PRECISION
313	float precisionSafeLength( vec3 v ) { return length( v ); }
314#else
315	float precisionSafeLength( vec3 v ) {
316		float maxComponent = max3( abs( v ) );
317		return length( v / maxComponent ) * maxComponent;
318	}
319#endif
320struct IncidentLight {
321	vec3 color;
322	vec3 direction;
323	bool visible;
324};
325struct ReflectedLight {
326	vec3 directDiffuse;
327	vec3 directSpecular;
328	vec3 indirectDiffuse;
329	vec3 indirectSpecular;
330};
331#ifdef USE_ALPHAHASH
332	varying vec3 vPosition;
333#endif
334vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
335	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
336}
337#define inverseTransformDirection transformDirectionByInverseViewMatrix
338vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
339	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
340}
341vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
342	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
343}
344bool isPerspectiveMatrix( mat4 m ) {
345	return m[ 2 ][ 3 ] == - 1.0;
346}
347vec2 equirectUv( in vec3 dir ) {
348	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
349	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
350	return vec2( u, v );
351}
352vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
353	return RECIPROCAL_PI * diffuseColor;
354}
355vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
356	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
357	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
358}
359float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
360	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
361	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
362} // validated`,tl=`#ifdef ENVMAP_TYPE_CUBE_UV
363	#define cubeUV_minMipLevel 4.0
364	#define cubeUV_minTileSize 16.0
365	float getFace( vec3 direction ) {
366		vec3 absDirection = abs( direction );
367		float face = - 1.0;
368		if ( absDirection.x > absDirection.z ) {
369			if ( absDirection.x > absDirection.y )
370				face = direction.x > 0.0 ? 0.0 : 3.0;
371			else
372				face = direction.y > 0.0 ? 1.0 : 4.0;
373		} else {
374			if ( absDirection.z > absDirection.y )
375				face = direction.z > 0.0 ? 2.0 : 5.0;
376			else
377				face = direction.y > 0.0 ? 1.0 : 4.0;
378		}
379		return face;
380	}
381	vec2 getUV( vec3 direction, float face ) {
382		vec2 uv;
383		if ( face == 0.0 ) {
384			uv = vec2( direction.z, direction.y ) / abs( direction.x );
385		} else if ( face == 1.0 ) {
386			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
387		} else if ( face == 2.0 ) {
388			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
389		} else if ( face == 3.0 ) {
390			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
391		} else if ( face == 4.0 ) {
392			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
393		} else {
394			uv = vec2( direction.x, direction.y ) / abs( direction.z );
395		}
396		return 0.5 * ( uv + 1.0 );
397	}
398	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
399		float face = getFace( direction );
400		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
401		mipInt = max( mipInt, cubeUV_minMipLevel );
402		float faceSize = exp2( mipInt );
403		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
404		if ( face > 2.0 ) {
405			uv.y += faceSize;
406			face -= 3.0;
407		}
408		uv.x += face * faceSize;
409		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
410		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
411		uv.x *= CUBEUV_TEXEL_WIDTH;
412		uv.y *= CUBEUV_TEXEL_HEIGHT;
413		#ifdef texture2DGradEXT
414			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
415		#else
416			return texture2D( envMap, uv ).rgb;
417		#endif
418	}
419	#define cubeUV_r0 1.0
420	#define cubeUV_m0 - 2.0
421	#define cubeUV_r1 0.8
422	#define cubeUV_m1 - 1.0
423	#define cubeUV_r4 0.4
424	#define cubeUV_m4 2.0
425	#define cubeUV_r5 0.305
426	#define cubeUV_m5 3.0
427	#define cubeUV_r6 0.21
428	#define cubeUV_m6 4.0
429	float roughnessToMip( float roughness ) {
430		float mip = 0.0;
431		if ( roughness >= cubeUV_r1 ) {
432			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
433		} else if ( roughness >= cubeUV_r4 ) {
434			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
435		} else if ( roughness >= cubeUV_r5 ) {
436			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
437		} else if ( roughness >= cubeUV_r6 ) {
438			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
439		} else {
440			mip = - 2.0 * log2( 1.16 * roughness );		}
441		return mip;
442	}
443	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
444		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
445		float mipF = fract( mip );
446		float mipInt = floor( mip );
447		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
448		if ( mipF == 0.0 ) {
449			return vec4( color0, 1.0 );
450		} else {
451			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
452			return vec4( mix( color0, color1, mipF ), 1.0 );
453		}
454	}
455#endif`,nl=`vec3 transformedNormal = objectNormal;
456#ifdef USE_TANGENT
457	vec3 transformedTangent = objectTangent;
458#endif
459#ifdef USE_BATCHING
460	mat3 bm = mat3( batchingMatrix );
461	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
462	transformedNormal = bm * transformedNormal;
463	#ifdef USE_TANGENT
464		transformedTangent = bm * transformedTangent;
465	#endif
466#endif
467#ifdef USE_INSTANCING
468	mat3 im = mat3( instanceMatrix );
469	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
470	transformedNormal = im * transformedNormal;
471	#ifdef USE_TANGENT
472		transformedTangent = im * transformedTangent;
473	#endif
474#endif
475transformedNormal = normalMatrix * transformedNormal;
476#ifdef FLIP_SIDED
477	transformedNormal = - transformedNormal;
478#endif
479#ifdef USE_TANGENT
480	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
481#endif`,il=`#ifdef USE_DISPLACEMENTMAP
482	uniform sampler2D displacementMap;
483	uniform float displacementScale;
484	uniform float displacementBias;
485#endif`,rl=`#ifdef USE_DISPLACEMENTMAP
486	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
486placementBias );
487#endif`,sl=`#ifdef USE_EMISSIVEMAP
488	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
489	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
490		emissiveColor = sRGBTransferEOTF( emissiveColor );
491	#endif
492	totalEmissiveRadiance *= emissiveColor.rgb;
493#endif`,al=`#ifdef USE_EMISSIVEMAP
494	uniform sampler2D emissiveMap;
495#endif`,ol="gl_FragColor = linearToOutputTexel( gl_FragColor );",ll=`vec4 LinearTransferOETF( in vec4 value ) {
496	return value;
497}
498vec4 sRGBTransferEOTF( in vec4 value ) {
499	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.a );
500}
501vec4 sRGBTransferOETF( in vec4 value ) {
502	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.a );
503}`,cl=`#ifdef USE_ENVMAP
504	#ifdef ENV_WORLDPOS
505		vec3 cameraToFrag;
506		if ( isOrthographic ) {
507			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
508		} else {
509			cameraToFrag = normalize( vWorldPosition - cameraPosition );
510		}
511		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
512		#ifdef ENVMAP_MODE_REFLECTION
513			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
514		#else
515			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
516		#endif
517	#else
518		vec3 reflectVec = vReflect;
519	#endif
520	#ifdef ENVMAP_TYPE_CUBE
521		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
522		#ifdef ENVMAP_BLENDING_MULTIPLY
523			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
524		#elif defined( ENVMAP_BLENDING_MIX )
525			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
526		#elif defined( ENVMAP_BLENDING_ADD )
527			outgoingLight += envColor.xyz * specularStrength * reflectivity;
528		#endif
529	#endif
530#endif`,ul=`#ifdef USE_ENVMAP
531	uniform float envMapIntensity;
532	uniform mat3 envMapRotation;
533	#ifdef ENVMAP_TYPE_CUBE
534		uniform samplerCube envMap;
535	#else
536		uniform sampler2D envMap;
537	#endif
538#endif`,hl=`#ifdef USE_ENVMAP
539	uniform float reflectivity;
540	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
541		#define ENV_WORLDPOS
542	#endif
543	#ifdef ENV_WORLDPOS
544		varying vec3 vWorldPosition;
545		uniform float refractionRatio;
546	#else
547		varying vec3 vReflect;
548	#endif
549#endif`,dl=`#ifdef USE_ENVMAP
550	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
551		#define ENV_WORLDPOS
552	#endif
553	#ifdef ENV_WORLDPOS
554		
555		varying vec3 vWorldPosition;
556	#else
557		varying vec3 vReflect;
558		uniform float refractionRatio;
559	#endif
560#endif`,fl=`#ifdef USE_ENVMAP
561	#ifdef ENV_WORLDPOS
562		vWorldPosition = worldPosition.xyz;
563	#else
564		vec3 cameraToVertex;
565		if ( isOrthographic ) {
566			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
567		} else {
568			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
569		}
570		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
571		#ifdef ENVMAP_MODE_REFLECTION
572			vReflect = reflect( cameraToVertex, worldNormal );
573		#else
574			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
575		#endif
576	#endif
577#endif`,pl=`#ifdef USE_FOG
578	vFogDepth = - mvPosition.z;
579#endif`,ml=`#ifdef USE_FOG
580	varying float vFogDepth;
581#endif`,gl=`#ifdef USE_FOG
582	#ifdef FOG_EXP2
583		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
584	#else
585		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
586	#endif
587	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
588#endif`,_l=`#ifdef USE_FOG
589	uniform vec3 fogColor;
590	varying float vFogDepth;
591	#ifdef FOG_EXP2
592		uniform float fogDensity;
593	#else
594		uniform float fogNear;
595		uniform float fogFar;
596	#endif
597#endif`,xl=`#ifdef USE_GRADIENTMAP
598	uniform sampler2D gradientMap;
599#endif
600vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
601	float dotNL = dot( normal, lightDirection );
602	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
603	#ifdef USE_GRADIENTMAP
604		return vec3( texture2D( gradientMap, coord ).r );
605	#else
606		vec2 fw = fwidth( coord ) * 0.5;
607		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
608	#endif
609}`,vl=`#ifdef USE_LIGHTMAP
610	uniform sampler2D lightMap;
611	uniform float lightMapIntensity;
612#endif`,Ml=`LambertMaterial material;
613material.diffuseColor = diffuseColor.rgb;
614material.specularStrength = specularStrength;`,Sl=`varying vec3 vViewPosition;
615struct LambertMaterial {
616	vec3 diffuseColor;
617	float specularStrength;
618};
619void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
620	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
621	vec3 irradiance = dotNL * directLight.color;
622	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
623}
624void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
625	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
626}
627#define RE_Direct				RE_Direct_Lambert
628#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,El=`uniform bool receiveShadow;
629uniform vec3 ambientLightColor;
630#if defined( USE_LIGHT_PROBES )
631	uniform vec3 lightProbe[ 9 ];
632#endif
633vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
634	float x = normal.x, y = normal.y, z = normal.z;
635	vec3 result = shCoefficients[ 0 ] * 0.886227;
636	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
637	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
638	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
639	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
640	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
641	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
642	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
643	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
644	return result;
645}
646vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
647	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
648	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
649	return irradiance;
650}
651vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
652	vec3 irradiance = ambientLightColor;
653	return irradiance;
654}
655float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
656	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
657	if ( cutoffDistance > 0.0 ) {
658		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
659	}
660	return distanceFalloff;
661}
662float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
663	return smoothstep( coneCosine, penumbraCosine, angleCosine );
664}
665#if NUM_DIR_LIGHTS > 0
666	struct DirectionalLight {
667		vec3 direction;
668		vec3 color;
669	};
670	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
671	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
672		light.color = directionalLight.color;
673		light.direction = directionalLight.direction;
674		light.visible = true;
675	}
676#endif
677#if NUM_POINT_LIGHTS > 0
678	struct PointLight {
679		vec3 position;
680		vec3 color;
681		float distance;
682		float decay;
683	};
684	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
685	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
686		vec3 lVector = pointLight.position - geometryPosition;
687		light.direction = normalize( lVector );
688		float lightDistance = length( lVector );
689		light.color = pointLight.color;
690		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
691		light.visible = ( light.color != vec3( 0.0 ) );
692	}
693#endif
694#if NUM_SPOT_LIGHTS > 0
695	struct SpotLight {
696		vec3 position;
697		vec3 direction;
698		vec3 color;
699		float distance;
700		float decay;
701		float coneCos;
702		float penumbraCos;
703	};
704	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
705	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
706		vec3 lVector = spotLight.position - geometryPosition;
707		light.direction = normalize( lVector );
708		float angleCos = dot( light.direction, spotLight.direction );
709		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
710		if ( spotAttenuation > 0.0 ) {
711			float lightDistance = length( lVector );
712			light.color = spotLight.color * spotAttenuation;
713			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
714			light.visible = ( light.color != vec3( 0.0 ) );
715		} else {
716			light.color = vec3( 0.0 );
717			light.visible = false;
718		}
719	}
720#endif
721#if NUM_RECT_AREA_LIGHTS > 0
722	struct RectAreaLight {
723		vec3 color;
724		vec3 position;
725		vec3 halfWidth;
726		vec3 halfHeight;
727	};
728	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
729	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
730#endif
731#if NUM_HEMI_LIGHTS > 0
732	struct HemisphereLight {
733		vec3 direction;
734		vec3 skyColor;
735		vec3 groundColor;
736	};
737	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
738	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
739		float dotNL = dot( normal, hemiLight.direction );
740		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
741		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
742		return irradiance;
743	}
744#endif
745#include <lightprobes_pars_fragment>`,yl=`#ifdef USE_ENVMAP
746	vec3 getIBLIrradiance( const in vec3 normal ) {
747		#ifdef ENVMAP_TYPE_CUBE_UV
748			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
749			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
750			return PI * envMapColor.rgb * envMapIntensity;
751		#else
752			return vec3( 0.0 );
753		#endif
754	}
755	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
756		#ifdef ENVMAP_TYPE_CUBE_UV
757			vec3 reflectVec = reflect( - viewDir, normal );
758			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
759			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
760			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
761			return envMapColor.rgb * envMapIntensity;
762		#else
763			return vec3( 0.0 );
764		#endif
765	}
766	#ifdef USE_ANISOTROPY
767		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
768			#ifdef ENVMAP_TYPE_CUBE_UV
769				vec3 bentNormal = cross( bitangent, viewDir );
770				bentNormal = normalize( cross( bentNormal, bitangent ) );
771				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
772				return getIBLRadiance( viewDir, bentNormal, roughness );
773			#else
774				return vec3( 0.0 );
775			#endif
776		}
777	#endif
778#endif`,Tl=`ToonMaterial material;
779material.diffuseColor = diffuseColor.rgb;`,bl=`varying vec3 vViewPosition;
780struct ToonMaterial {
781	vec3 diffuseColor;
782};
783void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
784	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
785	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
786}
787void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
788	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
789}
790#define RE_Direct				RE_Direct_Toon
791#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Al=`BlinnPhongMaterial material;
792material.diffuseColor = diffuseColor.rgb;
793material.specularColor = specular;
794material.specularShininess = shininess;
795material.specularStrength = specularStrength;`,Rl=`varying vec3 vViewPosition;
796struct BlinnPhongMaterial {
797	vec3 diffuseColor;
798	vec3 specularColor;
799	float specularShininess;
800	float specularStrength;
801};
802void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
803	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
804	vec3 irradiance = dotNL * directLight.color;
805	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
806	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
807}
808void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
809	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
810}
811#define RE_Direct				RE_Direct_BlinnPhong
812#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,wl=`PhysicalMaterial material;
813material.diffuseColor = diffuseColor.rgb;
814material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
815material.metalness = metalnessFactor;
816vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
817float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
818material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
819material.roughness = min( material.roughness, 1.0 );
820#ifdef IOR
821	material.ior = ior;
822	#ifdef USE_SPECULAR
823		float specularIntensityFactor = specularIntensity;
824		vec3 specularColorFactor = specularColor;
825		#ifdef USE_SPECULAR_COLORMAP
826			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
827		#endif
828		#ifdef USE_SPECULAR_INTENSITYMAP
829			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
830		#endif
831		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
832	#else
833		float specularIntensityFactor = 1.0;
834		vec3 specularColorFactor = vec3( 1.0 );
835		material.specularF90 = 1.0;
836	#endif
837	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
838	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
839#else
840	material.specularColor = vec3( 0.04 );
841	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
842	material.specularF90 = 1.0;
843#endif
844#ifdef USE_CLEARCOAT
845	material.clearcoat = clearcoat;
846	material.clearcoatRoughness = clearcoatRoughness;
847	material.clearcoatF0 = vec3( 0.04 );
848	material.clearcoatF90 = 1.0;
849	#ifdef USE_CLEARCOATMAP
850		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
851	#endif
852	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
853		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
854	#endif
855	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
856	material.clearcoatRoughness += geometryRoughness;
857	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
858#endif
859#ifdef USE_DISPERSION
860	material.dispersion = dispersion;
861#endif
862#ifdef USE_IRIDESCENCE
863	material.iridescence = iridescence;
864	material.iridescenceIOR = iridescenceIOR;
865	#ifdef USE_IRIDESCENCEMAP
866		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
867	#endif
868	#ifdef USE_IRIDESCENCE_THICKNESSMAP
869		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
870	#else
871		material.iridescenceThickness = iridescenceThicknessMaximum;
872	#endif
873#endif
874#ifdef USE_SHEEN
875	material.sheenColor = sheenColor;
876	#ifdef USE_SHEEN_COLORMAP
877		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
878	#endif
879	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
880	#ifdef USE_SHEEN_ROUGHNESSMAP
881		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
882	#endif
883#endif
884#ifdef USE_ANISOTROPY
885	#ifdef USE_ANISOTROPYMAP
886		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
887		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
888		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
889	#else
890		vec2 anisotropyV = anisotropyVector;
891	#endif
892	material.anisotropy = length( anisotropyV );
893	if( material.anisotropy == 0.0 ) {
894		anisotropyV = vec2( 1.0, 0.0 );
895	} else {
896		anisotropyV /= material.anisotropy;
897		material.anisotropy = saturate( material.anisotropy );
898	}
899	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
900	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
901	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
902#endif`,Cl=`uniform sampler2D dfgLUT;
903struct PhysicalMaterial {
904	vec3 diffuseColor;
905	vec3 diffuseContribution;
906	vec3 specularColor;
907	vec3 specularColorBlended;
908	float roughness;
909	float metalness;
910	float specularF90;
911	float dispersion;
912	#ifdef USE_CLEARCOAT
913		float clearcoat;
914		float clearcoatRoughness;
915		vec3 clearcoatF0;
916		float clearcoatF90;
917	#endif
918	#ifdef USE_IRIDESCENCE
919		float iridescence;
920		float iridescenceIOR;
921		float iridescenceThickness;
922		vec3 iridescenceFresnel;
923		vec3 iridescenceF0;
924		vec3 iridescenceFresnelDielectric;
925		vec3 iridescenceFresnelMetallic;
926	#endif
927	#ifdef USE_SHEEN
928		vec3 sheenColor;
929		float sheenRoughness;
930	#endif
931	#ifdef IOR
932		float ior;
933	#endif
934	#ifdef USE_TRANSMISSION
935		float transmission;
936		float transmissionAlpha;
937		float thickness;
938		float attenuationDistance;
939		vec3 attenuationColor;
940	#endif
941	#ifdef USE_ANISOTROPY
942		float anisotropy;
943		float alphaT;
944		vec3 anisotropyT;
945		vec3 anisotropyB;
946	#endif
947};
948vec3 clearcoatSpecularDirect = vec3( 0.0 );
949vec3 clearcoatSpecularIndirect = vec3( 0.0 );
950vec3 sheenSpecularDirect = vec3( 0.0 );
951vec3 sheenSpecularIndirect = vec3(0.0 );
952vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
953    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
954    float x2 = x * x;
955    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
956    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
957}
958float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
959	float a2 = pow2( alpha );
960	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
961	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
962	return 0.5 / max( gv + gl, EPSILON );
963}
964float D_GGX( const in float alpha, const in float dotNH ) {
965	float a2 = pow2( alpha );
966	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
967	return RECIPROCAL_PI * a2 / pow2( denom );
968}
969#ifdef USE_ANISOTROPY
970	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
971		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
972		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
973		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 973-1132
973;
974	}
975	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
976		float a2 = alphaT * alphaB;
977		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
978		highp float v2 = dot( v, v );
979		float w2 = a2 / v2;
980		return RECIPROCAL_PI * a2 * pow2 ( w2 );
981	}
982#endif
983#ifdef USE_CLEARCOAT
984	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
985		vec3 f0 = material.clearcoatF0;
986		float f90 = material.clearcoatF90;
987		float roughness = material.clearcoatRoughness;
988		float alpha = pow2( roughness );
989		vec3 halfDir = normalize( lightDir + viewDir );
990		float dotNL = saturate( dot( normal, lightDir ) );
991		float dotNV = saturate( dot( normal, viewDir ) );
992		float dotNH = saturate( dot( normal, halfDir ) );
993		float dotVH = saturate( dot( viewDir, halfDir ) );
994		vec3 F = F_Schlick( f0, f90, dotVH );
995		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
996		float D = D_GGX( alpha, dotNH );
997		return F * ( V * D );
998	}
999#endif
1000vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1001	vec3 f0 = material.specularColorBlended;
1002	float f90 = material.specularF90;
1003	float roughness = material.roughness;
1004	float alpha = pow2( roughness );
1005	vec3 halfDir = normalize( lightDir + viewDir );
1006	float dotNL = saturate( dot( normal, lightDir ) );
1007	float dotNV = saturate( dot( normal, viewDir ) );
1008	float dotNH = saturate( dot( normal, halfDir ) );
1009	float dotVH = saturate( dot( viewDir, halfDir ) );
1010	vec3 F = F_Schlick( f0, f90, dotVH );
1011	#ifdef USE_IRIDESCENCE
1012		F = mix( F, material.iridescenceFresnel, material.iridescence );
1013	#endif
1014	#ifdef USE_ANISOTROPY
1015		float dotTL = dot( material.anisotropyT, lightDir );
1016		float dotTV = dot( material.anisotropyT, viewDir );
1017		float dotTH = dot( material.anisotropyT, halfDir );
1018		float dotBL = dot( material.anisotropyB, lightDir );
1019		float dotBV = dot( material.anisotropyB, viewDir );
1020		float dotBH = dot( material.anisotropyB, halfDir );
1021		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1022		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1023	#else
1024		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1025		float D = D_GGX( alpha, dotNH );
1026	#endif
1027	return F * ( V * D );
1028}
1029vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1030	const float LUT_SIZE = 64.0;
1031	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1032	const float LUT_BIAS = 0.5 / LUT_SIZE;
1033	float dotNV = saturate( dot( N, V ) );
1034	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1035	uv = uv * LUT_SCALE + LUT_BIAS;
1036	return uv;
1037}
1038float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1039	float l = length( f );
1040	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1041}
1042vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1043	float x = dot( v1, v2 );
1044	float y = abs( x );
1045	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1046	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1047	float v = a / b;
1048	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1049	return cross( v1, v2 ) * theta_sintheta;
1050}
1051vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1052	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1053	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1054	vec3 lightNormal = cross( v1, v2 );
1055	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1056	vec3 T1, T2;
1057	T1 = normalize( V - N * dot( V, N ) );
1058	T2 = - cross( N, T1 );
1059	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1060	vec3 coords[ 4 ];
1061	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1062	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1063	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1064	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1065	coords[ 0 ] = normalize( coords[ 0 ] );
1066	coords[ 1 ] = normalize( coords[ 1 ] );
1067	coords[ 2 ] = normalize( coords[ 2 ] );
1068	coords[ 3 ] = normalize( coords[ 3 ] );
1069	vec3 vectorFormFactor = vec3( 0.0 );
1070	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1071	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1072	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1073	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1074	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1075	return vec3( result );
1076}
1077#if defined( USE_SHEEN )
1078float D_Charlie( float roughness, float dotNH ) {
1079	float alpha = pow2( roughness );
1080	float invAlpha = 1.0 / alpha;
1081	float cos2h = dotNH * dotNH;
1082	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1083	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1084}
1085float V_Neubelt( float dotNV, float dotNL ) {
1086	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1087}
1088vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1089	vec3 halfDir = normalize( lightDir + viewDir );
1090	float dotNL = saturate( dot( normal, lightDir ) );
1091	float dotNV = saturate( dot( normal, viewDir ) );
1092	float dotNH = saturate( dot( normal, halfDir ) );
1093	float D = D_Charlie( sheenRoughness, dotNH );
1094	float V = V_Neubelt( dotNV, dotNL );
1095	return sheenColor * ( D * V );
1096}
1097#endif
1098float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1099	float dotNV = saturate( dot( normal, viewDir ) );
1100	float r2 = roughness * roughness;
1101	float rInv = 1.0 / ( roughness + 0.1 );
1102	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1103	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1104	float DG = exp( a * dotNV + b );
1105	return saturate( DG );
1106}
1107vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1108	float dotNV = saturate( dot( normal, viewDir ) );
1109	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1110	return specularColor * fab.x + specularF90 * fab.y;
1111}
1112#ifdef USE_IRIDESCENCE
1113void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1114#else
1115void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1116#endif
1117	float dotNV = saturate( dot( normal, viewDir ) );
1118	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1119	#ifdef USE_IRIDESCENCE
1120		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1121	#else
1122		vec3 Fr = specularColor;
1123	#endif
1124	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1125	float Ess = fab.x + fab.y;
1126	float Ems = 1.0 - Ess;
1127	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1128	singleScatter += FssEss;
1129	multiScatter += Fms * Ems;
1130}
1131vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1132	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1133-1262
1133	float dotNL = saturate( dot( normal, lightDir ) );
1134	float dotNV = saturate( dot( normal, viewDir ) );
1135	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1136	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1137	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1138	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1139	float Ess_V = dfgV.x + dfgV.y;
1140	float Ess_L = dfgL.x + dfgL.y;
1141	float Ems_V = 1.0 - Ess_V;
1142	float Ems_L = 1.0 - Ess_L;
1143	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1144	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1145	float compensationFactor = Ems_V * Ems_L;
1146	vec3 multiScatter = Fms * compensationFactor;
1147	return singleScatter + multiScatter;
1148}
1149#if NUM_RECT_AREA_LIGHTS > 0
1150	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1151		vec3 normal = geometryNormal;
1152		vec3 viewDir = geometryViewDir;
1153		vec3 position = geometryPosition;
1154		vec3 lightPos = rectAreaLight.position;
1155		vec3 halfWidth = rectAreaLight.halfWidth;
1156		vec3 halfHeight = rectAreaLight.halfHeight;
1157		vec3 lightColor = rectAreaLight.color;
1158		float roughness = material.roughness;
1159		vec3 rectCoords[ 4 ];
1160		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1161		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1162		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1163		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1164		vec4 t1 = texture2D( ltc_1, uv );
1165		vec4 t2 = texture2D( ltc_2, uv );
1166		mat3 mInv = mat3(
1167			vec3( t1.x, 0, t1.y ),
1168			vec3(    0, 1,    0 ),
1169			vec3( t1.z, 0, t1.w )
1170		);
1171		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1172		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1173		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1174		#ifdef USE_CLEARCOAT
1175			vec3 Ncc = geometryClearcoatNormal;
1176			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1177			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1178			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1179			mat3 mInvClearcoat = mat3(
1180				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1181				vec3(             0, 1,             0 ),
1182				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1183			);
1184			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1185			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1186		#endif
1187	}
1188#endif
1189void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1190	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1191	vec3 irradiance = dotNL * directLight.color;
1192	#ifdef USE_CLEARCOAT
1193		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1194		vec3 ccIrradiance = dotNLcc * directLight.color;
1195		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1196	#endif
1197	#ifdef USE_SHEEN
1198 
1199 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1200 
1201 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1202 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1203 
1204 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1205 
1206 		irradiance *= sheenEnergyComp;
1207 
1208 	#endif
1209	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1210	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1211}
1212void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1213	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1214	#ifdef USE_SHEEN
1215		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1216		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1217		diffuse *= sheenEnergyComp;
1218	#endif
1219	reflectedLight.indirectDiffuse += diffuse;
1220}
1221void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1222	#ifdef USE_CLEARCOAT
1223		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1224	#endif
1225	#ifdef USE_SHEEN
1226		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1227 	#endif
1228	vec3 singleScatteringDielectric = vec3( 0.0 );
1229	vec3 multiScatteringDielectric = vec3( 0.0 );
1230	vec3 singleScatteringMetallic = vec3( 0.0 );
1231	vec3 multiScatteringMetallic = vec3( 0.0 );
1232	#ifdef USE_IRIDESCENCE
1233		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1234		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1235	#else
1236		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1237		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1238	#endif
1239	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1240	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1241	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1242	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1243	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1244	vec3 indirectSpecular = radiance * singleScattering;
1245	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1246	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1247	#ifdef USE_SHEEN
1248		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1249		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1250		indirectSpecular *= sheenEnergyComp;
1251		indirectDiffuse *= sheenEnergyComp;
1252	#endif
1253	reflectedLight.indirectSpecular += indirectSpecular;
1254	reflectedLight.indirectDiffuse += indirectDiffuse;
1255}
1256#define RE_Direct				RE_Direct_Physical
1257#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1258#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1259#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1260float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1261	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1262}`,
1262Pl=`
1263vec3 geometryPosition = - vViewPosition;
1264vec3 geometryNormal = normal;
1265vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1266vec3 geometryClearcoatNormal = vec3( 0.0 );
1267#ifdef USE_CLEARCOAT
1268	geometryClearcoatNormal = clearcoatNormal;
1269#endif
1270#ifdef USE_IRIDESCENCE
1271	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1272	if ( material.iridescenceThickness == 0.0 ) {
1273		material.iridescence = 0.0;
1274	} else {
1275		material.iridescence = saturate( material.iridescence );
1276	}
1277	if ( material.iridescence > 0.0 ) {
1278		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1279		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1280		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1281		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1282	}
1283#endif
1284IncidentLight directLight;
1285#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1286	PointLight pointLight;
1287	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1288	PointLightShadow pointLightShadow;
1289	#endif
1290	#pragma unroll_loop_start
1291	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1292		pointLight = pointLights[ i ];
1293		getPointLightInfo( pointLight, geometryPosition, directLight );
1294		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1295		pointLightShadow = pointLightShadows[ i ];
1296		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1297		#endif
1298		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1299	}
1300	#pragma unroll_loop_end
1301#endif
1302#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1303	SpotLight spotLight;
1304	vec4 spotColor;
1305	vec3 spotLightCoord;
1306	bool inSpotLightMap;
1307	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1308	SpotLightShadow spotLightShadow;
1309	#endif
1310	#pragma unroll_loop_start
1311	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1312		spotLight = spotLights[ i ];
1313		getSpotLightInfo( spotLight, geometryPosition, directLight );
1314		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1315		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1316		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1317		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1318		#else
1319		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1320		#endif
1321		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1322			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1323			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1324			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1325			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1326		#endif
1327		#undef SPOT_LIGHT_MAP_INDEX
1328		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1329		spotLightShadow = spotLightShadows[ i ];
1330		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1331		#endif
1332		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1333	}
1334	#pragma unroll_loop_end
1335#endif
1336#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1337	DirectionalLight directionalLight;
1338	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1339	DirectionalLightShadow directionalLightShadow;
1340	#endif
1341	#pragma unroll_loop_start
1342	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1343		directionalLight = directionalLights[ i ];
1344		getDirectionalLightInfo( directionalLight, directLight );
1345		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1346		directionalLightShadow = directionalLightShadows[ i ];
1347		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1348		#endif
1349		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1350	}
1351	#pragma unroll_loop_end
1352#endif
1353#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1354	RectAreaLight rectAreaLight;
1355	#pragma unroll_loop_start
1356	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1357		rectAreaLight = rectAreaLights[ i ];
1358		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1359	}
1360	#pragma unroll_loop_end
1361#endif
1362#if defined( RE_IndirectDiffuse )
1363	vec3 iblIrradiance = vec3( 0.0 );
1364	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1365	#if defined( USE_LIGHT_PROBES )
1366		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1367	#endif
1368	#if ( NUM_HEMI_LIGHTS > 0 )
1369		#pragma unroll_loop_start
1370		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1371			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1372		}
1373		#pragma unroll_loop_end
1374	#endif
1375	#ifdef USE_LIGHT_PROBES_GRID
1376		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1377		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1378		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1379	#endif
1380#endif
1381#if defined( RE_IndirectSpecular )
1382	vec3 radiance = vec3( 0.0 );
1383	vec3 clearcoatRadiance = vec3( 0.0 );
1384#endif`,Dl=`#if defined( RE_IndirectDiffuse )
1385	#ifdef USE_LIGHTMAP
1386		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1387		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1388		irradiance += lightMapIrradiance;
1389	#endif
1390	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1391		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1392			iblIrradiance += getIBLIrradiance( geometryNormal );
1393		#endif
1394	#endif
1395#endif
1396#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1397	#ifdef USE_ANISOTROPY
1398		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1399	#else
1400		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1401	#endif
1402	#ifdef USE_CLEARCOAT
1403		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1404	#endif
1405#endif`,Ll=`#if defined( RE_IndirectDiffuse )
1406	#if defined( LAMBERT ) || defined( PHONG )
1407		irradiance += iblIrradiance;
1408	#endif
1409	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1410#endif
1411#if defined( RE_IndirectSpecular )
1412	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1413#endif`,Fl=`#ifdef USE_LIGHT_PROBES_GRID
1414uniform highp sampler3D probesSH;
1415uniform vec3 probesMin;
1416uniform vec3 probesMax;
1417uniform vec3 probesResolution;
1418vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1419	vec3 res = probesResolution;
1420	vec3 gridRange = probesMax - probesMin;
1421	vec3 resMinusOne = res - 1.0;
1422	vec3 probeSpacing = gridRange / resMinusOne;
1423	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1424	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1425	uvw = uvw * resMinusOne / res + 0.5 / res;
1426	float nz          = res.z;
1427	float paddedSlices = nz + 2.0;
1428	float atlasDepth  = 7.0 * paddedSlices;
1429	float uvZBase     = uvw.z * nz + 1.0;
1430	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1431	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1432	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1433	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1434	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1435	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1436	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1437	vec3 c0 = s0.xyz;
1438	vec3 c1 = vec3( s0.w, s1.xy );
1439	vec3 c2 = vec3( s1.zw, s2.x );
1440	vec3 c3 = s2.yzw;
1441	vec3 c4 = s3.xyz;
1442	vec3 c5 = vec3( s3.w, s4.xy );
1443	vec3 c6 = vec3( s4.zw, s5.x );
1444	vec3 c7 = s5.yzw;
1445	vec3 c8 = s6.xyz;
1446	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1447	vec3 result = c0 * 0.886227;
1448	result += c1 * 2.0 * 0.511664 * y;
1449	result += c2 * 2.0 * 0.511664 * z;
1450	result += c3 * 2.0 * 0.511664 * x;
1451	result += c4 * 2.0 * 0.429043 * x * y;
1452	result += c5 * 2.0 * 0.429043 * y * z;
1453	result += c6 * ( 0.743125 * z * z - 0.247708 );
1454	result += c7 * 2.0 * 0.429043 * x * z;
1455	result += c8 * 0.429043 * ( x * x - y * y );
1456	return max( result, vec3( 0.0 ) );
1457}
1458#endif`,Il=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1459	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1460#endif`,Ul=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1461	uniform float logDepthBufFC;
1462	varying float vFragDepth;
1463	varying float vIsPerspective;
1464#endif`,Nl=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1465	varying float vFragDepth;
1466	varying float vIsPerspective;
1467#endif`,Bl=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1468	vFragDepth = 1.0 + gl_Position.w;
1469	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1470#endif`,Ol=`#ifdef USE_MAP
1471	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1472	#ifdef DECODE_VIDEO_TEXTURE
1473		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1474	#endif
1475	diffuseColor *= sampledDiffuseColor;
1476#endif`,Gl=`#ifdef USE_MAP
1477	uniform sampler2D map;
1478#endif`,zl=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1479	#if defined( USE_POINTS_UV )
1480		vec2 uv = vUv;
1481	#else
1482		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1483	#endif
1484#endif
1485#ifdef USE_MAP
1486	diffuseColor *= texture2D( map, uv );
1487#endif
1488#ifdef USE_ALPHAMAP
1489	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1490#endif`,Vl=`#if defined( USE_POINTS_UV )
1491	varying vec2 vUv;
1492#else
1493	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1494		uniform mat3 uvTransform;
1495	#endif
1496#endif
1497#ifdef USE_MAP
1498	uniform sampler2D map;
1499#endif
1500#ifdef USE_ALPHAMAP
1501	uniform sampler2D alphaMap;
1502#endif`,Hl=`float metalnessFactor = metalness;
1503#ifdef USE_METALNESSMAP
1504	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1505	metalnessFactor *= texelMetalness.b;
1506#endif`,kl=`#ifdef USE_METALNESSMAP
1507	uniform sampler2D metalnessMap;
1508#endif`,Wl=`#ifdef USE_INSTANCING_MORPH
1509	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1510	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1511	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1512		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1513	}
1514#endif`,Xl=`#if defined( USE_MORPHCOLORS )
1515	vColor *= morphTargetBaseInfluence;
1516	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1517		#if defined( USE_COLOR_ALPHA )
1518			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1519		#elif defined( USE_COLOR )
1520			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1521		#endif
1522	}
1523#endif`,ql=`#ifdef USE_MORPHNORMALS
1524	objectNormal *= morphTargetBaseInfluence;
1525	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1526		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1527	}
1528#endif`,Yl=`#ifdef USE_MORPHTARGETS
1529	#ifndef USE_INSTANCING_MORPH
1530		uniform float morphTargetBaseInfluence;
1531		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1532	#endif
1533	uniform sampler2DArray morphTargetsTexture;
1534	uniform ivec2 morphTargetsTextureSize;
1535	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1536		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1537		int y = texelIndex / morphTargetsTextureSize.x;
1538		int x = texelIndex - y * morphTargetsTextureSize.x;
1539		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1540		return texelFetch( morphTargetsTexture, morphUV, 0 );
1541	}
1542#endif`,Kl=`#ifdef USE_MORPHTARGETS
1543	transformed *= morphTargetBaseInfluence;
1544	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1545		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1546	}
1547#endif`,Zl=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1548#ifdef FLAT_SHADED
1549	vec3 fdx = dFdx( vViewPosition );
1550	vec3 fdy = dFdy( vViewPosition );
1551	vec3 normal = normalize( cross( fdx, fdy ) );
1552#else
1553	vec3 normal = normalize( vNormal );
1554	#ifdef DOUBLE_SIDED
1555		normal *= faceDirection;
1556	#endif
1557#endif
1558#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1559	#ifdef USE_TANGENT
1560		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1561	#else
1562		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1563		#if defined( USE_NORMALMAP )
1564			vNormalMapUv
1565		#elif defined( USE_CLEARCOAT_NORMALMAP )
1566			vClearcoatNormalMapUv
1567		#else
1568			vUv
1569		#endif
1570		);
1571	#endif
1572	#ifdef DOUBLE_SIDED
1573		tbn[0] *= faceDirection;
1574		tbn[1] *= faceDirection;
1575	#endif
1576#endif
1577#ifdef USE_CLEARCOAT_NORMALMAP
1578	#ifdef USE_TANGENT
1579		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1580	#else
1581		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1582	#endif
1583	#ifdef DOUBLE_SIDED
1584		tbn2[0] *= faceDirection;
1585		tbn2[1] *= faceDirection;
1586	#endif
1587#endif
1588vec3 nonPerturbedNormal = normal;`,$l=`#ifdef USE_NORMALMAP_OBJECTSPACE
1589	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1590	#ifdef FLIP_SIDED
1591		normal = - normal;
1592	#endif
1593	#ifdef DOUBLE_SIDED
1594		normal = normal * faceDirection;
1595	#endif
1596	normal = normalize( normalMatrix * normal );
1597#elif defined( USE_NORMALMAP_TANGENTSPACE )
1598	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1599	#if defined( USE_PACKED_NORMALMAP )
1600		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1601	#endif
1602	mapN.xy *= normalScale;
1603	normal = normalize( tbn * mapN );
1604#elif defined( USE_BUMPMAP )
1605	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1606#endif`,Jl=`#ifndef FLAT_SHADED
1607	varying vec3 vNormal;
1608	#ifdef USE_TANGENT
1609		varying vec3 vTangent;
1610		varying vec3 vBitangent;
1611	#endif
1612#endif`,Ql=`#ifndef FLAT_SHADED
1613	varying vec3 vNormal;
1614	#ifdef USE_TANGENT
1615		varying vec3 vTangent;
1616		varying vec3 vBitangent;
1617	#endif
1618#endif`,jl=`#ifndef FLAT_SHADED
1619	vNormal = normalize( transformedNormal );
1620	#ifdef USE_TANGENT
1621		vTangent = normalize( transformedTangent );
1622		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1623		#ifdef FLIP_SIDED
1624			vBitangent = - vBitangent;
1625		#endif
1626	#endif
1627#endif`,ec=`#ifdef USE_NORMALMAP
1628	uniform sampler2D normalMap;
1629	uniform vec2 normalScale;
1630#endif
1631#ifdef USE_NORMALMAP_OBJECTSPACE
1632	uniform mat3 normalMatrix;
1633#endif
1634#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1635	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1636		vec3 q0 = dFdx( eye_pos.xyz );
1637		vec3 q1 = dFdy( eye_pos.xyz );
1638		vec2 st0 = dFdx( uv.st );
1639		vec2 st1 = dFdy( uv.st );
1640		vec3 N = surf_norm;
1641		vec3 q1perp = cross( q1, N );
1642		vec3 q0perp = cross( N, q0 );
1643		vec3 T = q1perp * st0.x + q0perp * st1.x;
1644		vec3 B = q1perp * st0.y + q0perp * st1.y;
1645		float det = max( dot( T, T ), dot( B, B ) );
1646		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1647		return mat3( T * scale, B * scale, N );
1648	}
1649#endif`,tc=`#ifdef USE_CLEARCOAT
1650	vec3 clearcoatNormal = nonPerturbedNormal;
1651#endif`,nc=`#ifdef USE_CLEARCOAT_NORMALMAP
1652	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1653	clearcoatMapN.xy *= clearcoatNormalScale;
1654	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1655#endif`,ic=`#ifdef USE_CLEARCOATMAP
1656	uniform sampler2D clearcoatMap;
1657#endif
1658#ifdef USE_CLEARCOAT_NORMALMAP
1659	uniform sampler2D clearcoatNormalMap;
1660	uniform vec2 clearcoatNormalScale;
1661#endif
1662#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1663	uniform sampler2D clearcoatRoughnessMap;
1664#endif`,rc=`#ifdef USE_IRIDESCENCEMAP
1665	uniform sampler2D iridescenceMap;
1666#endif
1667#ifdef USE_IRIDESCENCE_THICKNESSMAP
1668	uniform sampler2D iridescenceThicknessMap;
1669#endif`,sc=`#ifdef OPAQUE
1670diffuseColor.a = 1.0;
1671#endif
1672#ifdef USE_TRANSMISSION
1673diffuseColor.a *= material.transmissionAlpha;
1674#endif
1675gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ac=`vec3 packNormalToRGB( const in vec3 normal ) {
1676	return normalize( normal ) * 0.5 + 0.5;
1677}
1678vec3 unpackRGBToNormal( const in vec3 rgb ) {
1679	return 2.0 * rgb.xyz - 1.0;
1680}
1681const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1682const float Inv255 = 1. / 255.;
1683const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1684const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1685const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1686const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1687vec4 packDepthToRGBA( const in float v ) {
1688	if( v <= 0.0 )
1689		return vec4( 0., 0., 0., 0. );
1690	if( v >= 1.0 )
1691		return vec4( 1., 1., 1., 1. );
1692	float vuf;
1693	float af = modf( v * PackFactors.a, vuf );
1694	float bf = modf( vuf * ShiftRight8, vuf );
1695	float gf = modf( vuf * ShiftRight8, vuf );
1696	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1697}
1698vec3 packDepthToRGB( const in float v ) {
1699	if( v <= 0.0 )
1700		return vec3( 0., 0., 0. );
1701	if( v >= 1.0 )
1702		return vec3( 1., 1., 1. );
1703	float vuf;
1704	float bf = modf( v * PackFactors.b, vuf );
1705	float gf = modf( vuf * ShiftRight8, vuf );
1706	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1707}
1708vec2 packDepthToRG( const in float v ) {
1709	if( v <= 0.0 )
1710		return vec2( 0., 0. );
1711	if( v >= 1.0 )
1712		return vec2( 1., 1. );
1713	float vuf;
1714	float gf = modf( v * 256., vuf );
1715	return vec2( vuf * Inv255, gf );
1716}
1717float unpackRGBAToDepth( const in vec4 v ) {
1718	return dot( v, UnpackFactors4 );
1719}
1720float unpackRGBToDepth( const in vec3 v ) {
1721	return dot( v, UnpackFactors3 );
1722}
1723float unpackRGToDepth( const in vec2 v ) {
1724	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1725}
1726vec4 pack2HalfToRGBA( const in vec2 v ) {
1727	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1728	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1729}
1730vec2 unpackRGBATo2Half( const in vec4 v ) {
1731	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1732}
1733float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1734	return ( viewZ + near ) / ( near - far );
1735}
1736float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1737	#ifdef USE_REVERSED_DEPTH_BUFFER
1738	
1739		return depth * ( far - near ) - far;
1740	#else
1741		return depth * ( near - far ) - near;
1742	#endif
1743}
1744float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1745	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1746}
1747float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1748	
1749	#ifdef USE_REVERSED_DEPTH_BUFFER
1750		return ( near * far ) / ( ( near - far ) * depth - near );
1751	#else
1752		return ( near * far ) / ( ( far - near ) * depth - far );
1753	#endif
1754}`,oc=`#ifdef PREMULTIPLIED_ALPHA
1755	gl_FragColor.rgb *= gl_FragColor.a;
1756#endif`,lc=`vec4 mvPosition = vec4( transformed, 1.0 );
1757#ifdef USE_BATCHING
1758	mvPosition = batchingMatrix * mvPosition;
1759#endif
1760#ifdef USE_INSTANCING
1761	mvPosition = instanceMatrix * mvPosition;
1762#endif
1763mvPosition = modelViewMatrix * mvPosition;
1764gl_Position = projectionMatrix * mvPosition;`,cc=`#ifdef DITHERING
1765	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1766#endif`,uc=`#ifdef DITHERING
1767	vec3 dithering( vec3 color ) {
1768		float grid_position = rand( gl_FragCoord.xy );
1769		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1770		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1771		return color + dither_shift_RGB;
1772	}
1773#endif`,hc=`float roughnessFactor = roughness;
1774#ifdef USE_ROUGHNESSMAP
1775	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1776	roughnessFactor *= texelRoughness.g;
1777#endif`,dc=`#ifdef USE_ROUGHNESSMAP
1778	uniform sampler2D roughnessMap;
1779#endif`,fc=`#if NUM_SPOT_LIGHT_COORDS > 0
1780	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1781#endif
1782#if NUM_SPOT_LIGHT_MAPS > 0
1783	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1784#endif
1785#ifdef USE_SHADOWMAP
1786	#if NUM_DIR_LIGHT_SHADOWS > 0
1787		#if defined( SHADOWMAP_TYPE_PCF )
1788			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1789		#else
1790			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1791		#endif
1792		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1793		struct DirectionalLightShadow {
1794			float shadowIntensity;
1795			float shadowBias;
1796			float shadowNormalBias;
1797			float shadowRadius;
1798			vec2 shadowMapSize;
1799		};
1800		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1801	#endif
1802	#if NUM_SPOT_LIGHT_SHADOWS > 0
1803		#if defined( SHADOWMAP_TYPE_PCF )
1804			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1805		#else
1806			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1807		#endif
1808		struct SpotLightShadow {
1809			float shadowIntensity;
1810			float shadowBias;
1811			float shadowNormalBias;
1812			float shadowRadius;
1813			vec2 shadowMapSize;
1814		};
1815		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1816	#endif
1817	#if NUM_POINT_LIGHT_SHADOWS > 0
1818		#if defined( SHADOWMAP_TYPE_PCF )
1819			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1820		#elif defined( SHADOWMAP_TYPE_BASIC )
1821			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1822		#endif
1823		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1824		struct PointLightShadow {
1825			float shadowIntensity;
1826			float shadowBias;
1827			float shadowNormalBias;
1828			float shadowRadius;
1829			vec2 shadowMapSize;
1830			float shadowCameraNear;
1831			float shadowCameraFar;
1832		};
1833		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1834	#endif
1835	#if defined( SHADOWMAP_TYPE_PCF )
1836		float interleavedGradientNoise( vec2 position ) {
1837			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1838		}
1839		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1840			const float goldenAngle = 2.399963229728653;
1841			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1842			float theta = float( sampleIndex ) * goldenAngle + phi;
1843			return vec2( cos( theta ), sin( theta ) ) * r;
1844		}
1845	#endif
1846	#if defined( SHADOWMAP_TYPE_PCF )
1847		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1848			float shadow = 1.0;
1849			shadowCoord.xyz /= shadowCoord.w;
1850			shadowCoord.z += shadowBias;
1851			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1852			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1853			if ( frustumTest ) {
1854				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1855				float radius = shadowRadius * texelSize.x;
1856				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1857				shadow = (
1858					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1859					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1860					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1861					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1862					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1863				) * 0.2;
1864			}
1865			return mix( 1.0, shadow, shadowIntensity );
1866		}
1867	#elif defined( SHADOWMAP_TYPE_VSM )
1868		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1869			float shadow = 1.0;
1870			shadowCoord.xyz /= shadowCoord.w;
1871			#ifdef USE_REVERSED_DEPTH_BUFFER
1872				shadowCoord.z -= shadowBias;
1873			#else
1874				shadowCoord.z += shadowBias;
1875			#endif
1876			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1877			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1878			if ( frustumTest ) {
1879				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1880				float mean = distribution.x;
1881				float variance = distribution.y * distribution.y;
1882				#ifdef USE_REVERSED_DEPTH_BUFFER
1883					float hard_shadow = step( mean, shadowCoord.z );
1884				#else
1885					float hard_shadow = step( shadowCoord.z, mean );
1886				#endif
1887				
1888				if ( hard_shadow == 1.0 ) {
1889					shadow = 1.0;
1890				} else {
1891					variance = max( variance, 0.0000001 );
1892					float d = shadowCoord.z - mean;
1893					float p_max = variance / ( variance + d * d );
1894					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1895					shadow = max( hard_shadow, p_max );
1896				}
1897			}
1898			return mix( 1.0, shadow, shadowIntensity );
1899		}
1900	#else
1901		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1902			float shadow = 1.0;
1903			shadowCoord.xyz /= shadowCoord.w;
1904			#ifdef USE_REVERSED_DEPTH_BUFFER
1905				shadowCoord.z -= shadowBias;
1906			#else
1907				shadowCoord.z += shadowBias;
1908			#endif
1909			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1910			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1911			if ( frustumTest ) {
1912				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1913				#ifdef USE_REVERSED_DEPTH_BUFFER
1914					shadow = step( depth, shadowCoord.z );
1915				#else
1916					shadow = step( shadowCoord.z, depth );
1917				#endif
1918			}
1919			return mix( 1.0, shadow, shadowIntensity );
1920		}
1921	#endif
1922	#if NUM_POINT_LIGHT_SHADOWS > 0
1923	#if defined( SHADOWMAP_TYPE_PCF )
1924	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1925		float shadow = 1.0;
1926		vec3 lightToPosition = shadowCoord.xyz;
1927		vec3 bd3D = normalize( lightToPosition );
1928		vec3 absVec = abs( lightToPosition );
1929		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1930		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1931			#ifdef USE_REVERSED_DEPTH_BUFFER
1932				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1933				dp -= shadowBias;
1934			#else
1935				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1936				dp += shadowBias;
1937			#endif
1938			float texelSize = shadowRadius / shadowMapSize.x;
1939			vec3 absDir = abs( bd3D );
1940			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1941			tangent = normalize( cross( bd3D, tangent ) );
1942			vec3 bitangent = cross( bd3D, tangent );
1943			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1944			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1945			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1946			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1947			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1948			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1949			shadow = (
1950				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1951				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1952				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1953				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1954				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1955			) * 0.2;
1956		}
1957		return mix( 1.0, shadow, shadowIntensity );
1958	}
1959	#elif defined( SHADOWMAP_TYPE_BASIC )
1960	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1961		float shadow = 1.0;
1962		vec3 lightToPosition = shadowCoord.xyz;
1963		vec3 absVec = abs( lightToPosition );
1964		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1965		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1966			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1967			dp += shadowBias;
1968			vec3 bd3D = normalize( lightToPosition );
1969			float depth = textureCube( shadowMap, bd3D ).r;
1970			#ifdef USE_REVERSED_DEPTH_BUFFER
1971				depth = 1.0 - depth;
1972			#endif
1973			shadow = step( dp, depth );
1974		}
1975		return mix( 1.0, shadow, shadowIntensity );
1976	}
1977	#endif
1978	#endif
1979#endif`,pc=`#if NUM_SPOT_LIGHT_COORDS > 0
1980	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1981	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1982#endif
1983#ifdef USE_SHADOWMAP
1984	#if NUM_DIR_LIGHT_SHADOWS > 0
1985		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1986		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1987		struct DirectionalLightShadow {
1988			float shadowIntensity;
1989			float shadowBias;
1990			float shadowNormalBias;
1991			float shadowRadius;
1992			vec2 shadowMapSize;
1993		};
1994		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1995	#endif
1996	#if NUM_SPOT_LIGHT_SHADOWS > 0
1997		struct SpotLightShadow {
1998			float shadowIntensity;
1999			float shadowBias;
2000			float shadowNormalBias;
2001			float shadowRadius;
2002			vec2 shadowMapSize;
2003		};
2004		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2005	#endif
2006	#if NUM_POINT_LIGHT_SHADOWS > 0
2007		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2008		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2009		struct PointLightShadow {
2010			float shadowIntensity;
2011			float shadowBias;
2012			float shadowNormalBias;
2013			float shadowRadius;
2014			vec2 shadowMapSize;
2015			float shadowCameraNear;
2016			float shadowCameraFar;
2017		};
2018		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2019	#endif
2020#endif`,mc=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2021	#ifdef HAS_NORMAL
2022		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2023	#else
2024		vec3 shadowWorldNormal = vec3( 0.0 );
2025	#endif
2026	vec4 shadowWorldPosition;
2027#endif
2028#if defined( USE_SHADOWMAP )
2029	#if NUM_DIR_LIGHT_SHADOWS > 0
2030		#pragma unroll_loop_start
2031		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2032			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2033			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2034		}
2035		#pragma unroll_loop_end
2036	#endif
2037	#if NUM_POINT_LIGHT_SHADOWS > 0
2038		#pragma unroll_loop_start
2039		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2040			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2041			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2042		}
2043		#pragma unroll_loop_end
2044	#endif
2045#endif
2046#if NUM_SPOT_LIGHT_COORDS > 0
2047	#pragma unroll_loop_start
2048	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2049		shadowWorldPosition = worldPosition;
2050		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2051			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2052		#endif
2053		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2054	}
2055	#pragma unroll_loop_end
2056#endif`,gc=`float getShadowMask() {
2057	float shadow = 1.0;
2058	#ifdef USE_SHADOWMAP
2059	#if NUM_DIR_LIGHT_SHADOWS > 0
2060	DirectionalLightShadow directionalLight;
2061	#pragma unroll_loop_start
2062	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2063		directionalLight = directionalLightShadows[ i ];
2064		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2065	}
2066	#pragma unroll_loop_end
2067	#endif
2068	#if NUM_SPOT_LIGHT_SHADOWS > 0
2069	SpotLightShadow spotLight;
2070	#pragma unroll_loop_start
2071	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2072		spotLight = spotLightShadows[ i ];
2073		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2074	}
2075	#pragma unroll_loop_end
2076	#endif
2077	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2078	PointLightShadow pointLight;
2079	#pragma unroll_loop_start
2080	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2081		pointLight = pointLightShadows[ i ];
2082		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2083	}
2084	#pragma unroll_loop_end
2085	#endif
2086	#endif
2087	return shadow;
2088}`,_c=`#ifdef USE_SKINNING
2089	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2090	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2091	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2092	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2093#endif`,xc=`#ifdef USE_SKINNING
2094	uniform mat4 bindMatrix;
2095	uniform mat4 bindMatrixInverse;
2096	uniform highp sampler2D boneTexture;
2097	mat4 getBoneMatrix( const in float i ) {
2098		int size = textureSize( boneTexture, 0 ).x;
2099		int j = int( i ) * 4;
2100		int x = j % size;
2101		int y = j / size;
2102		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2103		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2104		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2105		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2106		return mat4( v1, v2, v3, v4 );
2107	}
2108#endif`,vc=`#ifdef USE_SKINNING
2109	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2110	vec4 skinned = vec4( 0.0 );
2111	skinned += boneMatX * skinVertex * skinWeight.x;
2112	skinned += boneMatY * skinVertex * skinWeight.y;
2113	skinned += boneMatZ * skinVertex * skinWeight.z;
2114	skinned += boneMatW * skinVertex * skinWeight.w;
2115	transformed = ( bindMatrixInverse * skinned ).xyz;
2116#endif`,Mc=`#ifdef USE_SKINNING
2117	mat4 skinMatrix = mat4( 0.0 );
2118	skinMatrix += skinWeight.x * boneMatX;
2119	skinMatrix += skinWeight.y * boneMatY;
2120	skinMatrix += skinWeight.z * boneMatZ;
2121	skinMatrix += skinWeight.w * boneMatW;
2122	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2123	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2124	#ifdef USE_TANGENT
2125		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2126	#endif
2127#endif`,Sc=`float specularStrength;
2128#ifdef USE_SPECULARMAP
2129	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2130	specularStrength = texelSpecular.r;
2131#else
2132	specularStrength = 1.0;
2133#endif`,Ec=`#ifdef USE_SPECULARMAP
2134	uniform sampler2D specularMap;
2135#endif`,yc=`#if defined( TONE_MAPPING )
2136	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2137#endif`,Tc=`#ifndef saturate
2138#define saturate( a ) clamp( a, 0.0, 1.0 )
2139#endif
2140uniform float toneMappingExposure;
2141vec3 LinearToneMapping( vec3 color ) {
2142	return saturate( toneMappingExposure * color );
2143}
2144vec3 ReinhardToneMapping( vec3 color ) {
2145	color *= toneMappingExposure;
2146	return saturate( color / ( vec3( 1.0 ) + color ) );
2147}
2148vec3 CineonToneMapping( vec3 color ) {
2149	color *= toneMappingExposure;
2150	color = max( vec3( 0.0 ), color - 0.004 );
2151	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2152}
2153vec3 RRTAndODTFit( vec3 v ) {
2154	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2155	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2156	return a / b;
2157}
2158vec3 ACESFilmicToneMapping( vec3 color ) {
2159	const mat3 ACESInputMat = mat3(
2160		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2161		vec3( 0.04823, 0.01566, 0.83777 )
2162	);
2163	const mat3 ACESOutputMat = mat3(
2164		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2165		vec3( -0.07367, -0.00605,  1.07602 )
2166	);
2167	color *= toneMappingExposure / 0.6;
2168	color = ACESInputMat * color;
2169	color = RRTAndODTFit( color );
2170	color = ACESOutputMat * color;
2171	return saturate( color );
2172}
2173const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2174	vec3( 1.6605, - 0.1246, - 0.0182 ),
2175	vec3( - 0.5876, 1.1329, - 0.1006 ),
2176	vec3( - 0.0728, - 0.0083, 1.1187 )
2177);
2178const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2179	vec3( 0.6274, 0.0691, 0.0164 ),
2180	vec3( 0.3293, 0.9195, 0.0880 ),
2181	vec3( 0.0433, 0.0113, 0.8956 )
2182);
2183vec3 agxDefaultContrastApprox( vec3 x ) {
2184	vec3 x2 = x * x;
2185	vec3 x4 = x2 * x2;
2186	return + 15.5 * x4 * x2
2187		- 40.14 * x4 * x
2188		+ 31.96 * x4
2189		- 6.868 * x2 * x
2190		+ 0.4298 * x2
2191		+ 0.1191 * x
2192		- 0.00232;
2193}
2194vec3 AgXToneMapping( vec3 color ) {
2195	const mat3 AgXInsetMatrix = mat3(
2196		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2197		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2198		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2199	);
2200	const mat3 AgXOutsetMatrix = mat3(
2201		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2202		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2203		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2204	);
2205	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2206	color *= toneMappingExposure;
2207	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2208	color = AgXInsetMatrix * color;
2209	color = max( color, 1e-10 );	color = log2( color );
2210	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2211	color = clamp( color, 0.0, 1.0 );
2212	color = agxDefaultContrastApprox( color );
2213	color = AgXOutsetMatrix * color;
2214	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2215	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2216	color = clamp( color, 0.0, 1.0 );
2217	return color;
2218}
2219vec3 NeutralToneMapping( vec3 color ) {
2220	const float StartCompression = 0.8 - 0.04;
2221	const float Desaturation = 0.15;
2222	color *= toneMappingExposure;
2223	float x = min( color.r, min( color.g, color.b ) );
2224	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2225	color -= offset;
2226	float peak = max( color.r, max( color.g, color.b ) );
2227	if ( peak < StartCompression ) return color;
2228	float d = 1. - StartCompression;
2229	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2230	color *= newPeak / peak;
2231	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2232	return mix( color, vec3( newPeak ), g );
2233}
2234vec3 CustomToneMapping( vec3 color ) { return color; }`,bc=`#ifdef USE_TRANSMISSION
2235	material.transmission = transmission;
2236	material.transmissionAlpha = 1.0;
2237	material.thickness = thickness;
2238	material.attenuationDistance = attenuationDistance;
2239	material.attenuationColor = attenuationColor;
2240	#ifdef USE_TRANSMISSIONMAP
2241		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2242	#endif
2243	#ifdef USE_THICKNESSMAP
2244		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2245	#endif
2246	vec3 pos = vWorldPosition;
2247	vec3 v = normalize( cameraPosition - pos );
2248	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
2249	vec4 transmitted = getIBLVolumeRefraction(
2250		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2251		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2252		material.attenuationColor, material.attenuationDistance );
2253	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2254	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2255#endif`,Ac=`#ifdef USE_TRANSMISSION
2256	uniform float transmission;
2257	uniform float thickness;
2258	uniform float attenuationDistance;
2259	uniform vec3 attenuationColor;
2260	#ifdef USE_TRANSMISSIONMAP
2261		uniform sampler2D transmissionMap;
2262	#endif
2263	#ifdef USE_THICKNESSMAP
2264		uniform sampler2D thicknessMap;
2265	#endif
2266	uniform vec2 transmissionSamplerSize;
2267	uniform sampler2D transmissionSamplerMap;
2268	uniform mat4 modelMatrix;
2269	uniform mat4 projectionMatrix;
2270	varying vec3 vWorldPosition;
2271	float w0( float a ) {
2272		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2273	}
2274	float w1( float a ) {
2275		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2276	}
2277	float w2( float a ){
2278		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2279	}
2280	float w3( float a ) {
2281		return ( 1.0 / 6.0 ) * ( a * a * a );
2282	}
2283	float g0( float a ) {
2284		return w0( a ) + w1( a );
2285	}
2286	float g1( float a ) {
2287		return w2( a ) + w3( a );
2288	}
2289	float h0( float a ) {
2290		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2291	}
2292	float h1( float a ) {
2293		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2294	}
2295	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2296		uv = uv * texelSize.zw + 0.5;
2297		vec2 iuv = floor( uv );
2298		vec2 fuv = fract( uv );
2299		float g0x = g0( fuv.x );
2300		float g1x = g1( fuv.x );
2301		float h0x = h0( fuv.x );
2302		float h1x = h1( fuv.x );
2303		float h0y = h0( fuv.y );
2304		float h1y = h1( fuv.y );
2305		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2306		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2307		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2308		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2309		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2310			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2311	}
2312	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2313		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2314		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2315		vec2 fLodSizeInv = 1.0 / fLodSize;
2316		vec2 cLodSizeInv = 1.0 / cLodSize;
2317		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2318		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2319		return mix( fSample, cSample, fract( lod ) );
2320	}
2321	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2322		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2323		vec3 modelScale;
2324		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2325		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2326		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2327		return normalize( refractionVector ) * thickness * modelScale;
2328	}
2329	float applyIorToRoughness( const in float roughness, const in float ior ) {
2330		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2331	}
2332	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2333		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2334		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2335	}
2336	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2337		if ( isinf( attenuationDistance ) ) {
2338			return vec3( 1.0 );
2339		} else {
2340			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2341			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2342		}
2343	}
2344	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2345		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2346		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2347		const in vec3 attenuationColor, const in float attenuationDistance ) {
2348		vec4 transmittedLight;
2349		vec3 transmittance;
2350		#ifdef USE_DISPERSION
2351			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2352			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2353			for ( int i = 0; i < 3; i ++ ) {
2354				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2355				vec3 refractedRayExit = position + transmissionRay;
2356				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2357				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2358				refractionCoords += 1.0;
2359				refractionCoords /= 2.0;
2360				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2361				transmittedLight[ i ] = transmissionSample[ i ];
2362				transmittedLight.a += transmissionSample.a;
2363				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2364			}
2365			transmittedLight.a /= 3.0;
2366		#else
2367			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2368			vec3 refractedRayExit = position + transmissionRay;
2369			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2370			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2371			refractionCoords += 1.0;
2372			refractionCoords /= 2.0;
2373			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2374			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2375		#endif
2376		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2377		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2378		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2379		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2380	}
2381#endif`,Rc=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2382	varying vec2 vUv;
2383#endif
2384#ifdef USE_MAP
2385	varying vec2 vMapUv;
2386#endif
2387#ifdef USE_ALPHAMAP
2388	varying vec2 vAlphaMapUv;
2389#endif
2390#ifdef USE_LIGHTMAP
2391	varying vec2 vLightMapUv;
2392#endif
2393#ifdef USE_AOMAP
2394	varying vec2 vAoMapUv;
2395#endif
2396#ifdef USE_BUMPMAP
2397	varying vec2 vBumpMapUv;
2398#endif
2399#ifdef USE_NORMALMAP
2400	varying vec2 vNormalMapUv;
2401#endif
2402#ifdef USE_EMISSIVEMAP
2403	varying vec2 vEmissiveMapUv;
2404#endif
2405#ifdef USE_METALNESSMAP
2406	varying vec2 vMetalnessMapUv;
2407#endif
2408#ifdef USE_ROUGHNESSMAP
2409	varying vec2 vRoughnessMapUv;
2410#endif
2411#ifdef USE_ANISOTROPYMAP
2412	varying vec2 vAnisotropyMapUv;
2413#endif
2414#ifdef USE_CLEARCOATMAP
2415	varying vec2 vClearcoatMapUv;
2416#endif
2417#ifdef USE_CLEARCOAT_NORMALMAP
2418	varying vec2 vClearcoatNormalMapUv;
2419#endif
2420#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2421	varying vec2 vClearcoatRoughnessMapUv;
2422#endif
2423#ifdef USE_IRIDESCENCEMAP
2424	varying vec2 vIridescenceMapUv;
2425#endif
2426#ifdef USE_IRIDESCENCE_THICKNESSMAP
2427	varying vec2 vIridescenceThicknessMapUv;
2428#endif
2429#ifdef USE_SHEEN_COLORMAP
2430	varying vec2 vSheenColorMapUv;
2431#endif
2432#ifdef USE_SHEEN_ROUGHNESSMAP
2433	varying vec2 vSheenRoughnessMapUv;
2434#endif
2435#ifdef USE_SPECULARMAP
2436	varying vec2 vSpecularMapUv;
2437#endif
2438#ifdef USE_SPECULAR_COLORMAP
2439	varying vec2 vSpecularColorMapUv;
2440#endif
2441#ifdef USE_SPECULAR_INTENSITYMAP
2442	varying vec2 vSpecularIntensityMapUv;
2443#endif
2444#ifdef USE_TRANSMISSIONMAP
2445	uniform mat3 transmissionMapTransform;
2446	varying vec2 vTransmissionMapUv;
2447#endif
2448#ifdef USE_THICKNESSMAP
2449	uniform mat3 thicknessMapTransform;
2450	varying vec2 vThicknessMapUv;
2451#endif`,wc=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2452	varying vec2 vUv;
2453#endif
2454#ifdef USE_MAP
2455	uniform mat3 mapTransform;
2456	varying vec2 vMapUv;
2457#endif
2458#ifdef USE_ALPHAMAP
2459	uniform mat3 alphaMapTransform;
2460	varying vec2 vAlphaMapUv;
2461#endif
2462#ifdef USE_LIGHTMAP
2463	uniform mat3 lightMapTransform;
2464	varying vec2 vLightMapUv;
2465#endif
2466#ifdef USE_AOMAP
2467	uniform mat3 aoMapTransform;
2468	varying vec2 vAoMapUv;
2469#endif
2470#ifdef USE_BUMPMAP
2471	uniform mat3 bumpMapTransform;
2472	varying vec2 vBumpMapUv;
2473#endif
2474#ifdef USE_NORMALMAP
2475	uniform mat3 normalMapTransform;
2476	varying vec2 vNormalMapUv;
2477#endif
2478#ifdef USE_DISPLACEMENTMAP
2479	uniform mat3 displacementMapTransform;
2480	varying vec2 vDisplacementMapUv;
2481#endif
2482#ifdef USE_EMISSIVEMAP
2483	uniform mat3 emissiveMapTransform;
2484	varying vec2 vEmissiveMapUv;
2485#endif
2486#ifdef USE_METALNESSMAP
2487	uniform mat3 metalnessMapTransform;
2488	varying vec2 vMetalnessMapUv;
2489#endif
2490#ifdef USE_ROUGHNESSMAP
2491	uniform mat3 roughnessMapTransform;
2492	varying vec2 vRoughnessMapUv;
2493#endif
2494#ifdef USE_ANISOTROPYMAP
2495	uniform mat3 anisotropyMapTransform;
2496	varying vec2 vAnisotropyMapUv;
2497#endif
2498#ifdef USE_CLEARCOATMAP
2499	uniform mat3 clearcoatMapTransform;
2500	varying vec2 vClearcoatMapUv;
2501#endif
2502#ifdef USE_CLEARCOAT_NORMALMAP
2503	uniform mat3 clearcoatNormalMapTransform;
2504	varying vec2 vClearcoatNormalMapUv;
2505#endif
2506#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2507	uniform mat3 clearcoatRoughnessMapTransform;
2508	varying vec2 vClearcoatRoughnessMapUv;
2509#endif
2510#ifdef USE_SHEEN_COLORMAP
2511	uniform mat3 sheenColorMapTransform;
2512	varying vec2 vSheenColorMapUv;
2513#endif
2514#ifdef USE_SHEEN_ROUGHNESSMAP
2515	uniform mat3 sheenRoughnessMapTransform;
2516	varying vec2 vSheenRoughnessMapUv;
2517#endif
2518#ifdef USE_IRIDESCENCEMAP
2519	uniform mat3 iridescenceMapTransform;
2520	varying vec2 vIridescenceMapUv;
2521#endif
2522#ifdef USE_IRIDESCENCE_THICKNESSMAP
2523	uniform mat3 iridescenceThicknessMapTransform;
2524	varying vec2 vIridescenceThicknessMapUv;
2525#endif
2526#ifdef USE_SPECULARMAP
2527	uniform mat3 specularMapTransform;
2528	varying vec2 vSpecularMapUv;
2529#endif
2530#ifdef USE_SPECULAR_COLORMAP
2531	uniform mat3 specularColorMapTransform;
2532	varying vec2 vSpecularColorMapUv;
2533#endif
2534#ifdef USE_SPECULAR_INTENSITYMAP
2535	uniform mat3 specularIntensityMapTransform;
2536	varying vec2 vSpecularIntensityMapUv;
2537#endif
2538#ifdef USE_TRANSMISSIONMAP
2539	uniform mat3 transmissionMapTransform;
2540	varying vec2 vTransmissionMapUv;
2541#endif
2542#ifdef USE_THICKNESSMAP
2543	uniform mat3 thicknessMapTransform;
2544	varying vec2 vThicknessMapUv;
2545#endif`,Cc=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2546	vUv = vec3( uv, 1 ).xy;
2547#endif
2548#ifdef USE_MAP
2549	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2550#endif
2551#ifdef USE_ALPHAMAP
2552	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2553#endif
2554#ifdef USE_LIGHTMAP
2555	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2556#endif
2557#ifdef USE_AOMAP
2558	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2559#endif
2560#ifdef USE_BUMPMAP
2561	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2562#endif
2563#ifdef USE_NORMALMAP
2564	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2565#endif
2566#ifdef USE_DISPLACEMENTMAP
2567	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2568#endif
2569#ifdef USE_EMISSIVEMAP
2570	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2571#endif
2572#ifdef USE_METALNESSMAP
2573	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2574#endif
2575#ifdef USE_ROUGHNESSMAP
2576	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2577#endif
2578#ifdef USE_ANISOTROPYMAP
2579	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2580#endif
2581#ifdef USE_CLEARCOATMAP
2582	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2583#endif
2584#ifdef USE_CLEARCOAT_NORMALMAP
2585	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2586#endif
2587#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2588	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2589#endif
2590#ifdef USE_IRIDESCENCEMAP
2591	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2592#endif
2593#ifdef USE_IRIDESCENCE_THICKNESSMAP
2594	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2595#endif
2596#ifdef USE_SHEEN_COLORMAP
2597	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2598#endif
2599#ifdef USE_SHEEN_ROUGHNESSMAP
2600	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2601#endif
2602#ifdef USE_SPECULARMAP
2603	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2604#endif
2605#ifdef USE_SPECULAR_COLORMAP
2606	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2607#endif
2608#ifdef USE_SPECULAR_INTENSITYMAP
2609	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2610#endif
2611#ifdef USE_TRANSMISSIONMAP
2612	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2613#endif
2614#ifdef USE_THICKNESSMAP
2615	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2616#endif`,Pc=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2617	vec4 worldPosition = vec4( transformed, 1.0 );
2618	#ifdef USE_BATCHING
2619		worldPosition = batchingMatrix * worldPosition;
2620	#endif
2621	#ifdef USE_INSTANCING
2622		worldPosition = instanceMatrix * worldPosition;
2623	#endif
2624	worldPosition = modelMatrix * worldPosition;
2625#endif`;const Dc=`varying vec2 vUv;
2626uniform mat3 uvTransform;
2627void main() {
2628	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2629	gl_Position = vec4( position.xy, 1.0, 1.0 );
2630}`,Lc=`uniform sampler2D t2D;
2631uniform float backgroundIntensity;
2632varying vec2 vUv;
2633void main() {
2634	vec4 texColor = texture2D( t2D, vUv );
2635	#ifdef DECODE_VIDEO_TEXTURE
2636		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2637	#endif
2638	texColor.rgb *= backgroundIntensity;
2639	gl_FragColor = texColor;
2640	#include <tonemapping_fragment>
2641	#include <colorspace_fragment>
2642}`,Fc=`varying vec3 vWorldDirection;
2643#include <common>
2644void main() {
2645	vWorldDirection = transformDirection( position, modelMatrix );
2646	#include <begin_vertex>
2647	#include <project_vertex>
2648	gl_Position.z = gl_Position.w;
2649}`,Ic=`#ifdef ENVMAP_TYPE_CUBE
2650	uniform samplerCube envMap;
2651#elif defined( ENVMAP_TYPE_CUBE_UV )
2652	uniform sampler2D envMap;
2653#endif
2654uniform float backgroundBlurriness;
2655uniform float backgroundIntensity;
2656uniform mat3 backgroundRotation;
2657varying vec3 vWorldDirection;
2658#include <cube_uv_reflection_fragment>
2659void main() {
2660	#ifdef ENVMAP_TYPE_CUBE
2661		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2662	#elif defined( ENVMAP_TYPE_CUBE_UV )
2663		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2664	#else
2665		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2666	#endif
2667	texColor.rgb *= backgroundIntensity;
2668	gl_FragColor = texColor;
2669	#include <tonemapping_fragment>
2670	#include <colorspace_fragment>
2671}`,Uc=`varying vec3 vWorldDirection;
2672#include <common>
2673void main() {
2674	vWorldDirection = transformDirection( position, modelMatrix );
2675	#include <begin_vertex>
2676	#include <project_vertex>
2677	gl_Position.z = gl_Position.w;
2678}`,Nc=`uniform samplerCube tCube;
2679uniform float tFlip;
2680uniform float opacity;
2681varying vec3 vWorldDirection;
2682void main() {
2683	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2684	gl_FragColor = texColor;
2685	gl_FragColor.a *= opacity;
2686	#include <tonemapping_fragment>
2687	#include <colorspace_fragment>
2688}`,Bc=`#include <common>
2689#include <batching_pars_vertex>
2690#include <uv_pars_vertex>
2691#include <displacementmap_pars_vertex>
2692#include <morphtarget_pars_vertex>
2693#include <skinning_pars_vertex>
2694#include <logdepthbuf_pars_vertex>
2695#include <clipping_planes_pars_vertex>
2696varying vec2 vHighPrecisionZW;
2697void main() {
2698	#include <uv_vertex>
2699	#include <batching_vertex>
2700	#include <skinbase_vertex>
2701	#include <morphinstance_vertex>
2702	#ifdef USE_DISPLACEMENTMAP
2703		#include <beginnormal_vertex>
2704		#include <morphnormal_vertex>
2705		#include <skinnormal_vertex>
2706	#endif
2707	#include <begin_vertex>
2708	#include <morphtarget_vertex>
2709	#include <skinning_vertex>
2710	#include <displacementmap_vertex>
2711	#include <project_vertex>
2712	#include <logdepthbuf_vertex>
2713	#include <clipping_planes_vertex>
2714	vHighPrecisionZW = gl_Position.zw;
2715}`,Oc=`#if DEPTH_PACKING == 3200
2716	uniform float opacity;
2717#endif
2718#include <common>
2719#include <packing>
2720#include <uv_pars_fragment>
2721#include <map_pars_fragment>
2722#include <alphamap_pars_fragment>
2723#include <alphatest_pars_fragment>
2724#include <alphahash_pars_fragment>
2725#include <logdepthbuf_pars_fragment>
2726#include <clipping_planes_pars_fragment>
2727varying vec2 vHighPrecisionZW;
2728void main() {
2729	vec4 diffuseColor = vec4( 1.0 );
2730	#include <clipping_planes_fragment>
2731	#if DEPTH_PACKING == 3200
2732		diffuseColor.a = opacity;
2733	#endif
2734	#include <map_fragment>
2735	#include <alphamap_fragment>
2736	#include <alphatest_fragment>
2737	#include <alphahash_fragment>
2738	#include <logdepthbuf_fragment>
2739	#ifdef USE_REVERSED_DEPTH_BUFFER
2740		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2741	#else
2742		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2743	#endif
2744	#if DEPTH_PACKING == 3200
2745		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2746	#elif DEPTH_PACKING == 3201
2747		gl_FragColor = packDepthToRGBA( fragCoordZ );
2748	#elif DEPTH_PACKING == 3202
2749		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2750	#elif DEPTH_PACKING == 3203
2751		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2752	#endif
2753}`,Gc=`#define DISTANCE
2754varying vec3 vWorldPosition;
2755#include <common>
2756#include <batching_pars_vertex>
2757#include <uv_pars_vertex>
2758#include <displacementmap_pars_vertex>
2759#include <morphtarget_pars_vertex>
2760#include <skinning_pars_vertex>
2761#include <clipping_planes_pars_vertex>
2762void main() {
2763	#include <uv_vertex>
2764	#include <batching_vertex>
2765	#include <skinbase_vertex>
2766	#include <morphinstance_vertex>
2767	#ifdef USE_DISPLACEMENTMAP
2768		#include <beginnormal_vertex>
2769		#include <morphnormal_vertex>
2770		#include <skinnormal_vertex>
2771	#endif
2772	#include <begin_vertex>
2773	#include <morphtarget_vertex>
2774	#include <skinning_vertex>
2775	#include <displacementmap_vertex>
2776	#include <project_vertex>
2777	#include <worldpos_vertex>
2778	#include <clipping_planes_vertex>
2779	vWorldPosition = worldPosition.xyz;
2780}`,zc=`#define DISTANCE
2781uniform vec3 referencePosition;
2782uniform float nearDistance;
2783uniform float farDistance;
2784varying vec3 vWorldPosition;
2785#include <common>
2786#include <uv_pars_fragment>
2787#include <map_pars_fragment>
2788#include <alphamap_pars_fragment>
2789#include <alphatest_pars_fragment>
2790#include <alphahash_pars_fragment>
2791#include <clipping_planes_pars_fragment>
2792void main() {
2793	vec4 diffuseColor = vec4( 1.0 );
2794	#include <clipping_planes_fragment>
2795	#include <map_fragment>
2796	#include <alphamap_fragment>
2797	#include <alphatest_fragment>
2798	#include <alphahash_fragment>
2799	float dist = length( vWorldPosition - referencePosition );
2800	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2801	dist = saturate( dist );
2802	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2803}`,Vc=`varying vec3 vWorldDirection;
2804#include <common>
2805void main() {
2806	vWorldDirection = transformDirection( position, modelMatrix );
2807	#include <begin_vertex>
2808	#include <project_vertex>
2809}`,Hc=`uniform sampler2D tEquirect;
2810varying vec3 vWorldDirection;
2811#include <common>
2812void main() {
2813	vec3 direction = normalize( vWorldDirection );
2814	vec2 sampleUV = equirectUv( direction );
2815	gl_FragColor = texture2D( tEquirect, sampleUV );
2816	#include <tonemapping_fragment>
2817	#include <colorspace_fragment>
2818}`,kc=`uniform float scale;
2819attribute float lineDistance;
2820varying float vLineDistance;
2821#include <common>
2822#include <uv_pars_vertex>
2823#include <color_pars_vertex>
2824#include <fog_pars_vertex>
2825#include <morphtarget_pars_vertex>
2826#include <logdepthbuf_pars_vertex>
2827#include <clipping_planes_pars_vertex>
2828void main() {
2829	vLineDistance = scale * lineDistance;
2830	#include <uv_vertex>
2831	#include <color_vertex>
2832	#include <morphinstance_vertex>
2833	#include <morphcolor_vertex>
2834	#include <begin_vertex>
2835	#include <morphtarget_vertex>
2836	#include <project_vertex>
2837	#include <logdepthbuf_vertex>
2838	#include <clipping_planes_vertex>
2839	#include <fog_vertex>
2840}`,Wc=`uniform vec3 diffuse;
2841uniform float opacity;
2842uniform float dashSize;
2843uniform float totalSize;
2844varying float vLineDistance;
2845#include <common>
2846#include <color_pars_fragment>
2847#include <uv_pars_fragment>
2848#include <map_pars_fragment>
2849#include <fog_pars_fragment>
2850#include <logdepthbuf_pars_fragment>
2851#include <clipping_planes_pars_fragment>
2852void main() {
2853	vec4 diffuseColor = vec4( diffuse, opacity );
2854	#include <clipping_planes_fragment>
2855	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2856		discard;
2857	}
2858	vec3 outgoingLight = vec3( 0.0 );
2859	#include <logdepthbuf_fragment>
2860	#include <map_fragment>
2861	#include <color_fragment>
2862	outgoingLight = diffuseColor.rgb;
2863	#include <opaque_fragment>
2864	#include <tonemapping_fragment>
2865	#include <colorspace_fragment>
2866	#include <fog_fragment>
2867	#include <premultiplied_alpha_fragment>
2868}`,Xc=`#include <common>
2869#include <batching_pars_vertex>
2870#include <uv_pars_vertex>
2871#include <envmap_pars_vertex>
2872#include <color_pars_vertex>
2873#include <fog_pars_vertex>
2874#include <morphtarget_pars_vertex>
2875#include <skinning_pars_vertex>
2876#include <logdepthbuf_pars_vertex>
2877#include <clipping_planes_pars_vertex>
2878void main() {
2879	#include <uv_vertex>
2880	#include <color_vertex>
2881	#include <morphinstance_vertex>
2882	#include <morphcolor_vertex>
2883	#include <batching_vertex>
2884	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2885		#include <beginnormal_vertex>
2886		#include <morphnormal_vertex>
2887		#include <skinbase_vertex>
2888		#include <skinnormal_vertex>
2889		#include <defaultnormal_vertex>
2890	#endif
2891	#include <begin_vertex>
2892	#include <morphtarget_vertex>
2893	#include <skinning_vertex>
2894	#include <project_vertex>
2895	#include <logdepthbuf_vertex>
2896	#include <clipping_planes_vertex>
2897	#include <worldpos_vertex>
2898	#include <envmap_vertex>
2899	#include <fog_vertex>
2900}`,qc=`uniform vec3 diffuse;
2901uniform float opacity;
2902#ifndef FLAT_SHADED
2903	varying vec3 vNormal;
2904#endif
2905#include <common>
2906#include <dithering_pars_fragment>
2907#include <color_pars_fragment>
2908#include <uv_pars_fragment>
2909#include <map_pars_fragment>
2910#include <alphamap_pars_fragment>
2911#include <alphatest_pars_fragment>
2912#include <alphahash_pars_fragment>
2913#include <aomap_pars_fragment>
2914#include <lightmap_pars_fragment>
2915#include <envmap_common_pars_fragment>
2916#include <envmap_pars_fragment>
2917#include <fog_pars_fragment>
2918#include <specularmap_pars_fragment>
2919#include <logdepthbuf_pars_fragment>
2920#include <clipping_planes_pars_fragment>
2921void main() {
2922	vec4 diffuseColor = vec4( diffuse, opacity );
2923	#include <clipping_planes_fragment>
2924	#include <logdepthbuf_fragment>
2925	#include <map_fragment>
2926	#include <color_fragment>
2927	#include <alphamap_fragment>
2928	#include <alphatest_fragment>
2929	#include <alphahash_fragment>
2930	#include <specularmap_fragment>
2931	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2932	#ifdef USE_LIGHTMAP
2933		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2934		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2935	#else
2936		reflectedLight.indirectDiffuse += vec3( 1.0 );
2937	#endif
2938	#include <aomap_fragment>
2939	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2940	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2941	#include <envmap_fragment>
2942	#include <opaque_fragment>
2943	#include <tonemapping_fragment>
2944	#include <colorspace_fragment>
2945	#include <fog_fragment>
2946	#include <premultiplied_alpha_fragment>
2947	#include <dithering_fragment>
2948}`,Yc=`#define LAMBERT
2949varying vec3 vViewPosition;
2950#include <common>
2951#include <batching_pars_vertex>
2952#include <uv_pars_vertex>
2953#include <displacementmap_pars_vertex>
2954#include <envmap_pars_vertex>
2955#include <color_pars_vertex>
2956#include <fog_pars_vertex>
2957#include <normal_pars_vertex>
2958#include <morphtarget_pars_vertex>
2959#include <skinning_pars_vertex>
2960#include <shadowmap_pars_vertex>
2961#include <logdepthbuf_pars_vertex>
2962#include <clipping_planes_pars_vertex>
2963void main() {
2964	#include <uv_vertex>
2965	#include <color_vertex>
2966	#include <morphinstance_vertex>
2967	#include <morphcolor_vertex>
2968	#include <batching_vertex>
2969	#include <beginnormal_vertex>
2970	#include <morphnormal_vertex>
2971	#include <skinbase_vertex>
2972	#include <skinnormal_vertex>
2973	#include <defaultnormal_vertex>
2974	#include <normal_vertex>
2975	#include <begin_vertex>
2976	#include <morphtarget_vertex>
2977	#include <skinning_vertex>
2978	#include <displacementmap_vertex>
2979	#include <project_vertex>
2980	#include <logdepthbuf_vertex>
2981	#include <clipping_planes_vertex>
2982	vViewPosition = - mvPosition.xyz;
2983	#include <worldpos_vertex>
2984	#include <envmap_vertex>
2985	#include <shadowmap_vertex>
2986	#include <fog_vertex>
2987}`,Kc=`#define LAMBERT
2988uniform vec3 diffuse;
2989uniform vec3 emissive;
2990uniform float opacity;
2991#include <common>
2992#include <dithering_pars_fragment>
2993#include <color_pars_fragment>
2994#include <uv_pars_fragment>
2995#include <map_pars_fragment>
2996#include <alphamap_pars_fragment>
2997#include <alphatest_pars_fragment>
2998#include <alphahash_pars_fragment>
2999#include <aomap_pars_fragment>
3000#include <lightmap_pars_fragment>
3001#include <emissivemap_pars_fragment>
3002#include <cube_uv_reflection_fragment>
3003#include <envmap_common_pars_fragment>
3004#include <envmap_pars_fragment>
3005#include <envmap_physical_pars_fragment>
3006#include <fog_pars_fragment>
3007#include <bsdfs>
3008#include <lights_pars_begin>
3009#include <normal_pars_fragment>
3010#include <lights_lambert_pars_fragment>
3011#include <shadowmap_pars_fragment>
3012#include <bumpmap_pars_fragment>
3013#include <normalmap_pars_fragment>
3014#include <specularmap_pars_fragment>
3015#include <logdepthbuf_pars_fragment>
3016#include <clipping_planes_pars_fragment>
3017void main() {
3018	vec4 diffuseColor = vec4( diffuse, opacity );
3019	#include <clipping_planes_fragment>
3020	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3021	vec3 totalEmissiveRadiance = emissive;
3022	#include <logdepthbuf_fragment>
3023	#include <map_fragment>
3024	#include <color_fragment>
3025	#include <alphamap_fragment>
3026	#include <alphatest_fragment>
3027	#include <alphahash_fragment>
3028	#include <specularmap_fragment>
3029	#include <normal_fragment_begin>
3030	#include <normal_fragment_maps>
3031	#include <emissivemap_fragment>
3032	#include <lights_lambert_fragment>
3033	#include <lights_fragment_begin>
3034	#include <lights_fragment_maps>
3035	#include <lights_fragment_end>
3036	#include <aomap_fragment>
3037	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3038	#include <envmap_fragment>
3039	#include <opaque_fragment>
3040	#include <tonemapping_fragment>
3041	#include <colorspace_fragment>
3042	#include <fog_fragment>
3043	#include <premultiplied_alpha_fragment>
3044	#include <dithering_fragment>
3045}`,Zc=`#define MATCAP
3046varying vec3 vViewPosition;
3047#include <common>
3048#include <batching_pars_vertex>
3049#include <uv_pars_vertex>
3050#include <color_pars_vertex>
3051#include <displacementmap_pars_vertex>
3052#include <fog_pars_vertex>
3053#include <normal_pars_vertex>
3054#include <morphtarget_pars_vertex>
3055#include <skinning_pars_vertex>
3056#include <logdepthbuf_pars_vertex>
3057#include <clipping_planes_pars_vertex>
3058void main() {
3059	#include <uv_vertex>
3060	#include <color_vertex>
3061	#include <morphinstance_vertex>
3062	#include <morphcolor_vertex>
3063	#include <batching_vertex>
3064	#include <beginnormal_vertex>
3065	#include <morphnormal_vertex>
3066	#include <skinbase_vertex>
3067	#include <skinnormal_vertex>
3068	#include <defaultnormal_vertex>
3069	#include <normal_vertex>
3070	#include <begin_vertex>
3071	#include <morphtarget_vertex>
3072	#include <skinning_vertex>
3073	#include <displacementmap_vertex>
3074	#include <project_vertex>
3075	#include <logdepthbuf_vertex>
3076	#include <clipping_planes_vertex>
3077	#include <fog_vertex>
3078	vViewPosition = - mvPosition.xyz;
3079}`,$c=`#define MATCAP
3080uniform vec3 diffuse;
3081uniform float opacity;
3082uniform sampler2D matcap;
3083varying vec3 vViewPosition;
3084#include <common>
3085#include <dithering_pars_fragment>
3086#include <color_pars_fragment>
3087#include <uv_pars_fragment>
3088#include <map_pars_fragment>
3089#include <alphamap_pars_fragment>
3090#include <alphatest_pars_fragment>
3091#include <alphahash_pars_fragment>
3092#include <fog_pars_fragment>
3093#include <normal_pars_fragment>
3094#include <bumpmap_pars_fragment>
3095#include <normalmap_pars_fragmen
3095t>
3096#include <logdepthbuf_pars_fragment>
3097#include <clipping_planes_pars_fragment>
3098void main() {
3099	vec4 diffuseColor = vec4( diffuse, opacity );
3100	#include <clipping_planes_fragment>
3101	#include <logdepthbuf_fragment>
3102	#include <map_fragment>
3103	#include <color_fragment>
3104	#include <alphamap_fragment>
3105	#include <alphatest_fragment>
3106	#include <alphahash_fragment>
3107	#include <normal_fragment_begin>
3108	#include <normal_fragment_maps>
3109	vec3 viewDir = normalize( vViewPosition );
3110	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3111	vec3 y = cross( viewDir, x );
3112	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3113	#ifdef USE_MATCAP
3114		vec4 matcapColor = texture2D( matcap, uv );
3115	#else
3116		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3117	#endif
3118	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3119	#include <opaque_fragment>
3120	#include <tonemapping_fragment>
3121	#include <colorspace_fragment>
3122	#include <fog_fragment>
3123	#include <premultiplied_alpha_fragment>
3124	#include <dithering_fragment>
3125}`,Jc=`#define NORMAL
3126#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3127	varying vec3 vViewPosition;
3128#endif
3129#include <common>
3130#include <batching_pars_vertex>
3131#include <uv_pars_vertex>
3132#include <displacementmap_pars_vertex>
3133#include <normal_pars_vertex>
3134#include <morphtarget_pars_vertex>
3135#include <skinning_pars_vertex>
3136#include <logdepthbuf_pars_vertex>
3137#include <clipping_planes_pars_vertex>
3138void main() {
3139	#include <uv_vertex>
3140	#include <batching_vertex>
3141	#include <beginnormal_vertex>
3142	#include <morphinstance_vertex>
3143	#include <morphnormal_vertex>
3144	#include <skinbase_vertex>
3145	#include <skinnormal_vertex>
3146	#include <defaultnormal_vertex>
3147	#include <normal_vertex>
3148	#include <begin_vertex>
3149	#include <morphtarget_vertex>
3150	#include <skinning_vertex>
3151	#include <displacementmap_vertex>
3152	#include <project_vertex>
3153	#include <logdepthbuf_vertex>
3154	#include <clipping_planes_vertex>
3155#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3156	vViewPosition = - mvPosition.xyz;
3157#endif
3158}`,Qc=`#define NORMAL
3159uniform float opacity;
3160#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3161	varying vec3 vViewPosition;
3162#endif
3163#include <uv_pars_fragment>
3164#include <normal_pars_fragment>
3165#include <bumpmap_pars_fragment>
3166#include <normalmap_pars_fragment>
3167#include <logdepthbuf_pars_fragment>
3168#include <clipping_planes_pars_fragment>
3169void main() {
3170	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3171	#include <clipping_planes_fragment>
3172	#include <logdepthbuf_fragment>
3173	#include <normal_fragment_begin>
3174	#include <normal_fragment_maps>
3175	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3176	#ifdef OPAQUE
3177		gl_FragColor.a = 1.0;
3178	#endif
3179}`,jc=`#define PHONG
3180varying vec3 vViewPosition;
3181#include <common>
3182#include <batching_pars_vertex>
3183#include <uv_pars_vertex>
3184#include <displacementmap_pars_vertex>
3185#include <envmap_pars_vertex>
3186#include <color_pars_vertex>
3187#include <fog_pars_vertex>
3188#include <normal_pars_vertex>
3189#include <morphtarget_pars_vertex>
3190#include <skinning_pars_vertex>
3191#include <shadowmap_pars_vertex>
3192#include <logdepthbuf_pars_vertex>
3193#include <clipping_planes_pars_vertex>
3194void main() {
3195	#include <uv_vertex>
3196	#include <color_vertex>
3197	#include <morphcolor_vertex>
3198	#include <batching_vertex>
3199	#include <beginnormal_vertex>
3200	#include <morphinstance_vertex>
3201	#include <morphnormal_vertex>
3202	#include <skinbase_vertex>
3203	#include <skinnormal_vertex>
3204	#include <defaultnormal_vertex>
3205	#include <normal_vertex>
3206	#include <begin_vertex>
3207	#include <morphtarget_vertex>
3208	#include <skinning_vertex>
3209	#include <displacementmap_vertex>
3210	#include <project_vertex>
3211	#include <logdepthbuf_vertex>
3212	#include <clipping_planes_vertex>
3213	vViewPosition = - mvPosition.xyz;
3214	#include <worldpos_vertex>
3215	#include <envmap_vertex>
3216	#include <shadowmap_vertex>
3217	#include <fog_vertex>
3218}`,eu=`#define PHONG
3219uniform vec3 diffuse;
3220uniform vec3 emissive;
3221uniform vec3 specular;
3222uniform float shininess;
3223uniform float opacity;
3224#include <common>
3225#include <dithering_pars_fragment>
3226#include <color_pars_fragment>
3227#include <uv_pars_fragment>
3228#include <map_pars_fragment>
3229#include <alphamap_pars_fragment>
3230#include <alphatest_pars_fragment>
3231#include <alphahash_pars_fragment>
3232#include <aomap_pars_fragment>
3233#include <lightmap_pars_fragment>
3234#include <emissivemap_pars_fragment>
3235#include <cube_uv_reflection_fragment>
3236#include <envmap_common_pars_fragment>
3237#include <envmap_pars_fragment>
3238#include <envmap_physical_pars_fragment>
3239#include <fog_pars_fragment>
3240#include <bsdfs>
3241#include <lights_pars_begin>
3242#include <normal_pars_fragment>
3243#include <lights_phong_pars_fragment>
3244#include <shadowmap_pars_fragment>
3245#include <bumpmap_pars_fragment>
3246#include <normalmap_pars_fragment>
3247#include <specularmap_pars_fragment>
3248#include <logdepthbuf_pars_fragment>
3249#include <clipping_planes_pars_fragment>
3250void main() {
3251	vec4 diffuseColor = vec4( diffuse, opacity );
3252	#include <clipping_planes_fragment>
3253	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3254	vec3 totalEmissiveRadiance = emissive;
3255	#include <logdepthbuf_fragment>
3256	#include <map_fragment>
3257	#include <color_fragment>
3258	#include <alphamap_fragment>
3259	#include <alphatest_fragment>
3260	#include <alphahash_fragment>
3261	#include <specularmap_fragment>
3262	#include <normal_fragment_begin>
3263	#include <normal_fragment_maps>
3264	#include <emissivemap_fragment>
3265	#include <lights_phong_fragment>
3266	#include <lights_fragment_begin>
3267	#include <lights_fragment_maps>
3268	#include <lights_fragment_end>
3269	#include <aomap_fragment>
3270	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3271	#include <envmap_fragment>
3272	#include <opaque_fragment>
3273	#include <tonemapping_fragment>
3274	#include <colorspace_fragment>
3275	#include <fog_fragment>
3276	#include <premultiplied_alpha_fragment>
3277	#include <dithering_fragment>
3278}`,tu=`#define STANDARD
3279varying vec3 vViewPosition;
3280#ifdef USE_TRANSMISSION
3281	varying vec3 vWorldPosition;
3282#endif
3283#include <common>
3284#include <batching_pars_vertex>
3285#include <uv_pars_vertex>
3286#include <displacementmap_pars_vertex>
3287#include <color_pars_vertex>
3288#include <fog_pars_vertex>
3289#include <normal_pars_vertex>
3290#include <morphtarget_pars_vertex>
3291#include <skinning_pars_vertex>
3292#include <shadowmap_pars_vertex>
3293#include <logdepthbuf_pars_vertex>
3294#include <clipping_planes_pars_vertex>
3295void main() {
3296	#include <uv_vertex>
3297	#include <color_vertex>
3298	#include <morphinstance_vertex>
3299	#include <morphcolor_vertex>
3300	#include <batching_vertex>
3301	#include <beginnormal_vertex>
3302	#include <morphnormal_vertex>
3303	#include <skinbase_vertex>
3304	#include <skinnormal_vertex>
3305	#include <defaultnormal_vertex>
3306	#include <normal_vertex>
3307	#include <begin_vertex>
3308	#include <morphtarget_vertex>
3309	#include <skinning_vertex>
3310	#include <displacementmap_vertex>
3311	#include <project_vertex>
3312	#include <logdepthbuf_vertex>
3313	#include <clipping_planes_vertex>
3314	vViewPosition = - mvPosition.xyz;
3315	#include <worldpos_vertex>
3316	#include <shadowmap_vertex>
3317	#include <fog_vertex>
3318#ifdef USE_TRANSMISSION
3319	vWorldPosition = worldPosition.xyz;
3320#endif
3321}`,nu=`#define STANDARD
3322#ifdef PHYSICAL
3323	#define IOR
3324	#define USE_SPECULAR
3325#endif
3326uniform vec3 diffuse;
3327uniform vec3 emissive;
3328uniform float roughness;
3329uniform float metalness;
3330uniform float opacity;
3331#ifdef IOR
3332	uniform float ior;
3333#endif
3334#ifdef USE_SPECULAR
3335	uniform float specularIntensity;
3336	uniform vec3 specularColor;
3337	#ifdef USE_SPECULAR_COLORMAP
3338		uniform sampler2D specularColorMap;
3339	#endif
3340	#ifdef USE_SPECULAR_INTENSITYMAP
3341		uniform sampler2D specularIntensityMap;
3342	#endif
3343#endif
3344#ifdef USE_CLEARCOAT
3345	uniform float clearcoat;
3346	uniform float clearcoatRoughness;
3347#endif
3348#ifdef USE_DISPERSION
3349	uniform float dispersion;
3350#endif
3351#ifdef USE_IRIDESCENCE
3352	uniform float iridescence;
3353	uniform float iridescenceIOR;
3354	uniform float iridescenceThicknessMinimum;
3355	uniform float iridescenceThicknessMaximum;
3356#endif
3357#ifdef USE_SHEEN
3358	uniform vec3 sheenColor;
3359	uniform float sheenRoughness;
3360	#ifdef USE_SHEEN_COLORMAP
3361		uniform sampler2D sheenColorMap;
3362	#endif
3363	#ifdef USE_SHEEN_ROUGHNESSMAP
3364		uniform sampler2D sheenRoughnessMap;
3365	#endif
3366#endif
3367#ifdef USE_ANISOTROPY
3368	uniform vec2 anisotropyVector;
3369	#ifdef USE_ANISOTROPYMAP
3370		uniform sampler2D anisotropyMap;
3371	#endif
3372#endif
3373varying vec3 vViewPosition;
3374#include <common>
3375#include <dithering_pars_fragment>
3376#include <color_pars_fragment>
3377#include <uv_pars_fragment>
3378#include <map_pars_fragment>
3379#include <alphamap_pars_fragment>
3380#include <alphatest_pars_fragment>
3381#include <alphahash_pars_fragment>
3382#include <aomap_pars_fragment>
3383#include <lightmap_pars_fragment>
3384#include <emissivemap_pars_fragment>
3385#include <iridescence_fragment>
3386#include <cube_uv_reflection_fragment>
3387#include <envmap_common_pars_fragment>
3388#include <envmap_physical_pars_fragment>
3389#include <fog_pars_fragment>
3390#include <lights_pars_begin>
3391#include <normal_pars_fragment>
3392#include <lights_physical_pars_fragment>
3393#include <transmission_pars_fragment>
3394#include <shadowmap_pars_fragment>
3395#include <bumpmap_pars_fragment>
3396#include <normalmap_pars_fragment>
3397#include <clearcoat_pars_fragment>
3398#include <iridescence_pars_fragment>
3399#include <roughnessmap_pars_fragment>
3400#include <metalnessmap_pars_fragment>
3401#include <logdepthbuf_pars_fragment>
3402#include <clipping_planes_pars_fragment>
3403void main() {
3404	vec4 diffuseColor = vec4( diffuse, opacity );
3405	#include <clipping_planes_fragment>
3406	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3407	vec3 totalEmissiveRadiance = emissive;
3408	#include <logdepthbuf_fragment>
3409	#include <map_fragment>
3410	#include <color_fragment>
3411	#include <alphamap_fragment>
3412	#include <alphatest_fragment>
3413	#include <alphahash_fragment>
3414	#include <roughnessmap_fragment>
3415	#include <metalnessmap_fragment>
3416	#include <normal_fragment_begin>
3417	#include <normal_fragment_maps>
3418	#include <clearcoat_normal_fragment_begin>
3419	#include <clearcoat_normal_fragment_maps>
3420	#include <emissivemap_fragment>
3421	#include <lights_physical_fragment>
3422	#include <lights_fragment_begin>
3423	#include <lights_fragment_maps>
3424	#include <lights_fragment_end>
3425	#include <aomap_fragment>
3426	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3427	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3428	#include <transmission_fragment>
3429	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3430	#ifdef USE_SHEEN
3431 
3432		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3433 
3434 	#endif
3435	#ifdef USE_CLEARCOAT
3436		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3437		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3438		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3439	#endif
3440	#include <opaque_fragment>
3441	#include <tonemapping_fragment>
3442	#include <colorspace_fragment>
3443	#include <fog_fragment>
3444	#include <premultiplied_alpha_fragment>
3445	#include <dithering_fragment>
3446}`,iu=`#define TOON
3447varying vec3 vViewPosition;
3448#include <common>
3449#include <batching_pars_vertex>
3450#include <uv_pars_vertex>
3451#include <displacementmap_pars_vertex>
3452#include <color_pars_vertex>
3453#include <fog_pars_vertex>
3454#include <normal_pars_vertex>
3455#include <morphtarget_pars_vertex>
3456#include <skinning_pars_vertex>
3457#include <shadowmap_pars_vertex>
3458#include <logdepthbuf_pars_vertex>
3459#include <clipping_planes_pars_vertex>
3460void main() {
3461	#include <uv_vertex>
3462	#include <color_vertex>
3463	#include <morphinstance_vertex>
3464	#include <morphcolor_vertex>
3465	#include <batching_vertex>
3466	#include <beginnormal_vertex>
3467	#include <morphnormal_vertex>
3468	#include <skinbase_vertex>
3469	#include <skinnormal_vertex>
3470	#include <defaultnormal_vertex>
3471	#include <normal_vertex>
3472	#include <begin_vertex>
3473	#include <morphtarget_vertex>
3474	#include <skinning_vertex>
3475	#include <displacementmap_vertex>
3476	#include <project_vertex>
3477	#include <logdepthbuf_vertex>
3478	#include <clipping_planes_vertex>
3479	vViewPosition = - mvPosition.xyz;
3480	#include <worldpos_vertex>
3481	#include <shadowmap_vertex>
3482	#include <fog_vertex>
3483}`,ru=`#define TOON
3484uniform vec3 diffuse;
3485uniform vec3 emissive;
3486uniform float opacity;
3487#include <common>
3488#include <dithering_pars_fragment>
3489#include <color_pars_fragment>
3490#include <uv_pars_fragment>
3491#include <map_pars_fragment>
3492#include <alphamap_pars_fragment>
3493#include <alphatest_pars_fragment>
3494#include <alphahash_pars_fragment>
3495#include <aomap_pars_fragment>
3496#include <lightmap_pars_fragment>
3497#include <emissivemap_pars_fragment>
3498#include <gradientmap_pars_fragment>
3499#include <fog_pars_fragment>
3500#include <bsdfs>
3501#include <lights_pars_begin>
3502#include <normal_pars_fragment>
3503#include <lights_toon_pars_fragment>
3504#include <shadowmap_pars_fragment>
3505#include <bumpmap_pars_fragment>
3506#include <normalmap_pars_fragment>
3507#include <logdepthbuf_pars_fragment>
3508#include <clipping_planes_pars_fragment>
3509void main() {
3510	vec4 diffuseColor = vec4( diffuse, opacity );
3511	#include <clipping_planes_fragment>
3512	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3513	vec3 totalEmissiveRadiance = emissive;
3514	#include <logdepthbuf_fragment>
3515	#include <map_fragment>
3516	#include <color_fragment>
3517	#include <alphamap_fragment>
3518	#include <alphatest_fragment>
3519	#include <alphahash_fragment>
3520	#include <normal_fragment_begin>
3521	#include <normal_fragment_maps>
3522	#include <emissivemap_fragment>
3523	#include <lights_toon_fragment>
3524	#include <lights_fragment_begin>
3525	#include <lights_fragment_maps>
3526	#include <lights_fragment_end>
3527	#include <aomap_fragment>
3528	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3529	#include <opaque_fragment>
3530	#include <tonemapping_fragment>
3531	#include <colorspace_fragment>
3532	#include <fog_fragment>
3533	#include <premultiplied_alpha_fragment>
3534	#include <dithering_fragment>
3535}`,su=`uniform float size;
3536uniform float scale;
3537#include <common>
3538#include <color_pars_vertex>
3539#include <fog_pars_vertex>
3540#include <morphtarget_pars_vertex>
3541#include <logdepthbuf_pars_vertex>
3542#include <clipping_planes_pars_vertex>
3543#ifdef USE_POINTS_UV
3544	varying vec2 vUv;
3545	uniform mat3 uvTransform;
3546#endif
3547void main() {
3548	#ifdef USE_POINTS_UV
3549		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3550	#endif
3551	#include <color_vertex>
3552	#include <morphinstance_vertex>
3553	#include <morphcolor_vertex>
3554	#include <begin_vertex>
3555	#include <morphtarget_vertex>
3556	#include <project_vertex>
3557	gl_PointSize = size;
3558	#ifdef USE_SIZEATTENUATION
3559		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3560		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3561	#endif
3562	#include <logdepthbuf_vertex>
3563	#include <clipping_planes_vertex>
3564	#include <worldpos_vertex>
3565	#include <fog_vertex>
3566}`,au=`uniform vec3 diffuse;
3567uniform float opacity;
3568#include <common>
3569#include <color_pars_fragment>
3570#include <map_particle_pars_fragment>
3571#include <alphatest_pars_fragment>
3572#include <alphahash_pars_fragment>
3573#include <fog_pars_fragment>
3574#include <logdepthbuf_pars_fragment>
3575#include <clipping_planes_pars_fragment>
3576void main() {
3577	vec4 diffuseColor = vec4( diffuse, opacity );
3578	#include <clipping_planes_fragment>
3579	vec3 outgoingLight = vec3( 0.0 );
3580	#include <logdepthbuf_fragment>
3581	#include <map_particle_fragment>
3582	#include <color_fragment>
3583	#include <alphatest_fragment>
3584	#include <alphahash_fragment>
3585	outgoingLight = diffuseColor.rgb;
3586	#include <opaque_fragment>
3587	#include <tonemapping_fragment>
3588	#include <colorspace_fragment>
3589	#include <fog_fragment>
3590	#include <premultiplied_alpha_fragment>
3591}`,ou=`#include <common>
3592#include <batching_pars_vertex>
3593#include <fog_pars_vertex>
3594#include <morphtarget_pars_vertex>
3595#include <skinning_pars_vertex>
3596#include <logdepthbuf_pars_vertex>
3597#include <shadowmap_pars_vertex>
3598void main() {
3599	#include <batching_vertex>
3600	#include <beginnormal_vertex>
3601	#include <morphinstance_vertex>
3602	#include <morphnormal_vertex>
3603	#include <skinbase_vertex>
3604	#include <skinnormal_vertex>
3605	#include <defaultnormal_vertex>
3606	#include <begin_vertex>
3607	#include <morphtarget_vertex>
3608	#include <skinning_vertex>
3609	#include <project_vertex>
3610	#include <logdepthbuf_vertex>
3611	#include <worldpos_vertex>
3612	#include <shadowmap_vertex>
3613	#include <fog_vertex>
3614}`,lu=`uniform vec3 color;
3615uniform float opacity;
3616#include <common>
3617#include <fog_pars_fragment>
3618#include <bsdfs>
3619#include <lights_pars_begin>
3620#include <logdepthbuf_pars_fragment>
3621#include <shadowmap_pars_fragment>
3622#include <shadowmask_pars_fragment>
3623void main() {
3624	#include <logdepthbuf_fragment>
3625	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3626	#include <tonemapping_fragment>
3627	#include <colorspace_fragment>
3628	#include <fog_fragment>
3629	#include <premultiplied_alpha_fragment>
3630}`,cu=`uniform float rotation;
3631uniform vec2 center;
3632#include <common>
3633#include <uv_pars_vertex>
3634#include <fog_pars_vertex>
3635#include <logdepthbuf_pars_vertex>
3636#include <clipping_planes_pars_vertex>
3637void main() {
3638	#include <uv_vertex>
3639	vec4 mvPosition = modelViewMatrix[ 3 ];
3640	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3641	#ifndef USE_SIZEATTENUATION
3642		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3643		if ( isPerspective ) scale *= - mvPosition.z;
3644	#endif
3645	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3646	vec2 rotatedPosition;
3647	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3648	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3649	mvPosition.xy += rotatedPosition;
3650	gl_Position = projectionMatrix * mvPosition;
3651	#include <logdepthbuf_vertex>
3652	#include <clipping_planes_vertex>
3653	#include <fog_vertex>
3654}`,uu=`uniform vec3 diffuse;
3655uniform float opacity;
3656#include <common>
3657#include <uv_pars_fragment>
3658#include <map_pars_fragment>
3659#include <alphamap_pars_fragment>
3660#include <alphatest_pars_fragment>
3661#include <alphahash_pars_fragment>
3662#include <fog_pars_fragment>
3663#include <logdepthbuf_pars_fragment>
3664#include <clipping_planes_pars_fragment>
3665void main() {
3666	vec4 diffuseColor = vec4( diffuse, opacity );
3667	#include <clipping_planes_fragment>
3668	vec3 outgoingLight = vec3( 0.0 );
3669	#include <logdepthbuf_fragment>
3670	#include <map_fragment>
3671	#include <alphamap_fragment>
3672	#include <alphatest_fragment>
3673	#include <alphahash_fragment>
3674	outgoingLight = diffuseColor.rgb;
3675	#include <opaque_fragment>
3676	#include <tonemapping_fragment>
3677	#include <colorspace_fragment>
3678	#include <fog_fragment>
3679}`,Ve={alphahash_fragment:Do,alphahash_pars_fragment:Lo,alphamap_fragment:Fo,alphamap_pars_fragment:Io,alphatest_fragment:Uo,alphatest_pars_fragment:No,aomap_fragment:Bo,aomap_pars_fragment:Oo,batching_pars_vertex:Go,batching_vertex:zo,begin_vertex:Vo,beginnormal_vertex:Ho,bsdfs:ko,iridescence_fragment:Wo,bumpmap_pars_fragment:Xo,clipping_planes_fragment:qo,clipping_planes_pars_fragment:Yo,clipping_planes_pars_vertex:Ko,clipping_planes_vertex:Zo,color_fragment:$o,color_pars_fragment:Jo,color_pars_vertex:Qo,color_vertex:jo,common:el,cube_uv_reflection_fragment:tl,defaultnormal_vertex:nl,displacementmap_pars_vertex:il,displacementmap_vertex:rl,emissivemap_fragment:sl,emissivemap_pars_fragment:al,colorspace_fragment:ol,colorspace_pars_fragment:ll,envmap_fragment:cl,envmap_common_pars_fragment:ul,envmap_pars_fragment:hl,envmap_pars_vertex:dl,envmap_physical_pars_fragment:yl,envmap_vertex:fl,fog_vertex:pl,fog_pars_vertex:ml,fog_fragment:gl,fog_pars_fragment:_l,gradientmap_pars_fragment:xl,lightmap_pars_fragment:vl,lights_lambert_fragment:Ml,lights_lambert_pars_fragment:Sl,lights_pars_begin:El,lights_toon_fragment:Tl,lights_toon_pars_fragment:bl,lights_phong_fragment:Al,lights_phong_pars_fragment:Rl,lights_physical_fragment:wl,lights_physical_pars_fragment:Cl,lights_fragment_begin:Pl,lights_fragment_maps:Dl,lights_fragment_end:Ll,lightprobes_pars_fragment:Fl,logdepthbuf_fragment:Il,logdepthbuf_pars_fragment:Ul,logdepthbuf_pars_vertex:Nl,logdepthbuf_vertex:Bl,map_fragment:Ol,map_pars_fragment:Gl,map_particle_fragment:zl,map_particle_pars_fragment:Vl,metalnessmap_fragment:Hl,metalnessmap_pars_fragment:kl,morphinstance_vertex:Wl,morphcolor_vertex:Xl,morphnormal_vertex:ql,morphtarget_pars_vertex:Yl,morphtarget_vertex:Kl,normal_fragment_begin:Zl,normal_fragment_maps:$l,normal_pars_fragment:Jl,normal_pars_vertex:Ql,normal_vertex:jl,normalmap_pars_fragment:ec,clearcoat_normal_fragment_begin:tc,clearcoat_normal_fragment_maps:nc,clearcoat_pars_fragment:ic,iridescence_pars_fragment:rc,opaque_fragment:sc,packing:ac,premultiplied_alpha_fragment:oc,project_vertex:lc,dithering_fragment:cc,dithering_pars_fragment:uc,roughnessmap_fragment:hc,roughnessmap_pars_fragment:dc,shadowmap_pars_fragment:fc,shadowmap_pars_vertex:pc,shadowmap_vertex:mc,shadowmask_pars_fragment:gc,skinbase_vertex:_c,skinning_pars_vertex:xc,skinning_vertex:vc,skinnormal_vertex:Mc,specularmap_fragment:Sc,specularmap_pars_fragment:Ec,tonemapping_fragment:yc,tonemapping_pars_fragment:Tc,transmission_fragment:bc,transmission_pars_fragment:Ac,uv_pars_fragment:Rc,uv_pars_vertex:wc,uv_vertex:Cc,worldpos_vertex:Pc,background_vert:Dc,background_frag:Lc,backgroundCube_vert:Fc,backgroundCube_frag:Ic,cube_vert:Uc,cube_frag:Nc,depth_vert:Bc,depth_frag:Oc,distance_vert:Gc,distance_frag:zc,equirect_vert:Vc,equirect_frag:Hc,linedashed_vert:kc,linedashed_frag:Wc,meshbasic_vert:Xc,meshbasic_frag:qc,meshlambert_vert:Yc,meshlambert_frag:Kc,meshmatcap_vert:Zc,meshmatcap_frag:$c,meshnormal_vert:Jc,meshnormal_frag:Qc,meshphong_vert:jc,meshphong_frag:eu,meshphysical_vert:tu,meshphysical_frag:nu,meshtoon_vert:iu,meshtoon_frag:ru,points_vert:su,points_frag:au,shadow_vert:ou,shadow_frag:lu,sprite_vert:cu,sprite_frag:uu},me={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new We(1,1)}}
vendor: 4,149 bytes, line 3679
3679,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new P},probesMax:{value:new P},probesResolution:{value:new P}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},on={basic:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Ve.meshbasic_vert,fragmentShader:Ve.meshbasic_frag},lambert:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ie(0)},envMapIntensity:{value:1}}]),vertexShader:Ve.meshlambert_vert,fragmentShader:Ve.meshlambert_frag},phong:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphong_vert,fragmentShader:Ve.meshphong_frag},standard:{uniforms:It([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag},toon:{uniforms:It([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Ie(0)}}]),vertexShader:Ve.meshtoon_vert,fragmentShader:Ve.meshtoon_frag},matcap:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Ve.meshmatcap_vert,fragmentShader:Ve.meshmatcap_frag},points:{uniforms:It([me.points,me.fog]),vertexShader:Ve.points_vert,fragmentShader:Ve.points_frag},dashed:{uniforms:It([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ve.linedashed_vert,fragmentShader:Ve.linedashed_frag},depth:{uniforms:It([me.common,me.displacementmap]),vertexShader:Ve.depth_vert,fragmentShader:Ve.depth_frag},normal:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Ve.meshnormal_vert,fragmentShader:Ve.meshnormal_frag}
vendor: 4,585 bytes, line 3679
3679,sprite:{uniforms:It([me.sprite,me.fog]),vertexShader:Ve.sprite_vert,fragmentShader:Ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ve.background_vert,fragmentShader:Ve.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:Ve.backgroundCube_vert,fragmentShader:Ve.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ve.cube_vert,fragmentShader:Ve.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ve.equirect_vert,fragmentShader:Ve.equirect_frag},distance:{uniforms:It([me.common,me.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ve.distance_vert,fragmentShader:Ve.distance_frag},shadow:{uniforms:It([me.lights,me.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:Ve.shadow_vert,fragmentShader:Ve.shadow_frag}};on.physical={uniforms:It([on.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new We(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new We},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag};const ji={r:0,b:0,g:0},hu=new et,Da=new Be;Da.set(-1,0,0,0,1,0,0,0,1);function du(i,e,t,n,r,s){const a=new Ie(0);let o=r===!0?0:1,l,c,f=null,g=0,u=null;function m(b){let R=b.isScene===!0?b.background:null;if(R&&R.isTexture){const M=b.backgroundBlurriness>0;R=e.get(R,M)}return R}function x(b){let R=!1;const M=m(b);M===null?p(a,o):M&&M.isColor&&(p(M,1),R=!0);const A=i.xr.getEnvironmentBlendMode();A==="additive"?t.buffers.color.setClear(0,0,0,1,s):A==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||R)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(b,R){const M=m(R);M&&(M.isCubeTexture||M.mapping===306)?(c===void 0&&(c=new qt(new li(1,1,1),new Jt({name:"BackgroundCubeMaterial",uniforms:oi(on.backgroundCube.uniforms),vertexShader:on.backgroundCube.vertexShader,fragmentShader:on.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(A,y,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(hu.makeRotationFromEuler(R.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Da),c.material.toneMapped=Ye.getTransfer(M.colorSpace)!==je,(f!==M||g!==M.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,f=M,g=M.version,u=i.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new qt(new bi(2,2),new Jt({name:"Backgroun
3679dMaterial",uniforms:oi(on.background.uniforms),vertexShader:on.background.vertexShader,fragmentShader:on.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.toneMapped=Ye.getTransfer(M.colorSpace)!==je,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(f!==M||g!==M.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,f=M,g=M.version,u=i.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function p(b,R){b.getRGB(ji,Aa(i)),t.buffers.color.setClear(ji.r,ji.g,ji.b,R,s)}function h(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,R=1){a.set(b),o=R,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(b){o=b,p(a,o)},render:x,addToRenderList:S,dispose:h}}function fu(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(D,N,K,$,z){let q=!1;const k=g(D,$,K,N);s!==k&&(s=k,c(s.object)),q=m(D,$,K,z),q&&x(D,$,K,z),z!==null&&e.update(z,i.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,M(D,N,K,$),z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return i.createVertexArray()}function c(D){return i.bindVertexArray(D)}function f(D){return i.deleteVertexArray(D)}function g(D,N,K,$){const z=$.wireframe===!0;let q=n[N.id];q===void 0&&(q={},n[N.id]=q);const k=D.isInstancedMesh===!0?D.id:0;let Q=q[k];Q===void 0&&(Q={},q[k]=Q);let ee=Q[K.id];ee===void 0&&(ee={},Q[K.id]=ee);let ue=ee[z];return ue===void 0&&(ue=u(l()),ee[z]=ue),ue}function u(D){const N=[],K=[],$=[];for(let z=0;z<t;z++)N[z]=0,K[z]=0,$[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:K,attributeDivisors:$,object:D,attributes:{},index:null}}function m(D,N,K,$){const z=s.attributes,q=N.attributes;let k=0;const Q=K.getAttributes();for(const ee in Q)if(Q[ee].location>=0){const pe=z[ee];let ve=q[ee];if(ve===void 0&&(ee==="instanceMatrix"&&D.instanceMatrix&&(ve=D.instanceMatrix),ee==="instanceColor"&&D.instanceColor&&(ve=D.instanceColor)),pe===void 0||pe.attribute!==ve||ve&&pe.data!==ve.data)return!0;k++}return s.attributesNum!==k||s.index!==$}function x(D,N,K,$){const z={},q=N.attributes;let k=0;const Q=K.getAttributes();for(const ee in Q)if(Q[ee].location>=0){let pe=q[ee];pe===void 0&&(ee==="instanceMatrix"&&D.instanceMatrix&&(pe=D.instanceMatrix),ee==="instanceColor"&&D.instanceColor&&(pe=D.instanceColor));const ve={};ve.attribute=pe,pe&&pe.data&&(ve.data=pe.data),z[ee]=ve,k++}s.attributes=z,s.attributesNum=k,s.index=$}function S(){const D=s.newAttributes;for(let N=0,K=D.length;N<K;N++)D[N]=0}function p(D){h(D,0)}function h(D,N){const K=s.newAttributes,$=s.enabledAttributes,z=s.attributeDivisors;K[D]=1,$[D]===0&&(i.enableVertexAttribArray(D),$[D]=1),z[D]!==N&&(i.vertexAttribDivisor(D,N),z[D]=N)}function b(){const D=s.newAttributes,N=s.enabledAttributes;for(let K=0,$=N.length;K<$;K++)N[K]!==D[K]&&(i.disableVertexAttribArray(K),N[K]=0)}function R(D,N,K,$,z,q,k){k===!0?i.vertexAttribIPointer(D,N,K,z,q):i.vertexAttribPointer(D,N,K,$,z,q)}function M(D,N,K,$){S();const z=$.attributes,q=K.getAttributes(),k=N.defaultAttributeValues;for(const Q in q){const ee=q[Q];if(ee.location>=0){let ue=z[Q];if(ue===void 0&&(Q==="instanceMatrix"&&D.instanceMatrix&&(ue=D.instanceMatrix),Q==="instanceColor"&&D.instanceColor&&(ue=D.instanceColor)),ue!==void 0){const pe=ue.normalized,ve=ue.itemSize,Xe=e.get(ue);if(Xe===void 0)continue;const tt=Xe.buffer,Ne=Xe.type,J=Xe.bytesPerElement,ae=Ne===i.INT||Ne===i.UNSIGNED_INT||ue.gpuType===1013;if(ue.isInterleavedBufferAttribute){const ne=ue.data,De=ne.stride,Fe=ue.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<ee.locationSize;Ce++)h(ee.location+Ce,ne.meshPerAttribute);D.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<ee.locationSize;Ce++)p(ee.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,tt);for(let Ce=0;Ce<ee.locationSize;Ce++)R(ee.location+Ce,ve/ee.locationSize,Ne,pe,De*J,(Fe+ve/ee.locationSize*Ce)*J,ae)}else{if(ue.isInstancedBufferAttribute){for(let ne=0;ne<ee.locationSize;ne++)h(ee.location+ne,ue.meshPerAttribute);D.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let ne=0;ne<ee.locationSize;ne++)p(ee.location+ne);i.bindBuffer(i.ARRAY_BUFFER,tt);for(let ne=0;ne<ee.locationSize;ne++)R(ee.location+ne,ve/ee.locationSize,Ne,pe,ve*J,ve/ee.locationSize*ne*J,ae)}}else if(k!==void 0){const pe=k[Q];if(pe!==void 0)switch(pe.length){case 2:i.vertexAttrib2fv(ee.location,pe);break;case 3:i.vertexAttrib3fv(ee.location,pe);break;case 4:i.vertexAttrib4fv(ee.location,pe);break;default:i.vertexAttrib1fv(ee.location,pe)}}}}b()}function A(){T();for(const D in n){const N=n[D];for(const K in N){const $=N[K];for(const z in $){const q=$[z];for(const k in q)f(q[k].object),delete q[k];delete $[z]}}delete n[D]}}
3679function y(D){if(n[D.id]===void 0)return;const N=n[D.id];for(const K in N){const $=N[K];for(const z in $){const q=$[z];for(const k in q)f(q[k].object),delete q[k];delete $[z]}}delete n[D.id]}function C(D){for(const N in n){const K=n[N];for(const $ in K){const z=K[$];if(z[D.id]===void 0)continue;const q=z[D.id];for(const k in q)f(q[k].object),delete q[k];delete z[D.id]}}}function _(D){for(const N in n){const K=n[N],$=D.isInstancedMesh===!0?D.id:0,z=K[$];if(z!==void 0){for(const q in z){const k=z[q];for(const Q in k)f(k[Q].object),delete k[Q];delete z[q]}delete K[$],Object.keys(K).length===0&&delete n[N]}}}function T(){I(),a=!0,s!==r&&(s=r,c(s.object))}function I(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:T,resetDefaultState:I,dispose:A,releaseStatesOfGeometry:y,releaseStatesOfObject:_,releaseStatesOfProgram:C,initAttributes:S,enableAttribute:p,disableUnusedAttributes:b}}function pu(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,f){f!==0&&(i.drawArraysInstanced(n,l,c,f),t.update(c,n,f))}function o(l,c,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,f);let u=0;for(let m=0;m<f;m++)u+=c[m];t.update(u,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function mu(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(C){return!(C!==1023&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const _=C===1016&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==1009&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==1015&&!_)}function l(C){if(C==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const f=l(c);f!==c&&(Le("WebGLRenderer:",c,"not supported, using",f,"instead."),c=f);const g=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Le("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),h=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),A=i.getParameter(i.MAX_SAMPLES),y=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:g,reversedDepthBuffer:u,maxTextures:m,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:p,maxAttributes:h,maxVertexUniforms:b,maxVaryings:R,maxFragmentUniforms:M,maxSamples:A,samples:y}}function gu(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new In,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(g,u){const m=g.length!==0||u||n!==0||r;return r=u,n=g.length,m},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(g,u){t=f(g,u,0)},this.setState=function(g,u,m){const x=g.clippingPlanes,S=g.clipIntersection,p=g.clipShadows,h=i.get(g);if(!r||x===null||x.length===0||s&&!p)s?f(null):c();else{const b=s?0:n,R=b*4;let M=h.clippingState||null;l.value=M,M=f(x,u,R,m);for(let A=0;A!==R;++A)M[A]=t[A];h.clippingState=M,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(g,u,m,x){const S=g!==null?g.length:0;let p=null;if(S!==0){if(p=l.value,x!==!0||p===null){const h=m+S*4,b=u.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length<h)&&(p=new Float32Array(h));for(let R=0,M=m;R!==S;++R,M+=4)a.copy(g[R]).applyMatrix4(b,o),a.normal.toArray(p,M),p[M+3]=a.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,p}}const wn=4,Vs=[.125,.215,.35,.446,.526,.582],Un=20,_u=256,Mi=new cr,Hs=new Ie;let Gr=null,zr=0,Vr=0,Hr=!1;const xu=new P;class ks{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=xu}=s;Gr=this._renderer.getRenderTarget(),zr=this._renderer.getActiveCubeFace(),Vr=this._renderer.getActiveMipmapLevel(),Hr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=qs(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Xs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Gr,zr,Vr),this._renderer.xr.enabled=Hr,e.scissorTest=!1,ii(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Gr=this._renderer.getRenderTarget(),zr=this._renderer.getActiveCubeFace(),Vr=this._renderer.getActiveMipmapLevel(),Hr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:rr,depthBuffer:!1}
vendor: 7,239 bytes, lines 3679-3752
3679,r=Ws(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ws(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=vu(s)),this._blurMaterial=Su(s,e,t),this._ggxMaterial=Mu(s,e,t)}return r}_compileMaterial(e){const t=new qt(new Bt,e);this._renderer.compile(t,Mi)}_sceneToCubeUV(e,t,n,r,s){const l=new Xt(90,1,t,n),c=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],g=this._renderer,u=g.autoClear,m=g.toneMapping;g.getClearColor(Hs),g.toneMapping=0,g.autoClear=!1,g.state.buffers.depth.getReversed()&&(g.setRenderTarget(r),g.clearDepth(),g.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new qt(new li,new Sa({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const S=this._backgroundBox,p=S.material;let h=!1;const b=e.background;b?b.isColor&&(p.color.copy(b),e.background=null,h=!0):(p.color.copy(Hs),h=!0);for(let R=0;R<6;R++){const M=R%3;M===0?(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+f[R],s.y,s.z)):M===1?(l.up.set(0,0,c[R]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+f[R],s.z)):(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+f[R]));const A=this._cubeSize;ii(r,M*A,R>2?A:0,A,A),g.setRenderTarget(r),h&&g.render(S,l),g.render(e,l)}g.toneMapping=m,g.autoClear=u,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=qs()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Xs());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;ii(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Mi)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),f=t/(this._lodMeshes.length-1),g=Math.sqrt(c*c-f*f),u=0+c*1.25,m=g*u,{_lodMax:x}=this,S=this._sizeLods[n],p=3*S*(n>x-wn?n-x+wn:0),h=4*(this._cubeSize-S);l.envMap.value=e.texture,l.roughness.value=m,l.mipInt.value=x-t,ii(s,p,h,3*S,2*S),r.setRenderTarget(s),r.render(o,Mi),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=x-n,ii(e,p,h,3*S,2*S),r.setRenderTarget(e),r.render(o,Mi)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&$e("blur direction must be either latitudinal or longitudinal!");const f=3,g=this._lodMeshes[r];g.material=c;const u=c.uniforms,m=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*Un-1),S=s/x,p=isFinite(s)?1+Math.floor(f*S):Un;p>Un&&Le(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Un}`);const h=[];let b=0;for(let C=0;C<Un;++C){const _=C/S,T=Math.exp(-_*_/2);h.push(T),C===0?b+=T:C<p&&(b+=2*T)}for(let C=0;C<h.length;C++)h[C]=h[C]/b;u.envMap.value=e.texture,u.samples.value=p,u.weights.value=h,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:R}=this;u.dTheta.value=x,u.mipInt.value=R-n;const M=this._sizeLods[r],A=3*M*(r>R-wn?r-R+wn:0),y=4*(this._cubeSize-M);ii(t,A,y,3*M,2*M),l.setRenderTarget(t),l.render(g,Mi)}}function vu(i){const e=[],t=[],n=[];let r=i;const s=i-wn+1+Vs.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>i-wn?l=Vs[a-i+wn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),f=-c,g=1+c,u=[f,f,g,f,g,g,f,f,g,g,f,g],m=6,x=6,S=3,p=2,h=1,b=new Float32Array(S*x*m),R=new Float32Array(p*x*m),M=new Float32Array(h*x*m);for(let y=0;y<m;y++){const C=y%3*2/3-1,_=y>2?0:-1,T=[C,_,0,C+2/3,_,0,C+2/3,_+1,0,C,_,0,C+2/3,_+1,0,C,_+1,0];b.set(T,S*x*y),R.set(u,p*x*y);const I=[y,y,y,y,y,y];M.set(I,h*x*y)}const A=new Bt;A.setAttribute("position",new Gt(b,S)),A.setAttribute("uv",new Gt(R,p)),A.setAttribute("faceIndex",new Gt(M,h)),n.push(new qt(A,null)),r>wn&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Ws(i,e,t){const n=new ln(i,e,t);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ii(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Mu(i,e,t){return new Jt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:_u,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:ur(),fragmentShader:`
3680
3681			precision highp float;
3682			precision highp int;
3683
3684			varying vec3 vOutputDirection;
3685
3686			uniform sampler2D envMap;
3687			uniform float roughness;
3688			uniform float mipInt;
3689
3690			#define ENVMAP_TYPE_CUBE_UV
3691			#include <cube_uv_reflection_fragment>
3692
3693			#define PI 3.14159265359
3694
3695			// Van der Corput radical inverse
3696			float radicalInverse_VdC(uint bits) {
3697				bits = (bits << 16u) | (bits >> 16u);
3698				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3699				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3700				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3701				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3702				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3703			}
3704
3705			// Hammersley sequence
3706			vec2 hammersley(uint i, uint N) {
3707				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3708			}
3709
3710			// GGX VNDF importance sampling (Eric Heitz 2018)
3711			// "Sampling the GGX Distribution of Visible Normals"
3712			// https://jcgt.org/published/0007/04/01/
3713			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3714				float alpha = roughness * roughness;
3715
3716				// Section 4.1: Orthonormal basis
3717				vec3 T1 = vec3(1.0, 0.0, 0.0);
3718				vec3 T2 = cross(V, T1);
3719
3720				// Section 4.2: Parameterization of projected area
3721				float r = sqrt(Xi.x);
3722				float phi = 2.0 * PI * Xi.y;
3723				float t1 = r * cos(phi);
3724				float t2 = r * sin(phi);
3725				float s = 0.5 * (1.0 + V.z);
3726				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3727
3728				// Section 4.3: Reprojection onto hemisphere
3729				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3730
3731				// Section 3.4: Transform back to ellipsoid configuration
3732				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3733			}
3734
3735			void main() {
3736				vec3 N = normalize(vOutputDirection);
3737				vec3 V = N; // Assume view direction equals normal for pre-filtering
3738
3739				vec3 prefilteredColor = vec3(0.0);
3740				float totalWeight = 0.0;
3741
3742				// For very low roughness, just sample the environment directly
3743				if (roughness < 0.001) {
3744					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3745					return;
3746				}
3747
3748				// Tangent space basis for VNDF sampling
3749				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3750				vec3 tangent = normalize(cross(up, N));
3751				vec3 bitangent = cross(N, tangent);
3752
3753				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3754					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3755
3756					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3757					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3758
3759					// Transform H back to world space
3760					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3761					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3762
3763					float NdotL = max(dot(N, L), 0.0);
3764
3765					if(NdotL > 0.0) {
3766						// Sample environment at fixed mip level
3767						// VNDF importance sampling handles the distribution filtering
3768						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3769
3770						// Weight by NdotL for the split-sum approximation
3771						// VNDF PDF naturally accounts for the visible microfacet distribution
3772						prefilteredColor += sampleColor * NdotL;
3773						totalWeight += NdotL;
3774					}
3775				}
3776
3777				if (totalWeight > 0.0) {
3778					prefilteredColor = prefilteredColor / totalWeight;
3779				}
3780
3781				gl_FragColor = vec4(prefilteredColor, 1.0);
3782			}
3783		`,blending:0,depthTest:!1,depthWrite:!1})}function Su(i,e,t){const n=new Float32Array(Un),r=new P(0,1,0);return new Jt({name:"SphericalGaussianBlur",defines:{n:Un,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ur(),fragmentShader:`
3784
3785			precision mediump float;
3786			precision mediump int;
3787
3788			varying vec3 vOutputDirection;
3789
3790			uniform sampler2D envMap;
3791			uniform int samples;
3792			uniform float weights[ n ];
3793			uniform bool latitudinal;
3794			uniform float dTheta;
3795			uniform float mipInt;
3796			uniform vec3 poleAxis;
3797
3798			#define ENVMAP_TYPE_CUBE_UV
3799			#include <cube_uv_reflection_fragment>
3800
3801			vec3 getSample( float theta, vec3 axis ) {
3802
3803				float cosTheta = cos( theta );
3804				// Rodrigues' axis-angle rotation
3805				vec3 sampleDirection = vOutputDirection * cosTheta
3806					+ cross( axis, vOutputDirection ) * sin( theta )
3807					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3808
3809				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3810
3811			}
3812
3813			void main() {
3814
3815				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3816
3817				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3818
3819					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3820
3821				}
3822
3823				axis = normalize( axis );
3824
3825				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3826				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3827
3828				for ( int i = 1; i < n; i++ ) {
3829
3830					if ( i >= samples ) {
3831
3832						break;
3833
3834					}
3835
3836					float theta = dTheta * float( i );
3837					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3838					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3839
3840				}
3841
3842			}
3843		`,blending:0,depthTest:!1,depthWrite:!1})}function Xs(){return new Jt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ur(),fragmentShader:`
3844
3845			precision mediump float;
3846			precision mediump int;
3847
3848			varying vec3 vOutputDirection;
3849
3850			uniform sampler2D envMap;
3851
3852			#include <common>
3853
3854			void main() {
3855
3856				vec3 outputDirection = normalize( vOutputDirection );
3857				vec2 uv = equirectUv( outputDirection );
3858
3859				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3860
3861			}
3862		`,blending:0,depthTest:!1,depthWrite:!1})}function qs(){return new Jt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ur(),fragmentShader:`
3863
3864			precision mediump float;
3865			precision mediump int;
3866
3867			uniform float flipEnvMap;
3868
3869			varying vec3 vOutputDirection;
3870
3871			uniform samplerCube envMap;
3872
3873			void main() {
3874
3875				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3876
3877			}
3878		`,blending:0,depthTest:!1,depthWrite:!1})}function ur(){return`
3879
3880		precision mediump float;
3881		precision mediump int;
3882
3883		attribute float faceIndex;
3884
3885		varying vec3 vOutputDirection;
3886
3887		// RH coordinate system; PMREM face-indexing convention
3888		vec3 getDirection( vec2 uv, float face ) {
3889
3890			uv = 2.0 * uv - 1.0;
3891
3892			vec3 direction = vec3( uv, 1.0 );
3893
3894			if ( face == 0.0 ) {
3895
3896				direction = direction.zyx; // ( 1, v, u ) pos x
3897
3898			} else if ( face == 1.0 ) {
3899
3900				direction = direction.xzy;
3901				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3902
3903			} else if ( face == 2.0 ) {
3904
3905				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3906
3907			} else if ( face == 3.0 ) {
3908
3909				direction = direction.zyx;
3910				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3911
3912			} else if ( face == 4.0 ) {
3913
3914				direction = direction.xzy;
3915				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3916
3917			} else if ( face == 5.0 ) {
3918
3919				direction.z *= -1.0; // ( u, v, -1 ) neg z
3920
3921			}
3922
3923			return direction;
3924
3925		}
3926
3927		void main() {
3928
3929			vOutputDirection = getDirection( uv, faceIndex );
3930			gl_Position = vec4( position, 1.0 );
3931
3932		}
3933	`}class La extends ln{constructor(e=1,t={}
vendor: 25,745 bytes, lines 3933-4049
3933){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ta(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
3934
3935				varying vec3 vWorldDirection;
3936
3937				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3938
3939					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3940
3941				}
3942
3943				void main() {
3944
3945					vWorldDirection = transformDirection( position, modelMatrix );
3946
3947					#include <begin_vertex>
3948					#include <project_vertex>
3949
3950				}
3951			`,fragmentShader:`
3952
3953				uniform sampler2D tEquirect;
3954
3955				varying vec3 vWorldDirection;
3956
3957				#include <common>
3958
3959				void main() {
3960
3961					vec3 direction = normalize( vWorldDirection );
3962
3963					vec2 sampleUV = equirectUv( direction );
3964
3965					gl_FragColor = texture2D( tEquirect, sampleUV );
3966
3967				}
3968			`},r=new li(5,5,5),s=new Jt({name:"CubemapFromEquirect",uniforms:oi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;const a=new qt(r,s),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=1006),new Ro(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function Eu(i){let e=new WeakMap,t=new WeakMap,n=null;function r(u,m=!1){return u==null?null:m?a(u):s(u)}function s(u){if(u&&u.isTexture){const m=u.mapping;if(m===303||m===304)if(e.has(u)){const x=e.get(u).texture;return o(x,u.mapping)}else{const x=u.image;if(x&&x.height>0){const S=new La(x.height);return S.fromEquirectangularTexture(i,u),e.set(u,S),u.addEventListener("dispose",c),o(S.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const m=u.mapping,x=m===303||m===304,S=m===301||m===302;if(x||S){let p=t.get(u);const h=p!==void 0?p.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==h)return n===null&&(n=new ks(i)),p=x?n.fromEquirectangular(u,p):n.fromCubemap(u,p),p.texture.pmremVersion=u.pmremVersion,t.set(u,p),p.texture;if(p!==void 0)return p.texture;{const b=u.image;return x&&b&&b.height>0||S&&b&&l(b)?(n===null&&(n=new ks(i)),p=x?n.fromEquirectangular(u):n.fromCubemap(u),p.texture.pmremVersion=u.pmremVersion,t.set(u,p),u.addEventListener("dispose",f),p.texture):null}}}return u}function o(u,m){return m===303?u.mapping=301:m===304&&(u.mapping=302),u}function l(u){let m=0;const x=6;for(let S=0;S<x;S++)u[S]!==void 0&&m++;return m===x}function c(u){const m=u.target;m.removeEventListener("dispose",c);const x=e.get(m);x!==void 0&&(e.delete(m),x.dispose())}function f(u){const m=u.target;m.removeEventListener("dispose",f);const x=t.get(m);x!==void 0&&(t.delete(m),x.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:g}}function yu(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&ri("WebGLRenderer: "+n+" extension not supported."),r}}}function Tu(i,e,t,n){const r={},s=new WeakMap;function a(g){const u=g.target;u.index!==null&&e.remove(u.index);for(const x in u.attributes)e.remove(u.attributes[x]);u.removeEventListener("dispose",a),delete r[u.id];const m=s.get(u);m&&(e.remove(m),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(g,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function l(g){const u=g.attributes;for(const m in u)e.update(u[m],i.ARRAY_BUFFER)}function c(g){const u=[],m=g.index,x=g.attributes.position;let S=0;if(x===void 0)return;if(m!==null){const b=m.array;S=m.version;for(let R=0,M=b.length;R<M;R+=3){const A=b[R+0],y=b[R+1],C=b[R+2];u.push(A,y,y,C,C,A)}}else{const b=x.array;S=x.version;for(let R=0,M=b.length/3-1;R<M;R+=3){const A=R+0,y=R+1,C=R+2;u.push(A,y,y,C,C,A)}}const p=new(x.count>=65535?Ma:va)(u,1);p.version=S;const h=s.get(g);h&&e.remove(h),s.set(g,p)}function f(g){const u=s.get(g);if(u){const m=g.index;m!==null&&u.version<m.version&&c(g)}else c(g);return s.get(g)}return{get:o,update:l,getWireframeAttribute:f}}function bu(i,e,t){let n;function r(g){n=g}let s,a;function o(g){s=g.type,a=g.bytesPerElement}function l(g,u){i.drawElements(n,u,s,g*a),t.update(u,n,1)}function c(g,u,m){m!==0&&(i.drawElementsInstanced(n,u,s,g*a,m),t.update(u,n,m))}function f(g,u,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,u,0,s,g,0,m);let S=0;for(let p=0;p<m;p++)S+=u[p];t.update(S,n,1)}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=f}function Au(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:$e("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Ru(i,e,t){const n=new WeakMap,r=new ft;function s(a,o,l){const c=a.morphTargetInfluences,f=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,g=f!==void 0?f.length:0;let u=n.get(o);if(u===void 0||u.count!==g){let T=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",T)};u!==void 0&&u.texture.dispose();const m=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,S=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],h=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let R=0;m===!0&&(R=1),x===!0&&(R=2),S===!0&&(R=3);let M=o.attributes.position.count*R,A=1;M>e.maxTextureSize&&(A=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const y=new Float32Array(M*A*4*g),C=new ga(y,M,A,g);C.type=1015,C.needsUpdate=!0;const _=R*4;for(let I=0;I<g;I++){const D=p[I],N=h[I],K=b[I],$=M*A*4*I;for(let z=0;z<D.count;z++){const q=z*_;m===!0&&(r.fromBufferAttribute(D,z),y[$+q+0]=r.x,y[$+q+1]=r.y,y[$+q+2]=r.z,y[$+q+3]=0),x===!0&&(r.fromBufferAttribute(N,z),y[$+q+4]=r.x,y[$+q+5]=r.y,y[$+q+6]=r.z,y[$+q+7]=0),S===!0&&(r.fromBufferAttribute(K,z),y[$+q+8]=r.x,y[$+q+9]=r.y,y[$+q+10]=r.z,y[$+q+11]=K.itemSize===4?r.w:1)}}u={count:g,texture:C,size:new We(M,A)},n.set(o,u),o.addEventListener("dispose",T)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let m=0;for(let S=0;S<c.length;S++)m+=c[S];const x=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(i,"morphTargetBaseInfluence",x),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function wu(i,e,t,n,r){let s=new WeakMap;function a(c){const f=r.render.frame,g=c.geometry,u=e.get(c,g);if(s.get(u)!==f&&(e.update(u),s.set(u,f)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==f&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,f))),c.isSkinnedMesh){const m=c.skeleton;s.get(m)!==f&&(m.update(),s.set(m,f))}return u}function o(){s=new WeakMap}function l(c){const f=c.target;f.removeEventListener("dispose",l),n.releaseStatesOfObject(f),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:a,dispose:o}}const Cu={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function Pu(i,e,t,n,r,s){const a=new ln(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new ai(e,t):void 0}),o=new ln(e,t,{type:1016,depthBuffer:!1,stencilBuffer:!1}),l=new Bt;l.setAttribute("position",new Nt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Nt([0,2,0,0,2,0],2));const c=new Mo({uniforms:{tDiffuse:{value:null}},vertexShader:`
3969			precision highp float;
3970
3971			uniform mat4 modelViewMatrix;
3972			uniform mat4 projectionMatrix;
3973
3974			attribute vec3 position;
3975			attribute vec2 uv;
3976
3977			varying vec2 vUv;
3978
3979			void main() {
3980				vUv = uv;
3981				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3982			}`,fragmentShader:`
3983			precision highp float;
3984
3985			uniform sampler2D tDiffuse;
3986
3987			varying vec2 vUv;
3988
3989			#include <tonemapping_pars_fragment>
3990			#include <colorspace_pars_fragment>
3991
3992			void main() {
3993				gl_FragColor = texture2D( tDiffuse, vUv );
3994
3995				#ifdef LINEAR_TONE_MAPPING
3996					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3997				#elif defined( REINHARD_TONE_MAPPING )
3998					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3999				#elif defined( CINEON_TONE_MAPPING )
4000					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
4001				#elif defined( ACES_FILMIC_TONE_MAPPING )
4002					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4003				#elif defined( AGX_TONE_MAPPING )
4004					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4005				#elif defined( NEUTRAL_TONE_MAPPING )
4006					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4007				#elif defined( CUSTOM_TONE_MAPPING )
4008					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4009				#endif
4010
4011				#ifdef SRGB_TRANSFER
4012					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4013				#endif
4014			}`,depthTest:!1,depthWrite:!1}),f=new qt(l,c),g=new cr(-1,1,1,-1,0,1);let u=null,m=null,x=!1,S,p=null,h=[],b=!1;this.setSize=function(R,M){a.setSize(R,M),o.setSize(R,M);for(let A=0;A<h.length;A++){const y=h[A];y.setSize&&y.setSize(R,M)}},this.setEffects=function(R){h=R,b=h.length>0&&h[0].isRenderPass===!0;const M=a.width,A=a.height;for(let y=0;y<h.length;y++){const C=h[y];C.setSize&&C.setSize(M,A)}},this.begin=function(R,M){if(x||R.toneMapping===0&&h.length===0)return!1;if(p=M,M!==null){const A=M.width,y=M.height;(a.width!==A||a.height!==y)&&this.setSize(A,y)}return b===!1&&R.setRenderTarget(a),S=R.toneMapping,R.toneMapping=0,!0},this.hasRenderPass=function(){return b},this.end=function(R,M){R.toneMapping=S,x=!0;let A=a,y=o;for(let C=0;C<h.length;C++){const _=h[C];if(_.enabled!==!1&&(_.render(R,y,A,M),_.needsSwap!==!1)){const T=A;A=y,y=T}}if(u!==R.outputColorSpace||m!==R.toneMapping){u=R.outputColorSpace,m=R.toneMapping,c.defines={},Ye.getTransfer(u)===je&&(c.defines.SRGB_TRANSFER="");const C=Cu[m];C&&(c.defines[C]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=A.texture,R.setRenderTarget(p),R.render(f,g),p=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),l.dispose(),c.dispose()}}const Fa=new Ut,$r=new ai(1,1),Ia=new ga,Ua=new Ka,Na=new Ta,Ys=[],Ks=[],Zs=new Float32Array(16),$s=new Float32Array(9),Js=new Float32Array(4);function ci(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Ys[r];if(s===void 0&&(s=new Float32Array(r),Ys[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function yt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Tt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function hr(i,e){let t=Ks[e];t===void 0&&(t=new Int32Array(e),Ks[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Du(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Lu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(yt(t,e))return;i.uniform2fv(this.addr,e),Tt(t,e)}}function Fu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(yt(t,e))return;i.uniform3fv(this.addr,e),Tt(t,e)}}function Iu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(yt(t,e))return;i.uniform4fv(this.addr,e),Tt(t,e)}}function Uu(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Tt(t,e)}else{if(yt(t,n))return;Js.set(n),i.uniformMatrix2fv(this.addr,!1,Js),Tt(t,n)}}function Nu(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Tt(t,e)}else{if(yt(t,n))return;$s.set(n),i.uniformMatrix3fv(this.addr,!1,$s),Tt(t,n)}}function Bu(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Tt(t,e)}else{if(yt(t,n))return;Zs.set(n),i.uniformMatrix4fv(this.addr,!1,Zs),Tt(t,n)}}function Ou(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Gu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(yt(t,e))return;i.uniform2iv(this.addr,e),Tt(t,e)}}function zu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(yt(t,e))return;i.uniform3iv(this.addr,e),Tt(t,e)}}function Vu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(yt(t,e))return;i.uniform4iv(this.addr,e),Tt(t,e)}}function Hu(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function ku(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(yt(t,e))return;i.uniform2uiv(this.addr,e),Tt(t,e)}}function Wu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(yt(t,e))return;i.uniform3uiv(this.addr,e),Tt(t,e)}}function Xu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(yt(t,e))return;i.uniform4uiv(this.addr,e),Tt(t,e)}}function qu(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?($r.compareFunction=t.isReversedDepthBuffer()?518:515,s=$r):s=Fa,t.setTexture2D(e||s,r)}function Yu(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Ua,r)}function Ku(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Na,r)}function Zu(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Ia,r)}function $u(i){switch(i){case 5126:return Du;case 35664:return Lu;case 35665:return Fu;case 35666:return Iu;case 35674:return Uu;case 35675:return Nu;case 35676:return Bu;case 5124:case 35670:return Ou;case 35667:case 35671:return Gu;case 35668:case 35672:return zu;case 35669:case 35673:return Vu;case 5125:return Hu;case 36294:return ku;case 36295:return Wu;case 36296:return Xu;case 35678:case 36198:case 36298:case 36306:case 35682:return qu;case 35679:case 36299:case 36307:return Yu;case 35680:case 36300:case 36308:case 36293:return Ku;case 36289:case 36303:case 36311:case 36292:return Zu}}function Ju(i,e){i.uniform1fv(this.addr,e)}function Qu(i,e){const t=ci(e,this.size,2);i.uniform2fv(this.addr,t)}function ju(i,e){const t=ci(e,this.size,3);i.uniform3fv(this.addr,t)}function eh(i,e){const t=ci(e,this.size,4);i.uniform4fv(this.addr,t)}function th(i,e){const t=ci(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function nh(i,e){const t=ci(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function ih(i,e){const t=ci(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function rh(i,e){i.uniform1iv(this.addr,e)}function sh(i,e){i.uniform2iv(this.addr,e)}function ah(i,e){i.uniform3iv(this.addr,e)}function oh(i,e){i.uniform4iv(this.addr,e)}function lh(i,e){i.uniform1uiv(this.addr,e)}function ch(i,e){i.uniform2uiv(this.addr,e)}function uh(i,e){i.uniform3uiv(this.addr,e)}function hh(i,e){i.uniform4uiv(this.addr,e)}function dh(i,e,t){const n=this.cache,r=e.length,s=hr(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),Tt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=$r:a=Fa;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function fh(i,e,t){const n=this.cache,r=e.length,s=hr(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),Tt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Ua,s[a])}function ph(i,e,t){const n=this.cache,r=e.length,s=hr(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),Tt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Na,s[a])}function mh(i,e,t){const n=this.cache,r=e.length,s=hr(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),Tt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Ia,s[a])}function gh(i){switch(i){case 5126:return Ju;case 35664:return Qu;case 35665:return ju;case 35666:return eh;case 35674:return th;case 35675:return nh;case 35676:return ih;case 5124:case 35670:return rh;case 35667:case 35671:return sh;case 35668:case 35672:return ah;case 35669:case 35673:return oh;case 5125:return lh;case 36294:return ch;case 36295:return uh;case 36296:return hh;case 35678:case 36198:case 36298:case 36306:case 35682:return dh;case 35679:case 36299:case 36307:return fh;case 35680:case 36300:case 36308:case 36293:return ph;case 36289:case 36303:case 36311:case 36292:return mh}}class _h{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=$u(t.type)}}class xh{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=gh(t.type)}}class vh{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const kr=/(\w+)(\])?(\[|\.)?/g;function Qs(i,e){i.seq.push(e),i.map[e.id]=e}function Mh(i,e,t){const n=i.name,r=n.length;for(kr.lastIndex=0;;){const s=kr.exec(n),a=kr.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Qs(t,c===void 0?new _h(o,i,e):new xh(o,i,e));break}else{let g=t.map[o];g===void 0&&(g=new vh(o),Qs(t,g)),t=g}}}class ir{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);Mh(o,l,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function js(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Sh=37297;let Eh=0;function yh(i,e){const t=i.split(`
4015`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
4016`)}const ea=new Be;function Th(i){Ye._getMatrix(ea,Ye.workingColorSpace,i);const e=`mat3( ${ea.elements.map(t=>t.toFixed(4))} )`;switch(Ye.getTransfer(i)){case sr:return[e,"LinearTransferOETF"];case je:return[e,"sRGBTransferOETF"];default:return Le("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ta(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
4017
4018`+s+`
4019
4020`+yh(i.getShaderSource(e),o)}else return s}function bh(i,e){const t=Th(e);return[`vec4 ${i}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4021`)}const Ah={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"};function Rh(i,e){const t=Ah[e];return t===void 0?(Le("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const er=new P;function wh(){Ye.getLuminanceCoefficients(er);const i=er.x.toFixed(4),e=er.y.toFixed(4),t=er.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
4022`)}function Ch(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(yi).join(`
4023`)}function Ph(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
4024`)}function Dh(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function yi(i){return i!==""}function na(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ia(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Lh=/^[ \t]*#include +<([\w\d./]+)>/gm;function Jr(i){return i.replace(Lh,Ih)}const Fh=new Map;function Ih(i,e){let t=Ve[e];if(t===void 0){const n=Fh.get(e);if(n!==void 0)t=Ve[n],Le('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Jr(t)}const Uh=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ra(i){return i.replace(Uh,Nh)}function Nh(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function sa(i){let e=`precision ${i.precision} float;
4025	precision ${i.precision} int;
4026	precision ${i.precision} sampler2D;
4027	precision ${i.precision} samplerCube;
4028	precision ${i.precision} sampler3D;
4029	precision ${i.precision} sampler2DArray;
4030	precision ${i.precision} sampler2DShadow;
4031	precision ${i.precision} samplerCubeShadow;
4032	precision ${i.precision} sampler2DArrayShadow;
4033	precision ${i.precision} isampler2D;
4034	precision ${i.precision} isampler3D;
4035	precision ${i.precision} isamplerCube;
4036	precision ${i.precision} isampler2DArray;
4037	precision ${i.precision} usampler2D;
4038	precision ${i.precision} usampler3D;
4039	precision ${i.precision} usamplerCube;
4040	precision ${i.precision} usampler2DArray;
4041	`;return i.precision==="highp"?e+=`
4042#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
4043#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
4044#define LOW_PRECISION`),e}const Bh={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"};function Oh(i){return Bh[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Gh={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"};function zh(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Gh[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const Vh={302:"ENVMAP_MODE_REFRACTION"};function Hh(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Vh[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const kh={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function Wh(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":kh[i.combine]||"ENVMAP_BLENDING_NONE"}function Xh(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function qh(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Oh(t),c=zh(t),f=Hh(t),g=Wh(t),u=Xh(t),m=Ch(t),x=Ph(s),S=r.createProgram();let p,h,b=t.glslVersion?"#version "+t.glslVersion+`
4045`:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(yi).join(`
4046`),p.length>0&&(p+=`
4047`),h=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(yi).join(`
4048`),h.length>0&&(h+=`
4049`)):(p=[sa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.extensionCl
vendor: 6,566 bytes, lines 4049-4051
4049ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4050`].filter(yi).join(`
4051`),h=[sa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",t.envMap?"#define "+g:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4051IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==0?"#define TONE_MAPPING":"",t.toneMapping!==0?Ve.tonemapping_pars_fragment:"",t.toneMapping!==0?Rh("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ve.colorspace_pars_fragment,bh("linearToOutputTexel",t.outputColorSpace),wh(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4052`].filter(yi).join(`
4053`)),a=Jr(a),a=na(a,t),a=ia(a,t),o=Jr(o),o=na(o,t),o=ia(o,t),a=ra(a),o=ra(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
4054`,p=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4055`)+`
4056`+p,h=["#define varying in",t.glslVersion===as?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===as?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4057`)+`
4058`+h);const R=b+p+a,M=b+h+o,A=js(r,r.VERTEX_SHADER,R),y=js(r,r.FRAGMENT_SHADER,M);r.attachShader(S,A),r.attachShader(S,y),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S);function C(D){if(i.debug.checkShaderErrors){const N=r.getProgramInfoLog(S)||"",K=r.getShaderInfoLog(A)||"",$=r.getShaderInfoLog(y)||"",z=N.trim(),q=K.trim(),k=$.trim();let Q=!0,ee=!0;if(r.getProgramParameter(S,r.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,S,A,y);else{const ue=ta(r,A,"vertex"),pe=ta(r,y,"fragment");$e("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,r.VALIDATE_STATUS)+`
4059
4060Material Name: `+D.name+`
4061Material Type: `+D.type+`
4062
4063Program Info Log: `+z+`
4064`+ue+`
4065`+pe)}else z!==""?Le("WebGLProgram: Program Info Log:",z):(q===""||k==="")&&(ee=!1);ee&&(D.diagnostics={runnable:Q,programLog:z,vertexShader:{log:q,prefix:p},fragmentShader:{log:k,prefix:h}})}r.deleteShader(A),r.deleteShader(y),_=new ir(r,S),T=Dh(r,S)}let _;this.getUniforms=function(){return _===void 0&&C(this),_};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let I=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=r.getProgramParameter(S,Sh)),I},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Eh++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=A,this.fragmentShader=y,this}let Yh=0;class Kh{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Zh(e),t.set(e,n)),n}}class Zh{constructor(e){this.id=Yh++,this.code=e,this.usedTimes=0}}function $h(i){return i===1030||i===37490||i===36285}
4065function Jh(i,e,t,n,r,s){const a=new _a,o=new Kh,l=new Set,c=[],f=new Map,g=n.logarithmicDepthBuffer;let u=n.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(_){return l.add(_),_===0?"uv":`uv${_}`}function S(_,T,I,D,N,K){const $=D.fog,z=N.geometry,q=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?D.environment:null,k=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,Q=e.get(_.envMap||q,k),ee=Q&&Q.mapping===306?Q.image.height:null,ue=m[_.type];_.precision!==null&&(u=n.getMaxPrecision(_.precision),u!==_.precision&&Le("WebGLProgram.getParameters:",_.precision,"not supported, using",u,"instead."));const pe=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,ve=pe!==void 0?pe.length:0;let Xe=0;z.morphAttributes.position!==void 0&&(Xe=1),z.morphAttributes.normal!==void 0&&(Xe=2),z.morphAttributes.color!==void 0&&(Xe=3);let tt,Ne,J,ae;if(ue){const Ee=on[ue];tt=Ee.vertexShader,Ne=Ee.fragmentShader}else{tt=_.vertexShader,Ne=_.fragmentShader;const Ee=o.getVertexShaderStage(_),dt=o.getFragmentShaderStage(_);o.update(_,Ee,dt),J=Ee.id,ae=dt.id}const ne=i.getRenderTarget(),De=i.state.buffers.depth.getReversed(),Fe=N.isInstancedMesh===!0,Ce=N.isBatchedMesh===!0,ct=!!_.map,He=!!_.matcap,Qe=!!Q,ze=!!_.aoMap,qe=!!_.lightMap,gt=!!_.bumpMap&&_.wireframe===!1,ut=!!_.normalMap,_t=!!_.displacementMap,St=!!_.emissiveMap,ht=!!_.metalnessMap,nt=!!_.roughnessMap,L=_.anisotropy>0,bt=_.clearcoat>0,Je=_.dispersion>0,E=_.iridescence>0,d=_.sheen>0,U=_.transmission>0,B=L&&!!_.anisotropyMap,V=bt&&!!_.clearcoatMap,ie=bt&&!!_.clearcoatNormalMap,oe=bt&&!!_.clearcoatRoughnessMap,W=E&&!!_.iridescenceMap,Z=E&&!!_.iridescenceThicknessMap,le=d&&!!_.sheenColorMap,ye=d&&!!_.sheenRoughnessMap,he=!!_.specularMap,ce=!!_.specularColorMap,Te=!!_.specularIntensityMap,we=U&&!!_.transmissionMap,Ue=U&&!!_.thicknessMap,w=!!_.gradientMap,re=!!_.alphaMap,X=_.alphaTest>0,se=!!_.alphaHash,de=!!_.extensions;let j=0;_.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(j=i.toneMapping);const Se={shaderID:ue,shaderType:_.type,shaderName:_.name,vertexShader:tt,fragmentShader:Ne,defines:_.defines,customVertexShaderID:J,customFragmentShaderID:ae,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:u,batching:Ce,batchingColor:Ce&&N._colorsTexture!==null,instancing:Fe,instancingColor:Fe&&N.instanceColor!==null,instancingMorph:Fe&&N.morphTexture!==null,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:Ye.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ct,matcap:He,envMap:Qe,envMapMode:Qe&&Q.mapping,envMapCubeUVHeight:ee,aoMap:ze,lightMap:qe,bumpMap:gt,normalMap:ut,displacementMap:_t,emissiveMap:St,normalMapObjectSpace:ut&&_.normalMapType===1,normalMapTangentSpace:ut&&_.normalMapType===0,packedNormalMap:ut&&_.normalMapType===0&&$h(_.normalMap.format),metalnessMap:ht,roughnessMap:nt,anisotropy:L,anisotropyMap:B,clearcoat:bt,clearcoatMap:V,clearcoatNormalMap:ie,clearcoatRoughnessMap:oe,dispersion:Je,iridescence:E,iridescenceMap:W,iridescenceThicknessMap:Z,sheen:d,sheenColorMap:le,sheenRoughnessMap:ye,specularMap:he,specularColorMap:ce,specularIntensityMap:Te,transmission:U,transmissionMap:we,thicknessMap:Ue,gradientMap:w,opaque:_.transparent===!1&&_.blending===1&&_.alphaToCoverage===!1,alphaMap:re,alphaTest:X,alphaHash:se,combine:_.combine,mapUv:ct&&x(_.map.channel),aoMapUv:ze&&x(_.aoMap.channel),lightMapUv:qe&&x(_.lightMap.channel),bumpMapUv:gt&&x(_.bumpMap.channel),normalMapUv:ut&&x(_.normalMap.channel),displacementMapUv:_t&&x(_.displacementMap.channel),emissiveMapUv:St&&x(_.emissiveMap.channel),metalnessMapUv:ht&&x(_.metalnessMap.channel),roughnessMapUv:nt&&x(_.roughnessMap.channel),anisotropyMapUv:B&&x(_.anisotropyMap.channel),clearcoatMapUv:V&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:ie&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:Z&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:le&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:ye&&x(_.sheenRoughnessMap.channel),specularMapUv:he&&x(_.specularMap.channel),specularColorMapUv:ce&&x(_.specularColorMap.channel),specularIntensityMapUv:Te&&x(_.specularIntensityMap.channel),transmissionMapUv:we&&x(_.transmissionMap.channel),thicknessMapUv:Ue&&x(_.thicknessMap.channel),alphaMapUv:re&&x(_.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(ut||L),vertexNormals:!!z.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!z.attributes.uv&&(ct||re),fog:!!$,useFog:_.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||z.attributes.normal===void 0&&ut===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:De,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:z.attributes.position!==void 0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:Xe,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:K.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:i.shadowMap.enabled&&I.length>0,shadowMapType:i.shadowMap.type,toneMapping:j,decodeVideoTexture:ct&&_.map.isVideoTexture===!0&&Ye.getTransfer(_.map.colorSpace)===je,decodeVideoTextureEmissive:St&&_.emissiveMap.isVideoTexture===!0&&Ye.getTransfer(_.emissiveMap.colorSpace)===je,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===2,flipSided:_.side===1,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionCl
vendor: 10,060 bytes, line 4065
4065ipCullDistance:de&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(de&&_.extensions.multiDraw===!0||Ce)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Se.vertexUv1s=l.has(1),Se.vertexUv2s=l.has(2),Se.vertexUv3s=l.has(3),l.clear(),Se}function p(_){const T=[];if(_.shaderID?T.push(_.shaderID):(T.push(_.customVertexShaderID),T.push(_.customFragmentShaderID)),_.defines!==void 0)for(const I in _.defines)T.push(I),T.push(_.defines[I]);return _.isRawShaderMaterial===!1&&(h(T,_),b(T,_),T.push(i.outputColorSpace)),T.push(_.customProgramCacheKey),T.join()}function h(_,T){_.push(T.precision),_.push(T.outputColorSpace),_.push(T.envMapMode),_.push(T.envMapCubeUVHeight),_.push(T.mapUv),_.push(T.alphaMapUv),_.push(T.lightMapUv),_.push(T.aoMapUv),_.push(T.bumpMapUv),_.push(T.normalMapUv),_.push(T.displacementMapUv),_.push(T.emissiveMapUv),_.push(T.metalnessMapUv),_.push(T.roughnessMapUv),_.push(T.anisotropyMapUv),_.push(T.clearcoatMapUv),_.push(T.clearcoatNormalMapUv),_.push(T.clearcoatRoughnessMapUv),_.push(T.iridescenceMapUv),_.push(T.iridescenceThicknessMapUv),_.push(T.sheenColorMapUv),_.push(T.sheenRoughnessMapUv),_.push(T.specularMapUv),_.push(T.specularColorMapUv),_.push(T.specularIntensityMapUv),_.push(T.transmissionMapUv),_.push(T.thicknessMapUv),_.push(T.combine),_.push(T.fogExp2),_.push(T.sizeAttenuation),_.push(T.morphTargetsCount),_.push(T.morphAttributeCount),_.push(T.numDirLights),_.push(T.numPointLights),_.push(T.numSpotLights),_.push(T.numSpotLightMaps),_.push(T.numHemiLights),_.push(T.numRectAreaLights),_.push(T.numDirLightShadows),_.push(T.numPointLightShadows),_.push(T.numSpotLightShadows),_.push(T.numSpotLightShadowsWithMaps),_.push(T.numLightProbes),_.push(T.shadowMapType),_.push(T.toneMapping),_.push(T.numClippingPlanes),_.push(T.numClipIntersection),_.push(T.depthPacking)}function b(_,T){a.disableAll(),T.instancing&&a.enable(0),T.instancingColor&&a.enable(1),T.instancingMorph&&a.enable(2),T.matcap&&a.enable(3),T.envMap&&a.enable(4),T.normalMapObjectSpace&&a.enable(5),T.normalMapTangentSpace&&a.enable(6),T.clearcoat&&a.enable(7),T.iridescence&&a.enable(8),T.alphaTest&&a.enable(9),T.vertexColors&&a.enable(10),T.vertexAlphas&&a.enable(11),T.vertexUv1s&&a.enable(12),T.vertexUv2s&&a.enable(13),T.vertexUv3s&&a.enable(14),T.vertexTangents&&a.enable(15),T.anisotropy&&a.enable(16),T.alphaHash&&a.enable(17),T.batching&&a.enable(18),T.dispersion&&a.enable(19),T.batchingColor&&a.enable(20),T.gradientMap&&a.enable(21),T.packedNormalMap&&a.enable(22),T.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.reversedDepthBuffer&&a.enable(4),T.skinning&&a.enable(5),T.morphTargets&&a.enable(6),T.morphNormals&&a.enable(7),T.morphColors&&a.enable(8),T.premultipliedAlpha&&a.enable(9),T.shadowMapEnabled&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),T.decodeVideoTexture&&a.enable(19),T.decodeVideoTextureEmissive&&a.enable(20),T.alphaToCoverage&&a.enable(21),T.numLightProbeGrids>0&&a.enable(22),T.hasPositionAttribute&&a.enable(23),_.push(a.mask)}function R(_){const T=m[_.type];let I;if(T){const D=on[T];I=_o.clone(D.uniforms)}else I=_.uniforms;return I}function M(_,T){let I=f.get(T);return I!==void 0?++I.usedTimes:(I=new qh(i,T,_,r),c.push(I),f.set(T,I)),I}function A(_){if(--_.usedTimes===0){const T=c.indexOf(_);c[T]=c[c.length-1],c.pop(),f.delete(_.cacheKey),_.destroy()}}function y(_){o.remove(_)}function C(){o.dispose()}return{getParameters:S,getProgramCacheKey:p,getUniforms:R,acquireProgram:M,releaseProgram:A,releaseShaderCache:y,programs:c,dispose:C}}function Qh(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function jh(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function aa(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function oa(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u){let m=0;return u.isInstancedMesh&&(m+=2),u.isSkinnedMesh&&(m+=1),m}function o(u,m,x,S,p,h){let b=i[e];return b===void 0?(b={id:u.id,object:u,geometry:m,material:x,materialVariant:a(u),groupOrder:S,renderOrder:u.renderOrder,z:p,group:h},i[e]=b):(b.id=u.id,b.object=u,b.geometry=m,b.material=x,b.materialVariant=a(u),b.groupOrder=S,b.renderOrder=u.renderOrder,b.z=p,b.group=h),e++,b}function l(u,m,x,S,p,h){const b=o(u,m,x,S,p,h);x.transmission>0?n.push(b):x.transparent===!0?r.push(b):t.push(b)}function c(u,m,x,S,p,h){const b=o(u,m,x,S,p,h);x.transmission>0?n.unshift(b):x.transparent===!0?r.unshift(b):t.unshift(b)}function f(u,m,x){t.length>1&&t.sort(u||jh),n.length>1&&n.sort(m||aa),r.length>1&&r.sort(m||aa),x&&(t.reverse(),n.reverse(),r.reverse())}function g(){for(let u=e,m=i.length;u<m;u++){const x=i[u];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:g,sort:f}}function ed(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new oa,i.set(n,[a])):r>=s.length?(a=new oa,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function td(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new P,color:new Ie};break;case"SpotLight":t={position:new P,direction:new P,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":t={color:new Ie,position:new P,halfWidth:new P,halfHeight:new P};break}return i[e.id]=t,t}}}function nd(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let id=0;function rd(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function sd(i){const e=new td,t=nd(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new P);const r=new P,s=new et,a=new et;function o(c){let f=0,g=0,u=0;for(let T=0;T<9;T++)n.probe[T].set(0,0,0);let m=0,x=0,S=0,p=0,h=0,b=0,R=0,M=0,A=0,y=0,C=0;c.sort(rd);for(let T=0,I=c.length;T<I;T++){const D=c[T],N=D.color,K=D.intensity,$=D.distance;let z=null;if(D.shadow&&D.shadow.map&&(D.shadow.map.texture.format===1030?z=D.shadow.map.texture:z=D.shadow.map.depthTexture||D.shadow.map.texture),D.isAmbientLight)f+=N.r*K,g+=N.g*K,u+=N.b*K;else if(D.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(D.sh.coefficients[q],K);C++}else if(D.isDirectionalLight){const q=e.get(D);if(q.color.copy(D.color).multiplyScalar(D.intensity),D.castShadow){const k=D.shadow,Q=t.get(D);Q.shadowIntensity=k.intensity,Q.shadowBias=k.bias,Q.shadowNormalBias=k.normalBias,Q.shadowRadius=k.radius,Q.shadowMapSize=k.mapSize,n.directionalShadow[m]=Q,n.directionalShadowMap[m]=z,n.directionalShadowMatrix[m]=D.shadow.matrix,b++}n.directional[m]=q,m++}else if(D.isSpotLight){const q=e.get(D);q.position.setFromMatrixPosition(D.matrixWorld),q.color.copy(N).multiplyScalar(K),q.distance=$,q.coneCos=Math.cos(D.angle),q.penumbraCos=Math.cos(D.angle*(1-D.penumbra)),q.decay=D.decay,n.spot[S]=q;const k=D.shadow;if(D.map&&(n.spotLightMap[A]=D.map,A++,k.updateMatrices(D),D.castShadow&&y++),n.spotLightMatrix[S]=k.matrix,D.castShadow){const Q=t.get(D);Q.shadowIntensity=k.intensity,Q.shadowBias=k.bias,Q.shadowNormalBias=k.normalBias,Q.shadowRadius=k.radius,Q.shadowMapSize=k.mapSize,n.spotShadow[S]=Q,n.spotShadowMap[S]=z,M++}S++}else if(D.isRectAreaLight){const q=e.get(D);q.color.copy(N).multiplyScalar(K),q.halfWidth.set(D.width*.5,0,0),q.halfHeight.set(0,D.height*.5,0),n.rectArea[p]=q,p++}else if(D.isPointLight){const q=e.get(D);if(q.color.copy(D.color).multiplyScalar(D.intensity),q.distance=D.distance,q.decay=D.decay,D.castShadow){const k=D.shadow,Q=t.get(D);Q.shadowIntensity=k.intensity,Q.shadowBias=k.bias,Q.shadowNormalBias=k.normalBias,Q.shadowRadius=k.radius,Q.shadowMapSize=k.mapSize,Q.shadowCameraNear=k.camera.near,Q.shadowCameraFar=k.camera.far,n.pointShadow[x]=Q,n.pointShadowMap[x]=z,n.pointShadowMatrix[x]=D.shadow.matrix,R++}n.point[x]=q,x++}else if(D.isHemisphereLight){const q=e.get(D);q.skyColor.copy(D.color).multiplyScalar(K),q.groundColor.copy(D.groundColor).multiplyScalar(K),n.hemi[h]=q,h++}}p>
vendor: 1,825 bytes, line 4065
40650&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=f,n.ambient[1]=g,n.ambient[2]=u;const _=n.hash;(_.directionalLength!==m||_.pointLength!==x||_.spotLength!==S||_.rectAreaLength!==p||_.hemiLength!==h||_.numDirectionalShadows!==b||_.numPointShadows!==R||_.numSpotShadows!==M||_.numSpotMaps!==A||_.numLightProbes!==C)&&(n.directional.length=m,n.spot.length=S,n.rectArea.length=p,n.point.length=x,n.hemi.length=h,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=M+A-y,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=y,n.numLightProbes=C,_.directionalLength=m,_.pointLength=x,_.spotLength=S,_.rectAreaLength=p,_.hemiLength=h,_.numDirectionalShadows=b,_.numPointShadows=R,_.numSpotShadows=M,_.numSpotMaps=A,_.numLightProbes=C,n.version=id++)}function l(c,f){let g=0,u=0,m=0,x=0,S=0;const p=f.matrixWorldInverse;for(let h=0,b=c.length;h<b;h++){const R=c[h];if(R.isDirectionalLight){const M=n.directional[g];M.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(p),g++}else if(R.isSpotLight){const M=n.spot[m];M.position.setFromMatrixPosition(R.matrixWorld),M.position.applyMatrix4(p),M.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(p),m++}else if(R.isRectAreaLight){const M=n.rectArea[x];M.position.setFromMatrixPosition(R.matrixWorld),M.position.applyMatrix4(p),a.identity(),s.copy(R.matrixWorld),s.premultiply(
4065p),a.extractRotation(s),M.halfWidth.set(R.width*.5,0,0),M.halfHeight.set(0,R.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(R.isPointLight){const M=n.point[u];M.position.setFromMatrixPosition(R.matrixWorld),M.position.applyMatrix4(p),u++}else if(R.isHemisphereLight){const M=n.hemi[S];M.direction.setFromMatrixPosition(R.matrixWorld),M.direction.transformDirection(p),S++}}}return{setup:o,setupView:l,state:n}}function la(i){const e=new sd(i),t=[],n=[],r=[];function s(u){g.camera=u,t.length=0,n.length=0,r.length=0}function a(u){t.push(u)}function o(u){n.push(u)}function l(u){r.push(u)}function c(){e.setup(t)}function f(u){e.setupView(t,u)}const g={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:g,setupLights:c,setupLightsView:f,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function ad(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new la(i),e.set(r,[o])):s>=a.length?(o=new la(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const od=`void main() {
4066	gl_Position = vec4( position, 1.0 );
4067}`,ld=`uniform sampler2D shadow_pass;
4068uniform vec2 resolution;
4069uniform float radius;
4070void main() {
4071	const float samples = float( VSM_SAMPLES );
4072	float mean = 0.0;
4073	float squared_mean = 0.0;
4074	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4075	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4076	for ( float i = 0.0; i < samples; i ++ ) {
4077		float uvOffset = uvStart + i * uvStride;
4078		#ifdef HORIZONTAL_PASS
4079			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4080			mean += distribution.x;
4081			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4082		#else
4083			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4084			mean += depth;
4085			squared_mean += depth * depth;
4086		#endif
4087	}
4088	mean = mean / samples;
4089	squared_mean = squared_mean / samples;
4090	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4091	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4092}`,cd=[new P(1,0,0),new P(-1,0,0),new P(0,1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1)],ud=[new P(0,-1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1),new P(0,-1,0),new P(0,-1,0)],ca=new et,Si=new P,Wr=new P;function hd(i,e,t){let n=new ns;const r=new We,s=new We,a=new ft,o=new So,l=new Eo,c={},f=t.maxTextureSize,g={0:1,1:0,2:2},u=new Jt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:od,fragmentShader:ld}),m=u.clone();m.defines.HORIZONTAL_PASS=1;const x=new Bt;x.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new qt(x,u),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let h=this.type;this.render=function(y,C,_){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||y.length===0)return;this.type===2&&(Le("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);const T=i.getRenderTarget(),I=i.getActiveCubeFace(),D=i.getActiveMipmapLevel(),N=i.state;N.setBlending(0),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const K=h!==this.type;K&&C.traverse(function($){$.material&&(Array.isArray($.material)?$.material.forEach(z=>z.needsUpdate=!0):$.material.needsUpdate=!0)});for(let $=0,z=y.length;$<z;$++){const q=y[$],k=q.shadow;if(k===void 0){Le("WebGLShadowMap:",q,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;r.copy(k.mapSize);const Q=k.getFrameExtents();r.multiply(Q),s.copy(k.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/Q.x),r.x=s.x*Q.x,k.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/Q.y),r.y=s.y*Q.y,k.mapSize.y=s.y));const ee=i.state.buffers.depth.getReversed();if(k.camera._reversedDepth=ee,k.map===null||K===!0){if(k.map!==null&&(k.map.depthTexture!==null&&(k.map.depthTexture.dispose(),k.map.depthTexture=null),k.map.dispose()),this.type===3){if(q.isPointLight){Le("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}k.map=new ln(r.x,r.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),k.map.texture.name=q.name+".shadowMap",k.map.depthTexture=new ai(r.x,r.y,1015),k.map.depthTexture.name=q.name+".shadowMapDepth",k.map.depthTexture.format=1026,k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=1003,k.map.depthTexture.magFilter=1003}else q.isPointLight?(k.map=new La(r.x),k.map.depthTexture=new mo(r.x,1014)):(k.map=new ln(r.x,r.y),k.map.depthTexture=new ai(r.x,r.y,1014)),k.map.depthTexture.name=q.name+".shadowMap",k.map.depthTexture.format=1026,this.type===1?(k.map.depthTexture.compareFunction=ee?518:515,k.map.depthTexture.minFilter=1006,k.map.depthTexture.magFilter=1006):(k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=1003,k.map.depthTexture.magFilter=1003);k.camera.updateProjectionMatrix()}
vendor: 4,884 bytes, line 4092
4092const ue=k.map.isWebGLCubeRenderTarget?6:1;for(let pe=0;pe<ue;pe++){if(k.map.isWebGLCubeRenderTarget)i.setRenderTarget(k.map,pe),i.clear();else{pe===0&&(i.setRenderTarget(k.map),i.clear());const ve=k.getViewport(pe);a.set(s.x*ve.x,s.y*ve.y,s.x*ve.z,s.y*ve.w),N.viewport(a)}if(q.isPointLight){const ve=k.camera,Xe=k.matrix,tt=q.distance||ve.far;tt!==ve.far&&(ve.far=tt,ve.updateProjectionMatrix()),Si.setFromMatrixPosition(q.matrixWorld),ve.position.copy(Si),Wr.copy(ve.position),Wr.add(cd[pe]),ve.up.copy(ud[pe]),ve.lookAt(Wr),ve.updateMatrixWorld(),Xe.makeTranslation(-Si.x,-Si.y,-Si.z),ca.multiplyMatrices(ve.projectionMatrix,ve.matrixWorldInverse),k._frustum.setFromProjectionMatrix(ca,ve.coordinateSystem,ve.reversedDepth)}else k.updateMatrices(q);n=k.getFrustum(),M(C,_,k.camera,q,this.type)}k.isPointLightShadow!==!0&&this.type===3&&b(k,_),k.needsUpdate=!1}h=this.type,p.needsUpdate=!1,i.setRenderTarget(T,I,D)};function b(y,C){const _=e.update(S);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,m.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,m.needsUpdate=!0),y.mapPass===null&&(y.mapPass=new ln(r.x,r.y,{format:1030,type:1016})),u.uniforms.shadow_pass.value=y.map.depthTexture,u.uniforms.resolution.value=y.mapSize,u.uniforms.radius.value=y.radius,i.setRenderTarget(y.mapPass),i.clear(),i.renderBufferDirect(C,null,_,u,S,null),m.uniforms.shadow_pass.value=y.mapPass.texture,m.uniforms.resolution.value=y.mapSize,m.uniforms.radius.value=y.radius,i.setRenderTarget(y.map),i.clear(),i.renderBufferDirect(C,null,_,m,S,null)}function R(y,C,_,T){let I=null;const D=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(D!==void 0)I=D;else if(I=_.isPointLight===!0?l:o,i.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const N=I.uuid,K=C.uuid;let $=c[N];$===void 0&&($={},c[N]=$);let z=$[K];z===void 0&&(z=I.clone(),$[K]=z,C.addEventListener("dispose",A)),I=z}if(I.visible=C.visible,I.wireframe=C.wireframe,T===3?I.side=C.shadowSide!==null?C.shadowSide:C.side:I.side=C.shadowSide!==null?C.shadowSide:g[C.side],I.alphaMap=C.alphaMap,I.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,I.map=C.map,I.clipShadows=C.clipShadows,I.clippingPlanes=C.clippingPlanes,I.clipIntersection=C.clipIntersection,I.displacementMap=C.displacementMap,I.displacementScale=C.displacementScale,I.displacementBias=C.displacementBias,I.wireframeLinewidth=C.wireframeLinewidth,I.linewidth=C.linewidth,_.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const N=i.properties.get(I);N.light=_}return I}function M(y,C,_,T,I){if(y.visible===!1)return;if(y.layers.test(C.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&I===3)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,y.matrixWorld);const K=e.update(y),$=y.material;if(Array.isArray($)){const z=K.groups;for(let q=0,k=z.length;q<k;q++){const Q=z[q],ee=$[Q.materialIndex];if(ee&&ee.visible){const ue=R(y,ee,T,I);y.onBeforeShadow(i,y,C,_,K,ue,Q),i.renderBufferDirect(_,null,K,ue,y,Q),y.onAfterShadow(i,y,C,_,K,ue,Q)}}}else if($.visible){const z=R(y,$,T,I);y.onBeforeShadow(i,y,C,_,K,z,null),i.renderBufferDirect(_,null,K,z,y,null),y.onAfterShadow(i,y,C,_,K,z,null)}}const N=y.children;for(let K=0,$=N.length;K<$;K++)M(N[K],C,_,T,I)}function A(y){y.target.removeEventListener("dispose",A);for(const _ in c){const T=c[_],I=y.target.uuid;I in T&&(T[I].dispose(),delete T[I])}}}function dd(i,e){function t(){let w=!1;const re=new ft;let X=null;const se=new ft(0,0,0,0);return{setMask:function(de){X!==de&&!w&&(i.colorMask(de,de,de,de),X=de)},setLocked:function(de){w=de},setClear:function(de,j,Se,Ee,dt){dt===!0&&(de*=Ee,j*=Ee,Se*=Ee),re.set(de,j,Se,Ee),se.equals(re)===!1&&(i.clearColor(de,j,Se,Ee),se.copy(re))},reset:function(){w=!1,X=null,se.set(-1,0,0,0)}}}function n(){let w=!1,re=!1,X=null,se=null,de=null;return{setReversed:function(j){if(re!==j){const Se=e.get("EXT_clip_control");j?Se.clipControlEXT(Se.LOWER_LEFT_EXT,Se.ZERO_TO_ONE_EXT):Se.clipControlEXT(Se.LOWER_LEFT_EXT,Se.NEGATIVE_ONE_TO_ONE_EXT),re=j;const Ee=de;de=null,this.setClear(Ee)}},getReversed:function(){return re},setTest:function(j){j?ne(i.DEPTH_TEST):De(i.DEPTH_TEST)},setMask:function(j){X!==j&&!w&&(i.depthMask(j),X=j)},setFunc:function(j){if(re&&(j=Va[j]),se!==j){switch(j){case 0:i.depthFunc(i.NEVER);break;case 1:i.depthFunc(i.ALWAYS);break;case 2:i.depthFunc(i.LESS);break;case 3:i.depthFunc(i.LEQUAL);break;case 4:i.depthFunc(i.EQUAL);break;case 5:i.depthFunc(i.GEQUAL);break;case 6:i.depthFunc(i.GREATER);break;case 7:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}se=j}},setLocked:function(j){w=j},setClear:function(j){de!==j&&(de=j,re&&(j=1-j),i.clearDepth(j))}
4092,reset:function(){w=!1,X=null,se=null,de=null,re=!1}}}function r(){let w=!1,re=null,X=null,se=null,de=null,j=null,Se=null,Ee=null,dt=null;return{setTest:function(Y){w||(Y?ne(i.STENCIL_TEST):De(i.STENCIL_TEST))},setMask:function(Y){re!==Y&&!w&&(i.stencilMask(Y),re=Y)},setFunc:function(Y,fe,Pe){(X!==Y||se!==fe||de!==Pe)&&(i.stencilFunc(Y,fe,Pe),X=Y,se=fe,de=Pe)},setOp:function(Y,fe,Pe){(j!==Y||Se!==fe||Ee!==Pe)&&(i.stencilOp(Y,fe,Pe),j=Y,Se=fe,Ee=Pe)},setLocked:function(Y){w=Y},setClear:function(Y){dt!==Y&&(i.clearStencil(Y),dt=Y)},reset:function(){w=!1,re=null,X=null,se=null,de=null,j=null,Se=null,Ee=null,dt=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let f={},g={},u={},m=new WeakMap,x=[],S=null,p=!1,h=null,b=null,R=null,M=null,A=null,y=null,C=null,_=new Ie(0,0,0),T=0,I=!1,D=null,N=null,K=null,$=null,z=null;const q=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let k=!1,Q=0;const ee=i.getParameter(i.VERSION);ee.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(ee)[1]),k=Q>=1):ee.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(ee)[1]),k=Q>=2);let ue=null,pe={};const ve=i.getParameter(i.SCISSOR_BOX),Xe=i.getParameter(i.VIEWPORT),tt=new ft().fromArray(ve),Ne=new ft().fromArray(Xe);function J(w,re,X,se){const de=new Uint8Array(4),j=i.createTexture();i.bindTexture(w,j),i.texParameteri(w,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(w,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Se=0;Se<X;Se++)w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY?i.texImage3D(re,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,de):i.texImage2D(re+Se,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,de);return j}const ae={};ae[i.TEXTURE_2D]=J(i.TEXTURE_2D,i.TEXTURE_2D,1),ae[i.TEXTURE_CUBE_MAP]=J(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[i.TEXTURE_2D_ARRAY]=J(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ae[i.TEXTURE_3D]=J(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ne(i.DEPTH_TEST),a.setFunc(3),gt(!1),ut(1),ne(i.CULL_FACE),ze(0);function ne(w){f[w]!==!0&&(i.enable(w),f[w]=!0)}function De(w){f[w]!==!1&&(i.disable(w),f[w]=!1)}function Fe(w,re){return u[w]!==re?(i.bindFramebuffer(w,re),u[w]=re,w===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=re),w===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=re),!0):!1}function Ce(w,re){let X=x,se=!1;if(w){X=m.get(re),X===void 0&&(X=[],m.set(re,X));const de=w.textures;if(X.length!==de.length||X[0]!==i.COLOR_ATTACHMENT0){for(let j=0,Se=de.length;j<Se;j++)X[j]=i.COLOR_ATTACHMENT0+j;X.length=de.length,se=!0}}else X[0]!==i.BACK&&(X[0]=i.BACK,se=!0);se&&i.drawBuffers(X)}function ct(w){return S!==w?(i.useProgram(w),S=w,!0):!1}const He={100:i.FUNC_ADD,101:i.FUNC_SUBTRACT,102:i.FUNC_REVERSE_SUBTRACT};He[103]=i.MIN,He[104]=i.MAX;const Qe={200:i.ZERO,201:i.ONE,202:i.SRC_COLOR,204:i.SRC_ALPHA,210:i.SRC_ALPHA_SATURATE,208:i.DST_COLOR,206:i.DST_ALPHA,203:i.ONE_MINUS_SRC_COLOR,205:i.ONE_MINUS_SRC_ALPHA,209:i.ONE_MINUS_DST_COLOR,207:i.ONE_MINUS_DST_ALPHA,211:i.CONSTANT_COLOR,212:i.ONE_MINUS_CONSTANT_COLOR,213:i.CONSTANT_ALPHA,214:i.ONE_MINUS_CONSTANT_ALPHA};function ze(w,re,X,se,de,j,Se,Ee,dt,Y){if(w===0){p===!0&&(De(i.BLEND),p=!1);return}if(p===!1&&(ne(i.BLEND),p=!0),w!==5){if(w!==h||Y!==I){if((b!==100||A!==100)&&(i.blendEquation(i.FUNC_ADD),b=100,A=100),Y)switch(w){case 1:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFunc(i.ONE,i.ONE);break;case 3:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case 4:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:$e("WebGLState: Invalid blending: ",w);break}else switch(w){case 1:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case 3:$e("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:$e("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:$e("WebGLState: Invalid blending: ",w);break}R=null,M=null,y=null,C=null,_.set(0,0,0),T=0,h=w,I=Y}return}de=de||re,j=j||X,Se=Se||se,(re!==b||de!==A)&&(i.blendEquationSeparate(He[re],He[de]),b=re,A=de),(X!==R||se!==M||j!==y||Se!==C)&&(i.blendFuncSeparate(Qe[X],Qe[se],Qe[j],Qe[Se]),R=X,M=se,y=j,C=Se),(Ee.equals(_)===!1||dt!==T)&&(i.blendColor
4092(Ee.r,Ee.g,Ee.b,dt),_.copy(Ee),T=dt),h=w,I=!1}function qe(w,re){w.side===2?De(i.CULL_FACE):ne(i.CULL_FACE);let X=w.side===1;re&&(X=!X),gt(X),w.blending===1&&w.transparent===!1?ze(0):ze(w.blending,w.blendEquation,w.blendSrc,w.blendDst,w.blendEquationAlpha,w.blendSrcAlpha,w.blendDstAlpha,w.blendColor,w.blendAlpha,w.premultipliedAlpha),a.setFunc(w.depthFunc),a.setTest(w.depthTest),a.setMask(w.depthWrite),s.setMask(w.colorWrite);const se=w.stencilWrite;o.setTest(se),se&&(o.setMask(w.stencilWriteMask),o.setFunc(w.stencilFunc,w.stencilRef,w.stencilFuncMask),o.setOp(w.stencilFail,w.stencilZFail,w.stencilZPass)),St(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits),w.alphaToCoverage===!0?ne(i.SAMPLE_ALPHA_TO_COVERAGE):De(i.SAMPLE_ALPHA_TO_COVERAGE)}function gt(w){D!==w&&(w?i.frontFace(i.CW):i.frontFace(i.CCW),D=w)}function ut(w){w!==0?(ne(i.CULL_FACE),w!==N&&(w===1?i.cullFace(i.BACK):w===2?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):De(i.CULL_FACE),N=w}function _t(w){w!==K&&(k&&i.lineWidth(w),K=w)}function St(w,re,X){w?(ne(i.POLYGON_OFFSET_FILL),($!==re||z!==X)&&($=re,z=X,a.getReversed()&&(re=-re),i.polygonOffset(re,X))):De(i.POLYGON_OFFSET_FILL)}function ht(w){w?ne(i.SCISSOR_TEST):De(i.SCISSOR_TEST)}function nt(w){w===void 0&&(w=i.TEXTURE0+q-1),ue!==w&&(i.activeTexture(w),ue=w)}function L(w,re,X){X===void 0&&(ue===null?X=i.TEXTURE0+q-1:X=ue);let se=pe[X];se===void 0&&(se={type:void 0,texture:void 0},pe[X]=se),(se.type!==w||se.texture!==re)&&(ue!==X&&(i.activeTexture(X),ue=X),i.bindTexture(w,re||ae[w]),se.type=w,se.texture=re)}function bt(){const w=pe[ue];w!==void 0&&w.type!==void 0&&(i.bindTexture(w.type,null),w.type=void 0,w.texture=void 0)}function Je(){try{i.compressedTexImage2D(...arguments)}catch(w){$e("WebGLState:",w)}}function E(){try{i.compressedTexImage3D(...arguments)}catch(w){$e("WebGLState:",w)}}function d(){try{i.texSubImage2D(...arguments)}catch(w){$e("WebGLState:",w)}}function U(){try{i.texSubImage3D(...arguments)}catch(w){$e("WebGLState:",w)}}function B(){try{i.compressedTexSubImage2D(...arguments)}catch(w){$e("WebGLState:",w)}}function V(){try{i.compressedTexSubImage3D(...arguments)}catch(w){$e("WebGLState:",w)}}function ie(){try{i.texStorage2D(...arguments)}catch(w){$e("WebGLState:",w)}}function oe(){try{i.texStorage3D(...arguments)}catch(w){$e("WebGLState:",w)}}function W(){try{i.texImage2D(...arguments)}catch(w){$e("WebGLState:",w)}}function Z(){try{i.texImage3D(...arguments)}catch(w){$e("WebGLState:",w)}}function le(w){return g[w]!==void 0?g[w]:i.getParameter(w)}function ye(w,re){g[w]!==re&&(i.pixelStorei(w,re),g[w]=re)}function he(w){tt.equals(w)===!1&&(i.scissor(w.x,w.y,w.z,w.w),tt.copy(w))}function ce(w){Ne.equals(w)===!1&&(i.viewport(w.x,w.y,w.z,w.w),Ne.copy(w))}function Te(w,re){let X=c.get(re);X===void 0&&(X=new WeakMap,c.set(re,X));let se=X.get(w);se===void 0&&(se=i.getUniformBlockIndex(re,w.name),X.set(w,se))}function we(w,re){const se=c.get(re).get(w);l.get(re)!==se&&(i.uniformBlockBinding(re,se,w.__bindingPointIndex),l.set(re,se))}function Ue(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor
vendor: 3,253 bytes, line 4092
4092(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),f={},g={},ue=null,pe={},u={},m=new WeakMap,x=[],S=null,p=!1,h=null,b=null,R=null,M=null,A=null,y=null,C=null,_=new Ie(0,0,0),T=0,I=!1,D=null,N=null,K=null,$=null,z=null,tt.set(0,0,i.canvas.width,i.canvas.height),Ne.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ne,disable:De,bindFramebuffer:Fe,drawBuffers:Ce,useProgram:ct,setBlending:ze,setMaterial:qe,setFlipSided:gt,setCullFace:ut,setLineWidth:_t,setPolygonOffset:St,setScissorTest:ht,activeTexture:nt,bindTexture:L,unbindTexture:bt,compressedTexImage2D:Je,compressedTexImage3D:E,texImage2D:W,texImage3D:Z,pixelStorei:ye,getParameter:le,updateUBOMapping:Te,uniformBlockBinding:we,texStorage2D:ie,texStorage3D:oe,texSubImage2D:d,texSubImage3D:U,compressedTexSubImage2D:B,compressedTexSubImage3D:V,scissor:he,viewport:ce,reset:Ue}}function fd(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new We,f=new WeakMap,g=new Set;let u;const m=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(E,d){return x?new OffscreenCanvas(E,d):ar("canvas")}function p(E,d,U){let B=1;const V=Je(E);if((V.width>U||V.height>U)&&(B=U/Math.max(V.width,V.height)),B<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const ie=Math.floor(B*V.width),oe=Math.floor(B*V.height);u===void 0&&(u=S(ie,oe));const W=d?S(ie,oe):u;return W.width=ie,W.height=oe,W.getContext("2d").drawImage(E,0,0,ie,oe),Le("WebGLRenderer: Texture has been resized from ("+V.width+"x"+V.height+") to ("+ie+"x"+oe+")."),W}else return"data"in E&&Le("WebGLRenderer: Image in DataTexture is too big ("+V.width+"x"+V.height+")."),E;return E}function h(E){return E.generateMipmaps}function b(E){i.generateMipmap(E)}function R(E){return E.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:E.isWebG
4092L3DRenderTarget?i.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(E,d,U,B,V,ie=!1){if(E!==null){if(i[E]!==void 0)return i[E];Le("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let oe;B&&(oe=e.get("EXT_texture_norm16"),oe||Le("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=d;if(d===i.RED&&(U===i.FLOAT&&(W=i.R32F),U===i.HALF_FLOAT&&(W=i.R16F),U===i.UNSIGNED_BYTE&&(W=i.R8),U===i.UNSIGNED_SHORT&&oe&&(W=oe.R16_EXT),U===i.SHORT&&oe&&(W=oe.R16_SNORM_EXT)),d===i.RED_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.R8UI),U===i.UNSIGNED_SHORT&&(W=i.R16UI),U===i.UNSIGNED_INT&&(W=i.R32UI),U===i.BYTE&&(W=i.R8I),U===i.SHORT&&(W=i.R16I),U===i.INT&&(W=i.R32I)),d===i.RG&&(U===i.FLOAT&&(W=i.RG32F),U===i.HALF_FLOAT&&(W=i.RG16F),U===i.UNSIGNED_BYTE&&(W=i.RG8),U===i.UNSIGNED_SHORT&&oe&&(W=oe.RG16_EXT),U===i.SHORT&&oe&&(W=oe.RG16_SNORM_EXT)),d===i.RG_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RG8UI),U===i.UNSIGNED_SHORT&&(W=i.RG16UI),U===i.UNSIGNED_INT&&(W=i.RG32UI),U===i.BYTE&&(W=i.RG8I),U===i.SHORT&&(W=i.RG16I),U===i.INT&&(W=i.RG32I)),d===i.RGB_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RGB8UI),U===i.UNSIGNED_SHORT&&(W=i.RGB16UI),U===i.UNSIGNED_INT&&(W=i.RGB32UI),U===i.BYTE&&(W=i.RGB8I),U===i.SHORT&&(W=i.RGB16I),U===i.INT&&(W=i.RGB32I)),d===i.RGBA_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RGBA8UI),U===i.UNSIGNED_SHORT&&(W=i.RGBA16UI),U===i.UNSIGNED_INT&&(W=i.RGBA32UI),U===i.BYTE&&(W=i.RGBA8I),U===i.SHORT&&(W=i.RGBA16I),U===i.INT&&(W=i.RGBA32I)),d===i.RGB&&(U===i.UNSIGNED_SHORT&&oe&&(W=oe.RGB16_EXT),U===i.SHORT&&oe&&(W=oe.RGB16_SNORM_EXT),U===i.UNSIGNED_INT_5_9_9_9_REV&&(W=i.RGB9_E5),U===i.UNSIGNED_INT_10F_11F_11F_REV&&(W=i.R11F_G11F_B10F)),d===i.RGBA){const Z=ie?sr:Ye.getTransfer(V);U===i.FLOAT&&(W=i.RGBA32F),U===i.HALF_FLOAT&&(W=i.RGBA16F),U===i.UNSIGNED_BYTE&&(W=Z===je?i.SRGB8_ALPHA8:i.RGBA8),U===i.UNSIGNED_SHORT&&oe&&(W=oe.RGBA16_EXT),U===i.SHORT&&oe&&(W=oe.RGBA16_SNORM_EXT),U===i.UNSIGNED_SHORT_4_4_4_4&&(W=i.RGBA4),U===i.UNSIGNED_SHORT_5_5_5_1&&(W=i.RGB5_A1)}return(W===i.R16F||W===i.R32F||W===i.RG16F||W===i.RG32F||W===i.RGBA16F||W===i.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function A(E,d){let U;return E?d===null||d===1014||d===1020?U=i.DEPTH24_STENCIL8:d===1015?U=i.DEPTH32F_STENCIL8:d===1012&&(U=i.DEPTH24_STENCIL8,Le("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):d===null||d===1014||d===1020?U=i.DEPTH_COMPONENT24:d===1015?U=i.DEPTH_COMPONENT32F:d===1012&&(U=i.DEPTH_COMPONENT16),U}function y(E,d){return h(E)===!0||E.isFramebufferTexture&&E.minFilter!==1003&&E.minFilter!==1006?Math.log2(Math.max(d.width,d.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?d.mipmaps.length:1}function C(E){const d=E.target;d.removeEventListener("dispose",C),T(d),d.isVideoTexture&&f.delete(d),d.isHTMLTexture&&g.delete(d)}function _(E){const d=E.target;d.removeEventListener("dispose",_),D(d)}function T(E){const d=n.get(E);if(d.__webglInit===void 0)return;const U=E.source,B=m.get(U);if(B){const V=B[d.__cacheKey];V.usedTimes--,V.usedTimes===0&&I(E),Object.keys(B).length===0&&m.delete(U)}n.remove(E)}function I(E){const d=n.get(E);i.deleteTexture(d.__webglTexture);const U=E.source,B=m.get(U);delete B[d.__cacheKey],a.memory.textures--}function D(E){const d=n.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),n.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(d.__webglFramebuffer[B]))for(let V=0;V<d.__webglFramebuffer[B].length;V++)i.deleteFramebuffer(d.__webglFramebuffer[B][V]);else i.deleteFramebuffer(d.__webglFramebuffer[B]);d.__webglDepthbuffer&&i.deleteRenderbuffer(d.__webglDepthbuffer[B])}else{if(Array.isArray(d.__webglFramebuffer))for(let B=0;B<d.__webglFramebuffer.length;B++)i.deleteFramebuffer(d.__webglFramebuffer[B]);else i.deleteFramebuffer(d.__webglFramebuffer);if(d.__webglDepthbuffer&&i.deleteRenderbuffer(d.__webglDepthbuffer),d.__webglMultisampledFramebuffer&&i.deleteFramebuffer(d.__webglMultisampledFramebuffer),d.__webglColorRen
4092derbuffer)for(let B=0;B<d.__webglColorRenderbuffer.length;B++)d.__webglColorRenderbuffer[B]&&i.deleteRenderbuffer(d.__webglColorRenderbuffer[B]);d.__webglDepthRenderbuffer&&i.deleteRenderbuffer(d.__webglDepthRenderbuffer)}const U=E.textures;for(let B=0,V=U.length;B<V;B++){const ie=n.get(U[B]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(U[B])}n.remove(E)}let N=0;function K(){N=0}function $(){return N}function z(E){N=E}function q(){const E=N;return E>=r.maxTextures&&Le("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),N+=1,E}function k(E){const d=[];return d.push(E.wrapS),d.push(E.wrapT),d.push(E.wrapR||0),d.push(E.magFilter),d.push(E.minFilter),d.push(E.anisotropy),d.push(E.internalFormat),d.push(E.format),d.push(E.type),d.push(E.generateMipmaps),d.push(E.premultiplyAlpha),d.push(E.flipY),d.push(E.unpackAlignment),d.push(E.colorSpace),d.join()}function Q(E,d){const U=n.get(E);if(E.isVideoTexture&&L(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&U.__version!==E.version){const B=E.image;if(B===null)Le("WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)Le("WebGLRenderer: Texture marked for update but image is incomplete");else{De(U,E,d);return}}else E.isExternalTexture&&(U.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,U.__webglTexture,i.TEXTURE0+d)}function ee(E,d){const U=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&U.__version!==E.version){De(U,E,d);return}else E.isExternalTexture&&(U.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,U.__webglTexture,i.TEXTURE0+d)}function ue(E,d){const U=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&U.__version!==E.version){De(U,E,d);return}t.bindTexture(i.TEXTURE_3D,U.__webglTexture,i.TEXTURE0+d)}function pe(E,d){const U=n.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&U.__version!==E.version){Fe(U,E,d);return}t.bindTexture(i.TEXTURE_CUBE_MAP,U.__webglTexture,i.TEXTURE0+d)}const ve={1e3:i.REPEAT,1001:i.CLAMP_TO_EDGE,1002:i.MIRRORED_REPEAT},Xe={1003:i.NEAREST,1004:i.NEAREST_MIPMAP_NEAREST,1005:i.NEAREST_MIPMAP_LINEAR,1006:i.LINEAR,1007:i.LINEAR_MIPMAP_NEAREST,1008:i.LINEAR_MIPMAP_LINEAR},tt={512:i.NEVER,519:i.ALWAYS,513:i.LESS,515:i.LEQUAL,514:i.EQUAL,518:i.GEQUAL,516:i.GREATER,517:i.NOTEQUAL};function Ne(E,d){if(d.type===1015&&e.has("OES_texture_float_linear")===!1&&(d.magFilter===1006||d.magFilter===1007||d.magFilter===1005||d.magFilter===1008||d.minFilter===1006||d.minFilter===1007||d.minFilter===1005||d.minFilter===1008)&&Le("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(E,i.TEXTURE_WRAP_S,ve[d.wrapS]),i.texParameteri(E,i.TEXTURE_WRAP_T,ve[d.wrapT]),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,ve[d.wrapR]),i.texParameteri(E,i.TEXTURE_MAG_FILTER,Xe[d.magFilter]),i.texParameteri(E,i.TEXTURE_MIN_FILTER,Xe[d.minFilter]),d.compareFunction&&(i.texParameteri(E,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(E,i.TEXTURE_COMPARE_FUNC,tt[d.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(d.magFilter===1003||d.minFilter!==1005&&d.minFilter!==1008||d.type===1015&&e.has("OES_texture_float_linear")===!1)return;if(d.anisotropy>1||n.get(d).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");i.texParameterf(E,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(d.anisotropy,r.getMaxAnisotropy())),n.get(d).__currentAnisotropy=d.anisotropy}}}function J(E,d){let U=!1;E.__webglInit===void 0&&(E.__webglInit=!0,d.addEventListener("dispose",C));const B=d.source;let V=m.get(B);V===void 0&&(V={},m.set(B,V));const ie=k(d);if(ie!==E.__cacheKey){V[ie]===void 0&&(V[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,U=!0),V[ie].usedTimes++;const oe=V[E.__cacheKey];oe!==void 0&&(V[E.__cacheKey].usedTimes--,oe.usedTimes===0&&I(d)),E.__cacheKey=ie,E.__webglTexture=V[ie].texture}return U}function ae(E,d,U){return Math.floor(Math.floor(E/U)/d)}function ne(E,d,U,B){const ie=E.updateRanges;if(ie.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,d.width,d.height,U,B,d.data);else{ie.sort((ye,he)=>ye.start-he.start);let oe=0;for(let ye=1;ye<ie.length;ye++){const he=ie[oe],ce=ie[ye],Te=he.start+he.count,we=ae(ce.start,d.width,4),Ue=ae(he.start,d.width,4);ce.start<=Te+1&&we===Ue&&ae(ce.start+ce.count-1,d.width,4)===we?he.count=Math.max(he.count,ce.start+ce.count-he.start):(++oe,ie[oe]=ce)}ie.length=oe+1;const W=t.getParameter(i.UNPACK_ROW_LENGTH),Z=t.getParameter(i.UNPACK_SKIP_PIXELS),le=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,d.width);for(let ye=0,he=ie.length;ye<he;ye++){const ce=ie[ye],Te=Math.floor(ce.start/4),we=Math.ceil(ce.count/4),Ue=Te%d.width,w=Math.floor(Te/d.width),re=we,X=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Ue),t.pixelStorei(i.UNPACK_SKIP_ROWS,w),t.texSubImage2D(i.TEXTURE_2D,0,Ue,w,re,X,U,B,d.data)}E.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,W),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Z),t.pixelStorei(i.UNPACK_SKIP_ROWS,le)}}function De(E,d,U){let B=i.TEXTURE_2D;(d.isDataArrayTexture||d.isCompressedArrayTexture)&&(B=i.TEXTURE_2D_ARRAY),d.isData3DTexture&&(B=i.TEXTURE_3D);const V=J(E,d),ie=d.source;t.bindTexture(B,E.__webglTexture,i.TEXTURE0+U);const oe=n.get(ie);if(ie.version!==oe.__version||V===!0){if(t.activeTexture(i.TEXTURE0+U),(typeof ImageBitmap<"u"&&d.image instanceof ImageBitmap)===!1){const X=Ye.getPrimaries(Ye.workingColorSpace),se=d.colorSpace
4092===Rn?null:Ye.getPrimaries(d.colorSpace),de=d.colorSpace===Rn||X===se?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,d.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,de)}t.pixelStorei(i.UNPACK_ALIGNMENT,d.unpackAlignment);let Z=p(d.image,!1,r.maxTextureSize);Z=bt(d,Z);const le=s.convert(d.format,d.colorSpace),ye=s.convert(d.type);let he=M(d.internalFormat,le,ye,d.normalized,d.colorSpace,d.isVideoTexture);Ne(B,d);let ce;const Te=d.mipmaps,we=d.isVideoTexture!==!0,Ue=oe.__version===void 0||V===!0,w=ie.dataReady,re=y(d,Z);if(d.isDepthTexture)he=A(d.format===1027,d.type),Ue&&(we?t.texStorage2D(i.TEXTURE_2D,1,he,Z.width,Z.height):t.texImage2D(i.TEXTURE_2D,0,he,Z.width,Z.height,0,le,ye,null));else if(d.isDataTexture)if(Te.length>0){we&&Ue&&t.texStorage2D(i.TEXTURE_2D,re,he,Te[0].width,Te[0].height);for(let X=0,se=Te.length;X<se;X++)ce=Te[X],we?w&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,ce.width,ce.height,le,ye,ce.data):t.texImage2D(i.TEXTURE_2D,X,he,ce.width,ce.height,0,le,ye,ce.data);d.generateMipmaps=!1}else we?(Ue&&t.texStorage2D(i.TEXTURE_2D,re,he,Z.width,Z.height),w&&ne(d,Z,le,ye)):t.texImage2D(i.TEXTURE_2D,0,he,Z.width,Z.height,0,le,ye,Z.data);else if(d.isCompressedTexture)if(d.isCompressedArrayTexture){we&&Ue&&t.texStorage3D(i.TEXTURE_2D_ARRAY,re,he,Te[0].width,Te[0].height,Z.depth);for(let X=0,se=Te.length;X<se;X++)if(ce=Te[X],d.format!==1023)if(le!==null)if(we){if(w)if(d.layerUpdates.size>0){const de=zs(ce.width,ce.height,d.format,d.type);for(const j of d.layerUpdates){const Se=ce.data.subarray(j*de/ce.data.BYTES_PER_ELEMENT,(j+1)*de/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,j,ce.width,ce.height,1,le,Se)}d.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,ce.width,ce.height,Z.depth,le,ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,X,he,ce.width,ce.height,Z.depth,0,ce.data,0,0);else Le("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else we?w&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,ce.width,ce.height,Z.depth,le,ye,ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,X,he,ce.width,ce.height,Z.depth,0,le,ye,ce.data)}else{we&&Ue&&t.texStorage2D(i.TEXTURE_2D,re,he,Te[0].width,Te[0].height);for(let X=0,se=Te.length;X<se;X++)ce=Te[X],d.format!==1023?le!==null?we?w&&t.compressedTexSubImage2D(i.TEXTURE_2D,X,0,0,ce.width,ce.height,le,ce.data):t.compressedTexImage2D(i.TEXTURE_2D,X,he,ce.width,ce.height,0,ce.data):Le("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):we?w&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,ce.width,ce.height,le,ye,ce.data):t.texImage2D(i.TEXTURE_2D,X,he,ce.width,ce.height,0,le,ye,ce.data)}else if(d.isDataArrayTexture)if(we){if(Ue&&t.texStorage3D(i.TEXTURE_2D_ARRAY,re,he,Z.width,Z.height,Z.depth),w)if(d.layerUpdates.size>0){const X=zs(Z.width,Z.height,d.format,d.type);for(const se of d.layerUpdates){const de=Z.data.subarray(se*X/Z.data.BYTES_PER_ELEMENT,(se+1)*X/Z.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,se,Z.width,Z.height,1,le,ye,de)}d.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,le,ye,Z.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,he,Z.width,Z.height,Z.depth,0,le,ye,Z.data);else if(d.isData3DTexture)we?(Ue&&t.texStorage3D(i.TEXTURE_3D,re,he,Z.width,Z.height,Z.depth),w&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,le,ye,Z.data)):t.texImage3D(i.TEXTURE_3D,0,he,Z.width,Z.height,Z.depth,0,le,ye,Z.data);else if(d.isFramebufferTexture){if(Ue)if(we)t.texStorage2D(i.TEXTURE_2D,re,he,Z.width,Z.height);else{let X=Z.width,se=Z.height;for(let de=0;de<re;de++)t.texImage2D(i.TEXTURE_2D,de,he,X,se,0,le,ye,null),X>>=1,se>>=1}}else if(d.isHTMLTexture){if("texElementImage2D"in i){const X=i.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),Z.parentNode!==X){X.appendChild(Z),g.add(d),X.onpaint=se=>{const de=se.changedElements;for(const j of g)de.includes(j.image)&&(j.needsUpdate=!0)},X.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Z);else{const de=i.RGBA,j=i.RGBA,Se=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,de,j,Se,Z)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Te.length>0){if(we&&Ue){const X=Je(Te[0]);t.texStorage2D(i.TEXTURE_2D,re,he,X.width,X.height)}for(let X=0,se=Te.length;X<se;X++)ce=Te[X],we?w&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,le,ye,ce):t.texImage2D(i.TEXTURE_2D,X,he,le,ye,ce);d.generateMipmaps=!1}else if(we){if(Ue){const X=Je(Z);t.texStorage2D(i.TEXTURE_2D,re,he,X.width,X.height)}w&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,le,ye,Z)}else t.texImage2D(i.TEXTURE_2D,0,he,le,ye,Z);h(d)&&b(B),oe.__version=ie.version,d.onUpdate&&d.onUpdate(d)}E.__version=d.version}function Fe(E,d,U){if(d.image.length!==6)return;const B=J(E,d),V=d.source;t.bindTexture(i.TEXTURE_CUBE_MAP,E.__webglTexture,i.TEXTURE0+U);const ie=n.get(V);if(V.version!==ie.__version||B===!0){t.activeTexture(i.TEXTURE0+U);
vendor: 13,375 bytes, line 4092
4092const oe=Ye.getPrimaries(Ye.workingColorSpace),W=d.colorSpace===Rn?null:Ye.getPrimaries(d.colorSpace),Z=d.colorSpace===Rn||oe===W?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,d.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,d.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Z);const le=d.isCompressedTexture||d.image[0].isCompressedTexture,ye=d.image[0]&&d.image[0].isDataTexture,he=[];for(let j=0;j<6;j++)!le&&!ye?he[j]=p(d.image[j],!0,r.maxCubemapSize):he[j]=ye?d.image[j].image:d.image[j],he[j]=bt(d,he[j]);const ce=he[0],Te=s.convert(d.format,d.colorSpace),we=s.convert(d.type),Ue=M(d.internalFormat,Te,we,d.normalized,d.colorSpace),w=d.isVideoTexture!==!0,re=ie.__version===void 0||B===!0,X=V.dataReady;let se=y(d,ce);Ne(i.TEXTURE_CUBE_MAP,d);let de;if(le){w&&re&&t.texStorage2D(i.TEXTURE_CUBE_MAP,se,Ue,ce.width,ce.height);for(let j=0;j<6;j++){de=he[j].mipmaps;for(let Se=0;Se<de.length;Se++){const Ee=de[Se];d.format!==1023?Te!==null?w?X&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se,0,0,Ee.width,Ee.height,Te,Ee.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se,Ue,Ee.width,Ee.height,0,Ee.data):Le("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):w?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se,0,0,Ee.width,Ee.height,Te,we,Ee.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se,Ue,Ee.width,Ee.height,0,Te,we,Ee.data)}}}else{if(de=d.mipmaps,w&&re){de.length>0&&se++;const j=Je(he[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,se,Ue,j.width,j.height)}for(let j=0;j<6;j++)if(ye){w?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,he[j].width,he[j].height,Te,we,he[j].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ue,he[j].width,he[j].height,0,Te,we,he[j].data);for(let Se=0;Se<de.length;Se++){const dt=de[Se].image[j].image;w?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se+1,0,0,dt.width,dt.height,Te,we,dt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se+1,Ue,dt.width,dt.height,0,Te,we,dt.data)}}else{w?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,Te,we,he[j]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ue,Te,we,he[j]);for(let Se=0;Se<de.length;Se++){const Ee=de[Se];w?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se+1,0,0,Te,we,Ee.image[j]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Se+1,Ue,Te,we,Ee.image[j])}}}h(d)&&b(i.TEXTURE_CUBE_MAP),ie.__version=V.version,d.onUpdate&&d.onUpdate(d)}E.__version=d.version}function Ce(E,d,U,B,V,ie){const oe=s.convert(U.format,U.colorSpace),W=s.convert(U.type),Z=M(U.internalFormat,oe,W,U.normalized,U.colorSpace),le=n.get(d),ye=n.get(U);if(ye.__renderTarget=d,!le.__hasExternalTextures){const he=Math.max(1,d.width>>ie),ce=Math.max(1,d.height>>ie);V===i.TEXTURE_3D||V===i.TEXTURE_2D_ARRAY?t.texImage3D(V,ie,Z,he,ce,d.depth,0,oe,W,null):t.texImage2D(V,ie,Z,he,ce,0,oe,W,null)}t.bindFramebuffer(i.FRAMEBUFFER,E),nt(d)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,B,V,ye.__webglTexture,0,ht(d)):(V===i.TEXTURE_2D||V>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&V<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,B,V,ye.__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ct(E,d,U){if(i.bindRenderbuffer(i.RENDERBUFFER,E),d.depthBuffer){const B=d.depthTexture,V=B&&B.isDepthTexture?B.type:null,ie=A(d.stencilBuffer,V),oe=d.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;nt(d)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ht(d),ie,d.width,d.height):U?i.renderbufferStorageMultisample(i.RENDERBUFFER,ht(d),ie,d.width,d.height):i.renderbufferStorage(i.RENDERBUFFER,ie,d.width,d.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,oe,i.RENDERBUFFER,E)}else{const B=d.textures;for(let V=0;V<B.length;V++){const ie=B[V],oe=s.convert(ie.format,ie.colorSpace),W=s.convert(ie.type),Z=M(ie.internalFormat,oe,W,ie.normalized,ie.colorSpace);nt(d)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ht(d),Z,d.width,d.height):U?i.renderbufferStorageMultisample(i.RENDERBUFFER,ht(d),Z,d.width,d.height):i.renderbufferStorage(i.RENDERBUFFER,Z,d.width,d.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function He(E,d,U){const B=d.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,E),!(d.depthTexture&&d.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const V=n.get(d.depthTexture);if(V.__renderTarget=d,(!V.__webglTexture||d.depthTexture.image.width!==d.width||d.depthTexture.image.height!==d.height)&&(d.depthTexture.image.width=d.width,d.depthTexture.image.height=d.height,d.depthTexture.needsUpdate=!0),B){if(V.__webglInit===void 0&&(V.__webglInit=!0,d.depthTexture.addEventListener("dispose",C)),V.__webglTexture===void 0){V.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,V.__webglTexture),Ne(i.TEXTURE_CUBE_MAP,d.depthTexture);const le=s.convert(d.depthTexture.format),ye=s.convert(d.depthTexture.type);let he;d.depthTexture.format===1026?he=i.DEPTH_COMPONENT24:d.depthTexture.format===1027&&(he=i.DEPTH24_STENCIL8);for(let ce=0;ce<6;ce++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,he,d.width,d.height,0,le,ye,null)}}else Q(d.depthTexture,0);const ie=V.__webglTexture,oe=ht(d),W=B?i.TEXTURE_CUBE_MAP_POSITIVE_X+U:i.TEXTURE_2D,Z=d.depthTexture.format===1027?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(d.depthTexture.format===1026)nt(d)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,W,ie,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,Z,W,ie,0);else if(d.depthTexture.format===1027)nt(d)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,W,ie,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,Z,W,ie,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Qe(E){const d=n.get(E),U=E.isWebGLCubeRenderTarget===!0;if(d.__boundDepthTexture!==E.depthTexture){const B=E.depthTexture;if(d.__depthDisposeCallback&&d.__depthDisposeCallback(),B){const V=()=>{delete d.__boundDepthTexture,delete d.__depthDisposeCallback,B.removeEventListener("dispose",V)};B.addEventListener("dispose",V),d.__depthDisposeCallback=V}d.__boundDepthTexture=B}if(E.depthTexture&&!d.__autoAllocateDepthBuffer)if(U)for(let B=0;B<6;B++)He(d.__webglFramebuffer[B],E,B);else{const B=E.texture.mipmaps;B&&B.length>0?He(d.__webglFramebuffer[0],E,0):He(d.__webglFramebuffer,E,0)}else if(U){d.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(t.bindFramebuffer(i.FRAMEBUFFER,d.__webglFramebuffer[B]),d.__webglDepthbuffer[B]===void 0)d.__webglDepthbuffer[B]=i.createRenderbuffer(),ct(d.__webglDepthbuffer[B],E,!1);else{const V=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=d.__webglDepthbuffer[B];i.bindRenderbuffer(i.RENDERBUFFER,ie),i.framebufferRenderbuffer(i.FRAMEBUFFER,V,i.RENDERBUFFER,ie)}}else{const B=E.texture.mipmaps;if(B&&B.length>0?t.bindFramebuffer(i.FRAMEBUFFER,d.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,d.__webglFramebuffer),d.__webglDepthbuffer===void 0)d.__webglDepthbuffer=i.createRenderbuffer(),ct(d.__webglDepthbuffer,E,!1);else{const V=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=d.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ie),i.framebufferRenderbuffer(i.FRAMEBUFFER,V,i.RENDERBUFFER,ie)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ze(E,d,U){const B=n.get(E);d!==void 0&&Ce(B.__webglFramebuffer,E,E.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),U!==void 0&&Qe(E)}function qe(E){const d=E.texture,U=n.get(E),B=n.get(d);E.addEventListener("dispose",_);const V=E.textures,ie=E.isWebGLCubeRenderTarget===!0,oe=V.length>1;if(oe||(B.__webglTexture===void 0&&(B.__webglTexture=i.createTexture()),B.__version=d.version,a.memory.textures++),ie){U.__webglFramebuffer=[];for(let W=0;W<6;W++)if(d.mipmaps&&d.mipmaps.length>0){U.__webglFramebuffer[W]=[];for(let Z=0;Z<d.mipmaps.length;Z++)U.__webglFramebuffer[W][Z]=i.createFramebuffer()}else U.__webglFramebuffer[W]=i.createFramebuffer()}else{if(d.mipmaps&&d.mipmaps.length>0){U.__webglFramebuffer=[];for(let W=0;W<d.mipmaps.length;W++)U.__webglFramebuffer[W]=i.createFramebuffer()}else U.__webglFramebuffer=i.createFramebuffer();if(oe)for(let W=0,Z=V.length;W<Z;W++){const le=n.get(V[W]);le.__webglTexture===void 0&&(le.__webglTexture=i.createTexture(),a.memory.textures++)}if(E.samples>0&&nt(E)===!1){U.__webglMultisampledFramebuffer=i.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let W=0;W<V.length;W++){const Z=V[W];U.__webglColorRenderbuffer[W]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,U.__webglColorRenderbuffer[W]);const le=s.convert(Z.format,Z.colorSpace),ye=s.convert(Z.type),he=M(Z.internalFormat,le,ye,Z.normalized,Z.colorSpace,E.isXRRenderTarget===!0),ce=ht(E);i.renderbufferStorageMultisample(i.RENDERBUFFER,ce,he,E.width,E.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+W,i.RENDERBUFFER,U.__webglColorRenderbuffer[W])}i.bindRenderbuffer(i.RENDERBUFFER,null),E.depthBuffer&&(U.__webglDepthRenderbuffer=i.createRenderbuffer(),ct(U.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,B.__webglTexture),Ne(i.TEXTURE_CUBE_MAP,d);for(let W=0;W<6;W++)if(d.mipmaps&&d.mipmaps.length>0)for(let Z=0;Z<d.mipmaps.length;Z++)Ce(U.__webglFramebuffer[W][Z],E,d,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,Z);else Ce(U.__webglFramebuffer[W],E,d,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);h(d)&&b(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(oe){for(let W=0,Z=V.length;W<Z;W++){const le=V[W],ye=n.get(le);let he=i.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(he=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(he,ye.__webglTexture),Ne(he,le),Ce(U.__webglFramebuffer,E,le,i.COLOR_ATTACHMENT0+W,he,0),h(le)&&b(he)}t.unbindTexture()}else{let W=i.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(W=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(W,B.__webglTexture),Ne(W,d),d.mipmaps&&d.mipmaps.length>0)for(let Z=0;Z<d.mipmaps.length;Z++)Ce(U.__webglFramebuffer[Z],E,d,i.COLOR_ATTACHMENT0,W,Z);else Ce(U.__webglFramebuffer,E,d,i.COLOR_ATTACHMENT0,W,0);h(d)&&b(W),t.unbindTexture()}E.depthBuffer&&Qe(E)}function gt(E){const d=E.textures;for(let U=0,B=d.length;U<B;U++){const V=d[U];if(h(V)){const ie=R(E),oe=n.get(V).__webglTexture;t.bindTexture(ie,oe),b(ie),t.unbindTexture()}}}const ut=[],_t=[];function St(E){if(E.samples>0){if(nt(E)===!1){const d=E.textures,U=E.width,B=E.height;let V=i.COLOR_BUFFER_BIT;const ie=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=n.get(E),W=d.length>1;if(W)for(let le=0;le<d.length;le++)t.bindFramebuffer(i.FRAMEBUFFER,oe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+le,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,oe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+le,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,oe.__webglMultisampledFramebuffer);const Z=E.texture.mipmaps;Z&&Z.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,oe.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,oe.__webglFramebuffer);for(let le=0;le<d.length;le++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(V|=i.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(V|=i.STENCIL_BUFFER_BIT)),W){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,oe.__webglColorRenderbuffer[le]);const ye=n.get(d[le]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ye,0)}i.blitFramebuffer(0,0,U,B,0,0,U,B,V,i.NEAREST),l===!0&&(ut.length=0,_t.length=0,ut.push(i.COLOR_ATTACHMENT0+le),E.depthBuffer&&E.resolveDepthBuffer===!1&&(ut.push(ie),_t.push(ie),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,_t)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ut))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),W)for(let le=0;le<d.length;le++){t.bindFramebuffer(i.FRAMEBUFFER,oe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+le,i.RENDERBUFFER,oe.__webglColorRenderbuffer[le]);const ye=n.get(d[le]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,oe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+le,i.TEXTURE_2D,ye,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,oe.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&l){const d=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[d])}}}function ht(E){return Math.min(r.maxSamples,E.samples)}function nt(E){const d=n.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&d.__useRenderToTexture!==!1}function L(E){const d=a.render.frame;f.get(E)!==d&&(f.set(E,d),E.update())}function bt(E,d){const U=E.colorSpace,B=E.format,V=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||U!==rr&&U!==Rn&&(Ye.getTransfer(U)===je?(B!==1023||V!==1009)&&Le("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$e("WebGLTextures: Unsupported texture color space:",U)),d}function Je(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWi
4092dth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=q,this.resetTextureUnits=K,this.getTextureUnits=$,this.setTextureUnits=z,this.setTexture2D=Q,this.setTexture2DArray=ee,this.setTexture3D=ue,this.setTextureCube=pe,this.rebindTextures=ze,this.setupRenderTarget=qe,this.updateRenderTargetMipmap=gt,this.updateMultisampleRenderTarget=St,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=nt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function pd(i,e){function t(n,r=Rn){let s;const a=Ye.getTransfer(r);if(n===1009)return i.UNSIGNED_BYTE;if(n===1017)return i.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return i.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return i.BYTE;if(n===1011)return i.SHORT;if(n===1012)return i.UNSIGNED_SHORT;if(n===1013)return i.INT;if(n===1014)return i.UNSIGNED_INT;if(n===1015)return i.FLOAT;if(n===1016)return i.HALF_FLOAT;if(n===1021)return i.ALPHA;if(n===1022)return i.RGB;if(n===1023)return i.RGBA;if(n===1026)return i.DEPTH_COMPONENT;if(n===1027)return i.DEPTH_STENCIL;if(n===1028)return i.RED;if(n===1029)return i.RED_INTEGER;if(n===1030)return i.RG;if(n===1031)return i.RG_INTEGER;if(n===1033)return i.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===je)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===33776)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===33776)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===35840)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===36196||n===37492)return a===je?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===37496)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return s.COMPRESSED_R11_EAC;if(n===37489)return s.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return s.COMPRESSED_RG11_EAC;if(n===37491)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===37808)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===je?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===36492)return a===je?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===36283)return s.COMPRESSED_RED_RGT
vendor: 10,563 bytes, lines 4092-4116
4092C1_EXT;if(n===36284)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const md=`
4093void main() {
4094
4095	gl_Position = vec4( position, 1.0 );
4096
4097}`,gd=`
4098uniform sampler2DArray depthColor;
4099uniform float depthWidth;
4100uniform float depthHeight;
4101
4102void main() {
4103
4104	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4105
4106	if ( coord.x >= 1.0 ) {
4107
4108		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4109
4110	} else {
4111
4112		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4113
4114	}
4115
4116}`;class _d{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ba(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Jt({vertexShader:md,fragmentShader:gd,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new qt(new bi(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class xd extends Nn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,f=null,g=null,u=null,m=null,x=null;const S=typeof XRWebGLBinding<"u",p=new _d,h={},b=t.getContextAttributes();let R=null,M=null;const A=[],y=[],C=new We;let _=null;const T=new Xt;T.viewport=new ft;const I=new Xt;I.viewport=new ft;const D=[T,I],N=new wo;let K=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ae=A[J];return ae===void 0&&(ae=new Mr,A[J]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(J){let ae=A[J];return ae===void 0&&(ae=new Mr,A[J]=ae),ae.getGripSpace()},this.getHand=function(J){let ae=A[J];return ae===void 0&&(ae=new Mr,A[J]=ae),ae.getHandSpace()};function z(J){const ae=y.indexOf(J.inputSource);if(ae===-1)return;const ne=A[ae];ne!==void 0&&(ne.update(J.inputSource,J.frame,c||a),ne.dispatchEvent({type:J.type,data:J.inputSource}))}function q(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",k);for(let J=0;J<A.length;J++){const ae=y[J];ae!==null&&(y[J]=null,A[J].disconnect(ae))}K=null,$=null,p.reset();for(const J in h)delete h[J];e.setRenderTarget(R),m=null,u=null,g=null,r=null,M=null,Ne.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,n.isPresenting===!0&&Le("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&Le("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(J){c=J},this.getBaseLayer=function(){return u!==null?u:m},this.getBinding=function(){return g===null&&S&&(g=new XRWebGLBinding(r,t)),g},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function(J){if(r=J,r!==null){if(R=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",q),r.addEventListener("inputsourceschange",k),b.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(C),S&&"createProjectionLayer"in XRWebGLBinding.prototype){let ne=null,De=null,Fe=null;b.depth&&(Fe=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ne=b.stencil?1027:1026,De=b.stencil?1020:1014);const Ce={colorFormat:t.RGBA8,depthFormat:Fe,scaleFactor:s};g=this.getBinding(),u=g.createProjectionLayer(Ce),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new ln(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new ai(u.textureWidth,u.textureHeight,De,void 0,void 0,void 0,void 0,void 0,void 0,ne),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const ne={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,ne),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),M=new ln(m.framebufferWidth,m.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Ne.setContext(r),Ne.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};function k(J){for(let ae=0;ae<J.removed.length;ae++){const ne=J.removed[ae],De=y.indexOf(ne);De>=0&&(y[De]=null,A[De].disconnect(ne))}for(let ae=0;ae<J.added.length;ae++){const ne=J.added[ae];let De=y.indexOf(ne);if(De===-1){for(let Ce=0;Ce<A.length;Ce++)if(Ce>=y.length){y.push(ne),De=Ce;break}else if(y[Ce]===null){y[Ce]=ne,De=Ce;break}if(De===-1)break}const Fe=A[De];Fe&&Fe.connect(ne)}}const Q=new P,ee=new P;function ue(J,ae,ne){Q.setFromMatrixPosition(ae.matrixWorld),ee.setFromMatrixPosition(ne.matrixWorld);const De=Q.distanceTo(ee),Fe=ae.projectionMatrix.elements,Ce=ne.projectionMatrix.elements,ct=Fe[14]/(Fe[10]-1),He=Fe[14]/(Fe[10]+1),Qe=(Fe[9]+1)/Fe[5],ze=(Fe[9]-1)/Fe[5],qe=(Fe[8]-1)/Fe[0],gt=(Ce[8]+1)/Ce[0],ut=ct*qe,_t=ct*gt,St=De/(-qe+gt),ht=St*-qe;if(ae.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(ht),J.translateZ(St),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Fe[10]===-1)J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const nt=ct+St,L=He+St,bt=ut-ht,Je=_t+(De-ht),E=Qe*He/L*nt,d=ze*He/L*nt;J.projectionMatrix.makePerspective(bt,Je,E,d,nt,L),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function pe(J,ae){ae===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ae.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(r===null)return;let ae=J.near,ne=J.far;p.texture!==null&&(p.depthNear>0&&(ae=p.depthNear),p.depthFar>0&&(ne=p.depthFar)),N.near=I.near=T.near=ae,N.far=I.far=T.far=ne,(K!==N.near||$!==N.far)&&(r.updateRenderState({depthNear:N.near,depthFar:N.far}),K=N.near,$=N.far),N.layers.mask=J.layers.mask|6,T.layers.mask=N.layers.mask&-5,I.layers.mask=N.layers.mask&-3;const De=J.parent,Fe=N.cameras;pe(N,De);for(let Ce=0;Ce<Fe.length;Ce++)pe(Fe[Ce],De);Fe.length===2?ue(N,T,I):N.projectionMatrix.copy(T.projectionMatrix),ve(J,N,De)};function ve(J,ae,ne){ne===null?J.matrix.copy(ae.matrixWorld):(J.matrix.copy(ne.matrixWorld),J.matrix.invert(),J.matrix.multiply(ae.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=qr*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(u===null&&m===null))return l},this.setFoveation=function(J){l=J,u!==null&&(u.fixedFoveation=J),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=J)},this.hasDepthSensing=function(){return p.texture!==null},this.getDepthSensingMesh=function(){return p.getMesh(N)},this.getCameraTexture=function(J){return h[J]};let Xe=null;function tt(J,ae){if(f=ae.getViewerPose(c||a),x=ae,f!==null){const ne=f.views;m!==null&&(e.setRenderTargetFramebuffer(M,m.framebuffer),e.setRenderTarget(M));let De=!1;ne.length!==N.cameras.length&&(N.cameras.length=0,De=!0);for(let He=0;He<ne.length;He++){const Qe=ne[He];let ze=null;if(m!==null)ze=m.getViewport(Qe);else{const gt=g.getViewSubImage(u,Qe);ze=gt.viewport,He===0&&(e.setRenderTargetTextures(M,gt.colorTexture,gt.depthStencilTexture),e.setRenderTarget(M))}let qe=D[He];qe===void 0&&(qe=new Xt,qe.layers.enable(He),qe.viewport=new ft,D[He]=qe),qe.matrix.fromArray(Qe.transform.matrix),qe.matrix.decompose(qe.position,qe.quaternion,qe.scale),qe.projectionMatrix.fromArray(Qe.projectionMatrix),qe.projectionMatrixInverse.copy(qe.projectionMatrix).invert(),qe.viewport.set(ze.x,ze.y,ze.width,ze.height),He===0&&(N.matrix.copy(qe.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),De===!0&&N.cameras.push(qe)}const Fe=r.enabledFeatures;if(Fe&&Fe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&S){g=n.getBinding();const He=g.getDepthInformation(ne[0]);He&&He.isValid&&He.texture&&p.init(He,r.renderState)}if(Fe&&Fe.includes("camera-access")&&S){e.state.unbindTexture(),g=n.getBinding();for(let He=0;He<ne.length;He++){const Qe=ne[He].camera;if(Qe){let ze=h[Qe];ze||(ze=new ba,h[Qe]=ze);const qe=g.getCameraImage(Qe);ze.sourceTexture=qe}}}}for(let ne=0;ne<A.length;ne++){const De=y[ne],Fe=A[ne];De!==null&&Fe!==void 0&&Fe.update(De,ae,c||a)}Xe&&Xe(J,ae),ae.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ae}),x=null}const Ne=new Pa;Ne.setAnimationLoop(tt),this.setAnimationLoop=function(J){Xe=J},this.dispose=function(){}}}const vd=new et,Ba=new Be;Ba.set(-1,0,0,0,1,0,0,0,1);function Md(i,e){function t(p,h){p.matrixAutoUpdate===!0&&p.updateMatrix(),h.value.copy(p.matrix)}function n(p,h){h.color.getRGB(p.fogColor.value,Aa(i)),h.isFog?(p.fogNear.value=h.near,p.fogFar.value=h.far):h.isFogExp2&&(p.fogDensity.value=h.density)}function r(p,h,b,R,M){h.isNodeMaterial?h.uniformsNeedUpdate=!1:h.isMeshBasicMaterial?s(p,h):h.isMeshLambertMaterial?(s(p,h),h.envMap&&(p.envMapIntensity.value=h.envMapIntensity)):h.isMeshToonMaterial?(s(p,h),g(p,h)):h.isMeshPhongMaterial?(s(p,h),f(p,h),h.envMap&&(p.envMapIntensity.value=h.envMapIntensity)):h.isMeshStandardMaterial?(s(p,h),u(p,h),h.isMeshPhysicalMaterial&&m(p,h,M)):h.isMeshMat
4116capMaterial?(s(p,h),x(p,h)):h.isMeshDepthMaterial?s(p,h):h.isMeshDistanceMaterial?(s(p,h),S(p,h)):h.isMeshNormalMaterial?s(p,h):h.isLineBasicMaterial?(a(p,h),h.isLineDashedMaterial&&o(p,h)):h.isPointsMaterial?l(p,h,b,R):h.isSpriteMaterial?c(p,h):h.isShadowMaterial?(p.color.value.copy(h.color),p.opacity.value=h.opacity):h.isShaderMaterial&&(h.uniformsNeedUpdate=!1)}function s(p,h){p.opacity.value=h.opacity,h.color&&p.diffuse.value.copy(h.color),h.emissive&&p.emissive.value.copy(h.emissive).multiplyScalar(h.emissiveIntensity),h.map&&(p.map.value=h.map,t(h.map,p.mapTransform)),h.alphaMap&&(p.alphaMap.value=h.alphaMap,t(h.alphaMap,p.alphaMapTransform)),h.bumpMap&&(p.bumpMap.value=h.bumpMap,t(h.bumpMap,p.bumpMapTransform),p.bumpScale.value=h.bumpScale,h.side===1&&(p.bumpScale.value*=-1)),h.normalMap&&(p.normalMap.value=h.normalMap,t(h.normalMap,p.normalMapTransform),p.normalScale.value.copy(h.normalScale),h.side===1&&p.normalScale.value.negate()),h.displacementMap&&(p.displacementMap.value=h.displacementMap,t(h.displacementMap,p.displacementMapTransform),p.displacementScale.value=h.displacementScale,p.displacementBias.value=h.displacementBias),h.emissiveMap&&(p.emissiveMap.value=h.emissiveMap,t(h.emissiveMap,p.emissiveMapTransform)),h.specularMap&&(p.specularMap.value=h.specularMap,t(h.specularMap,p.specularMapTransform)),h.alphaTest>0&&(p.alphaTest.value=h.alphaTest);const b=e.get(h),R=b.envMap,M=b.envMapRotation;R&&(p.envMap.value=R,p.envMapRotation.value.setFromMatrix4(vd.makeRotationFromEuler(M)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&p.envMapRotation.value.premultiply(Ba),p.reflectivity.value=h.reflectivity,p.ior.value=h.ior,p.refractionRatio.value=h.refractionRatio),h.lightMap&&(p.lightMap.value=h.lightMap,p.lightMapIntensity.value=h.lightMapIntensity,t(h.lightMap,p.lightMapTransform)),h.aoMap&&(p.aoMap.value=h.aoMap,p.aoMapIntensity.value=h.aoMapIntensity,t(h.aoMap,p.aoMapTransform))}function a(p,h){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,h.map&&(p.map.value=h.map,t(h.map,p.mapTransform))}function o(p,h){p.dashSize.value=h.dashSize,p.totalSize.value=h.dashSize+h.gapSize,p.scale.value=h.scale}function l(p,h,b,R){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,p.size.value=h.size*b,p.scale.value=R*.5,h.map&&(p.map.value=h.map,t(h.map,p.uvTransform)),h.alphaMap&&(p.alphaMap.value=h.alphaMap,t(h.alphaMap,p.alphaMapTransform)),h.alphaTest>0&&(p.alphaTest.value=h.alphaTest)}function c(p,h){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,p.rotation.value=h.rotation,h.map&&(p.map.value=h.map,t(h.map,p.mapTransform)),h.alphaMap&&(p.alphaMap.value=h.alphaMap,t(h.alphaMap,p.alphaMapTransform)),h.alphaTest>0&&(p.alphaTest.value=h.alphaTest)}function f(p,h){p.specular.value.copy(h.specular),p.shininess.value=Math.max(h.shininess,1e-4)}function g(p,h){h.gradientMap&&(p.gradientMap.value=h.gradientMap)}function u(p,h){p.metalness.value=h.metalness,h.metalnessMap&&(p.metalnessMap.value=h.metalnessMap,t(h.metalnessMap,p.metalnessMapTransform)),p.roughness.value=h.roughness,h.roughnessMap&&(p.roughnessMap.value=h.roughnessMap,t(h.roughnessMap,p.roughnessMapTransform)),h.envMap&&(p.envMapIntensity.value=h.envMapIntensity)}function m(p,h,b){p.ior.value=h.ior,h.sheen>0&&(p.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),p.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(p.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,p.sheenColorMapTransform)),h.sheenRoughnessMap&&(p.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,p.sheenRoughnessMapTransform))),h.clearcoat>0&&(p.clearcoat.value=h.clearcoat,p.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(p.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,p.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(p.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===1&&p.clearcoatNormalScale.value.negate())),h.dispersion>0&&(p.dispersion.value=h.dispersion),h.iridescence>0&&(p.iridescence.value=h.iridescence,p.iridescenceIOR.value=h.iridescenceIOR,p.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(p.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,p.iridescenceMapTransform)),h.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),h.transmission>0&&(p.transmission.value=h.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),h.transmissionMap&&(p.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,p.transmissionMapTransform)),p.thickness.value=h.thickness,h.thicknessMap&&(p.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=h.attenuationDistance,p.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(p.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(p.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=h.specularIntensity,p.specularColor.value.copy(h.specularColor),h.specularColorMap&&(p.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,p.specularColorMapTransform)),h.specularIntensityMap&&(p.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,p.specularIntensityMapTransform))}function x(p,h){h.matcap&&(p.matcap.value=h.matcap)}function S(p,h){const b=e.get(h).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Sd(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,A){const y=A.program;n.uniformBlockBinding(M,y)}function c(M,A){let y=r[M.id];y===void 0&&(p(M),y=f(M),r[M.id]=y,M.addEventListener("dispose",b));const C=A.program;n.updateUBOMapping(M,C);const _=e.render.frame;s[M.id]!==_&&(u(M),s[M.id]=_)}function f(M){const A=g();M.__bindingPointIndex=A;const y=i.createBuffer(),C=M.__size,_=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,C,_),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,A,y),y}function g(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return $e("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(M){const A=r[M.id],y=M.uniforms,C=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let _=0,T=y.length;_<T;_++){const I=y[_];if(Array.isArray(I))for(let D=0,N=I.length;D<N;D++)m(I[D],_,D,C);else m(I,_,0,C)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(M,A,y,C){if(S(M,A,y,C)===!0){const _=M.__offset,T=M.value;if(Array.isArray(T)){let I=0;for(let D=0;D<T.length;D++){const N=T[D],K=h(N);x(N,M.__data,I),typeof N!="number"&&typeof N!="boolean"&&!N.isMatrix3&&!ArrayBuffer.isView(N)&&(I+=K.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(T,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,_,M.__data)}}function x(M,A,y){typeof M=="number"||typeof M=="boolean"?A[0]=M:M.isMatrix3?(A[0]=M.elements[0],A[1]=M.elements[1],A[2]=M.elements[2],A[3]=0,A[4]=M.elements[3],A[5]=M.elements[4],A[6]=M.elements[5],A[7]=0,A[8]=M.elements[6],A[9]=M.elements[7],A[10
4116]=M.elements[8],A[11]=0):ArrayBuffer.isView(M)?A.set(new M.constructor(M.buffer,M.byteOffset,A.length)):M.toArray(A,y)}function S(M,A,y,C){const _=M.value,T=A+"_"+y;if(C[T]===void 0)return typeof _=="number"||typeof _=="boolean"?C[T]=_:ArrayBuffer.isView(_)?C[T]=_.slice():C[T]=_.clone(),!0;{const I=C[T];if(typeof _=="number"||typeof _=="boolean"){if(I!==_)return C[T]=_,!0}else{if(ArrayBuffer.isView(_))return!0;if(I.equals(_)===!1)return I.copy(_),!0}}return!1}function p(M){const A=M.uniforms;let y=0;const C=16;for(let T=0,I=A.length;T<I;T++){const D=Array.isArray(A[T])?A[T]:[A[T]];for(let N=0,K=D.length;N<K;N++){const $=D[N],z=Array.isArray($.value)?$.value:[$.value];for(let q=0,k=z.length;q<k;q++){const Q=z[q],ee=h(Q),ue=y%C,pe=ue%ee.boundary,ve=ue+pe;y+=pe,ve!==0&&C-ve<ee.storage&&(y+=C-ve),$.__data=new Float32Array(ee.storage/Float32Array.BYTES_PER_ELEMENT),$.__offset=y,y+=ee.storage}}}const _=y%C;return _>0&&(y+=C-_),M.__size=y,M.__cache={},this}function h(M){const A={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(A.boundary=4,A.storage=4):M.isVector2?(A.boundary=8,A.storage=8):M.isVector3||M.isColor?(A.boundary=16,A.storage=12):M.isVector4?(A.boundary=16,A.storage=16):M.isMatrix3?(A.boundary=48,A.storage=48):M.isMatrix4?(A.boundary=64,A.storage=64):M.isTexture?Le("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(A.boundary=16,A.storage=M.byteLength):Le("WebGLRenderer: Unsupported uniform value type.",M),A}function b(M){const A=M.target;A.removeEventListener("dispose",b);const y=a.indexOf(A.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function R(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:l,update:c,dispose:R}}const Ed=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
411614942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let an=null;function yd(){return an===null&&(an=new Ea(Ed,16,16,1030,1016),an.name="DFG_LUT",an.minFilter=1006,an.magFilter=1006,an.wrapS=1001,an.wrapT=1001,an.generateMipmaps=!1,an.needsUpdate=!0),an}class Td{constructor(e={}){const{canvas:t=Ga(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:u=!1,outputBufferType:m=1009}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;const S=m,p=new Set([1033,1031,1029]),h=new Set([1009,1014,1012,1020,1017,1018]),b=new Uint32Array(4),R=new Int32Array(4),M=new P;let A=null,y=null;const C=[],_=[];let T=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let D=!1,N=null,K=null,$=null,z=null;this._outputColorSpace=$t;let q=0,k=0,Q=null,ee=-1,ue=null;const pe=new ft,ve=new ft;let Xe=null;const tt=new Ie(0);let Ne=0,J=t.width,ae=t.height,ne=1,De=null,Fe=null;const Ce=new ft(0,0,J,ae),ct=new ft(0,0,J,ae);let He=!1;const Qe=new ns;let ze=!1,qe=!1;const gt=new et,ut=new P,_t=new ft,St={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ht=!1;function nt(){return Q===null?ne:1}let L=n;function bt(v,F){return t.getContext(v,F)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:f,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Qr}`),t.addEventListener("webglcontextlost",dt,!1),t.addEventListener("webglcontextrestored",Y,!1),t.addEventListener("webglcontextcreationerror",fe,!1),L===null){const F="webgl2";if(L=bt(F,v),L===null)throw bt(F)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(v){throw $e("WebGLRenderer: "+v.message),v}let Je,E,d,U,B,V,ie,oe,W,Z,le,ye,he,ce,Te,we,Ue,w,re,X,se,de,j;
vendor: 4,591 bytes, line 4116
4116function Se(){Je=new yu(L),Je.init(),se=new pd(L,Je),E=new mu(L,Je,e,se),d=new dd(L,Je),E.reversedDepthBuffer&&u&&d.buffers.depth.setReversed(!0),K=L.createFramebuffer(),$=L.createFramebuffer(),z=L.createFramebuffer(),U=new Au(L),B=new Qh,V=new fd(L,Je,d,B,E,se,U),ie=new Eu(I),oe=new Po(L),de=new fu(L,oe),W=new Tu(L,oe,U,de),Z=new wu(L,W,oe,de,U),w=new Ru(L,E,V),Te=new gu(B),le=new Jh(I,ie,Je,E,de,Te),ye=new Md(I,B),he=new ed,ce=new ad(Je),Ue=new du(I,ie,d,Z,x,l),we=new hd(I,Z,E),j=new Sd(L,U,E,d),re=new pu(L,Je,U),X=new bu(L,Je,U),U.programs=le.programs,I.capabilities=E,I.extensions=Je,I.properties=B,I.renderLists=he,I.shadowMap=we,I.state=d,I.info=U}Se(),S!==1009&&(T=new Pu(S,t.width,t.height,o,r,s));const Ee=new xd(I,L);this.xr=Ee,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const v=Je.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Je.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(v){v!==void 0&&(ne=v,this.setSize(J,ae,!1))},this.getSize=function(v){return v.set(J,ae)},this.setSize=function(v,F,H=!0){if(Ee.isPresenting){Le("WebGLRenderer: Can't change size while VR device is presenting.");return}J=v,ae=F,t.width=Math.floor(v*ne),t.height=Math.floor(F*ne),H===!0&&(t.style.width=v+"px",t.style.height=F+"px"),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,v,F)},this.getDrawingBufferSize=function(v){return v.set(J*ne,ae*ne).floor()},this.setDrawingBufferSize=function(v,F,H){J=v,ae=F,ne=H,t.width=Math.floor(v*H),t.height=Math.floor(F*H),this.setViewport(0,0,v,F)},this.setEffects=function(v){if(S===1009){$e("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let F=0;F<v.length;F++)if(v[F].isOutputPass===!0){Le("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(pe)},this.getViewport=function(v){return v.copy(Ce)},this.setViewport=function(v,F,H,O){v.isVector4?Ce.set(v.x,v.y,v.z,v.w):Ce.set(v,F,H,O),d.viewport(pe.copy(Ce).multiplyScalar(ne).round())},this.getScissor=function(v){return v.copy(ct)},this.setScissor=function(v,F,H,O){v.isVector4?ct.set(v.x,v.y,v.z,v.w):ct.set(v,F,H,O),d.scissor(ve.copy(ct).multiplyScalar(ne).round())},this.getScissorTest=function(){return He},this.setScissorTest=function(v){d.setScissorTest(He=v)},this.setOpaqueSort=function(v){De=v},this.setTransparentSort=function(v){Fe=v},this.getClearColor=function(v){return v.copy(Ue.getClearColor())},this.setClearColor=function(){Ue.setClearColor(...arguments)},this.getClearAlpha=function(){return Ue.getClearAlpha()},this.setClearAlpha=function(){Ue.setClearAlpha(...arguments)},this.clear=function(v=!0,F=!0,H=!0){let O=0;if(v){let G=!1;if(Q!==null){const _e=Q.texture.format;G=p.has(_e)}if(G){const _e=Q.texture.type,Me=h.has(_e),ge=Ue.getClearColor(),be=Ue.getClearAlpha(),Ae=ge.r,Oe=ge.g,ke=ge.b;Me?(b[0]=Ae,b[1]=Oe,b[2]=ke,b[3]=be,L.clearBufferuiv(L.COLOR,0,b)):(R[0]=Ae,R[1]=Oe,R[2]=ke,R[3]=be,L.clearBufferiv(L.COLOR,0,R))}else O|=L.COLOR_BUFFER_BIT}F&&(O|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),H&&(O|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O!==0&&L.clear(O)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),N=v},this.dispose=function(){t.removeEventListener("webglcontextlost",dt,!1),t.removeEventListener("webglcontextrestored",Y,!1),t.removeEventListener("webglcontextcreationerror",fe,!1),Ue.dispose(),he.dispose(),ce.dispose(),B.dispose(),ie.dispose(),Z.dispose(),de.dispose(),j.dispose(),le.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",ui),Ee.removeEventListener("sessionend",Ri),un.stop()};function dt(v){v.preventDefault(),ls("WebGLRenderer: Context Lost."),D=!0}function Y(){ls("WebGLRenderer: Context Restored."),D=!1;const v=U.autoReset,F=we.enabled,H=we.autoUpdate,O=we.needsUpdate,G=we.type;Se(),U.autoReset=v,we.enabled=F,we.autoUpdate=H,we.needsUpdate=O,we.type=G}function fe(v){$e("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Pe(v){const F=v.target;F.removeEventListener("dispose",Pe),rt(F)}function rt(v){pt(v),B.remove(v)}function pt(v){const F=B.get(v).programs;
vendor: 6,002 bytes, line 4116
4116F!==void 0&&(F.forEach(function(H){le.releaseProgram(H)}),v.isShaderMaterial&&le.releaseShaderCache(v))}this.renderBufferDirect=function(v,F,H,O,G,_e){F===null&&(F=St);const Me=G.isMesh&&G.matrixWorld.determinantAffine()<0,ge=wi(v,F,H,O,G);d.setMaterial(O,Me);let be=H.index,Ae=1;if(O.wireframe===!0){if(be=W.getWireframeAttribute(H),be===void 0)return;Ae=2}const Oe=H.drawRange,ke=H.attributes.position;let Re=Oe.start*Ae,it=(Oe.start+Oe.count)*Ae;_e!==null&&(Re=Math.max(Re,_e.start*Ae),it=Math.min(it,(_e.start+_e.count)*Ae)),be!==null?(Re=Math.max(Re,0),it=Math.min(it,be.count)):ke!=null&&(Re=Math.max(Re,0),it=Math.min(it,ke.count));const vt=it-Re;if(vt<0||vt===1/0)return;de.setup(G,O,ge,H,be);let xt,at=re;if(be!==null&&(xt=oe.get(be),at=X,at.setIndex(xt)),G.isMesh)O.wireframe===!0?(d.setLineWidth(O.wireframeLinewidth*nt()),at.setMode(L.LINES)):at.setMode(L.TRIANGLES);else if(G.isLine){let Dt=O.linewidth;Dt===void 0&&(Dt=1),d.setLineWidth(Dt*nt()),G.isLineSegments?at.setMode(L.LINES):G.isLineLoop?at.setMode(L.LINE_LOOP):at.setMode(L.LINE_STRIP)}else G.isPoints?at.setMode(L.POINTS):G.isSprite&&at.setMode(L.TRIANGLES);if(G.isBatchedMesh)if(Je.get("WEBGL_multi_draw"))at.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const Dt=G._multiDrawStarts,xe=G._multiDrawCounts,Ht=G._multiDrawCount,Ze=be?oe.get(be).bytesPerElement:1,Kt=B.get(O).currentProgram.getUniforms();for(let rn=0;rn<Ht;rn++)Kt.setValue(L,"_gl_DrawID",rn),at.render(Dt[rn]/Ze,xe[rn])}else if(G.isInstancedMesh)at.renderInstances(Re,vt,G.count);else if(H.isInstancedBufferGeometry){const Dt=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,xe=Math.min(H.instanceCount,Dt);at.renderInstances(Re,vt,xe)}else at.render(Re,vt)};function Yt(v,F,H){v.transparent===!0&&v.side===2&&v.forceSinglePass===!1?(v.side=1,v.needsUpdate=!0,At(v,F,H),v.side=0,v.needsUpdate=!0,At(v,F,H),v.side=2):At(v,F,H)}this.compile=function(v,F,H=null){H===null&&(H=v),y=ce.get(H),y.init(F),_.push(y),H.traverseVisible(function(G){G.isLight&&G.layers.test(F.layers)&&(y.pushLight(G),G.castShadow&&y.pushShadow(G))}),v!==H&&v.traverseVisible(function(G){G.isLight&&G.layers.test(F.layers)&&(y.pushLight(G),G.castShadow&&y.pushShadow(G))}),y.setupLights();const O=new Set;return v.traverse(function(G){if(!(G.isMesh||G.isPoints||G.isLine||G.isSprite))return;const _e=G.material;if(_e)if(Array.isArray(_e))for(let Me=0;Me<_e.length;Me++){const ge=_e[Me];Yt(ge,H,G),O.add(ge)}else Yt(_e,H,G),O.add(_e)}),y=_.pop(),O},this.compileAsync=function(v,F,H=null){const O=this.compile(v,F,H);return new Promise(G=>{function _e(){if(O.forEach(function(Me){B.get(Me).currentProgram.isReady()&&O.delete(Me)}),O.size===0){G(v);return}setTimeout(_e,10)}Je.get("KHR_parallel_shader_compile")!==null?_e():setTimeout(_e,10)})};let zn=null;function Ai(v){zn&&zn(v)}function ui(){un.stop()}function Ri(){un.start()}const un=new Pa;un.setAnimationLoop(Ai),typeof self<"u"&&un.setContext(self),this.setAnimationLoop=function(v){zn=v,Ee.setAnimationLoop(v),v===null?un.stop():un.start()},Ee.addEventListener("sessionstart",ui),Ee.addEventListener("sessionend",Ri),this.render=function(v,F){if(F!==void 0&&F.isCamera!==!0){$e("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;N!==null&&N.renderStart(v,F);const H=Ee.enabled===!0&&Ee.isPresenting===!0,O=T!==null&&(Q===null||H)&&T.begin(I,Q);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(F),F=Ee.getCamera()),v.isScene===!0&&v.onBeforeRender(I,v,F,Q),y=ce.get(v,_.length),y.init(F),y.state.textureUnits=V.getTextureUnits(),_.push(y),gt.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Qe.setFromProjectionMatrix(gt,2e3,F.reversedDepth),qe=this.localClippingEnabled,ze=Te.init(this.clippingPlanes,qe),A=he.get(v,C.length),A.init(),C.push(A),Ee.enabled===!0&&Ee.isPresenting===!0){const Me=I.xr.getDepthSensingMesh();Me!==null&&Pt(Me,F,-1/0,I.sortObjects)}Pt(v,F,0,I.sortObjects),A.finish(),I.sortObjects===!0&&A.sort(De,Fe,F.reversedDepth),ht=Ee.enabled===!1||Ee.isPresenting===!1||Ee.hasDepthSensing()===!1,ht&&Ue.addToRenderList(A,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ze===!0&&Te.beginShadows();const G=y.state.shadowsArray;if(we.render(G,v,F),ze===!0&&Te.endShadows(),(O&&T.hasRenderPass())===!1){const Me=A.opaque,ge=A.transmissive;if(y.setupLights(),F.isArrayCamera){const be=F.cameras;if(ge.length>0)for(let Ae=0,Oe=be.length;Ae<Oe;Ae++){const ke=be[Ae];te(Me,ge,v,ke)}ht&&Ue.render(v);for(let Ae=0,Oe=be.length;Ae<Oe;Ae++){const ke=be[Ae];st(A,v,ke,ke.viewport)}}else ge.length>0&&te(Me,ge,v,F),ht&&Ue.render(v),st(A,v,F)}Q!==null&&k===0&&(V.updateMultisampleRenderTarget(Q),V.updateRenderTargetMipmap(Q)),O&&T.end(I),v.isScene===!0&&v.onAfterRender(I,v,F),de.resetDefaultState(),ee=-1,ue=null,_.pop(),_.length>0?(y=_[_.length-1],V.setTextureUnits(y.state.textureUnits),ze===!0&&Te.setGlobalState(I.clippingPlanes,y.state.camera)):y=null,C.pop(),C.length>0?A=C[C.length-1]:A=null,N!==null&&N.renderEnd()};function Pt(v,F,H,O){if(v.visible===!1)return;if(v.layers.test(F.layers)){if(v.isGroup)H=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(F);else if(v.isLightProbeGrid)y.pushLightProbeGrid(v);else if(v.isLight)y.pushLight(v),v.castShadow&&y.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Qe.intersectsSprite(v)){O&&_t.setFromMatrixPosition(v.matrixWorld).applyMatrix4(gt);const Me=Z.update(v),ge=v.material;ge.visible&&A.push(v,Me,ge,H,_t.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Qe.intersectsObject(v))){const Me=Z.update(v),ge=v.material;if(O&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),_t.copy(v.boundingSphere.center)):(Me.boundingSphere===null&&Me.computeBoundingSphere(),_t.copy(Me.boundingSphere.center)),_t.applyM
4116atrix4(v.matrixWorld).applyMatrix4(gt)),Array.isArray(ge)){const be=Me.groups;for(let Ae=0,Oe=be.length;Ae<Oe;Ae++){const ke=be[Ae],Re=ge[ke.materialIndex];Re&&Re.visible&&A.push(v,Me,Re,H,_t.z,ke)}}else ge.visible&&A.push(v,Me,ge,H,_t.z,null)}}const _e=v.children;for(let Me=0,ge=_e.length;Me<ge;Me++)Pt(_e[Me],F,H,O)}function st(v,F,H,O){const{opaque:G,transmissive:_e,transparent:Me}=v;y.setupLightsView(H),ze===!0&&Te.setGlobalState(I.clippingPlanes,H),O&&d.viewport(pe.copy(O)),G.length>0&&Ct(G,F,H),_e.length>0&&Ct(_e,F,H),Me.length>0&&Ct(Me,F,H),d.buffers.depth.setTest(!0),d.buffers.depth.setMask(!0),d.buffers.color.setMask(!0),d.setPolygonOffset(!1)}function te(v,F,H,O){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;if(y.state.transmissionRenderTarget[O.id]===void 0){const Re=Je.has("EXT_color_buffer_half_float")||Je.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[O.id]=new ln(1,1,{generateMipmaps:!0,type:Re?1016:1009,minFilter:1008,samples:Math.max(4,E.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ye.workingColorSpace})}const _e=y.state.transmissionRenderTarget[O.id],Me=O.viewport||pe;_e.setSize(Me.z*I.transmissionResolutionScale,Me.w*I.transmissionResolutionScale);const ge=I.getRenderTarget(),be=I.getActiveCubeFace(),Ae=I.getActiveMipmapLevel();I.setRenderTarget(_e),I.getClearColor(tt),Ne=I.getClearAlpha(),Ne<1&&I.setClearColor(16777215,.5),I.clear(),ht&&Ue.render(H);const Oe=I.toneMapping;I.toneMapping=0;const ke=O.viewport;if(O.viewport!==void 0&&(O.viewport=void 0),y.setupLightsView(O),ze===!0&&Te.setGlobalState(I.clippingPlanes,O),Ct(v,H,O),V.updateMultisampleRenderTarget(_e),V.updateRenderTargetMipmap(_e),Je.has("WEBGL_multisampled_render_to_texture")===!1){let Re=!1;for(let it=0,vt=F.length;it<vt;it++){const xt=F[it],{object:at,geometry:Dt,material:xe,group:Ht}=xt;if(xe.side===2&&at.layers.test(O.layers)){const Ze=xe.side;xe.side=1,xe.needsUpdate=!0,zt(at,H,O,Dt,xe,Ht),xe.side=Ze,xe.needsUpdate=!0,Re=!0}}Re===!0&&(V.updateMultisampleRenderTarget(_e),V.updateRenderTargetMipmap(_e))}I.setRenderTarget(ge,be,Ae),I.setClearColor(tt,Ne),ke!==void 0&&(O.viewport=ke),I.toneMapping=Oe}function Ct(v,F,H){const O=F.isScene===!0?F.overrideMaterial:null;for(let G=0,_e=v.length;G<_e;G++){const Me=v[G],{object:ge,geometry:be,group:Ae}=Me;let Oe=Me.material;Oe.allowOverride===!0&&O!==null&&(Oe=O),ge.layers.test(H.layers)&&zt(ge,F,H,be,Oe,Ae)}}function zt(v,F,H,O,G,_e){v.onBeforeRender(I,F,H,O,G,_e),v.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),G.onBeforeRender(I,F,H,O,v,_e),G.transparent===!0&&G.side===2&&G.forceSinglePass===!1?(G.side=1,G.needsUpdate=!0,I.renderBufferDirect(H,F,O,G,v,_e),G.side=0,G.needsUpdate=!0,I.renderBufferDirect(H,F,O,G,v,_e),G.side=2):I.renderBufferDirect(H,F,O,G,v,_e),v.onAfterRender(I,F,H,O,G,_e)}function At(v,F,H){F.isScene!==!0&&(F=St);const O=B.get(v),G=y.state.lights,_e=y.state.shadowsArray,Me=G.state.version,ge=le.getParameters(v,G.state,_e,F,H,y.state.lightProbeGridArray),be=le.getProgramCacheKey(ge);let Ae=O.programs;O.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?F.environment:null,O.fog=F.fog;const Oe=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;O.envMap=ie.get(v.envMap||O.environment,Oe),O.envMapRotation=O.environment!==null&&v.envMap===null?F.environmentRotation:v.envMapRotation,Ae===void 0&&(v.addEventListener("dispose",Pe),Ae=new Map,O.programs=Ae);let ke=Ae.get(be);if(ke!==void 0){if(O.currentProgram===ke&&O.lightsStateVersion===Me)return hi(v,ge),ke}else ge.uniforms=le.getUniforms(v),N!==null&&v.isNodeMaterial&&N.build(v,H,ge),v.onBeforeCompile(ge,I),ke=le.acquireProgram(ge,be),Ae.set(be,ke),O.uniforms=ge.uniforms;const Re=O.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Re.clippingPlanes=Te.uniform),hi(v,ge),O.needsLights=Vt(v),O.lightsStateVersion=Me,O.needsLights&&(Re.ambientLightColor.value=G.state.ambient,Re.lightProbe.value=G.state.probe,Re.directionalLights.value=G.state.directional,Re.directionalLightShadows.value=G.state.directionalShadow,Re.spotLights.value=G.state.spot,Re.spotLightShadows.value=G.state.spotShadow,Re.rectAreaLights.value=G.state.rectArea,Re.ltc_1.value=G.state.rectAreaLTC1,Re.ltc_2.value=G.state.rectAreaLTC2,Re.pointLights.value=G.state.point,Re.pointLightShadows.value=G.state.pointShadow,Re.hemisphereLights.value=G.state.hemi,Re.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Re.spotLightMatrix.value=G.state.spotLightMatrix,Re.spotLightMap.value=G.state.spotLightMap,Re.pointShadowMatrix.value=G.state.pointShadowMatrix),O.lightProbeGrid=y.state.lightProbeGridArray.length>0,O.currentProgram=ke,O.uniformsList=null,ke}function Vn(v){if(v.uniformsList===null){const F=v.currentProgram.getUniforms();v.uniformsList=ir.seqWithValue(F.seq,v.uniforms)}return v.uniformsList}function hi(v,F){const H=B.get(v);
vendor: 8,030 bytes, line 4116
4116H.outputColorSpace=F.outputColorSpace,H.batching=F.batching,H.batchingColor=F.batchingColor,H.instancing=F.instancing,H.instancingColor=F.instancingColor,H.instancingMorph=F.instancingMorph,H.skinning=F.skinning,H.morphTargets=F.morphTargets,H.morphNormals=F.morphNormals,H.morphColors=F.morphColors,H.morphTargetsCount=F.morphTargetsCount,H.numClippingPlanes=F.numClippingPlanes,H.numIntersection=F.numClipIntersection,H.vertexAlphas=F.vertexAlphas,H.vertexTangents=F.vertexTangents,H.toneMapping=F.toneMapping}function dr(v,F){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(F.matrixWorld);for(let H=0,O=v.length;H<O;H++){const G=v[H];if(G.texture!==null&&G.boundingBox.containsPoint(M))return G}return null}function wi(v,F,H,O,G){F.isScene!==!0&&(F=St),V.resetTextureUnits();const _e=F.fog,Me=O.isMeshStandardMaterial||O.isMeshLambertMaterial||O.isMeshPhongMaterial?F.environment:null,ge=Q===null?I.outputColorSpace:Q.isXRRenderTarget===!0?Q.texture.colorSpace:Ye.workingColorSpace,be=O.isMeshStandardMaterial||O.isMeshLambertMaterial&&!O.envMap||O.isMeshPhongMaterial&&!O.envMap,Ae=ie.get(O.envMap||Me,be),Oe=O.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,ke=!!H.attributes.tangent&&(!!O.normalMap||O.anisotropy>0),Re=!!H.morphAttributes.position,it=!!H.morphAttributes.normal,vt=!!H.morphAttributes.color;let xt=0;O.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(xt=I.toneMapping);const at=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Dt=at!==void 0?at.length:0,xe=B.get(O),Ht=y.state.lights;if(ze===!0&&(qe===!0||v!==ue)){const lt=v===ue&&O.id===ee;Te.setState(O,v,lt)}let Ze=!1;O.version===xe.__version?(xe.needsLights&&xe.lightsStateVersion!==Ht.state.version||xe.outputColorSpace!==ge||G.isBatchedMesh&&xe.batching===!1||!G.isBatchedMesh&&xe.batching===!0||G.isBatchedMesh&&xe.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&xe.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&xe.instancing===!1||!G.isInstancedMesh&&xe.instancing===!0||G.isSkinnedMesh&&xe.skinning===!1||!G.isSkinnedMesh&&xe.skinning===!0||G.isInstancedMesh&&xe.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&xe.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&xe.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&xe.instancingMorph===!1&&G.morphTexture!==null||xe.envMap!==Ae||O.fog===!0&&xe.fog!==_e||xe.numClippingPlanes!==void 0&&(xe.numClippingPlanes!==Te.numPlanes||xe.numIntersection!==Te.numIntersection)||xe.vertexAlphas!==Oe||xe.vertexTangents!==ke||xe.morphTargets!==Re||xe.morphNormals!==it||xe.morphColors!==vt||xe.toneMapping!==xt||xe.morphTargetsCount!==Dt||!!xe.lightProbeGrid!=y.state.lightProbeGridArray.length>0)&&(Ze=!0):(Ze=!0,xe.__version=O.version);let Kt=xe.currentProgram;Ze===!0&&(Kt=At(O,F,G),N&&O.isNodeMaterial&&N.onUpdateProgram(O,Kt,xe));let rn=!1,xn=!1,Hn=!1;const ot=Kt.getUniforms(),Mt=xe.uniforms;if(d.useProgram(Kt.program)&&(rn=!0,xn=!0,Hn=!0),O.id!==ee&&(ee=O.id,xn=!0),xe.needsLights){const lt=dr(y.state.lightProbeGridArray,G);xe.lightProbeGrid!==lt&&(xe.lightProbeGrid=lt,xn=!0)}if(rn||ue!==v){d.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),ot.setValue(L,"projectionMatrix",v.projectionMatrix),ot.setValue(L,"viewMatrix",v.matrixWorldInverse);const Mn=ot.map.cameraPosition;Mn!==void 0&&Mn.setValue(L,ut.setFromMatrixPosition(v.matrixWorld)),E.logarithmicDepthBuffer&&ot.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&&ot.setValue(L,"isOrthographic",v.isOrthographicCamera===!0),ue!==v&&(ue=v,xn=!0,Hn=!0)}if(xe.needsLights&&(Ht.state.directionalShadowMap.length>0&&ot.setValue(L,"directionalShadowMap",Ht.state.directionalShadowMap,V),Ht.state.spotShadowMap.length>0&&ot.setValue(L,"spotShadowMap",Ht.state.spotShadowMap,V),Ht.state.pointShadowMap.length>0&&ot.setValue(L,"pointShadowMap",Ht.state.pointShadowMap,V)),G.isSkinnedMesh){ot.setOptional(L,G,"bindMatrix"),ot.setOptional(L,G,"bindMatrixInverse");const lt=G.skeleton;lt&&(lt.boneTexture===null&&lt.computeBoneTexture(),ot.setValue(L,"boneTexture",lt.boneTexture,V))}G.isBatchedMesh&&(ot.setOptional(L,G,"batchingTexture"),ot.setValue(L,"batchingTexture",G._matricesTexture,V),ot.setOptional(L,G,"batchingIdTexture"),ot.setValue(L,"batchingIdTexture",G._indirectTexture,V),ot.setOptional(L,G,"batchingColorTexture"),G._colorsTexture!==null&&ot.setValue(L,"batchingColorTexture",G._colorsTexture,V));const vn=H.morphAttributes;if((vn.position!==void 0||vn.normal!==void 0||vn.color!==void 0)&&w.update(G,H,Kt),(xn||xe.receiveShadow!==G.receiveShadow)&&(xe.receiveShadow=G.receiveShadow,ot.setValue(L,"receiveShadow",G.receiveShadow)),(O.isMeshStandardMaterial||O.isMeshLambertMaterial||O.isMeshPhongMaterial)&&O.envMap===null&&F.environment!==null&&(Mt.envMapIntensity.value=F.environmentIntensity),Mt.dfgLUT!==void 0&&(Mt.dfgLUT.value=yd()),xn){if(ot.setValue(L,"toneMappingExposure",I.toneMappingExposure),xe.needsLights&&mt(Mt,Hn),_e&&O.fog===!0&&ye.refreshFogUniforms(Mt,_e),ye.refreshMaterialUniforms(Mt,O,ne,ae,y.state.transmissionRenderTarget[v.id]),xe.needsLights&&xe.lightProbeGrid){const lt=xe.lightProbeGrid;Mt.probesSH.value=lt.texture,Mt.probesMin.value.copy(lt.boundingBox.min),Mt.probesMax.value.copy(lt.boundingBox.max),Mt.probesResolution.value.copy(lt.resolution)}ir.upload(L,Vn(xe),Mt,V)}if(O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(ir.upload(L,Vn(xe),Mt,V),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&&ot.setValue(L,"center",G.center),ot.setValue(L,"modelViewMatrix",G.modelViewMatrix),ot.setValue(L,"normalMatrix",G.normalMatrix),ot.setValue(L,"modelMatrix",G.matrixWorld),O.uniformsGroups!==void 0){const lt=O.uniformsGroups;for(let Mn=0,kn=lt.length;Mn<kn;Mn++){const ss=lt[Mn];j.update(ss,Kt),j.bind(ss,Kt)}}return Kt}function mt(v,F){v.ambientLightColor.needsUpdate=F,v.lightProbe.needsUpdate=F,v.directionalLights.needsUpdate=F,v.directionalLightShadows.needsUpdate=F,v.pointLights.needsUpdate=F,v.pointLightShadows.needsUpdate=F,v.spotLights.needsUpdate=F,v.spotLightShadows.needsUpdate=F,v.rectAreaLights.needsUpdate=F,v.hemisphereLights.needsUpdate=F}function Vt(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return k},this.getRenderTarget=function(){return Q},this.setRenderTargetTextures=function(v,F,H){const O=B.get(v);O.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,O.__autoAllocateDepthBuffer===!1&&(O.__useRenderToTexture=!1),B.get(v.texture).__webglTexture=F,B.get(v.depthTexture).__webglTexture=O.__autoAllocateDepthBuffer?void 0:H,O.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,F){const H=B.get(v);H.__webglFramebuffer=F,H.__useDefaultFramebuffer=F===void 0},this.setRenderTarget=function(v,F=0,H=0){Q=v,q=F,k=H;let O=null,G=!1,_e=!1;if(v){const ge=B.get(v);if(ge.__useDefaultFramebuffer!==void 0){d.bindFramebuffer(L.FRAMEBUFFER,ge.__webglFramebuffer),pe.copy(v.viewport),ve.copy(v.scissor),Xe=v.scissorTest,d.viewport(pe),d.scissor(ve),d.setScissorTest(Xe),ee=-1;return}else if(ge.__webglFramebuffer===void 0)V.setupRenderTarget(v);else if(ge.__hasExternalTextures)V.rebindTextures(v,B.get(v.texture).__webglTexture,B.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Oe=v.depthTexture;if(ge.__boundDepthTexture!==Oe){if(Oe!==null&&B.has(Oe)&&(v.width!==Oe.image.width||v.height!==Oe.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");V.setupDepthRenderbuffer(v)}}const be=v.texture;(be.isData3DTexture||be.isDataArrayTexture||be.isCompressedArrayTexture)&&(_e=!0);const Ae=B.get(v).__webglFramebuffer;
vendor: 7,705 bytes, line 4116
4116v.isWebGLCubeRenderTarget?(Array.isArray(Ae[F])?O=Ae[F][H]:O=Ae[F],G=!0):v.samples>0&&V.useMultisampledRTT(v)===!1?O=B.get(v).__webglMultisampledFramebuffer:Array.isArray(Ae)?O=Ae[H]:O=Ae,pe.copy(v.viewport),ve.copy(v.scissor),Xe=v.scissorTest}else pe.copy(Ce).multiplyScalar(ne).floor(),ve.copy(ct).multiplyScalar(ne).floor(),Xe=He;if(H!==0&&(O=K),d.bindFramebuffer(L.FRAMEBUFFER,O)&&d.drawBuffers(v,O),d.viewport(pe),d.scissor(ve),d.setScissorTest(Xe),G){const ge=B.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+F,ge.__webglTexture,H)}else if(_e){const ge=F;for(let be=0;be<v.textures.length;be++){const Ae=B.get(v.textures[be]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+be,Ae.__webglTexture,H,ge)}}else if(v!==null&&H!==0){const ge=B.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,ge.__webglTexture,H)}ee=-1},this.readRenderTargetPixels=function(v,F,H,O,G,_e,Me,ge=0){if(!(v&&v.isWebGLRenderTarget)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let be=B.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Me!==void 0&&(be=be[Me]),be){d.bindFramebuffer(L.FRAMEBUFFER,be);try{const Ae=v.textures[ge],Oe=Ae.format,ke=Ae.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+ge),!E.textureFormatReadable(Oe)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!E.textureTypeReadable(ke)){$e("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=v.width-O&&H>=0&&H<=v.height-G&&L.readPixels(F,H,O,G,se.convert(Oe),se.convert(ke),_e)}finally{const Ae=Q!==null?B.get(Q).__webglFramebuffer:null;d.bindFramebuffer(L.FRAMEBUFFER,Ae)}}},this.readRenderTargetPixelsAsync=async function(v,F,H,O,G,_e,Me,ge=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let be=B.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Me!==void 0&&(be=be[Me]),be)if(F>=0&&F<=v.width-O&&H>=0&&H<=v.height-G){d.bindFramebuffer(L.FRAMEBUFFER,be);const Ae=v.textures[ge],Oe=Ae.format,ke=Ae.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+ge),!E.textureFormatReadable(Oe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!E.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Re=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Re),L.bufferData(L.PIXEL_PACK_BUFFER,_e.byteLength,L.STREAM_READ),L.readPixels(F,H,O,G,se.convert(Oe),se.convert(ke),0);const it=Q!==null?B.get(Q).__webglFramebuffer:null;d.bindFramebuffer(L.FRAMEBUFFER,it);const vt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await za(L,vt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Re),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,_e),L.deleteBuffer(Re),L.deleteSync(vt),_e}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,F=null,H=0){const O=Math.pow(2,-H),G=Math.floor(v.image.width*O),_e=Math.floor(v.image.height*O),Me=F!==null?F.x:0,ge=F!==null?F.y:0;V.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,H,0,0,Me,ge,G,_e),d.unbindTexture()},this.copyTextureToTexture=function(v,F,H=null,O=null,G=0,_e=0){let Me,ge,be,Ae,Oe,ke,Re,it,vt;const xt=v.isCompressedTexture?v.mipmaps[_e]:v.image;if(H!==null)Me=H.max.x-H.min.x,ge=H.max.y-H.min.y,be=H.isBox3?H.max.z-H.min.z:1,Ae=H.min.x,Oe=H.min.y,ke=H.isBox3?H.min.z:0;else{const Mt=Math.pow(2,-G);Me=Math.floor(xt.width*Mt),ge=Math.floor(xt.height*Mt),v.isDataArrayTexture?be=xt.depth:v.isData3DTexture?be=Math.floor(xt.depth*Mt):be=1,Ae=0,Oe=0,ke=0}O!==null?(Re=O.x,it=O.y,vt=O.z):(Re=0,it=0,vt=0);const at=se.convert(F.format),Dt=se.convert(F.type);let xe;F.isData3DTexture?(V.setTexture3D(F,0),xe=L.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(V.setTexture2DArray(F,0),xe=L.TEXTURE_2D_ARRAY):(V.setTexture2D(F,0),xe=L.TEXTURE_2D),d.activeTexture(L.TEXTURE0),d.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,F.flipY),d.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),d.pixelStorei(L.UNPACK_ALIGNMENT,F.unpackAlignment);const Ht=d.getParameter(L.UNPACK_ROW_LENGTH),Ze=d.getParameter(L.UNPACK_IMAGE_HEIGHT),Kt=d.getParameter(L.UNPACK_SKIP_PIXELS),rn=d.getParameter(L.UNPACK_SKIP_ROWS),xn=d.getParameter(L.UNPACK_SKIP_IMAGES);d.pixelStorei(L.UNPACK_ROW_LENGTH,xt.width),d.pixelStorei(L.UNPACK_IMAGE_HEIGHT,xt.height),d.pixelStorei(L.UNPACK_SKIP_PIXELS,Ae),d.pixelStorei(L.UNPACK_SKIP_ROWS,Oe),d.pixelStorei(L.UNPACK_SKIP_IMAGES,ke);const Hn=v.isDataArrayTexture||v.isData3DTexture,ot=F.isDataArrayTexture||F.isData3DTexture;if(v.isDepthTexture){const Mt=B.get(v),vn=B.get(F),lt=B.get(Mt.__renderTarget),Mn=B.get(vn.__renderTarget);d.bindFramebuffer(L.READ_FRAMEBUFFER,lt.__webglFramebuffer),d.bindFramebuffer(L.DRAW_FRAMEBUFFER,Mn.__webglFramebuffer);for(let kn=0;kn<be;kn++)Hn&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,B.get(v).__webglTexture,G,ke+kn),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,B.get(F).__webglTexture,_e,vt+kn)),L.blitFramebuffer(Ae,Oe,Me,ge,Re,it,Me,ge,L.DEPTH_BUFFER_BIT,L.NEAREST);d.bindFramebuffer(L.READ_FRAMEBUFFER,null),d.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(G!==0||v.isRenderTargetTexture||B.has(v)){const Mt=B.get(v),vn=B.get(F);d.bindFramebuffer(L.READ_FRAMEBUFFER,$),d.bindFramebuffer(L.DRAW_FRAMEBUFFER,z);for(let lt=0;lt<be;lt++)Hn?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Mt.__webglTexture,G,ke+lt):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Mt.__webglTexture,G),ot?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,vn.__webglTexture,_e,vt+lt):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,vn.__webglTexture,_e),G!==0?L.blitFramebuffer(Ae,Oe,Me,ge,Re,it,Me,ge,L.COLOR_BUFFER_BIT,L.NEAREST):ot?L.copyTexSubImage3D(xe,_e,Re,it,vt+lt,Ae,Oe,Me,ge):L.copyTexSubImage2D(xe,_e,Re,it,Ae,Oe,Me,ge);d.bindFramebuffer(L.READ_FRAMEBUFFER,null),d.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else ot?v.isDataTexture||v.isData3DTexture?L.texSubImage3D(xe,_e,Re,it,vt,Me,ge,be,at,Dt,xt.data):F.isCompressedArrayTexture?L.compressedTexSubImage3D(xe,_e,Re,it,vt,Me,ge,be,at,xt.data):L.texSubImage3D(xe,_e,Re,it,vt,Me,ge,be,at,Dt,xt):v.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,_e,Re,it,Me,ge,at,Dt,xt.data):v.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,_e,Re,it,xt.width,xt.height,at,xt.data):L.texSubImage2D(L.TEXTURE_2D,_e,Re,it,Me,ge,at,Dt,xt);d.pixelStorei(L.UNPACK_ROW_LENGTH,Ht),d.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ze),d.pixelStorei(L.UNPACK_SKIP_PIXELS,Kt),d.pixelStorei(L.UNPACK_SKIP_ROWS,rn),d.pixelStorei(L.UNPACK_SKIP_IMAGES,xn),_e===0&&F.generateMipmaps&&L.generateMipmap(xe),d.unbindTexture()},this.initRenderTarget=function(v){B.get(v).__webglFramebuffer===void 0&&V.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?V.setTextureCube(v,0):v.isData3DTexture?V.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?V.setTexture2DArray(v,0):V.setTexture2D(v,0),d.unbindTexture()},this.resetState=function(){q=0,k=0,Q=null,d.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}
4116set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ye._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ye._getUnpackColorSpace()}}const bd={high:{modules:22,particles:110,links:11,dpr:2},medium:{modules:16,particles:80,links:9,dpr:1.7},low:{modules:11,particles:50,links:6,dpr:1.3}},ua=new et,gn=new P,Xr=new P,tr=new cn,ha=new cn,Ad=new P(0,1,0),tn=new P,da=new P,Ge=(i,e)=>i+Math.random()*(e-i),nr=(i,e,t)=>{const n=Math.min(Math.max((t-i)/(e-i),0),1);return n*n*(3-2*n)},fa=.45,pa=3.9,Rd=3.3,wd=i=>{const t=2.1799999999999997,n=i-1;return 1+t*n*n*n+1.18*n*n};function Cd(i){const{canvas:e,quality:t}=i,n=bd[t],r=new Td({canvas:e,antialias:t!=="low",alpha:!1,powerPreference:"high-performance"});r.setClearColor(1397708,1);const s=new vs,a=new Ie(1726676),o=new Ie(3111920);s.fog=new es(a.getHex(),13,33);const l=new Xt(46,1,.1,120);l.position.set(0,0,15);const c=Y=>13+Math.max(0,1.75-Y)*5.5,f=Y=>Math.tan(l.fov*Math.PI/180/2)*c(Y)*Y,g=f(1.6),u=Y=>Math.min(Math.max(f(Y)/g,.4),1.15);let m=u((e.clientWidth||16)/(e.clientHeight||10)),x=Math.min(1.7,1/m);const S=new Jt({side:1,depthWrite:!1,uniforms:{uCornerTop:{value:new Ie("#0b57d0")},uCornerTopRight:{value:new Ie("#2772f5")},uCore:{value:new Ie("#1553cc")},uCornerAccent:{value:new Ie("#2570ea")},uCornerBright:{value:new Ie("#4d95ff")},uCardTop:{value:new Ie("#2467dd")},uCardBottom:{value:new Ie("#2f7bf0")},uResolution:{value:new We(1,1)},uTime:{value:0},uScroll:{value:0}},vertexShader:`
4117      void main() {
4118        gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4119      }
4120    `,fragmentShader:`
4121      uniform vec3 uCornerTop;
4122      uniform vec3 uCornerTopRight;
4123      uniform vec3 uCore;
4124      uniform vec3 uCornerAccent;
4125      uniform vec3 uCornerBright;
4126      uniform vec3 uCardTop;
4127      uniform vec3 uCardBottom;
4128      uniform vec2 uResolution;
4129      uniform float uTime;
4130      uniform float uScroll;
4131
4132      // Inverse-distance weight: near a point it dominates, far away it fades out
4133      // smoothly, and the constant keeps it finite at the centre.
4134      float pull(vec2 uv, vec2 at) {
4135        float d = distance(uv, at);
4136        return 1.0 / (pow(d, 2.6) + 0.03);
4137      }
4138
4139      void main() {
4140        vec2 uv = gl_FragCoord.xy / uResolution;
4141
4142        vec2 pTop = vec2(0.16 + sin(uTime * 0.05) * 0.04, 0.86);
4143        vec2 pTopRight = vec2(0.84, 0.8 + cos(uTime * 0.043) * 0.05);
4144        vec2 pCore = vec2(0.5 + sin(uTime * 0.031) * 0.05, 0.52 + cos(uTime * 0.037) * 0.04);
4145        vec2 pAccent = vec2(0.12, 0.14 + sin(uTime * 0.047) * 0.05);
4146        vec2 pBright = vec2(0.9 + cos(uTime * 0.039) * 0.04, 0.12);
4147
4148        float wTop = pull(uv, pTop);
4149        float wTopRight = pull(uv, pTopRight);
4150        float wCore = pull(uv, pCore) * 1.35;
4151        float wAccent = pull(uv, pAccent);
4152        float wBright = pull(uv, pBright);
4153        float total = wTop + wTopRight + wCore + wAccent + wBright;
4154
4155        vec3 base =
4156          (uCornerTop * wTop +
4157           uCornerTopRight * wTopRight +
4158           uCore * wCore +
4159           uCornerAccent * wAccent +
4160           uCornerBright * wBright) / total;
4161
4162        // The end of the ride: the field settles onto the brand accent, so the
4163        // card the world folds into is a solid GetBlock blue.
4164        vec3 card = mix(uCardBottom, uCardTop, uv.y);
4165        base = mix(base, card, smoothstep(0.45, 1.0, uScroll) * 0.85);
4166
4167        // A grain below the eye's threshold: a field this smooth over a whole
4168        // viewport bands without it.
4169        float grain = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);
4170        base += (grain - 0.5) * 0.006;
4171
4172        gl_FragColor = vec4(base, 1.0);
4173        // The uniforms are colour-managed (three converts every Color to linear on
4174        // the way in), so the shader has to hand the result back through the
4175        // renderer's output conversion.
4176        #include <colorspace_fragment>
4177      }
4178    `}),p=new qt(new is(60,32,24),S);s.add(p),s.add(new Ao(10339583,1.15));const h=new Gs(16777215,2.1);h.position.set(6,9,8),s.add(h);const b=new Gs(9421055,1.4);b.position.set(-8,-3,4),s.add(b);const R=new To(7319807,26,26,2);R.position.set(4.5,.4,3),s.add(R);const M=new Ei;s.add(M);const A=n.modules,y=[],C=1.05,_=Y=>Math.round(Y/C)*C,T=3,I=[],D=()=>{I.length=0;for(let Y=0;Y<T;Y++){const fe=Y/Math.max(T-1,1),Pe=_((4.6+fe*5.8)*m),rt=_((-1.6+fe*2+Ge(-.6,.6))*x),pt=_(-1-fe*4.5+Ge(-1.2,1.2));I.push(new P(Pe,rt,pt),new P(-Pe,rt,pt))}I.push(new P(0,_(-4.2*x),_(-2.5)))};D();let N=0;const K=(Y=!1)=>
4178{if(Y){N=I.length-1;const Yt=_(Ge(2,13)*m)*(Math.random()<.5?-1:1);return new P(Yt,_(Ge(-5,5)*x),_(Ge(-17,-9)))}N=Math.floor(Math.random()*I.length);const fe=I[N],Pe=new P(Ge(-2.6,2.6)*m,Ge(-2,2)*x,Ge(-2.4,2.4)),rt=new P(_(fe.x+Pe.x),_(fe.y+Pe.y),_(fe.z+Pe.z)),pt=pa*m;return Math.abs(rt.x)<pt&&rt.y>-3*x&&(rt.x=_(pt+Math.random()*2*m)*Math.sign(rt.x||1)),rt},$=Y=>{const fe=Math.random();return Y===1&&fe>.62?new P(Ge(1.8,2.8),Ge(.12,.22),Ge(1.8,2.8)):fe>.86?new P(Ge(.6,.95),Ge(2.4,3.8),Ge(.6,.95)):fe>.6?new P(Ge(1.9,3),Ge(.85,1.3),Ge(1.3,2)):fe>.24?new P(Ge(1.2,2.1),Ge(1.2,2.1),Ge(1.2,2.1)):new P(Ge(.5,.8),Ge(.5,.8),Ge(.5,.8))};for(let Y=0;Y<A;Y++){const fe=Y%5===0,Pe=fe?1:Math.random()<.5?0:Math.random()<.74?1:2,rt=K(fe),pt=rt.clone().add(new P(Ge(-2.5,2.5),Ge(-2.2,2.2),Ge(-14,-8))),Yt=new cn().setFromAxisAngle(new P(0,1,0),Math.floor(Math.random()*4)*Math.PI/2).multiply(new cn().setFromAxisAngle(new P(1,0,.3).normalize(),Ge(-.06,.06)));y.push({target:rt,origin:pt,position:pt.clone(),velocity:new P,scale:fe?$(Pe).multiplyScalar(Ge(.45,.8)):$(Pe),rotation:Yt.clone(),targetRotation:Yt.clone(),spin:new P(Ge(-.05,.05),Ge(-.08,.08),Ge(-.05,.05)),family:Pe,distant:fe,anchor:N,retireUntil:0,pendingSlot:null,pendingAnchor:N,delay:Math.random()*3.4,travel:Ge(1.5,2.8),spawnedAt:0,charge:0,seed:Math.random()})}const z=new li(1,1,1,1,1,1),q={value:1.4},k={value:1},Q=Y=>{const fe=new Is({color:Y===0?15660287:Y===1?10274047:12900859,transparent:!0,opacity:Y===0?.12:Y===1?.08:.14,depthWrite:!1,emissive:new Ie(1920944),emissiveIntensity:.08});return fe.onBeforeCompile=Pe=>{Pe.uniforms.uLinePx=q,Pe.uniforms.uPxScale=k,Pe.vertexShader=Pe.vertexShader.replace("#include <common>",`#include <common>
4179 varying vec3 vViewDir;
4180 varying vec3 vNormalW;
4181 varying vec3 vObj;`).replace("#include <fog_vertex>",`#include <fog_vertex>
4182           vViewDir = normalize(-mvPosition.xyz);
4183           vNormalW = normalize(normalMatrix * objectNormal);
4184           // Unit-box coordinates drive both the wireframe and the panel lines.
4185           vObj = position;`),Pe.fragmentShader=Pe.fragmentShader.replace("#include <common>",`#include <common>
4186 varying vec3 vViewDir;
4187 varying vec3 vNormalW;
4188 varying vec3 vObj;
4189 uniform float uLinePx;
4190 uniform float uPxScale;`).replace("#include <dithering_fragment>",`#include <dithering_fragment>
4191           float fresnel = pow(1.0 - clamp(dot(normalize(vNormalW), normalize(vViewDir)), 0.0, 1.0), 2.4);
4192           gl_FragColor.rgb += vec3(0.36, 0.56, 1.0) * fresnel * 0.28;
4193
4194           // Wireframe, measured in pixels rather than in the module's own
4195           // coordinates: fwidth() says how much a box coordinate moves per
4196           // screen pixel, so dividing by it turns "distance to the edge" into a
4197           // pixel count. Every module then carries the same crisp 1-2px frame
4198           // however large it is or however far away it stands — the old
4199           // fraction-of-the-box lines went thick and soft on the big volumes.
4200           vec3 boxStep = max(fwidth(vObj), vec3(1e-5));
4201           vec3 edgePx = (vec3(0.5) - abs(vObj)) / boxStep;
4202           // On any face one coordinate sits at the surface, so its distance is
4203           // ~0 and has to be discarded: the nearest real edge is the second
4204           // smallest of the three.
4205           float nearest = min(edgePx.x, min(edgePx.y, edgePx.z));
4206           float furthest = max(edgePx.x, max(edgePx.y, edgePx.z));
4207           float edgePixels = edgePx.x + edgePx.y + edgePx.z - nearest - furthest;
4208           float halfLine = uLinePx * 0.5;
4209           float edge = 1.0 - smoothstep(halfLine - 0.5, halfLine + 0.5, edgePixels);
4210
4211           // Panel lines across the faces, on the same pixel measure. The face's
4212           // own axis is constant across the surface, so its derivative is ~0 and
4213           // it can never win the minimum.
4214           vec3 cell = vObj * 3.0;
4215           vec3 cellPx = abs(fract(cell + 0.5) - 0.5) / max(fwidth(cell), vec3(1e-5));
4216           float panelHalf = uLinePx * 0.34;
4217           float panel = 1.0 - smoothstep(panelHalf - 0.4, panelHalf + 0.6, min(cellPx.x, min(cellPx.y, cellPx.z)));
4218           // Level of detail: 1 / fwidth is roughly how many pixels the module
4219           // spans, so the panel grid only draws on the volumes big enough to
4220           // carry it. Without this the far-off modules turn into graph paper.
4221           float spanPx = 1.0 / max(max(boxStep.x, boxStep.y), boxStep.z);
4222           panel *= smoothstep(90.0 * uPxScale, 260.0 * uPxScale, spanPx);
4223
4224           float mesh = clamp(edge + panel * 0.4, 0.0, 1.0);
4225           gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.86, 0.94, 1.0), mesh * 0.85);
4226
4227           // The faces are barely there, so the frame has to be: edges and panel
4228           // lines pull their own alpha up and draw the module's shape, and the
4229           // rim adds a little where the surface turns away.
4230           float ink = max(mesh, fresnel * 0.5);
4231           gl_FragColor.a = clamp(gl_FragColor.a + ink * 0.34, 0.0, 0.6);
4232        `)},fe},ee=[0,1,2].map(Y=>{const fe=y.filter(pt=>pt.family===Y).length||1,Pe=new lo(z,Q(Y),fe);Pe.instanceMatrix.setUsage(35048),Pe.frustumCulled=!1;const rt=new Float32Array(fe*3);for(let pt=0;pt<fe;pt++)rt[pt*3]=1,rt[pt*3+1]=1,rt[pt*3+2]=1;return Pe.instanceColor=new Yr(rt,3),Pe.instanceColor.setUsage(35048),M.add(Pe),{mesh:Pe,cursor:0}}),ue=new Bt,pe=new Float32Array(n.particles*3);for(let Y=0;Y<n.particles;Y++)pe[Y*3]=Ge(-14,16),pe[Y*3+1]=Ge(-7,7),pe[Y*3+2]=Ge(-14,6);ue.setAttribute("position",new Nt(pe,3));const ve=new Ds(ue,new Kr({color:12376319,size:.05,transparent:!0,opacity:.3,depthWrite:!1}));M.add(ve);const Xe=n.links,tt=new Bt,Ne=new Float32Array(Xe*6),J=new Float32Array(Xe*2);tt.setAttribute("position",new Gt(Ne,3).setUsage(35048)),tt.setAttribute("aAlpha",new Gt(J,1).setUsage(35048));const ae=new ya({color:11129087,transparent:!0,opacity:.16,depthWrite:!1}),ne=new po(tt,ae);ne.frustumCulled=!1,M.add(ne);const De=new Bt,Fe=new Float32Array(Xe*3);De.setAttribute("position",new Gt(Fe,3).setUsage(35048));const Ce=new Ds(De,new Kr({color:15003903,size:.15,transparent:!0,opacity:.6,depthWrite:!1}));Ce.frustumCulled=!1,M.add(Ce);const ct=[],He=()=>{for(let Y=0;Y<24;Y++){const fe=Math.floor(Math.random()*y.length),Pe=Math.floor(Math.random()*y.length);if(fe===Pe)continue;const rt=y[fe].target.distanceTo(y[Pe].target);if(!(rt<1.1||rt>3.4))return[fe,Pe]}return null},Qe=()=>{ct.length=0;for(let Y=0;Y<Xe;Y++){const fe=He();if(!fe)break;ct.push({a:fe[0],b:fe[1],life:Ge(2.5,7),signal:Math.random(),speed:Ge(.25,.6)})}};Qe();const ze=[],qe=(Y,fe=1)=>{ze.length>6&&ze.shift(),ze.push({center:Y.clone(),radius:0,strength:fe})}
4232,gt=new cr(-1,1,1,-1,0,1),ut=new Jt({transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{uRect:{value:new ft(0,0,1,1)},uRadius:{value:0},uResolution:{value:new We(1,1)},uColor:{value:new Ie("#f5f6f7")}},vertexShader:`
4233      void main() {
4234        gl_Position = vec4(position.xy, 0.0, 1.0);
4235      }
4236    `,fragmentShader:`
4237      uniform vec4 uRect;
4238      uniform float uRadius;
4239      uniform vec2 uResolution;
4240      uniform vec3 uColor;
4241
4242      void main() {
4243        // Page coordinates: top-left origin, like the rect the page hands over.
4244        vec2 point = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y);
4245        vec2 centre = vec2(uRect.x + uRect.z, uRect.y + uRect.w) * 0.5;
4246        vec2 halfSize = vec2(uRect.z - uRect.x, uRect.w - uRect.y) * 0.5;
4247        vec2 corner = abs(point - centre) - (halfSize - vec2(uRadius));
4248        float distance = length(max(corner, 0.0)) + min(max(corner.x, corner.y), 0.0) - uRadius;
4249        float cover = smoothstep(-1.0, 1.0, distance);
4250        if (cover <= 0.002) discard;
4251        gl_FragColor = vec4(uColor, cover);
4252        #include <colorspace_fragment>
4253      }
4254    `}),_t=new qt(new bi(2,2),ut);_t.frustumCulled=!1;const St=new vs;St.add(_t);let ht=!1;const nt=new We(0,0),L=new P(0,0,0),bt=new P(0,0,0),Je=new P(0,0,0),E=new We;let d=!1,U=0,B=0,V=0,ie=0,oe=0,W=0,Z=0;const le=new P;let ye=!1;const he=(Y,fe,Pe)=>{const pt=gn.set(Y,fe,.5).unproject(l).sub(l.position).normalize(),Yt=-l.position.z/pt.z;return Pe.copy(l.position).add(pt.multiplyScalar(Yt)),Pe},ce=(Y=1)=>{D(),I.forEach(fe=>{fe.y=_(fe.y+V*1),fe.z=_(fe.z-V*1.2)}),y.forEach(fe=>{Math.random()>Y||(fe.pendingSlot=K(fe.distant),fe.pendingAnchor=N,fe.retireUntil=w+fa+Math.random()*.5)}),Qe()};let Te=0,we=!1,Ue=0,w=0,re=Ge(4,7),X=1,se=0,de=0,j=l.position.z;const Se=()=>{const Y=e.clientWidth||1,fe=e.clientHeight||1,Pe=Math.min(window.devicePixelRatio||1,n.dpr)*X;r.setPixelRatio(Pe),q.value=1.4*Pe,k.value=Pe,r.setSize(Y,fe,!1),S.uniforms.uResolution.value.set(e.width,e.height),l.aspect=Y/fe,j=c(l.aspect),l.position.z=j,l.updateProjectionMatrix();const rt=u(l.aspect);Math.abs(rt-m)>.1&&(m=rt,x=Math.min(1.7,1/m),D())},Ee=Y=>{w+=Y,S.uniforms.uTime.value=w,V+=(B-V)*Math.min(Y*2.6,1),S.uniforms.uScroll.value=V,s.fog&&(s.fog.color.copy(a).lerp(o,nr(.45,1,V)*.85),r.setClearColor(s.fog.color.getHex(),1));const fe=(B-oe)/Math.max(Y,1e-4);oe=B,W+=(Math.min(Math.max(fe,-2),2)-W)*Math.min(Y*5,1);const Pe=1+V*.6,rt=V*.6,pt=V*.3;da.set(0,.4+V*.8,-1-V*1.6);const Yt=1-nr(.97,1,V);M.rotation.y=V*1.15+Math.sin(w*.07)*.09+ie,M.rotation.x=-V*.09+Math.sin(w*.05)*.02,M.position.z=V*4.2,M.position.y=-V*.6+Math.sin(w*.11)*.14,M.updateMatrixWorld();const zn=Math.cos(M.rotation.y),Ai=Math.sin(M.rotation.y),ui=Math.floor(V*3);ui!==Z&&(Z=ui,ce(.55));const Ri=nt.x*.55,un=nt.y*.35+B*.6;l.position.x+=(Ri-l.position.x)*Math.min(Y*2.2,1),l.position.y+=(un-l.position.y)*Math.min(Y*2.2,1),l.position.z=j-V*1.1+Math.sin(w*.09)*.35,l.lookAt(0,0,-1-B*2),d?(he(nt.x,nt.y,L),M.worldToLocal(bt.copy(L)),U+=Y*(1-Math.min(E.length()*8,1)),U>.9&&(U=0,qe(bt,.8))):U=0,ye&&M.worldToLocal(Je.copy(le));for(let st=ze.length-1;st>=0;st--){const te=ze[st];te.radius+=Y*6.5,te.strength-=Y*.28,(te.strength<=0||te.radius>22)&&ze.splice(st,1)}ee.forEach(st=>st.cursor=0);for(let st=0;st<y.length;st++){const te=y[st];let Ct=1;if(te.retireUntil){const mt=te.retireUntil-w;mt<=0?(te.pendingSlot&&(te.origin.copy(te.position),te.origin.y-=Ge(3,9),te.target.copy(te.pendingSlot),te.anchor=te.pendingAnchor,te.pendingSlot=null),te.retireUntil=0,te.spawnedAt=w,te.delay=Math.random()*.6,te.travel=Ge(1.3,2.6),te.velocity.set(0,0,0)):Ct=nr(0,fa,mt)}const zt=w-te.spawnedAt-te.delay;let At=0;if(zt>0){At=Math.min(zt/te.travel,1);const mt=At<1?wd(At):1;Xr.copy(te.origin).lerp(te.target,mt),At<1&&(te.position.copy(Xr),te.velocity.set(0,0,0),At>.985&&qe(te.target,.35))}else te.position.copy(te.origin);if(At>=1){if(tn.copy(te.target).lerp(I[Math.min(te.anchor,I.length-1)],rt).lerp(da,pt),tn.x+=Math.cos(w*.37+te.seed*8)*.18,tn.y+=Math.sin(w*.5+te.seed*12)*.24,tn.z+=Math.sin(w*.29+te.seed*5)*.2,Yt>.01&&!te.distant){const mt=pa*m,Vt=tn.x*zn+tn.z*Ai;if(Math.abs(Vt)<mt&&Math.abs(tn.y)<Rd*x){const F=(Math.sign(Vt||1)*mt-tn.z*Ai)/(zn||1);tn.x+=(F-tn.x)*Yt}}if(gn.copy(tn).sub(te.position).multiplyScalar(26*Y),te.velocity.add(gn),d){gn.copy(te.position).sub(bt);const mt=gn.length();if(mt<4.2){const Vt=(1-mt/4.2)**2*26*Y;te.velocity.add(gn.normalize().multiplyScalar(Vt))}}if(ye){gn.copy(Je).sub(te.position);const mt=gn.length();mt<5.5&&te.velocity.add(gn.normalize().multiplyScalar((1-mt/5.5)*5*Y))}if(Math.abs(W)>.02){const mt=W*2.4*Y;te.velocity.x-=te.position.y*mt,te.velocity.y+=te.position.x*mt,te.velocity.z-=mt*2.5;const Vt=W*3.4*Y;te.velocity.x+=te.position.z*Vt,te.velocity.z-=te.position.x*Vt}te.velocity.multiplyScalar(1-Math.min(Y*5.2,.9)),te.position.addScaledVector(te.velocity,Y)}te.charge=Math.max(0,te.charge-Y*1.5);for(let mt=0;mt<ze.length;mt++){const Vt=ze[mt],v=te.position.distanceTo(Vt.center),F=Math.abs(v-Vt.radius);F<.9&&(te.charge=Math.max(te.charge,Vt.strength*(1-F/.9)))}At<1?(tr.setFromAxisAngle(new P(.2,1,.1).normalize(),(1-At)*1.6),te.rotation.copy(te.targetRotation).multiply(tr)):(tr.setFromAxisAngle(new P(te.spin.x,te.spin.y,te.spin.z).normalize(),Math.sin(w*.25+te.seed*9)*.06),ha.setFromAxisAngle(Ad,V*(.5+te.seed*1.1)*(te.seed>.5?1:-1)),te.rotation.copy(te.targetRotation).multiply(tr).multiply(ha));const Vn=ee[te.family],hi=Vn.cursor++,dr=nr(0,.25,At);ua.compose(te.position,te.rotation,Xr.copy(te.scale).multiplyScalar(dr*Ct*Pe*(1+te.seed*.1))),Vn.mesh.setMatrixAt(hi,ua);const wi=Vn.mesh.instanceColor;wi&&wi.setXYZ(hi,.86+te.charge*.9,.92+te.charge*.6,1)}ee.forEach(st=>{st.mesh.count=st.cursor,st.mesh.instanceMatrix.needsUpdate=!0,st.mesh.instanceColor&&(st.mesh.instanceColor.
4254needsUpdate=!0)});let Pt=0;for(let st=0;st<Xe;st++){const te=ct[st];if(!te){Ne[Pt++]=0,Ne[Pt++]=0,Ne[Pt++]=0,Ne[Pt++]=0,Ne[Pt++]=0,Ne[Pt++]=0,Fe[st*3+1]=-999;continue}const Ct=y[te.a],zt=y[te.b];if(te.life-=Y,te.life<=0){const At=He();At&&(te.a=At[0],te.b=At[1]),te.life=Ge(2.5,7)}Ne[Pt++]=Ct.position.x,Ne[Pt++]=Ct.position.y,Ne[Pt++]=Ct.position.z,Ne[Pt++]=zt.position.x,Ne[Pt++]=zt.position.y,Ne[Pt++]=zt.position.z,te.signal+=Y*te.speed,te.signal>=1&&(te.signal-=1,Math.random()<.5&&qe(zt.position,.5)),Fe[st*3]=Ct.position.x+(zt.position.x-Ct.position.x)*te.signal,Fe[st*3+1]=Ct.position.y+(zt.position.y-Ct.position.y)*te.signal,Fe[st*3+2]=Ct.position.z+(zt.position.z-Ct.position.z)*te.signal}tt.attributes.position.needsUpdate=!0,De.attributes.position.needsUpdate=!0,re-=Y,re<=0&&(re=Ge(4.5,8),ce(.22)),ve.rotation.y+=Y*.008,R.position.x=4.5+Math.sin(w*.3)*1.2},dt=Y=>{if(!we)return;Te=requestAnimationFrame(dt);const fe=Math.min((Y-(Ue||Y))/1e3,.05);Ue=Y,fe>.024?(se+=1,de=0):fe<.014&&(de+=1,se=0),se>12&&X>.6?(X=Math.max(.6,X-.12),se=0,Se()):de>240&&X<1&&(X=Math.min(1,X+.1),de=0,Se()),Ee(fe),r.render(s,l),ht&&(r.autoClear=!1,r.render(St,gt),r.autoClear=!0)};return Se(),{start(){we||(we=!0,Ue=0,Te=requestAnimationFrame(dt))},stop(){we=!1,Te&&cancelAnimationFrame(Te),Te=0},resize:Se,setPointer(Y,fe,Pe){E.set(Y-nt.x,fe-nt.y),nt.set(Y,fe),d=Pe},setScroll(Y){B=Y},setYawOffset(Y){ie=Y},setFocus(Y,fe,Pe){ye=Pe,Pe&&he(Y,fe,le)},setMask(Y){if(ht=Y!==null,!Y)return;const fe=r.getPixelRatio();ut.uniforms.uRect.value.set(Y.left*fe,Y.top*fe,Y.right*fe,Y.bottom*fe),ut.uniforms.uRadius.value=Y.radius*fe,ut.uniforms.uResolution.value.set(e.width,e.height)},dispose(){this.stop(),z.dispose(),ee.forEach(Y=>{Y.mesh.material instanceof Is&&Y.mesh.material.dispose(),M.remove(Y.mesh)}),tt.dispose(),ae.dispose(),De.dispose(),ue.dispose(),p.geometry.dispose(),S.dispose(),_t.geometry.dispose(),ut.dispose(),r.dispose()}}}export{Cd as createPageScene};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.