vendor: 16,136 bytes, lines 1-5
1/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const rr="168";const $t="",wt="srgb",jt="srgb-linear",sr="display-p3",Si="display-p3-linear",gi="linear",Ye="srgb",vi="rec709",xi="p3";const _r="300 es";class Ln{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){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[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 ut=["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"],Ci=Math.PI/180,nr=180/Math.PI;function Hn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ut[i&255]+ut[i>>8&255]+ut[i>>16&255]+ut[i>>24&255]+"-"+ut[e&255]+ut[e>>8&255]+"-"+ut[e>>16&15|64]+ut[e>>24&255]+"-"+ut[t&63|128]+ut[t>>8&255]+"-"+ut[t>>16&255]+ut[t>>24&255]+ut[n&255]+ut[n>>8&255]+ut[n>>16&255]+ut[n>>24&255]).toLowerCase()}function mt(i,e,t){return Math.max(e,Math.min(t,i))}function Ds(i,e){return(i%e+e)%e}function wi(i,e,t){return(1-t)*i+t*e}function Un(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("Invalid component type.")}}function pt(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("Invalid component type.")}}class Ne{constructor(e=0,t=0){Ne.prototype.isVector2=!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("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("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}sub(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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(mt(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 Le{constructor(e,t,n,r,s,a,o,l,c){Le.prototype.isMatrix3=!0,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 h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[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],h=n[4],p=n[7],f=n[2],m=n[5],x=n[8],M=r[0],d=r[3],u=r[6],A=r[1],E=r[4],y=r[7],G=r[2],R=r[5],C=r[8];return s[0]=a*M+o*A+l*G,s[3]=a*d+o*E+l*R,s[6]=a*u+o*y+l*C,s[1]=c*M+h*A+p*G,s[4]=c*d+h*E+p*R,s[7]=c*u+h*y+p*C,s[2]=f*M+m*A+x*G,s[5]=f*d+m*E+x*R,s[8]=f*u+m*y+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],h=e[8];return t*a*h-t*o*c-n*s*h+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],h=e[8],p=h*a-o*c,f=o*l-h*s,m=c*s-a*l,x=t*p+n*f+r*m;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/x;return e[0]=p*M,e[1]=(r*c-h*n)*M,e[2]=(o*n-r*a)*M,e[3]=f*M,e[4]=(h*t-r*l)*M,e[5]=(r*s-o*t)*M,e[6]=m*M,e[7]=(n*l-c*t)*M,e[8]=(a*t-n*s)*M,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 this.premultiply(Pi.makeScale(e,t)),this}rotate(e){return this.premultiply(Pi.makeRotation(-e)),this}translate(e,t){return this.premultiply(Pi.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 Pi=new Le;function ls(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Mi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Us(){const i=Mi("canvas");return i.style.display="block",i}const gr={};function zn(i){i in gr||(gr[i]=!0,console.warn(i))}function Is(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 vr=new Le().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),xr=new Le().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),In={[jt]:{transfer:gi,primaries:vi,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[wt]:{transfer:Ye,primaries:vi,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Si]:{transfer:gi,primaries:xi,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(xr),fromReference:i=>i.applyMatrix3(vr)},[sr]:{transfer:Ye,primaries:xi,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(xr),fromReference:i=>i.applyMatrix3(vr).convertLinearToSRGB()}},Fs=new Set([jt,Si]),ke={enabled:!0,_workingColorSpace:jt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Fs.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=In[e].toReference,r=In[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return In[i].primaries},getTransfer:function(i){return i===$t?gi:In[i].transfer},getLuminanceCoefficients:function(i,e=this._workingColorSpace){return i.fromArray(In[e].luminanceCoefficients)}};function wn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Li(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let dn;class Ns{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{dn===void 0&&(dn=Mi("canvas")),dn.width=e.width,dn.height=e.height;const n=dn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=dn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Mi("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]=wn(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(wn(t[n]/255)*255):t[n]=wn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Os=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Os++}),this.uuid=Hn(),this.data=e,this.dataReady=!0,this.version=0}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(Di(r[a].image)):s.push(Di(r[a]))}else s=Di(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Di(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ns.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Bs=0;class _t extends Ln{constructor(e=_t.DEFAULT_IMAGE,t=_t.DEFAULT_MAPPING,n=1001,r=1001,s=1006,a=1008,o=1023,l=1009,c=_t.DEFAULT_ANISOTROPY,h=$t){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bs++}),this.uuid=Hn(),this.name="",this.source=new cs(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 Ne(0,0),this.repeat=new Ne(1,1),this.center=new Ne(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Le,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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)}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.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
vendor: 5,624 bytes, line 5
5=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}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.6,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,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++}}_t.DEFAULT_IMAGE=null;_t.DEFAULT_MAPPING=300;_t.DEFAULT_ANISOTROPY=1;class rt{constructor(e=0,t=0,n=0,r=1){rt.prototype.isVector4=!0,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("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("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}sub(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}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],h=l[4],p=l[8],f=l[1],m=l[5],x=l[9],M=l[2],d=l[6],u=l[10];if(Math.abs(h-f)<.01&&Math.abs(p-M)<.01&&Math.abs(x-d)<.01){if(Math.abs(h+f)<.1&&Math.abs(p+M)<.1&&Math.abs(x+d)<.1&&Math.abs(c+m+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,y=(m+1)/2,G=(u+1)/2,R=(h+f)/4,C=(p+M)/4,O=(x+d)/4;return E>y&&E>G?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=R/n,s=C/n):y>G?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=R/r,s=O/r):G<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(G),n=C/s,r=O/s),this.set(n,r,s,t),this}let A=Math.sqrt((d-x)*(d-x)+(p-M)*(p-M)+(f-h)*(f-h));return Math.abs(A)<.001&&(A=1),this.x=(d-x)/A,this.y=(p-M)/A,this.z=(f-h)/A,this.w=Math.acos((c+m+u-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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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}
vendor: 13,504 bytes, line 5
5round(){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 Gs extends Ln{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new rt(0,0,e,t),this.scissorTest=!1,this.viewport=new rt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new _t(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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.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 n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new cs(t),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}dispose(){this.dispatchEvent({type:"dispose"})}}class un extends Gs{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class us extends _t{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 zs extends _t{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 Vn{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],h=n[r+2],p=n[r+3];const f=s[a+0],m=s[a+1],x=s[a+2],M=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=p;return}if(o===1){e[t+0]=f,e[t+1]=m,e[t+2]=x,e[t+3]=M;return}if(p!==M||l!==f||c!==m||h!==x){let d=1-o;const u=l*f+c*m+h*x+p*M,A=u>=0?1:-1,E=1-u*u;if(E>Number.EPSILON){const G=Math.sqrt(E),R=Math.atan2(G,u*A);d=Math.sin(d*R)/G,o=Math.sin(o*R)/G}const y=o*A;if(l=l*d+f*y,c=c*d+m*y,h=h*d+x*y,p=p*d+M*y,d===1-o){const G=1/Math.sqrt(l*l+c*c+h*h+p*p);l*=G,c*=G,h*=G,p*=G}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],p=s[a],f=s[a+1],m=s[a+2],x=s[a+3];return e[t]=o*x+h*p+l*m-c*f,e[t+1]=l*x+h*f+c*p-o*m,e[t+2]=c*x+h*m+o*f-l*p,e[t+3]=h*x-o*p-l*f-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),h=o(r/2),p=o(s/2),f=l(n/2),m=l(r/2),x=l(s/2);switch(a){case"XYZ":this._x=f*h*p+c*m*x,this._y=c*m*p-f*h*x,this._z=c*h*x+f*m*p,this._w=c*h*p-f*m*x;break;case"YXZ":this._x=f*h*p+c*m*x,this._y=c*m*p-f*h*x,this._z=c*h*x-f*m*p,this._w=c*h*p+f*m*x;break;case"ZXY":this._x=f*h*p-c*m*x,this._y=c*m*p+f*h*x,this._z=c*h*x+f*m*p,this._w=c*h*p-f*m*x;break;case"ZYX":this._x=f*h*p-c*m*x,this._y=c*m*p+f*h*x,this._z=c*h*x-f*m*p,this._w=c*h*p+f*m*x;break;case"YZX":this._x=f*h*p+c*m*x,this._y=c*m*p+f*h*x,this._z=c*h*x-f*m*p,this._w=c*h*p-f*m*x;break;case"XZY":this._x=f*h*p-c*m*x,this._y=c*m*p-f*h*x,this._z=c*h*x+f*m*p,this._w=c*h*p+f*m*x;break;default:console.warn("THREE.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],h=t[6],p=t[10],f=n+o+p;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>p){const m=2*Math.sqrt(1+n-o-p);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>p){const m=2*Math.sqrt(1+o-n-p);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+p-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(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(mt(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,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),p=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=a*p+this._w*f,this._x=n*p+this._x*f,this._y=r*p+this._y*f,this._z=s*p+this._z*f,this._onChangeCallback(),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 F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!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("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("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(Mr.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Mr.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),h=2*(o*t-s*r),p=2*(s*n-a*t);return this.x=t+l*c+a*p-o*h,this.y=n+l*h+o*c-s*p,this.z=r+l*p+s*h-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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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}
vendor: 5,822 bytes, line 5
5round(){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 Ui.copy(this).projectOnVector(e),this.sub(Ui)}reflect(e){return this.sub(Ui.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(mt(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 Ui=new F,Mr=new Vn;class kn{constructor(e=new F(1/0,1/0,1/0),t=new F(-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(yt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(yt.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=yt.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,yt):yt.fromBufferAttribute(s,a),yt.applyMatrix4(e.matrixWorld),this.expandByPoint(yt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Kn.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Kn.copy(n.boundingBox)),Kn.applyMatrix4(e.matrixWorld),this.union(Kn)}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,yt),yt.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 19,842 bytes, line 5
5s}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(Fn),$n.subVectors(this.max,Fn),fn.subVectors(e.a,Fn),pn.subVectors(e.b,Fn),mn.subVectors(e.c,Fn),kt.subVectors(pn,fn),Wt.subVectors(mn,pn),en.subVectors(fn,mn);let t=[0,-kt.z,kt.y,0,-Wt.z,Wt.y,0,-en.z,en.y,kt.z,0,-kt.x,Wt.z,0,-Wt.x,en.z,0,-en.x,-kt.y,kt.x,0,-Wt.y,Wt.x,0,-en.y,en.x,0];return!Ii(t,fn,pn,mn,$n)||(t=[1,0,0,0,1,0,0,0,1],!Ii(t,fn,pn,mn,$n))?!1:(Zn.crossVectors(kt,Wt),t=[Zn.x,Zn.y,Zn.z],Ii(t,fn,pn,mn,$n))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(yt).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:(Nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nt),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)}}const Nt=[new F,new F,new F,new F,new F,new F,new F,new F],yt=new F,Kn=new kn,fn=new F,pn=new F,mn=new F,kt=new F,Wt=new F,en=new F,Fn=new F,$n=new F,Zn=new F,tn=new F;function Ii(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){tn.fromArray(i,s);const o=r.x*Math.abs(tn.x)+r.y*Math.abs(tn.y)+r.z*Math.abs(tn.z),l=e.dot(tn),c=t.dot(tn),h=n.dot(tn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Hs=new kn,Nn=new F,Fi=new F;class ar{constructor(e=new F,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):Hs.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)}applyMatrix4(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;Nn.subVectors(e,this.center);const t=Nn.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Nn,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):(Fi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Nn.copy(e.center).add(Fi)),this.expandByPoint(Nn.copy(e.center).sub(Fi))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ot=new F,Ni=new F,jn=new F,Xt=new F,Oi=new F,Jn=new F,Bi=new F;class Vs{constructor(e=new F,t=new F(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,Ot)),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=Ot.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ot.copy(this.origin).addScaledVector(this.direction,t),Ot.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Ni.copy(e).add(t).multiplyScalar(.5),jn.copy(t).sub(e).normalize(),Xt.copy(this.origin).sub(Ni);const s=e.distanceTo(t)*.5,a=-this.direction.dot(jn),o=Xt.dot(this.direction),l=-Xt.dot(jn),c=Xt.lengthSq(),h=Math.abs(1-a*a);let p,f,m,x;if(h>0)if(p=a*l-o,f=a*o-l,x=s*h,p>=0)if(f>=-x)if(f<=x){const M=1/h;p*=M,f*=M,m=p*(p+a*f+2*o)+f*(a*p+f+2*l)+c}else f=s,p=Math.max(0,-(a*f+o)),m=-p*p+f*(f+2*l)+c;else f=-s,p=Math.max(0,-(a*f+o)),m=-p*p+f*(f+2*l)+c;else f<=-x?(p=Math.max(0,-(-a*s+o)),f=p>0?-s:Math.min(Math.max(-s,-l),s),m=-p*p+f*(f+2*l)+c):f<=x?(p=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(p=Math.max(0,-(a*s+o)),f=p>0?s:Math.min(Math.max(-s,-l),s),m=-p*p+f*(f+2*l)+c);else f=a>0?-s:s,p=Math.max(0,-(a*f+o)),m=-p*p+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(Ni).addScaledVector(jn,f),m}intersectSphere(e,t){Ot.subVectors(e.center,this.origin);const n=Ot.dot(this.direction),r=Ot.dot(Ot)-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 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,h=1/this.direction.y,p=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),h>=0?(s=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),p>=0?(o=(e.min.z-f.z)*p,l=(e.max.z-f.z)*p):(o=(e.max.z-f.z)*p,l=(e.min.z-f.z)*p),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,Ot)!==null}intersectTriangle(e,t,n,r,s){Oi.subVectors(t,e),Jn.subVectors(n,e),Bi.crossVectors(Oi,Jn);let a=this.direction.dot(Bi),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Xt.subVectors(this.origin,e);const l=o*this.direction.dot(Jn.crossVectors(Xt,Jn));if(l<0)return null;const c=o*this.direction.dot(Oi.cross(Xt));if(c<0||l+c>a)return null;const h=-o*Xt.dot(Bi);return h<0?null:this.at(h/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 Je{constructor(e,t,n,r,s,a,o,l,c,h,p,f,m,x,M,d){Je.prototype.isMatrix4=!0,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,h,p,f,m,x,M,d)}set(e,t,n,r,s,a,o,l,c,h,p,f,m,x,M,d){const u=this.elements;return u[0]=e,u[4]=t,u[8]=n,u[12]=r,u[1]=s,u[5]=a,u[9]=o,u[13]=l,u[2]=c,u[6]=h,u[10]=p,u[14]=f,u[3]=m,u[7]=x,u[11]=M,u[15]=d,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 Je().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 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){const t=this.elements,n=e.elements,r=1/_n.setFromMatrixColumn(e,0).length(),s=1/_n.setFromMatrixColumn(e,1).length(),a=1/_n.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),h=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const f=a*h,m=a*p,x=o*h,M=o*p;t[0]=l*h,t[4]=-l*p,t[8]=c,t[1]=m+x*c,t[5]=f-M*c,t[9]=-o*l,t[2]=M-f*c,t[6]=x+m*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,m=l*p,x=c*h,M=c*p;t[0]=f+M*o,t[4]=x*o-m,t[8]=a*c,t[1]=a*p,t[5]=a*h,t[9]=-o,t[2]=m*o-x,t[6]=M+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,m=l*p,x=c*h,M=c*p;t[0]=f-M*o,t[4]=-a*p,t[8]=x+m*o,t[1]=m+x*o,t[5]=a*h,t[9]=M-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,m=a*p,x=o*h,M=o*p;t[0]=l*h,t[4]=x*c-m,t[8]=f*c+M,t[1]=l*p,t[5]=M*c+f,t[9]=m*c-x,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,m=a*c,x=o*l,M=o*c;t[0]=l*h,t[4]=M-f*p,t[8]=x*p+m,t[1]=p,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=m*p+x,t[10]=f-M*p}else if(e.order==="XZY"){const f=a*l,m=a*c,x=o*l,M=o*c;t[0]=l*h,t[4]=-p,t[8]=c*h,t[1]=f*p+M,t[5]=a*h,t[9]=m*p-x,t[2]=x*p-m,t[6]=o*h,t[10]=M*p+f}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(ks,e,Ws)}lookAt(e,t,n){const r=this.elements;return xt.subVectors(e,t),xt.lengthSq()===0&&(xt.z=1),xt.normalize(),qt.crossVectors(n,xt),qt.lengthSq()===0&&(Math.abs(n.z)===1?xt.x+=1e-4:xt.z+=1e-4,xt.normalize(),qt.crossVectors(n,xt)),qt.normalize(),Qn.crossVectors(xt,qt),r[0]=qt.x,r[4]=Qn.x,r[8]=xt.x,r[1]=qt.y,r[5]=Qn.y,r[9]=xt.y,r[2]=qt.z,r[6]=Qn.z,r[10]=xt.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],h=n[1],p=n[5],f=n[9],m=n[13],x=n[2],M=n[6],d=n[10],u=n[14],A=n[3],E=n[7],y=n[11],G=n[15],R=r[0],C=r[4],O=r[8],S=r[12],v=r[1],P=r[5],X=r[9],B=r[13],V=r[2],Z=r[6],H=r[10],j=r[14],z=r[3],ae=r[7],ue=r[11],me=r[15];return s[0]=a*R+o*v+l*V+c*z,s[4]=a*C+o*P+l*Z+c*ae,s[8]=a*O+o*X+l*H+c*ue,s[12]=a*S+o*B+l*j+c*me,s[1]=h*R+p*v+f*V+m*z,s[5]=h*C+p*P+f*Z+m*ae,s[9]=h*O+p*X+f*H+m*ue,s[13]=h*S+p*B+f*j+m*me,s[2]=x*R+M*v+d*V+u*z,s[6]=x*C+M*P+d*Z+u*ae,s[10]=x*O+M*X+d*H+u*ue,s[14]=x*S+M*B+d*j+u*me,s[3]=A*R+E*v+y*V+G*z,s[7]=A*C+E*P+y*Z+G*ae,s[11]=A*O+E*X+y*H+G*ue,s[15]=A*S+E*B+y*j+G*me,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],h=e[2],p=e[6],f=e[10],m=e[14],x=e[3],M=e[7],d=e[11],u=e[15];return x*(+s*l*p-r*c*p-s*o*f+n*c*f+r*o*m-n*l*m)+M*(+t*l*m-t*c*f+s*a*f-r*a*m+r*c*h-s*l*h)+d*(+t*c*p-t*o*m-s*a*p+n*a*m+s*o*h-n*c*h)+u*(-r*o*h-t*l*p+t*o*f+r*a*p-n*a*f+n*l*h)}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],h=e[8],p=e[9],f=e[10],m=e[11],x=e[12],M=e[13],d=e[14],u=e[15],A=p*d*c-M*f*c+M*l*m-o*d*m-p*l*u+o*f*u,E=x*f*c-h*d*c-x*l*m+a*d*m+h*l*u-a*f*u,y=h*M*c-x*p*c+x*o*m-a*M*m-h*o*u+a*p*u,G=x*p*l-h*M*l-x*o*f+a*M*f+h*o*d-a*p*d,R=t*A+n*E+r*y+s*G;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/R;return e[0]=A*C,e[1]=(M*f*s-p*d*s-M*r*m+n*d*m+p*r*u-n*f*u)*C,e[2]=(o*d*s-M*l*s+M*r*c-n*d*c-o*r*u+n*l*u)*C,e[3]=(p*l*s-o*f*s-p*r*c+n*f*c+o*r*m-n*l*m)*C,e[4]=E*C,e[5]=(h*d*s-x*f*s+x*r*m-t*d*m-h*r*u+t*f*u)*C,e[6]=(x*l*s-a*d*s-x*r*c+t*d*c+a*r*u-t*l*u)*C,e[7]=(a*f*s-h*l*s+h*r*c-t*f*c-a*r*m+t*l*m)*C,e[8]=y*C,e[9]=(x*p*s-h*M*s-x*n*m+t*M*m+h*n*u-t*p*u)*C,e[10]=(a*M*s-x*o*s+x*n*c-t*M*c-a*n*u+t*o*u)*C,e[11]=(h*o*s-a*p*s-h*n*c+t*p*c+a*n*m-t*o*m)*C,e[12]=G*C,e[13]=(h*M*r-x*p*r+x*n*f-t*M*f-h*n*d+t*p*d)*C,e[14]=(x*o*r-a*M*r-x*n*l+t*M*l+a*n*d-t*o*d)*C,e[15]=(a*p*r-h*o*r+h*n*l-t*p*l-a*n*f+t*o*f)*C,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,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*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,h=a+a,p=o+o,f=s*c,m=s*h,x=s*p,M=a*h,d=a*p,u=o*p,A=l*c,E=l*h,y=l*p,G=n.x,R=n.y,C=n.z;return r[0]=(1-(M+u))*G,r[1]=(m+y)*G,r[2]=(x-E)*G,r[3]=0,r[4]=(m-y)*R,r[5]=(1-(f+u))*R,r[6]=(d+A)*R,r[7]=0,r[8]=(x+E)*C,r[9]=(d-A)*C,r[10]=(1-(f+M))*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;let s=_n.set(r[0],r[1],r[2]).length();const a=_n.set(r[4],r[5],r[6]).length(),o=_n.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],At.copy(this);const c=1/s,h=1/a,p=1/o;return At.elements[0]*=c,At.elements[1]*=c,At.elements[2]*=c,At.elements[4]*=h,At.elements[5]*=h,At.elements[6]*=h,At.elements[8]*=p,At.elements[9]*=p,At.elements[10]*=p,t.setFromRotationMatrix(At),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=2e3){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),p=(t+e)/(t-e),f=(n+r)/(n-r);let m,x;if(o===2e3)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===2001)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=p,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=2e3){const l=this.elements,c=1/(t-e),h=1/(n-r),p=1/(a-s),f=(t+e)*c,m=(n+r)*h;let x,M;if(o===2e3)x=(a+s)*p,M=-2*p;else if(o===2001)x=s*p,M=-1*p;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=M,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[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 _n=new F,At=new Je,ks=new F(0,0,0),Ws=new F(1,1,1),qt=new F,Qn=new F,xt=new F,Sr=new Je,Er=new Vn;class It{constructor(e=0,t=0,n=0,r=It.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],h=r[9],p=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(mt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-mt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(mt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-p,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-mt(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(mt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-mt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Sr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Sr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Er.setFromEuler(this),this.setFromQuaternion(Er,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}}It.DEFAULT_ORDER="XYZ";class hs{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}
vendor: 9,663 bytes, line 5
5isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Xs=0;const Tr=new F,gn=new Vn,Bt=new Je,ei=new F,On=new F,qs=new F,Ys=new Vn,yr=new F(1,0,0),Ar=new F(0,1,0),br=new F(0,0,1),Rr={type:"added"},Ks={type:"removed"},vn={type:"childadded",child:null},Gi={type:"childremoved",child:null};class dt extends Ln{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xs++}),this.uuid=Hn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=dt.DEFAULT_UP.clone();const e=new F,t=new It,n=new Vn,r=new F(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 Je},normalMatrix:{value:new Le}}),this.matrix=new Je,this.matrixWorld=new Je,this.matrixAutoUpdate=dt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 gn.setFromAxisAngle(e,t),this.quaternion.multiply(gn),this}rotateOnWorldAxis(e,t){return gn.setFromAxisAngle(e,t),this.quaternion.premultiply(gn),this}rotateX(e){return this.rotateOnAxis(yr,e)}rotateY(e){return this.rotateOnAxis(Ar,e)}rotateZ(e){return this.rotateOnAxis(br,e)}translateOnAxis(e,t){return Tr.copy(e).applyQuaternion(this.quaternion),this.position.add(Tr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(yr,e)}translateY(e){return this.translateOnAxis(Ar,e)}translateZ(e){return this.translateOnAxis(br,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ei.copy(e):ei.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),On.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bt.lookAt(On,ei,this.up):Bt.lookAt(ei,On,this.up),this.quaternion.setFromRotationMatrix(Bt),r&&(Bt.extractRotation(r.matrixWorld),gn.setFromRotationMatrix(Bt),this.quaternion.premultiply(gn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.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(Rr),vn.child=e,this.dispatchEvent(vn),vn.child=null):console.error("THREE.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(Ks),Gi.child=e,this.dispatchEvent(Gi),Gi.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),Bt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rr),vn.child=e,this.dispatchEvent(vn),vn.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(On,e,qs),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(On,Ys,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),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){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}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.6,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),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.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));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,h=l.length;c<h;c++){const p=l[c];s(e.shapes,p)}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),h=a(e.images),p=a(e.shapes),f=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),h.length>0&&(n.images=h),p.length>
vendor: 10,190 bytes, line 5
50&&(n.shapes=p),f.length>0&&(n.skeletons=f),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 h=o[c];delete h.metadata,l.push(h)}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.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.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}}dt.DEFAULT_UP=new F(0,1,0);dt.DEFAULT_MATRIX_AUTO_UPDATE=!0;dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const bt=new F,Gt=new F,zi=new F,zt=new F,xn=new F,Mn=new F,Cr=new F,Hi=new F,Vi=new F,ki=new F;class Lt{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),bt.subVectors(e,t),r.cross(bt);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){bt.subVectors(r,t),Gt.subVectors(n,t),zi.subVectors(e,t);const a=bt.dot(bt),o=bt.dot(Gt),l=bt.dot(zi),c=Gt.dot(Gt),h=Gt.dot(zi),p=a*c-o*o;if(p===0)return s.set(0,0,0),null;const f=1/p,m=(c*l-o*h)*f,x=(a*h-o*l)*f;return s.set(1-m-x,x,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,zt)===null?!1:zt.x>=0&&zt.y>=0&&zt.x+zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,zt)===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,zt.x),l.addScaledVector(a,zt.y),l.addScaledVector(o,zt.z),l)}static isFrontFacing(e,t,n,r){return bt.subVectors(n,t),Gt.subVectors(e,t),bt.cross(Gt).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 bt.subVectors(this.c,this.b),Gt.subVectors(this.a,this.b),bt.cross(Gt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Lt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Lt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Lt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Lt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Lt.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;xn.subVectors(r,n),Mn.subVectors(s,n),Hi.subVectors(e,n);const l=xn.dot(Hi),c=Mn.dot(Hi);if(l<=0&&c<=0)return t.copy(n);Vi.subVectors(e,r);const h=xn.dot(Vi),p=Mn.dot(Vi);if(h>=0&&p<=h)return t.copy(r);const f=l*p-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(xn,a);ki.subVectors(e,s);const m=xn.dot(ki),x=Mn.dot(ki);if(x>=0&&m<=x)return t.copy(s);const M=m*c-l*x;if(M<=0&&c>=0&&x<=0)return o=c/(c-x),t.copy(n).addScaledVector(Mn,o);const d=h*x-m*p;if(d<=0&&p-h>=0&&m-x>=0)return Cr.subVectors(s,r),o=(p-h)/(p-h+(m-x)),t.copy(r).addScaledVector(Cr,o);const u=1/(d+M+f);return a=M*u,o=f*u,t.copy(n).addScaledVector(xn,a).addScaledVector(Mn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ds={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},Yt={h:0,s:0,l:0},ti={h:0,s:0,l:0};function Wi(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 Be{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=wt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ke.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,ke.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ke.workingColorSpace){if(e=Ds(e,1),t=mt(t,0,1),n=mt(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=Wi(a,s,e+1/3),this.g=Wi(a,s,e),this.b=Wi(a,s,e-1/3)}return ke.toWorkingColorSpace(this,r),this}setStyle(e,t=wt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.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:console.warn("THREE.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);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=wt){const n=ds[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.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=wn(e.r),this.g=wn(e.g),this.b=wn(e.b),this}copyLinearToSRGB(e){return this.r=Li(e.r),this.g=Li(e.g),this.b=Li(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wt){return ke.fromWorkingColorSpace(ht.copy(this),e),Math.round(mt(ht.r*255,0,255))*65536+Math.round(mt(ht.g*255,0,255))*256+Math.round(mt(ht.b*255,0,255))}getHexString(e=wt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ke.workingColorSpace){ke.fromWorkingColorSpace(ht.copy(this),t);const n=ht.r,r=ht.g,s=ht.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const p=a-o;switch(c=h<=.5?p/(a+o):p/(2-a-o),a){case n:l=(r-s)/p+(r<s?6:0);break;case r:l=(s-n)/p+2;break;case s:l=(n-r)/p+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=ke.workingColorSpace){return ke.fromWorkingColorSpace(ht.copy(this),t),e.r=ht.r,e.g=ht.g,e.b
vendor: 3,454 bytes, line 5
5=ht.b,e}getStyle(e=wt){ke.fromWorkingColorSpace(ht.copy(this),e);const t=ht.r,n=ht.g,r=ht.b;return e!==wt?`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(Yt),this.setHSL(Yt.h+e,Yt.s+t,Yt.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(Yt),e.getHSL(ti);const n=wi(Yt.h,ti.h,t),r=wi(Yt.s,ti.s,t),s=wi(Yt.l,ti.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 ht=new Be;Be.NAMES=ds;let $s=0;class Wn extends Ln{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:$s++}),this.uuid=Hn(),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 Be(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.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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):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.6,type:"Material",generator:"Material.toJSON"}};
vendor: 48,887 bytes, lines 5-103
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.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.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}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.clipShadows,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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class fs extends Wn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Be(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 It,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 it=new F,ni=new Ne;class Dt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return zn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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++)ni.fromBufferAttribute(this,t),ni.applyMatrix3(e),this.setXY(t,ni.x,ni.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)it.fromBufferAttribute(this,t),it.applyMatrix3(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)it.fromBufferAttribute(this,t),it.applyMatrix4(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)it.fromBufferAttribute(this,t),it.applyNormalMatrix(e),this.setXYZ(t,it.x,it.y,it.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)it.fromBufferAttribute(this,t),it.transformDirection(e),this.setXYZ(t,it.x,it.y,it.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=Un(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Un(t,this.array)),t}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Un(t,this.array)),t}setY(e,t){return this.normalized&&(t=pt(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=Un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=pt(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=Un(t,this.array)),t}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(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=pt(t,this.array),n=pt(n,this.array),r=pt(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=pt(t,this.array),n=pt(n,this.array),r=pt(r,this.array),s=pt(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}}class ps extends Dt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ms extends Dt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ut extends Dt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Zs=0;const Et=new Je,Xi=new dt,Sn=new F,Mt=new kn,Bn=new kn,ot=new F;class Jt extends Ln{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zs++}),this.uuid=Hn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ls(e)?ms:ps)(e,1):this.index=e,this}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 Le().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}applyQuaternion(e){return Et.makeRotationFromQuaternion(e),this.applyMatrix4(Et),this}rotateX(e){return Et.makeRotationX(e),this.applyMatrix4(Et),this}rotateY(e){return Et.makeRotationY(e),this.applyMatrix4(Et),this}rotateZ(e){return Et.makeRotationZ(e),this.applyMatrix4(Et),this}translate(e,t,n){return Et.makeTranslation(e,t,n),this.applyMatrix4(Et),this}scale(e,t,n){return Et.makeScale(e,t,n),this.applyMatrix4(Et),this}lookAt(e){return Xi.lookAt(e),Xi.updateMatrix(),this.applyMatrix4(Xi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Sn).negate(),this.translate(Sn.x,Sn.y,Sn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ut(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new kn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(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];Mt.setFromBufferAttribute(s),this.morphTargetsRelative?(ot.addVectors(this.boundingBox.min,Mt.min),this.boundingBox.expandByPoint(ot),ot.addVectors(this.boundingBox.max,Mt.max),this.boundingBox.expandByPoint(ot)):(this.boundingBox.expandByPoint(Mt.min),this.boundingBox.expandByPoint(Mt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 ar);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const n=this.boundingSphere.center;if(Mt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Bn.setFromBufferAttribute(o),this.morphTargetsRelative?(ot.addVectors(Mt.min,Bn.min),Mt.expandByPoint(ot),ot.addVectors(Mt.max,Bn.max),Mt.expandByPoint(ot)):(Mt.expandByPoint(Bn.min),Mt.expandByPoint(Bn.max))}Mt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ot.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ot));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ot.fromBufferAttribute(o,c),l&&(Sn.fromBufferAttribute(e,c),ot.add(Sn)),r=Math.max(r,n.distanceToSquared(ot))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.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){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Dt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let O=0;O<n.count;O++)o[O]=new F,l[O]=new F;const c=new F,h=new F,p=new F,f=new Ne,m=new Ne,x=new Ne,M=new F,d=new F;function u(O,S,v){c.fromBufferAttribute(n,O),h.fromBufferAttribute(n,S),p.fromBufferAttribute(n,v),f.fromBufferAttribute(s,O),m.fromBufferAttribute(s,S),x.fromBufferAttribute(s,v),h.sub(c),p.sub(c),m.sub(f),x.sub(f);const P=1/(m.x*x.y-x.x*m.y);!isFinite(P)||(M.copy(h).multiplyScalar(x.y).addScaledVector(p,-m.y).multiplyScalar(P),d.copy(p).multiplyScalar(m.x).addScaledVector(h,-x.x).multiplyScalar(P),o[O].add(M),o[S].add(M),o[v].add(M),l[O].add(d),l[S].add(d),l[v].add(d))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let O=0,S=A.length;O<S;++O){const v=A[O],P=v.start,X=v.count;for(let B=P,V=P+X;B<V;B+=3)u(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const E=new F,y=new F,G=new F,R=new F;function C(O){G.fromBufferAttribute(r,O),R.copy(G);const S=o[O];E.copy(S),E.sub(G.multiplyScalar(G.dot(S))).normalize(),y.crossVectors(R,S);const P=y.dot(l[O])<0?-1:1;a.setXYZW(O,E.x,E.y,E.z,P)}for(let O=0,S=A.length;O<S;++O){const v=A[O],P=v.start,X=v.count;for(let B=P,V=P+X;B<V;B+=3)C(e.getX(B+0)),C(e.getX(B+1)),C(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Dt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,m=n.count;f<m;f++)n.setXYZ(f,0,0,0);const r=new F,s=new F,a=new F,o=new F,l=new F,c=new F,h=new F,p=new F;if(e)for(let f=0,m=e.count;f<m;f+=3){const x=e.getX(f+0),M=e.getX(f+1),d=e.getX(f+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,M),a.fromBufferAttribute(t,d),h.subVectors(a,s),p.subVectors(r,s),h.cross(p),o.fromBufferAttribute(n,x),l.fromBufferAttribute(n,M),c.fromBufferAttribute(n,d),o.add(h),l.add(h),c.add(h),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(M,l.x,l.y,l.z),n.setXYZ(d,c.x,c.y,c.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),h.subVectors(a,s),p.subVectors(r,s),h.cross(p),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ot.fromBufferAttribute(e,t),ot.normalize(),e.setXYZ(t,ot.x,ot.y,ot.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,p=o.normalized,f=new c.constructor(l.length*h);let m=0,x=0;for(let M=0,d=l.length;M<d;M++){o.isInterleavedBufferAttribute?m=l[M]*o.data.stride+o.offset:m=l[M]*h;for(let u=0;u<h;u++)f[x++]=c[m++]}return new Dt(f,h,p)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Jt,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 h=0,p=c.length;h<p;h++){const f=c[h],m=e(f,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.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 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],h=[];for(let p=0,f=c.length;p<f;p++){const m=c[p];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,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={center:o.center.toArray(),radius:o.radius}),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(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],p=s[c];for(let f=0,m=p.length;f<m;f++)h.push(p[f].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const p=a[c];this.addGroup(p.start,p.count,p.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}dispose(){this.dispatchEvent({type:"dispose"})}}const wr=new Je,nn=new Vs,ii=new ar,Pr=new F,En=new F,Tn=new F,yn=new F,qi=new F,ri=new F,si=new Ne,ai=new Ne,oi=new Ne,Lr=new F,Dr=new F,Ur=new F,li=new F,ci=new F;class Ht extends dt{constructor(e=new Jt,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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){ri.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],p=s[l];h!==0&&(qi.fromBufferAttribute(p,e),a?ri.addScaledVector(qi,h):ri.addScaledVector(qi.sub(t),h))}t.add(ri)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ii.copy(n.boundingSphere),ii.applyMatrix4(s),nn.copy(e.ray).recast(e.near),!(ii.containsPoint(nn.origin)===!1&&(nn.intersectSphere(ii,Pr)===null||nn.origin.distanceToSquared(Pr)>(e.far-e.near)**2))&&(wr.copy(s).invert(),nn.copy(e.ray).applyMatrix4(wr),!(n.boundingBox!==null&&nn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,nn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,p=s.attributes.normal,f=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,M=f.length;x<M;x++){const d=f[x],u=a[d.materialIndex],A=Math.max(d.start,m.start),E=Math.min(o.count,Math.min(d.start+d.count,m.start+m.count));for(let y=A,G=E;y<G;y+=3){const R=o.getX(y),C=o.getX(y+1),O=o.getX(y+2);r=ui(this,u,e,n,c,h,p,R,C,O),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=d.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),M=Math.min(o.count,m.start+m.count);for(let d=x,u=M;d<u;d+=3){const A=o.getX(d),E=o.getX(d+1),y=o.getX(d+2);r=ui(this,a,e,n,c,h,p,A,E,y),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let x=0,M=f.length;x<M;x++){const d=f[x],u=a[d.materialIndex],A=Math.max(d.start,m.start),E=Math.min(l.count,Math.min(d.start+d.count,m.start+m.count));for(let y=A,G=E;y<G;y+=3){const R=y,C=y+1,O=y+2;r=ui(this,u,e,n,c,h,p,R,C,O),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=d.materialIndex,t.push(r))}}else{const x=Math.max(0,m.start),M=Math.min(l.count,m.start+m.count);for(let d=x,u=M;d<u;d+=3){const A=d,E=d+1,y=d+2;r=ui(this,a,e,n,c,h,p,A,E,y),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}}function js(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;ci.copy(o),ci.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(ci);return c<t.near||c>t.far?null:{distance:c,point:ci.clone(),object:i}}function ui(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,En),i.getVertexPosition(l,Tn),i.getVertexPosition(c,yn);const h=js(i,e,t,n,En,Tn,yn,li);if(h){r&&(si.fromBufferAttribute(r,o),ai.fromBufferAttribute(r,l),oi.fromBufferAttribute(r,c),h.uv=Lt.getInterpolation(li,En,Tn,yn,si,ai,oi,new Ne)),s&&(si.fromBufferAttribute(s,o),ai.fromBufferAttribute(s,l),oi.fromBufferAttribute(s,c),h.uv1=Lt.getInterpolation(li,En,Tn,yn,si,ai,oi,new Ne)),a&&(Lr.fromBufferAttribute(a,o),Dr.fromBufferAttribute(a,l),Ur.fromBufferAttribute(a,c),h.normal=Lt.getInterpolation(li,En,Tn,yn,Lr,Dr,Ur,new F),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new F,materialIndex:0};Lt.getNormal(En,Tn,yn,p.normal),h.face=p}return h}class Xn extends Jt{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=[],h=[],p=[];let f=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),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 Ut(c,3)),this.setAttribute("normal",new Ut(h,3)),this.setAttribute("uv",new Ut(p,2));function x(M,d,u,A,E,y,G,R,C,O,S){const v=y/C,P=G/O,X=y/2,B=G/2,V=R/2,Z=C+1,H=O+1;let j=0,z=0;const ae=new F;for(let ue=0;ue<H;ue++){const me=ue*P-B;for(let Ie=0;Ie<Z;Ie++){const Xe=Ie*v-X;ae[M]=Xe*A,ae[d]=me*E,ae[u]=V,c.push(ae.x,ae.y,ae.z),ae[M]=0,ae[d]=0,ae[u]=R>0?1:-1,h.push(ae.x,ae.y,ae.z),p.push(Ie/C),p.push(1-ue/O),j+=1}}for(let ue=0;ue<O;ue++)for(let me=0;me<C;me++){const Ie=f+me+Z*ue,Xe=f+me+Z*(ue+1),k=f+(me+1)+Z*(ue+1),J=f+(me+1)+Z*ue;l.push(Ie,Xe,J),l.push(Xe,k,J),z+=6}o.addGroup(m,z,S),m+=z,f+=j}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Pn(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function ft(i){const e={};for(let t=0;t<i.length;t++){const n=Pn(i[t]);for(const r in n)e[r]=n[r]}return e}function Js(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function _s(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ke.workingColorSpace}const Qs={clone:Pn,merge:ft};var ea=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,ta=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class Zt extends Wn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ea,this.fragmentShader=ta,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=Pn(e.uniforms),this.uniformsGroups=Js(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}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}}class gs extends dt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Je,this.projectionMatrix=new Je,this.projectionMatrixInverse=new Je,this.coordinateSystem=2e3}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Kt=new F,Ir=new Ne,Fr=new Ne;class Rt extends gs{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=nr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ci*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return nr*2*Math.atan(Math.tan(Ci*.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){Kt.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Kt.x,Kt.y).multiplyScalar(-e/Kt.z),Kt.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Kt.x,Kt.y).multiplyScalar(-e/Kt.z)}getViewSize(e,t){return this.getViewBounds(e,Ir,Fr),t.subVectors(Fr,Ir)}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(Ci*.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.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}}const An=-90,bn=1;class na extends dt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rt(An,bn,e,t);r.layers=this.layers,this.add(r);const s=new Rt(An,bn,e,t);s.layers=this.layers,this.add(s);const a=new Rt(An,bn,e,t);a.layers=this.layers,this.add(a);const o=new Rt(An,bn,e,t);o.layers=this.layers,this.add(o);const l=new Rt(An,bn,e,t);l.layers=this.layers,this.add(l);const c=new Rt(An,bn,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,h]=this.children,p=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(p,f,m),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class vs extends _t{constructor(e,t,n,r,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:301,super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ia extends un{constructor(e=1,t={}){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 vs(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:1006}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:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new Xn(5,5,5),s=new Zt({name:"CubemapFromEquirect",uniforms:Pn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;const a=new Ht(r,s),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=1006),new na(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const Yi=new F,ra=new F,sa=new Le;class on{constructor(e=new F(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}setFromCoplanarPoints(e,t,n){const r=Yi.subVectors(n,t).cross(ra.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){const n=e.delta(Yi),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}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||sa.getNormalMatrix(e),r=this.coplanarPoint(Yi).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 rn=new ar,hi=new F;class or{constructor(e=new on,t=new on,n=new on,r=new on,s=new on,a=new on){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){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],p=r[6],f=r[7],m=r[8],x=r[9],M=r[10],d=r[11],u=r[12],A=r[13],E=r[14],y=r[15];if(n[0].setComponents(l-s,f-c,d-m,y-u).normalize(),n[1].setComponents(l+s,f+c,d+m,y+u).normalize(),n[2].setComponents(l+a,f+h,d+x,y+A).normalize(),n[3].setComponents(l-a,f-h,d-x,y-A).normalize(),n[4].setComponents(l-o,f-p,d-M,y-E).normalize(),t===2e3)n[5].setComponents(l+o,f+p,d+M,y+E).normalize();else if(t===2001)n[5].setComponents(o,p,M,E).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(),rn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),rn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(rn)}intersectsSprite(e){return rn.center.set(0,0,0),rn.radius=.7071067811865476,rn.applyMatrix4(e.matrixWorld),this.intersectsSphere(rn)}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(hi.x=r.normal.x>0?e.max.x:e.min.x,hi.y=r.normal.y>0?e.max.y:e.min.y,hi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(hi)<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)}}function xs(){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&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function aa(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,p=c.byteLength,f=i.createBuffer();i.bindBuffer(l,f),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.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:f,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:p}}function n(o,l,c){const h=l.array,p=l._updateRange,f=l.updateRanges;if(i.bindBuffer(c,o),p.count===-1&&f.length===0&&i.bufferSubData(c,0,h),f.length!==0){for(let m=0,x=f.length;m<x;m++){const M=f[m];i.bufferSubData(c,M.start*h.BYTES_PER_ELEMENT,h,M.start,M.count)}l.clearUpdateRanges()}p.count!==-1&&(i.bufferSubData(c,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count),p.count=-1),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 h=e.get(o);(!h||h.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}}class Ei extends Jt{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,h=l+1,p=e/o,f=t/l,m=[],x=[],M=[],d=[];for(let u=0;u<h;u++){const A=u*f-a;for(let E=0;E<c;E++){const y=E*p-s;x.push(y,-A,0),M.push(0,0,1),d.push(E/o),d.push(1-u/l)}}for(let u=0;u<l;u++)for(let A=0;A<o;A++){const E=A+c*u,y=A+c*(u+1),G=A+1+c*(u+1),R=A+1+c*u;m.push(E,y,R),m.push(y,G,R)}this.setIndex(m),this.setAttribute("position",new Ut(x,3)),this.setAttribute("normal",new Ut(M,3)),this.setAttribute("uv",new Ut(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ei(e.width,e.height,e.widthSegments,e.heightSegments)}}var oa=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,la=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,ca=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,ua=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,ha=`#ifdef USE_ALPHATEST 86 #ifdef ALPHA_TO_COVERAGE 87 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 88 if ( diffuseColor.a == 0.0 ) discard; 89 #else 90 if ( diffuseColor.a < alphaTest ) discard; 91 #endif 92#endif`,da=`#ifdef USE_ALPHATEST 93 uniform float alphaTest; 94#endif`,fa=`#ifdef USE_AOMAP 95 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 96 reflectedLight.indirectDiffuse *= ambientOcclusion; 97 #if defined( USE_CLEARCOAT ) 98 clearcoatSpecularIndirect *= ambientOcclusion; 99 #endif 100 #if defined( USE_SHEEN ) 101 sheenSpecularIndirect *= ambientOcclusion; 102 #endif 103 #if defined( USE_ENVMAP ) && defined( STANDARD )
104 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 105 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 106 #endif 107#endif`,pa=`#ifdef USE_AOMAP 108 uniform sampler2D aoMap; 109 uniform float aoMapIntensity; 110#endif`,ma=`#ifdef USE_BATCHING 111 #if ! defined( GL_ANGLE_multi_draw ) 112 #define gl_DrawID _gl_DrawID 113 uniform int _gl_DrawID; 114 #endif 115 uniform highp sampler2D batchingTexture; 116 uniform highp usampler2D batchingIdTexture; 117 mat4 getBatchingMatrix( const in float i ) { 118 int size = textureSize( batchingTexture, 0 ).x; 119 int j = int( i ) * 4; 120 int x = j % size; 121 int y = j / size; 122 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 123 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 124 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 125 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 126 return mat4( v1, v2, v3, v4 ); 127 } 128 float getIndirectIndex( const in int i ) { 129 int size = textureSize( batchingIdTexture, 0 ).x; 130 int x = i % size; 131 int y = i / size; 132 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 133 } 134#endif 135#ifdef USE_BATCHING_COLOR 136 uniform sampler2D batchingColorTexture; 137 vec3 getBatchingColor( const in float i ) { 138 int size = textureSize( batchingColorTexture, 0 ).x; 139 int j = int( i ); 140 int x = j % size; 141 int y = j / size; 142 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 143 } 144#endif`,_a=`#ifdef USE_BATCHING 145 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 146#endif`,ga=`vec3 transformed = vec3( position ); 147#ifdef USE_ALPHAHASH 148 vPosition = vec3( position ); 149#endif`,va=`vec3 objectNormal = vec3( normal ); 150#ifdef USE_TANGENT 151 vec3 objectTangent = vec3( tangent.xyz ); 152#endif`,xa=`float G_BlinnPhong_Implicit( ) { 153 return 0.25; 154} 155float D_BlinnPhong( const in float shininess, const in float dotNH ) { 156 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 157} 158vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 159 vec3 halfDir = normalize( lightDir + viewDir ); 160 float dotNH = saturate( dot( normal, halfDir ) ); 161 float dotVH = saturate( dot( viewDir, halfDir ) ); 162 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 163 float G = G_BlinnPhong_Implicit( ); 164 float D = D_BlinnPhong( shininess, dotNH ); 165 return F * ( G * D ); 166} // validated`,Ma=`#ifdef USE_IRIDESCENCE 167 const mat3 XYZ_TO_REC709 = mat3( 168 3.2404542, -0.9692660, 0.0556434, 169 -1.5371385, 1.8760108, -0.2040259, 170 -0.4985314, 0.0415560, 1.0572252 171 ); 172 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 173 vec3 sqrtF0 = sqrt( fresnel0 ); 174 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 175 } 176 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 177 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 178 } 179 float IorToFresnel0( float transmittedIor, float incidentIor ) { 180 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 181 } 182 vec3 evalSensitivity( float OPD, vec3 shift ) { 183 float phase = 2.0 * PI * OPD * 1.0e-9; 184 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 185 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 186 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 187 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 188 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 ) ); 189 xyz /= 1.0685e-7; 190 vec3 rgb = XYZ_TO_REC709 * xyz; 191 return rgb; 192 } 193 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 194 vec3 I; 195 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 196 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 197 float cosTheta2Sq = 1.0 - sinTheta2Sq; 198 if ( cosTheta2Sq < 0.0 ) { 199 return vec3( 1.0 ); 200 } 201 float cosTheta2 = sqrt( cosTheta2Sq ); 202 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
203 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 204 float T121 = 1.0 - R12; 205 float phi12 = 0.0; 206 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 207 float phi21 = PI - phi12; 208 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 209 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 210 vec3 phi23 = vec3( 0.0 ); 211 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 212 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 213 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 214 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 215 vec3 phi = vec3( phi21 ) + phi23; 216 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 217 vec3 r123 = sqrt( R123 ); 218 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 219 vec3 C0 = R12 + Rs; 220 I = C0; 221 vec3 Cm = Rs - T121; 222 for ( int m = 1; m <= 2; ++ m ) { 223 Cm *= r123; 224 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 225 I += Cm * Sm; 226 } 227 return max( I, vec3( 0.0 ) ); 228 } 229#endif`,Sa=`#ifdef USE_BUMPMAP 230 uniform sampler2D bumpMap; 231 uniform float bumpScale; 232 vec2 dHdxy_fwd() { 233 vec2 dSTdx = dFdx( vBumpMapUv ); 234 vec2 dSTdy = dFdy( vBumpMapUv ); 235 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 236 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 237 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 238 return vec2( dBx, dBy ); 239 } 240 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 241 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 242 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 243 vec3 vN = surf_norm; 244 vec3 R1 = cross( vSigmaY, vN ); 245 vec3 R2 = cross( vN, vSigmaX ); 246 float fDet = dot( vSigmaX, R1 ) * faceDirection; 247 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 248 return normalize( abs( fDet ) * surf_norm - vGrad ); 249 } 250#endif`,Ea=`#if NUM_CLIPPING_PLANES > 0 251 vec4 plane; 252 #ifdef ALPHA_TO_COVERAGE 253 float distanceToPlane, distanceGradient; 254 float clipOpacity = 1.0; 255 #pragma unroll_loop_start 256 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 257 plane = clippingPlanes[ i ]; 258 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 259 distanceGradient = fwidth( distanceToPlane ) / 2.0; 260 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 261 if ( clipOpacity == 0.0 ) discard; 262 } 263 #pragma unroll_loop_end 264 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 265 float unionClipOpacity = 1.0; 266 #pragma unroll_loop_start 267 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 268 plane = clippingPlanes[ i ]; 269 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 270 distanceGradient = fwidth( distanceToPlane ) / 2.0; 271 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 272 } 273 #pragma unroll_loop_end 274 clipOpacity *= 1.0 - unionClipOpacity; 275 #endif 276 diffuseColor.a *= clipOpacity; 277 if ( diffuseColor.a == 0.0 ) discard; 278 #else 279 #pragma unroll_loop_start 280 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 281 plane = clippingPlanes[ i ]; 282 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 283 } 284 #pragma unroll_loop_end 285 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 286 bool clipped = true; 287 #pragma unroll_loop_start 288 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 289 plane = clippingPlanes[ i ]; 290 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 291 } 292 #pragma unroll_loop_end 293 if ( clipped ) discard; 294 #endif 295 #endif 296#endif`,Ta=`#if NUM_CLIPPING_PLANES > 0 297 varying vec3 vClipPosition; 298 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 299#endif`,ya=`#if NUM_CLIPPING_PLANES > 0 300 varying vec3 vClipPosition; 301#endif`,Aa=`#if NUM_CLIPPING_PLANES > 0 302 vClipPosition = - mvPosition.xyz; 303#endif`,ba=`#if defined( USE_COLOR_ALPHA ) 304 diffuseColor *= vColor; 305#elif defined( USE_COLOR ) 306 diffuseColor.rgb *= vColor; 307#endif`,Ra=`#if defined( USE_COLOR_ALPHA ) 308 varying vec4 vColor; 309#elif defined( USE_COLOR ) 310 varying vec3 vColor; 311#endif`,Ca=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 314 varying vec3 vColor; 315#endif`,wa=`#if defined( USE_COLOR_ALPHA ) 316 vColor = vec4( 1.0 ); 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 vColor = vec3( 1.0 ); 319#endif 320#ifdef USE_COLOR 321 vColor *= color; 322#endif 323#ifdef USE_INSTANCING_COLOR 324 vColor.xyz *= instanceColor.xyz; 325#endif 326#ifdef USE_BATCHING_COLOR 327 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 328 vColor.xyz *= batchingColor.xyz; 329#endif`,Pa=`#define PI 3.141592653589793 330#define PI2 6.283185307179586 331#define PI_HALF 1.5707963267948966 332#define RECIPROCAL_PI 0.3183098861837907 333#define RECIPROCAL_PI2 0.15915494309189535 334#define EPSILON 1e-6 335#ifndef saturate 336#define saturate( a ) clamp( a, 0.0, 1.0 ) 337#endif 338#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 339float pow2( const in float x ) { return x*x; } 340vec3 pow2( const in vec3 x ) { return x*x; } 341float pow3( const in float x ) { return x*x*x; } 342float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 343float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 344float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 345highp float rand( const in vec2 uv ) { 346 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 347 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 348 return fract( sin( sn ) * c ); 349} 350#ifdef HIGH_PRECISION 351 float precisionSafeLength( vec3 v ) { return length( v ); } 352#else 353 float precisionSafeLength( vec3 v ) { 354 float maxComponent = max3( abs( v ) ); 355 return length( v / maxComponent ) * maxComponent; 356 } 357#endif 358struct IncidentLight { 359 vec3 color; 360 vec3 direction; 361 bool visible; 362}; 363struct ReflectedLight { 364 vec3 directDiffuse; 365 vec3 directSpecular; 366 vec3 indirectDiffuse; 367 vec3 indirectSpecular; 368}; 369#ifdef USE_ALPHAHASH 370 varying vec3 vPosition; 371#endif 372vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 373 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 374} 375vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 376 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 377} 378mat3 transposeMat3( const in mat3 m ) { 379 mat3 tmp; 380 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 381 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 382 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 383 return tmp; 384} 385bool isPerspectiveMatrix( mat4 m ) { 386 return m[ 2 ][ 3 ] == - 1.0; 387} 388vec2 equirectUv( in vec3 dir ) { 389 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 390 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 391 return vec2( u, v ); 392}
393vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 394 return RECIPROCAL_PI * diffuseColor; 395} 396vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 397 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 398 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 399} 400float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} // validated`,La=`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt ); 444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_m0 - 2.0 462 #define cubeUV_r1 0.8 463 #define cubeUV_m1 - 1.0 464 #define cubeUV_r4 0.4 465 #define cubeUV_m4 2.0 466 #define cubeUV_r5 0.305 467 #define cubeUV_m5 3.0 468 #define cubeUV_r6 0.21 469 #define cubeUV_m6 4.0 470 float roughnessToMip( float roughness ) { 471 float mip = 0.0; 472 if ( roughness >= cubeUV_r1 ) { 473 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 474 } else if ( roughness >= cubeUV_r4 ) { 475 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 476 } else if ( roughness >= cubeUV_r5 ) { 477 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 478 } else if ( roughness >= cubeUV_r6 ) { 479 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 480 } else { 481 mip = - 2.0 * log2( 1.16 * roughness ); } 482 return mip; 483 } 484 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 485 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 486 float mipF = fract( mip ); 487 float mipInt = floor( mip ); 488 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 489 if ( mipF == 0.0 ) { 490 return vec4( color0, 1.0 ); 491 } else { 492 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 493 return vec4( mix( color0, color1, mipF ), 1.0 ); 494 } 495 } 496#endif`,Da=`vec3 transformedNormal = objectNormal; 497#ifdef USE_TANGENT 498 vec3 transformedTangent = objectTangent; 499#endif 500#ifdef USE_BATCHING 501 mat3 bm = mat3( batchingMatrix ); 502 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 503 transformedNormal = bm * transformedNormal; 504 #ifdef USE_TANGENT 505 transformedTangent = bm * transformedTangent; 506 #endif 507#endif 508#ifdef USE_INSTANCING 509 mat3 im = mat3( instanceMatrix ); 510 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 511 transformedNormal = im * transformedNormal; 512 #ifdef USE_TANGENT 513 transformedTangent = im * transformedTangent; 514 #endif 515#endif 516transformedNormal = normalMatrix * transformedNormal; 517#ifdef FLIP_SIDED 518 transformedNormal = - transformedNormal; 519#endif 520#ifdef USE_TANGENT 521 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 522 #ifdef FLIP_SIDED 523 transformedTangent = - transformedTangent; 524 #endif 525#endif`,Ua=`#ifdef USE_DISPLACEMENTMAP 526 uniform sampler2D displacementMap; 527 uniform float displacementScale; 528 uniform float displacementBias; 529#endif`,Ia=`#ifdef USE_DISPLACEMENTMAP 530 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
530placementBias ); 531#endif`,Fa=`#ifdef USE_EMISSIVEMAP 532 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 533 totalEmissiveRadiance *= emissiveColor.rgb; 534#endif`,Na=`#ifdef USE_EMISSIVEMAP 535 uniform sampler2D emissiveMap; 536#endif`,Oa="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ba=` 537const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 538 vec3( 0.8224621, 0.177538, 0.0 ), 539 vec3( 0.0331941, 0.9668058, 0.0 ), 540 vec3( 0.0170827, 0.0723974, 0.9105199 ) 541); 542const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 543 vec3( 1.2249401, - 0.2249404, 0.0 ), 544 vec3( - 0.0420569, 1.0420571, 0.0 ), 545 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 546); 547vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 548 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 549} 550vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 551 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 552} 553vec4 LinearTransferOETF( in vec4 value ) { 554 return value; 555} 556vec4 sRGBTransferOETF( in vec4 value ) { 557 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 ); 558}`,Ga=`#ifdef USE_ENVMAP 559 #ifdef ENV_WORLDPOS 560 vec3 cameraToFrag; 561 if ( isOrthographic ) { 562 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 563 } else { 564 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 565 } 566 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 567 #ifdef ENVMAP_MODE_REFLECTION 568 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 569 #else 570 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 571 #endif 572 #else 573 vec3 reflectVec = vReflect; 574 #endif 575 #ifdef ENVMAP_TYPE_CUBE 576 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 577 #else 578 vec4 envColor = vec4( 0.0 ); 579 #endif 580 #ifdef ENVMAP_BLENDING_MULTIPLY 581 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 582 #elif defined( ENVMAP_BLENDING_MIX ) 583 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 584 #elif defined( ENVMAP_BLENDING_ADD ) 585 outgoingLight += envColor.xyz * specularStrength * reflectivity; 586 #endif 587#endif`,za=`#ifdef USE_ENVMAP 588 uniform float envMapIntensity; 589 uniform float flipEnvMap; 590 uniform mat3 envMapRotation; 591 #ifdef ENVMAP_TYPE_CUBE 592 uniform samplerCube envMap; 593 #else 594 uniform sampler2D envMap; 595 #endif 596 597#endif`,Ha=`#ifdef USE_ENVMAP 598 uniform float reflectivity; 599 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 600 #define ENV_WORLDPOS 601 #endif 602 #ifdef ENV_WORLDPOS 603 varying vec3 vWorldPosition; 604 uniform float refractionRatio; 605 #else 606 varying vec3 vReflect; 607 #endif 608#endif`,Va=`#ifdef USE_ENVMAP 609 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 610 #define ENV_WORLDPOS 611 #endif 612 #ifdef ENV_WORLDPOS 613 614 varying vec3 vWorldPosition; 615 #else 616 varying vec3 vReflect; 617 uniform float refractionRatio; 618 #endif 619#endif`,ka=`#ifdef USE_ENVMAP 620 #ifdef ENV_WORLDPOS 621 vWorldPosition = worldPosition.xyz; 622 #else 623 vec3 cameraToVertex; 624 if ( isOrthographic ) { 625 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 626 } else {
627 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 628 } 629 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 630 #ifdef ENVMAP_MODE_REFLECTION 631 vReflect = reflect( cameraToVertex, worldNormal ); 632 #else 633 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 634 #endif 635 #endif 636#endif`,Wa=`#ifdef USE_FOG 637 vFogDepth = - mvPosition.z; 638#endif`,Xa=`#ifdef USE_FOG 639 varying float vFogDepth; 640#endif`,qa=`#ifdef USE_FOG 641 #ifdef FOG_EXP2 642 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 643 #else 644 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 645 #endif 646 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 647#endif`,Ya=`#ifdef USE_FOG 648 uniform vec3 fogColor; 649 varying float vFogDepth; 650 #ifdef FOG_EXP2 651 uniform float fogDensity; 652 #else 653 uniform float fogNear; 654 uniform float fogFar; 655 #endif 656#endif`,Ka=`#ifdef USE_GRADIENTMAP 657 uniform sampler2D gradientMap; 658#endif 659vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 660 float dotNL = dot( normal, lightDirection ); 661 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 662 #ifdef USE_GRADIENTMAP 663 return vec3( texture2D( gradientMap, coord ).r ); 664 #else 665 vec2 fw = fwidth( coord ) * 0.5; 666 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 667 #endif 668}`,$a=`#ifdef USE_LIGHTMAP 669 uniform sampler2D lightMap; 670 uniform float lightMapIntensity; 671#endif`,Za=`LambertMaterial material; 672material.diffuseColor = diffuseColor.rgb; 673material.specularStrength = specularStrength;`,ja=`varying vec3 vViewPosition; 674struct LambertMaterial { 675 vec3 diffuseColor; 676 float specularStrength; 677}; 678void 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 ) { 679 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 680 vec3 irradiance = dotNL * directLight.color; 681 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 682} 683void 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 ) { 684 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 685} 686#define RE_Direct RE_Direct_Lambert 687#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ja=`uniform bool receiveShadow; 688uniform vec3 ambientLightColor; 689#if defined( USE_LIGHT_PROBES ) 690 uniform vec3 lightProbe[ 9 ]; 691#endif 692vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 693 float x = normal.x, y = normal.y, z = normal.z; 694 vec3 result = shCoefficients[ 0 ] * 0.886227; 695 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 696 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 697 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 698 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 699 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 700 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 701 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 702 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 703 return result; 704} 705vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 706 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 707 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 708 return irradiance; 709} 710vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 711 vec3 irradiance = ambientLightColor; 712 return irradiance; 713} 714float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 715 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 716 if ( cutoffDistance > 0.0 ) { 717 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 718 } 719 return distanceFalloff; 720} 721float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 722 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 723} 724#if NUM_DIR_LIGHTS > 0 725 struct DirectionalLight { 726 vec3 direction; 727 vec3 color; 728 }; 729 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 730 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 731 light.color = directionalLight.color; 732 light.direction = directionalLight.direction; 733 light.visible = true; 734 } 735#endif 736#if NUM_POINT_LIGHTS > 0 737 struct PointLight { 738 vec3 position; 739 vec3 color; 740 float distance; 741 float decay; 742 }; 743 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 744 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 745 vec3 lVector = pointLight.position - geometryPosition; 746 light.direction = normalize( lVector ); 747 float lightDistance = length( lVector ); 748 light.color = pointLight.color; 749 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 750 light.visible = ( light.color != vec3( 0.0 ) ); 751 } 752#endif
753#if NUM_SPOT_LIGHTS > 0 754 struct SpotLight { 755 vec3 position; 756 vec3 direction; 757 vec3 color; 758 float distance; 759 float decay; 760 float coneCos; 761 float penumbraCos; 762 }; 763 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 764 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 765 vec3 lVector = spotLight.position - geometryPosition; 766 light.direction = normalize( lVector ); 767 float angleCos = dot( light.direction, spotLight.direction ); 768 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 769 if ( spotAttenuation > 0.0 ) { 770 float lightDistance = length( lVector ); 771 light.color = spotLight.color * spotAttenuation; 772 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 773 light.visible = ( light.color != vec3( 0.0 ) ); 774 } else { 775 light.color = vec3( 0.0 ); 776 light.visible = false; 777 } 778 } 779#endif 780#if NUM_RECT_AREA_LIGHTS > 0 781 struct RectAreaLight { 782 vec3 color; 783 vec3 position; 784 vec3 halfWidth; 785 vec3 halfHeight; 786 }; 787 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 788 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 789#endif 790#if NUM_HEMI_LIGHTS > 0 791 struct HemisphereLight { 792 vec3 direction; 793 vec3 skyColor; 794 vec3 groundColor; 795 }; 796 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 797 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 798 float dotNL = dot( normal, hemiLight.direction ); 799 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 800 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 801 return irradiance; 802 } 803#endif`,Qa=`#ifdef USE_ENVMAP 804 vec3 getIBLIrradiance( const in vec3 normal ) { 805 #ifdef ENVMAP_TYPE_CUBE_UV 806 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 807 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 808 return PI * envMapColor.rgb * envMapIntensity; 809 #else 810 return vec3( 0.0 ); 811 #endif 812 } 813 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 814 #ifdef ENVMAP_TYPE_CUBE_UV 815 vec3 reflectVec = reflect( - viewDir, normal ); 816 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 817 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 818 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 819 return envMapColor.rgb * envMapIntensity; 820 #else 821 return vec3( 0.0 ); 822 #endif 823 } 824 #ifdef USE_ANISOTROPY 825 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 826 #ifdef ENVMAP_TYPE_CUBE_UV 827 vec3 bentNormal = cross( bitangent, viewDir ); 828 bentNormal = normalize( cross( bentNormal, bitangent ) ); 829 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 830 return getIBLRadiance( viewDir, bentNormal, roughness ); 831 #else 832 return vec3( 0.0 ); 833 #endif 834 } 835 #endif 836#endif`,eo=`ToonMaterial material; 837material.diffuseColor = diffuseColor.rgb;`,to=`varying vec3 vViewPosition; 838struct ToonMaterial { 839 vec3 diffuseColor; 840}; 841void 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 ) { 842 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 843 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 844} 845void 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 ) { 846 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 847} 848#define RE_Direct RE_Direct_Toon 849#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,no=`BlinnPhongMaterial material; 850material.diffuseColor = diffuseColor.rgb; 851material.specularColor = specular; 852material.specularShininess = shininess; 853material.specularStrength = specularStrength;
853`,io=`varying vec3 vViewPosition; 854struct BlinnPhongMaterial { 855 vec3 diffuseColor; 856 vec3 specularColor; 857 float specularShininess; 858 float specularStrength; 859}; 860void 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 ) { 861 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 862 vec3 irradiance = dotNL * directLight.color; 863 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 864 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 865} 866void 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 ) { 867 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 868} 869#define RE_Direct RE_Direct_BlinnPhong 870#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ro=`PhysicalMaterial material; 871material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 872vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 873float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 874material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 875material.roughness = min( material.roughness, 1.0 ); 876#ifdef IOR 877 material.ior = ior; 878 #ifdef USE_SPECULAR 879 float specularIntensityFactor = specularIntensity; 880 vec3 specularColorFactor = specularColor; 881 #ifdef USE_SPECULAR_COLORMAP 882 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 883 #endif 884 #ifdef USE_SPECULAR_INTENSITYMAP 885 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 886 #endif 887 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 888 #else 889 float specularIntensityFactor = 1.0; 890 vec3 specularColorFactor = vec3( 1.0 ); 891 material.specularF90 = 1.0; 892 #endif 893 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 894#else 895 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 896 material.specularF90 = 1.0; 897#endif 898#ifdef USE_CLEARCOAT 899 material.clearcoat = clearcoat; 900 material.clearcoatRoughness = clearcoatRoughness; 901 material.clearcoatF0 = vec3( 0.04 ); 902 material.clearcoatF90 = 1.0; 903 #ifdef USE_CLEARCOATMAP 904 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 905 #endif 906 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 907 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 908 #endif 909 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 910 material.clearcoatRoughness += geometryRoughness; 911 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 912#endif 913#ifdef USE_DISPERSION 914 material.dispersion = dispersion; 915#endif 916#ifdef USE_IRIDESCENCE 917 material.iridescence = iridescence; 918 material.iridescenceIOR = iridescenceIOR; 919 #ifdef USE_IRIDESCENCEMAP 920 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 921 #endif 922 #ifdef USE_IRIDESCENCE_THICKNESSMAP 923 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 924 #else 925 material.iridescenceThickness = iridescenceThicknessMaximum; 926 #endif 927#endif 928#ifdef USE_SHEEN 929 material.sheenColor = sheenColor; 930 #ifdef USE_SHEEN_COLORMAP 931 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 932 #endif 933 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 934 #ifdef USE_SHEEN_ROUGHNESSMAP 935 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 936 #endif 937#endif 938#ifdef USE_ANISOTROPY 939 #ifdef USE_ANISOTROPYMAP 940 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 941 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 942 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 943 #else 944 vec2 anisotropyV = anisotropyVector; 945 #endif 946 material.anisotropy = length( anisotropyV ); 947 if( material.anisotropy == 0.0 ) { 948 anisotropyV = vec2( 1.0, 0.0 ); 949 } else { 950 anisotropyV /= material.anisotropy; 951 material.anisotropy = saturate( material.anisotropy ); 952 } 953 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
954 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 955 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 956#endif`,so
vendor: 14,687 bytes, lines 956-1257
956=`struct PhysicalMaterial { 957 vec3 diffuseColor; 958 float roughness; 959 vec3 specularColor; 960 float specularF90; 961 float dispersion; 962 #ifdef USE_CLEARCOAT 963 float clearcoat; 964 float clearcoatRoughness; 965 vec3 clearcoatF0; 966 float clearcoatF90; 967 #endif 968 #ifdef USE_IRIDESCENCE 969 float iridescence; 970 float iridescenceIOR; 971 float iridescenceThickness; 972 vec3 iridescenceFresnel; 973 vec3 iridescenceF0; 974 #endif 975 #ifdef USE_SHEEN 976 vec3 sheenColor; 977 float sheenRoughness; 978 #endif 979 #ifdef IOR 980 float ior; 981 #endif 982 #ifdef USE_TRANSMISSION 983 float transmission; 984 float transmissionAlpha; 985 float thickness; 986 float attenuationDistance; 987 vec3 attenuationColor; 988 #endif 989 #ifdef USE_ANISOTROPY 990 float anisotropy; 991 float alphaT; 992 vec3 anisotropyT; 993 vec3 anisotropyB; 994 #endif 995}; 996vec3 clearcoatSpecularDirect = vec3( 0.0 ); 997vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 998vec3 sheenSpecularDirect = vec3( 0.0 ); 999vec3 sheenSpecularIndirect = vec3(0.0 ); 1000vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1001 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1002 float x2 = x * x; 1003 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1004 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1005} 1006float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1007 float a2 = pow2( alpha ); 1008 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1009 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1010 return 0.5 / max( gv + gl, EPSILON ); 1011} 1012float D_GGX( const in float alpha, const in float dotNH ) { 1013 float a2 = pow2( alpha ); 1014 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1015 return RECIPROCAL_PI * a2 / pow2( denom ); 1016} 1017#ifdef USE_ANISOTROPY 1018 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 ) { 1019 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1020 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1021 float v = 0.5 / ( gv + gl ); 1022 return saturate(v); 1023 } 1024 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1025 float a2 = alphaT * alphaB; 1026 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1027 highp float v2 = dot( v, v ); 1028 float w2 = a2 / v2; 1029 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1030 } 1031#endif 1032#ifdef USE_CLEARCOAT 1033 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1034 vec3 f0 = material.clearcoatF0; 1035 float f90 = material.clearcoatF90; 1036 float roughness = material.clearcoatRoughness; 1037 float alpha = pow2( roughness ); 1038 vec3 halfDir = normalize( lightDir + viewDir ); 1039 float dotNL = saturate( dot( normal, lightDir ) ); 1040 float dotNV = saturate( dot( normal, viewDir ) ); 1041 float dotNH = saturate( dot( normal, halfDir ) ); 1042 float dotVH = saturate( dot( viewDir, halfDir ) ); 1043 vec3 F = F_Schlick( f0, f90, dotVH ); 1044 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1045 float D = D_GGX( alpha, dotNH ); 1046 return F * ( V * D ); 1047 } 1048#endif 1049vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1050 vec3 f0 = material.specularColor; 1051 float f90 = material.specularF90; 1052 float roughness = material.roughness; 1053 float alpha = pow2( roughness ); 1054 vec3 halfDir = normalize( lightDir + viewDir ); 1055 float dotNL = saturate( dot( normal, lightDir ) ); 1056 float dotNV = saturate( dot( normal, viewDir ) ); 1057 float dotNH = saturate( dot( normal, halfDir ) ); 1058 float dotVH = saturate( dot( viewDir, halfDir ) ); 1059 vec3 F = F_Schlick( f0, f90, dotVH ); 1060 #ifdef USE_IRIDESCENCE 1061 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1062 #endif 1063 #ifdef USE_ANISOTROPY 1064 float dotTL = dot( material.anisotropyT, lightDir ); 1065 float dotTV = dot( material.anisotropyT, viewDir ); 1066 float dotTH = dot( material.anisotropyT, halfDir ); 1067 float dotBL = dot( material.anisotropyB, lightDir ); 1068 float dotBV = dot( material.anisotropyB, viewDir ); 1069 float dotBH = dot( material.anisotropyB, halfDir ); 1070 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1071 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1072 #else 1073 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1074 float D = D_GGX( alpha, dotNH ); 1075 #endif 1076 return F * ( V * D ); 1077} 1078vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1079 const float LUT_SIZE = 64.0; 1080 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1081 const float LUT_BIAS = 0.5 / LUT_SIZE; 1082 float dotNV = saturate( dot( N, V ) ); 1083 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1084 uv = uv * LUT_SCALE + LUT_BIAS; 1085 return uv; 1086} 1087float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1088 float l = length( f ); 1089 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1090} 1091vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1092 float x = dot( v1, v2 ); 1093 float y = abs( x ); 1094 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1095 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1096 float v = a / b; 1097 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1098 return cross( v1, v2 ) * theta_sintheta; 1099} 1100vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1101 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1102 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1103 vec3 lightNormal = cross( v1, v2 ); 1104 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1105 vec3 T1, T2; 1106 T1 = normalize( V - N * dot( V, N ) ); 1107 T2 = - cross( N, T1 ); 1108 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1109 vec3 coords[ 4 ]; 1110 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1111 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1112 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1113 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1114 coords[ 0 ] = normalize( coords[ 0 ] ); 1115 coords[ 1 ] = normalize( coords[ 1 ] ); 1116 coords[ 2 ] = normalize( coords[ 2 ] ); 1117 coords[ 3 ] = normalize( coords[ 3 ] ); 1118 vec3 vectorFormFactor = vec3( 0.0 ); 1119 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1120 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1121 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1122 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1123 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1124 return vec3( result ); 1125} 1126#if defined( USE_SHEEN ) 1127float D_Charlie( float roughness, float dotNH ) { 1128 float alpha = pow2( roughness ); 1129 float invAlpha = 1.0 / alpha; 1130 float cos2h = dotNH * dotNH; 1131 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1132 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1133} 1134float V_Neubelt( float dotNV, float dotNL ) { 1135 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1136} 1137vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1138 vec3 halfDir = normalize( lightDir + viewDir ); 1139 float dotNL = saturate( dot( normal, lightDir ) ); 1140 float dotNV = saturate( dot( normal, viewDir ) ); 1141 float dotNH = saturate( dot( normal, halfDir ) ); 1142 float D = D_Charlie( sheenRoughness, dotNH ); 1143 float V = V_Neubelt( dotNV, dotNL ); 1144 return sheenColor * ( D * V ); 1145} 1146#endif 1147float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1148 float dotNV = saturate( dot( normal, viewDir ) ); 1149 float r2 = roughness * roughness; 1150 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1151 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1152 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1153 return saturate( DG * RECIPROCAL_PI ); 1154} 1155vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1156 float dotNV = saturate( dot( normal, viewDir ) ); 1157 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1158 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1159 vec4 r = roughness * c0 + c1; 1160 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1161 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1162 return fab; 1163} 1164vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1165 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1166 return specularColor * fab.x + specularF90 * fab.y; 1167} 1168#ifdef USE_IRIDESCENCE 1169void 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 ) { 1170#else 1171void 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 ) { 1172#endif 1173 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1174 #ifdef USE_IRIDESCENCE 1175 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1176 #else 1177 vec3 Fr = specularColor; 1178 #endif 1179 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1180 float Ess = fab.x + fab.y; 1181 float Ems = 1.0 - Ess; 1182 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1183 singleScatter += FssEss; 1184 multiScatter += Fms * Ems; 1185} 1186#if NUM_RECT_AREA_LIGHTS > 0 1187 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 ) { 1188 vec3 normal = geometryNormal; 1189 vec3 viewDir = geometryViewDir; 1190 vec3 position = geometryPosition; 1191 vec3 lightPos = rectAreaLight.position; 1192 vec3 halfWidth = rectAreaLight.halfWidth; 1193 vec3 halfHeight = rectAreaLight.halfHeight; 1194 vec3 lightColor = rectAreaLight.color; 1195 float roughness = material.roughness; 1196 vec3 rectCoords[ 4 ]; 1197 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1198 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1199 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1200 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1201 vec4 t1 = texture2D( ltc_1, uv ); 1202 vec4 t2 = texture2D( ltc_2, uv ); 1203 mat3 mInv = mat3( 1204 vec3( t1.x, 0, t1.y ), 1205 vec3( 0, 1, 0 ), 1206 vec3( t1.z, 0, t1.w ) 1207 ); 1208 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1209 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1210 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1211 } 1212#endif 1213void 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 ) { 1214 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1215 vec3 irradiance = dotNL * directLight.color; 1216 #ifdef USE_CLEARCOAT 1217 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1218 vec3 ccIrradiance = dotNLcc * directLight.color; 1219 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1220 #endif 1221 #ifdef USE_SHEEN 1222 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1223 #endif 1224 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1225 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1226} 1227void 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 ) { 1228 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1229} 1230void 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) { 1231 #ifdef USE_CLEARCOAT 1232 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1233 #endif 1234 #ifdef USE_SHEEN 1235 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1236 #endif 1237 vec3 singleScattering = vec3( 0.0 ); 1238 vec3 multiScattering = vec3( 0.0 ); 1239 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1240 #ifdef USE_IRIDESCENCE 1241 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1242 #else 1243 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1244 #endif 1245 vec3 totalScattering = singleScattering + multiScattering; 1246 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1247 reflectedLight.indirectSpecular += radiance * singleScattering; 1248 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1249 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1250} 1251#define RE_Direct RE_Direct_Physical 1252#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1253#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1254#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1255float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1256 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1257}`,
1257ao=` 1258vec3 geometryPosition = - vViewPosition; 1259vec3 geometryNormal = normal; 1260vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1261vec3 geometryClearcoatNormal = vec3( 0.0 ); 1262#ifdef USE_CLEARCOAT 1263 geometryClearcoatNormal = clearcoatNormal; 1264#endif 1265#ifdef USE_IRIDESCENCE 1266 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1267 if ( material.iridescenceThickness == 0.0 ) { 1268 material.iridescence = 0.0; 1269 } else { 1270 material.iridescence = saturate( material.iridescence ); 1271 } 1272 if ( material.iridescence > 0.0 ) { 1273 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1274 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1275 } 1276#endif 1277IncidentLight directLight; 1278#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1279 PointLight pointLight; 1280 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1281 PointLightShadow pointLightShadow; 1282 #endif 1283 #pragma unroll_loop_start 1284 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1285 pointLight = pointLights[ i ]; 1286 getPointLightInfo( pointLight, geometryPosition, directLight ); 1287 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1288 pointLightShadow = pointLightShadows[ i ]; 1289 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1290 #endif 1291 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1292 } 1293 #pragma unroll_loop_end 1294#endif 1295#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1296 SpotLight spotLight; 1297 vec4 spotColor; 1298 vec3 spotLightCoord; 1299 bool inSpotLightMap; 1300 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1301 SpotLightShadow spotLightShadow; 1302 #endif 1303 #pragma unroll_loop_start 1304 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1305 spotLight = spotLights[ i ]; 1306 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1307 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1308 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1309 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1310 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1311 #else 1312 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1313 #endif 1314 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1315 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1316 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1317 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1318 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1319 #endif 1320 #undef SPOT_LIGHT_MAP_INDEX 1321 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1322 spotLightShadow = spotLightShadows[ i ]; 1323 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1324 #endif 1325 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1326 } 1327 #pragma unroll_loop_end 1328#endif 1329#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1330 DirectionalLight directionalLight; 1331 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1332 DirectionalLightShadow directionalLightShadow; 1333 #endif 1334 #pragma unroll_loop_start 1335 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1336 directionalLight = directionalLights[ i ]; 1337 getDirectionalLightInfo( directionalLight, directLight ); 1338 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1339 directionalLightShadow = directionalLightShadows[ i ]; 1340 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1341 #endif 1342 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1343 } 1344 #pragma unroll_loop_end 1345#endif 1346#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1347 RectAreaLight rectAreaLight; 1348 #pragma unroll_loop_start 1349 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1350 rectAreaLight = rectAreaLights[ i ]; 1351 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1352 } 1353 #pragma unroll_loop_end 1354#endif 1355#if defined( RE_IndirectDiffuse ) 1356 vec3 iblIrradiance = vec3( 0.0 ); 1357 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1358 #if defined( USE_LIGHT_PROBES ) 1359 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1360 #endif 1361 #if ( NUM_HEMI_LIGHTS > 0 ) 1362 #pragma unroll_loop_start 1363 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1364 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1365 } 1366 #pragma unroll_loop_end 1367 #endif 1368#endif 1369#if defined( RE_IndirectSpecular ) 1370 vec3 radiance = vec3( 0.0 ); 1371 vec3 clearcoatRadiance = vec3( 0.0 ); 1372#endif`,oo=`#if defined( RE_IndirectDiffuse ) 1373 #ifdef USE_LIGHTMAP 1374 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1375 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1376 irradiance += lightMapIrradiance; 1377 #endif 1378 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1379 iblIrradiance += getIBLIrradiance( geometryNormal ); 1380 #endif 1381#endif 1382#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1383 #ifdef USE_ANISOTROPY 1384 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1385 #else 1386 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1387 #endif 1388 #ifdef USE_CLEARCOAT 1389 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1390 #endif 1391#endif`,lo=`#if defined( RE_IndirectDiffuse ) 1392 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1393#endif 1394#if defined( RE_IndirectSpecular ) 1395 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1396#endif`,co=`#if defined( USE_LOGDEPTHBUF ) 1397 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1398#endif`,uo=`#if defined( USE_LOGDEPTHBUF ) 1399 uniform float logDepthBufFC; 1400 varying float vFragDepth; 1401 varying float vIsPerspective; 1402#endif`,ho=`#ifdef USE_LOGDEPTHBUF 1403 varying float vFragDepth; 1404 varying float vIsPerspective; 1405#endif`,fo=`#ifdef USE_LOGDEPTHBUF 1406 vFragDepth = 1.0 + gl_Position.w; 1407 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1408#endif`,po=`#ifdef USE_MAP 1409 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1410 #ifdef DECODE_VIDEO_TEXTURE 1411 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1412 1413 #endif 1414 diffuseColor *= sampledDiffuseColor; 1415#endif`,mo=`#ifdef USE_MAP 1416 uniform sampler2D map; 1417#endif`,_o=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1418 #if defined( USE_POINTS_UV ) 1419 vec2 uv = vUv; 1420 #else 1421 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1422 #endif 1423#endif 1424#ifdef USE_MAP 1425 diffuseColor *= texture2D( map, uv ); 1426#endif 1427#ifdef USE_ALPHAMAP 1428 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1429#endif`,go=`#if defined( USE_POINTS_UV ) 1430 varying vec2 vUv; 1431#else 1432 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1433 uniform mat3 uvTransform; 1434 #endif 1435#endif 1436#ifdef USE_MAP 1437 uniform sampler2D map; 1438#endif 1439#ifdef USE_ALPHAMAP 1440 uniform sampler2D alphaMap; 1441#endif`,vo=`float metalnessFactor = metalness; 1442#ifdef USE_METALNESSMAP 1443 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1444 metalnessFactor *= texelMetalness.b; 1445#endif`,xo=`#ifdef USE_METALNESSMAP 1446 uniform sampler2D metalnessMap; 1447#endif`,Mo=`#ifdef USE_INSTANCING_MORPH 1448 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1449 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1450 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1451 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1452 } 1453#endif`,So=`#if defined( USE_MORPHCOLORS ) 1454 vColor *= morphTargetBaseInfluence; 1455 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1456 #if defined( USE_COLOR_ALPHA ) 1457 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1458 #elif defined( USE_COLOR ) 1459 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1460 #endif 1461 } 1462#endif`,Eo=`#ifdef USE_MORPHNORMALS 1463 objectNormal *= morphTargetBaseInfluence; 1464 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1465 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1466 } 1467#endif`,To=`#ifdef USE_MORPHTARGETS 1468 #ifndef USE_INSTANCING_MORPH 1469 uniform float morphTargetBaseInfluence; 1470 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1471 #endif 1472 uniform sampler2DArray morphTargetsTexture; 1473 uniform ivec2 morphTargetsTextureSize; 1474 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1475 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1476 int y = texelIndex / morphTargetsTextureSize.x; 1477 int x = texelIndex - y * morphTargetsTextureSize.x; 1478 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1479 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1480 } 1481#endif`,yo=`#ifdef USE_MORPHTARGETS 1482 transformed *= morphTargetBaseInfluence; 1483 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1484 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1485 } 1486#endif`,Ao=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1487#ifdef FLAT_SHADED 1488 vec3 fdx = dFdx( vViewPosition ); 1489 vec3 fdy = dFdy( vViewPosition ); 1490 vec3 normal = normalize( cross( fdx, fdy ) ); 1491#else 1492 vec3 normal = normalize( vNormal ); 1493 #ifdef DOUBLE_SIDED 1494 normal *= faceDirection; 1495 #endif 1496#endif 1497#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1498 #ifdef USE_TANGENT 1499 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1500 #else 1501 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1502 #if defined( USE_NORMALMAP ) 1503 vNormalMapUv 1504 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1505 vClearcoatNormalMapUv 1506 #else 1507 vUv 1508 #endif 1509 ); 1510 #endif 1511 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1512 tbn[0] *= faceDirection; 1513 tbn[1] *= faceDirection; 1514 #endif 1515#endif 1516#ifdef USE_CLEARCOAT_NORMALMAP 1517 #ifdef USE_TANGENT 1518 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1519 #else 1520 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1521 #endif 1522 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1523 tbn2[0] *= faceDirection; 1524 tbn2[1] *= faceDirection; 1525 #endif 1526#endif 1527vec3 nonPerturbedNormal = normal;`,bo=`#ifdef USE_NORMALMAP_OBJECTSPACE 1528 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1529 #ifdef FLIP_SIDED 1530 normal = - normal; 1531 #endif 1532 #ifdef DOUBLE_SIDED 1533 normal = normal * faceDirection; 1534 #endif 1535 normal = normalize( normalMatrix * normal ); 1536#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1537 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1538 mapN.xy *= normalScale; 1539 normal = normalize( tbn * mapN ); 1540#elif defined( USE_BUMPMAP )
1541 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1542#endif`,Ro=`#ifndef FLAT_SHADED 1543 varying vec3 vNormal; 1544 #ifdef USE_TANGENT 1545 varying vec3 vTangent; 1546 varying vec3 vBitangent; 1547 #endif 1548#endif`,Co=`#ifndef FLAT_SHADED 1549 varying vec3 vNormal; 1550 #ifdef USE_TANGENT 1551 varying vec3 vTangent; 1552 varying vec3 vBitangent; 1553 #endif 1554#endif`,wo=`#ifndef FLAT_SHADED 1555 vNormal = normalize( transformedNormal ); 1556 #ifdef USE_TANGENT 1557 vTangent = normalize( transformedTangent ); 1558 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1559 #endif 1560#endif`,Po=`#ifdef USE_NORMALMAP 1561 uniform sampler2D normalMap; 1562 uniform vec2 normalScale; 1563#endif 1564#ifdef USE_NORMALMAP_OBJECTSPACE 1565 uniform mat3 normalMatrix; 1566#endif 1567#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1568 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1569 vec3 q0 = dFdx( eye_pos.xyz ); 1570 vec3 q1 = dFdy( eye_pos.xyz ); 1571 vec2 st0 = dFdx( uv.st ); 1572 vec2 st1 = dFdy( uv.st ); 1573 vec3 N = surf_norm; 1574 vec3 q1perp = cross( q1, N ); 1575 vec3 q0perp = cross( N, q0 ); 1576 vec3 T = q1perp * st0.x + q0perp * st1.x; 1577 vec3 B = q1perp * st0.y + q0perp * st1.y; 1578 float det = max( dot( T, T ), dot( B, B ) ); 1579 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1580 return mat3( T * scale, B * scale, N ); 1581 } 1582#endif`,Lo=`#ifdef USE_CLEARCOAT 1583 vec3 clearcoatNormal = nonPerturbedNormal; 1584#endif`,Do=`#ifdef USE_CLEARCOAT_NORMALMAP 1585 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1586 clearcoatMapN.xy *= clearcoatNormalScale; 1587 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1588#endif`,Uo=`#ifdef USE_CLEARCOATMAP 1589 uniform sampler2D clearcoatMap; 1590#endif 1591#ifdef USE_CLEARCOAT_NORMALMAP 1592 uniform sampler2D clearcoatNormalMap; 1593 uniform vec2 clearcoatNormalScale; 1594#endif 1595#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1596 uniform sampler2D clearcoatRoughnessMap; 1597#endif`,Io=`#ifdef USE_IRIDESCENCEMAP 1598 uniform sampler2D iridescenceMap; 1599#endif 1600#ifdef USE_IRIDESCENCE_THICKNESSMAP 1601 uniform sampler2D iridescenceThicknessMap; 1602#endif`,Fo=`#ifdef OPAQUE 1603diffuseColor.a = 1.0; 1604#endif 1605#ifdef USE_TRANSMISSION 1606diffuseColor.a *= material.transmissionAlpha; 1607#endif 1608gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,No=`vec3 packNormalToRGB( const in vec3 normal ) { 1609 return normalize( normal ) * 0.5 + 0.5; 1610} 1611vec3 unpackRGBToNormal( const in vec3 rgb ) { 1612 return 2.0 * rgb.xyz - 1.0; 1613} 1614const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1615const float Inv255 = 1. / 255.; 1616const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1617const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1618const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1619const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1620vec4 packDepthToRGBA( const in float v ) { 1621 if( v <= 0.0 ) 1622 return vec4( 0., 0., 0., 0. ); 1623 if( v >= 1.0 ) 1624 return vec4( 1., 1., 1., 1. ); 1625 float vuf; 1626 float af = modf( v * PackFactors.a, vuf ); 1627 float bf = modf( vuf * ShiftRight8, vuf ); 1628 float gf = modf( vuf * ShiftRight8, vuf ); 1629 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1630} 1631vec3 packDepthToRGB( const in float v ) { 1632 if( v <= 0.0 ) 1633 return vec3( 0., 0., 0. ); 1634 if( v >= 1.0 ) 1635 return vec3( 1., 1., 1. ); 1636 float vuf; 1637 float bf = modf( v * PackFactors.b, vuf ); 1638 float gf = modf( vuf * ShiftRight8, vuf ); 1639 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1640} 1641vec2 packDepthToRG( const in float v ) { 1642 if( v <= 0.0 ) 1643 return vec2( 0., 0. ); 1644 if( v >= 1.0 ) 1645 return vec2( 1., 1. ); 1646 float vuf; 1647 float gf = modf( v * 256., vuf ); 1648 return vec2( vuf * Inv255, gf ); 1649} 1650float unpackRGBAToDepth( const in vec4 v ) { 1651 return dot( v, UnpackFactors4 ); 1652} 1653float unpackRGBToDepth( const in vec3 v ) { 1654 return dot( v, UnpackFactors3 ); 1655} 1656float unpackRGToDepth( const in vec2 v ) { 1657 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1658} 1659vec4 pack2HalfToRGBA( const in vec2 v ) {
1660 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1661 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1662} 1663vec2 unpackRGBATo2Half( const in vec4 v ) { 1664 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1665} 1666float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1667 return ( viewZ + near ) / ( near - far ); 1668} 1669float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1670 return depth * ( near - far ) - near; 1671} 1672float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1673 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1674} 1675float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1676 return ( near * far ) / ( ( far - near ) * depth - far ); 1677}`,Oo=`#ifdef PREMULTIPLIED_ALPHA 1678 gl_FragColor.rgb *= gl_FragColor.a; 1679#endif`,Bo=`vec4 mvPosition = vec4( transformed, 1.0 ); 1680#ifdef USE_BATCHING 1681 mvPosition = batchingMatrix * mvPosition; 1682#endif 1683#ifdef USE_INSTANCING 1684 mvPosition = instanceMatrix * mvPosition; 1685#endif 1686mvPosition = modelViewMatrix * mvPosition; 1687gl_Position = projectionMatrix * mvPosition;`,Go=`#ifdef DITHERING 1688 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1689#endif`,zo=`#ifdef DITHERING 1690 vec3 dithering( vec3 color ) { 1691 float grid_position = rand( gl_FragCoord.xy ); 1692 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1693 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1694 return color + dither_shift_RGB; 1695 } 1696#endif`,Ho=`float roughnessFactor = roughness; 1697#ifdef USE_ROUGHNESSMAP 1698 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1699 roughnessFactor *= texelRoughness.g; 1700#endif`,Vo=`#ifdef USE_ROUGHNESSMAP 1701 uniform sampler2D roughnessMap; 1702#endif`,ko=
vendor: 8,887 bytes, lines 1702-1888
1702`#if NUM_SPOT_LIGHT_COORDS > 0 1703 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1704#endif 1705#if NUM_SPOT_LIGHT_MAPS > 0 1706 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1707#endif 1708#ifdef USE_SHADOWMAP 1709 #if NUM_DIR_LIGHT_SHADOWS > 0 1710 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1711 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1712 struct DirectionalLightShadow { 1713 float shadowIntensity; 1714 float shadowBias; 1715 float shadowNormalBias; 1716 float shadowRadius; 1717 vec2 shadowMapSize; 1718 }; 1719 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1720 #endif 1721 #if NUM_SPOT_LIGHT_SHADOWS > 0 1722 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 struct SpotLightShadow { 1724 float shadowIntensity; 1725 float shadowBias; 1726 float shadowNormalBias; 1727 float shadowRadius; 1728 vec2 shadowMapSize; 1729 }; 1730 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1731 #endif 1732 #if NUM_POINT_LIGHT_SHADOWS > 0 1733 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1734 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1735 struct PointLightShadow { 1736 float shadowIntensity; 1737 float shadowBias; 1738 float shadowNormalBias; 1739 float shadowRadius; 1740 vec2 shadowMapSize; 1741 float shadowCameraNear; 1742 float shadowCameraFar; 1743 }; 1744 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1745 #endif 1746 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1747 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1748 } 1749 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1750 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1751 } 1752 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1753 float occlusion = 1.0; 1754 vec2 distribution = texture2DDistribution( shadow, uv ); 1755 float hard_shadow = step( compare , distribution.x ); 1756 if (hard_shadow != 1.0 ) { 1757 float distance = compare - distribution.x ; 1758 float variance = max( 0.00000, distribution.y * distribution.y ); 1759 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1760 } 1761 return occlusion; 1762 } 1763 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1764 float shadow = 1.0; 1765 shadowCoord.xyz /= shadowCoord.w; 1766 shadowCoord.z += shadowBias; 1767 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1768 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1769 if ( frustumTest ) { 1770 #if defined( SHADOWMAP_TYPE_PCF ) 1771 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1772 float dx0 = - texelSize.x * shadowRadius; 1773 float dy0 = - texelSize.y * shadowRadius; 1774 float dx1 = + texelSize.x * shadowRadius; 1775 float dy1 = + texelSize.y * shadowRadius; 1776 float dx2 = dx0 / 2.0; 1777 float dy2 = dy0 / 2.0; 1778 float dx3 = dx1 / 2.0; 1779 float dy3 = dy1 / 2.0; 1780 shadow = ( 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1791 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1792 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1793 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1794 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1795 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1796 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1798 ) * ( 1.0 / 17.0 ); 1799 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1800 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1801 float dx = texelSize.x; 1802 float dy = texelSize.y; 1803 vec2 uv = shadowCoord.xy; 1804 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1805 uv -= f * texelSize; 1806 shadow = ( 1807 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1808 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1809 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1810 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1811 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1812 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1813 f.x ) + 1814 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1815 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1816 f.x ) + 1817 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1818 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1819 f.y ) + 1820 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1821 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1822 f.y ) + 1823 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1824 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1825 f.x ), 1826 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1827 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1828 f.x ), 1829 f.y ) 1830 ) * ( 1.0 / 9.0 ); 1831 #elif defined( SHADOWMAP_TYPE_VSM ) 1832 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1833 #else 1834 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1835 #endif 1836 } 1837 return mix( 1.0, shadow, shadowIntensity ); 1838 } 1839 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1840 vec3 absV = abs( v ); 1841 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1842 absV *= scaleToCube; 1843 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1844 vec2 planar = v.xy; 1845 float almostATexel = 1.5 * texelSizeY; 1846 float almostOne = 1.0 - almostATexel; 1847 if ( absV.z >= almostOne ) { 1848 if ( v.z > 0.0 ) 1849 planar.x = 4.0 - v.x; 1850 } else if ( absV.x >= almostOne ) { 1851 float signX = sign( v.x ); 1852 planar.x = v.z * signX + 2.0 * signX; 1853 } else if ( absV.y >= almostOne ) { 1854 float signY = sign( v.y ); 1855 planar.x = v.x + 2.0 * signY + 2.0; 1856 planar.y = v.z * signY - 2.0; 1857 } 1858 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1859 } 1860 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1861 float shadow = 1.0; 1862 vec3 lightToPosition = shadowCoord.xyz; 1863 1864 float lightToPositionLength = length( lightToPosition ); 1865 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1866 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1867 vec3 bd3D = normalize( lightToPosition ); 1868 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1869 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1870 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1871 shadow = ( 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1874 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1875 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1876 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1877 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1878 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1879 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1880 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1881 ) * ( 1.0 / 9.0 ); 1882 #else 1883 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1884 #endif 1885 } 1886 return mix( 1.0, shadow, shadowIntensity ); 1887 } 1888#endif`,
1888Wo=`#if NUM_SPOT_LIGHT_COORDS > 0 1889 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1890 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1891#endif 1892#ifdef USE_SHADOWMAP 1893 #if NUM_DIR_LIGHT_SHADOWS > 0 1894 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1895 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1896 struct DirectionalLightShadow { 1897 float shadowIntensity; 1898 float shadowBias; 1899 float shadowNormalBias; 1900 float shadowRadius; 1901 vec2 shadowMapSize; 1902 }; 1903 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1904 #endif 1905 #if NUM_SPOT_LIGHT_SHADOWS > 0 1906 struct SpotLightShadow { 1907 float shadowIntensity; 1908 float shadowBias; 1909 float shadowNormalBias; 1910 float shadowRadius; 1911 vec2 shadowMapSize; 1912 }; 1913 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1914 #endif 1915 #if NUM_POINT_LIGHT_SHADOWS > 0 1916 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1917 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1918 struct PointLightShadow { 1919 float shadowIntensity; 1920 float shadowBias; 1921 float shadowNormalBias; 1922 float shadowRadius; 1923 vec2 shadowMapSize; 1924 float shadowCameraNear; 1925 float shadowCameraFar; 1926 }; 1927 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1928 #endif 1929#endif`,Xo=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1930 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1931 vec4 shadowWorldPosition; 1932#endif 1933#if defined( USE_SHADOWMAP ) 1934 #if NUM_DIR_LIGHT_SHADOWS > 0 1935 #pragma unroll_loop_start 1936 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1937 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1938 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1939 } 1940 #pragma unroll_loop_end 1941 #endif 1942 #if NUM_POINT_LIGHT_SHADOWS > 0 1943 #pragma unroll_loop_start 1944 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1945 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1946 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1947 } 1948 #pragma unroll_loop_end 1949 #endif 1950#endif 1951#if NUM_SPOT_LIGHT_COORDS > 0 1952 #pragma unroll_loop_start 1953 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1954 shadowWorldPosition = worldPosition; 1955 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1956 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1957 #endif 1958 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1959 } 1960 #pragma unroll_loop_end 1961#endif`,qo=`float getShadowMask() { 1962 float shadow = 1.0; 1963 #ifdef USE_SHADOWMAP 1964 #if NUM_DIR_LIGHT_SHADOWS > 0 1965 DirectionalLightShadow directionalLight; 1966 #pragma unroll_loop_start 1967 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1968 directionalLight = directionalLightShadows[ i ]; 1969 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1970 } 1971 #pragma unroll_loop_end 1972 #endif 1973 #if NUM_SPOT_LIGHT_SHADOWS > 0 1974 SpotLightShadow spotLight; 1975 #pragma unroll_loop_start 1976 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1977 spotLight = spotLightShadows[ i ]; 1978 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1979 } 1980 #pragma unroll_loop_end 1981 #endif 1982 #if NUM_POINT_LIGHT_SHADOWS > 0 1983 PointLightShadow pointLight; 1984 #pragma unroll_loop_start 1985 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1986 pointLight = pointLightShadows[ i ]; 1987 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1988 } 1989 #pragma unroll_loop_end 1990 #endif 1991 #endif 1992 return shadow; 1993}`,Yo=`#ifdef USE_SKINNING 1994 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1995 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1996 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1997 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1998#endif`,Ko=`#ifdef USE_SKINNING 1999 uniform mat4 bindMatrix; 2000 uniform mat4 bindMatrixInverse; 2001 uniform highp sampler2D boneTexture; 2002 mat4 getBoneMatrix( const in float i ) { 2003 int size = textureSize( boneTexture, 0 ).x; 2004 int j = int( i ) * 4; 2005 int x = j % size; 2006 int y = j / size; 2007 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2008 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2009 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2010 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2011 return mat4( v1, v2, v3, v4 ); 2012 } 2013#endif`,$o=`#ifdef USE_SKINNING 2014 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2015 vec4 skinned = vec4( 0.0 ); 2016 skinned += boneMatX * skinVertex * skinWeight.x; 2017 skinned += boneMatY * skinVertex * skinWeight.y; 2018 skinned += boneMatZ * skinVertex * skinWeight.z; 2019 skinned += boneMatW * skinVertex * skinWeight.w; 2020 transformed = ( bindMatrixInverse * skinned ).xyz; 2021#endif`,Zo=`#ifdef USE_SKINNING 2022 mat4 skinMatrix = mat4( 0.0 ); 2023 skinMatrix += skinWeight.x * boneMatX; 2024 skinMatrix += skinWeight.y * boneMatY; 2025 skinMatrix += skinWeight.z * boneMatZ; 2026 skinMatrix += skinWeight.w * boneMatW; 2027 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2028 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2029 #ifdef USE_TANGENT 2030 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2031 #endif 2032#endif`,jo=`float specularStrength; 2033#ifdef USE_SPECULARMAP 2034 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2035 specularStrength = texelSpecular.r; 2036#else 2037 specularStrength = 1.0; 2038#endif`,Jo=`#ifdef USE_SPECULARMAP 2039 uniform sampler2D specularMap; 2040#endif`,Qo=`#if defined( TONE_MAPPING ) 2041 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2042#endif`,el=`#ifndef saturate 2043#define saturate( a ) clamp( a, 0.0, 1.0 ) 2044#endif 2045uniform float toneMappingExposure; 2046vec3 LinearToneMapping( vec3 color ) { 2047 return saturate( toneMappingExposure * color ); 2048} 2049vec3 ReinhardToneMapping( vec3 color ) { 2050 color *= toneMappingExposure; 2051 return saturate( color / ( vec3( 1.0 ) + color ) ); 2052} 2053vec3 CineonToneMapping( vec3 color ) { 2054 color *= toneMappingExposure; 2055 color = max( vec3( 0.0 ), color - 0.004 ); 2056 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2057} 2058vec3 RRTAndODTFit( vec3 v ) { 2059 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2060 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2061 return a / b; 2062} 2063vec3 ACESFilmicToneMapping( vec3 color ) { 2064 const mat3 ACESInputMat = mat3( 2065 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2066 vec3( 0.04823, 0.01566, 0.83777 ) 2067 ); 2068 const mat3 ACESOutputMat = mat3( 2069 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2070 vec3( -0.07367, -0.00605, 1.07602 ) 2071 ); 2072 color *= toneMappingExposure / 0.6; 2073 color = ACESInputMat * color; 2074 color = RRTAndODTFit( color ); 2075 color = ACESOutputMat * color; 2076 return saturate( color ); 2077} 2078const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2079 vec3( 1.6605, - 0.1246, - 0.0182 ), 2080 vec3( - 0.5876, 1.1329, - 0.1006 ), 2081 vec3( - 0.0728, - 0.0083, 1.1187 ) 2082); 2083const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2084 vec3( 0.6274, 0.0691, 0.0164 ), 2085 vec3( 0.3293, 0.9195, 0.0880 ), 2086 vec3( 0.0433, 0.0113, 0.8956 ) 2087); 2088vec3 agxDefaultContrastApprox( vec3 x ) { 2089 vec3 x2 = x * x; 2090 vec3 x4 = x2 * x2; 2091 return + 15.5 * x4 * x2 2092 - 40.14 * x4 * x 2093 + 31.96 * x4 2094 - 6.868 * x2 * x 2095 + 0.4298 * x2 2096 + 0.1191 * x 2097 - 0.00232; 2098} 2099vec3 AgXToneMapping( vec3 color ) { 2100 const mat3 AgXInsetMatrix = mat3( 2101 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2102 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2103 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2104 );
2105 const mat3 AgXOutsetMatrix = mat3( 2106 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2107 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2108 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2109 ); 2110 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2111 color *= toneMappingExposure; 2112 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2113 color = AgXInsetMatrix * color; 2114 color = max( color, 1e-10 ); color = log2( color ); 2115 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2116 color = clamp( color, 0.0, 1.0 ); 2117 color = agxDefaultContrastApprox( color ); 2118 color = AgXOutsetMatrix * color; 2119 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2120 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2121 color = clamp( color, 0.0, 1.0 ); 2122 return color; 2123} 2124vec3 NeutralToneMapping( vec3 color ) { 2125 const float StartCompression = 0.8 - 0.04; 2126 const float Desaturation = 0.15; 2127 color *= toneMappingExposure; 2128 float x = min( color.r, min( color.g, color.b ) ); 2129 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2130 color -= offset; 2131 float peak = max( color.r, max( color.g, color.b ) ); 2132 if ( peak < StartCompression ) return color; 2133 float d = 1. - StartCompression; 2134 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2135 color *= newPeak / peak; 2136 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2137 return mix( color, vec3( newPeak ), g ); 2138} 2139vec3 CustomToneMapping( vec3 color ) { return color; }`,tl=`#ifdef USE_TRANSMISSION 2140 material.transmission = transmission; 2141 material.transmissionAlpha = 1.0; 2142 material.thickness = thickness; 2143 material.attenuationDistance = attenuationDistance; 2144 material.attenuationColor = attenuationColor; 2145 #ifdef USE_TRANSMISSIONMAP 2146 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2147 #endif 2148 #ifdef USE_THICKNESSMAP 2149 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2150 #endif 2151 vec3 pos = vWorldPosition; 2152 vec3 v = normalize( cameraPosition - pos ); 2153 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2154 vec4 transmitted = getIBLVolumeRefraction( 2155 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2156 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2157 material.attenuationColor, material.attenuationDistance ); 2158 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2159 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2160#endif`,nl=`#ifdef USE_TRANSMISSION 2161 uniform float transmission; 2162 uniform float thickness; 2163 uniform float attenuationDistance; 2164 uniform vec3 attenuationColor; 2165 #ifdef USE_TRANSMISSIONMAP 2166 uniform sampler2D transmissionMap; 2167 #endif 2168 #ifdef USE_THICKNESSMAP 2169 uniform sampler2D thicknessMap; 2170 #endif 2171 uniform vec2 transmissionSamplerSize; 2172 uniform sampler2D transmissionSamplerMap; 2173 uniform mat4 modelMatrix; 2174 uniform mat4 projectionMatrix; 2175 varying vec3 vWorldPosition; 2176 float w0( float a ) { 2177 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2178 } 2179 float w1( float a ) { 2180 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2181 } 2182 float w2( float a ){ 2183 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2184 } 2185 float w3( float a ) { 2186 return ( 1.0 / 6.0 ) * ( a * a * a ); 2187 } 2188 float g0( float a ) { 2189 return w0( a ) + w1( a ); 2190 } 2191 float g1( float a ) { 2192 return w2( a ) + w3( a ); 2193 } 2194 float h0( float a ) { 2195 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2196 } 2197 float h1( float a ) { 2198 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2199 } 2200 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2201 uv = uv * texelSize.zw + 0.5; 2202 vec2 iuv = floor( uv ); 2203 vec2 fuv = fract( uv ); 2204 float g0x = g0( fuv.x ); 2205 float g1x = g1( fuv.x ); 2206 float h0x = h0( fuv.x ); 2207 float h1x = h1( fuv.x ); 2208 float h0y = h0( fuv.y ); 2209 float h1y = h1( fuv.y ); 2210 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2211 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2212 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2213 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2214 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2215 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2216 } 2217 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2218 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2219 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2220 vec2 fLodSizeInv = 1.0 / fLodSize; 2221 vec2 cLodSizeInv = 1.0 / cLodSize; 2222 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2223 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2224 return mix( fSample, cSample, fract( lod ) ); 2225 } 2226 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2227 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2228 vec3 modelScale; 2229 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2230 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2231 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2232 return normalize( refractionVector ) * thickness * modelScale; 2233 } 2234 float applyIorToRoughness( const in float roughness, const in float ior ) { 2235 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2236 } 2237 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2238 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2239 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2240 } 2241 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2242 if ( isinf( attenuationDistance ) ) { 2243 return vec3( 1.0 ); 2244 } else { 2245 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2246 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2247 } 2248 } 2249 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2250 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2251 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2252 const in vec3 attenuationColor, const in float attenuationDistance ) { 2253 vec4 transmittedLight; 2254 vec3 transmittance; 2255 #ifdef USE_DISPERSION 2256 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2257 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2258 for ( int i = 0; i < 3; i ++ ) { 2259 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2260 vec3 refractedRayExit = position + transmissionRay; 2261 2262 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2263 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2264 refractionCoords += 1.0; 2265 refractionCoords /= 2.0; 2266 2267 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2268 transmittedLight[ i ] = transmissionSample[ i ]; 2269 transmittedLight.a += transmissionSample.a; 2270 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2271 } 2272 transmittedLight.a /= 3.0; 2273 2274 #else 2275 2276 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2277 vec3 refractedRayExit = position + transmissionRay; 2278 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2279 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2280 refractionCoords += 1.0; 2281 refractionCoords /= 2.0; 2282 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2283 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2284 2285 #endif 2286 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2287 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2288 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2289 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2290 } 2291#endif`,il=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2292 varying vec2 vUv; 2293#endif 2294#ifdef USE_MAP 2295 varying vec2 vMapUv; 2296#endif 2297#ifdef USE_ALPHAMAP
2298 varying vec2 vAlphaMapUv; 2299#endif 2300#ifdef USE_LIGHTMAP 2301 varying vec2 vLightMapUv; 2302#endif 2303#ifdef USE_AOMAP 2304 varying vec2 vAoMapUv; 2305#endif 2306#ifdef USE_BUMPMAP 2307 varying vec2 vBumpMapUv; 2308#endif 2309#ifdef USE_NORMALMAP 2310 varying vec2 vNormalMapUv; 2311#endif 2312#ifdef USE_EMISSIVEMAP 2313 varying vec2 vEmissiveMapUv; 2314#endif 2315#ifdef USE_METALNESSMAP 2316 varying vec2 vMetalnessMapUv; 2317#endif 2318#ifdef USE_ROUGHNESSMAP 2319 varying vec2 vRoughnessMapUv; 2320#endif 2321#ifdef USE_ANISOTROPYMAP 2322 varying vec2 vAnisotropyMapUv; 2323#endif 2324#ifdef USE_CLEARCOATMAP 2325 varying vec2 vClearcoatMapUv; 2326#endif 2327#ifdef USE_CLEARCOAT_NORMALMAP 2328 varying vec2 vClearcoatNormalMapUv; 2329#endif 2330#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2331 varying vec2 vClearcoatRoughnessMapUv; 2332#endif 2333#ifdef USE_IRIDESCENCEMAP 2334 varying vec2 vIridescenceMapUv; 2335#endif 2336#ifdef USE_IRIDESCENCE_THICKNESSMAP 2337 varying vec2 vIridescenceThicknessMapUv; 2338#endif 2339#ifdef USE_SHEEN_COLORMAP 2340 varying vec2 vSheenColorMapUv; 2341#endif 2342#ifdef USE_SHEEN_ROUGHNESSMAP 2343 varying vec2 vSheenRoughnessMapUv; 2344#endif 2345#ifdef USE_SPECULARMAP 2346 varying vec2 vSpecularMapUv; 2347#endif 2348#ifdef USE_SPECULAR_COLORMAP 2349 varying vec2 vSpecularColorMapUv; 2350#endif 2351#ifdef USE_SPECULAR_INTENSITYMAP 2352 varying vec2 vSpecularIntensityMapUv; 2353#endif 2354#ifdef USE_TRANSMISSIONMAP 2355 uniform mat3 transmissionMapTransform; 2356 varying vec2 vTransmissionMapUv; 2357#endif 2358#ifdef USE_THICKNESSMAP 2359 uniform mat3 thicknessMapTransform; 2360 varying vec2 vThicknessMapUv; 2361#endif`,rl=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2362 varying vec2 vUv; 2363#endif 2364#ifdef USE_MAP 2365 uniform mat3 mapTransform; 2366 varying vec2 vMapUv; 2367#endif 2368#ifdef USE_ALPHAMAP 2369 uniform mat3 alphaMapTransform; 2370 varying vec2 vAlphaMapUv; 2371#endif 2372#ifdef USE_LIGHTMAP 2373 uniform mat3 lightMapTransform; 2374 varying vec2 vLightMapUv; 2375#endif 2376#ifdef USE_AOMAP 2377 uniform mat3 aoMapTransform; 2378 varying vec2 vAoMapUv; 2379#endif 2380#ifdef USE_BUMPMAP 2381 uniform mat3 bumpMapTransform; 2382 varying vec2 vBumpMapUv; 2383#endif 2384#ifdef USE_NORMALMAP 2385 uniform mat3 normalMapTransform; 2386 varying vec2 vNormalMapUv; 2387#endif 2388#ifdef USE_DISPLACEMENTMAP 2389 uniform mat3 displacementMapTransform; 2390 varying vec2 vDisplacementMapUv; 2391#endif 2392#ifdef USE_EMISSIVEMAP 2393 uniform mat3 emissiveMapTransform; 2394 varying vec2 vEmissiveMapUv; 2395#endif 2396#ifdef USE_METALNESSMAP 2397 uniform mat3 metalnessMapTransform; 2398 varying vec2 vMetalnessMapUv; 2399#endif 2400#ifdef USE_ROUGHNESSMAP 2401 uniform mat3 roughnessMapTransform; 2402 varying vec2 vRoughnessMapUv; 2403#endif 2404#ifdef USE_ANISOTROPYMAP 2405 uniform mat3 anisotropyMapTransform; 2406 varying vec2 vAnisotropyMapUv; 2407#endif 2408#ifdef USE_CLEARCOATMAP 2409 uniform mat3 clearcoatMapTransform; 2410 varying vec2 vClearcoatMapUv; 2411#endif 2412#ifdef USE_CLEARCOAT_NORMALMAP 2413 uniform mat3 clearcoatNormalMapTransform; 2414 varying vec2 vClearcoatNormalMapUv; 2415#endif 2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2417 uniform mat3 clearcoatRoughnessMapTransform; 2418 varying vec2 vClearcoatRoughnessMapUv; 2419#endif 2420#ifdef USE_SHEEN_COLORMAP 2421 uniform mat3 sheenColorMapTransform; 2422 varying vec2 vSheenColorMapUv; 2423#endif 2424#ifdef USE_SHEEN_ROUGHNESSMAP 2425 uniform mat3 sheenRoughnessMapTransform; 2426 varying vec2 vSheenRoughnessMapUv; 2427#endif 2428#ifdef USE_IRIDESCENCEMAP 2429 uniform mat3 iridescenceMapTransform; 2430 varying vec2 vIridescenceMapUv; 2431#endif 2432#ifdef USE_IRIDESCENCE_THICKNESSMAP 2433 uniform mat3 iridescenceThicknessMapTransform; 2434 varying vec2 vIridescenceThicknessMapUv; 2435#endif 2436#ifdef USE_SPECULARMAP 2437 uniform mat3 specularMapTransform; 2438 varying vec2 vSpecularMapUv; 2439#endif 2440#ifdef USE_SPECULAR_COLORMAP 2441 uniform mat3 specularColorMapTransform; 2442 varying vec2 vSpecularColorMapUv; 2443#endif 2444#ifdef USE_SPECULAR_INTENSITYMAP 2445 uniform mat3 specularIntensityMapTransform; 2446 varying vec2 vSpecularIntensityMapUv; 2447#endif 2448#ifdef USE_TRANSMISSIONMAP 2449 uniform mat3 transmissionMapTransform; 2450 varying vec2 vTransmissionMapUv; 2451#endif 2452#ifdef USE_THICKNESSMAP 2453 uniform mat3 thicknessMapTransform; 2454 varying vec2 vThicknessMapUv; 2455#endif`,sl=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2456 vUv = vec3( uv, 1 ).xy; 2457#endif 2458#ifdef USE_MAP 2459 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2460#endif 2461#ifdef USE_ALPHAMAP 2462 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2463#endif 2464#ifdef USE_LIGHTMAP 2465 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2466#endif 2467#ifdef USE_AOMAP 2468 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2469#endif 2470#ifdef USE_BUMPMAP 2471 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2472#endif 2473#ifdef USE_NORMALMAP 2474 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2475#endif 2476#ifdef USE_DISPLACEMENTMAP 2477 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2478#endif 2479#ifdef USE_EMISSIVEMAP 2480 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2481#endif 2482#ifdef USE_METALNESSMAP 2483 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2484#endif 2485#ifdef USE_ROUGHNESSMAP 2486 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2487#endif 2488#ifdef USE_ANISOTROPYMAP 2489 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_CLEARCOATMAP 2492 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_CLEARCOAT_NORMALMAP 2495 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2498 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2499#endif
2500#ifdef USE_IRIDESCENCEMAP 2501 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_IRIDESCENCE_THICKNESSMAP 2504 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_SHEEN_COLORMAP 2507 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_SHEEN_ROUGHNESSMAP 2510 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_SPECULARMAP 2513 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2514#endif 2515#ifdef USE_SPECULAR_COLORMAP 2516 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2517#endif 2518#ifdef USE_SPECULAR_INTENSITYMAP 2519 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2520#endif 2521#ifdef USE_TRANSMISSIONMAP 2522 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2523#endif 2524#ifdef USE_THICKNESSMAP 2525 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2526#endif`,al=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2527 vec4 worldPosition = vec4( transformed, 1.0 ); 2528 #ifdef USE_BATCHING 2529 worldPosition = batchingMatrix * worldPosition; 2530 #endif 2531 #ifdef USE_INSTANCING 2532 worldPosition = instanceMatrix * worldPosition; 2533 #endif 2534 worldPosition = modelMatrix * worldPosition; 2535#endif`;const ol=`varying vec2 vUv; 2536uniform mat3 uvTransform; 2537void main() { 2538 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2539 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2540}`,ll=`uniform sampler2D t2D; 2541uniform float backgroundIntensity; 2542varying vec2 vUv; 2543void main() { 2544 vec4 texColor = texture2D( t2D, vUv ); 2545 #ifdef DECODE_VIDEO_TEXTURE 2546 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 ); 2547 #endif 2548 texColor.rgb *= backgroundIntensity; 2549 gl_FragColor = texColor; 2550 #include <tonemapping_fragment> 2551 #include <colorspace_fragment> 2552}`,cl=`varying vec3 vWorldDirection; 2553#include <common> 2554void main() { 2555 vWorldDirection = transformDirection( position, modelMatrix ); 2556 #include <begin_vertex> 2557 #include <project_vertex> 2558 gl_Position.z = gl_Position.w; 2559}`,ul=`#ifdef ENVMAP_TYPE_CUBE 2560 uniform samplerCube envMap; 2561#elif defined( ENVMAP_TYPE_CUBE_UV ) 2562 uniform sampler2D envMap; 2563#endif 2564uniform float flipEnvMap; 2565uniform float backgroundBlurriness; 2566uniform float backgroundIntensity; 2567uniform mat3 backgroundRotation; 2568varying vec3 vWorldDirection; 2569#include <cube_uv_reflection_fragment> 2570void main() { 2571 #ifdef ENVMAP_TYPE_CUBE 2572 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2573 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2574 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2575 #else 2576 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2577 #endif 2578 texColor.rgb *= backgroundIntensity; 2579 gl_FragColor = texColor; 2580 #include <tonemapping_fragment> 2581 #include <colorspace_fragment> 2582}`,hl=`varying vec3 vWorldDirection; 2583#include <common> 2584void main() { 2585 vWorldDirection = transformDirection( position, modelMatrix ); 2586 #include <begin_vertex> 2587 #include <project_vertex> 2588 gl_Position.z = gl_Position.w; 2589}`,dl=`uniform samplerCube tCube; 2590uniform float tFlip; 2591uniform float opacity; 2592varying vec3 vWorldDirection; 2593void main() { 2594 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2595 gl_FragColor = texColor; 2596 gl_FragColor.a *= opacity; 2597 #include <tonemapping_fragment> 2598 #include <colorspace_fragment> 2599}`,fl=`#include <common> 2600#include <batching_pars_vertex> 2601#include <uv_pars_vertex> 2602#include <displacementmap_pars_vertex> 2603#include <morphtarget_pars_vertex> 2604#include <skinning_pars_vertex> 2605#include <logdepthbuf_pars_vertex> 2606#include <clipping_planes_pars_vertex> 2607varying vec2 vHighPrecisionZW; 2608void main() { 2609 #include <uv_vertex> 2610 #include <batching_vertex> 2611 #include <skinbase_vertex> 2612 #include <morphinstance_vertex> 2613 #ifdef USE_DISPLACEMENTMAP 2614 #include <beginnormal_vertex> 2615 #include <morphnormal_vertex> 2616 #include <skinnormal_vertex> 2617 #endif 2618 #include <begin_vertex> 2619 #include <morphtarget_vertex> 2620 #include <skinning_vertex> 2621 #include <displacementmap_vertex> 2622 #include <project_vertex> 2623 #include <logdepthbuf_vertex> 2624 #include <clipping_planes_vertex> 2625 vHighPrecisionZW = gl_Position.zw; 2626}`,pl=`#if DEPTH_PACKING == 3200 2627 uniform float opacity; 2628#endif 2629#include <common> 2630#include <packing> 2631#include <uv_pars_fragment> 2632#include <map_pars_fragment> 2633#include <alphamap_pars_fragment> 2634#include <alphatest_pars_fragment> 2635#include <alphahash_pars_fragment> 2636#include <logdepthbuf_pars_fragment> 2637#include <clipping_planes_pars_fragment> 2638varying vec2 vHighPrecisionZW; 2639void main() { 2640 vec4 diffuseColor = vec4( 1.0 ); 2641 #include <clipping_planes_fragment> 2642 #if DEPTH_PACKING == 3200 2643 diffuseColor.a = opacity; 2644 #endif 2645 #include <map_fragment> 2646 #include <alphamap_fragment> 2647 #include <alphatest_fragment> 2648 #include <alphahash_fragment> 2649 #include <logdepthbuf_fragment> 2650 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2651 #if DEPTH_PACKING == 3200 2652 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2653 #elif DEPTH_PACKING == 3201 2654 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2655 #elif DEPTH_PACKING == 3202 2656 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2657 #elif DEPTH_PACKING == 3203 2658 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2659 #endif 2660}`,ml=`#define DISTANCE 2661varying vec3 vWorldPosition; 2662#include <common> 2663#include <batching_pars_vertex> 2664#include <uv_pars_vertex> 2665#include <displacementmap_pars_vertex> 2666#include <morphtarget_pars_vertex> 2667#include <skinning_pars_vertex> 2668#include <clipping_planes_pars_vertex> 2669void main() { 2670 #include <uv_vertex> 2671 #include <batching_vertex> 2672 #include <skinbase_vertex> 2673 #include <morphinstance_vertex> 2674 #ifdef USE_DISPLACEMENTMAP 2675 #include <beginnormal_vertex> 2676 #include <morphnormal_vertex> 2677 #include <skinnormal_vertex> 2678 #endif 2679 #include <begin_vertex> 2680 #include <morphtarget_vertex> 2681 #include <skinning_vertex> 2682 #include <displacementmap_vertex> 2683 #include <project_vertex> 2684 #include <worldpos_vertex> 2685 #include <clipping_planes_vertex> 2686 vWorldPosition = worldPosition.xyz; 2687}`,_l=`#define DISTANCE 2688uniform vec3 referencePosition; 2689uniform float nearDistance; 2690uniform float farDistance; 2691varying vec3 vWorldPosition; 2692#include <common> 2693#include <packing> 2694#include <uv_pars_fragment> 2695#include <map_pars_fragment> 2696#include <alphamap_pars_fragment> 2697#include <alphatest_pars_fragment> 2698#include <alphahash_pars_fragment> 2699#include <clipping_planes_pars_fragment> 2700void main () { 2701 vec4 diffuseColor = vec4( 1.0 ); 2702 #include <clipping_planes_fragment> 2703 #include <map_fragment> 2704 #include <alphamap_fragment> 2705 #include <alphatest_fragment> 2706 #include <alphahash_fragment> 2707 float dist = length( vWorldPosition - referencePosition ); 2708 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2709 dist = saturate( dist ); 2710 gl_FragColor = packDepthToRGBA( dist ); 2711}`,gl=`varying vec3 vWorldDirection; 2712#include <common> 2713void main() { 2714 vWorldDirection = transformDirection( position, modelMatrix ); 2715 #include <begin_vertex> 2716 #include <project_vertex> 2717}`,vl=`uniform sampler2D tEquirect; 2718varying vec3 vWorldDirection; 2719#include <common> 2720void main() { 2721 vec3 direction = normalize( vWorldDirection ); 2722 vec2 sampleUV = equirectUv( direction ); 2723 gl_FragColor = texture2D( tEquirect, sampleUV ); 2724 #include <tonemapping_fragment> 2725 #include <colorspace_fragment> 2726}`,xl=`uniform float scale; 2727attribute float lineDistance; 2728varying float vLineDistance; 2729#include <common> 2730#include <uv_pars_vertex> 2731#include <color_pars_vertex> 2732#include <fog_pars_vertex> 2733#include <morphtarget_pars_vertex> 2734#include <logdepthbuf_pars_vertex> 2735#include <clipping_planes_pars_vertex> 2736void main() { 2737 vLineDistance = scale * lineDistance; 2738 #include <uv_vertex> 2739 #include <color_vertex> 2740 #include <morphinstance_vertex> 2741 #include <morphcolor_vertex> 2742 #include <begin_vertex> 2743 #include <morphtarget_vertex> 2744 #include <project_vertex> 2745 #include <logdepthbuf_vertex> 2746 #include <clipping_planes_vertex> 2747 #include <fog_vertex> 2748}`,Ml=`uniform vec3 diffuse; 2749uniform float opacity; 2750uniform float dashSize; 2751uniform float totalSize; 2752varying float vLineDistance; 2753#include <common> 2754#include <color_pars_fragment> 2755#include <uv_pars_fragment> 2756#include <map_pars_fragment> 2757#include <fog_pars_fragment> 2758#include <logdepthbuf_pars_fragment> 2759#include <clipping_planes_pars_fragment> 2760void main() { 2761 vec4 diffuseColor = vec4( diffuse, opacity ); 2762 #include <clipping_planes_fragment> 2763 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2764 discard; 2765 } 2766 vec3 outgoingLight = vec3( 0.0 ); 2767 #include <logdepthbuf_fragment> 2768 #include <map_fragment> 2769 #include <color_fragment> 2770 outgoingLight = diffuseColor.rgb; 2771 #include <opaque_fragment> 2772 #include <tonemapping_fragment> 2773 #include <colorspace_fragment> 2774 #include <fog_fragment> 2775 #include <premultiplied_alpha_fragment> 2776}`,Sl=`#include <common> 2777#include <batching_pars_vertex> 2778#include <uv_pars_vertex> 2779#include <envmap_pars_vertex> 2780#include <color_pars_vertex> 2781#include <fog_pars_vertex> 2782#include <morphtarget_pars_vertex> 2783#include <skinning_pars_vertex> 2784#include <logdepthbuf_pars_vertex> 2785#include <clipping_planes_pars_vertex> 2786void main() { 2787 #include <uv_vertex> 2788 #include <color_vertex> 2789 #include <morphinstance_vertex> 2790 #include <morphcolor_vertex> 2791 #include <batching_vertex> 2792 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2793 #include <beginnormal_vertex> 2794 #include <morphnormal_vertex> 2795 #include <skinbase_vertex> 2796 #include <skinnormal_vertex> 2797 #include <defaultnormal_vertex> 2798 #endif 2799 #include <begin_vertex> 2800 #include <morphtarget_vertex> 2801 #include <skinning_vertex> 2802 #include <project_vertex> 2803 #include <logdepthbuf_vertex> 2804 #include <clipping_planes_vertex> 2805 #include <worldpos_vertex> 2806 #include <envmap_vertex> 2807 #include <fog_vertex> 2808}`,El=`uniform vec3 diffuse; 2809uniform float opacity; 2810#ifndef FLAT_SHADED 2811 varying vec3 vNormal; 2812#endif 2813#include <common> 2814#include <dithering_pars_fragment> 2815#include <color_pars_fragment> 2816#include <uv_pars_fragment> 2817#include <map_pars_fragment> 2818#include <alphamap_pars_fragment> 2819#include <alphatest_pars_fragment> 2820#include <alphahash_pars_fragment> 2821#include <aomap_pars_fragment> 2822#include <lightmap_pars_fragment> 2823#include <envmap_common_pars_fragment> 2824#include <envmap_pars_fragment> 2825#include <fog_pars_fragment> 2826#include <specularmap_pars_fragment> 2827#include <logdepthbuf_pars_fragment> 2828#include <clipping_planes_pars_fragment> 2829void main() { 2830 vec4 diffuseColor = vec4( diffuse, opacity ); 2831 #include <clipping_planes_fragment> 2832 #include <logdepthbuf_fragment> 2833 #include <map_fragment> 2834 #include <color_fragment> 2835 #include <alphamap_fragment> 2836 #include <alphatest_fragment> 2837 #include <alphahash_fragment> 2838 #include <specularmap_fragment> 2839 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2840 #ifdef USE_LIGHTMAP 2841 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2842 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2843 #else 2844 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2845 #endif 2846 #include <aomap_fragment> 2847 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2848 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2849 #include <envmap_fragment> 2850 #include <opaque_fragment> 2851 #include <tonemapping_fragment> 2852 #include <colorspace_fragment> 2853 #include <fog_fragment> 2854 #include <premultiplied_alpha_fragment> 2855 #include <dithering_fragment> 2856}`,Tl=`#define LAMBERT 2857varying vec3 vViewPosition; 2858#include <common> 2859#include <batching_pars_vertex> 2860#include <uv_pars_vertex> 2861#include <displacementmap_pars_vertex> 2862#include <envmap_pars_vertex> 2863#include <color_pars_vertex> 2864#include <fog_pars_vertex> 2865#include <normal_pars_vertex> 2866#include <morphtarget_pars_vertex> 2867#include <skinning_pars_vertex> 2868#include <shadowmap_pars_vertex> 2869#include <logdepthbuf_pars_vertex> 2870#include <clipping_planes_pars_vertex> 2871void main() { 2872 #include <uv_vertex> 2873 #include <color_vertex> 2874 #include <morphinstance_vertex> 2875 #include <morphcolor_vertex> 2876 #include <batching_vertex> 2877 #include <beginnormal_vertex> 2878 #include <morphnormal_vertex> 2879 #include <skinbase_vertex> 2880 #include <skinnormal_vertex> 2881 #include <defaultnormal_vertex> 2882 #include <normal_vertex> 2883 #include <begin_vertex> 2884 #include <morphtarget_vertex> 2885 #include <skinning_vertex> 2886 #include <displacementmap_vertex> 2887 #include <project_vertex> 2888 #include <logdepthbuf_vertex> 2889 #include <clipping_planes_vertex> 2890 vViewPosition = - mvPosition.xyz; 2891 #include <worldpos_vertex> 2892 #include <envmap_vertex> 2893 #include <shadowmap_vertex> 2894 #include <fog_vertex> 2895}
2895`,yl=`#define LAMBERT 2896uniform vec3 diffuse; 2897uniform vec3 emissive; 2898uniform float opacity; 2899#include <common> 2900#include <packing> 2901#include <dithering_pars_fragment> 2902#include <color_pars_fragment> 2903#include <uv_pars_fragment> 2904#include <map_pars_fragment> 2905#include <alphamap_pars_fragment> 2906#include <alphatest_pars_fragment> 2907#include <alphahash_pars_fragment> 2908#include <aomap_pars_fragment> 2909#include <lightmap_pars_fragment> 2910#include <emissivemap_pars_fragment> 2911#include <envmap_common_pars_fragment> 2912#include <envmap_pars_fragment> 2913#include <fog_pars_fragment> 2914#include <bsdfs> 2915#include <lights_pars_begin> 2916#include <normal_pars_fragment> 2917#include <lights_lambert_pars_fragment> 2918#include <shadowmap_pars_fragment> 2919#include <bumpmap_pars_fragment> 2920#include <normalmap_pars_fragment> 2921#include <specularmap_pars_fragment> 2922#include <logdepthbuf_pars_fragment> 2923#include <clipping_planes_pars_fragment> 2924void main() { 2925 vec4 diffuseColor = vec4( diffuse, opacity ); 2926 #include <clipping_planes_fragment> 2927 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2928 vec3 totalEmissiveRadiance = emissive; 2929 #include <logdepthbuf_fragment> 2930 #include <map_fragment> 2931 #include <color_fragment> 2932 #include <alphamap_fragment> 2933 #include <alphatest_fragment> 2934 #include <alphahash_fragment> 2935 #include <specularmap_fragment> 2936 #include <normal_fragment_begin> 2937 #include <normal_fragment_maps> 2938 #include <emissivemap_fragment> 2939 #include <lights_lambert_fragment> 2940 #include <lights_fragment_begin> 2941 #include <lights_fragment_maps> 2942 #include <lights_fragment_end> 2943 #include <aomap_fragment> 2944 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2945 #include <envmap_fragment> 2946 #include <opaque_fragment> 2947 #include <tonemapping_fragment> 2948 #include <colorspace_fragment> 2949 #include <fog_fragment> 2950 #include <premultiplied_alpha_fragment> 2951 #include <dithering_fragment> 2952}`,Al=`#define MATCAP 2953varying vec3 vViewPosition; 2954#include <common> 2955#include <batching_pars_vertex> 2956#include <uv_pars_vertex> 2957#include <color_pars_vertex> 2958#include <displacementmap_pars_vertex> 2959#include <fog_pars_vertex> 2960#include <normal_pars_vertex> 2961#include <morphtarget_pars_vertex> 2962#include <skinning_pars_vertex> 2963#include <logdepthbuf_pars_vertex> 2964#include <clipping_planes_pars_vertex> 2965void main() { 2966 #include <uv_vertex> 2967 #include <color_vertex> 2968 #include <morphinstance_vertex> 2969 #include <morphcolor_vertex> 2970 #include <batching_vertex> 2971 #include <beginnormal_vertex> 2972 #include <morphnormal_vertex> 2973 #include <skinbase_vertex> 2974 #include <skinnormal_vertex> 2975 #include <defaultnormal_vertex> 2976 #include <normal_vertex> 2977 #include <begin_vertex> 2978 #include <morphtarget_vertex> 2979 #include <skinning_vertex> 2980 #include <displacementmap_vertex> 2981 #include <project_vertex> 2982 #include <logdepthbuf_vertex> 2983 #include <clipping_planes_vertex> 2984 #include <fog_vertex> 2985 vViewPosition = - mvPosition.xyz; 2986}`,bl=`#define MATCAP 2987uniform vec3 diffuse; 2988uniform float opacity; 2989uniform sampler2D matcap; 2990varying vec3 vViewPosition; 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 <fog_pars_fragment> 3000#include <normal_pars_fragment> 3001#include <bumpmap_pars_fragment> 3002#include <normalmap_pars_fragment> 3003#include <logdepthbuf_pars_fragment> 3004#include <clipping_planes_pars_fragment> 3005void main() { 3006 vec4 diffuseColor = vec4( diffuse, opacity ); 3007 #include <clipping_planes_fragment> 3008 #include <logdepthbuf_fragment> 3009 #include <map_fragment> 3010 #include <color_fragment> 3011 #include <alphamap_fragment> 3012 #include <alphatest_fragment> 3013 #include <alphahash_fragment> 3014 #include <normal_fragment_begin> 3015 #include <normal_fragment_maps> 3016 vec3 viewDir = normalize( vViewPosition ); 3017 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3018 vec3 y = cross( viewDir, x ); 3019 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3020 #ifdef USE_MATCAP 3021 vec4 matcapColor = texture2D( matcap, uv ); 3022 #else
3023 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3024 #endif 3025 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3026 #include <opaque_fragment> 3027 #include <tonemapping_fragment> 3028 #include <colorspace_fragment> 3029 #include <fog_fragment> 3030 #include <premultiplied_alpha_fragment> 3031 #include <dithering_fragment> 3032}`,Rl=`#define NORMAL 3033#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3034 varying vec3 vViewPosition; 3035#endif 3036#include <common> 3037#include <batching_pars_vertex> 3038#include <uv_pars_vertex> 3039#include <displacementmap_pars_vertex> 3040#include <normal_pars_vertex> 3041#include <morphtarget_pars_vertex> 3042#include <skinning_pars_vertex> 3043#include <logdepthbuf_pars_vertex> 3044#include <clipping_planes_pars_vertex> 3045void main() { 3046 #include <uv_vertex> 3047 #include <batching_vertex> 3048 #include <beginnormal_vertex> 3049 #include <morphinstance_vertex> 3050 #include <morphnormal_vertex> 3051 #include <skinbase_vertex> 3052 #include <skinnormal_vertex> 3053 #include <defaultnormal_vertex> 3054 #include <normal_vertex> 3055 #include <begin_vertex> 3056 #include <morphtarget_vertex> 3057 #include <skinning_vertex> 3058 #include <displacementmap_vertex> 3059 #include <project_vertex> 3060 #include <logdepthbuf_vertex> 3061 #include <clipping_planes_vertex> 3062#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3063 vViewPosition = - mvPosition.xyz; 3064#endif 3065}`,Cl=`#define NORMAL 3066uniform float opacity; 3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3068 varying vec3 vViewPosition; 3069#endif 3070#include <packing> 3071#include <uv_pars_fragment> 3072#include <normal_pars_fragment> 3073#include <bumpmap_pars_fragment> 3074#include <normalmap_pars_fragment> 3075#include <logdepthbuf_pars_fragment> 3076#include <clipping_planes_pars_fragment> 3077void main() { 3078 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3079 #include <clipping_planes_fragment> 3080 #include <logdepthbuf_fragment> 3081 #include <normal_fragment_begin> 3082 #include <normal_fragment_maps> 3083 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3084 #ifdef OPAQUE 3085 gl_FragColor.a = 1.0; 3086 #endif 3087}`,wl=`#define PHONG 3088varying vec3 vViewPosition; 3089#include <common> 3090#include <batching_pars_vertex> 3091#include <uv_pars_vertex> 3092#include <displacementmap_pars_vertex> 3093#include <envmap_pars_vertex> 3094#include <color_pars_vertex> 3095#include <fog_pars_vertex> 3096#include <normal_pars_vertex> 3097#include <morphtarget_pars_vertex> 3098#include <skinning_pars_vertex> 3099#include <shadowmap_pars_vertex> 3100#include <logdepthbuf_pars_vertex> 3101#include <clipping_planes_pars_vertex> 3102void main() { 3103 #include <uv_vertex> 3104 #include <color_vertex> 3105 #include <morphcolor_vertex> 3106 #include <batching_vertex> 3107 #include <beginnormal_vertex> 3108 #include <morphinstance_vertex> 3109 #include <morphnormal_vertex> 3110 #include <skinbase_vertex> 3111 #include <skinnormal_vertex> 3112 #include <defaultnormal_vertex> 3113 #include <normal_vertex> 3114 #include <begin_vertex> 3115 #include <morphtarget_vertex> 3116 #include <skinning_vertex> 3117 #include <displacementmap_vertex> 3118 #include <project_vertex> 3119 #include <logdepthbuf_vertex> 3120 #include <clipping_planes_vertex> 3121 vViewPosition = - mvPosition.xyz; 3122 #include <worldpos_vertex> 3123 #include <envmap_vertex> 3124 #include <shadowmap_vertex> 3125 #include <fog_vertex> 3126}`,Pl=`#define PHONG 3127uniform vec3 diffuse; 3128uniform vec3 emissive; 3129uniform vec3 specular; 3130uniform float shininess; 3131uniform float opacity; 3132#include <common> 3133#include <packing> 3134#include <dithering_pars_fragment> 3135#include <color_pars_fragment> 3136#include <uv_pars_fragment> 3137#include <map_pars_fragment> 3138#include <alphamap_pars_fragment> 3139#include <alphatest_pars_fragment> 3140#include <alphahash_pars_fragment> 3141#include <aomap_pars_fragment> 3142#include <lightmap_pars_fragment> 3143#include <emissivemap_pars_fragment> 3144#include <envmap_common_pars_fragment> 3145#include <envmap_pars_fragment> 3146#include <fog_pars_fragment> 3147#include <bsdfs> 3148#include <lights_pars_begin> 3149#include <normal_pars_fragment> 3150#include <lights_phong_pars_fragment> 3151#include <shadowmap_pars_fragment> 3152#include <bumpmap_pars_fragment> 3153#include <normalmap_pars_fragment> 3154#include <specularmap_pars_fragment> 3155#include <logdepthbuf_pars_fragment> 3156#include <clipping_planes_pars_fragment> 3157void main() { 3158 vec4 diffuseColor = vec4( diffuse, opacity ); 3159 #include <clipping_planes_fragment> 3160 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3161 vec3 totalEmissiveRadiance = emissive; 3162 #include <logdepthbuf_fragment> 3163 #include <map_fragment> 3164 #include <color_fragment> 3165 #include <alphamap_fragment> 3166 #include <alphatest_fragment> 3167 #include <alphahash_fragment> 3168 #include <specularmap_fragment> 3169 #include <normal_fragment_begin> 3170 #include <normal_fragment_maps> 3171 #include <emissivemap_fragment> 3172 #include <lights_phong_fragment> 3173 #include <lights_fragment_begin> 3174 #include <lights_fragment_maps> 3175 #include <lights_fragment_end> 3176 #include <aomap_fragment> 3177 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3178 #include <envmap_fragment> 3179 #include <opaque_fragment> 3180 #include <tonemapping_fragment> 3181 #include <colorspace_fragment> 3182 #include <fog_fragment> 3183 #include <premultiplied_alpha_fragment> 3184 #include <dithering_fragment> 3185}`,Ll=`#define STANDARD 3186varying vec3 vViewPosition; 3187#ifdef USE_TRANSMISSION 3188 varying vec3 vWorldPosition; 3189#endif 3190#include <common> 3191#include <batching_pars_vertex> 3192#include <uv_pars_vertex> 3193#include <displacementmap_pars_vertex> 3194#include <color_pars_vertex> 3195#include <fog_pars_vertex> 3196#include <normal_pars_vertex> 3197#include <morphtarget_pars_vertex> 3198#include <skinning_pars_vertex> 3199#include <shadowmap_pars_vertex> 3200#include <logdepthbuf_pars_vertex> 3201#include <clipping_planes_pars_vertex> 3202void main() { 3203 #include <uv_vertex> 3204 #include <color_vertex> 3205 #include <morphinstance_vertex> 3206 #include <morphcolor_vertex> 3207 #include <batching_vertex> 3208 #include <beginnormal_vertex> 3209 #include <morphnormal_vertex> 3210 #include <skinbase_vertex> 3211 #include <skinnormal_vertex> 3212 #include <defaultnormal_vertex> 3213 #include <normal_vertex> 3214 #include <begin_vertex> 3215 #include <morphtarget_vertex> 3216 #include <skinning_vertex> 3217 #include <displacementmap_vertex> 3218 #include <project_vertex> 3219 #include <logdepthbuf_vertex> 3220 #include <clipping_planes_vertex> 3221 vViewPosition = - mvPosition.xyz; 3222 #include <worldpos_vertex> 3223 #include <shadowmap_vertex> 3224 #include <fog_vertex> 3225#ifdef USE_TRANSMISSION 3226 vWorldPosition = worldPosition.xyz; 3227#endif 3228}
3228`,Dl=`#define STANDARD 3229#ifdef PHYSICAL 3230 #define IOR 3231 #define USE_SPECULAR 3232#endif 3233uniform vec3 diffuse; 3234uniform vec3 emissive; 3235uniform float roughness; 3236uniform float metalness; 3237uniform float opacity; 3238#ifdef IOR 3239 uniform float ior; 3240#endif 3241#ifdef USE_SPECULAR 3242 uniform float specularIntensity; 3243 uniform vec3 specularColor; 3244 #ifdef USE_SPECULAR_COLORMAP 3245 uniform sampler2D specularColorMap; 3246 #endif 3247 #ifdef USE_SPECULAR_INTENSITYMAP 3248 uniform sampler2D specularIntensityMap; 3249 #endif 3250#endif 3251#ifdef USE_CLEARCOAT 3252 uniform float clearcoat; 3253 uniform float clearcoatRoughness; 3254#endif 3255#ifdef USE_DISPERSION 3256 uniform float dispersion; 3257#endif 3258#ifdef USE_IRIDESCENCE 3259 uniform float iridescence; 3260 uniform float iridescenceIOR; 3261 uniform float iridescenceThicknessMinimum; 3262 uniform float iridescenceThicknessMaximum; 3263#endif 3264#ifdef USE_SHEEN 3265 uniform vec3 sheenColor; 3266 uniform float sheenRoughness; 3267 #ifdef USE_SHEEN_COLORMAP 3268 uniform sampler2D sheenColorMap; 3269 #endif 3270 #ifdef USE_SHEEN_ROUGHNESSMAP 3271 uniform sampler2D sheenRoughnessMap; 3272 #endif 3273#endif 3274#ifdef USE_ANISOTROPY 3275 uniform vec2 anisotropyVector; 3276 #ifdef USE_ANISOTROPYMAP 3277 uniform sampler2D anisotropyMap; 3278 #endif 3279#endif 3280varying vec3 vViewPosition; 3281#include <common> 3282#include <packing> 3283#include <dithering_pars_fragment> 3284#include <color_pars_fragment> 3285#include <uv_pars_fragment> 3286#include <map_pars_fragment> 3287#include <alphamap_pars_fragment> 3288#include <alphatest_pars_fragment> 3289#include <alphahash_pars_fragment> 3290#include <aomap_pars_fragment> 3291#include <lightmap_pars_fragment> 3292#include <emissivemap_pars_fragment> 3293#include <iridescence_fragment> 3294#include <cube_uv_reflection_fragment> 3295#include <envmap_common_pars_fragment> 3296#include <envmap_physical_pars_fragment> 3297#include <fog_pars_fragment> 3298#include <lights_pars_begin> 3299#include <normal_pars_fragment> 3300#include <lights_physical_pars_fragment> 3301#include <transmission_pars_fragment> 3302#include <shadowmap_pars_fragment> 3303#include <bumpmap_pars_fragment> 3304#include <normalmap_pars_fragment> 3305#include <clearcoat_pars_fragment> 3306#include <iridescence_pars_fragment> 3307#include <roughnessmap_pars_fragment> 3308#include <metalnessmap_pars_fragment> 3309#include <logdepthbuf_pars_fragment> 3310#include <clipping_planes_pars_fragment> 3311void main() { 3312 vec4 diffuseColor = vec4( diffuse, opacity ); 3313 #include <clipping_planes_fragment> 3314 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3315 vec3 totalEmissiveRadiance = emissive; 3316 #include <logdepthbuf_fragment> 3317 #include <map_fragment> 3318 #include <color_fragment> 3319 #include <alphamap_fragment> 3320 #include <alphatest_fragment> 3321 #include <alphahash_fragment> 3322 #include <roughnessmap_fragment> 3323 #include <metalnessmap_fragment> 3324 #include <normal_fragment_begin> 3325 #include <normal_fragment_maps> 3326 #include <clearcoat_normal_fragment_begin> 3327 #include <clearcoat_normal_fragment_maps> 3328 #include <emissivemap_fragment> 3329 #include <lights_physical_fragment> 3330 #include <lights_fragment_begin> 3331 #include <lights_fragment_maps> 3332 #include <lights_fragment_end> 3333 #include <aomap_fragment> 3334 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3335 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3336 #include <transmission_fragment> 3337 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3338 #ifdef USE_SHEEN 3339 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3340 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3341 #endif 3342 #ifdef USE_CLEARCOAT 3343 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3344 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3345 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3346 #endif 3347 #include <opaque_fragment> 3348 #include <tonemapping_fragment> 3349 #include <colorspace_fragment> 3350 #include <fog_fragment> 3351 #include <premultiplied_alpha_fragment> 3352 #include <dithering_fragment> 3353}`,Ul=`#define TOON 3354varying vec3 vViewPosition; 3355#include <common> 3356#include <batching_pars_vertex> 3357#include <uv_pars_vertex> 3358#include <displacementmap_pars_vertex> 3359#include <color_pars_vertex> 3360#include <fog_pars_vertex> 3361#include <normal_pars_vertex> 3362#include <morphtarget_pars_vertex> 3363#include <skinning_pars_vertex> 3364#include <shadowmap_pars_vertex> 3365#include <logdepthbuf_pars_vertex> 3366#include <clipping_planes_pars_vertex> 3367void main() { 3368 #include <uv_vertex> 3369 #include <color_vertex> 3370 #include <morphinstance_vertex> 3371 #include <morphcolor_vertex> 3372 #include <batching_vertex> 3373 #include <beginnormal_vertex> 3374 #include <morphnormal_vertex> 3375 #include <skinbase_vertex> 3376 #include <skinnormal_vertex> 3377 #include <defaultnormal_vertex> 3378 #include <normal_vertex> 3379 #include <begin_vertex> 3380 #include <morphtarget_vertex> 3381 #include <skinning_vertex> 3382 #include <displacementmap_vertex> 3383 #include <project_vertex> 3384 #include <logdepthbuf_vertex> 3385 #include <clipping_planes_vertex> 3386 vViewPosition = - mvPosition.xyz; 3387 #include <worldpos_vertex> 3388 #include <shadowmap_vertex> 3389 #include <fog_vertex> 3390}`,Il=`#define TOON 3391uniform vec3 diffuse; 3392uniform vec3 emissive; 3393uniform float opacity; 3394#include <common> 3395#include <packing> 3396#include <dithering_pars_fragment> 3397#include <color_pars_fragment> 3398#include <uv_pars_fragment> 3399#include <map_pars_fragment> 3400#include <alphamap_pars_fragment> 3401#include <alphatest_pars_fragment> 3402#include <alphahash_pars_fragment> 3403#include <aomap_pars_fragment> 3404#include <lightmap_pars_fragment> 3405#include <emissivemap_pars_fragment> 3406#include <gradientmap_pars_fragment> 3407#include <fog_pars_fragment> 3408#include <bsdfs> 3409#include <lights_pars_begin> 3410#include <normal_pars_fragment> 3411#include <lights_toon_pars_fragment> 3412#include <shadowmap_pars_fragment> 3413#include <bumpmap_pars_fragment> 3414#include <normalmap_pars_fragment> 3415#include <logdepthbuf_pars_fragment> 3416#include <clipping_planes_pars_fragment> 3417void main() { 3418 vec4 diffuseColor = vec4( diffuse, opacity ); 3419 #include <clipping_planes_fragment> 3420 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3421 vec3 totalEmissiveRadiance = emissive; 3422 #include <logdepthbuf_fragment> 3423 #include <map_fragment> 3424 #include <color_fragment> 3425 #include <alphamap_fragment> 3426 #include <alphatest_fragment> 3427 #include <alphahash_fragment> 3428 #include <normal_fragment_begin> 3429 #include <normal_fragment_maps> 3430 #include <emissivemap_fragment> 3431 #include <lights_toon_fragment> 3432 #include <lights_fragment_begin> 3433 #include <lights_fragment_maps> 3434 #include <lights_fragment_end> 3435 #include <aomap_fragment> 3436 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3437 #include <opaque_fragment> 3438 #include <tonemapping_fragment> 3439 #include <colorspace_fragment> 3440 #include <fog_fragment> 3441 #include <premultiplied_alpha_fragment> 3442 #include <dithering_fragment> 3443}`,Fl=`uniform float size; 3444uniform float scale; 3445#include <common> 3446#include <color_pars_vertex> 3447#include <fog_pars_vertex> 3448#include <morphtarget_pars_vertex> 3449#include <logdepthbuf_pars_vertex> 3450#include <clipping_planes_pars_vertex> 3451#ifdef USE_POINTS_UV 3452 varying vec2 vUv; 3453 uniform mat3 uvTransform; 3454#endif 3455void main() { 3456 #ifdef USE_POINTS_UV 3457 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3458 #endif 3459 #include <color_vertex> 3460 #include <morphinstance_vertex> 3461 #include <morphcolor_vertex> 3462 #include <begin_vertex> 3463 #include <morphtarget_vertex> 3464 #include <project_vertex> 3465 gl_PointSize = size; 3466 #ifdef USE_SIZEATTENUATION 3467 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3468 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3469 #endif 3470 #include <logdepthbuf_vertex> 3471 #include <clipping_planes_vertex> 3472 #include <worldpos_vertex> 3473 #include <fog_vertex> 3474}`,Nl=`uniform vec3 diffuse; 3475uniform float opacity; 3476#include <common> 3477#include <color_pars_fragment> 3478#include <map_particle_pars_fragment> 3479#include <alphatest_pars_fragment> 3480#include <alphahash_pars_fragment> 3481#include <fog_pars_fragment> 3482#include <logdepthbuf_pars_fragment> 3483#include <clipping_planes_pars_fragment> 3484void main() { 3485 vec4 diffuseColor = vec4( diffuse, opacity ); 3486 #include <clipping_planes_fragment> 3487 vec3 outgoingLight = vec3( 0.0 ); 3488 #include <logdepthbuf_fragment> 3489 #include <map_particle_fragment> 3490 #include <color_fragment> 3491 #include <alphatest_fragment> 3492 #include <alphahash_fragment> 3493 outgoingLight = diffuseColor.rgb; 3494 #include <opaque_fragment> 3495 #include <tonemapping_fragment> 3496 #include <colorspace_fragment> 3497 #include <fog_fragment> 3498 #include <premultiplied_alpha_fragment> 3499}`,Ol=`#include <common> 3500#include <batching_pars_vertex> 3501#include <fog_pars_vertex> 3502#include <morphtarget_pars_vertex> 3503#include <skinning_pars_vertex> 3504#include <logdepthbuf_pars_vertex> 3505#include <shadowmap_pars_vertex> 3506void main() { 3507 #include <batching_vertex> 3508 #include <beginnormal_vertex> 3509 #include <morphinstance_vertex> 3510 #include <morphnormal_vertex> 3511 #include <skinbase_vertex> 3512 #include <skinnormal_vertex> 3513 #include <defaultnormal_vertex> 3514 #include <begin_vertex> 3515 #include <morphtarget_vertex> 3516 #include <skinning_vertex> 3517 #include <project_vertex> 3518 #include <logdepthbuf_vertex> 3519 #include <worldpos_vertex> 3520 #include <shadowmap_vertex> 3521 #include <fog_vertex> 3522}`,Bl=`uniform vec3 color; 3523uniform float opacity; 3524#include <common> 3525#include <packing> 3526#include <fog_pars_fragment> 3527#include <bsdfs> 3528#include <lights_pars_begin> 3529#include <logdepthbuf_pars_fragment> 3530#include <shadowmap_pars_fragment> 3531#include <shadowmask_pars_fragment> 3532void main() { 3533 #include <logdepthbuf_fragment> 3534 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3535 #include <tonemapping_fragment> 3536 #include <colorspace_fragment> 3537 #include <fog_fragment> 3538}`,Gl=`uniform float rotation; 3539uniform vec2 center; 3540#include <common> 3541#include <uv_pars_vertex> 3542#include <fog_pars_vertex> 3543#include <logdepthbuf_pars_vertex> 3544#include <clipping_planes_pars_vertex> 3545void main() { 3546 #include <uv_vertex> 3547 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3548 vec2 scale; 3549 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3550 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3551 #ifndef USE_SIZEATTENUATION 3552 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3553 if ( isPerspective ) scale *= - mvPosition.z; 3554 #endif 3555 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3556 vec2 rotatedPosition; 3557 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3558 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3559 mvPosition.xy += rotatedPosition; 3560 gl_Position = projectionMatrix * mvPosition; 3561 #include <logdepthbuf_vertex> 3562 #include <clipping_planes_vertex> 3563 #include <fog_vertex> 3564}`,zl=`uniform vec3 diffuse; 3565uniform float opacity; 3566#include <common> 3567#include <uv_pars_fragment> 3568#include <map_pars_fragment> 3569#include <alphamap_pars_fragment> 3570#include <alphatest_pars_fragment> 3571#include <alphahash_pars_fragment> 3572#include <fog_pars_fragment> 3573#include <logdepthbuf_pars_fragment> 3574#include <clipping_planes_pars_fragment> 3575void main() { 3576 vec4 diffuseColor = vec4( diffuse, opacity ); 3577 #include <clipping_planes_fragment> 3578 vec3 outgoingLight = vec3( 0.0 ); 3579 #include <logdepthbuf_fragment> 3580 #include <map_fragment> 3581 #include <alphamap_fragment> 3582 #include <alphatest_fragment> 3583 #include <alphahash_fragment> 3584 outgoingLight = diffuseColor.rgb; 3585 #include <opaque_fragment> 3586 #include <tonemapping_fragment> 3587 #include <colorspace_fragment> 3588 #include <fog_fragment> 3589}`,Pe={alphahash_fragment:oa,alphahash_pars_fragment:la,alphamap_fragment:ca,alph
vendor: 7,325 bytes, line 3589
3589amap_pars_fragment:ua,alphatest_fragment:ha,alphatest_pars_fragment:da,aomap_fragment:fa,aomap_pars_fragment:pa,batching_pars_vertex:ma,batching_vertex:_a,begin_vertex:ga,beginnormal_vertex:va,bsdfs:xa,iridescence_fragment:Ma,bumpmap_pars_fragment:Sa,clipping_planes_fragment:Ea,clipping_planes_pars_fragment:Ta,clipping_planes_pars_vertex:ya,clipping_planes_vertex:Aa,color_fragment:ba,color_pars_fragment:Ra,color_pars_vertex:Ca,color_vertex:wa,common:Pa,cube_uv_reflection_fragment:La,defaultnormal_vertex:Da,displacementmap_pars_vertex:Ua,displacementmap_vertex:Ia,emissivemap_fragment:Fa,emissivemap_pars_fragment:Na,colorspace_fragment:Oa,colorspace_pars_fragment:Ba,envmap_fragment:Ga,envmap_common_pars_fragment:za,envmap_pars_fragment:Ha,envmap_pars_vertex:Va,envmap_physical_pars_fragment:Qa,envmap_vertex:ka,fog_vertex:Wa,fog_pars_vertex:Xa,fog_fragment:qa,fog_pars_fragment:Ya,gradientmap_pars_fragment:Ka,lightmap_pars_fragment:$a,lights_lambert_fragment:Za,lights_lambert_pars_fragment:ja,lights_pars_begin:Ja,lights_toon_fragment:eo,lights_toon_pars_fragment:to,lights_phong_fragment:no,lights_phong_pars_fragment:io,lights_physical_fragment:ro,lights_physical_pars_fragment:so,lights_fragment_begin:ao,lights_fragment_maps:oo,lights_fragment_end:lo,logdepthbuf_fragment:co,logdepthbuf_pars_fragment:uo,logdepthbuf_pars_vertex:ho,logdepthbuf_vertex:fo,map_fragment:po,map_pars_fragment:mo,map_particle_fragment:_o,map_particle_pars_fragment:go,metalnessmap_fragment:vo,metalnessmap_pars_fragment:xo,morphinstance_vertex:Mo,morphcolor_vertex:So,morphnormal_vertex:Eo,morphtarget_pars_vertex:To,morphtarget_vertex:yo,normal_fragment_begin:Ao,normal_fragment_maps:bo,normal_pars_fragment:Ro,normal_pars_vertex:Co,normal_vertex:wo,normalmap_pars_fragment:Po,clearcoat_normal_fragment_begin:Lo,clearcoat_normal_fragment_maps:Do,clearcoat_pars_fragment:Uo,iridescence_pars_fragment:Io,opaque_fragment:Fo,packing:No,premultiplied_alpha_fragment:Oo,project_vertex:Bo,dithering_fragment:Go,dithering_pars_fragment:zo,roughnessmap_fragment:Ho,roughnessmap_pars_fragment:Vo,shadowmap_pars_fragment:ko,shadowmap_pars_vertex:Wo,shadowmap_vertex:Xo,shadowmask_pars_fragment:qo,skinbase_vertex:Yo,skinning_pars_vertex:Ko,skinning_vertex:$o,skinnormal_vertex:Zo,specularmap_fragment:jo,specularmap_pars_fragment:Jo,tonemapping_fragment:Qo,tonemapping_pars_fragment:el,transmission_fragment:tl,transmission_pars_fragment:nl,uv_pars_fragment:il,uv_pars_vertex:rl,uv_vertex:sl,worldpos_vertex:al,background_vert:ol,background_frag:ll,backgroundCube_vert:cl,backgroundCube_frag:ul,cube_vert:hl,cube_frag:dl,depth_vert:fl,depth_frag:pl,distanceRGBA_vert:ml,distanceRGBA_frag:_l,equirect_vert:gl,equirect_frag:vl,linedashed_vert:xl,linedashed_frag:Ml,meshbasic_vert:Sl,meshbasic_frag:El,meshlambert_vert:Tl,meshlambert_frag:yl,meshmatcap_vert:Al,meshmatcap_frag:bl,meshnormal_vert:Rl,meshnormal_frag:Cl,meshphong_vert:wl,meshphong_frag:Pl,meshphysical_vert:Ll,meshphysical_frag:Dl,meshtoon_vert:Ul,meshtoon_frag:Il,points_vert:Fl,points_frag:Nl,shadow_vert:Ol,shadow_frag:Bl,sprite_vert:Gl,sprite_frag:zl},ie={common:{diffuse:{value:new Be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Le}},envmap:{envMap:{value:null},envMapRotation:{value:new Le},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Le}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Le}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Le},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Le},normalScale:{value:new Ne(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Le},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Le}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Le}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Le}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0},uvTransform:{value:new Le}},sprite:{diffuse:{value:new Be(16777215)},opacity:{value:1},center:{value:new Ne(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}}},Pt={basic:{uniforms:ft([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.fog]),vertexShader:Pe.meshbasic_vert,fragmentShader:Pe.meshbasic_frag},lambert:{uniforms:ft([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new Be(0)}}]),vertexShader:Pe.meshlambert_vert,fragmentShader:Pe.meshlambert_frag},phong:{uniforms:ft([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new Be(0)},specular:{value:new Be(1118481)},shininess:{value:30}}]),vertexShader:Pe.meshphong_vert,fragmentShader:Pe.meshphong_frag},standard:{uniforms:ft([ie.common,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.roughnessmap,ie.metalnessmap,ie.fog,ie.lights,{emissive:{value:new Be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag},toon:{uniforms:ft([ie.common,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.gradientmap,ie.fog,ie.lights,{emissive:{value:new Be(0)}}]),vertexShader:Pe.meshtoon_vert,fragmentShader:Pe.meshtoon_frag},matcap:{uniforms:ft([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,{matc
vendor: 5,263 bytes, line 3589
3589ap:{value:null}}]),vertexShader:Pe.meshmatcap_vert,fragmentShader:Pe.meshmatcap_frag},points:{uniforms:ft([ie.points,ie.fog]),vertexShader:Pe.points_vert,fragmentShader:Pe.points_frag},dashed:{uniforms:ft([ie.common,ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pe.linedashed_vert,fragmentShader:Pe.linedashed_frag},depth:{uniforms:ft([ie.common,ie.displacementmap]),vertexShader:Pe.depth_vert,fragmentShader:Pe.depth_frag},normal:{uniforms:ft([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,{opacity:{value:1}}]),vertexShader:Pe.meshnormal_vert,fragmentShader:Pe.meshnormal_frag},sprite:{uniforms:ft([ie.sprite,ie.fog]),vertexShader:Pe.sprite_vert,fragmentShader:Pe.sprite_frag},background:{uniforms:{uvTransform:{value:new Le},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Pe.background_vert,fragmentShader:Pe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Le}},vertexShader:Pe.backgroundCube_vert,fragmentShader:Pe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pe.cube_vert,fragmentShader:Pe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pe.equirect_vert,fragmentShader:Pe.equirect_frag},distanceRGBA:{uniforms:ft([ie.common,ie.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pe.distanceRGBA_vert,fragmentShader:Pe.distanceRGBA_frag},shadow:{uniforms:ft([ie.lights,ie.fog,{color:{value:new Be(0)},opacity:{value:1}}]),vertexShader:Pe.shadow_vert,fragmentShader:Pe.shadow_frag}};Pt.physical={uniforms:ft([Pt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Le},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Le},clearcoatNormalScale:{value:new Ne(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Le},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Le},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Le},sheen:{value:0},sheenColor:{value:new Be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Le},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Le},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Le},transmissionSamplerSize:{value:new Ne},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Le},attenuationDistance:{value:0},attenuationColor:{value:new Be(0)},specularColor:{value:new Be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Le},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Le},anisotropyVector:{value:new Ne},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Le}}]),vertexShader:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag};const di={r:0,b:0,g:0},sn=new It,Hl=new Je;function Vl(i,e,t,n,r,s,a){const o=new Be(0);let l=s===!0?0:1,c,h,p=null,f=0,m=null;function x(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function M(A){let E=!1;const y=x(A);y===null?u(o,l):y&&y.isColor&&(u(y,1),E=!0);const G=i.xr.getEnvironmentBlendMode();G==="additive"?n.buffers.color.setClear(0,0,0,1,a):G==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function d(A,E){const y=x(E);y&&(y.isCubeTexture||y.mapping===306)?(h===void 0&&(h=new Ht(new Xn(1,1,1),new Zt({name:"BackgroundCubeMaterial",uniforms:Pn(Pt.backgroundCube.uniforms),vertexShader:Pt.backgroundCube.vertexShader,fragmentShader:Pt.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(G,R,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),sn.copy(E.backgroundRotation),sn.x*=-1,sn.y*=-1,sn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(sn.y*=-1,sn.z*=-1),h.material.uniforms.envMap.value=y,h.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Hl.makeRotationFromEuler(sn)),h.material.toneMapped=ke.getTransfer(y.colorSpace)!==Ye,(p!==y||f!==y.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,p=y,f=y.version,m=i.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Ht(new Ei(2,2),new Zt({name:"Backgroun
3589dMaterial",uniforms:Pn(Pt.background.uniforms),vertexShader:Pt.background.vertexShader,fragmentShader:Pt.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=ke.getTransfer(y.colorSpace)!==Ye,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(p!==y||f!==y.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,p=y,f=y.version,m=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function u(A,E){A.getRGB(di,_s(i)),n.buffers.color.setClear(di.r,di.g,di.b,E,a)}return{getClearColor:function(){return o},setClearColor:function(A,E=1){o.set(A),l=E,u(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,u(o,l)},render:M,addToRenderList:d}}function kl(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(v,P,X,B,V){let Z=!1;const H=p(B,X,P);s!==H&&(s=H,c(s.object)),Z=m(v,B,X,V),Z&&x(v,B,X,V),V!==null&&e.update(V,i.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,y(v,P,X,B),V!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function l(){return i.createVertexArray()}function c(v){return i.bindVertexArray(v)}function h(v){return i.deleteVertexArray(v)}function p(v,P,X){const B=X.wireframe===!0;let V=n[v.id];V===void 0&&(V={},n[v.id]=V);let Z=V[P.id];Z===void 0&&(Z={},V[P.id]=Z);let H=Z[B];return H===void 0&&(H=f(l()),Z[B]=H),H}function f(v){const P=[],X=[],B=[];for(let V=0;V<t;V++)P[V]=0,X[V]=0,B[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:X,attributeDivisors:B,object:v,attributes:{},index:null}}function m(v,P,X,B){const V=s.attributes,Z=P.attributes;let H=0;const j=X.getAttributes();for(const z in j)if(j[z].location>=0){const ue=V[z];let me=Z[z];if(me===void 0&&(z==="instanceMatrix"&&v.instanceMatrix&&(me=v.instanceMatrix),z==="instanceColor"&&v.instanceColor&&(me=v.instanceColor)),ue===void 0||ue.attribute!==me||me&&ue.data!==me.data)return!0;H++}return s.attributesNum!==H||s.index!==B}function x(v,P,X,B){const V={},Z=P.attributes;let H=0;const j=X.getAttributes();for(const z in j)if(j[z].location>=0){let ue=Z[z];ue===void 0&&(z==="instanceMatrix"&&v.instanceMatrix&&(ue=v.instanceMatrix),z==="instanceColor"&&v.instanceColor&&(ue=v.instanceColor));const me={};me.attribute=ue,ue&&ue.data&&(me.data=ue.data),V[z]=me,H++}s.attributes=V,s.attributesNum=H,s.index=B}function M(){const v=s.newAttributes;for(let P=0,X=v.length;P<X;P++)v[P]=0}function d(v){u(v,0)}function u(v,P){const X=s.newAttributes,B=s.enabledAttributes,V=s.attributeDivisors;X[v]=1,B[v]===0&&(i.enableVertexAttribArray(v),B[v]=1),V[v]!==P&&(i.vertexAttribDivisor(v,P),V[v]=P)}function A(){const v=s.newAttributes,P=s.enabledAttributes;for(let X=0,B=P.length;X<B;X++)P[X]!==v[X]&&(i.disableVertexAttribArray(X),P[X]=0)}function E(v,P,X,B,V,Z,H){H===!0?i.vertexAttribIPointer(v,P,X,V,Z):i.vertexAttribPointer(v,P,X,B,V,Z)}function y(v,P,X,B){M();const V=B.attributes,Z=X.getAttributes(),H=P.defaultAttributeValues;for(const j in Z){const z=Z[j];if(z.location>=0){let ae=V[j];if(ae===void 0&&(j==="instanceMatrix"&&v.instanceMatrix&&(ae=v.instanceMatrix),j==="instanceColor"&&v.instanceColor&&(ae=v.instanceColor)),ae!==void 0){const ue=ae.normalized,me=ae.itemSize,Ie=e.get(ae);if(Ie===void 0)continue;const Xe=Ie.buffer,k=Ie.type,J=Ie.bytesPerElement,pe=k===i.INT||k===i.UNSIGNED_INT||ae.gpuType===1013;if(ae.isInterleavedBufferAttribute){const le=ae.data,Ee=le.stride,Re=ae.offset;if(le.isInstancedInterleavedBuffer){for(let Ue=0;Ue<z.locationSize;Ue++)u(z.location+Ue,le.meshPerAttribute);v.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let Ue=0;Ue<z.locationSize;Ue++)d(z.location+Ue);i.bindBuffer(i.ARRAY_BUFFER,Xe);for(let Ue=0;Ue<z.locationSize;Ue++)E(z.location+Ue,me/z.locationSize,k,ue,Ee*J,(Re+me/z.locationSize*Ue)*J,pe)}else{if(ae.isInstancedBufferAttribute){for(let le=0;le<z.locationSize;le++)u(z.location+le,ae.meshPerAttribute);v.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ae.meshPerAttribute*ae.count)}else for(let le=0;le<z.locationSize;le++)d(z.location+le);i.bindBuffer(i.ARRAY_BUFFER,Xe);for(let le=0;le<z.locationSize;le++)E(z.location+le,me/z.locationSize,k,ue,me*J,me/z.locationSize*le*J,pe)}}else if(H!==void 0){const ue=H[j];if(ue!==void 0)switch(ue.length){case 2:i.vertexAttrib2fv(z.location,ue);break;case 3:i.vertexAttrib3fv(z.location,ue);break;case 4:i.vertexAttrib4fv(z.location,ue);break;default:i.vertexAttrib1fv(z.location,ue)}}}}A()}function G(){O();for(const v in n){const P=n[v];for(const X in P){const B=P[X];for(const V in B)h(B[V].object),delete B[V];delete P[X]}delete n[v]}}function R(v){if(n[v.id]===void 0)return;const P=n[v.id];for(const X in P){const B=P[X];for(const V in B)h(B[V].object),delete B[V];delete P[X]}delete n[v.id]}function C(v){for(const P in n){const X=n[P];if(X[v.id]===void 0)continue;const B=X[v.id];for(const V in B)h(B[V].object),delete B[V];delete X[v.id]}}function O(){S(),a=!0,s!==r&&(s=r,c(s.object))}function S(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:O,resetDefaultState:S,dispose:G,releaseStatesOfGeometry:R,releaseStatesOfProgram:C,initAttributes:M,enableAttribute:d,disableUnusedAttributes:A}}function Wl(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,p){p!==0&&(i.drawArraysInstanced(n,c,h,p),t.update(h,n,p))}function o(c,h,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,p);let m=0;for(let x=0;x<p;x++)m+=h[x];t.update(m,n,1)}function l(c,h,p,f){if(p===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let x=0;x<c.length;x++)a(c[x],h[x],f[x]);
vendor: 8,700 bytes, line 3589
3589else{m.multiDrawArraysInstancedWEBGL(n,c,0,h,0,f,0,p);let x=0;for(let M=0;M<p;M++)x+=h[M];for(let M=0;M<f.length;M++)t.update(x,n,f[M])}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Xl(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(R){return!(R!==1023&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const C=R===1016&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==1009&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==1015&&!C)}function l(R){if(R==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="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 h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const p=t.logarithmicDepthBuffer===!0,f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_TEXTURE_SIZE),M=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),u=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),E=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),y=m>0,G=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:p,maxTextures:f,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:M,maxAttributes:d,maxVertexUniforms:u,maxVaryings:A,maxFragmentUniforms:E,vertexTextures:y,maxSamples:G}}function ql(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new on,o=new Le,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(p,f){const m=p.length!==0||f||n!==0||r;return r=f,n=p.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,f){t=h(p,f,0)},this.setState=function(p,f,m){const x=p.clippingPlanes,M=p.clipIntersection,d=p.clipShadows,u=i.get(p);if(!r||x===null||x.length===0||s&&!d)s?h(null):c();else{const A=s?0:n,E=A*4;let y=u.clippingState||null;l.value=y,y=h(x,f,E,m);for(let G=0;G!==E;++G)y[G]=t[G];u.clippingState=y,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(p,f,m,x){const M=p!==null?p.length:0;let d=null;if(M!==0){if(d=l.value,x!==!0||d===null){const u=m+M*4,A=f.matrixWorldInverse;o.getNormalMatrix(A),(d===null||d.length<u)&&(d=new Float32Array(u));for(let E=0,y=m;E!==M;++E,y+=4)a.copy(p[E]).applyMatrix4(A,o),a.normal.toArray(d,y),d[y+3]=a.constant}l.value=d,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,d}}function Yl(i){let e=new WeakMap;function t(a,o){return o===303?a.mapping=301:o===304&&(a.mapping=302),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===303||o===304)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new ia(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ms extends gs{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,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),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}}const Cn=4,Nr=[.125,.215,.35,.446,.526,.582],cn=20,Ki=new Ms,Or=new Be;let $i=null,Zi=0,ji=0,Ji=!1;const ln=(1+Math.sqrt(5))/2,Rn=1/ln,Br=[new F(-ln,Rn,0),new F(ln,Rn,0),new F(-Rn,0,ln),new F(Rn,0,ln),new F(0,ln,-Rn),new F(0,ln,Rn),new F(-1,1,-1),new F(1,1,-1),new F(-1,1,1),new F(1,1,1)];class Gr{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){$i=this._renderer.getRenderTarget(),Zi=this._renderer.getActiveCubeFace(),ji=this._renderer.getActiveMipmapLevel(),Ji=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Vr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Hr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget($i,Zi,ji),this._renderer.xr.enabled=Ji,e.scissorTest=!1,fi(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),$i=this._renderer.getRenderTarget(),Zi=this._renderer.getActiveCubeFace(),ji=this._renderer.getActiveMipmapLevel(),Ji=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:jt,depthBuffer:!1},r=zr(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=zr(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Kl(s)),this._blurMaterial=$l(s,e,t)}return r}_compileMaterial(e){const t=new Ht(this._lodPlanes[0],e);this._renderer.compile(t,Ki)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,p=h.autoClear,f=h.toneMapping;h.getClearColor(Or),h.toneMapping=0,h.autoClear=!1;
vendor: 5,419 bytes, lines 3589-3664
3589const m=new fs({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),x=new Ht(new Xn,m);let M=!1;const d=e.background;d?d.isColor&&(m.color.copy(d),e.background=null,M=!0):(m.color.copy(Or),M=!0);for(let u=0;u<6;u++){const A=u%3;A===0?(o.up.set(0,l[u],0),o.lookAt(c[u],0,0)):A===1?(o.up.set(0,0,l[u]),o.lookAt(0,c[u],0)):(o.up.set(0,l[u],0),o.lookAt(0,0,c[u]));const E=this._cubeSize;fi(r,A*E,u>2?E:0,E,E),h.setRenderTarget(r),M&&h.render(x,o),h.render(e,o)}x.geometry.dispose(),x.material.dispose(),h.toneMapping=f,h.autoClear=p,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Vr()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Hr());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Ht(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;fi(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Ki)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Br[(r-s-1)%Br.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_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"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,p=new Ht(this._lodPlanes[r],c),f=c.uniforms,m=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*cn-1),M=s/x,d=isFinite(s)?1+Math.floor(h*M):cn;d>cn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${cn}`);const u=[];let A=0;for(let C=0;C<cn;++C){const O=C/M,S=Math.exp(-O*O/2);u.push(S),C===0?A+=S:C<d&&(A+=2*S)}for(let C=0;C<u.length;C++)u[C]=u[C]/A;f.envMap.value=e.texture,f.samples.value=d,f.weights.value=u,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:E}=this;f.dTheta.value=x,f.mipInt.value=E-n;const y=this._sizeLods[r],G=3*y*(r>E-Cn?r-E+Cn:0),R=4*(this._cubeSize-y);fi(t,G,R,3*y,2*y),l.setRenderTarget(t),l.render(p,Ki)}}function Kl(i){const e=[],t=[],n=[];let r=i;const s=i-Cn+1+Nr.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-Cn?l=Nr[a-i+Cn-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,p=1+c,f=[h,h,p,h,p,p,h,h,p,p,h,p],m=6,x=6,M=3,d=2,u=1,A=new Float32Array(M*x*m),E=new Float32Array(d*x*m),y=new Float32Array(u*x*m);for(let R=0;R<m;R++){const C=R%3*2/3-1,O=R>2?0:-1,S=[C,O,0,C+2/3,O,0,C+2/3,O+1,0,C,O,0,C+2/3,O+1,0,C,O+1,0];A.set(S,M*x*R),E.set(f,d*x*R);const v=[R,R,R,R,R,R];y.set(v,u*x*R)}const G=new Jt;G.setAttribute("position",new Dt(A,M)),G.setAttribute("uv",new Dt(E,d)),G.setAttribute("faceIndex",new Dt(y,u)),e.push(G),r>Cn&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function zr(i,e,t){const n=new un(i,e,t);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function fi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function $l(i,e,t){const n=new Float32Array(cn),r=new F(0,1,0);return new Zt({name:"SphericalGaussianBlur",defines:{n:cn,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:lr(),fragmentShader:` 3590 3591 precision mediump float; 3592 precision mediump int; 3593 3594 varying vec3 vOutputDirection; 3595 3596 uniform sampler2D envMap; 3597 uniform int samples; 3598 uniform float weights[ n ]; 3599 uniform bool latitudinal; 3600 uniform float dTheta; 3601 uniform float mipInt; 3602 uniform vec3 poleAxis; 3603 3604 #define ENVMAP_TYPE_CUBE_UV 3605 #include <cube_uv_reflection_fragment> 3606 3607 vec3 getSample( float theta, vec3 axis ) { 3608 3609 float cosTheta = cos( theta ); 3610 // Rodrigues' axis-angle rotation 3611 vec3 sampleDirection = vOutputDirection * cosTheta 3612 + cross( axis, vOutputDirection ) * sin( theta ) 3613 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3614 3615 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3616 3617 } 3618 3619 void main() { 3620 3621 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3622 3623 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3624 3625 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3626 3627 } 3628 3629 axis = normalize( axis ); 3630 3631 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3632 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3633 3634 for ( int i = 1; i < n; i++ ) { 3635 3636 if ( i >= samples ) { 3637 3638 break; 3639 3640 } 3641 3642 float theta = dTheta * float( i ); 3643 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3644 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3645 3646 } 3647 3648 } 3649 `,blending:0,depthTest:!1,depthWrite:!1})}function Hr(){return new Zt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lr(),fragmentShader:` 3650 3651 precision mediump float; 3652 precision mediump int; 3653 3654 varying vec3 vOutputDirection; 3655 3656 uniform sampler2D envMap; 3657 3658 #include <common> 3659 3660 void main() { 3661 3662 vec3 outputDirection = normalize( vOutputDirection ); 3663 vec2 uv = equirectUv( outputDirection ); 3664
3665 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3666 3667 } 3668 `,blending:0,depthTest:!1,depthWrite:!1})}function Vr(){return new Zt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lr(),fragmentShader:` 3669 3670 precision mediump float; 3671 precision mediump int; 3672 3673 uniform float flipEnvMap; 3674 3675 varying vec3 vOutputDirection; 3676 3677 uniform samplerCube envMap; 3678 3679 void main() { 3680 3681 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3682 3683 } 3684 `,blending:0,depthTest:!1,depthWrite:!1})}function lr(){return` 3685 3686 precision mediump float; 3687 precision mediump int; 3688 3689 attribute float faceIndex; 3690 3691 varying vec3 vOutputDirection; 3692 3693 // RH coordinate system; PMREM face-indexing convention 3694 vec3 getDirection( vec2 uv, float face ) { 3695 3696 uv = 2.0 * uv - 1.0; 3697 3698 vec3 direction = vec3( uv, 1.0 ); 3699 3700 if ( face == 0.0 ) { 3701 3702 direction = direction.zyx; // ( 1, v, u ) pos x 3703 3704 } else if ( face == 1.0 ) { 3705 3706 direction = direction.xzy; 3707 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3708 3709 } else if ( face == 2.0 ) { 3710 3711 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3712 3713 } else if ( face == 3.0 ) { 3714 3715 direction = direction.zyx; 3716 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3717 3718 } else if ( face == 4.0 ) { 3719 3720 direction = direction.xzy; 3721 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3722 3723 } else if ( face == 5.0 ) { 3724 3725 direction.z *= -1.0; // ( u, v, -1 ) neg z 3726 3727 } 3728 3729 return direction; 3730 3731 } 3732 3733 void main() { 3734 3735 vOutputDirection = getDirection( uv, faceIndex ); 3736 gl_Position = vec4( position, 1.0 ); 3737 3738 } 3739 `}function Zl(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===303||l===304,h=l===301||l===302;if(c||h){let p=e.get(o);const f=p!==void 0?p.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new Gr(i)),p=c?t.fromEquirectangular(o,p):t.fromCubemap(o,p),p.texture.pmremVersion=o.pmremVersion,e.set(o,p),p.texture;if(p!==void 0)return p.texture;{const m=o.image;return c&&m&&m.height>0||h&&m&&r(m)?(t===null&&(t=new Gr(i)),p=c?t.fromEquirectangular(o):t.fromCubemap(o),p.texture.pmremVersion=o.pmremVersion,e.set(o,p),o.addEventListener("dispose",s),p.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function jl(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default: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&&zn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Jl(i,e,t,n){const r={},s=new WeakMap;function a(p){const f=p.target;f.index!==null&&e.remove(f.index);for(const x in f.attributes)e.remove(f.attributes[x]);for(const x in f.morphAttributes){const M=f.morphAttributes[x];for(let d=0,u=M.length;d<u;d++)e.remove(M[d])}f.removeEventListener("dispose",a),delete r[f.id];const m=s.get(f);m&&(e.remove(m),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(p,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(p){const f=p.attributes;for(const x in f)e.update(f[x],i.ARRAY_BUFFER);const m=p.morphAttributes;for(const x in m){const M=m[x];for(let d=0,u=M.length;d<u;d++)e.update(M[d],i.ARRAY_BUFFER)}}function c(p){const f=[],m=p.index,x=p.attributes.position;let M=0;if(m!==null){const A=m.array;M=m.version;for(let E=0,y=A.length;E<y;E+=3){const G=A[E+0],R=A[E+1],C=A[E+2];f.push(G,R,R,C,C,G)}}else if(x!==void 0){const A=x.array;M=x.version;for(let E=0,y=A.length/3-1;E<y;E+=3){const G=E+0,R=E+1,C=E+2;f.push(G,R,R,C,C,G)}}else return;const d=new(ls(f)?ms:ps)(f,1);d.version=M;const u=s.get(p);u&&e.remove(u),s.set(p,d)}function h(p){const f=s.get(p);if(f){const m=p.index;m!==null&&f.version<m.version&&c(p)}
vendor: 5,154 bytes, line 3739
3739else c(p);return s.get(p)}return{get:o,update:l,getWireframeAttribute:h}}function Ql(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,m){i.drawElements(n,m,s,f*a),t.update(m,n,1)}function c(f,m,x){x!==0&&(i.drawElementsInstanced(n,m,s,f*a,x),t.update(m,n,x))}function h(f,m,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,s,f,0,x);let d=0;for(let u=0;u<x;u++)d+=m[u];t.update(d,n,1)}function p(f,m,x,M){if(x===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let u=0;u<f.length;u++)c(f[u]/a,m[u],M[u]);else{d.multiDrawElementsInstancedWEBGL(n,m,0,s,f,0,M,0,x);let u=0;for(let A=0;A<x;A++)u+=m[A];for(let A=0;A<M.length;A++)t.update(u,n,M[A])}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=p}function ec(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:console.error("THREE.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 tc(i,e,t){const n=new WeakMap,r=new rt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,p=h!==void 0?h.length:0;let f=n.get(o);if(f===void 0||f.count!==p){let S=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",S)};f!==void 0&&f.texture.dispose();const m=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,M=o.morphAttributes.color!==void 0,d=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],A=o.morphAttributes.color||[];let E=0;m===!0&&(E=1),x===!0&&(E=2),M===!0&&(E=3);let y=o.attributes.position.count*E,G=1;y>e.maxTextureSize&&(G=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const R=new Float32Array(y*G*4*p),C=new us(R,y,G,p);C.type=1015,C.needsUpdate=!0;const O=E*4;for(let v=0;v<p;v++){const P=d[v],X=u[v],B=A[v],V=y*G*4*v;for(let Z=0;Z<P.count;Z++){const H=Z*O;m===!0&&(r.fromBufferAttribute(P,Z),R[V+H+0]=r.x,R[V+H+1]=r.y,R[V+H+2]=r.z,R[V+H+3]=0),x===!0&&(r.fromBufferAttribute(X,Z),R[V+H+4]=r.x,R[V+H+5]=r.y,R[V+H+6]=r.z,R[V+H+7]=0),M===!0&&(r.fromBufferAttribute(B,Z),R[V+H+8]=r.x,R[V+H+9]=r.y,R[V+H+10]=r.z,R[V+H+11]=B.itemSize===4?r.w:1)}}f={count:p,texture:C,size:new Ne(y,G)},n.set(o,f),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let m=0;for(let M=0;M<c.length;M++)m+=c[M];const x=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(i,"morphTargetBaseInfluence",x),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function nc(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,p=e.get(l,h);if(r.get(p)!==c&&(e.update(p),r.set(p,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return p}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class Ss extends _t{constructor(e,t,n,r,s,a,o,l,c,h=1026){if(h!==1026&&h!==1027)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===1026&&(n=1014),n===void 0&&h===1027&&(n=1020),super(null,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:1003,this.minFilter=l!==void 0?l:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const Es=new _t,kr=new Ss(1,1),Ts=new us,ys=new zs,As=new vs,Wr=[],Xr=[],qr=new Float32Array(16),Yr=new Float32Array(9),Kr=new Float32Array(4);function Dn(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Wr[r];if(s===void 0&&(s=new Float32Array(r),Wr[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 st(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 at(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ti(i,e){let t=Xr[e];t===void 0&&(t=new Int32Array(e),Xr[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function ic(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function rc(i,e){const t=this.cache;
vendor: 4,868 bytes, line 3739
3739if(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(st(t,e))return;i.uniform2fv(this.addr,e),at(t,e)}}function sc(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(st(t,e))return;i.uniform3fv(this.addr,e),at(t,e)}}function ac(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(st(t,e))return;i.uniform4fv(this.addr,e),at(t,e)}}function oc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;Kr.set(n),i.uniformMatrix2fv(this.addr,!1,Kr),at(t,n)}}function lc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;Yr.set(n),i.uniformMatrix3fv(this.addr,!1,Yr),at(t,n)}}function cc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(st(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),at(t,e)}else{if(st(t,n))return;qr.set(n),i.uniformMatrix4fv(this.addr,!1,qr),at(t,n)}}function uc(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function hc(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(st(t,e))return;i.uniform2iv(this.addr,e),at(t,e)}}function dc(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(st(t,e))return;i.uniform3iv(this.addr,e),at(t,e)}}function fc(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(st(t,e))return;i.uniform4iv(this.addr,e),at(t,e)}}function pc(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function mc(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(st(t,e))return;i.uniform2uiv(this.addr,e),at(t,e)}}function _c(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(st(t,e))return;i.uniform3uiv(this.addr,e),at(t,e)}}function gc(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(st(t,e))return;i.uniform4uiv(this.addr,e),at(t,e)}}function vc(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?(kr.compareFunction=515,s=kr):s=Es,t.setTexture2D(e||s,r)}function xc(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||ys,r)}function Mc(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||As,r)}function Sc(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Ts,r)}function Ec(i){switch(i){case 5126:return ic;case 35664:return rc;case 35665:return sc;case 35666:return ac;case 35674:return oc;case 35675:return lc;case 35676:return cc;case 5124:case 35670:return uc;case 35667:case 35671:return hc;case 35668:case 35672:return dc;case 35669:case 35673:return fc;case 5125:return pc;case 36294:return mc;case 36295:return _c;case 36296:return gc;case 35678:case 36198:case 36298:case 36306:case 35682:return vc;case 35679:case 36299:case 36307:return xc;case 35680:case 36300:case 36308:case 36293:return Mc;case 36289:case 36303:case 36311:case 36292:return Sc}}function Tc(i,e){i.uniform1fv(this.addr,e)}function yc(i,e){const t=Dn(e,this.size,2);i.uniform2fv(this.addr,t)}function Ac(i,e){const t=Dn(e,this.size,3);i.uniform3fv(this.addr,t)}function bc(i,e){const t=Dn(e,this.size,4);i.uniform4fv(this.addr,t)}function Rc(i,e){const t=Dn(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Cc(i,e){const t=Dn(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function wc(i,e){const t=Dn(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Pc(i,e){i.uniform1iv(this.addr,e)}function Lc(i,e){i.uniform2iv(this.addr,e)}function Dc(i,e){i.uniform3iv(this.addr,e)}function Uc(i,e){i.uniform4iv(this.addr,e)}function Ic(i,e){i.uniform1uiv(this.addr,e)}function Fc(i,e){i.uniform2uiv(this.addr,e)}function Nc(i,e){i.uniform3uiv(this.addr,e)}function Oc(i,e){i.uniform4uiv(this.addr,e)}function Bc(i,e,t){const n=this.cache,r=e.length,s=Ti(t,r);
vendor: 8,668 bytes, lines 3739-3773
3739st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Es,s[a])}function Gc(i,e,t){const n=this.cache,r=e.length,s=Ti(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||ys,s[a])}function zc(i,e,t){const n=this.cache,r=e.length,s=Ti(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||As,s[a])}function Hc(i,e,t){const n=this.cache,r=e.length,s=Ti(t,r);st(n,s)||(i.uniform1iv(this.addr,s),at(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Ts,s[a])}function Vc(i){switch(i){case 5126:return Tc;case 35664:return yc;case 35665:return Ac;case 35666:return bc;case 35674:return Rc;case 35675:return Cc;case 35676:return wc;case 5124:case 35670:return Pc;case 35667:case 35671:return Lc;case 35668:case 35672:return Dc;case 35669:case 35673:return Uc;case 5125:return Ic;case 36294:return Fc;case 36295:return Nc;case 36296:return Oc;case 35678:case 36198:case 36298:case 36306:case 35682:return Bc;case 35679:case 36299:case 36307:return Gc;case 35680:case 36300:case 36308:case 36293:return zc;case 36289:case 36303:case 36311:case 36292:return Hc}}class kc{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Ec(t.type)}}class Wc{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Vc(t.type)}}class Xc{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 Qi=/(\w+)(\])?(\[|\.)?/g;function $r(i,e){i.seq.push(e),i.map[e.id]=e}function qc(i,e,t){const n=i.name,r=n.length;for(Qi.lastIndex=0;;){const s=Qi.exec(n),a=Qi.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){$r(t,c===void 0?new kc(o,i,e):new Wc(o,i,e));break}else{let p=t.map[o];p===void 0&&(p=new Xc(o),$r(t,p)),t=p}}}class _i{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);qc(s,a,this)}}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 Zr(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Yc=37297;let Kc=0;function $c(i,e){const t=i.split(` 3740`),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(` 3741`)}function Zc(i){const e=ke.getPrimaries(ke.workingColorSpace),t=ke.getPrimaries(i);let n;switch(e===t?n="":e===xi&&t===vi?n="LinearDisplayP3ToLinearSRGB":e===vi&&t===xi&&(n="LinearSRGBToLinearDisplayP3"),i){case jt:case Si:return[n,"LinearTransferOETF"];case wt:case sr:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function jr(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3742 3743`+r+` 3744 3745`+$c(i.getShaderSource(e),a)}else return r}function jc(i,e){const t=Zc(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Jc(i,e){let t;switch(e){case 1:t="Linear";break;case 2:t="Reinhard";break;case 3:t="Cineon";break;case 4:t="ACESFilmic";break;case 6:t="AgX";break;case 7:t="Neutral";break;case 5:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const pi=new F;function Qc(){ke.getLuminanceCoefficients(pi);const i=pi.x.toFixed(4),e=pi.y.toFixed(4),t=pi.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3746`)}function eu(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Gn).join(` 3747`)}function tu(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3748`)}function nu(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 Gn(i){return i!==""}function Jr(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 Qr(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const iu=/^[ \t]*#include +<([\w\d./]+)>/gm;function ir(i){return i.replace(iu,su)}const ru=new Map;function su(i,e){let t=Pe[e];if(t===void 0){const n=ru.get(e);if(n!==void 0)t=Pe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return ir(t)}const au=/#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 es(i){return i.replace(au,ou)}function ou(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 ts(i){let e=`precision ${i.precision} float; 3749 precision ${i.precision} int; 3750 precision ${i.precision} sampler2D; 3751 precision ${i.precision} samplerCube; 3752 precision ${i.precision} sampler3D; 3753 precision ${i.precision} sampler2DArray; 3754 precision ${i.precision} sampler2DShadow; 3755 precision ${i.precision} samplerCubeShadow; 3756 precision ${i.precision} sampler2DArrayShadow; 3757 precision ${i.precision} isampler2D; 3758 precision ${i.precision} isampler3D; 3759 precision ${i.precision} isamplerCube; 3760 precision ${i.precision} isampler2DArray; 3761 precision ${i.precision} usampler2D; 3762 precision ${i.precision} usampler3D; 3763 precision ${i.precision} usamplerCube; 3764 precision ${i.precision} usampler2DArray; 3765 `;return i.precision==="highp"?e+=` 3766#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3767#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3768#define LOW_PRECISION`),e}function lu(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===1?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===2?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===3&&(e="SHADOWMAP_TYPE_VSM"),e}function cu(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:e="ENVMAP_TYPE_CUBE_UV";break}return e}function uu(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case 302:e="ENVMAP_MODE_REFRACTION";break}return e}function hu(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD";break}return e}function du(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 fu(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=lu(t),c=cu(t),h=uu(t),p=hu(t),f=du(t),m=eu(t),x=tu(s),M=r.createProgram();let d,u,A=t.glslVersion?"#version "+t.glslVersion+` 3769`:"";t.isRawShaderMaterial?(d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Gn).join(` 3770`),d.length>0&&(d+=` 3771`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Gn).join(` 3772`),u.length>0&&(u+=` 3773`)):(d=[ts(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.extensionCl
vendor: 5,713 bytes, lines 3773-3775
3773ipCullDistance?"#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 "+h:"",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.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_LOGDEPTHBUF":"","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",` 3774`].filter(Gn).join(` 3775`),u=[ts(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 "+h:"",t.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.max
vendor: 4,181 bytes, lines 3775-3782
3775Mip+".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.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_IRIDESCENCE":"",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||t.batchingColor?"#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.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.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==0?"#define TONE_MAPPING":"",t.toneMapping!==0?Pe.tonemapping_pars_fragment:"",t.toneMapping!==0?Jc("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Pe.colorspace_pars_fragment,jc("linearToOutputTexel",t.outputColorSpace),Qc(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3776`].filter(Gn).join(` 3777`)),a=ir(a),a=Jr(a,t),a=Qr(a,t),o=ir(o),o=Jr(o,t),o=Qr(o,t),a=es(a),o=es(o),t.isRawShaderMaterial!==!0&&(A=`#version 300 es 3778`,d=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3779`)+` 3780`+d,u=["#define varying in",t.glslVersion===_r?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===_r?"":"#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(` 3781`)+` 3782`+u);const E=A+d+a,y=A+u+o,G=Zr(r,r.VERTEX_SHADER,E),R=Zr(r,r.FRAGMENT_SHADER,y);r.attachShader(M,G),r.attachShader(M,R),t.index0AttributeName!==void 0?r.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);function C(P){if(i.debug.checkShaderErrors){const X=r.getProgramInfoLog(M).trim(),B=r.getShaderInfoLog(G).trim(),V=r.getShaderInfoLog(R).trim();let Z=!0,H=!0;if(r.getProgramParameter(M,r.LINK_STATUS)===!1)if(Z=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,M,G,R);else{const j=jr(r,G,"vertex"),z=jr(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(
vendor: 5,402 bytes, lines 3782-3789
3782M,r.VALIDATE_STATUS)+` 3783 3784Material Name: `+P.name+` 3785Material Type: `+P.type+` 3786 3787Program Info Log: `+X+` 3788`+j+` 3789`+z)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(B===""||V==="")&&(H=!1);H&&(P.diagnostics={runnable:Z,programLog:X,vertexShader:{log:B,prefix:d},fragmentShader:{log:V,prefix:u}})}r.deleteShader(G),r.deleteShader(R),O=new _i(r,M),S=nu(r,M)}let O;this.getUniforms=function(){return O===void 0&&C(this),O};let S;this.getAttributes=function(){return S===void 0&&C(this),S};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=r.getProgramParameter(M,Yc)),v},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Kc++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=G,this.fragmentShader=R,this}let pu=0;class mu{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.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}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}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 _u(e),t.set(e,n)),n}}class _u{constructor(e){this.id=pu++,this.code=e,this.usedTimes=0}}function gu(i,e,t,n,r,s,a){const o=new hs,l=new mu,c=new Set,h=[],p=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 M(S){return c.add(S),S===0?"uv":`uv${S}`}function d(S,v,P,X,B){const V=X.fog,Z=B.geometry,H=S.isMeshStandardMaterial?X.environment:null,j=(S.isMeshStandardMaterial?t:e).get(S.envMap||H),z=!!j&&j.mapping===306?j.image.height:null,ae=x[S.type];S.precision!==null&&(m=r.getMaxPrecision(S.precision),m!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const ue=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,me=ue!==void 0?ue.length:0;let Ie=0;Z.morphAttributes.position!==void 0&&(Ie=1),Z.morphAttributes.normal!==void 0&&(Ie=2),Z.morphAttributes.color!==void 0&&(Ie=3);let Xe,k,J,pe;if(ae){const Ge=Pt[ae];Xe=Ge.vertexShader,k=Ge.fragmentShader}else Xe=S.vertexShader,k=S.fragmentShader,l.update(S),J=l.getVertexShaderID(S),pe=l.getFragmentShaderID(S);const le=i.getRenderTarget(),Ee=B.isInstancedMesh===!0,Re=B.isBatchedMesh===!0,Ue=!!S.map,$e=!!S.matcap,b=!!j,Qe=!!S.aoMap,We=!!S.lightMap,qe=!!S.bumpMap,ve=!!S.normalMap,et=!!S.displacementMap,Ae=!!S.emissiveMap,Ce=!!S.metalnessMap,T=!!S.roughnessMap,_=S.anisotropy>0,N=S.clearcoat>0,Y=S.dispersion>0,$=S.iridescence>0,K=S.sheen>0,xe=S.transmission>0,re=_&&!!S.anisotropyMap,ce=N&&!!S.clearcoatMap,we=N&&!!S.clearcoatNormalMap,Q=N&&!!S.clearcoatRoughnessMap,oe=$&&!!S.iridescenceMap,Fe=$&&!!S.iridescenceThicknessMap,ye=K&&!!S.sheenColorMap,he=K&&!!S.sheenRoughnessMap,be=!!S.specularMap,De=!!S.specularColorMap,Ke=!!S.specularIntensityMap,w=xe&&!!S.transmissionMap,ee=xe&&!!S.thicknessMap,W=!!S.gradientMap,q=!!S.alphaMap,ne=S.alphaTest>0,Me=!!S.alphaHash,Oe=!!S.extensions;let tt=0;S.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(tt=i.toneMapping);const lt={shaderID:ae,shaderType:S.type,shaderName:S.name,vertexShader:Xe,fragmentShader:k,defines:S.defines,customVertexShaderID:J,customFragmentShaderID:pe,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:Re,batchingColor:Re&&B._colorsTexture!==null,instancing:Ee,instancingColor:Ee&&B.instanceColor!==null,instancingMorph:Ee&&B.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:le===null?i.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:jt,alphaToCoverage:!!S.alphaToCoverage,map:Ue,matcap:$e,envMap:b,envMapMode:b&&j.mapping,envMapCubeUVHeight:z,aoMap:Qe,lightMap:We,bumpMap:qe,normalMap:ve,displacementMap:f&&et,emissiveMap:Ae,normalMapObjectSpace:ve&&S.normalMapType===1,normalMapTangentSpace:ve&&S.normalMapType===0,metalnessMap:Ce,roughnessMap:T,anisotropy:_,anisotropyMap:re,clearcoat:N,clearcoatMap:ce,clearcoatNormalMap:we,clearcoatRoughnessMap:Q,dispersion:Y,iridescence:$,iridescenceMap:oe,iridescenceThicknessMap:Fe,sheen:K,sheenColorMap:ye,sheenRoughnessMap:he,specularMap:be,specularColorMap:De,specularIntensityMap:Ke,transmission:xe,transmissionMap:w,thicknessMap:ee,gradientMap:W,opaque:S.transparent===!1&&S.blending===1&&S.alphaToCoverage===!1,alphaMap:q,alphaTest:ne,alphaHash:Me,comb
vendor: 17,262 bytes, lines 3789-3817
3789ine:S.combine,mapUv:Ue&&M(S.map.channel),aoMapUv:Qe&&M(S.aoMap.channel),lightMapUv:We&&M(S.lightMap.channel),bumpMapUv:qe&&M(S.bumpMap.channel),normalMapUv:ve&&M(S.normalMap.channel),displacementMapUv:et&&M(S.displacementMap.channel),emissiveMapUv:Ae&&M(S.emissiveMap.channel),metalnessMapUv:Ce&&M(S.metalnessMap.channel),roughnessMapUv:T&&M(S.roughnessMap.channel),anisotropyMapUv:re&&M(S.anisotropyMap.channel),clearcoatMapUv:ce&&M(S.clearcoatMap.channel),clearcoatNormalMapUv:we&&M(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&M(S.clearcoatRoughnessMap.channel),iridescenceMapUv:oe&&M(S.iridescenceMap.channel),iridescenceThicknessMapUv:Fe&&M(S.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&M(S.sheenColorMap.channel),sheenRoughnessMapUv:he&&M(S.sheenRoughnessMap.channel),specularMapUv:be&&M(S.specularMap.channel),specularColorMapUv:De&&M(S.specularColorMap.channel),specularIntensityMapUv:Ke&&M(S.specularIntensityMap.channel),transmissionMapUv:w&&M(S.transmissionMap.channel),thicknessMapUv:ee&&M(S.thicknessMap.channel),alphaMapUv:q&&M(S.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(ve||_),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!Z.attributes.uv&&(Ue||q),fog:!!V,useFog:S.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:B.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:Ie,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:i.shadowMap.enabled&&P.length>0,shadowMapType:i.shadowMap.type,toneMapping:tt,decodeVideoTexture:Ue&&S.map.isVideoTexture===!0&&ke.getTransfer(S.map.colorSpace)===Ye,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===2,flipSided:S.side===1,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Oe&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Oe&&S.extensions.multiDraw===!0||Re)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return lt.vertexUv1s=c.has(1),lt.vertexUv2s=c.has(2),lt.vertexUv3s=c.has(3),c.clear(),lt}function u(S){const v=[];if(S.shaderID?v.push(S.shaderID):(v.push(S.customVertexShaderID),v.push(S.customFragmentShaderID)),S.defines!==void 0)for(const P in S.defines)v.push(P),v.push(S.defines[P]);return S.isRawShaderMaterial===!1&&(A(v,S),E(v,S),v.push(i.outputColorSpace)),v.push(S.customProgramCacheKey),v.join()}function A(S,v){S.push(v.precision),S.push(v.outputColorSpace),S.push(v.envMapMode),S.push(v.envMapCubeUVHeight),S.push(v.mapUv),S.push(v.alphaMapUv),S.push(v.lightMapUv),S.push(v.aoMapUv),S.push(v.bumpMapUv),S.push(v.normalMapUv),S.push(v.displacementMapUv),S.push(v.emissiveMapUv),S.push(v.metalnessMapUv),S.push(v.roughnessMapUv),S.push(v.anisotropyMapUv),S.push(v.clearcoatMapUv),S.push(v.clearcoatNormalMapUv),S.push(v.clearcoatRoughnessMapUv),S.push(v.iridescenceMapUv),S.push(v.iridescenceThicknessMapUv),S.push(v.sheenColorMapUv),S.push(v.sheenRoughnessMapUv),S.push(v.specularMapUv),S.push(v.specularColorMapUv),S.push(v.specularIntensityMapUv),S.push(v.transmissionMapUv),S.push(v.thicknessMapUv),S.push(v.combine),S.push(v.fogExp2),S.push(v.sizeAttenuation),S.push(v.morphTargetsCount),S.push(v.morphAttributeCount),S.push(v.numDirLights),S.push(v.numPointLights),S.push(v.numSpotLights),S.push(v.numSpotLightMaps),S.push(v.numHemiLights),S.push(v.numRectAreaLights),S.push(v.numDirLightShadows),S.push(v.numPointLightShadows),S.push(v.numSpotLightShadows),S.push(v.numSpotLightShadowsWithMaps),S.push(v.numLightProbes),S.push(v.shadowMapType),S.push(v.toneMapping),S.push(v.numClippingPlanes),S.push(v.numClipIntersection),S.push(v.depthPacking)}function E(S,v){o.disableAll(),v.supportsVertexTextures&&o.enable(0),v.instancing&&o.enable(1),v.instancingColor&&o.enable(2),v.instancingMorph&&o.enable(3),v.matcap&&o.enable(4),v.envMap&&o.enable(5),v.normalMapObjectSpace&&o.enable(6),v.normalMapTangentSpace&&o.enable(7),v.clearcoat&&o.enable(8),v.iridescence&&o.enable(9),v.alphaTest&&o.enable(10),v.vertexColors&&o.enable(11),v.vertexAlphas&&o.enable(12),v.vertexUv1s&&o.enable(13),v.vertexUv2s&&o.enable(14),v.vertexUv3s&&o.enable(15),v.vertexTangents&&o.enable(16),v.anisotropy&&o.enable(17),v.alphaHash&&o.enable(18),v.batching&&o.enable(19),v.dispersion&&o.enable(20),v.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),v.fog&&o.enable(0),v.useFog&&o.enable(1),v.flatShading&&o.enable(2),v.logarithmicDepthBuffer&&o.enable(3),v.skinning&&o.enable(4),v.morphTargets&&o.enable(5),v.morphNormals&&o.enable(6),v.morphColors&&o.enable(7),v.premultipliedAlpha&&o.enable(8),v.shadowMapEnabled&&o.enable(9),v.doubleSided&&o.enable(10),v.flipSided&&o.enable(11),v.useDepthPacking&&o.enable(12),v.dithering&&o.enable(13),v.transmission&&o.enable(14),v.sheen&&o.enable(15),v.opaque&&o.enable(16),v.pointsUvs&&o.enable(17),v.decodeVideoTexture&&o.enable(18),v.alphaToCoverage&&o.enable(19),S.push(o.mask)}function y(S){const v=x[S.type];let P;if(v){const X=Pt[v];P=Qs.clone(X.uniforms)}else P=S.uniforms;return P}function G(S,v){let P;for(let X=0,B=h.length;X<B;X++){const V=h[X];if(V.cacheKey===v){P=V,++P.usedTimes;break}}return P===void 0&&(P=new fu(i,v,S,s),h.push(P)),P}function R(S){if(--S.usedTimes===0){const v=h.indexOf(S);h[v]=h[h.length-1],h.pop(),S.destroy()}}function C(S){l.remove(S)}function O(){l.dispose()}return{getParameters:d,getProgramCacheKey:u,getUniforms:y,acquireProgram:G,releaseProgram:R,releaseShaderCache:C,programs:h,dispose:O}}function vu(){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 xu(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.z!==e.z?i.z-e.z:i.id-e.id}function ns(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 is(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(p,f,m,x,M,d){let u=i[e];return u===void 0?(u={id:p.id,object:p,geometry:f,material:m,groupOrder:x,renderOrder:p.renderOrder,z:M,group:d},i[e]=u):(u.id=p.id,u.object=p,u.geometry=f,u.material=m,u.groupOrder=x,u.renderOrder=p.renderOrder,u.z=M,u.group=d),e++,u}function o(p,f,m,x,M,d){const u=a(p,f,m,x,M,d);m.transmission>0?n.push(u):m.transparent===!0?r.push(u):t.push(u)}function l(p,f,m,x,M,d){const u=a(p,f,m,x,M,d);m.transmission>0?n.unshift(u):m.transparent===!0?r.unshift(u):t.unshift(u)}function c(p,f){t.length>1&&t.sort(p||xu),n.length>1&&n.sort(f||ns),r.length>1&&r.sort(f||ns)}function h(){for(let p=e,f=i.length;p<f;p++){const m=i[p];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Mu(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new is,i.set(n,[a])):r>=s.length?(a=new is,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Su(){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 F,color:new Be};break;case"SpotLight":t={position:new F,direction:new F,color:new Be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Be,groundColor:new Be};break;case"RectAreaLight":t={color:new Be,position:new F,halfWidth:new F,halfHeight:new F};break}return i[e.id]=t,t}}}function Eu(){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 Ne};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Tu=0;function yu(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Au(i){const e=new Su,t=Eu(),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 F);const r=new F,s=new Je,a=new Je;function o(c){let h=0,p=0,f=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let m=0,x=0,M=0,d=0,u=0,A=0,E=0,y=0,G=0,R=0,C=0;c.sort(yu);for(let S=0,v=c.length;S<v;S++){const P=c[S],X=P.color,B=P.intensity,V=P.distance,Z=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)h+=X.r*B,p+=X.g*B,f+=X.b*B;else if(P.isLightProbe){for(let H=0;H<9;H++)n.probe[H].addScaledVector(P.sh.coefficients[H],B);C++}else if(P.isDirectionalLight){const H=e.get(P);if(H.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const j=P.shadow,z=t.get(P);z.shadowIntensity=j.intensity,z.shadowBias=j.bias,z.shadowNormalBias=j.normalBias,z.shadowRadius=j.radius,z.shadowMapSize=j.mapSize,n.directionalShadow[m]=z,n.directionalShadowMap[m]=Z,n.directionalShadowMatrix[m]=P.shadow.matrix,A++}n.directional[m]=H,m++}else if(P.isSpotLight){const H=e.get(P);H.position.setFromMatrixPosition(P.matrixWorld),H.color.copy(X).multiplyScalar(B),H.distance=V,H.coneCos=Math.cos(P.angle),H.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),H.decay=P.decay,n.spot[M]=H;const j=P.shadow;if(P.map&&(n.spotLightMap[G]=P.map,G++,j.updateMatrices(P),P.castShadow&&R++),n.spotLightMatrix[M]=j.matrix,P.castShadow){const z=t.get(P);z.shadowIntensity=j.intensity,z.shadowBias=j.bias,z.shadowNormalBias=j.normalBias,z.shadowRadius=j.radius,z.shadowMapSize=j.mapSize,n.spotShadow[M]=z,n.spotShadowMap[M]=Z,y++}M++}else if(P.isRectAreaLight){const H=e.get(P);H.color.copy(X).multiplyScalar(B),H.halfWidth.set(P.width*.5,0,0),H.halfHeight.set(0,P.height*.5,0),n.rectArea[d]=H,d++}else if(P.isPointLight){const H=e.get(P);if(H.color.copy(P.color).multiplyScalar(P.intensity),H.distance=P.distance,H.decay=P.decay,P.castShadow){const j=P.shadow,z=t.get(P);z.shadowIntensity=j.intensity,z.shadowBias=j.bias,z.shadowNormalBias=j.normalBias,z.shadowRadius=j.radius,z.shadowMapSize=j.mapSize,z.shadowCameraNear=j.camera.near,z.shadowCameraFar=j.camera.far,n.pointShadow[x]=z,n.pointShadowMap[x]=Z,n.pointShadowMatrix[x]=P.shadow.matrix,E++}n.point[x]=H,x++}else if(P.isHemisphereLight){const H=e.get(P);H.skyColor.copy(P.color).multiplyScalar(B),H.groundColor.copy(P.groundColor).multiplyScalar(B),n.hemi[u]=H,u++}}d>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ie.LTC_FLOAT_1,n.rectAreaLTC2=ie.LTC_FLOAT_2):(n.rectAreaLTC1=ie.LTC_HALF_1,n.rectAreaLTC2=ie.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=f;const O=n.hash;(O.directionalLength!==m||O.pointLength!==x||O.spotLength!==M||O.rectAreaLength!==d||O.hemiLength!==u||O.numDirectionalShadows!==A||O.numPointShadows!==E||O.numSpotShadows!==y||O.numSpotMaps!==G||O.numLightProbes!==C)&&(n.directional.length=m,n.spot.length=M,n.rectArea.length=d,n.point.length=x,n.hemi.length=u,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=y+G-R,n.spotLightMap.length=G,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=C,O.directionalLength=m,O.pointLength=x,O.spotLength=M,O.rectAreaLength=d,O.hemiLength=u,O.numDirectionalShadows=A,O.numPointShadows=E,O.numSpotShadows=y,O.numSpotMaps=G,O.numLightProbes=C,n.version=Tu++)}function l(c,h){let p=0,f=0,m=0,x=0,M=0;const d=h.matrixWorldInverse;for(let u=0,A=c.length;u<A;u++){const E=c[u];if(E.isDirectionalLight){const y=n.directional[p];y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(d),p++}else if(E.isSpotLight){const y=n.spot[m];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(d),y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(d),m++}else if(E.isRectAreaLight){const y=n.rectArea[x];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(d),a.identity(),s.copy(E.matrixWorld),s.premultiply(d),a.extractRotation(s),y.halfWidth.set(E.width*.5,0,0),y.halfHeight.set(0,E.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),x++}else if(E.isPointLight){const y=n.point[f];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(d),f++}else if(E.isHemisphereLight){const y=n.hemi[M];y.direction.setFromMatrixPosition(E.matrixWorld),y.direction.transformDirection(d),M++}}}return{setup:o,setupView:l,state:n}}function rs(i){const e=new Au(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function bu(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new rs(i),e.set(r,[o])):s>=a.length?(o=new rs(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Ru extends Wn{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 Cu extends Wn{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}}const wu=`void main() { 3790 gl_Position = vec4( position, 1.0 ); 3791}`,Pu=`uniform sampler2D shadow_pass; 3792uniform vec2 resolution; 3793uniform float radius; 3794#include <packing> 3795void main() { 3796 const float samples = float( VSM_SAMPLES ); 3797 float mean = 0.0; 3798 float squared_mean = 0.0; 3799 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3800 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3801 for ( float i = 0.0; i < samples; i ++ ) { 3802 float uvOffset = uvStart + i * uvStride; 3803 #ifdef HORIZONTAL_PASS 3804 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3805 mean += distribution.x; 3806 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3807 #else 3808 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3809 mean += depth; 3810 squared_mean += depth * depth; 3811 #endif 3812 } 3813 mean = mean / samples; 3814 squared_mean = squared_mean / samples; 3815 float std_dev = sqrt( squared_mean - mean * mean ); 3816 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3817}`;function Lu(i,e,t){let n=new or;const r=new Ne,s=new Ne,a=new rt,o=new Ru({depthPacking:3201}),l=new Cu,c={},h=t.maxTextureSize,p={[0]:1,[1]:0,[2]:2}
vendor: 1,678 bytes, line 3817
3817,f=new Zt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ne},radius:{value:4}},vertexShader:wu,fragmentShader:Pu}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const x=new Jt;x.setAttribute("position",new Dt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new Ht(x,f),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let u=this.type;this.render=function(R,C,O){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||R.length===0)return;const S=i.getRenderTarget(),v=i.getActiveCubeFace(),P=i.getActiveMipmapLevel(),X=i.state;X.setBlending(0),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const B=u!==3&&this.type===3,V=u===3&&this.type!==3;for(let Z=0,H=R.length;Z<H;Z++){const j=R[Z],z=j.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",j,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const ae=z.getFrameExtents();if(r.multiply(ae),s.copy(z.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ae.x),r.x=s.x*ae.x,z.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ae.y),r.y=s.y*ae.y,z.mapSize.y=s.y)),z.map===null||B===!0||V===!0){const me=this.type!==3?{minFilter:1003,magFilter:1003}:{};z.map!==null&&z.map.dispose(),z.map=new un(r.x,r.y,me),z.map.texture.name=j.name+".shadowMap",z.camera.updateProjectionMatrix()}i.setRenderTarget(z.map),i.clear();const ue=z.getViewportCount();for(let me=0;me<ue;me++){const Ie=z.getViewport(me);a.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),X.viewport(a),z.updateMatrices(j,me),n=z.getFrustum(),y(C,O,z.camera,j,this.type)}z.isPointLightShadow!==!0&&this.type===3&&A(z,O),z.needsUpdate=!1}
vendor: 7,934 bytes, line 3817
3817u=this.type,d.needsUpdate=!1,i.setRenderTarget(S,v,P)};function A(R,C){const O=e.update(M);f.defines.VSM_SAMPLES!==R.blurSamples&&(f.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new un(r.x,r.y)),f.uniforms.shadow_pass.value=R.map.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,i.setRenderTarget(R.mapPass),i.clear(),i.renderBufferDirect(C,null,O,f,M,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,i.setRenderTarget(R.map),i.clear(),i.renderBufferDirect(C,null,O,m,M,null)}function E(R,C,O,S){let v=null;const P=O.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(P!==void 0)v=P;else if(v=O.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){const X=v.uuid,B=C.uuid;let V=c[X];V===void 0&&(V={},c[X]=V);let Z=V[B];Z===void 0&&(Z=v.clone(),V[B]=Z,C.addEventListener("dispose",G)),v=Z}if(v.visible=C.visible,v.wireframe=C.wireframe,S===3?v.side=C.shadowSide!==null?C.shadowSide:C.side:v.side=C.shadowSide!==null?C.shadowSide:p[C.side],v.alphaMap=C.alphaMap,v.alphaTest=C.alphaTest,v.map=C.map,v.clipShadows=C.clipShadows,v.clippingPlanes=C.clippingPlanes,v.clipIntersection=C.clipIntersection,v.displacementMap=C.displacementMap,v.displacementScale=C.displacementScale,v.displacementBias=C.displacementBias,v.wireframeLinewidth=C.wireframeLinewidth,v.linewidth=C.linewidth,O.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const X=i.properties.get(v);X.light=O}return v}function y(R,C,O,S,v){if(R.visible===!1)return;if(R.layers.test(C.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&v===3)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,R.matrixWorld);const B=e.update(R),V=R.material;if(Array.isArray(V)){const Z=B.groups;for(let H=0,j=Z.length;H<j;H++){const z=Z[H],ae=V[z.materialIndex];if(ae&&ae.visible){const ue=E(R,ae,S,v);R.onBeforeShadow(i,R,C,O,B,ue,z),i.renderBufferDirect(O,null,B,ue,R,z),R.onAfterShadow(i,R,C,O,B,ue,z)}}}else if(V.visible){const Z=E(R,V,S,v);R.onBeforeShadow(i,R,C,O,B,Z,null),i.renderBufferDirect(O,null,B,Z,R,null),R.onAfterShadow(i,R,C,O,B,Z,null)}}const X=R.children;for(let B=0,V=X.length;B<V;B++)y(X[B],C,O,S,v)}function G(R){R.target.removeEventListener("dispose",G);for(const O in c){const S=c[O],v=R.target.uuid;v in S&&(S[v].dispose(),delete S[v])}}}function Du(i){function e(){let w=!1;const ee=new rt;let W=null;const q=new rt(0,0,0,0);return{setMask:function(ne){W!==ne&&!w&&(i.colorMask(ne,ne,ne,ne),W=ne)},setLocked:function(ne){w=ne},setClear:function(ne,Me,Oe,tt,lt){lt===!0&&(ne*=tt,Me*=tt,Oe*=tt),ee.set(ne,Me,Oe,tt),q.equals(ee)===!1&&(i.clearColor(ne,Me,Oe,tt),q.copy(ee))},reset:function(){w=!1,W=null,q.set(-1,0,0,0)}}}function t(){let w=!1,ee=null,W=null,q=null;return{setTest:function(ne){ne?pe(i.DEPTH_TEST):le(i.DEPTH_TEST)},setMask:function(ne){ee!==ne&&!w&&(i.depthMask(ne),ee=ne)},setFunc:function(ne){if(W!==ne){switch(ne){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)}W=ne}},setLocked:function(ne){w=ne},setClear:function(ne){q!==ne&&(i.clearDepth(ne),q=ne)},reset:function(){w=!1,ee=null,W=null,q=null}}}function n(){let w=!1,ee=null,W=null,q=null,ne=null,Me=null,Oe=null,tt=null,lt=null;return{setTest:function(Ge){w||(Ge?pe(i.STENCIL_TEST):le(i.STENCIL_TEST))},setMask:function(Ge){ee!==Ge&&!w&&(i.stencilMask(Ge),ee=Ge)},setFunc:function(Ge,Ft,Ct){(W!==Ge||q!==Ft||ne!==Ct)&&(i.stencilFunc(Ge,Ft,Ct),W=Ge,q=Ft,ne=Ct)},setOp:function(Ge,Ft,Ct){(Me!==Ge||Oe!==Ft||tt!==Ct)&&(i.stencilOp(Ge,Ft,Ct),Me=Ge,Oe=Ft,tt=Ct)},setLocked:function(Ge){w=Ge},setClear:function(Ge){lt!==Ge&&(i.clearStencil(Ge),lt=Ge)},reset:function(){w=!1,ee=null,W=null,q=null,ne=null,Me=null,Oe=null,tt=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},h={},p=new WeakMap,f=[],m=null,x=!1,M=null,d=null,u=null,A=null,E=null,y=null,G=null,R=new Be(0,0,0),C=0,O=!1,S=null,v=null,P=null,X=null,B=null;const V=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Z=!1,H=0;const j=i.getParameter(i.VERSION);j.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(j)[1]),Z=H>=1):j.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),Z=H>=2);let z=null,ae={};const ue=i.getParameter(i.SCISSOR_BOX),me=i.getParameter(i.VIEWPORT),Ie=new rt().fromArray(ue),Xe=new rt().fromArray(me);function k(w,ee,W,q){const ne=new Uint8Array(4),Me=i.createTexture();i.bindTexture(w,Me),i.texParameteri(w,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(w,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Oe=0;Oe<W;Oe++)w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY?i.texImage3D(ee,0,i.RGBA,1,1,q,0,i.RGBA,i.UNSIGNED_BYTE,ne):i.texImage2D(ee+Oe,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,ne);return Me}const J={};J[i.TEXTURE_2D]=k(i.TEXTURE_2D,i.TEXTURE_2D,1),J[i.TEXTURE_CUBE_MAP]=k(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[i.TEXTURE_2D_ARRAY]=k(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),J[i.TEXTURE_3D]=k(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),pe(i.DEPTH_TEST),s.setFunc(3),qe(!1),ve(1),pe(i.CULL_FACE),Qe(0);function pe(w){c[w]!==!0&&(i.enable(w),c[w]=!0)}function le(w){c[w]!==!1&&(i.disable(w),c[w]=!1)}function Ee(w,ee){return h[w]!==ee?(i.bindFramebuffer(w,ee),h[w]=ee,w===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=ee),w===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=ee),!0):!1}function Re(w,ee){let W=f,q=!1;if(w){W=p.get(ee),W===void 0&&(W=[],p.set(ee,W));const ne=w.textures;if(W.length!==ne.length||W[0]!==i.COLOR_ATTACHMENT0){for(let Me=0,Oe=ne.length;Me<Oe;Me++)W[Me]=i.COLOR_ATTACHMENT0+Me;W.length=ne.length,q=!0}}else W[0]!==i.BACK&&(W[0]=i.BACK,q=!0);q&&i.drawBuffers(W)}function Ue(w){return m!==w?(i.useProgram(w),m=w,!0):!1}const $e={[100]:i.FUNC_ADD,[101]:i.FUNC_SUBTRACT,[102]:i.FUNC_REVERSE_SUBTRACT};$e[103]=i.MIN,$e[104]=i.MAX;const b={[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 Qe(w,ee,W,q,ne,Me,Oe,tt,lt,Ge){if(w===0){x===!0&&(le(i.BLEND),x=!1);return}if(x===!1&&(pe(i.BLEND),x=!0),w!==5){if(w!==M||Ge!==O){if((d!==100||E!==100)&&(i.blendEquation(i.FUNC_ADD),d=100,E=100),Ge)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.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.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.blendFunc(i.SRC_ALPHA,i.ONE);break;case 3:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case 4:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",w);break}u=null,A=null,y=null,G=null,R.set(0,0,0),C=0,M=w,O=Ge}return}ne=ne||ee,Me=Me||W,Oe=Oe||q,(ee!==d||ne!==E)&&(i.blendEquationSeparate($e[ee],$e[ne]),d=ee,E=ne),(W!==u||q!==A||Me!==y||Oe!==G)&&(i.blendFuncSeparate(b[W],b[q],b[Me],b[Oe]),u=W,A=q,y=Me,G=Oe),(tt.equals(R)===!1||lt!==C)&&(i.blendColor
vendor: 3,391 bytes, line 3817
3817(tt.r,tt.g,tt.b,lt),R.copy(tt),C=lt),M=w,O=!1}function We(w,ee){w.side===2?le(i.CULL_FACE):pe(i.CULL_FACE);let W=w.side===1;ee&&(W=!W),qe(W),w.blending===1&&w.transparent===!1?Qe(0):Qe(w.blending,w.blendEquation,w.blendSrc,w.blendDst,w.blendEquationAlpha,w.blendSrcAlpha,w.blendDstAlpha,w.blendColor,w.blendAlpha,w.premultipliedAlpha),s.setFunc(w.depthFunc),s.setTest(w.depthTest),s.setMask(w.depthWrite),r.setMask(w.colorWrite);const q=w.stencilWrite;a.setTest(q),q&&(a.setMask(w.stencilWriteMask),a.setFunc(w.stencilFunc,w.stencilRef,w.stencilFuncMask),a.setOp(w.stencilFail,w.stencilZFail,w.stencilZPass)),Ae(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits),w.alphaToCoverage===!0?pe(i.SAMPLE_ALPHA_TO_COVERAGE):le(i.SAMPLE_ALPHA_TO_COVERAGE)}function qe(w){S!==w&&(w?i.frontFace(i.CW):i.frontFace(i.CCW),S=w)}function ve(w){w!==0?(pe(i.CULL_FACE),w!==v&&(w===1?i.cullFace(i.BACK):w===2?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):le(i.CULL_FACE),v=w}function et(w){w!==P&&(Z&&i.lineWidth(w),P=w)}function Ae(w,ee,W){w?(pe(i.POLYGON_OFFSET_FILL),(X!==ee||B!==W)&&(i.polygonOffset(ee,W),X=ee,B=W)):le(i.POLYGON_OFFSET_FILL)}function Ce(w){w?pe(i.SCISSOR_TEST):le(i.SCISSOR_TEST)}function T(w){w===void 0&&(w=i.TEXTURE0+V-1),z!==w&&(i.activeTexture(w),z=w)}function _(w,ee,W){W===void 0&&(z===null?W=i.TEXTURE0+V-1:W=z);let q=ae[W];q===void 0&&(q={type:void 0,texture:void 0},ae[W]=q),(q.type!==w||q.texture!==ee)&&(z!==W&&(i.activeTexture(W),z=W),i.bindTexture(w,ee||J[w]),q.type=w,q.texture=ee)}function N(){const w=ae[z];w!==void 0&&w.type!==void 0&&(i.bindTexture(w.type,null),w.type=void 0,w.texture=void 0)}function Y(){try{i.compressedTexImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function $(){try{i.compressedTexImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function K(){try{i.texSubImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function xe(){try{i.texSubImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function re(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function ce(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function we(){try{i.texStorage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function Q(){try{i.texStorage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function oe(){try{i.texImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function Fe(){try{i.texImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function ye(w){Ie.equals(w)===!1&&(i.scissor(w.x,w.y,w.z,w.w),Ie.copy(w))}function he(w){Xe.equals(w)===!1&&(i.viewport(w.x,w.y,w.z,w.w),Xe.copy(w))}function be(w,ee){let W=l.get(ee);W===void 0&&(W=new WeakMap,l.set(ee,W));let q=W.get(w);q===void 0&&(q=i.getUniformBlockIndex(ee,w.name),W.set(w,q))}function De(w,ee){const q=l.get(ee).get(w);o.get(ee)!==q&&(i.uniformBlockBinding(ee,q,w.__bindingPointIndex),o.set(ee,q))}function Ke(){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
3817(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),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),c={},z=null,ae={},h={},p=new WeakMap,f=[],m=null,x=!1,M=null,d=null,u=null,A=null,E=null,y=null,G=null,R=new Be(0,0,0),C=0,O=!1,S=null,v=null,P=null,X=null,B=null,Ie.set(0,0,i.canvas.width,i.canvas.height),Xe.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:pe,disable:le,bindFramebuffer:Ee,drawBuffers:Re,useProgram:Ue,setBlending:Qe,setMaterial:We,setFlipSided:qe,setCullFace:ve,setLineWidth:et,setPolygonOffset:Ae,setScissorTest:Ce,activeTexture:T,bindTexture:_,unbindTexture:N,compressedTexImage2D:Y,compressedTexImage3D:$,texImage2D:oe,texImage3D:Fe,updateUBOMapping:be,uniformBlockBinding:De,texStorage2D:we,texStorage3D:Q,texSubImage2D:K,texSubImage3D:xe,compressedTexSubImage2D:re,compressedTexSubImage3D:ce,scissor:ye,viewport:he,reset:Ke}}function ss(i,e,t,n){const r=Uu(n);switch(t){case 1021:return i*e;case 1024:return i*e;case 1025:return i*e*2;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:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case 37496: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;case 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 Uu(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:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function Iu(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 Ne,h=new WeakMap;let p;const f=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(T,_){return m?new OffscreenCanvas(T,_):Mi("canvas")}function M(T,_,N){let Y=1;const $=Ce(T);
vendor: 4,823 bytes, line 3817
3817if(($.width>N||$.height>N)&&(Y=N/Math.max($.width,$.height)),Y<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const K=Math.floor(Y*$.width),xe=Math.floor(Y*$.height);p===void 0&&(p=x(K,xe));const re=_?x(K,xe):p;return re.width=K,re.height=xe,re.getContext("2d").drawImage(T,0,0,K,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+K+"x"+xe+")."),re}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),T;return T}function d(T){return T.generateMipmaps&&T.minFilter!==1003&&T.minFilter!==1006}function u(T){i.generateMipmap(T)}function A(T,_,N,Y,$=!1){if(T!==null){if(i[T]!==void 0)return i[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let K=_;if(_===i.RED&&(N===i.FLOAT&&(K=i.R32F),N===i.HALF_FLOAT&&(K=i.R16F),N===i.UNSIGNED_BYTE&&(K=i.R8)),_===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(K=i.R8UI),N===i.UNSIGNED_SHORT&&(K=i.R16UI),N===i.UNSIGNED_INT&&(K=i.R32UI),N===i.BYTE&&(K=i.R8I),N===i.SHORT&&(K=i.R16I),N===i.INT&&(K=i.R32I)),_===i.RG&&(N===i.FLOAT&&(K=i.RG32F),N===i.HALF_FLOAT&&(K=i.RG16F),N===i.UNSIGNED_BYTE&&(K=i.RG8)),_===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(K=i.RG8UI),N===i.UNSIGNED_SHORT&&(K=i.RG16UI),N===i.UNSIGNED_INT&&(K=i.RG32UI),N===i.BYTE&&(K=i.RG8I),N===i.SHORT&&(K=i.RG16I),N===i.INT&&(K=i.RG32I)),_===i.RGB&&N===i.UNSIGNED_INT_5_9_9_9_REV&&(K=i.RGB9_E5),_===i.RGBA){const xe=$?gi:ke.getTransfer(Y);N===i.FLOAT&&(K=i.RGBA32F),N===i.HALF_FLOAT&&(K=i.RGBA16F),N===i.UNSIGNED_BYTE&&(K=xe===Ye?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT_4_4_4_4&&(K=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(K=i.RGB5_A1)}return(K===i.R16F||K===i.R32F||K===i.RG16F||K===i.RG32F||K===i.RGBA16F||K===i.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function E(T,_){let N;return T?_===null||_===1014||_===1020?N=i.DEPTH24_STENCIL8:_===1015?N=i.DEPTH32F_STENCIL8:_===1012&&(N=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===1014||_===1020?N=i.DEPTH_COMPONENT24:_===1015?N=i.DEPTH_COMPONENT32F:_===1012&&(N=i.DEPTH_COMPONENT16),N}function y(T,_){return d(T)===!0||T.isFramebufferTexture&&T.minFilter!==1003&&T.minFilter!==1006?Math.log2(Math.max(_.width,_.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?_.mipmaps.length:1}function G(T){const _=T.target;_.removeEventListener("dispose",G),C(_),_.isVideoTexture&&h.delete(_)}function R(T){const _=T.target;_.removeEventListener("dispose",R),S(_)}function C(T){const _=n.get(T);if(_.__webglInit===void 0)return;const N=T.source,Y=f.get(N);if(Y){const $=Y[_.__cacheKey];$.usedTimes--,$.usedTimes===0&&O(T),Object.keys(Y).length===0&&f.delete(N)}n.remove(T)}function O(T){const _=n.get(T);i.deleteTexture(_.__webglTexture);const N=T.source,Y=f.get(N);delete Y[_.__cacheKey],a.memory.textures--}function S(T){const _=n.get(T);if(T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(_.__webglFramebuffer[Y]))for(let $=0;$<_.__webglFramebuffer[Y].length;$++)i.deleteFramebuffer(_.__webglFramebuffer[Y][$]);else i.deleteFramebuffer(_.__webglFramebuffer[Y]);_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer[Y])}else{if(Array.isArray(_.__webglFramebuffer))for(let Y=0;Y<_.__webglFramebuffer.length;Y++)i.deleteFramebuffer(_.__webglFramebuffer[Y]);else i.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&i.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let Y=0;Y<_.__webglColorRenderbuffer.length;Y++)_.__webglColorRenderbuffer[Y]&&i.deleteRenderbuffer(_.__webglColorRenderbuffer[Y]);_.__webglDepthRenderbuffer&&i.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const N=T.textures;for(let Y=0,$=N.length;Y<$;Y++){const K=n.get(N[Y]);K.__webglTexture&&(i.deleteTexture(K.__webglTexture),a.memory.textures--),n.remove(N[Y])}n.remove(T)}let v=0;function P(){v=0}function X(){const T=v;return T>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),v+=1,T}function B(T){const _=[];return _.push(T.wrapS),_.push(T.wrapT),_.push(T.wrapR||0),_.push(T.magFilter),_.push(T.minFilter),_.push(T.anisotropy),_.push(T.internalFormat),_.push(T.format),_.push(T.type),_.push(T.generateMipmaps),_.push(T.premultiplyAlpha),_.push(T.flipY),_.push(T.unpackAlignment),_.push(T.colorSpace),_.join()}function V(T,_){const N=n.get(T);
vendor: 7,901 bytes, line 3817
3817if(T.isVideoTexture&&et(T),T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){const Y=T.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Xe(N,T,_);return}}t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+_)}function Z(T,_){const N=n.get(T);if(T.version>0&&N.__version!==T.version){Xe(N,T,_);return}t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+_)}function H(T,_){const N=n.get(T);if(T.version>0&&N.__version!==T.version){Xe(N,T,_);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+_)}function j(T,_){const N=n.get(T);if(T.version>0&&N.__version!==T.version){k(N,T,_);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+_)}const z={[1e3]:i.REPEAT,[1001]:i.CLAMP_TO_EDGE,[1002]:i.MIRRORED_REPEAT},ae={[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},ue={[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 me(T,_){if(_.type===1015&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===1006||_.magFilter===1007||_.magFilter===1005||_.magFilter===1008||_.minFilter===1006||_.minFilter===1007||_.minFilter===1005||_.minFilter===1008)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,z[_.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,z[_.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&&i.texParameteri(T,i.TEXTURE_WRAP_R,z[_.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,ae[_.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,ae[_.minFilter]),_.compareFunction&&(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,ue[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===1003||_.minFilter!==1005&&_.minFilter!==1008||_.type===1015&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||n.get(_).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");i.texParameterf(T,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy}}}function Ie(T,_){let N=!1;T.__webglInit===void 0&&(T.__webglInit=!0,_.addEventListener("dispose",G));const Y=_.source;let $=f.get(Y);$===void 0&&($={},f.set(Y,$));const K=B(_);if(K!==T.__cacheKey){$[K]===void 0&&($[K]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),$[K].usedTimes++;const xe=$[T.__cacheKey];xe!==void 0&&($[T.__cacheKey].usedTimes--,xe.usedTimes===0&&O(_)),T.__cacheKey=K,T.__webglTexture=$[K].texture}return N}function Xe(T,_,N){let Y=i.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),_.isData3DTexture&&(Y=i.TEXTURE_3D);const $=Ie(T,_),K=_.source;t.bindTexture(Y,T.__webglTexture,i.TEXTURE0+N);const xe=n.get(K);if(K.version!==xe.__version||$===!0){t.activeTexture(i.TEXTURE0+N);const re=ke.getPrimaries(ke.workingColorSpace),ce=_.colorSpace===$t?null:ke.getPrimaries(_.colorSpace),we=_.colorSpace===$t||re===ce?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,we);let Q=M(_.image,!1,r.maxTextureSize);Q=Ae(_,Q);const oe=s.convert(_.format,_.colorSpace),Fe=s.convert(_.type);let ye=A(_.internalFormat,oe,Fe,_.colorSpace,_.isVideoTexture);me(Y,_);let he;const be=_.mipmaps,De=_.isVideoTexture!==!0,Ke=xe.__version===void 0||$===!0,w=K.dataReady,ee=y(_,Q);if(_.isDepthTexture)ye=E(_.format===1027,_.type),Ke&&(De?t.texStorage2D(i.TEXTURE_2D,1,ye,Q.width,Q.height):t.texImage2D(i.TEXTURE_2D,0,ye,Q.width,Q.height,0,oe,Fe,null));else if(_.isDataTexture)if(be.length>0){De&&Ke&&t.texStorage2D(i.TEXTURE_2D,ee,ye,be[0].width,be[0].height);for(let W=0,q=be.length;W<q;W++)he=be[W],De?w&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,he.width,he.height,oe,Fe,he.data):t.texImage2D(i.TEXTURE_2D,W,ye,he.width,he.height,0,oe,Fe,he.data);_.generateMipmaps=!1}else De?(Ke&&t.texStorage2D(i.TEXTURE_2D,ee,ye,Q.width,Q.height),w&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Q.width,Q.height,oe,Fe,Q.data)):t.texImage2D(i.TEXTURE_2D,0,ye,Q.width,Q.height,0,oe,Fe,Q.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){De&&Ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ee,ye,be[0].width,be[0].height,Q.depth);for(let W=0,q=be.length;W<q;W++)if(he=be[W],_.format!==1023)if(oe!==null)if(De){if(w)if(_.layerUpdates.size>0){const ne=ss(he.width,he.height,_.format,_.type);for(const Me of _.layerUpdates){const Oe=he.data.subarray(Me*ne/he.data.BYTES_PER_ELEMENT,(Me+1)*ne/he.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,Me,he.width,he.height,1,oe,Oe,0,0)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,he.width,he.height,Q.depth,oe,he.data,0,0)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,W,ye,he.width,he.height,Q.depth,0,he.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else De?w&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,he.width,he.height,Q.depth,oe,Fe,he.data):t.texImage3D(i.TEXTURE_2D_ARRAY,W,ye,he.width,he.height,Q.depth,0,oe,Fe,he.data)}else{De&&Ke&&t.texStorage2D(i.TEXTURE_2D,ee,ye,be[0].width,be[0].height);for(let W=0,q=be.length;W<q;W++)he=be[W],_.format!==1023?oe!==null?De?w&&t.compressedTexSubImage2D(i.TEXTURE_2D,W,0,0,he.width,he.height,oe,he.data):t.compressedTexImage2D(i.TEXTURE_2D,W,ye,he.width,he.height,0,he.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):De?w&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,he.width,he.height,oe,Fe,he.data):t.texImage2D(i.TEXTURE_2D,W,ye,he.width,he.height,0,oe,Fe,he.data)}else if(_.isDataArrayTexture)if(De){if(Ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ee,ye,Q.width,Q.height,Q.depth),w)if(_.layerUpdates.size>0){const W=ss(Q.width,Q.height,_.format,_.type);for(const q of _.layerUpdates){const ne=Q.data.subarray(q*W/Q.data.BYTES_PER_ELEMENT,(q+1)*W/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,q,Q.width,Q.height,1,oe,Fe,ne)}_.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,oe,Fe,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ye,Q.width,Q.height,Q.depth,0,oe,Fe,Q.data);else if(_.isData3DTexture)De?(Ke&&t.texStorage3D(i.TEXTURE_3D,ee,ye,Q.width,Q.height,Q.depth),w&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,oe,Fe,Q.data)):t.texImage3D(i.TEXTURE_3D,0,ye,Q.width,Q.height,Q.depth,0,oe,Fe,Q.data);else if(_.isFramebufferTexture){if(Ke)if(De)t.texStorage2D(i.TEXTURE_2D,ee,ye,Q.width,Q.height);else{let W=Q.width,q=Q.height;for(let ne=0;ne<ee;ne++)t.texImage2D(i.TEXTURE_2D,ne,ye,W,q,0,oe,Fe,null),W>>=1,q>>=1}}else if(be.length>0){if(De&&Ke){const W=Ce(be[0]);t.texStorage2D(i.TEXTURE_2D,ee,ye,W.width,W.height)}for(let W=0,q=be.length;W<q;W++)he=be[W],De?w&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,oe,Fe,he):t.texImage2D(i.TEXTURE_2D,W,ye,oe,Fe,he);_.generateMipmaps=!1}else if(De){if(Ke){const W=Ce(Q);t.texStorage2D(i.TEXTURE_2D,ee,ye,W.width,W.height)}w&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,oe,Fe,Q)}else t.texImage2D(i.TEXTURE_2D,0,ye,oe,Fe,Q);d(_)&&u(Y),xe.__version=K.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function k(T,_,N){if(_.image.length!==6)return;const Y=Ie(T,_),$=_.source;t.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+N);const K=n.get($);if($.version!==K.__version||Y===!0){t.activeTexture(i.TEXTURE0+N);
vendor: 4,162 bytes, line 3817
3817const xe=ke.getPrimaries(ke.workingColorSpace),re=_.colorSpace===$t?null:ke.getPrimaries(_.colorSpace),ce=_.colorSpace===$t||xe===re?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ce);const we=_.isCompressedTexture||_.image[0].isCompressedTexture,Q=_.image[0]&&_.image[0].isDataTexture,oe=[];for(let q=0;q<6;q++)!we&&!Q?oe[q]=M(_.image[q],!0,r.maxCubemapSize):oe[q]=Q?_.image[q].image:_.image[q],oe[q]=Ae(_,oe[q]);const Fe=oe[0],ye=s.convert(_.format,_.colorSpace),he=s.convert(_.type),be=A(_.internalFormat,ye,he,_.colorSpace),De=_.isVideoTexture!==!0,Ke=K.__version===void 0||Y===!0,w=$.dataReady;let ee=y(_,Fe);me(i.TEXTURE_CUBE_MAP,_);let W;if(we){De&&Ke&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ee,be,Fe.width,Fe.height);for(let q=0;q<6;q++){W=oe[q].mipmaps;for(let ne=0;ne<W.length;ne++){const Me=W[ne];_.format!==1023?ye!==null?De?w&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne,0,0,Me.width,Me.height,ye,Me.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne,be,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?w&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne,0,0,Me.width,Me.height,ye,he,Me.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne,be,Me.width,Me.height,0,ye,he,Me.data)}}}else{if(W=_.mipmaps,De&&Ke){W.length>0&&ee++;const q=Ce(oe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ee,be,q.width,q.height)}for(let q=0;q<6;q++)if(Q){De?w&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,oe[q].width,oe[q].height,ye,he,oe[q].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,be,oe[q].width,oe[q].height,0,ye,he,oe[q].data);for(let ne=0;ne<W.length;ne++){const Oe=W[ne].image[q].image;De?w&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne+1,0,0,Oe.width,Oe.height,ye,he,Oe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne+1,be,Oe.width,Oe.height,0,ye,he,Oe.data)}}else{De?w&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,ye,he,oe[q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,be,ye,he,oe[q]);for(let ne=0;ne<W.length;ne++){const Me=W[ne];De?w&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne+1,0,0,ye,he,Me.image[q]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+q,ne+1,be,ye,he,Me.image[q])}}}d(_)&&u(i.TEXTURE_CUBE_MAP),K.__version=$.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function J(T,_,N,Y,$,K){const xe=s.convert(N.format,N.colorSpace),re=s.convert(N.type),ce=A(N.internalFormat,xe,re,N.colorSpace);if(!n.get(_).__hasExternalTextures){const Q=Math.max(1,_.width>>K),oe=Math.max(1,_.height>>K);$===i.TEXTURE_3D||$===i.TEXTURE_2D_ARRAY?t.texImage3D($,K,ce,Q,oe,_.depth,0,xe,re,null):t.texImage2D($,K,ce,Q,oe,0,xe,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,T),ve(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,$,n.get(N).__webglTexture,0,qe(_)):($===i.TEXTURE_2D||$>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,$,n.get(N).__webglTexture,K),t.bindFramebuffer(i.FRAMEBUFFER,null)}function pe(T,_,N){if(i.bindRenderbuffer(i.RENDERBUFFER,T),_.depthBuffer){const Y=_.depthTexture,$=Y&&Y.isDepthTexture?Y.type:null,K=E(_.stencilBuffer,$),xe=_.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=qe(_);ve(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,re,K,_.width,_.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,re,K,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,K,_.width,_.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,xe,i.RENDERBUFFER,T)}else{const Y=_.textures;for(let $=0;$<Y.length;$++){const K=Y[$],xe=s.convert(K.format,K.colorSpace),re=s.convert(K.type),ce=A(K.internalFormat,xe,re,K.colorSpace),we=qe(_);N&&ve(_)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,we,ce,_.width,_.height):ve(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,we,ce,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,ce,_.width,_.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}
vendor: 5,449 bytes, line 3817
3817function le(T,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,T),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(_.depthTexture).__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),V(_.depthTexture,0);const Y=n.get(_.depthTexture).__webglTexture,$=qe(_);if(_.depthTexture.format===1026)ve(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Y,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Y,0);else if(_.depthTexture.format===1027)ve(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Y,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Y,0);else throw new Error("Unknown depthTexture format")}function Ee(T){const _=n.get(T),N=T.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==T.depthTexture){const Y=T.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),Y){const $=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,Y.removeEventListener("dispose",$)};Y.addEventListener("dispose",$),_.__depthDisposeCallback=$}_.__boundDepthTexture=Y}if(T.depthTexture&&!_.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");le(_.__webglFramebuffer,T)}else if(N){_.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[Y]),_.__webglDepthbuffer[Y]===void 0)_.__webglDepthbuffer[Y]=i.createRenderbuffer(),pe(_.__webglDepthbuffer[Y],T,!1);else{const $=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,K=_.__webglDepthbuffer[Y];i.bindRenderbuffer(i.RENDERBUFFER,K),i.framebufferRenderbuffer(i.FRAMEBUFFER,$,i.RENDERBUFFER,K)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=i.createRenderbuffer(),pe(_.__webglDepthbuffer,T,!1);else{const Y=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,$=_.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,$),i.framebufferRenderbuffer(i.FRAMEBUFFER,Y,i.RENDERBUFFER,$)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Re(T,_,N){const Y=n.get(T);_!==void 0&&J(Y.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&Ee(T)}function Ue(T){const _=T.texture,N=n.get(T),Y=n.get(_);T.addEventListener("dispose",R);const $=T.textures,K=T.isWebGLCubeRenderTarget===!0,xe=$.length>1;if(xe||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=_.version,a.memory.textures++),K){N.__webglFramebuffer=[];for(let re=0;re<6;re++)if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer[re]=[];for(let ce=0;ce<_.mipmaps.length;ce++)N.__webglFramebuffer[re][ce]=i.createFramebuffer()}else N.__webglFramebuffer[re]=i.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer=[];for(let re=0;re<_.mipmaps.length;re++)N.__webglFramebuffer[re]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(xe)for(let re=0,ce=$.length;re<ce;re++){const we=n.get($[re]);we.__webglTexture===void 0&&(we.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples>0&&ve(T)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let re=0;re<$.length;re++){const ce=$[re];N.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[re]);const we=s.convert(ce.format,ce.colorSpace),Q=s.convert(ce.type),oe=A(ce.internalFormat,we,Q,ce.colorSpace,T.isXRRenderTarget===!0),Fe=qe(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,Fe,oe,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,N.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),pe(N.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(K){t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture),me(i.TEXTURE_CUBE_MAP,_);for(let re=0;re<6;re++)if(_.mipmaps&&_.mipmaps.length>0)for(let ce=0;ce<_.mipmaps.length;ce++)J(N.__webglFramebuffer[re][ce],T,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,ce);else J(N.__webglFramebuffer[re],T,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);d(_)&&u(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(xe){for(let re=0,ce=$.length;re<ce;re++){const we=$[re],Q=n.get(we);t.bindTexture(i.TEXTURE_2D,Q.__webglTexture),me(i.TEXTURE_2D,we),J(N.__webglFramebuffer,T,we,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),d(we)&&u(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(re=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Y.__webglTexture),me(re,_),_.mipmaps&&_.mipmaps.length>0)for(let ce=0;ce<_.mipmaps.length;ce++)J(N.__webglFramebuffer[ce],T,_,i.COLOR_ATTACHMENT0,re,ce);else J(N.__webglFramebuffer,T,_,i.COLOR_ATTACHMENT0,re,0);d(_)&&u(re),t.unbindTexture()}T.depthBuffer&&Ee(T)}function $e(T){const _=T.textures;for(let N=0,Y=_.length;N<Y;N++){const $=_[N];
vendor: 7,609 bytes, line 3817
3817if(d($)){const K=T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,xe=n.get($).__webglTexture;t.bindTexture(K,xe),u(K),t.unbindTexture()}}}const b=[],Qe=[];function We(T){if(T.samples>0){if(ve(T)===!1){const _=T.textures,N=T.width,Y=T.height;let $=i.COLOR_BUFFER_BIT;const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,xe=n.get(T),re=_.length>1;if(re)for(let ce=0;ce<_.length;ce++)t.bindFramebuffer(i.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ce,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,xe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ce,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,xe.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,xe.__webglFramebuffer);for(let ce=0;ce<_.length;ce++){if(T.resolveDepthBuffer&&(T.depthBuffer&&($|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&($|=i.STENCIL_BUFFER_BIT)),re){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,xe.__webglColorRenderbuffer[ce]);const we=n.get(_[ce]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,we,0)}i.blitFramebuffer(0,0,N,Y,0,0,N,Y,$,i.NEAREST),l===!0&&(b.length=0,Qe.length=0,b.push(i.COLOR_ATTACHMENT0+ce),T.depthBuffer&&T.resolveDepthBuffer===!1&&(b.push(K),Qe.push(K),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,Qe)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,b))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),re)for(let ce=0;ce<_.length;ce++){t.bindFramebuffer(i.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ce,i.RENDERBUFFER,xe.__webglColorRenderbuffer[ce]);const we=n.get(_[ce]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,xe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ce,i.TEXTURE_2D,we,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,xe.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const _=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[_])}}}function qe(T){return Math.min(r.maxSamples,T.samples)}function ve(T){const _=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function et(T){const _=a.render.frame;h.get(T)!==_&&(h.set(T,_),T.update())}function Ae(T,_){const N=T.colorSpace,Y=T.format,$=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||N!==jt&&N!==$t&&(ke.getTransfer(N)===Ye?(Y!==1023||$!==1009)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),_}function Ce(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=X,this.resetTextureUnits=P,this.setTexture2D=V,this.setTexture2DArray=Z,this.setTexture3D=H,this.setTextureCube=j,this.rebindTextures=Re,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=We,this.setupDepthRenderbuffer=Ee,this.setupFrameBufferTexture=J,this.useMultisampledRTT=ve}function Fu(i,e){function t(n,r=$t){let s;const a=ke.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===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===1024)return i.LUMINANCE;if(n===1025)return i.LUMINANCE_ALPHA;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===Ye)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)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===36196||n===37492)return a===Ye?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===37496)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_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===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===Ye?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===Ye?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===36492)return s.COMPRESSED_RED_RGT
vendor: 6,910 bytes, lines 3817-3841
3817C1_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}}class Nu extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class mi extends dt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ou={type:"move"};class er{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mi,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 mi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),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 M of e.hand.values()){const d=t.getJointPose(M,n),u=this._getHandJoint(c,M);d!==null&&(u.matrix.fromArray(d.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=d.radius),u.visible=d!==null}const h=c.joints["index-finger-tip"],p=c.joints["thumb-tip"],f=h.position.distanceTo(p.position),m=.02,x=.005;c.inputState.pinching&&f>m+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=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));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(Ou)))}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 mi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Bu=` 3818void main() { 3819 3820 gl_Position = vec4( position, 1.0 ); 3821 3822}`,Gu=` 3823uniform sampler2DArray depthColor; 3824uniform float depthWidth; 3825uniform float depthHeight; 3826 3827void main() { 3828 3829 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3830 3831 if ( coord.x >= 1.0 ) { 3832 3833 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3834 3835 } else { 3836 3837 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3838 3839 } 3840 3841}`;class zu{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new _t,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Zt({vertexShader:Bu,fragmentShader:Gu,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ht(new Ei(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Hu extends Ln{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,p=null,f=null,m=null,x=null;const M=new zu,d=t.getContextAttributes();let u=null,A=null;const E=[],y=[],G=new Ne;let R=null;const C=new Rt;C.layers.enable(1),C.viewport=new rt;const O=new Rt;O.layers.enable(2),O.viewport=new rt;const S=[C,O],v=new Nu;v.layers.enable(1),v.layers.enable(2);let P=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let J=E[k];return J===void 0&&(J=new er,E[k]=J),J.getTargetRaySpace()},this.getControllerGrip=function(k){let J=E[k];return J===void 0&&(J=new er,E[k]=J),J.getGripSpace()},this.getHand=function(k){let J=E[k];return J===void 0&&(J=new er,E[k]=J),J.getHandSpace()};function B(k){const J=y.indexOf(k.inputSource);if(J===-1)return;const pe=E[J];pe!==void 0&&(pe.update(k.inputSource,k.frame,c||a),pe.dispatchEvent({type:k.type,data:k.inputSource}))}function V(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",V),r.removeEventListener("inputsourceschange",Z);for(let k=0;k<E.length;k++){const J=y[k];J!==null&&(y[k]=null,E[k].disconnect(J))}P=null,X=null,M.reset(),e.setRenderTarget(u),m=null,f=null,p=null,r=null,A=null,Xe.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(G.width,G.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(k){s=k,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(k){o=k,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(k){c=k},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return p},this.getFrame=function(){return x}
vendor: 6,335 bytes, line 3841
3841,this.getSession=function(){return r},this.setSession=async function(k){if(r=k,r!==null){if(u=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",V),r.addEventListener("inputsourceschange",Z),d.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(G),r.renderState.layers===void 0){const J={antialias:d.antialias,alpha:!0,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,J),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),A=new un(m.framebufferWidth,m.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:d.stencil})}else{let J=null,pe=null,le=null;d.depth&&(le=d.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,J=d.stencil?1027:1026,pe=d.stencil?1020:1014);const Ee={colorFormat:t.RGBA8,depthFormat:le,scaleFactor:s};p=new XRWebGLBinding(r,t),f=p.createProjectionLayer(Ee),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),A=new un(f.textureWidth,f.textureHeight,{format:1023,type:1009,depthTexture:new Ss(f.textureWidth,f.textureHeight,pe,void 0,void 0,void 0,void 0,void 0,void 0,J),stencilBuffer:d.stencil,colorSpace:e.outputColorSpace,samples:d.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Xe.setContext(r),Xe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function Z(k){for(let J=0;J<k.removed.length;J++){const pe=k.removed[J],le=y.indexOf(pe);le>=0&&(y[le]=null,E[le].disconnect(pe))}for(let J=0;J<k.added.length;J++){const pe=k.added[J];let le=y.indexOf(pe);if(le===-1){for(let Re=0;Re<E.length;Re++)if(Re>=y.length){y.push(pe),le=Re;break}else if(y[Re]===null){y[Re]=pe,le=Re;break}if(le===-1)break}const Ee=E[le];Ee&&Ee.connect(pe)}}const H=new F,j=new F;function z(k,J,pe){H.setFromMatrixPosition(J.matrixWorld),j.setFromMatrixPosition(pe.matrixWorld);const le=H.distanceTo(j),Ee=J.projectionMatrix.elements,Re=pe.projectionMatrix.elements,Ue=Ee[14]/(Ee[10]-1),$e=Ee[14]/(Ee[10]+1),b=(Ee[9]+1)/Ee[5],Qe=(Ee[9]-1)/Ee[5],We=(Ee[8]-1)/Ee[0],qe=(Re[8]+1)/Re[0],ve=Ue*We,et=Ue*qe,Ae=le/(-We+qe),Ce=Ae*-We;if(J.matrixWorld.decompose(k.position,k.quaternion,k.scale),k.translateX(Ce),k.translateZ(Ae),k.matrixWorld.compose(k.position,k.quaternion,k.scale),k.matrixWorldInverse.copy(k.matrixWorld).invert(),Ee[10]===-1)k.projectionMatrix.copy(J.projectionMatrix),k.projectionMatrixInverse.copy(J.projectionMatrixInverse);else{const T=Ue+Ae,_=$e+Ae,N=ve-Ce,Y=et+(le-Ce),$=b*$e/_*T,K=Qe*$e/_*T;k.projectionMatrix.makePerspective(N,Y,$,K,T,_),k.projectionMatrixInverse.copy(k.projectionMatrix).invert()}}function ae(k,J){J===null?k.matrixWorld.copy(k.matrix):k.matrixWorld.multiplyMatrices(J.matrixWorld,k.matrix),k.matrixWorldInverse.copy(k.matrixWorld).invert()}this.updateCamera=function(k){if(r===null)return;let J=k.near,pe=k.far;M.texture!==null&&(M.depthNear>0&&(J=M.depthNear),M.depthFar>0&&(pe=M.depthFar)),v.near=O.near=C.near=J,v.far=O.far=C.far=pe,(P!==v.near||X!==v.far)&&(r.updateRenderState({depthNear:v.near,depthFar:v.far}),P=v.near,X=v.far);const le=k.parent,Ee=v.cameras;ae(v,le);for(let Re=0;Re<Ee.length;Re++)ae(Ee[Re],le);Ee.length===2?z(v,C,O):v.projectionMatrix.copy(C.projectionMatrix),ue(k,v,le)};function ue(k,J,pe){pe===null?k.matrix.copy(J.matrixWorld):(k.matrix.copy(pe.matrixWorld),k.matrix.invert(),k.matrix.multiply(J.matrixWorld)),k.matrix.decompose(k.position,k.quaternion,k.scale),k.updateMatrixWorld(!0),k.projectionMatrix.copy(J.projectionMatrix),k.projectionMatrixInverse.copy(J.projectionMatrixInverse),k.isPerspectiveCamera&&(k.fov=nr*2*Math.atan(1/k.projectionMatrix.elements[5]),k.zoom=1)}this.getCamera=function(){return v},this.getFoveation=function(){if(!(f===null&&m===null))return l},this.setFoveation=function(k){l=k,f!==null&&(f.fixedFoveation=k),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=k)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(v)};let me=null;function Ie(k,J){if(h=J.getViewerPose(c||a),x=J,h!==null){const pe=h.views;m!==null&&(e.setRenderTargetFramebuffer(A,m.framebuffer),e.setRenderTarget(A));let le=!1;pe.length!==v.cameras.length&&(v.cameras.length=0,le=!0);for(let Re=0;Re<pe.length;Re++){const Ue=pe[Re];let $e=null;if(m!==null)$e=m.getViewport(Ue);else{const Qe=p.getViewSubImage(f,Ue);$e=Qe.viewport,Re===0&&(e.setRenderTargetTextures(A,Qe.colorTexture,f.ignoreDepthValues?void 0:Qe.depthStencilTexture),e.setRenderTarget(A))}let b=S[Re];b===void 0&&(b=new Rt,b.layers.enable(Re),b.viewport=new rt,S[Re]=b),b.matrix.fromArray(Ue.transform.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale),b.projectionMatrix.fromArray(Ue.projectionMatrix),b.projectionMatrixInverse.copy(b.projectionMatrix).invert(),b.viewport.set($e.x,$e.y,$e.width,$e.height),Re===0&&(v.matrix.copy(b.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),le===!0&&v.cameras.push(b)}const Ee=r.enabledFeatures;if(Ee&&Ee.includes("depth-sensing")){const Re=p.getDepthInformation(pe[0]);Re&&Re.isValid&&Re.texture&&M.init(e,Re,r.renderState)}}for(let pe=0;pe<E.length;pe++){const le=y[pe],Ee=E[pe];le!==null&&Ee!==void 0&&Ee.update(le,J,c||a)}me&&me(k,J),J.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:J}),x=null}const Xe=new xs;Xe.setAnimationLoop(Ie),this.setAnimationLoop=function(k){me=k},this.dispose=function(){}}}const an=new It,Vu=new Je;function ku(i,e){function t(d,u){d.matrixAutoUpdate===!0&&d.updateMatrix(),u.value.copy(d.matrix)}function n(d,u){u.color.getRGB(d.fogColor.value,_s(i)),u.isFog?(d.fogNear.value=u.near,d.fogFar.value=u.far):u.isFogExp2&&(d.fogDensity.value=u.density)}function r(d,u,A,E,y){u.isMeshBasicMaterial||u.isMeshLambertMaterial?s(d,u):u.isMeshToonMaterial?(s(d,u),p(d,u)):u.isMeshPhongMaterial?(s(d,u),h(d,u)):u.isMeshStandardMaterial?(s(d,u),f(d,u),u.isMeshPhysicalMaterial&&m(d,u,y)):u.isMeshMat
vendor: 2,212 bytes, line 3841
3841capMaterial?(s(d,u),x(d,u)):u.isMeshDepthMaterial?s(d,u):u.isMeshDistanceMaterial?(s(d,u),M(d,u)):u.isMeshNormalMaterial?s(d,u):u.isLineBasicMaterial?(a(d,u),u.isLineDashedMaterial&&o(d,u)):u.isPointsMaterial?l(d,u,A,E):u.isSpriteMaterial?c(d,u):u.isShadowMaterial?(d.color.value.copy(u.color),d.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(d,u){d.opacity.value=u.opacity,u.color&&d.diffuse.value.copy(u.color),u.emissive&&d.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(d.map.value=u.map,t(u.map,d.mapTransform)),u.alphaMap&&(d.alphaMap.value=u.alphaMap,t(u.alphaMap,d.alphaMapTransform)),u.bumpMap&&(d.bumpMap.value=u.bumpMap,t(u.bumpMap,d.bumpMapTransform),d.bumpScale.value=u.bumpScale,u.side===1&&(d.bumpScale.value*=-1)),u.normalMap&&(d.normalMap.value=u.normalMap,t(u.normalMap,d.normalMapTransform),d.normalScale.value.copy(u.normalScale),u.side===1&&d.normalScale.value.negate()),u.displacementMap&&(d.displacementMap.value=u.displacementMap,t(u.displacementMap,d.displacementMapTransform),d.displacementScale.value=u.displacementScale,d.displacementBias.value=u.displacementBias),u.emissiveMap&&(d.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,d.emissiveMapTransform)),u.specularMap&&(d.specularMap.value=u.specularMap,t(u.specularMap,d.specularMapTransform)),u.alphaTest>0&&(d.alphaTest.value=u.alphaTest);const A=e.get(u),E=A.envMap,y=A.envMapRotation;E&&(d.envMap.value=E,an.copy(y),an.x*=-1,an.y*=-1,an.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(an.y*=-1,an.z*=-1),d.envMapRotation.value.setFromMatrix4(Vu.makeRotationFromEuler(an)),d.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=u.reflectivity,d.ior.value=u.ior,d.refractionRatio.value=u.refractionRatio),u.lightMap&&(d.lightMap.value=u.lightMap,d.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,d.lightMapTransform)),u.aoMap&&(d.aoMap.value=u.aoMap,d.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,d.aoMapTransform))}function a(d,u){d.diffuse.value.copy(u.color),d.opacity.value=u.opacity,u.map&&(d.map.value=u.map,t(u.map,d.mapTransform))}function o(d,u){d.dashSize.value=u.dashSize,d.totalSize.value=u.dashSize
vendor: 4,693 bytes, line 3841
3841+u.gapSize,d.scale.value=u.scale}function l(d,u,A,E){d.diffuse.value.copy(u.color),d.opacity.value=u.opacity,d.size.value=u.size*A,d.scale.value=E*.5,u.map&&(d.map.value=u.map,t(u.map,d.uvTransform)),u.alphaMap&&(d.alphaMap.value=u.alphaMap,t(u.alphaMap,d.alphaMapTransform)),u.alphaTest>0&&(d.alphaTest.value=u.alphaTest)}function c(d,u){d.diffuse.value.copy(u.color),d.opacity.value=u.opacity,d.rotation.value=u.rotation,u.map&&(d.map.value=u.map,t(u.map,d.mapTransform)),u.alphaMap&&(d.alphaMap.value=u.alphaMap,t(u.alphaMap,d.alphaMapTransform)),u.alphaTest>0&&(d.alphaTest.value=u.alphaTest)}function h(d,u){d.specular.value.copy(u.specular),d.shininess.value=Math.max(u.shininess,1e-4)}function p(d,u){u.gradientMap&&(d.gradientMap.value=u.gradientMap)}function f(d,u){d.metalness.value=u.metalness,u.metalnessMap&&(d.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,d.metalnessMapTransform)),d.roughness.value=u.roughness,u.roughnessMap&&(d.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,d.roughnessMapTransform)),u.envMap&&(d.envMapIntensity.value=u.envMapIntensity)}function m(d,u,A){d.ior.value=u.ior,u.sheen>0&&(d.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),d.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(d.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,d.sheenColorMapTransform)),u.sheenRoughnessMap&&(d.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,d.sheenRoughnessMapTransform))),u.clearcoat>0&&(d.clearcoat.value=u.clearcoat,d.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(d.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,d.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(d.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===1&&d.clearcoatNormalScale.value.negate())),u.dispersion>0&&(d.dispersion.value=u.dispersion),u.iridescence>0&&(d.iridescence.value=u.iridescence,d.iridescenceIOR.value=u.iridescenceIOR,d.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(d.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,d.iridescenceMapTransform)),u.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),u.transmission>0&&(d.transmission.value=u.transmission,d.transmissionSamplerMap.value=A.texture,d.transmissionSamplerSize.value.set(A.width,A.height),u.transmissionMap&&(d.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,d.transmissionMapTransform)),d.thickness.value=u.thickness,u.thicknessMap&&(d.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=u.attenuationDistance,d.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(d.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(d.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=u.specularIntensity,d.specularColor.value.copy(u.specularColor),u.specularColorMap&&(d.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,d.specularColorMapTransform)),u.specularIntensityMap&&(d.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,d.specularIntensityMapTransform))}function x(d,u){u.matcap&&(d.matcap.value=u.matcap)}function M(d,u){const A=e.get(u).light;d.referencePosition.value.setFromMatrixPosition(A.matrixWorld),d.nearDistance.value=A.shadow.camera.near,d.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Wu(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,E){const y=E.program;n.uniformBlockBinding(A,y)}function c(A,E){let y=r[A.id];y===void 0&&(x(A),y=h(A),r[A.id]=y,A.addEventListener("dispose",d));const G=E.program;n.updateUBOMapping(A,G);const R=e.render.frame;s[A.id]!==R&&(f(A),s[A.id]=R)}function h(A){const E=p();A.__bindingPointIndex=E;const y=i.createBuffer(),G=A.__size,R=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,G,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,y),y}function p(){for(let A=0;A<o;A++)if(a.indexOf(A)===-1)return a.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}
vendor: 4,638 bytes, line 3841
3841function f(A){const E=r[A.id],y=A.uniforms,G=A.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let R=0,C=y.length;R<C;R++){const O=Array.isArray(y[R])?y[R]:[y[R]];for(let S=0,v=O.length;S<v;S++){const P=O[S];if(m(P,R,S,G)===!0){const X=P.__offset,B=Array.isArray(P.value)?P.value:[P.value];let V=0;for(let Z=0;Z<B.length;Z++){const H=B[Z],j=M(H);typeof H=="number"||typeof H=="boolean"?(P.__data[0]=H,i.bufferSubData(i.UNIFORM_BUFFER,X+V,P.__data)):H.isMatrix3?(P.__data[0]=H.elements[0],P.__data[1]=H.elements[1],P.__data[2]=H.elements[2],P.__data[3]=0,P.__data[4]=H.elements[3],P.__data[5]=H.elements[4],P.__data[6]=H.elements[5],P.__data[7]=0,P.__data[8]=H.elements[6],P.__data[9]=H.elements[7],P.__data[10]=H.elements[8],P.__data[11]=0):(H.toArray(P.__data,V),V+=j.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,X,P.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(A,E,y,G){const R=A.value,C=E+"_"+y;if(G[C]===void 0)return typeof R=="number"||typeof R=="boolean"?G[C]=R:G[C]=R.clone(),!0;{const O=G[C];if(typeof R=="number"||typeof R=="boolean"){if(O!==R)return G[C]=R,!0}else if(O.equals(R)===!1)return O.copy(R),!0}return!1}function x(A){const E=A.uniforms;let y=0;const G=16;for(let C=0,O=E.length;C<O;C++){const S=Array.isArray(E[C])?E[C]:[E[C]];for(let v=0,P=S.length;v<P;v++){const X=S[v],B=Array.isArray(X.value)?X.value:[X.value];for(let V=0,Z=B.length;V<Z;V++){const H=B[V],j=M(H),z=y%G,ae=z%j.boundary,ue=z+ae;y+=ae,ue!==0&&G-ue<j.storage&&(y+=G-ue),X.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),X.__offset=y,y+=j.storage}}}const R=y%G;return R>0&&(y+=G-R),A.__size=y,A.__cache={},this}function M(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function d(A){const E=A.target;E.removeEventListener("dispose",d);const y=a.indexOf(E.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function u(){for(const A in r)i.deleteBuffer(r[A]);a=[],r={},s={}}return{bind:l,update:c,dispose:u}}class Yu{constructor(e={}){const{canvas:t=Us(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:p=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),x=new Int32Array(4);let M=null,d=null;const u=[],A=[];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._outputColorSpace=wt,this.toneMapping=0,this.toneMappingExposure=1;const E=this;let y=!1,G=0,R=0,C=null,O=-1,S=null;const v=new rt,P=new rt;let X=null;const B=new Be(0);let V=0,Z=t.width,H=t.height,j=1,z=null,ae=null;const ue=new rt(0,0,Z,H),me=new rt(0,0,Z,H);let Ie=!1;const Xe=new or;let k=!1,J=!1;const pe=new Je,le=new F,Ee=new rt,Re={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ue=!1;function $e(){return C===null?j:1}let b=n;function Qe(g,L){return t.getContext(g,L)}try{const g={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${rr}`),t.addEventListener("webglcontextlost",W,!1),t.addEventListener("webglcontextrestored",q,!1),t.addEventListener("webglcontextcreationerror",ne,!1),b===null){const L="webgl2";if(b=Qe(L,g),b===null)throw Qe(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(g){throw console.error("THREE.WebGLRenderer: "+g.message),g}let We,qe,ve,et,Ae,Ce,T,_,N,Y,$,K,xe,re,ce,we,Q,oe,Fe,ye,he,be,De,Ke;function w(){We=new jl(b),We.init(),be=new Fu(b,We),qe=new Xl(b,We,e,be),ve=new Du(b),et=new ec(b),Ae=new vu,Ce=new Iu(b,We,ve,Ae,qe,be,et),T=new Yl(E),_=new Zl(E),N=new aa(b),De=new kl(b,N),Y=new Jl(b,N,et,De),$=new nc(b,Y,N,et),Fe
vendor: 4,838 bytes, line 3841
3841=new tc(b,qe,Ce),we=new ql(Ae),K=new gu(E,T,_,We,qe,De,we),xe=new ku(E,Ae),re=new Mu,ce=new bu(We),oe=new Vl(E,T,_,ve,$,f,l),Q=new Lu(E,$,qe),Ke=new Wu(b,et,qe,ve),ye=new Wl(b,We,et),he=new Ql(b,We,et),et.programs=K.programs,E.capabilities=qe,E.extensions=We,E.properties=Ae,E.renderLists=re,E.shadowMap=Q,E.state=ve,E.info=et}w();const ee=new Hu(E,b);this.xr=ee,this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){const g=We.get("WEBGL_lose_context");g&&g.loseContext()},this.forceContextRestore=function(){const g=We.get("WEBGL_lose_context");g&&g.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(g){g!==void 0&&(j=g,this.setSize(Z,H,!1))},this.getSize=function(g){return g.set(Z,H)},this.setSize=function(g,L,U=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Z=g,H=L,t.width=Math.floor(g*j),t.height=Math.floor(L*j),U===!0&&(t.style.width=g+"px",t.style.height=L+"px"),this.setViewport(0,0,g,L)},this.getDrawingBufferSize=function(g){return g.set(Z*j,H*j).floor()},this.setDrawingBufferSize=function(g,L,U){Z=g,H=L,j=U,t.width=Math.floor(g*U),t.height=Math.floor(L*U),this.setViewport(0,0,g,L)},this.getCurrentViewport=function(g){return g.copy(v)},this.getViewport=function(g){return g.copy(ue)},this.setViewport=function(g,L,U,I){g.isVector4?ue.set(g.x,g.y,g.z,g.w):ue.set(g,L,U,I),ve.viewport(v.copy(ue).multiplyScalar(j).round())},this.getScissor=function(g){return g.copy(me)},this.setScissor=function(g,L,U,I){g.isVector4?me.set(g.x,g.y,g.z,g.w):me.set(g,L,U,I),ve.scissor(P.copy(me).multiplyScalar(j).round())},this.getScissorTest=function(){return Ie},this.setScissorTest=function(g){ve.setScissorTest(Ie=g)},this.setOpaqueSort=function(g){z=g},this.setTransparentSort=function(g){ae=g},this.getClearColor=function(g){return g.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor.apply(oe,arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha.apply(oe,arguments)},this.clear=function(g=!0,L=!0,U=!0){let I=0;if(g){let D=!1;if(C!==null){const te=C.texture.format;D=te===1033||te===1031||te===1029}if(D){const te=C.texture.type,se=te===1009||te===1014||te===1012||te===1020||te===1017||te===1018,de=oe.getClearColor(),fe=oe.getClearAlpha(),Se=de.r,Te=de.g,_e=de.b;se?(m[0]=Se,m[1]=Te,m[2]=_e,m[3]=fe,b.clearBufferuiv(b.COLOR,0,m)):(x[0]=Se,x[1]=Te,x[2]=_e,x[3]=fe,b.clearBufferiv(b.COLOR,0,x))}else I|=b.COLOR_BUFFER_BIT}L&&(I|=b.DEPTH_BUFFER_BIT),U&&(I|=b.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),b.clear(I)},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.dispose=function(){t.removeEventListener("webglcontextlost",W,!1),t.removeEventListener("webglcontextrestored",q,!1),t.removeEventListener("webglcontextcreationerror",ne,!1),re.dispose(),ce.dispose(),Ae.dispose(),T.dispose(),_.dispose(),$.dispose(),De.dispose(),Ke.dispose(),K.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",Ct),ee.removeEventListener("sessionend",cr),Qt.stop()};function W(g){g.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function q(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const g=et.autoReset,L=Q.enabled,U=Q.autoUpdate,I=Q.needsUpdate,D=Q.type;w(),et.autoReset=g,Q.enabled=L,Q.autoUpdate=U,Q.needsUpdate=I,Q.type=D}function ne(g){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",g.statusMessage)}function Me(g){const L=g.target;L.removeEventListener("dispose",Me),Oe(L)}function Oe(g){tt(g),Ae.remove(g)}function tt(g){const L=Ae.get(g).programs;L!==void 0&&(L.forEach(function(U){K.releaseProgram(U)}),g.isShaderMaterial&&K.releaseShaderCache(g))}this.renderBufferDirect=function(g,L,U,I,D,te){L===null&&(L=Re);const se=D.isMesh&&D.matrixWorld.determinant()<0,de=Cs(g,L,U,I,D);ve.setMaterial(I,se);let fe=U.index,Se=1;if(I.wireframe===!0){if(fe=Y.getWireframeAttribute(U),fe===void 0)return;Se=2}const Te=U.drawRange,_e=U.attributes.position;let ze=Te.start*Se,Ze=(Te.start+Te.count)*Se;te!==null&&(ze=Math.max(ze,te.start*Se),Ze=Math.min(Ze,(te.start+te.count)*Se)),fe!==null?(ze=Math.max(ze,0),Ze=Math.min(Ze,fe.count)):_e!=null&&(ze=Math.max(ze,0),Ze=Math.min(Ze,_e.count));const je=Ze-ze;if(je<0||je===1/0)return;De.setup(D,I,de,U,fe);let gt,He=ye;if(fe!==null&&(gt=N.get(fe),He=he,He.setIndex(gt)),D.isMesh)I.wireframe===!0?(ve.setLineWidth(I.wireframeLinewidth*$e()),He.setMode(b.LINES)):He.setMode(b.TRIANGLES);else if(D.isLine){let ge=I.linewidth;ge===void 0&&(ge=1),ve.setLineWidth(ge*$e()),D.isLineSegments?He.setMode(b.LINES):D.isLine
vendor: 16,278 bytes, line 3841
3841Loop?He.setMode(b.LINE_LOOP):He.setMode(b.LINE_STRIP)}else D.isPoints?He.setMode(b.POINTS):D.isSprite&&He.setMode(b.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)He.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(We.get("WEBGL_multi_draw"))He.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ge=D._multiDrawStarts,ct=D._multiDrawCounts,Ve=D._multiDrawCount,Tt=fe?N.get(fe).bytesPerElement:1,hn=Ae.get(I).currentProgram.getUniforms();for(let vt=0;vt<Ve;vt++)hn.setValue(b,"_gl_DrawID",vt),He.render(ge[vt]/Tt,ct[vt])}else if(D.isInstancedMesh)He.renderInstances(ze,je,D.count);else if(U.isInstancedBufferGeometry){const ge=U._maxInstanceCount!==void 0?U._maxInstanceCount:1/0,ct=Math.min(U.instanceCount,ge);He.renderInstances(ze,je,ct)}else He.render(ze,je)};function lt(g,L,U){g.transparent===!0&&g.side===2&&g.forceSinglePass===!1?(g.side=1,g.needsUpdate=!0,Yn(g,L,U),g.side=0,g.needsUpdate=!0,Yn(g,L,U),g.side=2):Yn(g,L,U)}this.compile=function(g,L,U=null){U===null&&(U=g),d=ce.get(U),d.init(L),A.push(d),U.traverseVisible(function(D){D.isLight&&D.layers.test(L.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),g!==U&&g.traverseVisible(function(D){D.isLight&&D.layers.test(L.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),d.setupLights();const I=new Set;return g.traverse(function(D){const te=D.material;if(te)if(Array.isArray(te))for(let se=0;se<te.length;se++){const de=te[se];lt(de,U,D),I.add(de)}else lt(te,U,D),I.add(te)}),A.pop(),d=null,I},this.compileAsync=function(g,L,U=null){const I=this.compile(g,L,U);return new Promise(D=>{function te(){if(I.forEach(function(se){Ae.get(se).currentProgram.isReady()&&I.delete(se)}),I.size===0){D(g);return}setTimeout(te,10)}We.get("KHR_parallel_shader_compile")!==null?te():setTimeout(te,10)})};let Ge=null;function Ft(g){Ge&&Ge(g)}function Ct(){Qt.stop()}function cr(){Qt.start()}const Qt=new xs;Qt.setAnimationLoop(Ft),typeof self<"u"&&Qt.setContext(self),this.setAnimationLoop=function(g){Ge=g,ee.setAnimationLoop(g),g===null?Qt.stop():Qt.start()},ee.addEventListener("sessionstart",Ct),ee.addEventListener("sessionend",cr),this.render=function(g,L){if(L!==void 0&&L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(L),L=ee.getCamera()),g.isScene===!0&&g.onBeforeRender(E,g,L,C),d=ce.get(g,A.length),d.init(L),A.push(d),pe.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),Xe.setFromProjectionMatrix(pe),J=this.localClippingEnabled,k=we.init(this.clippingPlanes,J),M=re.get(g,u.length),M.init(),u.push(M),ee.enabled===!0&&ee.isPresenting===!0){const te=E.xr.getDepthSensingMesh();te!==null&&yi(te,L,-1/0,E.sortObjects)}yi(g,L,0,E.sortObjects),M.finish(),E.sortObjects===!0&&M.sort(z,ae),Ue=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,Ue&&oe.addToRenderList(M,g),this.info.render.frame++,k===!0&&we.beginShadows();const U=d.state.shadowsArray;Q.render(U,g,L),k===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset();const I=M.opaque,D=M.transmissive;if(d.setupLights(),L.isArrayCamera){const te=L.cameras;if(D.length>0)for(let se=0,de=te.length;se<de;se++){const fe=te[se];hr(I,D,g,fe)}Ue&&oe.render(g);for(let se=0,de=te.length;se<de;se++){const fe=te[se];ur(M,g,fe,fe.viewport)}}else D.length>0&&hr(I,D,g,L),Ue&&oe.render(g),ur(M,g,L);C!==null&&(Ce.updateMultisampleRenderTarget(C),Ce.updateRenderTargetMipmap(C)),g.isScene===!0&&g.onAfterRender(E,g,L),De.resetDefaultState(),O=-1,S=null,A.pop(),A.length>0?(d=A[A.length-1],k===!0&&we.setGlobalState(E.clippingPlanes,d.state.camera)):d=null,u.pop(),u.length>0?M=u[u.length-1]:M=null};function yi(g,L,U,I){if(g.visible===!1)return;if(g.layers.test(L.layers)){if(g.isGroup)U=g.renderOrder;else if(g.isLOD)g.autoUpdate===!0&&g.update(L);else if(g.isLight)d.pushLight(g),g.castShadow&&d.pushShadow(g);else if(g.isSprite){if(!g.frustumCulled||Xe.intersectsSprite(g)){I&&Ee.setFromMatrixPosition(g.matrixWorld).applyMatrix4(pe);const se=$.update(g),de=g.material;de.visible&&M.push(g,se,de,U,Ee.z,null)}}else if((g.isMesh||g.isLine||g.isPoints)&&(!g.frustumCulled||Xe.intersectsObject(g))){const se=$.update(g),de=g.material;if(I&&(g.boundingSphere!==void 0?(g.boundingSphere===null&&g.computeBoundingSphere(),Ee.copy(g.boundingSphere.center)):(se.boundingSphere===null&&se.computeBoundingSphere(),Ee.copy(se.boundingSphere.center)),Ee.applyMatrix4(g.matrixWorld).applyMatrix4(pe)),Array.isArray(de)){const fe=se.groups;for(let Se=0,Te=fe.length;Se<Te;Se++){const _e=fe[Se],ze=de[_e.materialIndex];ze&&ze.visible&&M.push(g,se,ze,U,Ee.z,_e)}}else de.visible&&M.push(g,se,de,U,Ee.z,null)}}const te=g.children;for(let se=0,de=te.length;se<de;se++)yi(te[se],L,U,I)}function ur(g,L,U,I){const D=g.opaque,te=g.transmissive,se=g.transparent;d.setupLightsView(U),k===!0&&we.setGlobalState(E.clippingPlanes,U),I&&ve.viewport(v.copy(I)),D.length>0&&qn(D,L,U),te.length>0&&qn(te,L,U),se.length>0&&qn(se,L,U),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function hr(g,L,U,I){if((U.isScene===!0?U.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[I.id]===void 0&&(d.state.transmissionRenderTarget[I.id]=new un(1,1,{generateMipmaps:!0,type:We.has("EXT_color_buffer_half_float")||We.has("EXT_color_buffer_float")?1016:1009,minFilter:1008,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ke.workingColorSpace}));const te=d.state.transmissionRenderTarget[I.id],se=I.viewport||v;te.setSize(se.z,se.w);const de=E.getRenderTarget();E.setRenderTarget(te),E.getClearColor(B),V=E.getClearAlpha(),V<1&&E.setClearColor(16777215,.5),E.clear(),Ue&&oe.render(U);const fe=E.toneMapping;E.toneMapping=0;const Se=I.viewport;if(I.viewport!==void 0&&(I.viewport=void 0),d.setupLightsView(I),k===!0&&we.setGlobalState(E.clippingPlanes,I),qn(g,U,I),Ce.updateMultisampleRenderTarget(te),Ce.updateRenderTargetMipmap(te),We.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let _e=0,ze=L.length;_e<ze;_e++){const Ze=L[_e],je=Ze.object,gt=Ze.geometry,He=Ze.material,ge=Ze.group;if(He.side===2&&je.layers.test(I.layers)){const ct=He.side;He.side=1,He.needsUpdate=!0,dr(je,U,I,gt,He,ge),He.side=ct,He.needsUpdate=!0,Te=!0}}Te===!0&&(Ce.updateMultisampleRenderTarget(te),Ce.updateRenderTargetMipmap(te))}E.setRenderTarget(de),E.setClearColor(B,V),Se!==void 0&&(I.viewport=Se),E.toneMapping=fe}function qn(g,L,U){const I=L.isScene===!0?L.overrideMaterial:null;for(let D=0,te=g.length;D<te;D++){const se=g[D],de=se.object,fe=se.geometry,Se=I===null?se.material:I,Te=se.group;de.layers.test(U.layers)&&dr(de,L,U,fe,Se,Te)}}function dr(g,L,U,I,D,te){g.onBeforeRender(E,L,U,I,D,te),g.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,g.matrixWorld),g.normalMatrix.getNormalMatrix(g.modelViewMatrix),D.onBeforeRender(E,L,U,I,g,te),D.transparent===!0&&D.side===2&&D.forceSinglePass===!1?(D.side=1,D.needsUpdate=!0,E.renderBufferDirect(U,L,I,D,g,te),D.side=0,D.needsUpdate=!0,E.renderBufferDirect(U,L,I,D,g,te),D.side=2):E.renderBufferDirect(U,L,I,D,g,te),g.onAfterRender(E,L,U,I,D,te)}function Yn(g,L,U){L.isScene!==!0&&(L=Re);const I=Ae.get(g),D=d.state.lights,te=d.state.shadowsArray,se=D.state.version,de=K.getParameters(g,D.state,te,L,U),fe=K.getProgramCacheKey(de);let Se=I.programs;I.environment=g.isMeshStandardMaterial?L.environment:null,I.fog=L.fog,I.envMap=(g.isMeshStandardMaterial?_:T).get(g.envMap||I.environment),I.envMapRotation=I.environment!==null&&g.envMap===null?L.environmentRotation:g.envMapRotation,Se===void 0&&(g.addEventListener("dispose",Me),Se=new Map,I.programs=Se);let Te=Se.get(fe);if(Te!==void 0){if(I.currentProgram===Te&&I.lightsStateVersion===se)return pr(g,de),Te}else de.uniforms=K.getUniforms(g),g.onBeforeCompile(de,E),Te=K.acquireProgram(de,fe),Se.set(fe,Te),I.uniforms=de.uniforms;const _e=I.uniforms;return(!g.isShaderMaterial&&!g.isRawShaderMaterial||g.clipping===!0)&&(_e.clippingPlanes=we.uniform),pr(g,de),I.needsLights=Ps(g),I.lightsStateVersion=se,I.needsLights&&(_e.ambientLightColor.value=D.state.ambient,_e.lightProbe.value=D.state.probe,_e.directionalLights.value=D.state.directional,_e.directionalLightShadows.value=D.state.directionalShadow,_e.spotLights.value=D.state.spot,_e.spotLightShadows.value=D.state.spotShadow,_e.rectAreaLights.value=D.state.rectArea,_e.ltc_1.value=D.state.rectAreaLTC1,_e.ltc_2.value=D.state.rectAreaLTC2,_e.pointLights.value=D.state.point,_e.pointLightShadows.value=D.state.pointShadow,_e.hemisphereLights.value=D.state.hemi,_e.directionalShadowMap.value=D.state.directionalShadowMap,_e.directionalShadowMatrix.value=D.state.directionalShadowMatrix,_e.spotShadowMap.value=D.state.spotShadowMap,_e.spotLightMatrix.value=D.state.spotLightMatrix,_e.spotLightMap.value=D.state.spotLightMap,_e.pointShadowMap.value=D.state.pointShadowMap,_e.pointShadowMatrix.value=D.state.pointShadowMatrix),I.currentProgram=Te,I.uniformsList=null,Te}function fr(g){if(g.uniformsList===null){const L=g.currentProgram.getUniforms();g.uniformsList=_i.seqWithValue(L.seq,g.uniforms)}return g.uniformsList}function pr(g,L){const U=Ae.get(g);U.outputColorSpace=L.outputColorSpace,U.batching=L.batching,U.batchingColor=L.batchingColor,U.instancing=L.instancing,U.instancingColor=L.instancingColor,U.instancingMorph=L.instancingMorph,U.skinning=L.skinning,U.morphTargets=L.morphTargets,U.morphNormals=L.morphNormals,U.morphColors=L.morphColors,U.morphTargetsCount=L.morphTargetsCount,U.numClippingPlanes=L.numClippingPlanes,U.numIntersection=L.numClipIntersection,U.vertexAlphas=L.vertexAlphas,U.vertexTangents=L.vertexTangents,U.toneMapping=L.toneMapping}function Cs(g,L,U,I,D){L.isScene!==!0&&(L=Re),Ce.resetTextureUnits();const te=L.fog,se=I.isMeshStandardMaterial?L.environment:null,de=C===null?E.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:jt,fe=(I.isMeshStandardMaterial?_:T).get(I.envMap||se),Se=I.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,Te=!!U.attributes.tangent&&(!!I.normalMap||I.anisotropy>0),_e=!!U.morphAttributes.position,ze=!!U.morphAttributes.normal,Ze=!!U.morphAttributes.color;let je=0;I.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(je=E.toneMapping);const gt=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,He=gt!==void 0?gt.length:0,ge=Ae.get(I),ct=d.state.lights;if(k===!0&&(J===!0||g!==S)){const St=g===S&&I.id===O;we.setState(I,g,St)}let Ve=!1;I.version===ge.__version?(ge.needsLights&&ge.lightsStateVersion!==ct.state.version||ge.outputColorSpace!==de||D.isBatchedMesh&&ge.batching===!1||!D.isBatchedMesh&&ge.batching===!0||D.isBatchedMesh&&ge.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&ge.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&ge.instancing===!1||!D.isInstancedMesh&&ge.instancing===!0||D.isSkinnedMesh&&ge.skinning===!1||!D.isSkinnedMesh&&ge.skinning===!0||D.isInstancedMesh&&ge.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&ge.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&ge.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&ge.instancingMorph===!1&&D.morphTexture!==null||ge.envMap!==fe||I.fog===!0&&ge.fog!==te||ge.numClippingPlanes!==void 0&&(ge.numClippingPlanes!==we.numPlanes||ge.numIntersection!==we.numIntersection)||ge.vertexAlphas!==Se||ge.vertexTangents!==Te||ge.morphTargets!==_e||ge.morphNormals!==ze||ge.morphColors!==Ze||ge.toneMapping!==je||ge.morphTargetsCount!==He)&&(Ve=!0):(Ve=!0,ge.__version=I.version);let Tt=ge.currentProgram;Ve===!0&&(Tt=Yn(I,L,D));let hn=!1,vt=!1,Ai=!1;const nt=Tt.getUniforms(),Vt=ge.uniforms;if(ve.useProgram(Tt.program)&&(hn=!0,vt=!0,Ai=!0),I.id!==O&&(O=I.id,vt=!0),hn||S!==g){nt.setValue(b,"projectionMatrix",g.projectionMatrix),nt.setValue(b,"viewMatrix",g.matrixWorldInverse);const St=nt.map.cameraPosition;St!==void 0&&St.setValue(b,le.setFromMatrixPosition(g.matrixWorld)),qe.logarithmicDepthBuffer&&nt.setValue(b,"logDepthBufFC",2/(Math.log(g.far+1)/Math.LN2)),(I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshLambertMaterial||I.isMeshBasicMaterial||I.isMeshStandardMaterial||I.isShaderMaterial)&&nt.setValue(b,"isOrthographic",g.isOrthographicCamera===!0),S!==g&&(S=g,vt=!0,Ai=!0)}if(D.isSkinnedMesh){nt.setOptional(b,D,"bindMatrix"),nt.setOptional(b,D,"bindMatrixInverse");const St=D.skeleton;St&&(St.boneTexture===null&&St.computeBoneTexture(),nt.setValue(b,"boneTexture",St.boneTexture,Ce))}D.isBatchedMesh&&(nt.setOptional(b,D,"batchingTexture"),nt.setValue(b,"batchingTexture",D._matricesTexture,Ce),nt.setOptional(b,D,"batchingIdTexture"),nt.setValue(b,"batchingIdTexture",D._indirectTexture,Ce),nt.setOptional(b,D,"batchingColorTexture"),D._colorsTexture!==null&&nt.setValue(b,"batchingColorTexture",D._colorsTexture,Ce));const bi=U.morphAttributes;if((bi.position!==void 0||bi.normal!==void 0||bi.color!==void 0)&&Fe.update(D,U,Tt),(vt||ge.receiveShadow!==D.receiveShadow)&&(ge.receiveShadow=D.receiveShadow,nt.setValue(b,"receiveShadow",D.receiveShadow)),I.isMeshGouraudMaterial&&I.envMap!==null&&(Vt.envMap.value=fe,Vt.flipEnvMap.value=fe.isCubeTexture&&fe.isRenderTargetTexture===!1?-1:1),I.isMeshStandardMaterial&&I.envMap===null&&L.environment!==null&&(Vt.envMapIntensity.value=L.environmentIntensity),vt&&(nt.setValue(b,"toneMappingExposure",E.toneMappingExposure),ge.needsLights&&ws(Vt,Ai),te&&I.fog===!0&&xe.refreshFogUniforms(Vt,te),xe.refreshMaterialUniforms(Vt,I,j,H,d.state.transmissionRenderTarget[g.id]),_i.upload(b,fr(ge),Vt,Ce)),I.isShaderMaterial&&I.uniformsNeedUpdate===!0&&(_i.upload(b,fr(ge),Vt,Ce),I.uniformsNeedUpdate=!1),I.isSpriteMaterial&&nt.setValue(b,"center",D.center),nt.setValue(b,"modelViewMatrix",D.modelViewMatrix),nt.setValue(b,"normalMatrix",D.normalMatrix),nt.setValue(b,"modelMatrix",D.matrixWorld),I.isShaderMaterial||I.isRawShaderMaterial){const St=I.uniformsGroups;for(let Ri=0,Ls=St.length;Ri<Ls;Ri++){const mr=St[Ri];Ke.update(mr,Tt),Ke.bind(mr,Tt)}}return Tt}function ws(g,L){g.ambientLightColor.needsUpdate=L,g.lightProbe.needsUpdate=L,g.directionalLights.needsUpdate=L,g.directionalLightShadows.needsUpdate=L,g.pointLights.needsUpdate=L,g.pointLightShadows.needsUpdate=L,g.spotLights.needsUpdate=L,g.spotLightShadows.needsUpdate=L,g.rectAreaLights.needsUpdate=L,g.hemisphereLights.needsUpdate=L}function Ps(g){return g.isMeshLambertMaterial||g.isMeshToonMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isShadowMaterial||g.isShaderMaterial&&g.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(g,L,U){Ae.get(g.texture).__webglTexture=L,Ae.get(g.depthTexture).__webglTexture=U;const I=Ae.get(g);I.__hasExternalTextures=!0,I.__autoAllocateDepthBuffer=U===void 0,I.__autoAllocateDepthBuffer||We.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),I.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(g,L){const U=Ae.get(g);U.__webglFramebuffer=L,U.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(g,L=0,U=0){C=g,G=L,R=U;let I=!0,D=null,te=!1,se=!1;if(g){const fe=Ae.get(g);if(fe.__useDefaultFramebuffer!==void 0)ve.bindFramebuffer(b.FRAMEBUFFER,null),I=!1;else if(fe.__webglFramebuffer===void 0)Ce.setupRenderTarget(g);else if(fe.__hasExternalTextures)Ce.rebindTextures(g,Ae.get(g.texture).__webglTexture,Ae.get(g.depthTexture).__webglTexture);else if(g.depthBuffer){const _e=g.depthTexture;if(fe.__boundDepthTexture!==_e){if(_e!==null&&Ae.has(_e)&&(g.width!==_e.image.width||g.height!==_e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Ce.setupDepthRenderbuffer(g)}}const Se=g.texture;(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)&&(se=!0);const Te=Ae.get(g).__webglFramebuffer;
3841g.isWebGLCubeRenderTarget?(Array.isArray(Te[L])?D=Te[L][U]:D=Te[L],te=!0):g.samples>0&&Ce.useMultisampledRTT(g)===!1?D=Ae.get(g).__webglMultisampledFramebuffer:Array.isArray(Te)?D=Te[U]:D=Te,v.copy(g.viewport),P.copy(g.scissor),X=g.scissorTest}else v.copy(ue).multiplyScalar(j).floor(),P.copy(me).multiplyScalar(j).floor(),X=Ie;if(ve.bindFramebuffer(b.FRAMEBUFFER,D)&&I&&ve.drawBuffers(g,D),ve.viewport(v),ve.scissor(P),ve.setScissorTest(X),te){const fe=Ae.get(g.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+L,fe.__webglTexture,U)}else if(se){const fe=Ae.get(g.texture),Se=L||0;b.framebufferTextureLayer(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,fe.__webglTexture,U||0,Se)}O=-1},this.readRenderTargetPixels=function(g,L,U,I,D,te,se){if(!(g&&g.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let de=Ae.get(g).__webglFramebuffer;if(g.isWebGLCubeRenderTarget&&se!==void 0&&(de=de[se]),de){ve.bindFramebuffer(b.FRAMEBUFFER,de);try{const fe=g.texture,Se=fe.format,Te=fe.type;if(!qe.textureFormatReadable(Se)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qe.textureTypeReadable(Te)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=g.width-I&&U>=0&&U<=g.height-D&&b.readPixels(L,U,I,D,be.convert(Se),be.convert(Te),te)}finally{const fe=C!==null?Ae.get(C).__webglFramebuffer:null;ve.bindFramebuffer(b.FRAMEBUFFER,fe)}}},this.readRenderTargetPixelsAsync=async function(g,L,U,I,D,te,se){if(!(g&&g.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let de=Ae.get(g).__webglFramebuffer;if(g.isWebGLCubeRenderTarget&&se!==void 0&&(de=de[se]),de){ve.bindFramebuffer(b.FRAMEBUFFER,de);try{const fe=g.texture,Se=fe.format,Te=fe.type;if(!qe.textureFormatReadable(Se))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!qe.textureTypeReadable(Te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(L>=0&&L<=g.width-I&&U>=0&&U<=g.height-D){const _e=b.createBuffer();b.bindBuffer(b.PIXEL_PACK_BUFFER,_e),b.bufferData(b.PIXEL_PACK_BUFFER,te.byteLength,b.STREAM_READ),b.readPixels(L,U,I,D,be.convert(Se),be.convert(Te),0),b.flush();const ze=b.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);await Is(b,ze,4);try{b.bindBuffer(b.PIXEL_PACK_BUFFER,_e),b.getBufferSubData(b.PIXEL_PACK_BUFFER,0,te)}finally{b.deleteBuffer(_e),b.deleteSync(ze)}return te}}finally{const fe=C!==null?Ae.get(C).__webglFramebuffer:null;ve.bindFramebuffer(b.FRAMEBUFFER,fe)}}},this.copyFramebufferToTexture=function(g,L=null,U=0){g.isTexture!==!0&&(zn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),L=arguments[0]||null,g=arguments[1]);const I=Math.pow(2,-U),D=Math.floor(g.image.width*I),te=Math.floor(g.image.height*I),se=L!==null?L.x:0,de=L!==null?L.y:0;Ce.setTexture2D(g,0),b.copyTexSubImage2D(b.TEXTURE_2D,U,0,0,se,de,D,te),ve.unbindTexture()},this.copyTextureToTexture=function(g,L,U=null,I=null,D=0){g.isTexture!==!0&&(zn("WebGLRenderer: copyTextureToTexture function signature has changed."),I=arguments[0]||null,g=arguments[1],L=arguments[2],D=arguments[3]||0,U=null);let te,se,de,fe,Se,Te;U!==null?(te=U.max.x-U.min.x,se=U.max.y-U.min.y,de=U.min.x,fe=U.min.y):(te=g.image.width,se=g.image.height,de=0,fe=0),I!==null?(Se=I.x,Te=I.y):(Se=0,Te=0);const _e=be.convert(L.format),ze=be.convert(L.type);Ce.setTexture2D(L,0),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,L.flipY),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),b.pixelStorei(b.UNPACK_ALIGNMENT,L.unpackAlignment);const Ze=b.getParameter(b.UNPACK_ROW_LENGTH),je=b.getParameter(b.UNPACK_IMAGE_HEIGHT),gt=b.getParameter(b.UNPACK_SKIP_PIXELS),He=b.getParameter(b.UNPACK_SKIP_ROWS),ge=b.getParameter(b.UNPACK_SKIP_IMAGES),ct=g.isCompressedTexture?g.mipmaps[D]:g.image;b.pixelStorei(b.UNPACK_ROW_LENGTH,ct.width),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,ct.height),b.pixelStorei(b.UNPACK_SKIP_PIXELS,de),b.pixelStorei(b.UNPACK_SKIP_ROWS,fe),g.isDataTexture?b.texSubImage2D(b.TEXTURE_2D,D,Se,Te,te,se,_e,ze,ct.data):g.isCompressedTexture?b.compressedTexSubImage2D(b.TEXTURE_2D,D,Se,Te,ct.width,ct.height,_e,ct.data):b.texSubImage2D(b.TEXTURE_2D,D,Se,Te,te,se,_e,ze,ct),b.pixelStorei(b.UNPACK_ROW_LENGTH,Ze),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,je),b.pixelStorei(b.UNPACK_SKIP_PIXELS,gt),b.pixelStorei(b.UNPACK_SKIP_ROWS,He),b.pixelStorei(b.UNPACK_SKIP_IMAGES,ge),D===0&&L.generateMipmaps&&b.generateMipmap(b.TEXTURE_2D),ve.unbindTexture()},this.copyTextureToTexture3D=function(g,L,U=null,I=null,D=0){g.isTexture!==!0&&(zn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),U=arguments[0]||null,I=arguments[1]||null,g=arguments[2],L=arguments[3],D=arguments[4]||0);let te,se,de,fe,Se,Te,_e,ze,Ze;const je=g.isCompressedTexture?g.mipmaps[D]:g.image;U!==null?(te=U.max.x-U.min.x,se=U.max.y-U.min.y,de=U.max.z-U.min.z,fe=U.min.x,Se=U.min.y,Te=U.min.z):(te=je.width,se=je.height,de=je.depth,fe=0,Se=0,Te=0),I!==null?(_e=I.x,ze=I.y,Ze=I.z):(_e=0,ze=0,Ze=0);const gt=be.convert(L.format),He=be.convert(L.type);let ge;if(L.isData3DTexture)Ce.setTexture3D(L,0),ge=b.TEXTURE_3D;else if(L.isDataArrayTexture||L.isCompressedArrayTexture)Ce.setTexture2DArray(L,0),ge=b.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,L.flipY),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),b.pixelStorei(b.UNPACK_ALIGNMENT,L.unpackAlignment);const ct=b.getParameter(b.UNPACK_ROW_LENGTH),Ve=b.getParameter(b.UNPACK_IMAGE_HEIGHT),Tt=b.getParameter(b.UNPACK_SKIP_PIXELS),hn=b.getParameter(b.UNPACK_SKIP_ROWS),vt=b.getParameter(b.UNPACK_SKIP_IMAGES);b.pixelStorei(b.UNPACK_ROW_LENGTH,je.width),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,je.height),b.pixelStorei(b.UNPACK_SKIP_PIXELS,fe),b.pixelStorei(b.UNPACK_SKIP_ROWS,Se),b.pixelStorei(b.UNPACK_SKIP_IMAGES,Te),g.isDataTexture||g.isData3DTexture?b.texSubImage3D(ge,D,_e,ze,Ze,te,se,de,gt,He,je.data):L.isCompressedArrayTexture?b.compressedTexSubImage3D(ge,D,_e,ze,Ze,te,se,de,gt,je.data):b.texSubImage3D(ge,D,_e,ze,Ze,te,se,de,gt,He,je),b.pixelStorei(b.UNPACK_ROW_LENGTH,ct),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,Ve),b.pixelStorei(b.UNPACK_SKIP_PIXELS,Tt),b.pixelStorei(b.UNPACK_SKIP_ROWS,hn),b.pixelStorei(b.UNPACK_SKIP_IMAGES,vt),D===0&&L.generateMipmaps&&b.generateMipmap(ge),ve.unbindTexture()},this.initRenderTarget=function(g){Ae.get(g).__webglFramebuffer===void 0&&Ce.setupRenderTarget(g)},this.initTexture=function(g){g.isCubeTexture?Ce.setTextureCube(g,0):g.isData3DTexture?Ce.setTexture3D(g,0):g.isDataArrayTexture||g.isCompressedArrayTexture?Ce.setTexture2DArray(g,0):Ce.setTexture2D(g,0),ve.unbindTexture()},this.resetState=function(){G=0,R=0,C=null,ve.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}
vendor: 7,405 bytes, line 3841
3841set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===sr?"display-p3":"srgb",t.unpackColorSpace=ke.workingColorSpace===Si?"display-p3":"srgb"}}class Ku extends dt{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 It,this.environmentIntensity=1,this.environmentRotation=new It,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}}class bs extends Jt{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new F,h=new Ne;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let p=0,f=3;p<=t;p++,f+=3){const m=n+p/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[f]/e+1)/2,h.y=(a[f+1]/e+1)/2,l.push(h.x,h.y)}for(let p=1;p<=t;p++)s.push(p,p+1,0);this.setIndex(s),this.setAttribute("position",new Ut(a,3)),this.setAttribute("normal",new Ut(o,3)),this.setAttribute("uv",new Ut(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bs(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class $u extends Wn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Be(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new It,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 Rs extends dt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Be(e),this.intensity=t}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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const tr=new Je,as=new F,os=new F;class Xu{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ne(512,512),this.map=null,this.mapPass=null,this.matrix=new Je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new or,this._frameExtents=new Ne(1,1),this._viewportCount=1,this._viewports=[new rt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;as.setFromMatrixPosition(e.matrixWorld),t.position.copy(as),os.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(os),t.updateMatrixWorld(),tr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(tr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(tr)}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.mapSize.copy(e.mapSize),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}}class qu extends Xu{constructor(){super(new Ms(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zu extends Rs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(dt.DEFAULT_UP),this.updateMatrix(),this.target=new dt,this.shadow=new qu}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class ju extends Rs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:rr}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=rr);export{ju as A,bs as C,Zu as D,Ht as M,Ms as O,wt as S,Yu as W,Ku as a,$u as b};
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.