1import{A as e,B as t,D as n,E as r,Et as i,G as a,H as o,K as s,L as c,N as l,O as u,R as d,T as f,Tt as p,W as m,Y as h,Z as g,et as _,f as v,ft as y,it as b,j as x,k as S,kt as C,o as w,q as T,u as E,w as D,x as O}from"./client-8ncp6pE6.js";import{t as k}from"./mail-C9H-seLZ.js";import{t as A}from"./sparkles-QE0YPFll.js";import{t as j}from"./square-kanban-CBXJQCPU.js";import{$ as M,G as N,K as P,Q as F,U as I,at as ee,c as te,ct as ne,et as re,ot as ie,z as ae}from"./index-BBRGlpnm.js";import{t as L}from"./SplitText-DbI5N-5T.js";import{t as R}from"./HeroNavbar-CODCFiUH.js";import{t as oe}from"./PublicFooter-Dp9ZdO2U.js";import{t as se}from"./StatsPortals-BnaP2FU7.js";function z(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function ce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function B(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function le(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function V(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function H(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function U(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function ue(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function W(e,t){let n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(n*n+r*r+i*i)}function G(e,t){let n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return n*n+r*r+i*i}function de(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function fe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function pe(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function me(e,t){let n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function he(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ge(e,t,n){let r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2];return e[0]=i*c-a*s,e[1]=a*o-r*c,e[2]=r*s-i*o,e}function _e(e,t,n,r){let i=t[0],a=t[1],o=t[2];return e[0]=i+r*(n[0]-i),e[1]=a+r*(n[1]-a),e[2]=o+r*(n[2]-o),e}function ve(e,t,n,r,i){let a=Math.exp(-r*i),o=t[0],s=t[1],c=t[2];return e[0]=n[0]+(o-n[0])*a,e[1]=n[1]+(s-n[1])*a,e[2]=n[2]+(c-n[2])*a,e}function ye(e,t,n){let r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o||=1,e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/o,e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function be(e,t,n){let r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o||=1,e[0]=(n[0]*r+n[4]*i+n[8]*a)/o,e[1]=(n[1]*r+n[5]*i+n[9]*a)/o,e[2]=(n[2]*r+n[6]*i+n[10]*a)/o,e}function xe(e,t,n){let r=t[0],i=t[1],a=t[2];return e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8],e}function Se(e,t,n){let r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2],l=n[3],u=s*a-c*i,d=c*r-o*a,f=o*i-s*r,p=s*f-c*d,m=c*u-o*f,h=o*d-s*u,g=l*2;return u*=g,d*=g,f*=g,p*=2,m*=2,h*=2,e[0]=r+u+p,e[1]=i+d+m,e[2]=a+f+h,e}var Ce=(function(){let e=[0,0,0],t=[0,0,0];return function(n,r){ce(e,n),ce(t,r),me(e,e),me(t,t);let i=he(e,t);return i>1?0:i<-1?Math.PI:Math.acos(i)}})();function we(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var Te=class e extends Array{constructor(e=0,t=e,n=e){return super(e,t,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,n=e){return e.length?this.copy(e):(B(this,e,t,n),this)}copy(e){return ce(this,e),this}add(e,t){return t?le(this,e,t):le(this,this,e),this}sub(e,t){return t?V(this,e,t):V(this,this,e),this}multiply(e){return e.length?H(this,this,e):ue(this,this,e),this}divide(e){return e.length?U(this,this,e):ue(this,this,1/e),this}inverse(e=this){return pe(this,e),this}len(){return z(this)}distance(e){return e?W(this,e):z(this)}squaredLen(){return de(this)}squaredDistance(e){return e?G(this,e):de(this)}negate(e=this){return fe(this,e),this}cross(e,t){return t?ge(this,e,t):ge(this,this,e),this}scale(e){return ue(this,this,e),this}normalize(){return me(this,this),this}dot(e){return he(this,e)}equals(e){return we(this,e)}applyMatrix3(e){return xe(this,this,e),this}applyMatrix4(e){return ye(this,this,e),this}scaleRotateMatrix4(e){return be(this,this,e),this}applyQuaternion(e){return Se(this,this,e),this}angle(e){return Ce(this,e)}lerp(e,t){return _e(this,this,e,t),this}smoothLerp(e,t,n){return ve(this,this,e,t,n),this}clone(){return new e(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){let t=this[0],n=this[1],r=this[2];return this[0]=e[0]*t+e[4]*n+e[8]*r,this[1]=e[1]*t+e[5]*n+e[9]*r,this[2]=e[2]*t+e[6]*n+e[10]*r,this.normalize()}},Ee=new Te,De=1,Oe=1,ke=!1,Ae=class{constructor(e,t={}){e.canvas||console.error(`gl not passed as first argument to Geometry`),this.gl=e,this.attributes=t,this.id=De++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let e in t)this.addAttribute(e,t[e])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Oe++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e===`index`?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn(`geometry has multiple instanced buffers of different length`),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e===`index`?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){let t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute(`index`,e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((e,{name:t,type:n})=>{if(!this.attributes[t]){console.warn(`active attribute ${t} not being supplied`);return}let r=this.attributes[t];this.gl.bindBuffer(r.target,r.buffer),this.glState.boundBuffer=r.buffer;let i=1;n===35674&&(i=2),n===35675&&(i=3),n===35676&&(i=4);
1let a=r.size/i,o=i===1?0:i*i*4,s=i===1?0:i*4;for(let t=0;t<i;t++)this.gl.vertexAttribPointer(e+t,a,r.type,r.normalized,r.stride+o,r.offset+t*s),this.gl.enableVertexAttribArray(e+t),this.gl.renderer.vertexAttribDivisor(e+t,r.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((e,{name:t})=>{let n=this.attributes[t];n.needsUpdate&&this.updateAttribute(n)});let n=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(n=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){let e=this.attributes.position;if(e.data)return e;if(!ke)return console.warn(`No position buffer data found to compute bounds`),ke=!0}computeBoundingBox(e){e||=this.getPosition();let t=e.data,n=e.size;this.bounds||={min:new Te,max:new Te,center:new Te,scale:new Te,radius:1/0};let r=this.bounds.min,i=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),i.set(-1/0);for(let e=0,a=t.length;e<a;e+=n){let n=t[e],a=t[e+1],o=t[e+2];r.x=Math.min(n,r.x),r.y=Math.min(a,r.y),r.z=Math.min(o,r.z),i.x=Math.max(n,i.x),i.y=Math.max(a,i.y),i.z=Math.max(o,i.z)}o.sub(i,r),a.add(r,i).divide(2)}computeBoundingSphere(e){e||=this.getPosition();let t=e.data,n=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let e=0,i=t.length;e<i;e+=n)Ee.fromArray(t,e),r=Math.max(r,this.bounds.center.squaredDistance(Ee));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}},je=1,Me={},Ne=class{constructor(e,{vertex:t,fragment:n,uniforms:r={},transparent:i=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:s=!0,depthWrite:c=!0,depthFunc:l=e.LEQUAL}={}){e.canvas||console.error(`gl not passed as first argument to Program`),this.gl=e,this.uniforms=r,this.id=je++,t||console.warn(`vertex shader not supplied`),n||console.warn(`fragment shader not supplied`),this.transparent=i,this.cullFace=a,this.frontFace=o,this.depthTest=s,this.depthWrite=c,this.depthFunc=l,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:n})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==``&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}\nVertex Shader\n${Fe(e)}`)),t&&(this.gl.shaderSource(this.fragmentShader,t),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==``&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}\nFragment Shader\n${Fe(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let n=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let e=0;e<n;e++){let t=this.gl.getActiveUniform(this.program,e);this.uniformLocations.set(t,this.gl.getUniformLocation(this.program,t.name));let n=t.name.match(/(\w+)/g);t.uniformName=n[0],t.nameComponents=n.slice(1)}this.attributeLocations=new Map;let r=[],i=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let e=0;e<i;e++){let t=this.gl.getActiveAttrib(this.program,e),n=this.gl.getAttribLocation(this.program,t.name);n!==-1&&(r[n]=t.name,this.attributeLocations.set(t,n))}this.attributeOrder=r.join(``)}setBlendFunc(e,t,n,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=n,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,n){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=n}setStencilOp(e,t,n){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=n}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram!==this.id&&(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id
1),this.uniformLocations.forEach((e,n)=>{let r=this.uniforms[n.uniformName];for(let e of n.nameComponents){if(!r)break;if(e in r)r=r[e];else if(Array.isArray(r.value))break;else{r=void 0;break}}if(!r)return Be(`Active uniform ${n.name} has not been supplied`);if(r&&r.value===void 0)return Be(`${n.name} uniform is missing a value parameter`);if(r.value.texture)return t+=1,r.value.update(t),Pe(this.gl,n.type,e,t);if(r.value.length&&r.value[0].texture){let i=[];return r.value.forEach(e=>{t+=1,e.update(t),i.push(t)}),Pe(this.gl,n.type,e,i)}Pe(this.gl,n.type,e,r.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}};function Pe(e,t,n,r){r=r.length?Ie(r):r;let i=e.renderer.state.uniformLocations.get(n);if(r.length)if(i===void 0||i.length!==r.length)e.renderer.state.uniformLocations.set(n,r.slice(0));else{if(Le(i,r))return;i.set?i.set(r):Re(i,r),e.renderer.state.uniformLocations.set(n,i)}else{if(i===r)return;e.renderer.state.uniformLocations.set(n,r)}switch(t){case 5126:return r.length?e.uniform1fv(n,r):e.uniform1f(n,r);case 35664:return e.uniform2fv(n,r);case 35665:return e.uniform3fv(n,r);case 35666:return e.uniform4fv(n,r);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return r.length?e.uniform1iv(n,r):e.uniform1i(n,r);case 35671:case 35667:return e.uniform2iv(n,r);case 35672:case 35668:return e.uniform3iv(n,r);case 35673:case 35669:return e.uniform4iv(n,r);case 35674:return e.uniformMatrix2fv(n,!1,r);case 35675:return e.uniformMatrix3fv(n,!1,r);case 35676:return e.uniformMatrix4fv(n,!1,r)}}function Fe(e){let t=e.split(` 2`);for(let e=0;e<t.length;e++)t[e]=e+1+`: `+t[e];return t.join(` 3`)}function Ie(e){let t=e.length,n=e[0].length;if(n===void 0)return e;let r=t*n,i=Me[r];i||(Me[r]=i=new Float32Array(r));for(let r=0;r<t;r++)i.set(e[r],r*n);return i}function Le(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Re(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t[n]}var ze=0;function Be(e){ze>100||(console.warn(e),ze++,ze>100&&console.warn(`More than 100 program warnings - stopping logs.`))}var Ve=new Te,He=1,Ue=class{constructor({canvas:e=document.createElement(`canvas`),width:t=300,height:n=150,dpr:r=1,alpha:i=!1,depth:a=!0,stencil:o=!1,antialias:s=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:l=!1,powerPreference:u=`default`,autoClear:d=!0,webgl:f=2}={}){let p={alpha:i,depth:a,stencil:o,antialias:s,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u};this.dpr=r,this.alpha=i,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=d,this.id=He++,f===2&&(this.gl=e.getContext(`webgl2`,p)),this.isWebgl2=!!this.gl,this.gl||=e.getContext(`webgl`,p),this.gl||console.error(`unable to create webgl context`),this.gl.renderer=this,this.setSize(t,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension(`EXT_color_buffer_float`),this.getExtension(`OES_texture_float_linear`)):(this.getExtension(`OES_texture_float`),this.getExtension(`OES_texture_float_linear`),this.getExtension(`OES_texture_half_float`),this.getExtension(`OES_texture_half_float_linear`),this.getExtension(`OES_element_index_uint`),this.getExtension(`OES_standard_derivatives`),this.getExtension(`EXT_sRGB`),this.getExtension(`WEBGL_depth_texture`),this.getExtension(`WEBGL_draw_buffers`)),this.getExtension(`WEBGL_compressed_texture_astc`),this.getExtension(`EXT_texture_compression_bptc`),this.getExtension(`WEBGL_compressed_texture_s3tc`),this.getExtension(`WEBGL_compressed_texture_etc1`),this.getExtension(`WEBGL_compressed_texture_pvrtc`),this.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`),this.vertexAttribDivisor=this.getExtension(`ANGLE_
3instanced_arrays`,`vertexAttribDivisor`,`vertexAttribDivisorANGLE`),this.drawArraysInstanced=this.getExtension(`ANGLE_instanced_arrays`,`drawArraysInstanced`,`drawArraysInstancedANGLE`),this.drawElementsInstanced=this.getExtension(`ANGLE_instanced_arrays`,`drawElementsInstanced`,`drawElementsInstancedANGLE`),this.createVertexArray=this.getExtension(`OES_vertex_array_object`,`createVertexArray`,`createVertexArrayOES`),this.bindVertexArray=this.getExtension(`OES_vertex_array_object`,`bindVertexArray`,`bindVertexArrayOES`),this.deleteVertexArray=this.getExtension(`OES_vertex_array_object`,`deleteVertexArray`,`deleteVertexArrayOES`),this.drawBuffers=this.getExtension(`WEBGL_draw_buffers`,`drawBuffers`,`drawBuffersWEBGL`),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension(`EXT_texture_filter_anisotropic`)?this.gl.getParameter(this.getExtension(`EXT_texture_filter_anisotropic`).MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+`px`,height:t+`px`})}setViewport(e,t,n=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=n,this.state.viewport.y=r,this.gl.viewport(n,r,e,t))}setScissor(e,t,n=0,r=0){this.gl.scissor(n,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,n,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===n&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=r,n===void 0?this.gl.blendFunc(e,t):this.gl.blendFuncSeparate(e,t,n,r))}setBlendEquation(e,t){e||=this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t===void 0?this.gl.blendEquation(e):this.gl.blendEquationSeparate(e,t))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,n){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===n||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=n||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,n||0))}setStencilOp(e,t,n){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===n||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=n,this.gl.stencilOp(e,t,n))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,n){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][n].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder===t.renderOrder?e.program.id===t.program.id?e.zDepth===t.zDepth?t.id-e.id:e.zDepth-t.zDepth:e.program.id-t.program.id:e.renderOrder-t.renderOrder}
3sortTransparent(e,t){return e.renderOrder===t.renderOrder?e.zDepth===t.zDepth?t.id-e.id:t.zDepth-e.zDepth:e.renderOrder-t.renderOrder}sortUI(e,t){return e.renderOrder===t.renderOrder?e.program.id===t.program.id?t.id-e.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder}getRenderList({scene:e,camera:t,frustumCull:n,sort:r}){let i=[];if(t&&n&&t.updateFrustum(),e.traverse(e=>{if(!e.visible)return!0;e.draw&&(n&&e.frustumCulled&&t&&!t.frustumIntersectsMesh(e)||i.push(e))}),r){let e=[],n=[],r=[];i.forEach(i=>{i.program.transparent?i.program.depthTest?n.push(i):r.push(i):e.push(i),i.zDepth=0,!(i.renderOrder!==0||!i.program.depthTest||!t)&&(i.worldMatrix.getTranslation(Ve),Ve.applyMatrix4(t.projectionViewMatrix),i.zDepth=Ve.z)}),e.sort(this.sortOpaque),n.sort(this.sortTransparent),r.sort(this.sortUI),i=e.concat(n,r)}return i}render({scene:e,camera:t,target:n=null,update:r=!0,sort:i=!0,frustumCull:a=!0,clear:o}){n===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!n||n.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!n||n.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:i}).forEach(e=>{e.draw({camera:t})})}};function We(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Ge(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function Ke(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=n*n+r*r+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=i*o,e[3]=a*o,e}function qe(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Je(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ye(e,t,n){n*=.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Xe(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=n[0],c=n[1],l=n[2],u=n[3];return e[0]=r*u+o*s+i*l-a*c,e[1]=i*u+o*c+a*s-r*l,e[2]=a*u+o*l+r*c-i*s,e[3]=o*u-r*s-i*c-a*l,e}function Ze(e,t,n){n*=.5;let r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);return e[0]=r*c+o*s,e[1]=i*c+a*s,e[2]=a*c-i*s,e[3]=o*c-r*s,e}function Qe(e,t,n){n*=.5;let r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);return e[0]=r*c-a*s,e[1]=i*c+o*s,e[2]=a*c+r*s,e[3]=o*c-i*s,e}function $e(e,t,n){n*=.5;let r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);return e[0]=r*c+i*s,e[1]=i*c-r*s,e[2]=a*c+o*s,e[3]=o*c-a*s,e}function et(e,t,n,r){let i=t[0],a=t[1],o=t[2],s=t[3],c=n[0],l=n[1],u=n[2],d=n[3],f,p,m,h,g;return p=i*c+a*l+o*u+s*d,p<0&&(p=-p,c=-c,l=-l,u=-u,d=-d),1-p>1e-6?(f=Math.acos(p),m=Math.sin(f),h=Math.sin((1-r)*f)/m,g=Math.sin(r*f)/m):(h=1-r,g=r),e[0]=h*i+g*c,e[1]=h*a+g*l,e[2]=h*o+g*u,e[3]=h*s+g*d,e}function tt(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=n*n+r*r+i*i+a*a,s=o?1/o:0;return e[0]=-n*s,e[1]=-r*s,e[2]=-i*s,e[3]=a*s,e}function nt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function rt(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);let i=(n+1)%3,a=(n+2)%3;r=Math.sqrt(t[n*3+n]-t[i*3+i]-t[a*3+a]+1),e[n]=.5*r,r=.5/r,e[3]=(t[i*3+a]-t[a*3+i])*r,e[i]=(t[i*3+n]+t[n*3+i])*r,e[a]=(t[a*3+n]+t[n*3+a])*r}return e}function it(e,t,n=`YXZ`){let r=Math.sin(t[0]*.5),i=Math.cos(t[0]*.5),a=Math.sin(t[1]*.5),o=Math.cos(t[1]*.5),s=Math.sin(t[2]*.5),c=Math.cos(t[2]*.5);return n===`XYZ`?(e[0]=r*o*c+i*a*s,e[1]=i*a*c-r*o*s,e[2]=i*o*s+r*a*c,e[3]=i*o*c-r*a*s):n===`YXZ`?(e[0]=r*o*c+i*a*s,e[1]=i*a*c-r*o*s,e[2]=i*o*s-r*a*c,e[3]=i*o*c+r*a*s):n===`ZXY`?(e[0]=r*o*c-i*a*s,e[1]=i*a*c+r*o*s,e[2]=i*o*s+r*a*c,e[3]=i*o*c-r*a*s):n===`ZYX`?(e[0]=r*o*c-i*a*s,e[1]=i*a*c+r*o*s,e[2]=i*o*s-r*a*c,e[3]=i*o*c+r*a*s):n===`YZX`?(e[0]=r*o*c+i*a*s,e[1]=i*a*c+r*o*s,e[2]=i*o*s-r*a*c,e[3]=i*o*c-r*a*s):n===`XZY`&&(e[0]=r*o*c-i*a*s,e[1]=i*a*c-r*o*s,e[2]=i*o*s+r*a*c,e[3]=i*o*c+r*a*s),e}
3var at=We,ot=Ge,st=qe,ct=Ke,lt=class extends Array{constructor(e=0,t=0,n=0,r=1){super(e,t,n,r),this.onChange=()=>{},this._target=this;let i=[`0`,`1`,`2`,`3`];return new Proxy(this,{set(e,t){let n=Reflect.set(...arguments);return n&&i.includes(t)&&e.onChange(),n}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return Je(this._target),this.onChange(),this}set(e,t,n,r){return e.length?this.copy(e):(ot(this._target,e,t,n,r),this.onChange(),this)}rotateX(e){return Ze(this._target,this._target,e),this.onChange(),this}rotateY(e){return Qe(this._target,this._target,e),this.onChange(),this}rotateZ(e){return $e(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return tt(this._target,e),this.onChange(),this}conjugate(e=this._target){return nt(this._target,e),this.onChange(),this}copy(e){return at(this._target,e),this.onChange(),this}normalize(e=this._target){return ct(this._target,e),this.onChange(),this}multiply(e,t){return t?Xe(this._target,e,t):Xe(this._target,this._target,e),this.onChange(),this}dot(e){return st(this._target,e)}fromMatrix3(e){return rt(this._target,e),this.onChange(),this}fromEuler(e,t){return it(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return Ye(this._target,e,t),this.onChange(),this}slerp(e,t){return et(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}},ut=1e-6;function dt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ft(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=u,e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h,e[15]=g,e}function pt(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function mt(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null}function ht(e){let t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m;return _*(d*g-f*h)-v*D+y*E+b*T-x*w+S*C}function gt(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,y=n[4],b=n[5],x=n[6],S=n[7],e[4]=y*r+b*s+x*d+S*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,y=n[8],b=n[9],x=n[10],S=n[11],e[8]=y*r+b*s+x*d+S*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,y=n[12],b=n[13],x=n[14],S=n[15],e[12]=y*r+b*s+x*d+S*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e}function _t(e,t,n){let r=n[0],i=n[1],a=n[2],o,s,c,l,u,d,f,p,m,h,g,_;return t===e?(e[12]=t[0]*r+t[4]*i+t[8]*a+t[12],e[13]=t[1]*r+t[5]*i+t[9]*a+t[13],e[14]=t[2]*r+t[6]*i+t[10]*a+t[14],e[15]=t[3]*r+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],c=t[2],l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11
3],e[0]=o,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=f,e[7]=p,e[8]=m,e[9]=h,e[10]=g,e[11]=_,e[12]=o*r+u*i+m*a+t[12],e[13]=s*r+d*i+h*a+t[13],e[14]=c*r+f*i+g*a+t[14],e[15]=l*r+p*i+_*a+t[15]),e}function vt(e,t,n){let r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function yt(e,t,n,r){let i=r[0],a=r[1],o=r[2],s=Math.hypot(i,a,o),c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j;return Math.abs(s)<ut?null:(s=1/s,i*=s,a*=s,o*=s,c=Math.sin(n),l=Math.cos(n),u=1-l,d=t[0],f=t[1],p=t[2],m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11],C=i*i*u+l,w=a*i*u+o*c,T=o*i*u-a*c,E=i*a*u-o*c,D=a*a*u+l,O=o*a*u+i*c,k=i*o*u+a*c,A=a*o*u-i*c,j=o*o*u+l,e[0]=d*C+h*w+y*T,e[1]=f*C+g*w+b*T,e[2]=p*C+_*w+x*T,e[3]=m*C+v*w+S*T,e[4]=d*E+h*D+y*O,e[5]=f*E+g*D+b*O,e[6]=p*E+_*D+x*O,e[7]=m*E+v*D+S*O,e[8]=d*k+h*A+y*j,e[9]=f*k+g*A+b*j,e[10]=p*k+_*A+x*j,e[11]=m*k+v*A+S*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function bt(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function xt(e,t){let n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],s=t[6],c=t[8],l=t[9],u=t[10];return e[0]=Math.hypot(n,r,i),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(c,l,u),e}function St(e){let t=e[0],n=e[1],r=e[2],i=e[4],a=e[5],o=e[6],s=e[8],c=e[9],l=e[10],u=t*t+n*n+r*r,d=i*i+a*a+o*o,f=s*s+c*c+l*l;return Math.sqrt(Math.max(u,d,f))}var Ct=(function(){let e=[1,1,1];return function(t,n){let r=e;xt(r,n);let i=1/r[0],a=1/r[1],o=1/r[2],s=n[0]*i,c=n[1]*a,l=n[2]*o,u=n[4]*i,d=n[5]*a,f=n[6]*o,p=n[8]*i,m=n[9]*a,h=n[10]*o,g=s+d+h,_=0;return g>0?(_=Math.sqrt(g+1)*2,t[3]=.25*_,t[0]=(f-m)/_,t[1]=(p-l)/_,t[2]=(c-u)/_):s>d&&s>h?(_=Math.sqrt(1+s-d-h)*2,t[3]=(f-m)/_,t[0]=.25*_,t[1]=(c+u)/_,t[2]=(p+l)/_):d>h?(_=Math.sqrt(1+d-s-h)*2,t[3]=(p-l)/_,t[0]=(c+u)/_,t[1]=.25*_,t[2]=(f+m)/_):(_=Math.sqrt(1+h-s-d)*2,t[3]=(c-u)/_,t[0]=(p+l)/_,t[1]=(f+m)/_,t[2]=.25*_),t}})();function wt(e,t,n,r){let i=z([e[0],e[1],e[2]]),a=z([e[4],e[5],e[6]]),o=z([e[8],e[9],e[10]]);ht(e)<0&&(i=-i),n[0]=e[12],n[1]=e[13],n[2]=e[14];let s=e.slice(),c=1/i,l=1/a,u=1/o;s[0]*=c,s[1]*=c,s[2]*=c,s[4]*=l,s[5]*=l,s[6]*=l,s[8]*=u,s[9]*=u,s[10]*=u,Ct(t,s),r[0]=i,r[1]=a,r[2]=o}function Tt(e,t,n,r){let i=e,a=t[0],o=t[1],s=t[2],c=t[3],l=a+a,u=o+o,d=s+s,f=a*l,p=a*u,m=a*d,h=o*u,g=o*d,_=s*d,v=c*l,y=c*u,b=c*d,x=r[0],S=r[1],C=r[2];return i[0]=(1-(h+_))*x,i[1]=(p+b)*x,i[2]=(m-y)*x,i[3]=0,i[4]=(p-b)*S,i[5]=(1-(f+_))*S,i[6]=(g+v)*S,i[7]=0,i[8]=(m+y)*C,i[9]=(g-v)*C,i[10]=(1-(f+h))*C,i[11]=0,i[12]=n[0],i[13]=n[1],i[14]=n[2],i[15]=1,i}function Et(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=n+n,s=r+r,c=i+i,l=n*o,u=r*o,d=r*s,f=i*o,p=i*s,m=i*c,h=a*o,g=a*s,_=a*c;return e[0]=1-d-m,e[1]=u+_,e[2]=f-g,e[3]=0,e[4]=u-_,e[5]=1-l-m,e[6]=p+h,e[7]=0,e[8]=f+g,e[9]=p-h,e[10]=1-l-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Dt(e,t,n,r,i){let a=1/Math.tan(t/2),o=1/(r-i);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+r)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*r*o,e[15]=0,e}function Ot(e,t,n,r,i,a,o){let s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e}function kt(e,t,n,r){let i=t[0],a=t[1],o=t[2],s=r[0],c=r[1],l=r[2],u=i-n[0],d=a-n[1],f=o-n[2],p=u*u+d*d+f*f;p===0?f=1:(p=1/Math.sqrt(p),u*=p,d*=p,f*=p);let m=c*f-l*d,h=l*u-s*f,g=s*d-c*u;return p=m*m+h*h+g*g,p===0&&(l?s+=1e-6:c?l+=1e-6:c+=1e-6,m=c*f-l*d,h=l*u-s*f,g=s*d-c*u,p=m*m+h*h+g*g),p=1/Math.sqrt(p),m*=p,h*=p,g*=p,e[0]=m,e[1]=h,e[2]=g,e[3]=0,e[4]=d*g-f*h,e[5]=f*m-u*g,e[6]=u*h-d*m,e[7]=0,e[8]=u,e[9]=d,e[10]=f,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function At(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function jt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Mt(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10
3]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}var Nt=class extends Array{constructor(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return super(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){return e.length?this.copy(e):(ft(this,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h),this)}translate(e,t=this){return _t(this,t,e),this}rotate(e,t,n=this){return yt(this,n,e,t),this}scale(e,t=this){return vt(this,t,typeof e==`number`?[e,e,e]:e),this}add(e,t){return t?At(this,e,t):At(this,this,e),this}sub(e,t){return t?jt(this,e,t):jt(this,this,e),this}multiply(e,t){return e.length?t?gt(this,e,t):gt(this,this,e):Mt(this,this,e),this}identity(){return pt(this),this}copy(e){return dt(this,e),this}fromPerspective({fov:e,aspect:t,near:n,far:r}={}){return Dt(this,e,t,n,r),this}fromOrthogonal({left:e,right:t,bottom:n,top:r,near:i,far:a}){return Ot(this,e,t,n,r,i,a),this}fromQuaternion(e){return Et(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return mt(this,e),this}compose(e,t,n){return Tt(this,e,t,n),this}decompose(e,t,n){return wt(this,e,t,n),this}getRotation(e){return Ct(e,this),this}getTranslation(e){return bt(e,this),this}getScaling(e){return xt(e,this),this}getMaxScaleOnAxis(){return St(this)}lookAt(e,t,n){return kt(this,e,t,n),this}determinant(){return ht(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}};function Pt(e,t,n=`YXZ`){return n===`XYZ`?(e[1]=Math.asin(Math.min(Math.max(t[8],-1),1)),Math.abs(t[8])<.99999?(e[0]=Math.atan2(-t[9],t[10]),e[2]=Math.atan2(-t[4],t[0])):(e[0]=Math.atan2(t[6],t[5]),e[2]=0)):n===`YXZ`?(e[0]=Math.asin(-Math.min(Math.max(t[9],-1),1)),Math.abs(t[9])<.99999?(e[1]=Math.atan2(t[8],t[10]),e[2]=Math.atan2(t[1],t[5])):(e[1]=Math.atan2(-t[2],t[0]),e[2]=0)):n===`ZXY`?(e[0]=Math.asin(Math.min(Math.max(t[6],-1),1)),Math.abs(t[6])<.99999?(e[1]=Math.atan2(-t[2],t[10]),e[2]=Math.atan2(-t[4],t[5])):(e[1]=0,e[2]=Math.atan2(t[1],t[0]))):n===`ZYX`?(e[1]=Math.asin(-Math.min(Math.max(t[2],-1),1)),Math.abs(t[2])<.99999?(e[0]=Math.atan2(t[6],t[10]),e[2]=Math.atan2(t[1],t[0])):(e[0]=0,e[2]=Math.atan2(-t[4],t[5]))):n===`YZX`?(e[2]=Math.asin(Math.min(Math.max(t[1],-1),1)),Math.abs(t[1])<.99999?(e[0]=Math.atan2(-t[9],t[5]),e[1]=Math.atan2(-t[2],t[0])):(e[0]=0,e[1]=Math.atan2(t[8],t[10]))):n===`XZY`&&(e[2]=Math.asin(-Math.min(Math.max(t[4],-1),1)),Math.abs(t[4])<.99999?(e[0]=Math.atan2(t[6],t[5]),e[1]=Math.atan2(t[8],t[0])):(e[0]=Math.atan2(-t[9],t[10]),e[1]=0)),e}var Ft=new Nt,It=class extends Array{constructor(e=0,t=e,n=e,r=`YXZ`){super(e,t,n),this.order=r,this.onChange=()=>{},this._target=this;let i=[`0`,`1`,`2`];return new Proxy(this,{set(e,t){let n=Reflect.set(...arguments);return n&&i.includes(t)&&e.onChange(),n}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,n=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=n,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return Pt(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,n){return Ft.fromQuaternion(e),this._target.fromRotationMatrix(Ft,t),n||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}},Lt=class{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new Nt,this.worldMatrix=new Nt,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new Te,this.quaternion=new lt,this.scale=new Te(1),this.rotation=new It,this.up=new Te(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}
3setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,n=this.children.length;t<n;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}};function Rt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function zt(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=n+n,s=r+r,c=i+i,l=n*o,u=r*o,d=r*s,f=i*o,p=i*s,m=i*c,h=a*o,g=a*s,_=a*c;return e[0]=1-d-m,e[3]=u-_,e[6]=f+g,e[1]=u+_,e[4]=1-l-m,e[7]=p-h,e[2]=f-g,e[5]=p+h,e[8]=1-l-d,e}function Bt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Vt(e,t,n,r,i,a,o,s,c,l){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e}function Ht(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ut(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=u*o-s*l,f=-u*a+s*c,p=l*a-o*c,m=n*d+r*f+i*p;return m?(m=1/m,e[0]=d*m,e[1]=(-u*r+i*l)*m,e[2]=(s*r-i*o)*m,e[3]=f*m,e[4]=(u*n-i*c)*m,e[5]=(-s*n+i*a)*m,e[6]=p*m,e[7]=(-l*n+r*c)*m,e[8]=(o*n-r*a)*m,e):null}function Wt(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1],m=n[2],h=n[3],g=n[4],_=n[5],v=n[6],y=n[7],b=n[8];return e[0]=f*r+p*o+m*l,e[1]=f*i+p*s+m*u,e[2]=f*a+p*c+m*d,e[3]=h*r+g*o+_*l,e[4]=h*i+g*s+_*u,e[5]=h*a+g*c+_*d,e[6]=v*r+y*o+b*l,e[7]=v*i+y*s+b*u,e[8]=v*a+y*c+b*d,e}function Gt(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=f*r+p*o+l,e[7]=f*i+p*s+u,e[8]=f*a+p*c+d,e}function Kt(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*i+f*s,e[2]=p*a+f*c,e[3]=p*o-f*r,e[4]=p*s-f*i,e[5]=p*c-f*a,e[6]=l,e[7]=u,e[8]=d,e}function qt(e,t,n){let r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Jt(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(c*E-o*k-l*T)*A,e[2]=(o*O-s*E+l*w)*A,e[3]=(i*O-r*k-a*D)*A,e[4]=(n*k-i*E+a*T)*A,e[5]=(r*E-n*O-a*w)*A,e[6]=(h*C-g*S+_*x)*A,e[7]=(g*b-m*C-_*y)*A,e[8]=(m*S-h*b+_*v)*A,e):null}var Yt=class extends Array{constructor(e=1,t=0,n=0,r=0,i=1,a=0,o=0,s=0,c=1){return super(e,t,n,r,i,a,o,s,c),this}set(e,t,n,r,i,a,o,s,c){return e.length?this.copy(e):(Vt(this,e,t,n,r,i,a,o,s,c),this)}translate(e,t=this){return Gt(this,t,e),this}rotate(e,t=this){return Kt(this,t,e),this}scale(e,t=this){return qt(this,t,e),this}multiply(e,t){return t?Wt(this,e,t):Wt(this,this,e),this}identity(){return Ht(this),this}copy(e){return Bt(this,e),this}fromMatrix4(e){return Rt(this,e),this}fromQuaternion(e){return zt(this,e),this}fromBasis(e,t,n){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]),this}inverse(e=this){return Ut(this,e),this}getNormalMatrix(e){return Jt(this,e),this}},Xt=0,Zt=class extends Lt{constructor(e,{geometry:t,program:n,mode:r=e.TRIANGLES,frustumCulled:i=!0,renderOrder:a=0}={}){super(),e.canvas||console.error(`gl not passed as first argument to Mesh`),this.gl=e,this.id=Xt++,this.geometry=t,this.program=n,this.mode=r,this.frustumCulled=i,this.renderOrder=a,this.modelViewMatrix=new Nt,this.normalMatrix=new Yt,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(t=>t&&t({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(t=>t&&t({mesh:this,camera:e}))}},Qt=class extends Ae{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}};l();var $t=w(x({__name:`Prism`,props:{height:{default:3.5},baseWidth:{default:5.5},animationType:{default:`rotate`},glow:{default:1},offset:{default:()=>({x:0,y:0})},noise:{default:.5},transparent:{type:Boolean,default:!0},scale:{default:3.6},hueShift:{default:0},colorFrequency:{default:1},hoverStrength:{default:2},inertia:{default:.05},bloom:{default:1},suspendWhenOffscreen:{type:Boolean,default:!1},timeScale:{default:.5}},setup(e){let r=e,i=s(`containerRef`),a=null,o=()=>{let e=i.value;if(!e)return;let t=Math.max(.001,r.height),n=Math.max(.001,r.baseWidth)*.5,o=Math.max(0,r.glow),s=Math.max(0,r.noise),c=r.offset?.x??0,l=r.offset?.y??0,u=r.transparent?1.5:1,d=Math.max(.001,r.scale),f=r.hueShift||0,p=Math.max(0,r.colorFrequency||1),m=Math.max(0,r.bloom||1),h=Math.max(0,r.timeScale||1),g=Math.max(0,r.hoverStrength||1),_=Math.max(0,Math.min(1,r.inertia||.12)),v=Math.min(2,window.devicePixelRatio||1),y=new Ue({dpr:v,alpha:r.transparent,antialias:!1}),b=y.gl;b.disable(b.DEPTH_TEST),b.disable(b.CULL_FACE),b.disable(b.BLEND),Object.assign(b.canvas.style,{position:`absolute`,inset:`0`,width:`100%`,height:`100%`,dis
3play:`block`}),e.appendChild(b.canvas);let x=new Qt(b),S=new Float32Array(2),C=new Float32Array(2),w=new Ne(b,{vertex:` 4 attribute vec2 position; 5 void main() { 6 gl_Position = vec4(position, 0.0, 1.0); 7 } 8 `,fragment:` 9 precision highp float; 10 11 uniform vec2 iResolution; 12 uniform float iTime; 13 14 uniform float uHeight; 15 uniform float uBaseHalf; 16 uniform mat3 uRot; 17 uniform int uUseBaseWobble; 18 uniform float uGlow; 19 uniform vec2 uOffsetPx; 20 uniform float uNoise; 21 uniform float uSaturation; 22 uniform float uScale; 23 uniform float uHueShift; 24 uniform float uColorFreq; 25 uniform float uBloom; 26 uniform float uCenterShift; 27 uniform float uInvBaseHalf; 28 uniform float uInvHeight; 29 uniform float uMinAxis; 30 uniform float uPxScale; 31 uniform float uTimeScale; 32 33 vec4 tanh4(vec4 x){ 34 vec4 e2x = exp(2.0*x); 35 return (e2x - 1.0) / (e2x + 1.0); 36 } 37 38 float rand(vec2 co){ 39 return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453123); 40 } 41 42 float sdOctaAnisoInv(vec3 p){ 43 vec3 q = vec3(abs(p.x) * uInvBaseHalf, abs(p.y) * uInvHeight, abs(p.z) * uInvBaseHalf); 44 float m = q.x + q.y + q.z - 1.0; 45 return m * uMinAxis * 0.5773502691896258; 46 } 47 48 float sdPyramidUpInv(vec3 p){ 49 float oct = sdOctaAnisoInv(p); 50 float halfSpace = -p.y; 51 return max(oct, halfSpace); 52 } 53 54 mat3 hueRotation(float a){ 55 float c = cos(a), s = sin(a); 56 mat3 W = mat3( 57 0.299, 0.587, 0.114, 58 0.299, 0.587, 0.114, 59 0.299, 0.587, 0.114 60 ); 61 mat3 U = mat3( 62 0.701, -0.587, -0.114, 63 -0.299, 0.413, -0.114, 64 -0.300, -0.588, 0.886 65 ); 66 mat3 V = mat3( 67 0.168, -0.331, 0.500, 68 0.328, 0.035, -0.500, 69 -0.497, 0.296, 0.201 70 ); 71 return W + U * c + V * s; 72 } 73 74 void main(){ 75 vec2 f = (gl_FragCoord.xy - 0.5 * iResolution.xy - uOffsetPx) * uPxScale; 76 77 float z = 5.0; 78 float d = 0.0; 79 80 vec3 p; 81 vec4 o = vec4(0.0); 82 83 float centerShift = uCenterShift; 84 float cf = uColorFreq; 85 86 mat2 wob = mat2(1.0); 87 if (uUseBaseWobble == 1) { 88 float t = iTime * uTimeScale; 89 float c0 = cos(t + 0.0); 90 float c1 = cos(t + 33.0); 91 float c2 = cos(t + 11.0); 92 wob = mat2(c0, c1, c2, c0); 93 } 94 95 const int STEPS = 100; 96 for (int i = 0; i < STEPS; i++) { 97 p = vec3(f, z); 98 p.xz = p.xz * wob; 99 p = uRot * p; 100 vec3 q = p; 101 q.y += centerShift; 102 d = 0.1 + 0.2 * abs(sdPyramidUpInv(q)); 103 z -= d; 104 o += (sin((p.y + z) * cf + vec4(0.0, 1.0, 2.0, 3.0)) + 1.0) / d; 105 } 106 107 o = tanh4(o * o * (uGlow * uBloom) / 1e5); 108 109 vec3 col = o.rgb; 110 float n = rand(gl_FragCoord.xy + vec2(iTime)); 111 col += (n - 0.5) * uNoise; 112 col = clamp(col, 0.0, 1.0); 113 114 float L = dot(col, vec3(0.2126, 0.7152, 0.0722)); 115 col = clamp(mix(vec3(L), col, uSaturation), 0.0, 1.0); 116 117 if(abs(uHueShift) > 0.0001){ 118 col = clamp(hueRotation(uHueShift) * col, 0.0, 1.0); 119 } 120 121 gl_FragColor = vec4(col, o.a); 122 } 123 `,uniforms:{iResolution:{value:S},iTime:{value:0},uHeight:{value:t},uBaseHalf:{value:n},uUseBaseWobble:{value:1},uRot:{value:new Float32Array([1,0,0,0,1,0,0,0,1])},uGlow:{value:o},uOffsetPx:{value:C},uNoise:{value:s},uSaturation:{value:u},uScale:{value:d},uHueShift:{value:f},uColorFreq:{value:p},uBloom:{value:m},uCenterShift:{value:t*.25},uInvBaseHalf:{value:1/n},uInvHeight:{value:1/t},uMinAxis:{value:Math.min(n,t)},uPxScale:{value:1/((b.drawingBufferHeight||1)*.1*d)},uTimeScale:{value:h}}}),T=new Zt(b,{geometry:x,program:w}),E=()=>{let t=e.clientWidth||1,n=e.clientHeight||1;y.setSize(t,n),S[0]=b.drawingBufferWidth,S[1]=b.drawingBufferHeight,C[0]=c*v,C[1]=l*v,w.uniforms.uPxScale.value=1/((b.drawingBufferHeight||1)*.1*d)},D=new ResizeObserver(E);D.observe(e),E();let O=new Float32Array(9),k=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(t),s=Math.sin(t),c=Math.cos(n),l=Math.sin(n),u=i*c+a*s*l,d=-i*l+a*s*c,f=a*o,p=o*l,m=o*c,h=-s,g=-a*c+i*s*l,_=a*l+i*s*c,v=i*o;return r[0]=u,r[1]=p,r[2]=g,r[3]=d,r[4]=m,r[5]=_,r[6]=f,r[7]=h,r[8]=v,r},A=s<1e-6,j=0,M=performance.now(),N=()=>{j||=requestAnimationFrame(H)},P=()=>{j&&=(cancelAnimationFrame(j),0)},F=()=>Math.random(),I=(.3+F()*.6)*1,ee=(.2+F()*.7)*1,te=(.1+F()*.5)*1,ne=F()*Math.PI*2,re=F()*Math.PI*2,ie=0,ae=0,L=0,R=0,oe=0,se=(e,t,n)=>e+(t-e)*n,z={x:0,y:0,inside:!0},ce=e=>{let t=Math.max(1,window.innerWidth),n=Math.max(1,window.innerHeight),r=t*.5,i=n*.5,a=(e.clientX-r)/(t*.5),o=(e.clientY-i)/(n*.5);z.x=Math.max(-1,Math.min(1,a)),z.y=Math.max(-1,Math.min(1,o)),z.inside=!0},B=()=>{z.inside=!1},le=()=>{z.inside=!1},V=null;r.animationType===`hover`?(V=e=>{ce(e),N()},window.addEventListener(`pointermove`,V,{passive:!0}),window.addEventListener(`mouseleave`,B),window.addEventListener(`blur`,le),w.uniforms.uUseBaseWobble.value=0):r.animationType===`3drotate`?w.uniforms.uUseBaseWobble.value=0:w.uniforms.uUseBaseWobble.value=1;let H=e=>{let t=(e-M)*.001;w.uniforms.iTime.value=t;let n=!0;if(r.animationType===`hover`){let e=.6*g,t=.6*g;R=(z.inside?-z.x:0)*t,oe=(z.inside?z.y:0)*e;let r=ie,i=ae,a=L;ie=se(r,R,_),ae=se(i,oe,_),L=se(a,0,.1),w.uniforms.uRot.value=k(ie,ae,L,O),A&&Math.abs(ie-R)<1e-4&&Math.abs(ae-oe)<1e-4&&Math.abs(L)<1e-4&&(n=!1)}else if(r.animationType===`3drotate`){let e=t*h;ie=e*ee,ae=Math.sin(e*I+ne)*.6,L=Math.sin(e*te+re)*.5,w.uniforms.uRot.value=k(ie,ae,L,O),h<1e-6&&(n=!1)}else O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=1,O[5]=0,O[6]=0,O[7]=0,O[8]=1,w.uniforms.uRot.value=O,h<1e-6&&(n=!1);y.render({scene:T}),j=n?requestAnimationFrame(H):0};if(r.suspendWhenOffscreen){let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)?N():P()});t.observe(e),N(),e.__prismIO=t}else N();a=()=>
123{if(P(),D.disconnect(),r.animationType===`hover`&&(V&&window.removeEventListener(`pointermove`,V),window.removeEventListener(`mouseleave`,B),window.removeEventListener(`blur`,le)),r.suspendWhenOffscreen){let t=e.__prismIO;t&&t.disconnect(),delete e.__prismIO}b.canvas.parentElement===e&&e.removeChild(b.canvas)}};return d(()=>{o()}),c(()=>{a?.()}),T(r,()=>{a?.(),o()},{deep:!0}),(e,r)=>(t(),n(`div`,{class:`prism-container`,ref_key:`containerRef`,ref:i},null,512))}}),[[`__scopeId`,`data-v-66b19ebe`]]),en=1e3,tn=1001,nn=1002,rn=1003,an=1004,on=1005,sn=1006,cn=1007,ln=1008,un=1009,dn=1010,fn=1011,pn=1012,mn=1013,hn=1014,gn=1015,_n=1016,vn=1017,yn=1018,bn=1020,xn=35902,Sn=1021,Cn=1022,wn=1023,Tn=1026,En=1027,Dn=1028,On=1029,kn=1030,An=1031,jn=1033,Mn=33776,Nn=33777,Pn=33778,Fn=33779,In=35840,Ln=35841,Rn=35842,zn=35843,Bn=36196,Vn=37492,Hn=37496,Un=37808,Wn=37809,Gn=37810,Kn=37811,qn=37812,Jn=37813,Yn=37814,Xn=37815,Zn=37816,Qn=37817,$n=37818,er=37819,tr=37820,nr=37821,rr=36492,ir=36494,ar=36495,or=36283,sr=36284,cr=36285,lr=36286,ur=2300,dr=2301,fr=2302,pr=2400,mr=2401,hr=2402,gr=3200,_r=3201,vr=`srgb`,yr=`srgb-linear`,br=`linear`,xr=`srgb`,Sr=7680,Cr=35044,wr=2e3,Tr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Er=`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`.split(`.`),Dr=Math.PI/180,Or=180/Math.PI;function kr(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Er[e&255]+Er[e>>8&255]+Er[e>>16&255]+Er[e>>24&255]+`-`+Er[t&255]+Er[t>>8&255]+`-`+Er[t>>16&15|64]+Er[t>>24&255]+`-`+Er[n&63|128]+Er[n>>8&255]+`-`+Er[n>>16&255]+Er[n>>24&255]+Er[r&255]+Er[r>>8&255]+Er[r>>16&255]+Er[r>>24&255]).toLowerCase()}function K(e,t,n){return Math.max(t,Math.min(n,e))}function Ar(e,t){return(e%t+t)%t}function jr(e,t,n){return(1-n)*e+n*t}function Mr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function Nr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var q=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}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 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 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}
vendor: 10,149 bytes, line 123
123sub(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){let 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=K(this.x,e.x,t.x),this.y=K(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=K(this.x,e,t),this.y=K(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(K(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(K(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*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}},Pr=class{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,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,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){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(K(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let 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*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*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=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*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}},J=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}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 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 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(Ir.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ir.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}
vendor: 8,426 bytes, line 123
123applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-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){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[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=K(this.x,e.x,t.x),this.y=K(this.y,e.y,t.y),this.z=K(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=K(this.x,e,t),this.y=K(this.y,e,t),this.z=K(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(K(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fr.copy(this).projectOnVector(e),this.sub(Fr)}reflect(e){return this.sub(Fr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(K(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let 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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let 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(){let 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}},Fr=new J,Ir=new Pr,Y=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,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){let 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,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Lr.makeScale(e,t)),this}rotate(e){return this.premultiply(Lr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Lr.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){let 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){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])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){let 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)}},Lr=new Y;function Rr(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function zr(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Br(){let e=zr(`canvas`);return e.style.display=`block`,e}var Vr={};function Hr(e){e in Vr||(Vr[e]=!0,console.warn(e))}function Ur(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function Wr(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function Gr(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var Kr=new Y().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),qr=new Y().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 15,261 bytes, line 123
1237,1.0569715);function Jr(){let e={enabled:!0,workingColorSpace:yr,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=Yr(e.r),e.g=Yr(e.g),e.b=Yr(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Xr(e.r),e.g=Xr(e.g),e.b=Xr(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?br:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Hr(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Hr(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[yr]:{primaries:t,whitePoint:r,transfer:br,toXYZ:Kr,fromXYZ:qr,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:vr},outputColorSpaceConfig:{drawingBufferColorSpace:vr}},[vr]:{primaries:t,whitePoint:r,transfer:xr,toXYZ:Kr,fromXYZ:qr,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:vr}}}),e}var X=Jr();function Yr(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Xr(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var Zr,Qr=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Zr===void 0&&(Zr=zr(`canvas`)),Zr.width=e.width,Zr.height=e.height;let t=Zr.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Zr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=zr(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Yr(i[e]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Yr(t[e]/255)*255):t[e]=Yr(t[e]);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}},$r=0,ei=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$r++}),this.uuid=kr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(ti(r[t].image)):e.push(ti(r[t]))}else e=ti(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function ti(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Qr.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn(`THREE.Texture: Unable to serialize Texture.`),{})}var ni=0,ri=new J,ii=class e extends Tr{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=tn,i=tn,a=sn,o=ln,s=wn,c=un,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ni++}),this.uuid=kr(),this.name=``,this.source=new ei(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Y,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ri).x}get height(){return this.source.getSize(ri).y}get depth(){return this.source.getSize(ri).z}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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,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 en:e.x-=Math.floor(e.x);break;case tn:e.x=e.x<0?0:1;break;case nn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case en:e.y-=Math.floor(e.y);break;case tn:e.y=e.y<0?0:1;break;case nn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(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++}};ii.DEFAULT_IMAGE=null,ii.DEFAULT_MAPPING=300,ii.DEFAULT_ANISOTROPY=1;var ai=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}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 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 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?1:e.w,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){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let 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=K(this.x,e.x,t.x),this.y=K(this.y,e.y,t.y),this.z=K(this.z,e.z,t.z),this.w=K(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=K(this.x,e,t),this.y=K(this.y,e,t),this.z=K(this.z,e,t),this.w=K(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(K(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},oi=class extends Tr{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:sn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ai(0,0,e,t),this.scissorTest=!1,this.viewport=new ai(0,0,e,t);let r=new ii({width:e,height:t,depth:n.depth});this.textures=[];let i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:sn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace
vendor: 5,023 bytes, line 123
123=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new ei(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:`dispose`})}},si=class extends oi{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},ci=class extends ii{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=rn,this.minFilter=rn,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},li=class extends ii{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=rn,this.minFilter=rn,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ui=class{constructor(e=new J(1/0,1/0,1/0),t=new J(-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(fi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(fi.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){let n=fi.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);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,fi):fi.fromBufferAttribute(r,t),fi.applyMatrix4(e.matrixWorld),this.expandByPoint(fi);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),pi.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),pi.copy(e.boundingBox)),pi.applyMatrix4(e.matrixWorld),this.union(pi)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],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,fi),fi.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 5,606 bytes, line 123
123s}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(bi),xi.subVectors(this.max,bi),mi.subVectors(e.a,bi),hi.subVectors(e.b,bi),gi.subVectors(e.c,bi),_i.subVectors(hi,mi),vi.subVectors(gi,hi),yi.subVectors(mi,gi);let t=[0,-_i.z,_i.y,0,-vi.z,vi.y,0,-yi.z,yi.y,_i.z,0,-_i.x,vi.z,0,-vi.x,yi.z,0,-yi.x,-_i.y,_i.x,0,-vi.y,vi.x,0,-yi.y,yi.x,0];return!wi(t,mi,hi,gi,xi)||(t=[1,0,0,0,1,0,0,0,1],!wi(t,mi,hi,gi,xi))?!1:(Si.crossVectors(_i,vi),t=[Si.x,Si.y,Si.z],wi(t,mi,hi,gi,xi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(fi).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:(di[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),di[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),di[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),di[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),di[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),di[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),di[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),di[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(di),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},di=[new J,new J,new J,new J,new J,new J,new J,new J],fi=new J,pi=new ui,mi=new J,hi=new J,gi=new J,_i=new J,vi=new J,yi=new J,bi=new J,xi=new J,Si=new J,Ci=new J;function wi(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Ci.fromArray(e,a);let o=i.x*Math.abs(Ci.x)+i.y*Math.abs(Ci.y)+i.z*Math.abs(Ci.z),s=t.dot(Ci),c=n.dot(Ci),l=r.dot(Ci);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Ti=new ui,Ei=new J,Di=new J,Oi=class{constructor(e=new J,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){let n=this.center;t===void 0?Ti.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));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){let 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){let 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*=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;Ei.subVectors(e,this.center);let t=Ei.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Ei,n/e),this.radius+=n}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):(Di.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ei.copy(e.center).add(Di)),this.expandByPoint(Ei.copy(e.center).sub(Di))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},ki=new J,Ai=new J,ji=new J,Mi=new J,Ni=new J,Pi=new J,Fi=new J,Ii=class{constructor(e=new J,t=new J(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,ki)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=ki.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ki.copy(this.origin).addScaledVector(this.direction,t),ki.distanceToSquared(e))}
vendor: 7,911 bytes, line 123
123distanceSqToSegment(e,t,n,r){Ai.copy(e).add(t).multiplyScalar(.5),ji.copy(t).sub(e).normalize(),Mi.copy(this.origin).sub(Ai);let i=e.distanceTo(t)*.5,a=-this.direction.dot(ji),o=Mi.dot(this.direction),s=-Mi.dot(ji),c=Mi.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Ai).addScaledVector(ji,d),f}intersectSphere(e,t){ki.subVectors(e.center,this.origin);let n=ki.dot(this.direction),r=ki.dot(ki)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ki)!==null}intersectTriangle(e,t,n,r,i){Ni.subVectors(t,e),Pi.subVectors(n,e),Fi.crossVectors(Ni,Pi);let a=this.direction.dot(Fi),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Mi.subVectors(this.origin,e);let s=o*this.direction.dot(Pi.crossVectors(Mi,Pi));if(s<0)return null;let c=o*this.direction.dot(Ni.cross(Mi));if(c<0||s+c>a)return null;let l=-o*Mi.dot(Fi);return l<0?null:this.at(l/a,i)}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)}},Li=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,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 e().fromArray(this.elements)}copy(e){let 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){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let 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){let t=this.elements,n=e.elements,r=1/Ri.setFromMatrixColumn(e,0).length(),i=1/Ri.setFromMatrixColumn(e,1).length(),a=1/Ri.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]*i,t[5]=n[5]*i,t[6]=n[6]*i,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){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}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(Bi,e,Vi)}lookAt(e,t,n){let r=this.elements;return Wi.subVectors(e,t),Wi.lengthSq()===0&&(Wi.z=1),Wi.normalize(),Hi.crossVectors(n,Wi),Hi.lengthSq()===0&&(Math.abs(n.z)===1?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),Hi.crossVectors(n,Wi)),Hi.normalize(),Ui.crossVectors(Wi,Hi),r[0]=Hi.x,r[4]=Ui.x,r[8]=Wi.x,r[1]=Hi.y,r[5]=Ui.y,r[9]=Wi.y,r[2]=Hi.z,r[6]=Ui.z,r[10]=Wi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,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){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a
vendor: 12,040 bytes, line 123
123*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let 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){let 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){let 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){let 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){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+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,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=Ri.set(r[0],r[1],r[2]).length(),a=Ri.set(r[4],r[5],r[6]).length(),o=Ri.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],zi.copy(this);let s=1/i,c=1/a,l=1/o;return zi.elements[0]*=s,zi.elements[1]*=s,zi.elements[2]*=s,zi.elements[4]*=c,zi.elements[5]*=c,zi.elements[6]*=c,zi.elements[8]*=l,zi.elements[9]*=l,zi.elements[10]*=l,t.setFromRotationMatrix(zi),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=wr){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=wr){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])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){let 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}},Ri=new J,zi=new Li,Bi=new J(0,0,0),Vi=new J(1,1,1),Hi=new J,Ui=new J,Wi=new J,Gi=new Li,Ki=new Pr,qi=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}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){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(K(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-K(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(K(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-K(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(K(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-K(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),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 Gi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ki.setFromEuler(this),this.setFromQuaternion(Ki,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}};qi.DEFAULT_ORDER=`XYZ`;var Ji=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},Yi=0,Xi=new J,Zi=new Pr,Qi=new Li,$i=new J,ea=new J,ta=new J,na=new Pr,ra=new J(1,0,0),ia=new J(0,1,0),aa=new J(0,0,1),oa={type:`added`},sa={type:`removed`},ca={type:`childadded`,child:null},la={type:`childremoved`,child:null},ua=class e extends Tr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Yi++}),this.uuid=kr(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new J,n=new qi,r=new Pr,i=new J(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Li},normalMatrix:{value:new Y}}),this.matrix=new Li,this.matrixWorld=new Li,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ji,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.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 Zi.setFromAxisAngle(e,t),this.quaternion.multiply(Zi),this}rotateOnWorldAxis(e,t){return Zi.setFromAxisAngle(e,t),this.quaternion.premultiply(Zi),this}rotateX(e){return this.rotateOnAxis(ra,e)}rotateY(e){return this.rotateOnAxis(ia,e)}rotateZ(e){return this.rotateOnAxis(aa,e)}translateOnAxis(e,t){return Xi.copy(e).applyQuaternion(this.quaternion),this.position.add(Xi.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ra,e)}translateY(e){return this.translateOnAxis(ia,e)}translateZ(e){return this.translateOnAxis(aa,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Qi.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?$i.copy(e):$i.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),ea.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Qi.lookAt(ea,$i,this.up):Qi.lookAt($i,ea,this.up),this.quaternion.setFromRotationMatrix(Qi),r&&(Qi.extractRotation(r.matrixWorld),Zi.setFromRotationMatrix(Qi),this.quaternion.premultiply(Zi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);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(oa),ca.child=e,this.dispatchEvent(ca),ca.child=null):console.error(`THREE.Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(sa),la.child=e,this.dispatchEvent(la),la.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Qi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Qi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Qi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(oa),ca.child=e,this.dispatchEvent(ca),ca.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++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].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(ea,e,ta),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ea,na,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let 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);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let 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
vendor: 12,072 bytes, line 123
123):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let 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){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let 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.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.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=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}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 t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};ua.DEFAULT_UP=new J(0,1,0),ua.DEFAULT_MATRIX_AUTO_UPDATE=!0,ua.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var da=new J,fa=new J,pa=new J,ma=new J,ha=new J,ga=new J,_a=new J,va=new J,ya=new J,ba=new J,xa=new ai,Sa=new ai,Ca=new ai,wa=class e{constructor(e=new J,t=new J,n=new J){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),da.subVectors(e,t),r.cross(da);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){da.subVectors(r,t),fa.subVectors(n,t),pa.subVectors(e,t);let a=da.dot(da),o=da.dot(fa),s=da.dot(pa),c=fa.dot(fa),l=fa.dot(pa),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ma)!==null&&ma.x>=0&&ma.y>=0&&ma.x+ma.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ma)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,ma.x),s.addScaledVector(a,ma.y),s.addScaledVector(o,ma.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return xa.setScalar(0),Sa.setScalar(0),Ca.setScalar(0),xa.fromBufferAttribute(e,t),Sa.fromBufferAttribute(e,n),Ca.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(xa,i.x),a.addScaledVector(Sa,i.y),a.addScaledVector(Ca,i.z),a}static isFrontFacing(e,t,n,r){return da.subVectors(n,t),fa.subVectors(e,t),da.cross(fa).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 da.subVectors(this.c,this.b),fa.subVectors(this.a,this.b),da.cross(fa).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;ha.subVectors(r,n),ga.subVectors(i,n),va.subVectors(e,n);let s=ha.dot(va),c=ga.dot(va);if(s<=0&&c<=0)return t.copy(n);ya.subVectors(e,r);let l=ha.dot(ya),u=ga.dot(ya);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(ha,a);ba.subVectors(e,i);let f=ha.dot(ba),p=ga.dot(ba);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(ga,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return _a.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(_a,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(ha,a).addScaledVector(ga,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ta={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},Ea={h:0,s:0,l:0},Da={h:0,s:0,l:0};function Oa(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Z=class{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){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=vr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,X.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=X.workingColorSpace){return this.r=e,this.g=t,this.b=n,X.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=X.workingColorSpace){if(e=Ar(e,1),t=K(t,0,1),n=K(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Oa(i,r,e+1/3),this.g=Oa(i,r,e),this.b=Oa(i,r,e-1/3)}
vendor: 5,903 bytes, line 123
123return X.colorSpaceToWorking(this,r),this}setStyle(e,t=vr){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,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=vr){let n=Ta[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),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=Yr(e.r),this.g=Yr(e.g),this.b=Yr(e.b),this}copyLinearToSRGB(e){return this.r=Xr(e.r),this.g=Xr(e.g),this.b=Xr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vr){return X.workingToColorSpace(ka.copy(this),e),Math.round(K(ka.r*255,0,255))*65536+Math.round(K(ka.g*255,0,255))*256+Math.round(K(ka.b*255,0,255))}getHexString(e=vr){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=X.workingColorSpace){X.workingToColorSpace(ka.copy(this),t);let n=ka.r,r=ka.g,i=ka.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4;break}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=X.workingColorSpace){return X.workingToColorSpace(ka.copy(this),t),e.r=ka.r,e.g=ka.g,e.b=ka.b,e}getStyle(e=vr){X.workingToColorSpace(ka.copy(this),e);let t=ka.r,n=ka.g,r=ka.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Ea),this.setHSL(Ea.h+e,Ea.s+t,Ea.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(Ea),e.getHSL(Da);let n=jr(Ea.h,Da.h,t),r=jr(Ea.s,Da.s,t),i=jr(Ea.l,Da.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[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}},ka=new Z;Z.NAMES=Ta;var Aa=0,ja=class extends Tr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Aa++}),this.uuid=kr(),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 Z(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=Sr,this.stencilZFail=Sr,this.stencilZPass=Sr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let 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){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7
vendor: 9,487 bytes, line 123
123,type:`Material`,generator:`Material.toJSON`}};n.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(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}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;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].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++}
vendor: 4,280 bytes, line 123
123},Ma=class extends ja{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Z(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 qi,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}},Na=new J,Pa=new q,Fa=0,Ia=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Fa++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Cr,this.updateRanges=[],this.gpuType=gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;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++)Pa.fromBufferAttribute(this,t),Pa.applyMatrix3(e),this.setXY(t,Pa.x,Pa.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Na.fromBufferAttribute(this,t),Na.applyMatrix3(e),this.setXYZ(t,Na.x,Na.y,Na.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Na.fromBufferAttribute(this,t),Na.applyMatrix4(e),this.setXYZ(t,Na.x,Na.y,Na.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Na.fromBufferAttribute(this,t),Na.applyNormalMatrix(e),this.setXYZ(t,Na.x,Na.y,Na.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Na.fromBufferAttribute(this,t),Na.transformDirection(e),this.setXYZ(t,Na.x,Na.y,Na.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=Mr(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Mr(t,this.array)),t}setX(e,t){return this.normalized&&(t=Nr(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Mr(t,this.array)),t}setY(e,t){return this.normalized&&(t=Nr(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=Mr(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Nr(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=Mr(t,this.array)),t}setW(e,t){return this.normalized&&(t=Nr(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Nr(t,this.array),n=Nr(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=Nr(t,this.array),n=Nr(n,this.array),r=Nr(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Nr(t,this.array),n=Nr(n,this.array),r=Nr(r,this.array),i=Nr(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}
vendor: 3,800 bytes, line 123
123onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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}},La=class extends Ia{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Ra=class extends Ia{constructor(e,t,n){super(new Uint32Array(e),t,n)}},za=class extends Ia{constructor(e,t,n){super(new Float32Array(e),t,n)}},Ba=0,Va=new Li,Ha=new ua,Ua=new J,Wa=new ui,Ga=new ui,Ka=new J,qa=class e extends Tr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ba++}),this.uuid=kr(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=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(Rr(e)?Ra:La)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Y().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let 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 Va.makeRotationFromQuaternion(e),this.applyMatrix4(Va),this}rotateX(e){return Va.makeRotationX(e),this.applyMatrix4(Va),this}rotateY(e){return Va.makeRotationY(e),this.applyMatrix4(Va),this}rotateZ(e){return Va.makeRotationZ(e),this.applyMatrix4(Va),this}translate(e,t,n){return Va.makeTranslation(e,t,n),this.applyMatrix4(Va),this}scale(e,t,n){return Va.makeScale(e,t,n),this.applyMatrix4(Va),this}lookAt(e){return Ha.lookAt(e),Ha.updateMatrix(),this.applyMatrix4(Ha.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ua).negate(),this.translate(Ua.x,Ua.y,Ua.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new za(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ui);let 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 J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Wa.setFromBufferAttribute(n),this.morphTargetsRelative?(Ka.addVectors(this.boundingBox.min,Wa.min),this.boundingBox.expandByPoint(Ka),Ka.addVectors(this.boundingBox.max,Wa.max),this.boundingBox.expandByPoint(Ka)):(this.boundingBox.expandByPoint(Wa.min),this.boundingBox.expandByPoint(Wa.max)
vendor: 4,975 bytes, line 123
123)}}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 Oi);let 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 J,1/0);return}if(e){let n=this.boundingSphere.center;if(Wa.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ga.setFromBufferAttribute(n),this.morphTargetsRelative?(Ka.addVectors(Wa.min,Ga.min),Wa.expandByPoint(Ka),Ka.addVectors(Wa.max,Ga.max),Wa.expandByPoint(Ka)):(Wa.expandByPoint(Ga.min),Wa.expandByPoint(Ga.max))}Wa.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Ka.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Ka));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Ka.fromBufferAttribute(a,t),o&&(Ua.fromBufferAttribute(e,t),Ka.add(Ua)),r=Math.max(r,n.distanceToSquared(Ka))}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(){let 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}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new Ia(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new J,s[e]=new J;let c=new J,l=new J,u=new J,d=new q,f=new q,p=new q,m=new J,h=new J;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new J,y=new J,b=new J,x=new J;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new Ia(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new J,i=new J,a=new J,o=new J,s=new J,c=new J,l=new J,u=new J;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ka.fromBufferAttribute(e,t),Ka.normalize(),e.setXYZ(t,Ka.x,Ka.y,Ka.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Ia(a,r,i)}if(this.index===null)return console.warn(`THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;
vendor: 4,530 bytes, line 123
123e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,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){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:`dispose`})}},Ja=new Li,Ya=new Ii,Xa=new Oi,Za=new J,Qa=new J,$a=new J,eo=new J,to=new J,no=new J,ro=new J,io=new J,ao=class extends ua{constructor(e=new qa,t=new Ma){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){no.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(to.fromBufferAttribute(s,e),a?no.addScaledVector(to,r):no.addScaledVector(to.sub(t),r))}t.add(no)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Xa.copy(n.boundingSphere),Xa.applyMatrix4(i),Ya.copy(e.ray).recast(e.near),!(Xa.containsPoint(Ya.origin)===!1&&(Ya.intersectSphere(Xa,Za)===null||Ya.origin.distanceToSquared(Za)>(e.far-e.near)**2))&&(Ja.copy(i).invert(),Ya.copy(e.ray).applyMatrix4(Ja),!(n.boundingBox!==null&&Ya.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ya)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=so(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=so(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.pu
vendor: 6,888 bytes, lines 123-127
123sh(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=so(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=so(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function oo(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;io.copy(s),io.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(io);return l<n.near||l>n.far?null:{distance:l,point:io.clone(),object:e}}function so(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Qa),e.getVertexPosition(c,$a),e.getVertexPosition(l,eo);let u=oo(e,t,n,r,Qa,$a,eo,ro);if(u){let e=new J;wa.getBarycoord(ro,Qa,$a,eo,e),i&&(u.uv=wa.getInterpolatedAttribute(i,s,c,l,e,new q)),a&&(u.uv1=wa.getInterpolatedAttribute(a,s,c,l,e,new q)),o&&(u.normal=wa.getInterpolatedAttribute(o,s,c,l,e,new J),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new J,materialIndex:0};wa.getNormal(Qa,$a,eo,t.normal),u.face=t,u.barycoord=e}return u}var co=class e extends qa{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new za(c,3)),this.setAttribute(`normal`,new za(l,3)),this.setAttribute(`uv`,new za(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new J;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function lo(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function uo(e){let t={};for(let n=0;n<e.length;n++){let r=lo(e[n]);for(let e in r)t[e]=r[e]}return t}function fo(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function po(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:X.workingColorSpace}var mo={clone:lo,merge:uo},ho=`void main() { 124 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 125}`,go=`void main() { 126 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 127}`,_o=class extends ja{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ho,this.fragmentShader=go,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=lo(e.uniforms),this.uniformsGroups=fo(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){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}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;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},vo=class extends ua{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new Li,this.projectionMatrix=new Li,this.projectionMatrixInverse=new Li,this.coordinateSystem=wr}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)}},yo=new J,bo=new q,xo=new q,So=class extends vo{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){let t=.5*this.getFilmHeight()/e;this.fov=Or*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Dr*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,109 bytes, line 127
127getEffectiveFOV(){return Or*2*Math.atan(Math.tan(Dr*.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){yo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yo.x,yo.y).multiplyScalar(-e/yo.z),yo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yo.x,yo.y).multiplyScalar(-e/yo.z)}getViewSize(e,t){return this.getViewBounds(e,bo,xo),t.subVectors(xo,bo)}setViewOffset(e,t,n,r,i,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=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Dr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},Co=-90,wo=1,To=class extends ua{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new So(Co,wo,e,t);r.layers=this.layers,this.add(r);let i=new So(Co,wo,e,t);i.layers=this.layers,this.add(i);let a=new So(Co,wo,e,t);a.layers=this.layers,this.add(a);let o=new So(Co,wo,e,t);o.layers=this.layers,this.add(o);let s=new So(Co,wo,e,t);s.layers=this.layers,this.add(s);let c=new So(Co,wo,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);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),i.up.set(0,0,-1),i.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),s.up.set(0,1,0),s.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),i.up.set(0,0,1),i.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),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),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,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},Eo=class extends ii{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Do=class extends si{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Eo(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 4,366 bytes, lines 127-162
127=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 128 129 varying vec3 vWorldDirection; 130 131 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 132 133 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 134 135 } 136 137 void main() { 138 139 vWorldDirection = transformDirection( position, modelMatrix ); 140 141 #include <begin_vertex> 142 #include <project_vertex> 143 144 } 145 `,fragmentShader:` 146 147 uniform sampler2D tEquirect; 148 149 varying vec3 vWorldDirection; 150 151 #include <common> 152 153 void main() { 154 155 vec3 direction = normalize( vWorldDirection ); 156 157 vec2 sampleUV = equirectUv( direction ); 158 159 gl_FragColor = texture2D( tEquirect, sampleUV ); 160 161 } 162 `},r=new co(5,5,5),i=new _o({name:`CubemapFromEquirect`,uniforms:lo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new ao(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=sn),new To(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},Oo=class extends ua{constructor(){super(),this.isGroup=!0,this.type=`Group`}},ko={type:`move`},Ao=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oo,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 Oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),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){let t=this._hand;if(t)for(let 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,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),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(ko)
vendor: 22,433 bytes, line 162
162))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Oo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},jo=class extends ua{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 qi,this.environmentIntensity=1,this.environmentRotation=new qi,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){let 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}},Mo=new J,No=new J,Po=new Y,Fo=class{constructor(e=new J(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){let r=Mo.subVectors(n,t).cross(No.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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){let n=e.delta(Mo),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let 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){let n=t||Po.getNormalMatrix(e),r=this.coplanarPoint(Mo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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)}},Io=new Oi,Lo=new q(.5,.5),Ro=new J,zo=class{constructor(e=new Fo,t=new Fo,n=new Fo,r=new Fo,i=new Fo,a=new Fo){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=wr){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Io.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Io.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Io)}intersectsSprite(e){return Io.center.set(0,0,0),Io.radius=.7071067811865476+Lo.distanceTo(e.center),Io.applyMatrix4(e.matrixWorld),this.intersectsSphere(Io)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Ro.x=r.normal.x>0?e.max.x:e.min.x,Ro.y=r.normal.y>0?e.max.y:e.min.y,Ro.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ro)<0)return!1}return!0}containsPoint(e){let 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)}},Bo=class extends ii{constructor(e,t,n=hn,r,i,a,o=rn,s=rn,c,l=Tn,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ei(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Vo=class e extends qa{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new za(p,3)),this.setAttribute(`normal`,new za(m,3)),this.setAttribute(`uv`,new za(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Ho=class extends ja{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=gr,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}},Uo=class extends ja{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}};function Wo(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function Go(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Ko=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`call to abstract method`)}intervalChanged_(){}},qo=class extends Ko{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:pr,endingEnd:pr}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case mr:i=e,o=2*t-n;break;case hr:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case mr:a=e,s=2*n-t;break;case hr:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},Jo=class extends Ko{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},Yo=class extends Ko{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Xo=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Wo(t,this.TimeBufferType),this.values=Wo(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Wo(e.times,Array),values:Wo(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Yo(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Jo(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new qo(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ur:t=this.InterpolantFactoryMethodDiscrete;break;case dr:t=this.InterpolantFactoryMethodLinear;break;case fr:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn(`THREE.KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ur;case this.InterpolantFactoryMethodLinear:return dr;case this.InterpolantFactoryMethodSmooth:return fr}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&Go(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===fr,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0]))if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Xo.prototype.ValueTypeName=``,Xo.prototype.TimeBufferType=Float32Array,Xo.prototype.ValueBufferType=Float32Array,Xo.prototype.DefaultInterpolation=dr;var Zo=class extends Xo{constructor(e,t,n){super(e,t,n)}};Zo.prototype.ValueTypeName=`bool`,Zo.prototype.ValueBufferType=Array,Zo.prototype.DefaultInterpolation=ur,Zo.prototype.InterpolantFactoryMethodLinear=void 0,Zo.prototype.InterpolantFactoryMethodSmooth=void 0;var Qo=class extends Xo{constructor(e,t,n,r){super(e,t,n,r)}};Qo.prototype.ValueTypeName=`color`;var $o=class extends Xo{constructor(e,t,n,r){super(e,t,n,r)}};$o.prototype.ValueTypeName=`number`;var es=class extends Ko{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Pr.slerpFlat(i,0,a,c-o,a,c,s);return i}},ts=class extends Xo{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new es(this.times,this.values,this.getValueSize(),e)}};ts.prototype.ValueTypeName=`quaternion`,ts.prototype.InterpolantFactoryMethodSmooth=void 0;var ns=class extends Xo{constructor(e,t,n){super(e,t,n)}};ns.prototype.ValueTypeName=`string`,ns.prototype.ValueBufferType=Array,ns.prototype.DefaultInterpolation=ur,ns.prototype.InterpolantFactoryMethodLinear=void 0,ns.prototype.InterpolantFactoryMethodSmooth=void 0;var rs=class extends Xo{constructor(e,t,n,r){super(e,t,n,r)}};rs.prototype.ValueTypeName=`vector`;var is=new class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}},as=class{constructor(e){this.manager=e===void 0?is:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};as.DEFAULT_MATERIAL_NAME=`__DEFAULT`;var os=class extends vo{constructor(e=-1,t=1,n=1,r=-1,i=.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=i,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,i,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=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let 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,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},ss=class extends So{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},cs=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},ls=`\\[\\]\\.:\\/`,us=RegExp(`[\\[\\]\\.:\\/]`,`g`),ds=`[^\\[\\]\\.:\\/]`,fs=`[^`+ls.replace(`\\.`,``)+`]`,ps=`((?:WC+[\\/:])*)`.replace(`WC`,ds),ms=`(WCOD+)?`.replace(`WCOD`,fs),hs=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,ds),gs=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,ds),_s=RegExp(`^`+ps+ms+hs+gs+`$`),vs=[`material`,`materials`,`bones`,`map`],ys=class{constructor(e,t,n){let r=n||bs.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},bs=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(us,``)}static parseTrackName(e){let t=_s.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);vs.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 8,557 bytes, line 162
162_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn(`THREE.PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){console.error(`THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){console.error(`THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){console.error(`THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){console.error(`THREE.PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){console.error(`THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;console.error(`THREE.PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};bs.Composite=ys,bs.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},bs.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},bs.prototype.GetterByBindingType=[bs.prototype._getValue_direct,bs.prototype._getValue_array,bs.prototype._getValue_arrayElement,bs.prototype._getValue_toArray],bs.prototype.SetterByBindingTypeAndVersioning=[[bs.prototype._setValue_direct,bs.prototype._setValue_direct_setNeedsUpdate,bs.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[bs.prototype._setValue_array,bs.prototype._setValue_array_setNeedsUpdate,bs.prototype._setValue_array_setMatrixWorldNeedsUpdate],[bs.prototype._setValue_arrayElement,bs.prototype._setValue_arrayElement_setNeedsUpdate,bs.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[bs.prototype._setValue_fromArray,bs.prototype._setValue_fromArray_setNeedsUpdate,bs.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];function xs(e,t,n,r){let i=Ss(r);switch(n){case Sn:return e*t;case Dn:return e*t/i.components*i.byteLength;case On:return e*t/i.components*i.byteLength;case kn:return e*t*2/i.components*i.byteLength;case An:return e*t*2/i.components*i.byteLength;case Cn:return e*t*3/i.components*i.byteLength;case wn:return e*t*4/i.components*i.byteLength;case jn:return e*t*4/i.components*i.byteLength;case Mn:case Nn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Pn:case Fn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ln:case zn:return Math.max(e,16)*Math.max(t,8)/4;case In:case Rn:return Math.max(e,8)*Math.max(t,8)/2;case Bn:case Vn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Hn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Un:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Wn:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Gn:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Kn:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case qn:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Jn:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Yn:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Xn:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Zn:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Qn:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case $n:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case er:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case tr:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case nr:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case rr:case ir:case ar:return Math.ceil(e/4)*Math.ceil(t/4)*16;case or:case sr:return Math.ceil(e/4)*Math.ceil(t/4)*8;case cr:case lr:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function Ss(e){switch(e){case un:case dn:return{byteLength:1,components:1};case pn:case fn:case _n:return{byteLength:2,components:1};case vn:case yn:return{byteLength:2,components:4};case hn:case mn:case gn:return{byteLength:4,components:1};case xn:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`178`}})),typeof window<`u`&&(window.__THREE__?console.warn(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`178`);function Cs(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){t!==!0&&n!==null&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ws(e){let t=new WeakMap;function n(t,n){let r=t.array,i=t.usage,a=r.byteLength,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();let s;if(r instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array<`u`&&r instanceof Float16Array)s=e.HALF_FLOAT;else if(r instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)s=e.SHORT;else if(r instanceof Uint32Array)s=e.UNSIGNED_INT;else if(r instanceof Int32Array)s=e.INT;else if(r instanceof Int8Array)s=e.BYTE;else if(r instanceof Uint8Array)s=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)s=e.UNSIGNED_BYTE;else throw Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+r);return{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:a}}function r(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),a.length===0)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):(++t,a[t]=r)}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}
vendor: 795 bytes, line 162
162n.clearUpdateRanges()}n.onUploadCallback()}function i(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))}function o(e,i){if(e.isInterleavedBufferAttribute&&(e=e.data),e.isGLBufferAttribute){let n=t.get(e);(!n||n.version<e.version)&&t.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version});return}let a=t.get(e);if(a===void 0)t.set(e,n(e,i));else if(a.version<e.version){if(a.size!==e.array.byteLength)throw Error(`THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.`);r(a.buffer,e,i),a.version=e.version}}return{get:i,remove:a,update:o}}var Q
vendor: 136,964 bytes, lines 162-3688
162={alphahash_fragment:`#ifdef USE_ALPHAHASH 163 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 164#endif`,alphahash_pars_fragment:`#ifdef USE_ALPHAHASH 165 const float ALPHA_HASH_SCALE = 0.05; 166 float hash2D( vec2 value ) { 167 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 168 } 169 float hash3D( vec3 value ) { 170 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 171 } 172 float getAlphaHashThreshold( vec3 position ) { 173 float maxDeriv = max( 174 length( dFdx( position.xyz ) ), 175 length( dFdy( position.xyz ) ) 176 ); 177 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 178 vec2 pixScales = vec2( 179 exp2( floor( log2( pixScale ) ) ), 180 exp2( ceil( log2( pixScale ) ) ) 181 ); 182 vec2 alpha = vec2( 183 hash3D( floor( pixScales.x * position.xyz ) ), 184 hash3D( floor( pixScales.y * position.xyz ) ) 185 ); 186 float lerpFactor = fract( log2( pixScale ) ); 187 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 188 float a = min( lerpFactor, 1.0 - lerpFactor ); 189 vec3 cases = vec3( 190 x * x / ( 2.0 * a * ( 1.0 - a ) ), 191 ( x - 0.5 * a ) / ( 1.0 - a ), 192 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 193 ); 194 float threshold = ( x < ( 1.0 - a ) ) 195 ? ( ( x < a ) ? cases.x : cases.y ) 196 : cases.z; 197 return clamp( threshold , 1.0e-6, 1.0 ); 198 } 199#endif`,alphamap_fragment:`#ifdef USE_ALPHAMAP 200 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 201#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP 202 uniform sampler2D alphaMap; 203#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST 204 #ifdef ALPHA_TO_COVERAGE 205 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 206 if ( diffuseColor.a == 0.0 ) discard; 207 #else 208 if ( diffuseColor.a < alphaTest ) discard; 209 #endif 210#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST 211 uniform float alphaTest; 212#endif`,aomap_fragment:`#ifdef USE_AOMAP 213 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 214 reflectedLight.indirectDiffuse *= ambientOcclusion; 215 #if defined( USE_CLEARCOAT ) 216 clearcoatSpecularIndirect *= ambientOcclusion; 217 #endif 218 #if defined( USE_SHEEN ) 219 sheenSpecularIndirect *= ambientOcclusion; 220 #endif 221 #if defined( USE_ENVMAP ) && defined( STANDARD ) 222 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 223 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 224 #endif 225#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP 226 uniform sampler2D aoMap; 227 uniform float aoMapIntensity; 228#endif`,batching_pars_vertex:`#ifdef USE_BATCHING 229 #if ! defined( GL_ANGLE_multi_draw ) 230 #define gl_DrawID _gl_DrawID 231 uniform int _gl_DrawID; 232 #endif 233 uniform highp sampler2D batchingTexture; 234 uniform highp usampler2D batchingIdTexture; 235 mat4 getBatchingMatrix( const in float i ) { 236 int size = textureSize( batchingTexture, 0 ).x; 237 int j = int( i ) * 4; 238 int x = j % size; 239 int y = j / size; 240 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 241 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 242 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 243 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 244 return mat4( v1, v2, v3, v4 ); 245 } 246 float getIndirectIndex( const in int i ) { 247 int size = textureSize( batchingIdTexture, 0 ).x; 248 int x = i % size; 249 int y = i / size; 250 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 251 } 252#endif 253#ifdef USE_BATCHING_COLOR 254 uniform sampler2D batchingColorTexture; 255 vec3 getBatchingColor( const in float i ) { 256 int size = textureSize( batchingColorTexture, 0 ).x; 257 int j = int( i ); 258 int x = j % size; 259 int y = j / size; 260 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 261 } 262#endif`,batching_vertex:`#ifdef USE_BATCHING 263 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 264#endif`,begin_vertex:`vec3 transformed = vec3( position ); 265#ifdef USE_ALPHAHASH 266 vPosition = vec3( position ); 267#endif`,beginnormal_vertex:`vec3 objectNormal = vec3( normal ); 268#ifdef USE_TANGENT 269 vec3 objectTangent = vec3( tangent.xyz ); 270#endif`,bsdfs:`float G_BlinnPhong_Implicit( ) { 271 return 0.25; 272} 273float D_BlinnPhong( const in float shininess, const in float dotNH ) { 274 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 275} 276vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 277 vec3 halfDir = normalize( lightDir + viewDir ); 278 float dotNH = saturate( dot( normal, halfDir ) ); 279 float dotVH = saturate( dot( viewDir, halfDir ) ); 280 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 281 float G = G_BlinnPhong_Implicit( ); 282 float D = D_BlinnPhong( shininess, dotNH ); 283 return F * ( G * D ); 284} // validated`,iridescence_fragment:`#ifdef USE_IRIDESCENCE 285 const mat3 XYZ_TO_REC709 = mat3( 286 3.2404542, -0.9692660, 0.0556434, 287 -1.5371385, 1.8760108, -0.2040259, 288 -0.4985314, 0.0415560, 1.0572252 289 ); 290 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 291 vec3 sqrtF0 = sqrt( fresnel0 ); 292 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 293 } 294 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 295 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 296 } 297 float IorToFresnel0( float transmittedIor, float incidentIor ) { 298 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 299 } 300 vec3 evalSensitivity( float OPD, vec3 shift ) { 301 float phase = 2.0 * PI * OPD * 1.0e-9; 302 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 303 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 304 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 305 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 306 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 ) ); 307 xyz /= 1.0685e-7; 308 vec3 rgb = XYZ_TO_REC709 * xyz; 309 return rgb; 310 } 311 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 312 vec3 I; 313 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 314 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 315 float cosTheta2Sq = 1.0 - sinTheta2Sq; 316 if ( cosTheta2Sq < 0.0 ) { 317 return vec3( 1.0 ); 318 } 319 float cosTheta2 = sqrt( cosTheta2Sq ); 320 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 321 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 322 float T121 = 1.0 - R12; 323 float phi12 = 0.0; 324 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 325 float phi21 = PI - phi12; 326 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 327 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 328 vec3 phi23 = vec3( 0.0 ); 329 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 330 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 331 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 332 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 333 vec3 phi = vec3( phi21 ) + phi23; 334 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 335 vec3 r123 = sqrt( R123 ); 336 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 337 vec3 C0 = R12 + Rs; 338 I = C0; 339 vec3 Cm = Rs - T121; 340 for ( int m = 1; m <= 2; ++ m ) { 341 Cm *= r123; 342 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 343 I += Cm * Sm; 344 } 345 return max( I, vec3( 0.0 ) ); 346 } 347#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP 348 uniform sampler2D bumpMap; 349 uniform float bumpScale; 350 vec2 dHdxy_fwd() { 351 vec2 dSTdx = dFdx( vBumpMapUv ); 352 vec2 dSTdy = dFdy( vBumpMapUv ); 353 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 354 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 355 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 356 return vec2( dBx, dBy ); 357 } 358 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 359 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 360 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 361 vec3 vN = surf_norm; 362 vec3 R1 = cross( vSigmaY, vN ); 363 vec3 R2 = cross( vN, vSigmaX ); 364 float fDet = dot( vSigmaX, R1 ) * faceDirection; 365 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 366 return normalize( abs( fDet ) * surf_norm - vGrad ); 367 } 368#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0 369 vec4 plane; 370 #ifdef ALPHA_TO_COVERAGE 371 float distanceToPlane, distanceGradient; 372 float clipOpacity = 1.0; 373 #pragma unroll_loop_start 374 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 375 plane = clippingPlanes[ i ]; 376 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 377 distanceGradient = fwidth( distanceToPlane ) / 2.0; 378 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 379 if ( clipOpacity == 0.0 ) discard; 380 } 381 #pragma unroll_loop_end 382 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 383 float unionClipOpacity = 1.0; 384 #pragma unroll_loop_start 385 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 386 plane = clippingPlanes[ i ]; 387 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 388 distanceGradient = fwidth( distanceToPlane ) / 2.0; 389 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 390 } 391 #pragma unroll_loop_end 392 clipOpacity *= 1.0 - unionClipOpacity; 393 #endif 394 diffuseColor.a *= clipOpacity; 395 if ( diffuseColor.a == 0.0 ) discard; 396 #else 397 #pragma unroll_loop_start 398 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 399 plane = clippingPlanes[ i ]; 400 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 401 } 402 #pragma unroll_loop_end 403 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 404 bool clipped = true; 405 #pragma unroll_loop_start 406 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 407 plane = clippingPlanes[ i ]; 408 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 409 } 410 #pragma unroll_loop_end 411 if ( clipped ) discard; 412 #endif 413 #endif 414#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 415 varying vec3 vClipPosition; 416 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 417#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 418 varying vec3 vClipPosition; 419#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 420 vClipPosition = - mvPosition.xyz; 421#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) 422 diffuseColor *= vColor; 423#elif defined( USE_COLOR ) 424 diffuseColor.rgb *= vColor; 425#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) 426 varying vec4 vColor; 427#elif defined( USE_COLOR ) 428 varying vec3 vColor; 429#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) 430 varying vec4 vColor; 431#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 432 varying vec3 vColor; 433#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) 434 vColor = vec4( 1.0 ); 435#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 436 vColor = vec3( 1.0 ); 437#endif 438#ifdef USE_COLOR 439 vColor *= color; 440#endif 441#ifdef USE_INSTANCING_COLOR 442 vColor.xyz *= instanceColor.xyz; 443#endif 444#ifdef USE_BATCHING_COLOR 445 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 446 vColor.xyz *= batchingColor.xyz; 447#endif`,common:`#define PI 3.141592653589793 448#define PI2 6.283185307179586 449#define PI_HALF 1.5707963267948966 450#define RECIPROCAL_PI 0.3183098861837907 451#define RECIPROCAL_PI2 0.15915494309189535 452#define EPSILON 1e-6 453#ifndef saturate 454#define saturate( a ) clamp( a, 0.0, 1.0 ) 455#endif 456#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 457float pow2( const in float x ) { return x*x; } 458vec3 pow2( const in vec3 x ) { return x*x; } 459float pow3( const in float x ) { return x*x*x; } 460float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 461float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 462float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 463highp float rand( const in vec2 uv ) { 464 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 465 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 466 return fract( sin( sn ) * c ); 467} 468#ifdef HIGH_PRECISION 469 float precisionSafeLength( vec3 v ) { return length( v ); } 470#else 471 float precisionSafeLength( vec3 v ) { 472 float maxComponent = max3( abs( v ) ); 473 return length( v / maxComponent ) * maxComponent; 474 } 475#endif 476struct IncidentLight { 477 vec3 color; 478 vec3 direction; 479 bool visible; 480}; 481struct ReflectedLight { 482 vec3 directDiffuse; 483 vec3 directSpecular; 484 vec3 indirectDiffuse; 485 vec3 indirectSpecular; 486}; 487#ifdef USE_ALPHAHASH 488 varying vec3 vPosition; 489#endif 490vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 491 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 492} 493vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 494 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 495} 496mat3 transposeMat3( const in mat3 m ) { 497 mat3 tmp; 498 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 499 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 500 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 501 return tmp; 502} 503bool isPerspectiveMatrix( mat4 m ) { 504 return m[ 2 ][ 3 ] == - 1.0; 505} 506vec2 equirectUv( in vec3 dir ) { 507 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 508 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 509 return vec2( u, v ); 510} 511vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 512 return RECIPROCAL_PI * diffuseColor; 513} 514vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 515 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 516 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 517} 518float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 519 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 520 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 521} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV 522 #define cubeUV_minMipLevel 4.0 523 #define cubeUV_minTileSize 16.0 524 float getFace( vec3 direction ) { 525 vec3 absDirection = abs( direction ); 526 float face = - 1.0; 527 if ( absDirection.x > absDirection.z ) { 528 if ( absDirection.x > absDirection.y ) 529 face = direction.x > 0.0 ? 0.0 : 3.0; 530 else 531 face = direction.y > 0.0 ? 1.0 : 4.0; 532 } else { 533 if ( absDirection.z > absDirection.y ) 534 face = direction.z > 0.0 ? 2.0 : 5.0; 535 else 536 face = direction.y > 0.0 ? 1.0 : 4.0; 537 } 538 return face; 539 } 540 vec2 getUV( vec3 direction, float face ) { 541 vec2 uv; 542 if ( face == 0.0 ) { 543 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 544 } else if ( face == 1.0 ) { 545 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 546 } else if ( face == 2.0 ) { 547 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 548 } else if ( face == 3.0 ) { 549 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 550 } else if ( face == 4.0 ) { 551 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 552 } else { 553 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 554 } 555 return 0.5 * ( uv + 1.0 ); 556 } 557 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 558 float face = getFace( direction ); 559 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 560 mipInt = max( mipInt, cubeUV_minMipLevel ); 561 float faceSize = exp2( mipInt ); 562 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 563 if ( face > 2.0 ) { 564 uv.y += faceSize; 565 face -= 3.0; 566 } 567 uv.x += face * faceSize; 568 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 569 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 570 uv.x *= CUBEUV_TEXEL_WIDTH; 571 uv.y *= CUBEUV_TEXEL_HEIGHT; 572 #ifdef texture2DGradEXT 573 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 574 #else 575 return texture2D( envMap, uv ).rgb; 576 #endif 577 } 578 #define cubeUV_r0 1.0 579 #define cubeUV_m0 - 2.0 580 #define cubeUV_r1 0.8 581 #define cubeUV_m1 - 1.0 582 #define cubeUV_r4 0.4 583 #define cubeUV_m4 2.0 584 #define cubeUV_r5 0.305 585 #define cubeUV_m5 3.0 586 #define cubeUV_r6 0.21 587 #define cubeUV_m6 4.0 588 float roughnessToMip( float roughness ) { 589 float mip = 0.0; 590 if ( roughness >= cubeUV_r1 ) { 591 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 592 } else if ( roughness >= cubeUV_r4 ) { 593 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 594 } else if ( roughness >= cubeUV_r5 ) { 595 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 596 } else if ( roughness >= cubeUV_r6 ) { 597 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 598 } else { 599 mip = - 2.0 * log2( 1.16 * roughness ); } 600 return mip; 601 } 602 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 603 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 604 float mipF = fract( mip ); 605 float mipInt = floor( mip ); 606 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 607 if ( mipF == 0.0 ) { 608 return vec4( color0, 1.0 ); 609 } else { 610 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 611 return vec4( mix( color0, color1, mipF ), 1.0 ); 612 } 613 } 614#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; 615#ifdef USE_TANGENT 616 vec3 transformedTangent = objectTangent; 617#endif 618#ifdef USE_BATCHING 619 mat3 bm = mat3( batchingMatrix ); 620 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 621 transformedNormal = bm * transformedNormal; 622 #ifdef USE_TANGENT 623 transformedTangent = bm * transformedTangent; 624 #endif 625#endif 626#ifdef USE_INSTANCING 627 mat3 im = mat3( instanceMatrix ); 628 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 629 transformedNormal = im * transformedNormal; 630 #ifdef USE_TANGENT 631 transformedTangent = im * transformedTangent; 632 #endif 633#endif 634transformedNormal = normalMatrix * transformedNormal; 635#ifdef FLIP_SIDED 636 transformedNormal = - transformedNormal; 637#endif 638#ifdef USE_TANGENT 639 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 640 #ifdef FLIP_SIDED 641 transformedTangent = - transformedTangent; 642 #endif 643#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP 644 uniform sampler2D displacementMap; 645 uniform float displacementScale; 646 uniform float displacementBias; 647#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP 648 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); 649#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP 650 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 651 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 652 emissiveColor = sRGBTransferEOTF( emissiveColor ); 653 #endif 654 totalEmissiveRadiance *= emissiveColor.rgb; 655#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP 656 uniform sampler2D emissiveMap; 657#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { 658 return value; 659} 660vec4 sRGBTransferEOTF( in vec4 value ) { 661 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 662} 663vec4 sRGBTransferOETF( in vec4 value ) { 664 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 ); 665}`,envmap_fragment:`#ifdef USE_ENVMAP 666 #ifdef ENV_WORLDPOS 667 vec3 cameraToFrag; 668 if ( isOrthographic ) { 669 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 670 } else { 671 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 672 } 673 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 674 #ifdef ENVMAP_MODE_REFLECTION 675 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 676 #else 677 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 678 #endif 679 #else 680 vec3 reflectVec = vReflect; 681 #endif 682 #ifdef ENVMAP_TYPE_CUBE 683 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 684 #else 685 vec4 envColor = vec4( 0.0 ); 686 #endif 687 #ifdef ENVMAP_BLENDING_MULTIPLY 688 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 689 #elif defined( ENVMAP_BLENDING_MIX ) 690 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 691 #elif defined( ENVMAP_BLENDING_ADD ) 692 outgoingLight += envColor.xyz * specularStrength * reflectivity; 693 #endif 694#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP 695 uniform float envMapIntensity; 696 uniform float flipEnvMap; 697 uniform mat3 envMapRotation; 698 #ifdef ENVMAP_TYPE_CUBE 699 uniform samplerCube envMap; 700 #else 701 uniform sampler2D envMap; 702 #endif 703 704#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP 705 uniform float reflectivity; 706 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 707 #define ENV_WORLDPOS 708 #endif 709 #ifdef ENV_WORLDPOS 710 varying vec3 vWorldPosition; 711 uniform float refractionRatio; 712 #else 713 varying vec3 vReflect; 714 #endif 715#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP 716 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 717 #define ENV_WORLDPOS 718 #endif 719 #ifdef ENV_WORLDPOS 720 721 varying vec3 vWorldPosition; 722 #else 723 varying vec3 vReflect; 724 uniform float refractionRatio; 725 #endif 726#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP 727 vec3 getIBLIrradiance( const in vec3 normal ) { 728 #ifdef ENVMAP_TYPE_CUBE_UV 729 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 730 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 731 return PI * envMapColor.rgb * envMapIntensity; 732 #else 733 return vec3( 0.0 ); 734 #endif 735 } 736 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 737 #ifdef ENVMAP_TYPE_CUBE_UV 738 vec3 reflectVec = reflect( - viewDir, normal ); 739 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 740 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 741 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 742 return envMapColor.rgb * envMapIntensity; 743 #else 744 return vec3( 0.0 ); 745 #endif 746 } 747 #ifdef USE_ANISOTROPY 748 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 749 #ifdef ENVMAP_TYPE_CUBE_UV 750 vec3 bentNormal = cross( bitangent, viewDir ); 751 bentNormal = normalize( cross( bentNormal, bitangent ) ); 752 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 753 return getIBLRadiance( viewDir, bentNormal, roughness ); 754 #else 755 return vec3( 0.0 ); 756 #endif 757 } 758 #endif 759#endif`,envmap_vertex:`#ifdef USE_ENVMAP 760 #ifdef ENV_WORLDPOS 761 vWorldPosition = worldPosition.xyz; 762 #else 763 vec3 cameraToVertex; 764 if ( isOrthographic ) { 765 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 766 } else { 767 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 768 } 769 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 770 #ifdef ENVMAP_MODE_REFLECTION 771 vReflect = reflect( cameraToVertex, worldNormal ); 772 #else 773 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 774 #endif 775 #endif 776#endif`,fog_vertex:`#ifdef USE_FOG 777 vFogDepth = - mvPosition.z; 778#endif`,fog_pars_vertex:`#ifdef USE_FOG 779 varying float vFogDepth; 780#endif`,fog_fragment:`#ifdef USE_FOG 781 #ifdef FOG_EXP2 782 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 783 #else 784 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 785 #endif 786 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 787#endif`,fog_pars_fragment:`#ifdef USE_FOG 788 uniform vec3 fogColor; 789 varying float vFogDepth; 790 #ifdef FOG_EXP2 791 uniform float fogDensity; 792 #else 793 uniform float fogNear; 794 uniform float fogFar; 795 #endif 796#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP 797 uniform sampler2D gradientMap; 798#endif 799vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 800 float dotNL = dot( normal, lightDirection ); 801 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 802 #ifdef USE_GRADIENTMAP 803 return vec3( texture2D( gradientMap, coord ).r ); 804 #else 805 vec2 fw = fwidth( coord ) * 0.5; 806 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 807 #endif 808}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP 809 uniform sampler2D lightMap; 810 uniform float lightMapIntensity; 811#endif`,lights_lambert_fragment:`LambertMaterial material; 812material.diffuseColor = diffuseColor.rgb; 813material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; 814struct LambertMaterial { 815 vec3 diffuseColor; 816 float specularStrength; 817}; 818void 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 ) { 819 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 820 vec3 irradiance = dotNL * directLight.color; 821 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 822} 823void 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 ) { 824 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 825} 826#define RE_Direct RE_Direct_Lambert 827#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; 828uniform vec3 ambientLightColor; 829#if defined( USE_LIGHT_PROBES ) 830 uniform vec3 lightProbe[ 9 ]; 831#endif 832vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 833 float x = normal.x, y = normal.y, z = normal.z; 834 vec3 result = shCoefficients[ 0 ] * 0.886227; 835 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 836 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 837 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 838 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 839 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 840 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 841 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 842 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 843 return result; 844} 845vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 846 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 847 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 848 return irradiance; 849} 850vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 851 vec3 irradiance = ambientLightColor; 852 return irradiance; 853} 854float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 855 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 856 if ( cutoffDistance > 0.0 ) { 857 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 858 } 859 return distanceFalloff; 860} 861float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 862 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 863} 864#if NUM_DIR_LIGHTS > 0 865 struct DirectionalLight { 866 vec3 direction; 867 vec3 color; 868 }; 869 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 870 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 871 light.color = directionalLight.color; 872 light.direction = directionalLight.direction; 873 light.visible = true; 874 } 875#endif 876#if NUM_POINT_LIGHTS > 0 877 struct PointLight { 878 vec3 position; 879 vec3 color; 880 float distance; 881 float decay; 882 }; 883 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 884 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 885 vec3 lVector = pointLight.position - geometryPosition; 886 light.direction = normalize( lVector ); 887 float lightDistance = length( lVector ); 888 light.color = pointLight.color; 889 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 890 light.visible = ( light.color != vec3( 0.0 ) ); 891 } 892#endif 893#if NUM_SPOT_LIGHTS > 0 894 struct SpotLight { 895 vec3 position; 896 vec3 direction; 897 vec3 color; 898 float distance; 899 float decay; 900 float coneCos; 901 float penumbraCos; 902 }; 903 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 904 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 905 vec3 lVector = spotLight.position - geometryPosition; 906 light.direction = normalize( lVector ); 907 float angleCos = dot( light.direction, spotLight.direction ); 908 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 909 if ( spotAttenuation > 0.0 ) { 910 float lightDistance = length( lVector ); 911 light.color = spotLight.color * spotAttenuation; 912 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 913 light.visible = ( light.color != vec3( 0.0 ) ); 914 } else { 915 light.color = vec3( 0.0 ); 916 light.visible = false; 917 } 918 } 919#endif 920#if NUM_RECT_AREA_LIGHTS > 0 921 struct RectAreaLight { 922 vec3 color; 923 vec3 position; 924 vec3 halfWidth; 925 vec3 halfHeight; 926 }; 927 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 928 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 929#endif 930#if NUM_HEMI_LIGHTS > 0 931 struct HemisphereLight { 932 vec3 direction; 933 vec3 skyColor; 934 vec3 groundColor; 935 }; 936 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 937 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 938 float dotNL = dot( normal, hemiLight.direction ); 939 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 940 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 941 return irradiance; 942 } 943#endif`,lights_toon_fragment:`ToonMaterial material; 944material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; 945struct ToonMaterial { 946 vec3 diffuseColor; 947}; 948void 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 ) { 949 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 950 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 951} 952void 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 ) { 953 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 954} 955#define RE_Direct RE_Direct_Toon 956#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; 957material.diffuseColor = diffuseColor.rgb; 958material.specularColor = specular; 959material.specularShininess = shininess; 960material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; 961struct BlinnPhongMaterial { 962 vec3 diffuseColor; 963 vec3 specularColor; 964 float specularShininess; 965 float specularStrength; 966}; 967void 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 ) { 968 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 969 vec3 irradiance = dotNL * directLight.color; 970 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 971 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 972} 973void 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 ) { 974 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 975} 976#define RE_Direct RE_Direct_BlinnPhong 977#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; 978material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 979vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 980float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 981material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 982material.roughness = min( material.roughness, 1.0 ); 983#ifdef IOR 984 material.ior = ior; 985 #ifdef USE_SPECULAR 986 float specularIntensityFactor = specularIntensity; 987 vec3 specularColorFactor = specularColor; 988 #ifdef USE_SPECULAR_COLORMAP 989 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 990 #endif 991 #ifdef USE_SPECULAR_INTENSITYMAP 992 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 993 #endif 994 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 995 #else 996 float specularIntensityFactor = 1.0; 997 vec3 specularColorFactor = vec3( 1.0 ); 998 material.specularF90 = 1.0; 999 #endif 1000 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 1001#else 1002 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 1003 material.specularF90 = 1.0; 1004#endif 1005#ifdef USE_CLEARCOAT 1006 material.clearcoat = clearcoat; 1007 material.clearcoatRoughness = clearcoatRoughness; 1008 material.clearcoatF0 = vec3( 0.04 ); 1009 material.clearcoatF90 = 1.0; 1010 #ifdef USE_CLEARCOATMAP 1011 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 1012 #endif 1013 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 1014 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 1015 #endif 1016 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 1017 material.clearcoatRoughness += geometryRoughness; 1018 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 1019#endif 1020#ifdef USE_DISPERSION 1021 material.dispersion = dispersion; 1022#endif 1023#ifdef USE_IRIDESCENCE 1024 material.iridescence = iridescence; 1025 material.iridescenceIOR = iridescenceIOR; 1026 #ifdef USE_IRIDESCENCEMAP 1027 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 1028 #endif 1029 #ifdef USE_IRIDESCENCE_THICKNESSMAP 1030 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 1031 #else 1032 material.iridescenceThickness = iridescenceThicknessMaximum; 1033 #endif 1034#endif 1035#ifdef USE_SHEEN 1036 material.sheenColor = sheenColor; 1037 #ifdef USE_SHEEN_COLORMAP 1038 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 1039 #endif 1040 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 1041 #ifdef USE_SHEEN_ROUGHNESSMAP 1042 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 1043 #endif 1044#endif 1045#ifdef USE_ANISOTROPY 1046 #ifdef USE_ANISOTROPYMAP 1047 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 1048 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 1049 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 1050 #else 1051 vec2 anisotropyV = anisotropyVector; 1052 #endif 1053 material.anisotropy = length( anisotropyV ); 1054 if( material.anisotropy == 0.0 ) { 1055 anisotropyV = vec2( 1.0, 0.0 ); 1056 } else { 1057 anisotropyV /= material.anisotropy; 1058 material.anisotropy = saturate( material.anisotropy ); 1059 } 1060 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); 1061 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 1062 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 1063#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { 1064 vec3 diffuseColor; 1065 float roughness; 1066 vec3 specularColor; 1067 float specularF90; 1068 float dispersion; 1069 #ifdef USE_CLEARCOAT 1070 float clearcoat; 1071 float clearcoatRoughness; 1072 vec3 clearcoatF0; 1073 float clearcoatF90; 1074 #endif 1075 #ifdef USE_IRIDESCENCE 1076 float iridescence; 1077 float iridescenceIOR; 1078 float iridescenceThickness; 1079 vec3 iridescenceFresnel; 1080 vec3 iridescenceF0; 1081 #endif 1082 #ifdef USE_SHEEN 1083 vec3 sheenColor; 1084 float sheenRoughness; 1085 #endif 1086 #ifdef IOR 1087 float ior; 1088 #endif 1089 #ifdef USE_TRANSMISSION 1090 float transmission; 1091 float transmissionAlpha; 1092 float thickness; 1093 float attenuationDistance; 1094 vec3 attenuationColor; 1095 #endif 1096 #ifdef USE_ANISOTROPY 1097 float anisotropy; 1098 float alphaT; 1099 vec3 anisotropyT; 1100 vec3 anisotropyB; 1101 #endif 1102}; 1103vec3 clearcoatSpecularDirect = vec3( 0.0 ); 1104vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 1105vec3 sheenSpecularDirect = vec3( 0.0 ); 1106vec3 sheenSpecularIndirect = vec3(0.0 ); 1107vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1108 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1109 float x2 = x * x; 1110 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1111 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1112} 1113float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1114 float a2 = pow2( alpha ); 1115 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1116 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1117 return 0.5 / max( gv + gl, EPSILON ); 1118} 1119float D_GGX( const in float alpha, const in float dotNH ) { 1120 float a2 = pow2( alpha ); 1121 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1122 return RECIPROCAL_PI * a2 / pow2( denom ); 1123} 1124#ifdef USE_ANISOTROPY 1125 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 ) { 1126 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1127 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1128 float v = 0.5 / ( gv + gl ); 1129 return saturate(v); 1130 } 1131 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1132 float a2 = alphaT * alphaB; 1133 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1134 highp float v2 = dot( v, v ); 1135 float w2 = a2 / v2; 1136 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1137 } 1138#endif 1139#ifdef USE_CLEARCOAT 1140 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1141 vec3 f0 = material.clearcoatF0; 1142 float f90 = material.clearcoatF90; 1143 float roughness = material.clearcoatRoughness; 1144 float alpha = pow2( roughness ); 1145 vec3 halfDir = normalize( lightDir + viewDir ); 1146 float dotNL = saturate( dot( normal, lightDir ) ); 1147 float dotNV = saturate( dot( normal, viewDir ) ); 1148 float dotNH = saturate( dot( normal, halfDir ) ); 1149 float dotVH = saturate( dot( viewDir, halfDir ) ); 1150 vec3 F = F_Schlick( f0, f90, dotVH ); 1151 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1152 float D = D_GGX( alpha, dotNH ); 1153 return F * ( V * D ); 1154 } 1155#endif 1156vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1157 vec3 f0 = material.specularColor; 1158 float f90 = material.specularF90; 1159 float roughness = material.roughness; 1160 float alpha = pow2( roughness ); 1161 vec3 halfDir = normalize( lightDir + viewDir ); 1162 float dotNL = saturate( dot( normal, lightDir ) ); 1163 float dotNV = saturate( dot( normal, viewDir ) ); 1164 float dotNH = saturate( dot( normal, halfDir ) ); 1165 float dotVH = saturate( dot( viewDir, halfDir ) ); 1166 vec3 F = F_Schlick( f0, f90, dotVH ); 1167 #ifdef USE_IRIDESCENCE 1168 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1169 #endif 1170 #ifdef USE_ANISOTROPY 1171 float dotTL = dot( material.anisotropyT, lightDir ); 1172 float dotTV = dot( material.anisotropyT, viewDir ); 1173 float dotTH = dot( material.anisotropyT, halfDir ); 1174 float dotBL = dot( material.anisotropyB, lightDir ); 1175 float dotBV = dot( material.anisotropyB, viewDir ); 1176 float dotBH = dot( material.anisotropyB, halfDir ); 1177 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1178 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1179 #else 1180 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1181 float D = D_GGX( alpha, dotNH ); 1182 #endif 1183 return F * ( V * D ); 1184} 1185vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1186 const float LUT_SIZE = 64.0; 1187 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1188 const float LUT_BIAS = 0.5 / LUT_SIZE; 1189 float dotNV = saturate( dot( N, V ) ); 1190 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1191 uv = uv * LUT_SCALE + LUT_BIAS; 1192 return uv; 1193} 1194float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1195 float l = length( f ); 1196 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1197} 1198vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1199 float x = dot( v1, v2 ); 1200 float y = abs( x ); 1201 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1202 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1203 float v = a / b; 1204 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1205 return cross( v1, v2 ) * theta_sintheta; 1206} 1207vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1208 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1209 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1210 vec3 lightNormal = cross( v1, v2 ); 1211 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1212 vec3 T1, T2; 1213 T1 = normalize( V - N * dot( V, N ) ); 1214 T2 = - cross( N, T1 ); 1215 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1216 vec3 coords[ 4 ]; 1217 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1218 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1219 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1220 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1221 coords[ 0 ] = normalize( coords[ 0 ] ); 1222 coords[ 1 ] = normalize( coords[ 1 ] ); 1223 coords[ 2 ] = normalize( coords[ 2 ] ); 1224 coords[ 3 ] = normalize( coords[ 3 ] ); 1225 vec3 vectorFormFactor = vec3( 0.0 ); 1226 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1227 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1228 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1229 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1230 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1231 return vec3( result ); 1232} 1233#if defined( USE_SHEEN ) 1234float D_Charlie( float roughness, float dotNH ) { 1235 float alpha = pow2( roughness ); 1236 float invAlpha = 1.0 / alpha; 1237 float cos2h = dotNH * dotNH; 1238 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1239 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1240} 1241float V_Neubelt( float dotNV, float dotNL ) { 1242 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1243} 1244vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1245 vec3 halfDir = normalize( lightDir + viewDir ); 1246 float dotNL = saturate( dot( normal, lightDir ) ); 1247 float dotNV = saturate( dot( normal, viewDir ) ); 1248 float dotNH = saturate( dot( normal, halfDir ) ); 1249 float D = D_Charlie( sheenRoughness, dotNH ); 1250 float V = V_Neubelt( dotNV, dotNL ); 1251 return sheenColor * ( D * V ); 1252} 1253#endif 1254float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1255 float dotNV = saturate( dot( normal, viewDir ) ); 1256 float r2 = roughness * roughness; 1257 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1258 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1259 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1260 return saturate( DG * RECIPROCAL_PI ); 1261} 1262vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1263 float dotNV = saturate( dot( normal, viewDir ) ); 1264 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1265 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1266 vec4 r = roughness * c0 + c1; 1267 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1268 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1269 return fab; 1270} 1271vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1272 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1273 return specularColor * fab.x + specularF90 * fab.y; 1274} 1275#ifdef USE_IRIDESCENCE 1276void 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 ) { 1277#else 1278void 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 ) { 1279#endif 1280 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1281 #ifdef USE_IRIDESCENCE 1282 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1283 #else 1284 vec3 Fr = specularColor; 1285 #endif 1286 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1287 float Ess = fab.x + fab.y; 1288 float Ems = 1.0 - Ess; 1289 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1290 singleScatter += FssEss; 1291 multiScatter += Fms * Ems; 1292} 1293#if NUM_RECT_AREA_LIGHTS > 0 1294 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 ) { 1295 vec3 normal = geometryNormal; 1296 vec3 viewDir = geometryViewDir; 1297 vec3 position = geometryPosition; 1298 vec3 lightPos = rectAreaLight.position; 1299 vec3 halfWidth = rectAreaLight.halfWidth; 1300 vec3 halfHeight = rectAreaLight.halfHeight; 1301 vec3 lightColor = rectAreaLight.color; 1302 float roughness = material.roughness; 1303 vec3 rectCoords[ 4 ]; 1304 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1305 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1306 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1307 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1308 vec4 t1 = texture2D( ltc_1, uv ); 1309 vec4 t2 = texture2D( ltc_2, uv ); 1310 mat3 mInv = mat3( 1311 vec3( t1.x, 0, t1.y ), 1312 vec3( 0, 1, 0 ), 1313 vec3( t1.z, 0, t1.w ) 1314 ); 1315 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1316 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1317 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1318 } 1319#endif 1320void 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 ) { 1321 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1322 vec3 irradiance = dotNL * directLight.color; 1323 #ifdef USE_CLEARCOAT 1324 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1325 vec3 ccIrradiance = dotNLcc * directLight.color; 1326 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1327 #endif 1328 #ifdef USE_SHEEN 1329 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1330 #endif 1331 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1332 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1333} 1334void 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 ) { 1335 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1336} 1337void 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) { 1338 #ifdef USE_CLEARCOAT 1339 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1340 #endif 1341 #ifdef USE_SHEEN 1342 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1343 #endif 1344 vec3 singleScattering = vec3( 0.0 ); 1345 vec3 multiScattering = vec3( 0.0 ); 1346 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1347 #ifdef USE_IRIDESCENCE 1348 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1349 #else 1350 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1351 #endif 1352 vec3 totalScattering = singleScattering + multiScattering; 1353 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1354 reflectedLight.indirectSpecular += radiance * singleScattering; 1355 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1356 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1357} 1358#define RE_Direct RE_Direct_Physical 1359#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1360#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1361#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1362float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1363 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1364}`,lights_fragment_begin:` 1365vec3 geometryPosition = - vViewPosition; 1366vec3 geometryNormal = normal; 1367vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1368vec3 geometryClearcoatNormal = vec3( 0.0 ); 1369#ifdef USE_CLEARCOAT 1370 geometryClearcoatNormal = clearcoatNormal; 1371#endif 1372#ifdef USE_IRIDESCENCE 1373 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1374 if ( material.iridescenceThickness == 0.0 ) { 1375 material.iridescence = 0.0; 1376 } else { 1377 material.iridescence = saturate( material.iridescence ); 1378 } 1379 if ( material.iridescence > 0.0 ) { 1380 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1381 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1382 } 1383#endif 1384IncidentLight directLight; 1385#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1386 PointLight pointLight; 1387 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1388 PointLightShadow pointLightShadow; 1389 #endif 1390 #pragma unroll_loop_start 1391 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1392 pointLight = pointLights[ i ]; 1393 getPointLightInfo( pointLight, geometryPosition, directLight ); 1394 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1395 pointLightShadow = pointLightShadows[ i ]; 1396 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1397 #endif 1398 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1399 } 1400 #pragma unroll_loop_end 1401#endif 1402#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1403 SpotLight spotLight; 1404 vec4 spotColor; 1405 vec3 spotLightCoord; 1406 bool inSpotLightMap; 1407 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1408 SpotLightShadow spotLightShadow; 1409 #endif 1410 #pragma unroll_loop_start 1411 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1412 spotLight = spotLights[ i ]; 1413 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1414 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1415 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1416 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1417 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1418 #else 1419 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1420 #endif 1421 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1422 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1423 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1424 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1425 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1426 #endif 1427 #undef SPOT_LIGHT_MAP_INDEX 1428 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1429 spotLightShadow = spotLightShadows[ i ]; 1430 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1431 #endif 1432 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1433 } 1434 #pragma unroll_loop_end 1435#endif 1436#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1437 DirectionalLight directionalLight; 1438 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1439 DirectionalLightShadow directionalLightShadow; 1440 #endif 1441 #pragma unroll_loop_start 1442 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1443 directionalLight = directionalLights[ i ]; 1444 getDirectionalLightInfo( directionalLight, directLight ); 1445 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1446 directionalLightShadow = directionalLightShadows[ i ]; 1447 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1448 #endif 1449 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1450 } 1451 #pragma unroll_loop_end 1452#endif 1453#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1454 RectAreaLight rectAreaLight; 1455 #pragma unroll_loop_start 1456 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1457 rectAreaLight = rectAreaLights[ i ]; 1458 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1459 } 1460 #pragma unroll_loop_end 1461#endif 1462#if defined( RE_IndirectDiffuse ) 1463 vec3 iblIrradiance = vec3( 0.0 ); 1464 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1465 #if defined( USE_LIGHT_PROBES ) 1466 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1467 #endif 1468 #if ( NUM_HEMI_LIGHTS > 0 ) 1469 #pragma unroll_loop_start 1470 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1471 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1472 } 1473 #pragma unroll_loop_end 1474 #endif 1475#endif 1476#if defined( RE_IndirectSpecular ) 1477 vec3 radiance = vec3( 0.0 ); 1478 vec3 clearcoatRadiance = vec3( 0.0 ); 1479#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) 1480 #ifdef USE_LIGHTMAP 1481 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1482 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1483 irradiance += lightMapIrradiance; 1484 #endif 1485 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1486 iblIrradiance += getIBLIrradiance( geometryNormal ); 1487 #endif 1488#endif 1489#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1490 #ifdef USE_ANISOTROPY 1491 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1492 #else 1493 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1494 #endif 1495 #ifdef USE_CLEARCOAT 1496 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1497 #endif 1498#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) 1499 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1500#endif 1501#if defined( RE_IndirectSpecular ) 1502 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1503#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) 1504 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1505#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) 1506 uniform float logDepthBufFC; 1507 varying float vFragDepth; 1508 varying float vIsPerspective; 1509#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF 1510 varying float vFragDepth; 1511 varying float vIsPerspective; 1512#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF 1513 vFragDepth = 1.0 + gl_Position.w; 1514 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1515#endif`,map_fragment:`#ifdef USE_MAP 1516 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1517 #ifdef DECODE_VIDEO_TEXTURE 1518 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1519 #endif 1520 diffuseColor *= sampledDiffuseColor; 1521#endif`,map_pars_fragment:`#ifdef USE_MAP 1522 uniform sampler2D map; 1523#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1524 #if defined( USE_POINTS_UV ) 1525 vec2 uv = vUv; 1526 #else 1527 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1528 #endif 1529#endif 1530#ifdef USE_MAP 1531 diffuseColor *= texture2D( map, uv ); 1532#endif 1533#ifdef USE_ALPHAMAP 1534 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1535#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) 1536 varying vec2 vUv; 1537#else 1538 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1539 uniform mat3 uvTransform; 1540 #endif 1541#endif 1542#ifdef USE_MAP 1543 uniform sampler2D map; 1544#endif 1545#ifdef USE_ALPHAMAP 1546 uniform sampler2D alphaMap; 1547#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; 1548#ifdef USE_METALNESSMAP 1549 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1550 metalnessFactor *= texelMetalness.b; 1551#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP 1552 uniform sampler2D metalnessMap; 1553#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH 1554 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1555 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1556 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1557 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1558 } 1559#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) 1560 vColor *= morphTargetBaseInfluence; 1561 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1562 #if defined( USE_COLOR_ALPHA ) 1563 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1564 #elif defined( USE_COLOR ) 1565 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1566 #endif 1567 } 1568#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS 1569 objectNormal *= morphTargetBaseInfluence; 1570 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1571 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1572 } 1573#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS 1574 #ifndef USE_INSTANCING_MORPH 1575 uniform float morphTargetBaseInfluence; 1576 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1577 #endif 1578 uniform sampler2DArray morphTargetsTexture; 1579 uniform ivec2 morphTargetsTextureSize; 1580 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1581 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1582 int y = texelIndex / morphTargetsTextureSize.x; 1583 int x = texelIndex - y * morphTargetsTextureSize.x; 1584 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1585 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1586 } 1587#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS 1588 transformed *= morphTargetBaseInfluence; 1589 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1590 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1591 } 1592#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1593#ifdef FLAT_SHADED 1594 vec3 fdx = dFdx( vViewPosition ); 1595 vec3 fdy = dFdy( vViewPosition ); 1596 vec3 normal = normalize( cross( fdx, fdy ) ); 1597#else 1598 vec3 normal = normalize( vNormal ); 1599 #ifdef DOUBLE_SIDED 1600 normal *= faceDirection; 1601 #endif 1602#endif 1603#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1604 #ifdef USE_TANGENT 1605 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1606 #else 1607 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1608 #if defined( USE_NORMALMAP ) 1609 vNormalMapUv 1610 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1611 vClearcoatNormalMapUv 1612 #else 1613 vUv 1614 #endif 1615 ); 1616 #endif 1617 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1618 tbn[0] *= faceDirection; 1619 tbn[1] *= faceDirection; 1620 #endif 1621#endif 1622#ifdef USE_CLEARCOAT_NORMALMAP 1623 #ifdef USE_TANGENT 1624 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1625 #else 1626 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1627 #endif 1628 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1629 tbn2[0] *= faceDirection; 1630 tbn2[1] *= faceDirection; 1631 #endif 1632#endif 1633vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE 1634 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1635 #ifdef FLIP_SIDED 1636 normal = - normal; 1637 #endif 1638 #ifdef DOUBLE_SIDED 1639 normal = normal * faceDirection; 1640 #endif 1641 normal = normalize( normalMatrix * normal ); 1642#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1643 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1644 mapN.xy *= normalScale; 1645 normal = normalize( tbn * mapN ); 1646#elif defined( USE_BUMPMAP ) 1647 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1648#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED 1649 varying vec3 vNormal; 1650 #ifdef USE_TANGENT 1651 varying vec3 vTangent; 1652 varying vec3 vBitangent; 1653 #endif 1654#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED 1655 varying vec3 vNormal; 1656 #ifdef USE_TANGENT 1657 varying vec3 vTangent; 1658 varying vec3 vBitangent; 1659 #endif 1660#endif`,normal_vertex:`#ifndef FLAT_SHADED 1661 vNormal = normalize( transformedNormal ); 1662 #ifdef USE_TANGENT 1663 vTangent = normalize( transformedTangent ); 1664 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1665 #endif 1666#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP 1667 uniform sampler2D normalMap; 1668 uniform vec2 normalScale; 1669#endif 1670#ifdef USE_NORMALMAP_OBJECTSPACE 1671 uniform mat3 normalMatrix; 1672#endif 1673#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1674 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1675 vec3 q0 = dFdx( eye_pos.xyz ); 1676 vec3 q1 = dFdy( eye_pos.xyz ); 1677 vec2 st0 = dFdx( uv.st ); 1678 vec2 st1 = dFdy( uv.st ); 1679 vec3 N = surf_norm; 1680 vec3 q1perp = cross( q1, N ); 1681 vec3 q0perp = cross( N, q0 ); 1682 vec3 T = q1perp * st0.x + q0perp * st1.x; 1683 vec3 B = q1perp * st0.y + q0perp * st1.y; 1684 float det = max( dot( T, T ), dot( B, B ) ); 1685 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1686 return mat3( T * scale, B * scale, N ); 1687 } 1688#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT 1689 vec3 clearcoatNormal = nonPerturbedNormal; 1690#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP 1691 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1692 clearcoatMapN.xy *= clearcoatNormalScale; 1693 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1694#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP 1695 uniform sampler2D clearcoatMap; 1696#endif 1697#ifdef USE_CLEARCOAT_NORMALMAP 1698 uniform sampler2D clearcoatNormalMap; 1699 uniform vec2 clearcoatNormalScale; 1700#endif 1701#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1702 uniform sampler2D clearcoatRoughnessMap; 1703#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP 1704 uniform sampler2D iridescenceMap; 1705#endif 1706#ifdef USE_IRIDESCENCE_THICKNESSMAP 1707 uniform sampler2D iridescenceThicknessMap; 1708#endif`,opaque_fragment:`#ifdef OPAQUE 1709diffuseColor.a = 1.0; 1710#endif 1711#ifdef USE_TRANSMISSION 1712diffuseColor.a *= material.transmissionAlpha; 1713#endif 1714gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { 1715 return normalize( normal ) * 0.5 + 0.5; 1716} 1717vec3 unpackRGBToNormal( const in vec3 rgb ) { 1718 return 2.0 * rgb.xyz - 1.0; 1719} 1720const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1721const float Inv255 = 1. / 255.; 1722const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1723const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1724const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1725const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1726vec4 packDepthToRGBA( const in float v ) { 1727 if( v <= 0.0 ) 1728 return vec4( 0., 0., 0., 0. ); 1729 if( v >= 1.0 ) 1730 return vec4( 1., 1., 1., 1. ); 1731 float vuf; 1732 float af = modf( v * PackFactors.a, vuf ); 1733 float bf = modf( vuf * ShiftRight8, vuf ); 1734 float gf = modf( vuf * ShiftRight8, vuf ); 1735 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1736} 1737vec3 packDepthToRGB( const in float v ) { 1738 if( v <= 0.0 ) 1739 return vec3( 0., 0., 0. ); 1740 if( v >= 1.0 ) 1741 return vec3( 1., 1., 1. ); 1742 float vuf; 1743 float bf = modf( v * PackFactors.b, vuf ); 1744 float gf = modf( vuf * ShiftRight8, vuf ); 1745 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1746} 1747vec2 packDepthToRG( const in float v ) { 1748 if( v <= 0.0 ) 1749 return vec2( 0., 0. ); 1750 if( v >= 1.0 ) 1751 return vec2( 1., 1. ); 1752 float vuf; 1753 float gf = modf( v * 256., vuf ); 1754 return vec2( vuf * Inv255, gf ); 1755} 1756float unpackRGBAToDepth( const in vec4 v ) { 1757 return dot( v, UnpackFactors4 ); 1758} 1759float unpackRGBToDepth( const in vec3 v ) { 1760 return dot( v, UnpackFactors3 ); 1761} 1762float unpackRGToDepth( const in vec2 v ) { 1763 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1764} 1765vec4 pack2HalfToRGBA( const in vec2 v ) { 1766 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1767 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1768} 1769vec2 unpackRGBATo2Half( const in vec4 v ) { 1770 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1771} 1772float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1773 return ( viewZ + near ) / ( near - far ); 1774} 1775float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1776 return depth * ( near - far ) - near; 1777} 1778float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1779 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1780} 1781float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1782 return ( near * far ) / ( ( far - near ) * depth - far ); 1783}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA 1784 gl_FragColor.rgb *= gl_FragColor.a; 1785#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); 1786#ifdef USE_BATCHING 1787 mvPosition = batchingMatrix * mvPosition; 1788#endif 1789#ifdef USE_INSTANCING 1790 mvPosition = instanceMatrix * mvPosition; 1791#endif 1792mvPosition = modelViewMatrix * mvPosition; 1793gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING 1794 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1795#endif`,dithering_pars_fragment:`#ifdef DITHERING 1796 vec3 dithering( vec3 color ) { 1797 float grid_position = rand( gl_FragCoord.xy ); 1798 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1799 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1800 return color + dither_shift_RGB; 1801 } 1802#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; 1803#ifdef USE_ROUGHNESSMAP 1804 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1805 roughnessFactor *= texelRoughness.g; 1806#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP 1807 uniform sampler2D roughnessMap; 1808#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 1809 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1810#endif 1811#if NUM_SPOT_LIGHT_MAPS > 0 1812 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1813#endif 1814#ifdef USE_SHADOWMAP 1815 #if NUM_DIR_LIGHT_SHADOWS > 0 1816 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1817 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1818 struct DirectionalLightShadow { 1819 float shadowIntensity; 1820 float shadowBias; 1821 float shadowNormalBias; 1822 float shadowRadius; 1823 vec2 shadowMapSize; 1824 }; 1825 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1826 #endif 1827 #if NUM_SPOT_LIGHT_SHADOWS > 0 1828 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1829 struct SpotLightShadow { 1830 float shadowIntensity; 1831 float shadowBias; 1832 float shadowNormalBias; 1833 float shadowRadius; 1834 vec2 shadowMapSize; 1835 }; 1836 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1837 #endif 1838 #if NUM_POINT_LIGHT_SHADOWS > 0 1839 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1840 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1841 struct PointLightShadow { 1842 float shadowIntensity; 1843 float shadowBias; 1844 float shadowNormalBias; 1845 float shadowRadius; 1846 vec2 shadowMapSize; 1847 float shadowCameraNear; 1848 float shadowCameraFar; 1849 }; 1850 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1851 #endif 1852 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1853 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1854 } 1855 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1856 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1857 } 1858 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1859 float occlusion = 1.0; 1860 vec2 distribution = texture2DDistribution( shadow, uv ); 1861 float hard_shadow = step( compare , distribution.x ); 1862 if (hard_shadow != 1.0 ) { 1863 float distance = compare - distribution.x ; 1864 float variance = max( 0.00000, distribution.y * distribution.y ); 1865 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 ); 1866 } 1867 return occlusion; 1868 } 1869 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1870 float shadow = 1.0; 1871 shadowCoord.xyz /= shadowCoord.w; 1872 shadowCoord.z += shadowBias; 1873 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1874 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1875 if ( frustumTest ) { 1876 #if defined( SHADOWMAP_TYPE_PCF ) 1877 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1878 float dx0 = - texelSize.x * shadowRadius; 1879 float dy0 = - texelSize.y * shadowRadius; 1880 float dx1 = + texelSize.x * shadowRadius; 1881 float dy1 = + texelSize.y * shadowRadius; 1882 float dx2 = dx0 / 2.0; 1883 float dy2 = dy0 / 2.0; 1884 float dx3 = dx1 / 2.0; 1885 float dy3 = dy1 / 2.0; 1886 shadow = ( 1887 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1888 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1889 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1890 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1891 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1892 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1893 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1894 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1895 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1896 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1897 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1898 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1899 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1900 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1901 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1902 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1903 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1904 ) * ( 1.0 / 17.0 ); 1905 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1906 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1907 float dx = texelSize.x; 1908 float dy = texelSize.y; 1909 vec2 uv = shadowCoord.xy; 1910 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1911 uv -= f * texelSize; 1912 shadow = ( 1913 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1914 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1915 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1916 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1917 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1918 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1919 f.x ) + 1920 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1921 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1922 f.x ) + 1923 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1924 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1925 f.y ) + 1926 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1927 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1928 f.y ) + 1929 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1930 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1931 f.x ), 1932 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1933 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1934 f.x ), 1935 f.y ) 1936 ) * ( 1.0 / 9.0 ); 1937 #elif defined( SHADOWMAP_TYPE_VSM ) 1938 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1939 #else 1940 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1941 #endif 1942 } 1943 return mix( 1.0, shadow, shadowIntensity ); 1944 } 1945 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1946 vec3 absV = abs( v ); 1947 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1948 absV *= scaleToCube; 1949 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1950 vec2 planar = v.xy; 1951 float almostATexel = 1.5 * texelSizeY; 1952 float almostOne = 1.0 - almostATexel; 1953 if ( absV.z >= almostOne ) { 1954 if ( v.z > 0.0 ) 1955 planar.x = 4.0 - v.x; 1956 } else if ( absV.x >= almostOne ) { 1957 float signX = sign( v.x ); 1958 planar.x = v.z * signX + 2.0 * signX; 1959 } else if ( absV.y >= almostOne ) { 1960 float signY = sign( v.y ); 1961 planar.x = v.x + 2.0 * signY + 2.0; 1962 planar.y = v.z * signY - 2.0; 1963 } 1964 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1965 } 1966 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1967 float shadow = 1.0; 1968 vec3 lightToPosition = shadowCoord.xyz; 1969 1970 float lightToPositionLength = length( lightToPosition ); 1971 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1972 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1973 vec3 bd3D = normalize( lightToPosition ); 1974 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1975 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1976 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1977 shadow = ( 1978 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1979 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1980 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1981 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1982 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1983 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1984 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1985 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1986 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1987 ) * ( 1.0 / 9.0 ); 1988 #else 1989 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1990 #endif 1991 } 1992 return mix( 1.0, shadow, shadowIntensity ); 1993 } 1994#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 1995 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1996 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1997#endif 1998#ifdef USE_SHADOWMAP 1999 #if NUM_DIR_LIGHT_SHADOWS > 0 2000 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 2001 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 2002 struct DirectionalLightShadow { 2003 float shadowIntensity; 2004 float shadowBias; 2005 float shadowNormalBias; 2006 float shadowRadius; 2007 vec2 shadowMapSize; 2008 }; 2009 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 2010 #endif 2011 #if NUM_SPOT_LIGHT_SHADOWS > 0 2012 struct SpotLightShadow { 2013 float shadowIntensity; 2014 float shadowBias; 2015 float shadowNormalBias; 2016 float shadowRadius; 2017 vec2 shadowMapSize; 2018 }; 2019 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2020 #endif 2021 #if NUM_POINT_LIGHT_SHADOWS > 0 2022 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2023 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2024 struct PointLightShadow { 2025 float shadowIntensity; 2026 float shadowBias; 2027 float shadowNormalBias; 2028 float shadowRadius; 2029 vec2 shadowMapSize; 2030 float shadowCameraNear; 2031 float shadowCameraFar; 2032 }; 2033 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2034 #endif 2035#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2036 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 2037 vec4 shadowWorldPosition; 2038#endif 2039#if defined( USE_SHADOWMAP ) 2040 #if NUM_DIR_LIGHT_SHADOWS > 0 2041 #pragma unroll_loop_start 2042 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2043 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2044 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2045 } 2046 #pragma unroll_loop_end 2047 #endif 2048 #if NUM_POINT_LIGHT_SHADOWS > 0 2049 #pragma unroll_loop_start 2050 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2051 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2052 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2053 } 2054 #pragma unroll_loop_end 2055 #endif 2056#endif 2057#if NUM_SPOT_LIGHT_COORDS > 0 2058 #pragma unroll_loop_start 2059 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2060 shadowWorldPosition = worldPosition; 2061 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2062 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2063 #endif 2064 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2065 } 2066 #pragma unroll_loop_end 2067#endif`,shadowmask_pars_fragment:`float getShadowMask() { 2068 float shadow = 1.0; 2069 #ifdef USE_SHADOWMAP 2070 #if NUM_DIR_LIGHT_SHADOWS > 0 2071 DirectionalLightShadow directionalLight; 2072 #pragma unroll_loop_start 2073 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2074 directionalLight = directionalLightShadows[ i ]; 2075 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2076 } 2077 #pragma unroll_loop_end 2078 #endif 2079 #if NUM_SPOT_LIGHT_SHADOWS > 0 2080 SpotLightShadow spotLight; 2081 #pragma unroll_loop_start 2082 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2083 spotLight = spotLightShadows[ i ]; 2084 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2085 } 2086 #pragma unroll_loop_end 2087 #endif 2088 #if NUM_POINT_LIGHT_SHADOWS > 0 2089 PointLightShadow pointLight; 2090 #pragma unroll_loop_start 2091 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2092 pointLight = pointLightShadows[ i ]; 2093 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2094 } 2095 #pragma unroll_loop_end 2096 #endif 2097 #endif 2098 return shadow; 2099}`,skinbase_vertex:`#ifdef USE_SKINNING 2100 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2101 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2102 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2103 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2104#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING 2105 uniform mat4 bindMatrix; 2106 uniform mat4 bindMatrixInverse; 2107 uniform highp sampler2D boneTexture; 2108 mat4 getBoneMatrix( const in float i ) { 2109 int size = textureSize( boneTexture, 0 ).x; 2110 int j = int( i ) * 4; 2111 int x = j % size; 2112 int y = j / size; 2113 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2114 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2115 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2116 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2117 return mat4( v1, v2, v3, v4 ); 2118 } 2119#endif`,skinning_vertex:`#ifdef USE_SKINNING 2120 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2121 vec4 skinned = vec4( 0.0 ); 2122 skinned += boneMatX * skinVertex * skinWeight.x; 2123 skinned += boneMatY * skinVertex * skinWeight.y; 2124 skinned += boneMatZ * skinVertex * skinWeight.z; 2125 skinned += boneMatW * skinVertex * skinWeight.w; 2126 transformed = ( bindMatrixInverse * skinned ).xyz; 2127#endif`,skinnormal_vertex:`#ifdef USE_SKINNING 2128 mat4 skinMatrix = mat4( 0.0 ); 2129 skinMatrix += skinWeight.x * boneMatX; 2130 skinMatrix += skinWeight.y * boneMatY; 2131 skinMatrix += skinWeight.z * boneMatZ; 2132 skinMatrix += skinWeight.w * boneMatW; 2133 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2134 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2135 #ifdef USE_TANGENT 2136 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2137 #endif 2138#endif`,specularmap_fragment:`float specularStrength; 2139#ifdef USE_SPECULARMAP 2140 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2141 specularStrength = texelSpecular.r; 2142#else 2143 specularStrength = 1.0; 2144#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP 2145 uniform sampler2D specularMap; 2146#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) 2147 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2148#endif`,tonemapping_pars_fragment:`#ifndef saturate 2149#define saturate( a ) clamp( a, 0.0, 1.0 ) 2150#endif 2151uniform float toneMappingExposure; 2152vec3 LinearToneMapping( vec3 color ) { 2153 return saturate( toneMappingExposure * color ); 2154} 2155vec3 ReinhardToneMapping( vec3 color ) { 2156 color *= toneMappingExposure; 2157 return saturate( color / ( vec3( 1.0 ) + color ) ); 2158} 2159vec3 CineonToneMapping( vec3 color ) { 2160 color *= toneMappingExposure; 2161 color = max( vec3( 0.0 ), color - 0.004 ); 2162 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2163} 2164vec3 RRTAndODTFit( vec3 v ) { 2165 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2166 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2167 return a / b; 2168} 2169vec3 ACESFilmicToneMapping( vec3 color ) { 2170 const mat3 ACESInputMat = mat3( 2171 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2172 vec3( 0.04823, 0.01566, 0.83777 ) 2173 ); 2174 const mat3 ACESOutputMat = mat3( 2175 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2176 vec3( -0.07367, -0.00605, 1.07602 ) 2177 ); 2178 color *= toneMappingExposure / 0.6; 2179 color = ACESInputMat * color; 2180 color = RRTAndODTFit( color ); 2181 color = ACESOutputMat * color; 2182 return saturate( color ); 2183} 2184const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2185 vec3( 1.6605, - 0.1246, - 0.0182 ), 2186 vec3( - 0.5876, 1.1329, - 0.1006 ), 2187 vec3( - 0.0728, - 0.0083, 1.1187 ) 2188); 2189const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2190 vec3( 0.6274, 0.0691, 0.0164 ), 2191 vec3( 0.3293, 0.9195, 0.0880 ), 2192 vec3( 0.0433, 0.0113, 0.8956 ) 2193); 2194vec3 agxDefaultContrastApprox( vec3 x ) { 2195 vec3 x2 = x * x; 2196 vec3 x4 = x2 * x2; 2197 return + 15.5 * x4 * x2 2198 - 40.14 * x4 * x 2199 + 31.96 * x4 2200 - 6.868 * x2 * x 2201 + 0.4298 * x2 2202 + 0.1191 * x 2203 - 0.00232; 2204} 2205vec3 AgXToneMapping( vec3 color ) { 2206 const mat3 AgXInsetMatrix = mat3( 2207 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2208 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2209 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2210 ); 2211 const mat3 AgXOutsetMatrix = mat3( 2212 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2213 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2214 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2215 ); 2216 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2217 color *= toneMappingExposure; 2218 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2219 color = AgXInsetMatrix * color; 2220 color = max( color, 1e-10 ); color = log2( color ); 2221 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2222 color = clamp( color, 0.0, 1.0 ); 2223 color = agxDefaultContrastApprox( color ); 2224 color = AgXOutsetMatrix * color; 2225 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2226 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2227 color = clamp( color, 0.0, 1.0 ); 2228 return color; 2229} 2230vec3 NeutralToneMapping( vec3 color ) { 2231 const float StartCompression = 0.8 - 0.04; 2232 const float Desaturation = 0.15; 2233 color *= toneMappingExposure; 2234 float x = min( color.r, min( color.g, color.b ) ); 2235 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2236 color -= offset; 2237 float peak = max( color.r, max( color.g, color.b ) ); 2238 if ( peak < StartCompression ) return color; 2239 float d = 1. - StartCompression; 2240 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2241 color *= newPeak / peak; 2242 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2243 return mix( color, vec3( newPeak ), g ); 2244} 2245vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION 2246 material.transmission = transmission; 2247 material.transmissionAlpha = 1.0; 2248 material.thickness = thickness; 2249 material.attenuationDistance = attenuationDistance; 2250 material.attenuationColor = attenuationColor; 2251 #ifdef USE_TRANSMISSIONMAP 2252 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2253 #endif 2254 #ifdef USE_THICKNESSMAP 2255 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2256 #endif 2257 vec3 pos = vWorldPosition; 2258 vec3 v = normalize( cameraPosition - pos ); 2259 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2260 vec4 transmitted = getIBLVolumeRefraction( 2261 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2262 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2263 material.attenuationColor, material.attenuationDistance ); 2264 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2265 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2266#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION 2267 uniform float transmission; 2268 uniform float thickness; 2269 uniform float attenuationDistance; 2270 uniform vec3 attenuationColor; 2271 #ifdef USE_TRANSMISSIONMAP 2272 uniform sampler2D transmissionMap; 2273 #endif 2274 #ifdef USE_THICKNESSMAP 2275 uniform sampler2D thicknessMap; 2276 #endif 2277 uniform vec2 transmissionSamplerSize; 2278 uniform sampler2D transmissionSamplerMap; 2279 uniform mat4 modelMatrix; 2280 uniform mat4 projectionMatrix; 2281 varying vec3 vWorldPosition; 2282 float w0( float a ) { 2283 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2284 } 2285 float w1( float a ) { 2286 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2287 } 2288 float w2( float a ){ 2289 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2290 } 2291 float w3( float a ) { 2292 return ( 1.0 / 6.0 ) * ( a * a * a ); 2293 } 2294 float g0( float a ) { 2295 return w0( a ) + w1( a ); 2296 } 2297 float g1( float a ) { 2298 return w2( a ) + w3( a ); 2299 } 2300 float h0( float a ) { 2301 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2302 } 2303 float h1( float a ) { 2304 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2305 } 2306 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2307 uv = uv * texelSize.zw + 0.5; 2308 vec2 iuv = floor( uv ); 2309 vec2 fuv = fract( uv ); 2310 float g0x = g0( fuv.x ); 2311 float g1x = g1( fuv.x ); 2312 float h0x = h0( fuv.x ); 2313 float h1x = h1( fuv.x ); 2314 float h0y = h0( fuv.y ); 2315 float h1y = h1( fuv.y ); 2316 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2317 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2318 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2319 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2320 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2321 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2322 } 2323 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2324 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2325 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2326 vec2 fLodSizeInv = 1.0 / fLodSize; 2327 vec2 cLodSizeInv = 1.0 / cLodSize; 2328 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2329 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2330 return mix( fSample, cSample, fract( lod ) ); 2331 } 2332 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2333 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2334 vec3 modelScale; 2335 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2336 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2337 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2338 return normalize( refractionVector ) * thickness * modelScale; 2339 } 2340 float applyIorToRoughness( const in float roughness, const in float ior ) { 2341 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2342 } 2343 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2344 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2345 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2346 } 2347 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2348 if ( isinf( attenuationDistance ) ) { 2349 return vec3( 1.0 ); 2350 } else { 2351 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2352 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2353 } 2354 } 2355 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2356 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2357 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2358 const in vec3 attenuationColor, const in float attenuationDistance ) { 2359 vec4 transmittedLight; 2360 vec3 transmittance; 2361 #ifdef USE_DISPERSION 2362 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2363 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2364 for ( int i = 0; i < 3; i ++ ) { 2365 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2366 vec3 refractedRayExit = position + transmissionRay; 2367 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2368 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2369 refractionCoords += 1.0; 2370 refractionCoords /= 2.0; 2371 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2372 transmittedLight[ i ] = transmissionSample[ i ]; 2373 transmittedLight.a += transmissionSample.a; 2374 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2375 } 2376 transmittedLight.a /= 3.0; 2377 #else 2378 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2379 vec3 refractedRayExit = position + transmissionRay; 2380 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2381 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2382 refractionCoords += 1.0; 2383 refractionCoords /= 2.0; 2384 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2385 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2386 #endif 2387 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2388 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2389 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2390 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2391 } 2392#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2393 varying vec2 vUv; 2394#endif 2395#ifdef USE_MAP 2396 varying vec2 vMapUv; 2397#endif 2398#ifdef USE_ALPHAMAP 2399 varying vec2 vAlphaMapUv; 2400#endif 2401#ifdef USE_LIGHTMAP 2402 varying vec2 vLightMapUv; 2403#endif 2404#ifdef USE_AOMAP 2405 varying vec2 vAoMapUv; 2406#endif 2407#ifdef USE_BUMPMAP 2408 varying vec2 vBumpMapUv; 2409#endif 2410#ifdef USE_NORMALMAP 2411 varying vec2 vNormalMapUv; 2412#endif 2413#ifdef USE_EMISSIVEMAP 2414 varying vec2 vEmissiveMapUv; 2415#endif 2416#ifdef USE_METALNESSMAP 2417 varying vec2 vMetalnessMapUv; 2418#endif 2419#ifdef USE_ROUGHNESSMAP 2420 varying vec2 vRoughnessMapUv; 2421#endif 2422#ifdef USE_ANISOTROPYMAP 2423 varying vec2 vAnisotropyMapUv; 2424#endif 2425#ifdef USE_CLEARCOATMAP 2426 varying vec2 vClearcoatMapUv; 2427#endif 2428#ifdef USE_CLEARCOAT_NORMALMAP 2429 varying vec2 vClearcoatNormalMapUv; 2430#endif 2431#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2432 varying vec2 vClearcoatRoughnessMapUv; 2433#endif 2434#ifdef USE_IRIDESCENCEMAP 2435 varying vec2 vIridescenceMapUv; 2436#endif 2437#ifdef USE_IRIDESCENCE_THICKNESSMAP 2438 varying vec2 vIridescenceThicknessMapUv; 2439#endif 2440#ifdef USE_SHEEN_COLORMAP 2441 varying vec2 vSheenColorMapUv; 2442#endif 2443#ifdef USE_SHEEN_ROUGHNESSMAP 2444 varying vec2 vSheenRoughnessMapUv; 2445#endif 2446#ifdef USE_SPECULARMAP 2447 varying vec2 vSpecularMapUv; 2448#endif 2449#ifdef USE_SPECULAR_COLORMAP 2450 varying vec2 vSpecularColorMapUv; 2451#endif 2452#ifdef USE_SPECULAR_INTENSITYMAP 2453 varying vec2 vSpecularIntensityMapUv; 2454#endif 2455#ifdef USE_TRANSMISSIONMAP 2456 uniform mat3 transmissionMapTransform; 2457 varying vec2 vTransmissionMapUv; 2458#endif 2459#ifdef USE_THICKNESSMAP 2460 uniform mat3 thicknessMapTransform; 2461 varying vec2 vThicknessMapUv; 2462#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2463 varying vec2 vUv; 2464#endif 2465#ifdef USE_MAP 2466 uniform mat3 mapTransform; 2467 varying vec2 vMapUv; 2468#endif 2469#ifdef USE_ALPHAMAP 2470 uniform mat3 alphaMapTransform; 2471 varying vec2 vAlphaMapUv; 2472#endif 2473#ifdef USE_LIGHTMAP 2474 uniform mat3 lightMapTransform; 2475 varying vec2 vLightMapUv; 2476#endif 2477#ifdef USE_AOMAP 2478 uniform mat3 aoMapTransform; 2479 varying vec2 vAoMapUv; 2480#endif 2481#ifdef USE_BUMPMAP 2482 uniform mat3 bumpMapTransform; 2483 varying vec2 vBumpMapUv; 2484#endif 2485#ifdef USE_NORMALMAP 2486 uniform mat3 normalMapTransform; 2487 varying vec2 vNormalMapUv; 2488#endif 2489#ifdef USE_DISPLACEMENTMAP 2490 uniform mat3 displacementMapTransform; 2491 varying vec2 vDisplacementMapUv; 2492#endif 2493#ifdef USE_EMISSIVEMAP 2494 uniform mat3 emissiveMapTransform; 2495 varying vec2 vEmissiveMapUv; 2496#endif 2497#ifdef USE_METALNESSMAP 2498 uniform mat3 metalnessMapTransform; 2499 varying vec2 vMetalnessMapUv; 2500#endif 2501#ifdef USE_ROUGHNESSMAP 2502 uniform mat3 roughnessMapTransform; 2503 varying vec2 vRoughnessMapUv; 2504#endif 2505#ifdef USE_ANISOTROPYMAP 2506 uniform mat3 anisotropyMapTransform; 2507 varying vec2 vAnisotropyMapUv; 2508#endif 2509#ifdef USE_CLEARCOATMAP 2510 uniform mat3 clearcoatMapTransform; 2511 varying vec2 vClearcoatMapUv; 2512#endif 2513#ifdef USE_CLEARCOAT_NORMALMAP 2514 uniform mat3 clearcoatNormalMapTransform; 2515 varying vec2 vClearcoatNormalMapUv; 2516#endif 2517#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2518 uniform mat3 clearcoatRoughnessMapTransform; 2519 varying vec2 vClearcoatRoughnessMapUv; 2520#endif 2521#ifdef USE_SHEEN_COLORMAP 2522 uniform mat3 sheenColorMapTransform; 2523 varying vec2 vSheenColorMapUv; 2524#endif 2525#ifdef USE_SHEEN_ROUGHNESSMAP 2526 uniform mat3 sheenRoughnessMapTransform; 2527 varying vec2 vSheenRoughnessMapUv; 2528#endif 2529#ifdef USE_IRIDESCENCEMAP 2530 uniform mat3 iridescenceMapTransform; 2531 varying vec2 vIridescenceMapUv; 2532#endif 2533#ifdef USE_IRIDESCENCE_THICKNESSMAP 2534 uniform mat3 iridescenceThicknessMapTransform; 2535 varying vec2 vIridescenceThicknessMapUv; 2536#endif 2537#ifdef USE_SPECULARMAP 2538 uniform mat3 specularMapTransform; 2539 varying vec2 vSpecularMapUv; 2540#endif 2541#ifdef USE_SPECULAR_COLORMAP 2542 uniform mat3 specularColorMapTransform; 2543 varying vec2 vSpecularColorMapUv; 2544#endif 2545#ifdef USE_SPECULAR_INTENSITYMAP 2546 uniform mat3 specularIntensityMapTransform; 2547 varying vec2 vSpecularIntensityMapUv; 2548#endif 2549#ifdef USE_TRANSMISSIONMAP 2550 uniform mat3 transmissionMapTransform; 2551 varying vec2 vTransmissionMapUv; 2552#endif 2553#ifdef USE_THICKNESSMAP 2554 uniform mat3 thicknessMapTransform; 2555 varying vec2 vThicknessMapUv; 2556#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2557 vUv = vec3( uv, 1 ).xy; 2558#endif 2559#ifdef USE_MAP 2560 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2561#endif 2562#ifdef USE_ALPHAMAP 2563 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2564#endif 2565#ifdef USE_LIGHTMAP 2566 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2567#endif 2568#ifdef USE_AOMAP 2569 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2570#endif 2571#ifdef USE_BUMPMAP 2572 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2573#endif 2574#ifdef USE_NORMALMAP 2575 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2576#endif 2577#ifdef USE_DISPLACEMENTMAP 2578 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2579#endif 2580#ifdef USE_EMISSIVEMAP 2581 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2582#endif 2583#ifdef USE_METALNESSMAP 2584 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2585#endif 2586#ifdef USE_ROUGHNESSMAP 2587 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2588#endif 2589#ifdef USE_ANISOTROPYMAP 2590 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2591#endif 2592#ifdef USE_CLEARCOATMAP 2593 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2594#endif 2595#ifdef USE_CLEARCOAT_NORMALMAP 2596 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2597#endif 2598#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2599 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2600#endif 2601#ifdef USE_IRIDESCENCEMAP 2602 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2603#endif 2604#ifdef USE_IRIDESCENCE_THICKNESSMAP 2605 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2606#endif 2607#ifdef USE_SHEEN_COLORMAP 2608 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2609#endif 2610#ifdef USE_SHEEN_ROUGHNESSMAP 2611 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2612#endif 2613#ifdef USE_SPECULARMAP 2614 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2615#endif 2616#ifdef USE_SPECULAR_COLORMAP 2617 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2618#endif 2619#ifdef USE_SPECULAR_INTENSITYMAP 2620 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2621#endif 2622#ifdef USE_TRANSMISSIONMAP 2623 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2624#endif 2625#ifdef USE_THICKNESSMAP 2626 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2627#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2628 vec4 worldPosition = vec4( transformed, 1.0 ); 2629 #ifdef USE_BATCHING 2630 worldPosition = batchingMatrix * worldPosition; 2631 #endif 2632 #ifdef USE_INSTANCING 2633 worldPosition = instanceMatrix * worldPosition; 2634 #endif 2635 worldPosition = modelMatrix * worldPosition; 2636#endif`,background_vert:`varying vec2 vUv; 2637uniform mat3 uvTransform; 2638void main() { 2639 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2640 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2641}`,background_frag:`uniform sampler2D t2D; 2642uniform float backgroundIntensity; 2643varying vec2 vUv; 2644void main() { 2645 vec4 texColor = texture2D( t2D, vUv ); 2646 #ifdef DECODE_VIDEO_TEXTURE 2647 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 ); 2648 #endif 2649 texColor.rgb *= backgroundIntensity; 2650 gl_FragColor = texColor; 2651 #include <tonemapping_fragment> 2652 #include <colorspace_fragment> 2653}`,backgroundCube_vert:`varying vec3 vWorldDirection; 2654#include <common> 2655void main() { 2656 vWorldDirection = transformDirection( position, modelMatrix ); 2657 #include <begin_vertex> 2658 #include <project_vertex> 2659 gl_Position.z = gl_Position.w; 2660}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE 2661 uniform samplerCube envMap; 2662#elif defined( ENVMAP_TYPE_CUBE_UV ) 2663 uniform sampler2D envMap; 2664#endif 2665uniform float flipEnvMap; 2666uniform float backgroundBlurriness; 2667uniform float backgroundIntensity; 2668uniform mat3 backgroundRotation; 2669varying vec3 vWorldDirection; 2670#include <cube_uv_reflection_fragment> 2671void main() { 2672 #ifdef ENVMAP_TYPE_CUBE 2673 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2674 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2675 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2676 #else 2677 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2678 #endif 2679 texColor.rgb *= backgroundIntensity; 2680 gl_FragColor = texColor; 2681 #include <tonemapping_fragment> 2682 #include <colorspace_fragment> 2683}`,cube_vert:`varying vec3 vWorldDirection; 2684#include <common> 2685void main() { 2686 vWorldDirection = transformDirection( position, modelMatrix ); 2687 #include <begin_vertex> 2688 #include <project_vertex> 2689 gl_Position.z = gl_Position.w; 2690}`,cube_frag:`uniform samplerCube tCube; 2691uniform float tFlip; 2692uniform float opacity; 2693varying vec3 vWorldDirection; 2694void main() { 2695 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2696 gl_FragColor = texColor; 2697 gl_FragColor.a *= opacity; 2698 #include <tonemapping_fragment> 2699 #include <colorspace_fragment> 2700}`,depth_vert:`#include <common> 2701#include <batching_pars_vertex> 2702#include <uv_pars_vertex> 2703#include <displacementmap_pars_vertex> 2704#include <morphtarget_pars_vertex> 2705#include <skinning_pars_vertex> 2706#include <logdepthbuf_pars_vertex> 2707#include <clipping_planes_pars_vertex> 2708varying vec2 vHighPrecisionZW; 2709void main() { 2710 #include <uv_vertex> 2711 #include <batching_vertex> 2712 #include <skinbase_vertex> 2713 #include <morphinstance_vertex> 2714 #ifdef USE_DISPLACEMENTMAP 2715 #include <beginnormal_vertex> 2716 #include <morphnormal_vertex> 2717 #include <skinnormal_vertex> 2718 #endif 2719 #include <begin_vertex> 2720 #include <morphtarget_vertex> 2721 #include <skinning_vertex> 2722 #include <displacementmap_vertex> 2723 #include <project_vertex> 2724 #include <logdepthbuf_vertex> 2725 #include <clipping_planes_vertex> 2726 vHighPrecisionZW = gl_Position.zw; 2727}`,depth_frag:`#if DEPTH_PACKING == 3200 2728 uniform float opacity; 2729#endif 2730#include <common> 2731#include <packing> 2732#include <uv_pars_fragment> 2733#include <map_pars_fragment> 2734#include <alphamap_pars_fragment> 2735#include <alphatest_pars_fragment> 2736#include <alphahash_pars_fragment> 2737#include <logdepthbuf_pars_fragment> 2738#include <clipping_planes_pars_fragment> 2739varying vec2 vHighPrecisionZW; 2740void main() { 2741 vec4 diffuseColor = vec4( 1.0 ); 2742 #include <clipping_planes_fragment> 2743 #if DEPTH_PACKING == 3200 2744 diffuseColor.a = opacity; 2745 #endif 2746 #include <map_fragment> 2747 #include <alphamap_fragment> 2748 #include <alphatest_fragment> 2749 #include <alphahash_fragment> 2750 #include <logdepthbuf_fragment> 2751 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2752 #if DEPTH_PACKING == 3200 2753 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2754 #elif DEPTH_PACKING == 3201 2755 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2756 #elif DEPTH_PACKING == 3202 2757 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2758 #elif DEPTH_PACKING == 3203 2759 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2760 #endif 2761}`,distanceRGBA_vert:`#define DISTANCE 2762varying vec3 vWorldPosition; 2763#include <common> 2764#include <batching_pars_vertex> 2765#include <uv_pars_vertex> 2766#include <displacementmap_pars_vertex> 2767#include <morphtarget_pars_vertex> 2768#include <skinning_pars_vertex> 2769#include <clipping_planes_pars_vertex> 2770void main() { 2771 #include <uv_vertex> 2772 #include <batching_vertex> 2773 #include <skinbase_vertex> 2774 #include <morphinstance_vertex> 2775 #ifdef USE_DISPLACEMENTMAP 2776 #include <beginnormal_vertex> 2777 #include <morphnormal_vertex> 2778 #include <skinnormal_vertex> 2779 #endif 2780 #include <begin_vertex> 2781 #include <morphtarget_vertex> 2782 #include <skinning_vertex> 2783 #include <displacementmap_vertex> 2784 #include <project_vertex> 2785 #include <worldpos_vertex> 2786 #include <clipping_planes_vertex> 2787 vWorldPosition = worldPosition.xyz; 2788}`,distanceRGBA_frag:`#define DISTANCE 2789uniform vec3 referencePosition; 2790uniform float nearDistance; 2791uniform float farDistance; 2792varying vec3 vWorldPosition; 2793#include <common> 2794#include <packing> 2795#include <uv_pars_fragment> 2796#include <map_pars_fragment> 2797#include <alphamap_pars_fragment> 2798#include <alphatest_pars_fragment> 2799#include <alphahash_pars_fragment> 2800#include <clipping_planes_pars_fragment> 2801void main () { 2802 vec4 diffuseColor = vec4( 1.0 ); 2803 #include <clipping_planes_fragment> 2804 #include <map_fragment> 2805 #include <alphamap_fragment> 2806 #include <alphatest_fragment> 2807 #include <alphahash_fragment> 2808 float dist = length( vWorldPosition - referencePosition ); 2809 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2810 dist = saturate( dist ); 2811 gl_FragColor = packDepthToRGBA( dist ); 2812}`,equirect_vert:`varying vec3 vWorldDirection; 2813#include <common> 2814void main() { 2815 vWorldDirection = transformDirection( position, modelMatrix ); 2816 #include <begin_vertex> 2817 #include <project_vertex> 2818}`,equirect_frag:`uniform sampler2D tEquirect; 2819varying vec3 vWorldDirection; 2820#include <common> 2821void main() { 2822 vec3 direction = normalize( vWorldDirection ); 2823 vec2 sampleUV = equirectUv( direction ); 2824 gl_FragColor = texture2D( tEquirect, sampleUV ); 2825 #include <tonemapping_fragment> 2826 #include <colorspace_fragment> 2827}`,linedashed_vert:`uniform float scale; 2828attribute float lineDistance; 2829varying float vLineDistance; 2830#include <common> 2831#include <uv_pars_vertex> 2832#include <color_pars_vertex> 2833#include <fog_pars_vertex> 2834#include <morphtarget_pars_vertex> 2835#include <logdepthbuf_pars_vertex> 2836#include <clipping_planes_pars_vertex> 2837void main() { 2838 vLineDistance = scale * lineDistance; 2839 #include <uv_vertex> 2840 #include <color_vertex> 2841 #include <morphinstance_vertex> 2842 #include <morphcolor_vertex> 2843 #include <begin_vertex> 2844 #include <morphtarget_vertex> 2845 #include <project_vertex> 2846 #include <logdepthbuf_vertex> 2847 #include <clipping_planes_vertex> 2848 #include <fog_vertex> 2849}`,linedashed_frag:`uniform vec3 diffuse; 2850uniform float opacity; 2851uniform float dashSize; 2852uniform float totalSize; 2853varying float vLineDistance; 2854#include <common> 2855#include <color_pars_fragment> 2856#include <uv_pars_fragment> 2857#include <map_pars_fragment> 2858#include <fog_pars_fragment> 2859#include <logdepthbuf_pars_fragment> 2860#include <clipping_planes_pars_fragment> 2861void main() { 2862 vec4 diffuseColor = vec4( diffuse, opacity ); 2863 #include <clipping_planes_fragment> 2864 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2865 discard; 2866 } 2867 vec3 outgoingLight = vec3( 0.0 ); 2868 #include <logdepthbuf_fragment> 2869 #include <map_fragment> 2870 #include <color_fragment> 2871 outgoingLight = diffuseColor.rgb; 2872 #include <opaque_fragment> 2873 #include <tonemapping_fragment> 2874 #include <colorspace_fragment> 2875 #include <fog_fragment> 2876 #include <premultiplied_alpha_fragment> 2877}`,meshbasic_vert:`#include <common> 2878#include <batching_pars_vertex> 2879#include <uv_pars_vertex> 2880#include <envmap_pars_vertex> 2881#include <color_pars_vertex> 2882#include <fog_pars_vertex> 2883#include <morphtarget_pars_vertex> 2884#include <skinning_pars_vertex> 2885#include <logdepthbuf_pars_vertex> 2886#include <clipping_planes_pars_vertex> 2887void main() { 2888 #include <uv_vertex> 2889 #include <color_vertex> 2890 #include <morphinstance_vertex> 2891 #include <morphcolor_vertex> 2892 #include <batching_vertex> 2893 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2894 #include <beginnormal_vertex> 2895 #include <morphnormal_vertex> 2896 #include <skinbase_vertex> 2897 #include <skinnormal_vertex> 2898 #include <defaultnormal_vertex> 2899 #endif 2900 #include <begin_vertex> 2901 #include <morphtarget_vertex> 2902 #include <skinning_vertex> 2903 #include <project_vertex> 2904 #include <logdepthbuf_vertex> 2905 #include <clipping_planes_vertex> 2906 #include <worldpos_vertex> 2907 #include <envmap_vertex> 2908 #include <fog_vertex> 2909}`,meshbasic_frag:`uniform vec3 diffuse; 2910uniform float opacity; 2911#ifndef FLAT_SHADED 2912 varying vec3 vNormal; 2913#endif 2914#include <common> 2915#include <dithering_pars_fragment> 2916#include <color_pars_fragment> 2917#include <uv_pars_fragment> 2918#include <map_pars_fragment> 2919#include <alphamap_pars_fragment> 2920#include <alphatest_pars_fragment> 2921#include <alphahash_pars_fragment> 2922#include <aomap_pars_fragment> 2923#include <lightmap_pars_fragment> 2924#include <envmap_common_pars_fragment> 2925#include <envmap_pars_fragment> 2926#include <fog_pars_fragment> 2927#include <specularmap_pars_fragment> 2928#include <logdepthbuf_pars_fragment> 2929#include <clipping_planes_pars_fragment> 2930void main() { 2931 vec4 diffuseColor = vec4( diffuse, opacity ); 2932 #include <clipping_planes_fragment> 2933 #include <logdepthbuf_fragment> 2934 #include <map_fragment> 2935 #include <color_fragment> 2936 #include <alphamap_fragment> 2937 #include <alphatest_fragment> 2938 #include <alphahash_fragment> 2939 #include <specularmap_fragment> 2940 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2941 #ifdef USE_LIGHTMAP 2942 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2943 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2944 #else 2945 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2946 #endif 2947 #include <aomap_fragment> 2948 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2949 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2950 #include <envmap_fragment> 2951 #include <opaque_fragment> 2952 #include <tonemapping_fragment> 2953 #include <colorspace_fragment> 2954 #include <fog_fragment> 2955 #include <premultiplied_alpha_fragment> 2956 #include <dithering_fragment> 2957}`,meshlambert_vert:`#define LAMBERT 2958varying vec3 vViewPosition; 2959#include <common> 2960#include <batching_pars_vertex> 2961#include <uv_pars_vertex> 2962#include <displacementmap_pars_vertex> 2963#include <envmap_pars_vertex> 2964#include <color_pars_vertex> 2965#include <fog_pars_vertex> 2966#include <normal_pars_vertex> 2967#include <morphtarget_pars_vertex> 2968#include <skinning_pars_vertex> 2969#include <shadowmap_pars_vertex> 2970#include <logdepthbuf_pars_vertex> 2971#include <clipping_planes_pars_vertex> 2972void main() { 2973 #include <uv_vertex> 2974 #include <color_vertex> 2975 #include <morphinstance_vertex> 2976 #include <morphcolor_vertex> 2977 #include <batching_vertex> 2978 #include <beginnormal_vertex> 2979 #include <morphnormal_vertex> 2980 #include <skinbase_vertex> 2981 #include <skinnormal_vertex> 2982 #include <defaultnormal_vertex> 2983 #include <normal_vertex> 2984 #include <begin_vertex> 2985 #include <morphtarget_vertex> 2986 #include <skinning_vertex> 2987 #include <displacementmap_vertex> 2988 #include <project_vertex> 2989 #include <logdepthbuf_vertex> 2990 #include <clipping_planes_vertex> 2991 vViewPosition = - mvPosition.xyz; 2992 #include <worldpos_vertex> 2993 #include <envmap_vertex> 2994 #include <shadowmap_vertex> 2995 #include <fog_vertex> 2996}`,meshlambert_frag:`#define LAMBERT 2997uniform vec3 diffuse; 2998uniform vec3 emissive; 2999uniform float opacity; 3000#include <common> 3001#include <packing> 3002#include <dithering_pars_fragment> 3003#include <color_pars_fragment> 3004#include <uv_pars_fragment> 3005#include <map_pars_fragment> 3006#include <alphamap_pars_fragment> 3007#include <alphatest_pars_fragment> 3008#include <alphahash_pars_fragment> 3009#include <aomap_pars_fragment> 3010#include <lightmap_pars_fragment> 3011#include <emissivemap_pars_fragment> 3012#include <envmap_common_pars_fragment> 3013#include <envmap_pars_fragment> 3014#include <fog_pars_fragment> 3015#include <bsdfs> 3016#include <lights_pars_begin> 3017#include <normal_pars_fragment> 3018#include <lights_lambert_pars_fragment> 3019#include <shadowmap_pars_fragment> 3020#include <bumpmap_pars_fragment> 3021#include <normalmap_pars_fragment> 3022#include <specularmap_pars_fragment> 3023#include <logdepthbuf_pars_fragment> 3024#include <clipping_planes_pars_fragment> 3025void main() { 3026 vec4 diffuseColor = vec4( diffuse, opacity ); 3027 #include <clipping_planes_fragment> 3028 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3029 vec3 totalEmissiveRadiance = emissive; 3030 #include <logdepthbuf_fragment> 3031 #include <map_fragment> 3032 #include <color_fragment> 3033 #include <alphamap_fragment> 3034 #include <alphatest_fragment> 3035 #include <alphahash_fragment> 3036 #include <specularmap_fragment> 3037 #include <normal_fragment_begin> 3038 #include <normal_fragment_maps> 3039 #include <emissivemap_fragment> 3040 #include <lights_lambert_fragment> 3041 #include <lights_fragment_begin> 3042 #include <lights_fragment_maps> 3043 #include <lights_fragment_end> 3044 #include <aomap_fragment> 3045 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3046 #include <envmap_fragment> 3047 #include <opaque_fragment> 3048 #include <tonemapping_fragment> 3049 #include <colorspace_fragment> 3050 #include <fog_fragment> 3051 #include <premultiplied_alpha_fragment> 3052 #include <dithering_fragment> 3053}`,meshmatcap_vert:`#define MATCAP 3054varying vec3 vViewPosition; 3055#include <common> 3056#include <batching_pars_vertex> 3057#include <uv_pars_vertex> 3058#include <color_pars_vertex> 3059#include <displacementmap_pars_vertex> 3060#include <fog_pars_vertex> 3061#include <normal_pars_vertex> 3062#include <morphtarget_pars_vertex> 3063#include <skinning_pars_vertex> 3064#include <logdepthbuf_pars_vertex> 3065#include <clipping_planes_pars_vertex> 3066void main() { 3067 #include <uv_vertex> 3068 #include <color_vertex> 3069 #include <morphinstance_vertex> 3070 #include <morphcolor_vertex> 3071 #include <batching_vertex> 3072 #include <beginnormal_vertex> 3073 #include <morphnormal_vertex> 3074 #include <skinbase_vertex> 3075 #include <skinnormal_vertex> 3076 #include <defaultnormal_vertex> 3077 #include <normal_vertex> 3078 #include <begin_vertex> 3079 #include <morphtarget_vertex> 3080 #include <skinning_vertex> 3081 #include <displacementmap_vertex> 3082 #include <project_vertex> 3083 #include <logdepthbuf_vertex> 3084 #include <clipping_planes_vertex> 3085 #include <fog_vertex> 3086 vViewPosition = - mvPosition.xyz; 3087}`,meshmatcap_frag:`#define MATCAP 3088uniform vec3 diffuse; 3089uniform float opacity; 3090uniform sampler2D matcap; 3091varying vec3 vViewPosition; 3092#include <common> 3093#include <dithering_pars_fragment> 3094#include <color_pars_fragment> 3095#include <uv_pars_fragment> 3096#include <map_pars_fragment> 3097#include <alphamap_pars_fragment> 3098#include <alphatest_pars_fragment> 3099#include <alphahash_pars_fragment> 3100#include <fog_pars_fragment> 3101#include <normal_pars_fragment> 3102#include <bumpmap_pars_fragment> 3103#include <normalmap_pars_fragment> 3104#include <logdepthbuf_pars_fragment> 3105#include <clipping_planes_pars_fragment> 3106void main() { 3107 vec4 diffuseColor = vec4( diffuse, opacity ); 3108 #include <clipping_planes_fragment> 3109 #include <logdepthbuf_fragment> 3110 #include <map_fragment> 3111 #include <color_fragment> 3112 #include <alphamap_fragment> 3113 #include <alphatest_fragment> 3114 #include <alphahash_fragment> 3115 #include <normal_fragment_begin> 3116 #include <normal_fragment_maps> 3117 vec3 viewDir = normalize( vViewPosition ); 3118 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3119 vec3 y = cross( viewDir, x ); 3120 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3121 #ifdef USE_MATCAP 3122 vec4 matcapColor = texture2D( matcap, uv ); 3123 #else 3124 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3125 #endif 3126 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3127 #include <opaque_fragment> 3128 #include <tonemapping_fragment> 3129 #include <colorspace_fragment> 3130 #include <fog_fragment> 3131 #include <premultiplied_alpha_fragment> 3132 #include <dithering_fragment> 3133}`,meshnormal_vert:`#define NORMAL 3134#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3135 varying vec3 vViewPosition; 3136#endif 3137#include <common> 3138#include <batching_pars_vertex> 3139#include <uv_pars_vertex> 3140#include <displacementmap_pars_vertex> 3141#include <normal_pars_vertex> 3142#include <morphtarget_pars_vertex> 3143#include <skinning_pars_vertex> 3144#include <logdepthbuf_pars_vertex> 3145#include <clipping_planes_pars_vertex> 3146void main() { 3147 #include <uv_vertex> 3148 #include <batching_vertex> 3149 #include <beginnormal_vertex> 3150 #include <morphinstance_vertex> 3151 #include <morphnormal_vertex> 3152 #include <skinbase_vertex> 3153 #include <skinnormal_vertex> 3154 #include <defaultnormal_vertex> 3155 #include <normal_vertex> 3156 #include <begin_vertex> 3157 #include <morphtarget_vertex> 3158 #include <skinning_vertex> 3159 #include <displacementmap_vertex> 3160 #include <project_vertex> 3161 #include <logdepthbuf_vertex> 3162 #include <clipping_planes_vertex> 3163#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3164 vViewPosition = - mvPosition.xyz; 3165#endif 3166}`,meshnormal_frag:`#define NORMAL 3167uniform float opacity; 3168#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3169 varying vec3 vViewPosition; 3170#endif 3171#include <packing> 3172#include <uv_pars_fragment> 3173#include <normal_pars_fragment> 3174#include <bumpmap_pars_fragment> 3175#include <normalmap_pars_fragment> 3176#include <logdepthbuf_pars_fragment> 3177#include <clipping_planes_pars_fragment> 3178void main() { 3179 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3180 #include <clipping_planes_fragment> 3181 #include <logdepthbuf_fragment> 3182 #include <normal_fragment_begin> 3183 #include <normal_fragment_maps> 3184 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3185 #ifdef OPAQUE 3186 gl_FragColor.a = 1.0; 3187 #endif 3188}`,meshphong_vert:`#define PHONG 3189varying vec3 vViewPosition; 3190#include <common> 3191#include <batching_pars_vertex> 3192#include <uv_pars_vertex> 3193#include <displacementmap_pars_vertex> 3194#include <envmap_pars_vertex> 3195#include <color_pars_vertex> 3196#include <fog_pars_vertex> 3197#include <normal_pars_vertex> 3198#include <morphtarget_pars_vertex> 3199#include <skinning_pars_vertex> 3200#include <shadowmap_pars_vertex> 3201#include <logdepthbuf_pars_vertex> 3202#include <clipping_planes_pars_vertex> 3203void main() { 3204 #include <uv_vertex> 3205 #include <color_vertex> 3206 #include <morphcolor_vertex> 3207 #include <batching_vertex> 3208 #include <beginnormal_vertex> 3209 #include <morphinstance_vertex> 3210 #include <morphnormal_vertex> 3211 #include <skinbase_vertex> 3212 #include <skinnormal_vertex> 3213 #include <defaultnormal_vertex> 3214 #include <normal_vertex> 3215 #include <begin_vertex> 3216 #include <morphtarget_vertex> 3217 #include <skinning_vertex> 3218 #include <displacementmap_vertex> 3219 #include <project_vertex> 3220 #include <logdepthbuf_vertex> 3221 #include <clipping_planes_vertex> 3222 vViewPosition = - mvPosition.xyz; 3223 #include <worldpos_vertex> 3224 #include <envmap_vertex> 3225 #include <shadowmap_vertex> 3226 #include <fog_vertex> 3227}`,meshphong_frag:`#define PHONG 3228uniform vec3 diffuse; 3229uniform vec3 emissive; 3230uniform vec3 specular; 3231uniform float shininess; 3232uniform float opacity; 3233#include <common> 3234#include <packing> 3235#include <dithering_pars_fragment> 3236#include <color_pars_fragment> 3237#include <uv_pars_fragment> 3238#include <map_pars_fragment> 3239#include <alphamap_pars_fragment> 3240#include <alphatest_pars_fragment> 3241#include <alphahash_pars_fragment> 3242#include <aomap_pars_fragment> 3243#include <lightmap_pars_fragment> 3244#include <emissivemap_pars_fragment> 3245#include <envmap_common_pars_fragment> 3246#include <envmap_pars_fragment> 3247#include <fog_pars_fragment> 3248#include <bsdfs> 3249#include <lights_pars_begin> 3250#include <normal_pars_fragment> 3251#include <lights_phong_pars_fragment> 3252#include <shadowmap_pars_fragment> 3253#include <bumpmap_pars_fragment> 3254#include <normalmap_pars_fragment> 3255#include <specularmap_pars_fragment> 3256#include <logdepthbuf_pars_fragment> 3257#include <clipping_planes_pars_fragment> 3258void main() { 3259 vec4 diffuseColor = vec4( diffuse, opacity ); 3260 #include <clipping_planes_fragment> 3261 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3262 vec3 totalEmissiveRadiance = emissive; 3263 #include <logdepthbuf_fragment> 3264 #include <map_fragment> 3265 #include <color_fragment> 3266 #include <alphamap_fragment> 3267 #include <alphatest_fragment> 3268 #include <alphahash_fragment> 3269 #include <specularmap_fragment> 3270 #include <normal_fragment_begin> 3271 #include <normal_fragment_maps> 3272 #include <emissivemap_fragment> 3273 #include <lights_phong_fragment> 3274 #include <lights_fragment_begin> 3275 #include <lights_fragment_maps> 3276 #include <lights_fragment_end> 3277 #include <aomap_fragment> 3278 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3279 #include <envmap_fragment> 3280 #include <opaque_fragment> 3281 #include <tonemapping_fragment> 3282 #include <colorspace_fragment> 3283 #include <fog_fragment> 3284 #include <premultiplied_alpha_fragment> 3285 #include <dithering_fragment> 3286}`,meshphysical_vert:`#define STANDARD 3287varying vec3 vViewPosition; 3288#ifdef USE_TRANSMISSION 3289 varying vec3 vWorldPosition; 3290#endif 3291#include <common> 3292#include <batching_pars_vertex> 3293#include <uv_pars_vertex> 3294#include <displacementmap_pars_vertex> 3295#include <color_pars_vertex> 3296#include <fog_pars_vertex> 3297#include <normal_pars_vertex> 3298#include <morphtarget_pars_vertex> 3299#include <skinning_pars_vertex> 3300#include <shadowmap_pars_vertex> 3301#include <logdepthbuf_pars_vertex> 3302#include <clipping_planes_pars_vertex> 3303void main() { 3304 #include <uv_vertex> 3305 #include <color_vertex> 3306 #include <morphinstance_vertex> 3307 #include <morphcolor_vertex> 3308 #include <batching_vertex> 3309 #include <beginnormal_vertex> 3310 #include <morphnormal_vertex> 3311 #include <skinbase_vertex> 3312 #include <skinnormal_vertex> 3313 #include <defaultnormal_vertex> 3314 #include <normal_vertex> 3315 #include <begin_vertex> 3316 #include <morphtarget_vertex> 3317 #include <skinning_vertex> 3318 #include <displacementmap_vertex> 3319 #include <project_vertex> 3320 #include <logdepthbuf_vertex> 3321 #include <clipping_planes_vertex> 3322 vViewPosition = - mvPosition.xyz; 3323 #include <worldpos_vertex> 3324 #include <shadowmap_vertex> 3325 #include <fog_vertex> 3326#ifdef USE_TRANSMISSION 3327 vWorldPosition = worldPosition.xyz; 3328#endif 3329}`,meshphysical_frag:`#define STANDARD 3330#ifdef PHYSICAL 3331 #define IOR 3332 #define USE_SPECULAR 3333#endif 3334uniform vec3 diffuse; 3335uniform vec3 emissive; 3336uniform float roughness; 3337uniform float metalness; 3338uniform float opacity; 3339#ifdef IOR 3340 uniform float ior; 3341#endif 3342#ifdef USE_SPECULAR 3343 uniform float specularIntensity; 3344 uniform vec3 specularColor; 3345 #ifdef USE_SPECULAR_COLORMAP 3346 uniform sampler2D specularColorMap; 3347 #endif 3348 #ifdef USE_SPECULAR_INTENSITYMAP 3349 uniform sampler2D specularIntensityMap; 3350 #endif 3351#endif 3352#ifdef USE_CLEARCOAT 3353 uniform float clearcoat; 3354 uniform float clearcoatRoughness; 3355#endif 3356#ifdef USE_DISPERSION 3357 uniform float dispersion; 3358#endif 3359#ifdef USE_IRIDESCENCE 3360 uniform float iridescence; 3361 uniform float iridescenceIOR; 3362 uniform float iridescenceThicknessMinimum; 3363 uniform float iridescenceThicknessMaximum; 3364#endif 3365#ifdef USE_SHEEN 3366 uniform vec3 sheenColor; 3367 uniform float sheenRoughness; 3368 #ifdef USE_SHEEN_COLORMAP 3369 uniform sampler2D sheenColorMap; 3370 #endif 3371 #ifdef USE_SHEEN_ROUGHNESSMAP 3372 uniform sampler2D sheenRoughnessMap; 3373 #endif 3374#endif 3375#ifdef USE_ANISOTROPY 3376 uniform vec2 anisotropyVector; 3377 #ifdef USE_ANISOTROPYMAP 3378 uniform sampler2D anisotropyMap; 3379 #endif 3380#endif 3381varying vec3 vViewPosition; 3382#include <common> 3383#include <packing> 3384#include <dithering_pars_fragment> 3385#include <color_pars_fragment> 3386#include <uv_pars_fragment> 3387#include <map_pars_fragment> 3388#include <alphamap_pars_fragment> 3389#include <alphatest_pars_fragment> 3390#include <alphahash_pars_fragment> 3391#include <aomap_pars_fragment> 3392#include <lightmap_pars_fragment> 3393#include <emissivemap_pars_fragment> 3394#include <iridescence_fragment> 3395#include <cube_uv_reflection_fragment> 3396#include <envmap_common_pars_fragment> 3397#include <envmap_physical_pars_fragment> 3398#include <fog_pars_fragment> 3399#include <lights_pars_begin> 3400#include <normal_pars_fragment> 3401#include <lights_physical_pars_fragment> 3402#include <transmission_pars_fragment> 3403#include <shadowmap_pars_fragment> 3404#include <bumpmap_pars_fragment> 3405#include <normalmap_pars_fragment> 3406#include <clearcoat_pars_fragment> 3407#include <iridescence_pars_fragment> 3408#include <roughnessmap_pars_fragment> 3409#include <metalnessmap_pars_fragment> 3410#include <logdepthbuf_pars_fragment> 3411#include <clipping_planes_pars_fragment> 3412void main() { 3413 vec4 diffuseColor = vec4( diffuse, opacity ); 3414 #include <clipping_planes_fragment> 3415 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3416 vec3 totalEmissiveRadiance = emissive; 3417 #include <logdepthbuf_fragment> 3418 #include <map_fragment> 3419 #include <color_fragment> 3420 #include <alphamap_fragment> 3421 #include <alphatest_fragment> 3422 #include <alphahash_fragment> 3423 #include <roughnessmap_fragment> 3424 #include <metalnessmap_fragment> 3425 #include <normal_fragment_begin> 3426 #include <normal_fragment_maps> 3427 #include <clearcoat_normal_fragment_begin> 3428 #include <clearcoat_normal_fragment_maps> 3429 #include <emissivemap_fragment> 3430 #include <lights_physical_fragment> 3431 #include <lights_fragment_begin> 3432 #include <lights_fragment_maps> 3433 #include <lights_fragment_end> 3434 #include <aomap_fragment> 3435 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3436 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3437 #include <transmission_fragment> 3438 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3439 #ifdef USE_SHEEN 3440 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3441 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3442 #endif 3443 #ifdef USE_CLEARCOAT 3444 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3445 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3446 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3447 #endif 3448 #include <opaque_fragment> 3449 #include <tonemapping_fragment> 3450 #include <colorspace_fragment> 3451 #include <fog_fragment> 3452 #include <premultiplied_alpha_fragment> 3453 #include <dithering_fragment> 3454}`,meshtoon_vert:`#define TOON 3455varying vec3 vViewPosition; 3456#include <common> 3457#include <batching_pars_vertex> 3458#include <uv_pars_vertex> 3459#include <displacementmap_pars_vertex> 3460#include <color_pars_vertex> 3461#include <fog_pars_vertex> 3462#include <normal_pars_vertex> 3463#include <morphtarget_pars_vertex> 3464#include <skinning_pars_vertex> 3465#include <shadowmap_pars_vertex> 3466#include <logdepthbuf_pars_vertex> 3467#include <clipping_planes_pars_vertex> 3468void main() { 3469 #include <uv_vertex> 3470 #include <color_vertex> 3471 #include <morphinstance_vertex> 3472 #include <morphcolor_vertex> 3473 #include <batching_vertex> 3474 #include <beginnormal_vertex> 3475 #include <morphnormal_vertex> 3476 #include <skinbase_vertex> 3477 #include <skinnormal_vertex> 3478 #include <defaultnormal_vertex> 3479 #include <normal_vertex> 3480 #include <begin_vertex> 3481 #include <morphtarget_vertex> 3482 #include <skinning_vertex> 3483 #include <displacementmap_vertex> 3484 #include <project_vertex> 3485 #include <logdepthbuf_vertex> 3486 #include <clipping_planes_vertex> 3487 vViewPosition = - mvPosition.xyz; 3488 #include <worldpos_vertex> 3489 #include <shadowmap_vertex> 3490 #include <fog_vertex> 3491}`,meshtoon_frag:`#define TOON 3492uniform vec3 diffuse; 3493uniform vec3 emissive; 3494uniform float opacity; 3495#include <common> 3496#include <packing> 3497#include <dithering_pars_fragment> 3498#include <color_pars_fragment> 3499#include <uv_pars_fragment> 3500#include <map_pars_fragment> 3501#include <alphamap_pars_fragment> 3502#include <alphatest_pars_fragment> 3503#include <alphahash_pars_fragment> 3504#include <aomap_pars_fragment> 3505#include <lightmap_pars_fragment> 3506#include <emissivemap_pars_fragment> 3507#include <gradientmap_pars_fragment> 3508#include <fog_pars_fragment> 3509#include <bsdfs> 3510#include <lights_pars_begin> 3511#include <normal_pars_fragment> 3512#include <lights_toon_pars_fragment> 3513#include <shadowmap_pars_fragment> 3514#include <bumpmap_pars_fragment> 3515#include <normalmap_pars_fragment> 3516#include <logdepthbuf_pars_fragment> 3517#include <clipping_planes_pars_fragment> 3518void main() { 3519 vec4 diffuseColor = vec4( diffuse, opacity ); 3520 #include <clipping_planes_fragment> 3521 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3522 vec3 totalEmissiveRadiance = emissive; 3523 #include <logdepthbuf_fragment> 3524 #include <map_fragment> 3525 #include <color_fragment> 3526 #include <alphamap_fragment> 3527 #include <alphatest_fragment> 3528 #include <alphahash_fragment> 3529 #include <normal_fragment_begin> 3530 #include <normal_fragment_maps> 3531 #include <emissivemap_fragment> 3532 #include <lights_toon_fragment> 3533 #include <lights_fragment_begin> 3534 #include <lights_fragment_maps> 3535 #include <lights_fragment_end> 3536 #include <aomap_fragment> 3537 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3538 #include <opaque_fragment> 3539 #include <tonemapping_fragment> 3540 #include <colorspace_fragment> 3541 #include <fog_fragment> 3542 #include <premultiplied_alpha_fragment> 3543 #include <dithering_fragment> 3544}`,points_vert:`uniform float size; 3545uniform float scale; 3546#include <common> 3547#include <color_pars_vertex> 3548#include <fog_pars_vertex> 3549#include <morphtarget_pars_vertex> 3550#include <logdepthbuf_pars_vertex> 3551#include <clipping_planes_pars_vertex> 3552#ifdef USE_POINTS_UV 3553 varying vec2 vUv; 3554 uniform mat3 uvTransform; 3555#endif 3556void main() { 3557 #ifdef USE_POINTS_UV 3558 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3559 #endif 3560 #include <color_vertex> 3561 #include <morphinstance_vertex> 3562 #include <morphcolor_vertex> 3563 #include <begin_vertex> 3564 #include <morphtarget_vertex> 3565 #include <project_vertex> 3566 gl_PointSize = size; 3567 #ifdef USE_SIZEATTENUATION 3568 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3569 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3570 #endif 3571 #include <logdepthbuf_vertex> 3572 #include <clipping_planes_vertex> 3573 #include <worldpos_vertex> 3574 #include <fog_vertex> 3575}`,points_frag:`uniform vec3 diffuse; 3576uniform float opacity; 3577#include <common> 3578#include <color_pars_fragment> 3579#include <map_particle_pars_fragment> 3580#include <alphatest_pars_fragment> 3581#include <alphahash_pars_fragment> 3582#include <fog_pars_fragment> 3583#include <logdepthbuf_pars_fragment> 3584#include <clipping_planes_pars_fragment> 3585void main() { 3586 vec4 diffuseColor = vec4( diffuse, opacity ); 3587 #include <clipping_planes_fragment> 3588 vec3 outgoingLight = vec3( 0.0 ); 3589 #include <logdepthbuf_fragment> 3590 #include <map_particle_fragment> 3591 #include <color_fragment> 3592 #include <alphatest_fragment> 3593 #include <alphahash_fragment> 3594 outgoingLight = diffuseColor.rgb; 3595 #include <opaque_fragment> 3596 #include <tonemapping_fragment> 3597 #include <colorspace_fragment> 3598 #include <fog_fragment> 3599 #include <premultiplied_alpha_fragment> 3600}`,shadow_vert:`#include <common> 3601#include <batching_pars_vertex> 3602#include <fog_pars_vertex> 3603#include <morphtarget_pars_vertex> 3604#include <skinning_pars_vertex> 3605#include <logdepthbuf_pars_vertex> 3606#include <shadowmap_pars_vertex> 3607void main() { 3608 #include <batching_vertex> 3609 #include <beginnormal_vertex> 3610 #include <morphinstance_vertex> 3611 #include <morphnormal_vertex> 3612 #include <skinbase_vertex> 3613 #include <skinnormal_vertex> 3614 #include <defaultnormal_vertex> 3615 #include <begin_vertex> 3616 #include <morphtarget_vertex> 3617 #include <skinning_vertex> 3618 #include <project_vertex> 3619 #include <logdepthbuf_vertex> 3620 #include <worldpos_vertex> 3621 #include <shadowmap_vertex> 3622 #include <fog_vertex> 3623}`,shadow_frag:`uniform vec3 color; 3624uniform float opacity; 3625#include <common> 3626#include <packing> 3627#include <fog_pars_fragment> 3628#include <bsdfs> 3629#include <lights_pars_begin> 3630#include <logdepthbuf_pars_fragment> 3631#include <shadowmap_pars_fragment> 3632#include <shadowmask_pars_fragment> 3633void main() { 3634 #include <logdepthbuf_fragment> 3635 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3636 #include <tonemapping_fragment> 3637 #include <colorspace_fragment> 3638 #include <fog_fragment> 3639}`,sprite_vert:`uniform float rotation; 3640uniform vec2 center; 3641#include <common> 3642#include <uv_pars_vertex> 3643#include <fog_pars_vertex> 3644#include <logdepthbuf_pars_vertex> 3645#include <clipping_planes_pars_vertex> 3646void main() { 3647 #include <uv_vertex> 3648 vec4 mvPosition = modelViewMatrix[ 3 ]; 3649 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3650 #ifndef USE_SIZEATTENUATION 3651 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3652 if ( isPerspective ) scale *= - mvPosition.z; 3653 #endif 3654 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3655 vec2 rotatedPosition; 3656 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3657 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3658 mvPosition.xy += rotatedPosition; 3659 gl_Position = projectionMatrix * mvPosition; 3660 #include <logdepthbuf_vertex> 3661 #include <clipping_planes_vertex> 3662 #include <fog_vertex> 3663}`,sprite_frag:`uniform vec3 diffuse; 3664uniform float opacity; 3665#include <common> 3666#include <uv_pars_fragment> 3667#include <map_pars_fragment> 3668#include <alphamap_pars_fragment> 3669#include <alphatest_pars_fragment> 3670#include <alphahash_pars_fragment> 3671#include <fog_pars_fragment> 3672#include <logdepthbuf_pars_fragment> 3673#include <clipping_planes_pars_fragment> 3674void main() { 3675 vec4 diffuseColor = vec4( diffuse, opacity ); 3676 #include <clipping_planes_fragment> 3677 vec3 outgoingLight = vec3( 0.0 ); 3678 #include <logdepthbuf_fragment> 3679 #include <map_fragment> 3680 #include <alphamap_fragment> 3681 #include <alphatest_fragment> 3682 #include <alphahash_fragment> 3683 outgoingLight = diffuseColor.rgb; 3684 #include <opaque_fragment> 3685 #include <tonemapping_fragment> 3686 #include <colorspace_fragment> 3687 #include <fog_fragment> 3688}`},
vendor: 755 bytes, line 3688
3688$={common:{diffuse:{value:new Z(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Y},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Y}},envmap:{envMap:{value:null},envMapRotation:{value:new Y},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Y}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Y}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Y},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Y},normalScale:{value:new q(1,1)}}
vendor: 7,337 bytes, line 3688
3688,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Y},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Y}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Y}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Y}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Z(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 Z(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0},uvTransform:{value:new Y}},sprite:{diffuse:{value:new Z(16777215)},opacity:{value:1},center:{value:new q(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Y},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0}}},Ts={basic:{uniforms:uo([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:uo([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.fog,$.lights,{emissive:{value:new Z(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:uo([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.fog,$.lights,{emissive:{value:new Z(0)},specular:{value:new Z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:uo([$.common,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.roughnessmap,$.metalnessmap,$.fog,$.lights,{emissive:{value:new Z(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:uo([$.common,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.gradientmap,$.fog,$.lights,{emissive:{value:new Z(0)}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:uo([$.common,$.bumpmap,$.normalmap,$.displacementmap,$.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:uo([$.points,$.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:uo([$.common,$.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:uo([$.common,$.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:uo([$.common,$.bumpmap,$.normalmap,$.displacementmap,{opacity:{value:1}}]),vertexShader:Q.meshnormal_vert,fragmentShader:Q.meshnormal_frag},sprite:{uniforms:uo([$.sprite,$.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new Y},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Y}},vertexShader:Q.backgroundCube_vert,fragmentShader:Q.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:uo([$.common,$.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:uo([$.lights,$.fog,{color:{value:new Z(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}};Ts.physical={uniforms:uo([Ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Y},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Y},clearcoatNormalScale:{value:new q(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Y},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Y},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Y},sheen:{value:0},sheenColor:{value:new Z(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Y},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Y},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Y},transmissionSamplerSize:{value:new q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Y},attenuationDistance:{value:0},attenuationColor:{value:new Z(0)},specularColor:{value:new Z(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Y},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Y},anisotropyVector:{value:new q},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Y}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag};var Es={r:0,b:0,g:0},Ds=new qi,Os=new Li;function ks(e,t,n,r,i,a,o){let s=new Z(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new ao(new co(1,1,1),new _o({name:`Backgroun
3688dCubeMaterial`,uniforms:lo(Ts.backgroundCube.uniforms),vertexShader:Ts.backgroundCube.vertexShader,fragmentShader:Ts.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Ds.copy(n.backgroundRotation),Ds.x*=-1,Ds.y*=-1,Ds.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(Ds.y*=-1,Ds.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Os.makeRotationFromEuler(Ds)),u.material.toneMapped=X.getTransfer(r.colorSpace)!==xr,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new ao(new Vo(2,2),new _o({name:`BackgroundMaterial`,uniforms:lo(Ts.background.uniforms),vertexShader:Ts.background.vertexShader,fragmentShader:Ts.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=X.getTransfer(r.colorSpace)!==xr,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(Es,po(e)),r.buffers.color.setClear(Es.r,Es.g,Es.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function As(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function p(e,t,n,r){let i=a.attributes,o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function g(e){_(e,0)}function _(t,n){let r=a.newAttributes,i=a.enabledAttributes,o=a.attributeDivisors;r[t]=1,i[t]===0&&(e.enableVertexAttribArray(t),i[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function v(){let t=a.newAttributes,n=a.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){s===!0?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function b(n,r,i,a){h();let o=a.attributes,s=i.getAttributes(),c=r.defaultAttributeValues;for(let r in s){let i=s[r];if(i.location>=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)_(i.location+e,t.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,c*d,(p+o/i.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)_(i.location+e,s.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,o*d,o/i.locationSize*e*d,f)}}else if(c!==void 0){let t=c[r];if(t!==void 0)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}v()}function x(){w();for(let e in r){let t=r[e];for(let e in t){let n=t[e];for(let e in n)u(n[e].object),delete n[e];delete t[e]}delete r[e]}}function S(e){if(r[e.id]===void 0)return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n)u(n[e].object),delete n[e];delete t[e]}delete r[e.id]}function C(e){for(let t in r){let n=r[t];if(n[e.id]===void 0)continue;let i=n[e.id];for(let e in i)u(i[e].object),delete i[e];delete n[e.id]}}function w(){T(),o=!0,a!==i&&(a=i,l(a.object))}function T(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:s,reset:w,resetDefaultState:T,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfProgram:C,initAttributes:h,enableAttribute:g,disableUnusedAttributes:v}}function js(e,t,n){let r;function i(e){r=e}function a(t,i){e.drawArrays(r,t,i),n.update(i,r,1)}function o(t,i,a){a!==0&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))}function s(e,i,a){if(a===0)return;t.get(`WEBGL_multi_draw`).multiDrawArraysWEBGL(r,e,0,i,0,a);let o=0;for(let e=0;e<a;e++)o+=i[e];n.update(o,r,1)}
vendor: 12,493 bytes, lines 3688-3763
3688function c(e,i,a,s){if(a===0)return;let c=t.get(`WEBGL_multi_draw`);if(c===null)for(let t=0;t<e.length;t++)o(e[t],i[t],s[t]);else{c.multiDrawArraysInstancedWEBGL(r,e,0,i,0,s,0,a);let t=0;for(let e=0;e<a;e++)t+=i[e]*s[e];n.update(t,r,1)}}this.setMode=i,this.render=a,this.renderInstances=o,this.renderMultiDraw=s,this.renderMultiDrawInstances=c}function Ms(e,t,n,r){let i;function a(){if(i!==void 0)return i;if(t.has(`EXT_texture_filter_anisotropic`)===!0){let n=t.get(`EXT_texture_filter_anisotropic`);i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(t){return!(t!==1023&&r.convert(t)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))}function s(n){let i=n===1016&&(t.has(`EXT_color_buffer_half_float`)||t.has(`EXT_color_buffer_float`));return!(n!==1009&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==1015&&!i)}function c(t){if(t===`highp`){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function Ns(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Fo,s=new Y,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length<t)&&(l=new Float32Array(t));for(let t=0,n=r;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}c.value=l,c.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}}function Ps(e){let t=new WeakMap;function n(e,t){return t===303?e.mapping=301:t===304&&(e.mapping=302),e}function r(r){if(r&&r.isTexture){let a=r.mapping;if(a===303||a===304)if(t.has(r)){let e=t.get(r).texture;return n(e,r.mapping)}else{let a=r.image;if(a&&a.height>0){let o=new Do(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var Fs=4,Is=[.125,.215,.35,.446,.526,.582],Ls=20,Rs=new os,zs=new Z,Bs=null,Vs=0,Hs=0,Us=!1,Ws=(1+Math.sqrt(5))/2,Gs=1/Ws,Ks=[new J(-Ws,Gs,0),new J(Ws,Gs,0),new J(-Gs,0,Ws),new J(Gs,0,Ws),new J(0,Ws,-Gs),new J(0,Ws,Gs),new J(-1,1,-1),new J(1,1,-1),new J(-1,1,1),new J(1,1,1)],qs=new J,Js=class{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={}){let{size:a=256,position:o=qs}=i;Bs=this._renderer.getRenderTarget(),Vs=this._renderer.getActiveCubeFace(),Hs=this._renderer.getActiveMipmapLevel(),Us=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),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=ec(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=$s(),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=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(Bs,Vs,Hs),this._renderer.xr.enabled=Us,e.scissorTest=!1,Zs(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),Bs=this._renderer.getRenderTarget(),Vs=this._renderer.getActiveCubeFace(),Hs=this._renderer.getActiveMipmapLevel(),Us=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:sn,minFilter:sn,generateMipmaps:!1,type:_n,format:wn,colorSpace:yr,depthBuffer:!1},r=Xs(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Xs(e,t,n);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Ys(r)),this._blurMaterial=Qs(r,e,t)}return r}_compileMaterial(e){let t=new ao(this._lodPlanes[0],e);this._renderer.compile(t,Rs)}_sceneToCubeUV(e,t,n,r,i){let a=new So(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],c=this._renderer,l=c.autoClear,u=c.toneMapping;c.getClearColor(zs),c.toneMapping=0,c.autoClear=!1;let d=new Ma({name:`PMREM.Background`,side:1,depthWrite:!1,depthTest:!1}),f=new ao(new co,d),p=!1,m=e.background;m?m.isColor&&(d.color.copy(m),e.background=null,p=!0):(d.color.copy(zs),p=!0);for(let t=0;t<6;t++){let n=t%3;n===0?(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+s[t],i.y,i.z)):n===1?(a.up.set(0,0,o[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+s[t],i.z)):(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+s[t]));let l=this._cubeSize;Zs(r,n*l,t>2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=ec()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=$s());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new ao(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;Zs(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,Rs)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;t<r;t++){let n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),i=Ks[(r-t-1)%Ks.length];this._blur(e,t-1,t,n,i)}t.autoClear=n}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)}_halfBlur(e,t,n,r,i,a,o){let s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&console.error(`blur direction must be either latitudinal or longitudinal!`);let l=new ao(this._lodPlanes[r],c),u=c.uniforms,d=this._sizeLods[n]-1,f=isFinite(i)?Math.PI/(2*d):2*Math.PI/(2*Ls-1),p=i/f,m=isFinite(i)?1+Math.floor(3*p):Ls;m>Ls&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ls}`);let h=[],g=0;for(let e=0;e<Ls;++e){let t=e/p,n=Math.exp(-t*t/2);h.push(n),e===0?g+=n:e<m&&(g+=2*n)}for(let e=0;e<h.length;e++)h[e]=h[e]/g;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=h,u.latitudinal.value=a===`latitudinal`,o&&(u.poleAxis.value=o);let{_lodMax:_}=this;u.dTheta.value=f,u.mipInt.value=_-n;let v=this._sizeLods[r];Zs(t,3*v*(r>_-Fs?r-_+Fs:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,Rs)}};function Ys(e){let t=[],n=[],r=[],i=e,a=e-Fs+1+Is.length;for(let o=0;o<a;o++){let a=2**i;n.push(a);let s=1/a;o>e-Fs?s=Is[o-e+Fs-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new qa;h.setAttribute(`position`,new Ia(f,3)),h.setAttribute(`uv`,new Ia(p,2)),h.setAttribute(`faceIndex`,new Ia(m,1)),t.push(h),i>Fs&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function Xs(e,t,n){let r=new si(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function Zs(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Qs(e,t,n){let r=new Float32Array(Ls),i=new J(0,1,0);return new _o({name:`SphericalGaussianBlur`,defines:{n:Ls,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:tc(),fragmentShader:` 3689 3690 precision mediump float; 3691 precision mediump int; 3692 3693 varying vec3 vOutputDirection; 3694 3695 uniform sampler2D envMap; 3696 uniform int samples; 3697 uniform float weights[ n ]; 3698 uniform bool latitudinal; 3699 uniform float dTheta; 3700 uniform float mipInt; 3701 uniform vec3 poleAxis; 3702 3703 #define ENVMAP_TYPE_CUBE_UV 3704 #include <cube_uv_reflection_fragment> 3705 3706 vec3 getSample( float theta, vec3 axis ) { 3707 3708 float cosTheta = cos( theta ); 3709 // Rodrigues' axis-angle rotation 3710 vec3 sampleDirection = vOutputDirection * cosTheta 3711 + cross( axis, vOutputDirection ) * sin( theta ) 3712 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3713 3714 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3715 3716 } 3717 3718 void main() { 3719 3720 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3721 3722 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3723 3724 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3725 3726 } 3727 3728 axis = normalize( axis ); 3729 3730 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3731 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3732 3733 for ( int i = 1; i < n; i++ ) { 3734 3735 if ( i >= samples ) { 3736 3737 break; 3738 3739 } 3740 3741 float theta = dTheta * float( i ); 3742 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3743 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3744 3745 } 3746 3747 } 3748 `,blending:0,depthTest:!1,depthWrite:!1})}function $s(){return new _o({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:tc(),fragmentShader:` 3749 3750 precision mediump float; 3751 precision mediump int; 3752 3753 varying vec3 vOutputDirection; 3754 3755 uniform sampler2D envMap; 3756 3757 #include <common> 3758 3759 void main() { 3760 3761 vec3 outputDirection = normalize( vOutputDirection ); 3762 vec2 uv = equirectUv( outputDirection ); 3763
3764 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3765 3766 } 3767 `,blending:0,depthTest:!1,depthWrite:!1})}function ec(){return new _o({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:tc(),fragmentShader:` 3768 3769 precision mediump float; 3770 precision mediump int; 3771 3772 uniform float flipEnvMap; 3773 3774 varying vec3 vOutputDirection; 3775 3776 uniform samplerCube envMap; 3777 3778 void main() { 3779 3780 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3781 3782 } 3783 `,blending:0,depthTest:!1,depthWrite:!1})}function tc(){return` 3784 3785 precision mediump float; 3786 precision mediump int; 3787 3788 attribute float faceIndex; 3789 3790 varying vec3 vOutputDirection; 3791 3792 // RH coordinate system; PMREM face-indexing convention 3793 vec3 getDirection( vec2 uv, float face ) { 3794 3795 uv = 2.0 * uv - 1.0; 3796 3797 vec3 direction = vec3( uv, 1.0 ); 3798 3799 if ( face == 0.0 ) { 3800 3801 direction = direction.zyx; // ( 1, v, u ) pos x 3802 3803 } else if ( face == 1.0 ) { 3804 3805 direction = direction.xzy; 3806 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3807 3808 } else if ( face == 2.0 ) { 3809 3810 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3811 3812 } else if ( face == 3.0 ) { 3813 3814 direction = direction.zyx; 3815 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3816 3817 } else if ( face == 4.0 ) { 3818 3819 direction = direction.xzy; 3820 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3821 3822 } else if ( face == 5.0 ) { 3823 3824 direction.z *= -1.0; // ( u, v, -1 ) neg z 3825 3826 } 3827 3828 return direction; 3829 3830 } 3831 3832 void main() { 3833 3834 vOutputDirection = getDirection( uv, faceIndex ); 3835 gl_Position = vec4( position, 1.0 ); 3836 3837 } 3838 `}function nc(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new Js(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new Js(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function rc(e){let t={};
vendor: 19,963 bytes, lines 3838-3873
3838function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&Hr(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function ic(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],i=e[t+1],a=e[t+2];n.push(r,i,i,a,a,r)}}else if(i!==void 0){let e=i.array;o=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}else return;let s=new(Rr(n)?Ra:La)(n,1);s.version=o;let c=a.get(e);c&&t.remove(c),a.set(e,s)}function u(e){let t=a.get(e);if(t){let n=e.index;n!==null&&t.version<n.version&&l(e)}else l(e);return a.get(e)}return{get:s,update:c,getWireframeAttribute:u}}function ac(e,t,n){let r;function i(e){r=e}let a,o;function s(e){a=e.type,o=e.bytesPerElement}function c(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)}function l(t,i,s){s!==0&&(e.drawElementsInstanced(r,i,a,t*o,s),n.update(i,r,s))}function u(e,i,o){if(o===0)return;t.get(`WEBGL_multi_draw`).multiDrawElementsWEBGL(r,i,0,a,e,0,o);let s=0;for(let e=0;e<o;e++)s+=i[e];n.update(s,r,1)}function d(e,i,s,c){if(s===0)return;let u=t.get(`WEBGL_multi_draw`);if(u===null)for(let t=0;t<e.length;t++)l(e[t]/o,i[t],c[t]);else{u.multiDrawElementsInstancedWEBGL(r,i,0,a,e,0,c,0,s);let t=0;for(let e=0;e<s;e++)t+=i[e]*c[e];n.update(t,r,1)}}this.setMode=i,this.setIndex=s,this.render=c,this.renderInstances=l,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function oc(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(t,r,i){switch(n.calls++,r){case e.TRIANGLES:n.triangles+=t/3*i;break;case e.LINES:n.lines+=t/2*i;break;case e.LINE_STRIP:n.lines+=i*(t-1);break;case e.LINE_LOOP:n.lines+=i*t;break;case e.POINTS:n.points+=i*t;break;default:console.error(`THREE.WebGLInfo: Unknown draw mode:`,r);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function sc(e,t,n){let r=new WeakMap,i=new ai;function a(a,o,s){let c=a.morphTargetInfluences,l=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=l===void 0?0:l.length,d=r.get(o);if(d===void 0||d.count!==u){d!==void 0&&d.texture.dispose();let e=o.morphAttributes.position!==void 0,n=o.morphAttributes.normal!==void 0,a=o.morphAttributes.color!==void 0,s=o.morphAttributes.position||[],c=o.morphAttributes.normal||[],l=o.morphAttributes.color||[],f=0;e===!0&&(f=1),n===!0&&(f=2),a===!0&&(f=3);let p=o.attributes.position.count*f,m=1;p>t.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new ci(h,p,m,u);g.type=gn,g.needsUpdate=!0;let _=f*4;for(let t=0;t<u;t++){let r=s[t],o=c[t],u=l[t],d=p*m*4*t;for(let t=0;t<r.count;t++){let s=t*_;e===!0&&(i.fromBufferAttribute(r,t),h[d+s+0]=i.x,h[d+s+1]=i.y,h[d+s+2]=i.z,h[d+s+3]=0),n===!0&&(i.fromBufferAttribute(o,t),h[d+s+4]=i.x,h[d+s+5]=i.y,h[d+s+6]=i.z,h[d+s+7]=0),a===!0&&(i.fromBufferAttribute(u,t),h[d+s+8]=i.x,h[d+s+9]=i.y,h[d+s+10]=i.z,h[d+s+11]=u.itemSize===4?i.w:1)}}d={count:u,texture:g,size:new q(p,m)},r.set(o,d);function v(){g.dispose(),r.delete(o),o.removeEventListener(`dispose`,v)}o.addEventListener(`dispose`,v)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)s.getUniforms().setValue(e,`morphTexture`,a.morphTexture,n);else{let t=0;for(let e=0;e<c.length;e++)t+=c[e];let n=o.morphTargetsRelative?1:1-t;s.getUniforms().setValue(e,`morphTargetBaseInfluence`,n),s.getUniforms().setValue(e,`morphTargetInfluences`,c)}s.getUniforms().setValue(e,`morphTargetsTexture`,d.texture,n),s.getUniforms().setValue(e,`morphTargetsTextureSize`,d.size)}return{update:a}}function cc(e,t,n,r){let i=new WeakMap;function a(a){let o=r.render.frame,c=a.geometry,l=t.get(a,c);if(i.get(l)!==o&&(t.update(l),i.set(l,o)),a.isInstancedMesh&&(a.hasEventListener(`dispose`,s)===!1&&a.addEventListener(`dispose`,s),i.get(a)!==o&&(n.update(a.instanceMatrix,e.ARRAY_BUFFER),a.instanceColor!==null&&n.update(a.instanceColor,e.ARRAY_BUFFER),i.set(a,o))),a.isSkinnedMesh){let e=a.skeleton;i.get(e)!==o&&(e.update(),i.set(e,o))}return l}function o(){i=new WeakMap}function s(e){let t=e.target;t.removeEventListener(`dispose`,s),n.remove(t.instanceMatrix),t.instanceColor!==null&&n.remove(t.instanceColor)}return{update:a,dispose:o}}var lc=new ii,uc=new Bo(1,1),dc=new ci,fc=new li,pc=new Eo,mc=[],hc=[],gc=new Float32Array(16),_c=new Float32Array(9),vc=new Float32Array(4);function yc(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=mc[i];if(a===void 0&&(a=new Float32Array(i),mc[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function bc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function xc(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function Sc(e,t){let n=hc[t];n===void 0&&(n=new Int32Array(t),hc[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Cc(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function wc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(bc(n,t))return;e.uniform2fv(this.addr,t),xc(n,t)}}function Tc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(bc(n,t))return;e.uniform3fv(this.addr,t),xc(n,t)}}function Ec(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(bc(n,t))return;e.uniform4fv(this.addr,t),xc(n,t)}}function Dc(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(bc(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),xc(n,t)}else{if(bc(n,r))return;vc.set(r),e.uniformMatrix2fv(this.addr,!1,vc),xc(n,r)}}function Oc(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(bc(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),xc(n,t)}else{if(bc(n,r))return;_c.set(r),e.uniformMatrix3fv(this.addr,!1,_c),xc(n,r)}}function kc(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(bc(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),xc(n,t)}else{if(bc(n,r))return;gc.set(r),e.uniformMatrix4fv(this.addr,!1,gc),xc(n,r)}}function Ac(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function jc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(bc(n,t))return;e.uniform2iv(this.addr,t),xc(n,t)}}function Mc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(bc(n,t))return;e.uniform3iv(this.addr,t),xc(n,t)}}function Nc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(bc(n,t))return;e.uniform4iv(this.addr,t),xc(n,t)}}function Pc(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Fc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(bc(n,t))return;e.uniform2uiv(this.addr,t),xc(n,t)}}function Ic(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(bc(n,t))return;e.uniform3uiv(this.addr,t),xc(n,t)}}function Lc(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(bc(n,t))return;e.uniform4uiv(this.addr,t),xc(n,t)}}function Rc(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i);let a;this.type===e.SAMPLER_2D_SHADOW?(uc.compareFunction=515,a=uc):a=lc,n.setTexture2D(t||a,i)}function zc(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||fc,i)}function Bc(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||pc,i)}function Vc(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||dc,i)}function Hc(e){switch(e){case 5126:return Cc;case 35664:return wc;case 35665:return Tc;case 35666:return Ec;case 35674:return Dc;case 35675:return Oc;case 35676:return kc;case 5124:case 35670:return Ac;case 35667:case 35671:return jc;case 35668:case 35672:return Mc;case 35669:case 35673:return Nc;case 5125:return Pc;case 36294:return Fc;case 36295:return Ic;case 36296:return Lc;case 35678:case 36198:case 36298:case 36306:case 35682:return Rc;case 35679:case 36299:case 36307:return zc;case 35680:case 36300:case 36308:case 36293:return Bc;case 36289:case 36303:case 36311:case 36292:return Vc}}function Uc(e,t){e.uniform1fv(this.addr,t)}function Wc(e,t){let n=yc(t,this.size,2);e.uniform2fv(this.addr,n)}function Gc(e,t){let n=yc(t,this.size,3);e.uniform3fv(this.addr,n)}function Kc(e,t){let n=yc(t,this.size,4);e.uniform4fv(this.addr,n)}function qc(e,t){let n=yc(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Jc(e,t){let n=yc(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Yc(e,t){let n=yc(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Xc(e,t){e.uniform1iv(this.addr,t)}function Zc(e,t){e.uniform2iv(this.addr,t)}function Qc(e,t){e.uniform3iv(this.addr,t)}function $c(e,t){e.uniform4iv(this.addr,t)}function el(e,t){e.uniform1uiv(this.addr,t)}function tl(e,t){e.uniform2uiv(this.addr,t)}function nl(e,t){e.uniform3uiv(this.addr,t)}function rl(e,t){e.uniform4uiv(this.addr,t)}function il(e,t,n){let r=this.cache,i=t.length,a=Sc(n,i);bc(r,a)||(e.uniform1iv(this.addr,a),xc(r,a));for(let e=0;e!==i;++e)n.setTexture2D(t[e]||lc,a[e])}function al(e,t,n){let r=this.cache,i=t.length,a=Sc(n,i);bc(r,a)||(e.uniform1iv(this.addr,a),xc(r,a));for(let e=0;e!==i;++e)n.setTexture3D(t[e]||fc,a[e])}function ol(e,t,n){let r=this.cache,i=t.length,a=Sc(n,i);bc(r,a)||(e.uniform1iv(this.addr,a),xc(r,a));for(let e=0;e!==i;++e)n.setTextureCube(t[e]||pc,a[e])}function sl(e,t,n){let r=this.cache,i=t.length,a=Sc(n,i);bc(r,a)||(e.uniform1iv(this.addr,a),xc(r,a));for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||dc,a[e])}function cl(e){switch(e){case 5126:return Uc;case 35664:return Wc;case 35665:return Gc;case 35666:return Kc;case 35674:return qc;case 35675:return Jc;case 35676:return Yc;case 5124:case 35670:return Xc;case 35667:case 35671:return Zc;case 35668:case 35672:return Qc;case 35669:case 35673:return $c;case 5125:return el;case 36294:return tl;case 36295:return nl;case 36296:return rl;case 35678:case 36198:case 36298:case 36306:case 35682:return il;case 35679:case 36299:case 36307:return al;case 35680:case 36300:case 36308:case 36293:return ol;case 36289:case 36303:case 36311:case 36292:return sl}}var ll=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Hc(t.type)}},ul=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=cl(t.type)}},dl=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let i=0,a=r.length;i!==a;++i){let a=r[i];a.setValue(e,t[a.id],n)}}},fl=/(\w+)(\])?(\[|\.)?/g;function pl(e,t){e.seq.push(t),e.map[t.id]=t}function ml(e,t,n){let r=e.name,i=r.length;for(fl.lastIndex=0;;){let a=fl.exec(r),o=fl.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){pl(n,l===void 0?new ll(s,e,t):new ul(s,e,t));break}else{let e=n.map[s];e===void 0&&(e=new dl(s),pl(n,e)),n=e}}}var hl=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let n=e.getActiveUniform(t,r);ml(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,r){let i=this.map[t];i!==void 0&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],o=n[a.id];o.needsUpdate!==!1&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}};function gl(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var _l=37297,vl=0;function yl(e,t){let n=e.split(` 3839`),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e<a;e++){let i=e+1;r.push(`${i===t?`>`:` `} ${i}: ${n[e]}`)}return r.join(` 3840`)}var bl=new Y;function xl(e){X._getMatrix(bl,X.workingColorSpace,e);let t=`mat3( ${bl.elements.map(e=>e.toFixed(4))} )`;switch(X.getTransfer(e)){case br:return[t,`LinearTransferOETF`];case xr:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function Sl(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` 3841 3842`+i+` 3843 3844`+yl(e.getShaderSource(t),r)}else return i}function Cl(e,t){let n=xl(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` 3845`)}function wl(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var Tl=new J;function El(){return X.getLuminanceCoefficients(Tl),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Tl.x.toFixed(4)}, ${Tl.y.toFixed(4)}, ${Tl.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` 3846`)}function Dl(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Al).join(` 3847`)}function Ol(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` 3848`)}function kl(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=e.getActiveAttrib(t,i),a=r.name,o=1;r.type===e.FLOAT_MAT2&&(o=2),r.type===e.FLOAT_MAT3&&(o=3),r.type===e.FLOAT_MAT4&&(o=4),n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}function Al(e){return e!==``}function jl(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ml(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Nl=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pl(e){return e.replace(Nl,Il)}var Fl=new Map;function Il(e,t){let n=Q[t];if(n===void 0){let e=Fl.get(t);if(e!==void 0)n=Q[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return Pl(n)}var Ll=/#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 Rl(e){return e.replace(Ll,zl)}function zl(e,t,n,r){let i=``;for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,`[ `+e+` ]`).replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Bl(e){let t=`precision ${e.precision} float; 3849 precision ${e.precision} int; 3850 precision ${e.precision} sampler2D; 3851 precision ${e.precision} samplerCube; 3852 precision ${e.precision} sampler3D; 3853 precision ${e.precision} sampler2DArray; 3854 precision ${e.precision} sampler2DShadow; 3855 precision ${e.precision} samplerCubeShadow; 3856 precision ${e.precision} sampler2DArrayShadow; 3857 precision ${e.precision} isampler2D; 3858 precision ${e.precision} isampler3D; 3859 precision ${e.precision} isamplerCube; 3860 precision ${e.precision} isampler2DArray; 3861 precision ${e.precision} usampler2D; 3862 precision ${e.precision} usampler3D; 3863 precision ${e.precision} usamplerCube; 3864 precision ${e.precision} usampler2DArray; 3865 `;return e.precision===`highp`?t+=` 3866#define HIGH_PRECISION`:e.precision===`mediump`?t+=` 3867#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=` 3868#define LOW_PRECISION`),t}function Vl(e){let t=`SHADOWMAP_TYPE_BASIC`;return e.shadowMapType===1?t=`SHADOWMAP_TYPE_PCF`:e.shadowMapType===2?t=`SHADOWMAP_TYPE_PCF_SOFT`:e.shadowMapType===3&&(t=`SHADOWMAP_TYPE_VSM`),t}function Hl(e){let t=`ENVMAP_TYPE_CUBE`;if(e.envMap)switch(e.envMapMode){case 301:case 302:t=`ENVMAP_TYPE_CUBE`;break;case 306:t=`ENVMAP_TYPE_CUBE_UV`;break}return t}function Ul(e){let t=`ENVMAP_MODE_REFLECTION`;if(e.envMap)switch(e.envMapMode){case 302:t=`ENVMAP_MODE_REFRACTION`;break}return t}function Wl(e){let t=`ENVMAP_BLENDING_NONE`;if(e.envMap)switch(e.combine){case 0:t=`ENVMAP_BLENDING_MULTIPLY`;break;case 1:t=`ENVMAP_BLENDING_MIX`;break;case 2:t=`ENVMAP_BLENDING_ADD`;break}return t}function Gl(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(2**n,112)),texelHeight:r,maxMip:n}}function Kl(e,t,n,r){let i=e.getContext(),a=n.defines,o=n.vertexShader,s=n.fragmentShader,c=Vl(n),l=Hl(n),u=Ul(n),d=Wl(n),f=Gl(n),p=Dl(n),m=Ol(a),h=i.createProgram(),g,_,v=n.glslVersion?`#version `+n.glslVersion+` 3869`:``;n.isRawShaderMaterial?(g=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Al).join(` 3870`),g.length>0&&(g+=` 3871`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Al).join(` 3872`),_.length>0&&(_+=` 3873`)):(g=[Bl(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionCl
vendor: 5,501 bytes, lines 3873-3875
3873ipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`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`,` 3874`].filter(Al).join(` 3875`),_=[Bl(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matc
vendor: 4,138 bytes, lines 3875-3882
3875ap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:wl(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,Q.colorspace_pars_fragment,Cl(`linearToOutputTexel`,n.outputColorSpace),El(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` 3876`].filter(Al).join(` 3877`)),o=Pl(o),o=jl(o,n),o=Ml(o,n),s=Pl(s),s=jl(s,n),s=Ml(s,n),o=Rl(o),s=Rl(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es 3878`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` 3879`)+` 3880`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#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(` 3881`)+` 3882`+_);let y=v+g+o,b=v+_+s,x=gl(i,i.VERTEX_SHADER,y),S=gl(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);
vendor: 13,936 bytes, lines 3882-3889
3882function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=Sl(i,x,`vertex`),r=Sl(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` 3883 3884Material Name: `+t.name+` 3885Material Type: `+t.type+` 3886 3887Program Info Log: `+n+` 3888`+e+` 3889`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new hl(i,h),T=kl(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,_l)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=vl++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var ql=0,Jl=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.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){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Yl(e),t.set(e,n)),n}},Yl=class{constructor(e){this.id=ql++,this.code=e,this.usedTimes=0}};function Xl(e,t,n,r,i,a,o){let s=new Ji,c=new Jl,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={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 h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=Ts[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,I=!!a.matcap,ee=!!x,te=!!a.aoMap,ne=!!a.lightMap,re=!!a.bumpMap,ie=!!a.normalMap,ae=!!a.displacementMap,L=!!a.emissiveMap,R=!!a.metalnessMap,oe=!!a.roughnessMap,se=a.anisotropy>0,z=a.clearcoat>0,ce=a.dispersion>0,B=a.iridescence>0,le=a.sheen>0,V=a.transmission>0,H=se&&!!a.anisotropyMap,U=z&&!!a.clearcoatMap,ue=z&&!!a.clearcoatNormalMap,W=z&&!!a.clearcoatRoughnessMap,G=B&&!!a.iridescenceMap,de=B&&!!a.iridescenceThicknessMap,fe=le&&!!a.sheenColorMap,pe=le&&!!a.sheenRoughnessMap,me=!!a.specularMap,he=!!a.specularColorMap,ge=!!a.specularIntensityMap,_e=V&&!!a.transmissionMap,ve=V&&!!a.thicknessMap,ye=!!a.gradientMap,be=!!a.alphaMap,xe=a.alphaTest>0,Se=!!a.alphaHash,Ce=!!a.extensions,we=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(we=e.toneMapping);let Te={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:yr,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:ie,displacementMap:f&&ae,emissiveMap:L,normalMapObjectSpace:ie&&a.normalMapType===1,normalMapTangentSpace:ie&&a.normalMapType===0,metalnessMap:R,roughnessMap:oe,anisotropy:se,anisotropyMap:H,clearcoat:z,clearcoatMap:U,clearcoatNormalMap:ue,clearcoatRoughnessMap:W,dispersion:ce,iridescence:B,iridescenceMap:G,iridescenceThicknessMap:de,sheen:le,sheenColorMap:fe,sheenRoughnessMap:pe,specularMap:me,specularColorMap:he,specularIntensityMap:ge,transmission:V,transmissionMap:_e,thicknessMap:ve,gradientMap:ye,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:be,alphaTest:xe,alphaHash:Se,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:te&&h(a.aoMap.channel),lightMapUv:ne&&h(a.lightMap.channel),bumpMapUv:re&&h(a.bumpMap.channel),normalMapUv:ie&&h(a.normalMap.channel),displacementMapUv:ae&&h(a.displacementMap.channel),emissiveMapUv:L&&h(a.emissiveMap.channel),metalnessMapUv:R&&h(a.metalnessMap.channel),roughnessMapUv:oe&&h(a.roughnessMap.channel),anisotropyMapUv:H&&h(a.anisotropyMap.channel),clearcoatMapUv:U&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:ue&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:W&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:G&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:de&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:pe&&h(a.sheenRoughnessMap.channel),specularMapUv:me&&h(a.specularMap.channel),specularColorMapUv:he&&h(a.specularColorMap.channel),specularIntensityMapUv:ge&&h(a.specularIntensityMap.channel),transmissionMapUv:_e&&h(a.transmissionMap.channel),thicknessMapUv:ve&&h(a.thicknessMap.channel),alphaMapUv:be&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ie||se),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||be),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0&&a.wireframe===!1,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:we,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&X.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:L&&a.emissiveMap.isVideoTexture===!0&&X.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:Ce&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(Ce&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return Te.vertexUv1s=l.has(1),Te.vertexUv2s=l.has(2),Te.vertexUv3s=l.has(3),l.clear(),Te}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),t.gradientMap&&s.enable(22),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=Ts[t];n=mo.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e<t;e++){let t=u[e];if(t.cacheKey===n){r=t,++r.usedTimes;break}}return r===void 0&&(r=new Kl(e,n,t,a),u.push(r)),r}function S(e){if(--e.usedTimes===0){let t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}}function C(e){c.remove(e)}function w(){c.dispose()}return{getParameters:g,getProgramCacheKey:_,getUniforms:b,acquireProgram:x,releaseProgram:S,releaseShaderCache:C,programs:u,dispose:w}}function Zl(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function r(t){e.delete(t)}function i(t,n,r){e.get(t)[n]=r}function a(){e=new WeakMap}return{has:t,get:n,remove:r,update:i,dispose:a}}function Ql(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function $l(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function eu(){let e=[],t=0,n=[],r=[],i=[];function a(){t=0,n.length=0,r.length=0,i.length=0}function o(n,r,i,a,o,s){let c=e[t];return c===void 0?(c={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=i,c.groupOrder=a,c.renderOrder=n.renderOrder,c.z=o,c.group=s),t++,c}function s(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||Ql),r.length>1&&r.sort(t||$l),i.length>1&&i.sort(t||$l)}function u(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(t.id===null)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}}return{opaque:n,transmissive:r,transparent:i,init:a,push:s,unshift:c,finish:u,sort:l}}
vendor: 1,176 bytes, line 3889
3889function tu(){let e=new WeakMap;function t(t,n){let r=e.get(t),i;return r===void 0?(i=new eu,e.set(t,[i])):n>=r.length?(i=new eu,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function nu(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new J,color:new Z};break;case`SpotLight`:n={position:new J,direction:new J,color:new Z,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new J,color:new Z,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new J,skyColor:new Z,groundColor:new Z};break;case`RectAreaLight`:n={color:new Z,position:new J,halfWidth:new J,halfHeight:new J};break}return e[t.id]=n,n}}}function ru(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q,
vendor: 1,613 bytes, line 3889
3889shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var iu=0;function au(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function ou(e){let t=new nu,n=ru(),r={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 e=0;e<9;e++)r.probe.push(new J);let i=new J,a=new Li,o=new Li;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(au);for(let e=0,y=i.length;e<y;e++){let y=i[e],b=y.color,x=y.intensity,S=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)a+=b.r*x,o+=b.g*x,s+=b.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(y.sh.coefficients[e],x);v++}else if(y.isDirectionalLight){let e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){let e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[c]=t,r.directionalShadowMap[c]=C,r.directionalShadowMatrix[c]=y.shadow.matrix,p++}r.directional[c]=e,c++}
vendor: 4,344 bytes, lines 3889-3895
3889else if(y.isSpotLight){let e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(b).multiplyScalar(x),e.distance=S,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,r.spot[u]=e;let i=y.shadow;if(y.map&&(r.spotLightMap[g]=y.map,g++,i.updateMatrices(y),y.castShadow&&_++),r.spotLightMatrix[u]=i.matrix,y.castShadow){let e=n.get(y);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[u]=e,r.spotShadowMap[u]=C,h++}u++}else if(y.isRectAreaLight){let e=t.get(y);e.color.copy(b).multiplyScalar(x),e.halfWidth.set(y.width*.5,0,0),e.halfHeight.set(0,y.height*.5,0),r.rectArea[d]=e,d++}else if(y.isPointLight){let e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){let e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[l]=t,r.pointShadowMap[l]=C,r.pointShadowMatrix[l]=y.shadow.matrix,m++}r.point[l]=e,l++}else if(y.isHemisphereLight){let e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),r.hemi[f]=e,f++}}d>0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=$.LTC_FLOAT_1,r.rectAreaLTC2=$.LTC_FLOAT_2):(r.rectAreaLTC1=$.LTC_HALF_1,r.rectAreaLTC2=$.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=iu++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t<f;t++){let f=e[t];if(f.isDirectionalLight){let e=r.directional[n];e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),n++}else if(f.isSpotLight){let e=r.spot[c];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),c++}else if(f.isRectAreaLight){let e=r.rectArea[l];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),o.identity(),a.copy(f.matrixWorld),a.premultiply(d),o.extractRotation(a),e.halfWidth.set(f.width*.5,0,0),e.halfHeight.set(0,f.height*.5,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),l++}else if(f.isPointLight){let e=r.point[s];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),s++}else if(f.isHemisphereLight){let e=r.hemi[u];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(d),u++}}}return{setup:s,setupView:c,state:r}}function su(e){let t=new ou(e),n=[],r=[];function i(e){l.camera=e,n.length=0,r.length=0}function a(e){n.push(e)}function o(e){r.push(e)}function s(){t.setup(n)}function c(e){t.setupView(n,e)}let l={lightsArray:n,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:s,setupLightsView:c,pushLight:a,pushShadow:o}}function cu(e){let t=new WeakMap;function n(n,r=0){let i=t.get(n),a;return i===void 0?(a=new su(e),t.set(n,[a])):r>=i.length?(a=new su(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var lu=`void main() { 3890 gl_Position = vec4( position, 1.0 ); 3891}`,uu=`uniform sampler2D shadow_pass; 3892uniform vec2 resolution; 3893uniform float radius; 3894#include <packing> 3895void main() {
3896 const float samples = float( VSM_SAMPLES ); 3897 float mean = 0.0; 3898 float squared_mean = 0.0; 3899 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3900 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3901 for ( float i = 0.0; i < samples; i ++ ) { 3902 float uvOffset = uvStart + i * uvStride; 3903 #ifdef HORIZONTAL_PASS 3904 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3905 mean += distribution.x; 3906 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3907 #else 3908 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3909 mean += depth; 3910 squared_mean += depth * depth; 3911 #endif 3912 } 3913 mean = mean / samples; 3914 squared_mean = squared_mean / samples; 3915 float std_dev = sqrt( squared_mean - mean * mean ); 3916 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3917}`;function du(e,t,n){let r=new zo,i=new q,a=new q,o=new ai,s=new Ho({depthPacking:_r}),c=new Uo,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new _o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new q},radius:{value:4}},vertexShader:lu,fragmentShader:uu}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new qa;m.setAttribute(`position`,new Ia(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new ao(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;c<l;c++){let l=t[c],d=l.shadow;if(d===void 0){console.warn(`THREE.WebGLShadowMap:`,l,`has no shadow.`);continue}if(d.autoUpdate===!1&&d.needsUpdate===!1)continue;i.copy(d.mapSize);let h=d.getFrameExtents();if(i.multiply(h),a.copy(d.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:rn,magFilter:rn};d.map!==null&&d.map.dispose(),d.map=new si(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e<g;e++){let t=d.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),f.viewport(o),d.updateMatrices(l,e),r=d.getFrustum(),b(n,s,d.camera,l,this.type)}d.isPointLightShadow!==!0&&this.type===3&&v(d,s),d.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(c,l,d)};function v(n,r){let a=t.update(h);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),n.mapPass===null&&(n.mapPass=new si(i.x,i.y)),f.uniforms.shadow_pass.value=n.map.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,h,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,h,null)}function y(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?c:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}
vendor: 6,339 bytes, line 3917
3917function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],d=c[u.materialIndex];if(d&&d.visible){let t=y(n,d,o,s);n.onBeforeShadow(e,n,i,a,r,t,u),e.renderBufferDirect(a,null,r,t,n,u),n.onAfterShadow(e,n,i,a,r,t,u)}}}else if(c.visible){let t=y(n,c,o,s);n.onBeforeShadow(e,n,i,a,r,t,null),e.renderBufferDirect(a,null,r,t,n,null),n.onAfterShadow(e,n,i,a,r,t,null)}}let c=n.children;for(let e=0,t=c.length;e<t;e++)b(c[e],i,a,o,s)}function x(e){e.target.removeEventListener(`dispose`,x);for(let t in l){let n=l[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}}var fu={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};function pu(e,t){function n(){let t=!1,n=new ai,r=null,i=new ai(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function r(){let n=!1,r=!1,i=null,a=null,o=null;return{setReversed:function(e){if(r!==e){let n=t.get(`EXT_clip_control`);e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;let i=o;o=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?L(e.DEPTH_TEST):R(e.DEPTH_TEST)},setMask:function(t){i!==t&&!n&&(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=fu[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(r&&(t=1-t),e.clearDepth(t),o=t)},reset:function(){n=!1,i=null,a=null,o=null,r=!1}}}function i(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(n){t||(n?L(e.STENCIL_TEST):R(e.STENCIL_TEST))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}let a=new n,o=new r,s=new i,c=new WeakMap,l=new WeakMap,u={},d={},f=new WeakMap,p=[],m=null,h=!1,g=null,_=null,v=null,y=null,b=null,x=null,S=null,C=new Z(0,0,0),w=0,T=!1,E=null,D=null,O=null,k=null,A=null,j=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),M=!1,N=0,P=e.getParameter(e.VERSION);P.indexOf(`WebGL`)===-1?P.indexOf(`OpenGL ES`)!==-1&&(N=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),M=N>=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,I={},ee=e.getParameter(e.SCISSOR_BOX),te=e.getParameter(e.VIEWPORT),ne=new ai().fromArray(ee),re=new ai().fromArray(te);function ie(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}let ae={};ae[e.TEXTURE_2D]=ie(e.TEXTURE_2D,e.TEXTURE_2D,1),ae[e.TEXTURE_CUBE_MAP]=ie(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[e.TEXTURE_2D_ARRAY]=ie(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ae[e.TEXTURE_3D]=ie(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),L(e.DEPTH_TEST),o.setFunc(3),H(!1),U(1),L(e.CULL_FACE),le(0);function L(t){u[t]!==!0&&(e.enable(t),u[t]=!0)}function R(t){u[t]!==!1&&(e.disable(t),u[t]=!1)}function oe(t,n){return d[t]===n?!1:(e.bindFramebuffer(t,n),d[t]=n,t===e.DRAW_FRAMEBUFFER&&(d[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(d[e.DRAW_FRAMEBUFFER]=n),!0)}function se(t,n){let r=p,i=!1;if(t){r=f.get(n),r===void 0&&(r=[],f.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)}function z(t){return m===t?!1:(e.useProgram(t),m=t,!0)}let ce={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};ce[103]=e.MIN,ce[104]=e.MAX;let B={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function le(t,n,r,i,a,o,s,c,l,u){if(t===0){h===!0&&(R(e.BLEND),h=!1);return}if(h===!1&&(L(e.BLEND),h=!0),t!==5){if(t!==g||u!==T){if((_!==100||b!==100)&&(e.blendEquation(e.FUNC_ADD),_=100,b=100),u)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:console.error(`THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true`);break;case 4:console.error(`THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true`);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}v=null,y=null,x=null,S=null,C.set(0,0,0),w=0,g=t,T=u}return}a||=n,o||=r,s||=i,(n!==_||a!==b)&&(e.blendEquationSeparate(ce[n],ce[a]),_=n,b=a),(r!==v||i!==y||o!==x||s!==S)&&(e.blendFuncSeparate(B[r],B[i],B[o],B[s]),v=r,y=i,x=o,S=s),(c.equals(C)===!1||l!==w)&&(e.blendColor
vendor: 10,153 bytes, line 3917
3917(c.r,c.g,c.b,l),C.copy(c),w=l),g=t,T=!1}function V(t,n){t.side===2?R(e.CULL_FACE):L(e.CULL_FACE);let r=t.side===1;n&&(r=!r),H(r),t.blending===1&&t.transparent===!1?le(0):le(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),a.setMask(t.colorWrite);let i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),W(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),t.alphaToCoverage===!0?L(e.SAMPLE_ALPHA_TO_COVERAGE):R(e.SAMPLE_ALPHA_TO_COVERAGE)}function H(t){E!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),E=t)}function U(t){t===0?R(e.CULL_FACE):(L(e.CULL_FACE),t!==D&&(t===1?e.cullFace(e.BACK):t===2?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))),D=t}function ue(t){t!==O&&(M&&e.lineWidth(t),O=t)}function W(t,n,r){t?(L(e.POLYGON_OFFSET_FILL),(k!==n||A!==r)&&(e.polygonOffset(n,r),k=n,A=r)):R(e.POLYGON_OFFSET_FILL)}function G(t){t?L(e.SCISSOR_TEST):R(e.SCISSOR_TEST)}function de(t){t===void 0&&(t=e.TEXTURE0+j-1),F!==t&&(e.activeTexture(t),F=t)}function fe(t,n,r){r===void 0&&(r=F===null?e.TEXTURE0+j-1:F);let i=I[r];i===void 0&&(i={type:void 0,texture:void 0},I[r]=i),(i.type!==t||i.texture!==n)&&(F!==r&&(e.activeTexture(r),F=r),e.bindTexture(t,n||ae[t]),i.type=t,i.texture=n)}function pe(){let t=I[F];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function me(){try{e.compressedTexImage2D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function he(){try{e.compressedTexImage3D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ge(){try{e.texSubImage2D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function _e(){try{e.texSubImage3D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ve(){try{e.compressedTexSubImage2D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ye(){try{e.compressedTexSubImage3D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function be(){try{e.texStorage2D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function xe(){try{e.texStorage3D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function Se(){try{e.texImage2D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function Ce(){try{e.texImage3D(...arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function we(t){ne.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),ne.copy(t))}function Te(t){re.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),re.copy(t))}function Ee(t,n){let r=l.get(n);r===void 0&&(r=new WeakMap,l.set(n,r));let i=r.get(t);i===void 0&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))}function De(t,n){let r=l.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))}function Oe(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),u={},F=null,I={},d={},f=new WeakMap,p=[],m=null,h=!1,g=null,_=null,v=null,y=null,b=null,x=null,S=null,C=new Z(0,0,0),w=0,T=!1,E=null,D=null,O=null,k=null,A=null,ne.set(0,0,e.canvas.width,e.canvas.height),re.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:L,disable:R,bindFramebuffer:oe,drawBuffers:se,useProgram:z,setBlending:le,setMaterial:V,setFlipSided:H,setCullFace:U,setLineWidth:ue,setPolygonOffset:W,setScissorTest:G,activeTexture:de,bindTexture:fe,unbindTexture:pe,compressedTexImage2D:me,compressedTexImage3D:he,texImage2D:Se,texImage3D:Ce,updateUBOMapping:Ee,uniformBlockBinding:De,texStorage2D:be,texStorage3D:xe,texSubImage2D:ge,texSubImage3D:_e,compressedTexSubImage2D:ve,compressedTexSubImage3D:ye,scissor:we,viewport:Te,reset:Oe}}function mu(e,t,n,r,i,a,o){let s=t.has(`WEBGL_multisampled_render_to_texture`)?t.get(`WEBGL_multisampled_render_to_texture`):null,c=typeof navigator>`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new q,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):zr(`canvas`)}function h(e,t,n){let r=1,i=fe(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?br:X.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let i=t.textures;for(let t=0,n=i.length;t<n;t++){let n=r.get(i[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),r.remove(i[t])}r.remove(t)}let D=0;function O(){D=0}function k(){let e=D;return e>=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];
vendor: 6,096 bytes, line 3917
3917return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&G(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{ae(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){L(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[en]:e.REPEAT,[tn]:e.CLAMP_TO_EDGE,[nn]:e.MIRRORED_REPEAT},I={[rn]:e.NEAREST,[an]:e.NEAREST_MIPMAP_NEAREST,[on]:e.NEAREST_MIPMAP_LINEAR,[sn]:e.LINEAR,[cn]:e.LINEAR_MIPMAP_NEAREST,[ln]:e.LINEAR_MIPMAP_LINEAR},ee={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function te(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,I[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,I[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ee[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ne(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function re(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ie(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<o.length;e++){let t=o[s],n=o[e],i=t.start+t.count,a=re(n.start,r.width,4),c=re(t.start,r.width,4);n.start<=i+1&&a===c&&re(n.start+n.count-1,r.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):(++s,o[s]=n)}o.length=s+1;let c=e.getParameter(e.UNPACK_ROW_LENGTH),l=e.getParameter(e.UNPACK_SKIP_PIXELS),u=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,s=o.length;t<s;t++){let s=o[t],c=Math.floor(s.start/4),l=Math.ceil(s.count/4),u=c%r.width,d=Math.floor(c/r.width),f=l;e.pixelStorei(e.UNPACK_SKIP_PIXELS,u),e.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,u,d,f,1,i,a,r.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,c),e.pixelStorei(e.UNPACK_SKIP_PIXELS,l),e.pixelStorei(e.UNPACK_SKIP_ROWS,u)}}function ae(t,o,s){let c=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(c=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(c=e.TEXTURE_3D);let l=ne(t,o),u=o.source;n.bindTexture(c,t.__webglTexture,e.TEXTURE0+s);let d=r.get(u);if(u.version!==d.__version||l===!0){n.activeTexture(e.TEXTURE0+s);let t=X.getPrimaries(X.workingColorSpace),r=o.colorSpace===``?null:X.getPrimaries(o.colorSpace),f=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=h(o.image,!1,i.maxTextureSize);p=de(o,p);let m=a.convert(o.format,o.colorSpace),v=a.convert(o.type),S=y(o.internalFormat,m,v,o.colorSpace,o.isVideoTexture);te(c,o);let C,w=o.mipmaps,T=o.isVideoTexture!==!0,E=d.__version===void 0||l===!0,D=u.dataReady,O=x(o,p);if(o.isDepthTexture)S=b(o.format===En,o.type),E&&(T?n.texStorage2D(e.TEXTURE_2D,1,S,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,m,v,null));else if(o.isDataTexture)if(w.length>0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t<r;t++)C=w[t],T?D&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,C.width,C.height,m,v,C.data):n.texImage2D(e.TEXTURE_2D,t,S,C.width,C.height,0,m,v,C.data);o.generateMipmaps=!1}else T?(E&&n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height),D&&ie(o,p,m,v)):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,m,v,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){T&&E&&n.texStorage3D(e.TEXTURE_2D_ARRAY,O,S,w[0].width,w[0].height,p.depth);for(let t=0,r=w.length;t<r;t++)if(C=w[t],o.format!==1023)if(m!==null)if(T){if(D)if(o.layerUpdates.size>0){let r=xs(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)
vendor: 23,994 bytes, lines 3917-3941
3917*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t<r;t++)C=w[t],o.format===1023?T?D&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,C.width,C.height,m,v,C.data):n.texImage2D(e.TEXTURE_2D,t,S,C.width,C.height,0,m,v,C.data):m===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):T?D&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,C.width,C.height,m,C.data):n.compressedTexImage2D(e.TEXTURE_2D,t,S,C.width,C.height,0,C.data)}else if(o.isDataArrayTexture)if(T){if(E&&n.texStorage3D(e.TEXTURE_2D_ARRAY,O,S,p.width,p.height,p.depth),D)if(o.layerUpdates.size>0){let t=xs(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i<O;i++)n.texImage2D(e.TEXTURE_2D,i,S,t,r,0,m,v,null),t>>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=fe(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t<r;t++)C=w[t],T?D&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m,v,C):n.texImage2D(e.TEXTURE_2D,t,S,m,v,C);o.generateMipmaps=!1}else if(T){if(E){let t=fe(p);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}D&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,m,v,p)}else n.texImage2D(e.TEXTURE_2D,0,S,m,v,p);g(o)&&_(c),d.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function L(t,o,s){if(o.image.length!==6)return;let c=ne(t,o),l=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);let u=r.get(l);if(l.version!==u.__version||c===!0){n.activeTexture(e.TEXTURE0+s);let t=X.getPrimaries(X.workingColorSpace),r=o.colorSpace===``?null:X.getPrimaries(o.colorSpace),d=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let f=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)!f&&!p?m[e]=h(o.image[e],!0,i.maxCubemapSize):m[e]=p?o.image[e].image:o.image[e],m[e]=de(o,m[e]);let v=m[0],b=a.convert(o.format,o.colorSpace),S=a.convert(o.type),C=y(o.internalFormat,b,S,o.colorSpace),w=o.isVideoTexture!==!0,T=u.__version===void 0||c===!0,E=l.dataReady,D=x(o,v);te(e.TEXTURE_CUBE_MAP,o);let O;if(f){w&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,v.width,v.height);for(let t=0;t<6;t++){O=m[t].mipmaps;for(let r=0;r<O.length;r++){let i=O[r];o.format===1023?w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,b,S,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,b,S,i.data):b===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):w?E&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,b,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,i.data)}}}else{if(O=o.mipmaps,w&&T){O.length>0&&D++;let t=fe(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r<O.length;r++){let i=O[r].image[t].image;w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,i.width,i.height,b,S,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,i.width,i.height,0,b,S,i.data)}}else{w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,b,S,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,b,S,m[t]);for(let r=0;r<O.length;r++){let i=O[r];w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,b,S,i.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,b,S,i.image[t])}}}g(o)&&_(e.TEXTURE_CUBE_MAP),u.__version=l.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function R(t,i,o,c,l,u){let d=a.convert(o.format,o.colorSpace),f=a.convert(o.type),p=y(o.internalFormat,d,f,o.colorSpace),m=r.get(i),h=r.get(o);if(h.__renderTarget=i,!m.__hasExternalTextures){let t=Math.max(1,i.width>>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),W(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ue(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function oe(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=ue(n);W(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let o=t[i],c=a.convert(o.format,o.colorSpace),l=a.convert(o.type),u=y(o.internalFormat,c,l,o.colorSpace),d=ue(n);r&&W(n)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,u,n.width,n.height):W(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function se(t,i){if(i&&i.isWebGLCubeRenderTarget)throw Error(`Depth Texture with cube render targets is not supported`);if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);let a=r.get(i.depthTexture);a.__renderTarget=i,(!a.__webglTexture||i.depthTexture.image.width!==i.width||i.depthTexture.image.height!==i.height)&&(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),j(i.depthTexture,0);let o=a.__webglTexture,c=ue(i);if(i.depthTexture.format===1026)W(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else if(i.depthTexture.format===1027)W(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0);else throw Error(`Unknown depthTexture format`)}function z(t){let i=r.get(t),a=t.isWebGLCubeRenderTarget===!0;if(i.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){let t=()=>{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?se(i.__webglFramebuffer[0],t):se(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),oe(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),oe(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function ce(t,n,i){let a=r.get(t);n!==void 0&&R(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&z(t)}function B(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<i.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<i.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=l.length;t<n;t++){let n=r.get(l[t]);n.__webglTexture===void 0&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&W(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<l.length;n++){let r=l[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);let i=a.convert(r.format,r.colorSpace),o=a.convert(r.type),c=y(r.internalFormat,i,o,r.colorSpace,t.isXRRenderTarget===!0),u=ue(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,c,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),oe(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),te(e.TEXTURE_CUBE_MAP,i);for(let n=0;n<6;n++)if(i.mipmaps&&i.mipmaps.length>0)for(let r=0;r<i.mipmaps.length;r++)R(s.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else R(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(i)&&_(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let i=0,a=l.length;i<a;i++){let a=l[i],o=r.get(a);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),te(e.TEXTURE_2D,a),R(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+i,e.TEXTURE_2D,0),g(a)&&_(e.TEXTURE_2D)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,c.__webglTexture),te(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)R(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else R(s.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);g(i)&&_(r),n.unbindTexture()}t.depthBuffer&&z(t)}function le(e){let t=e.textures;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(g(a)){let t=v(e),i=r.get(a).__webglTexture;n.bindTexture(t,i),_(t),n.unbindTexture()}}}let V=[],H=[];function U(t){if(t.samples>0){if(W(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t<i.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);let f=t.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<i.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),c===!0&&(V.length=0,H.length=0,V.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&t.resolveDepthBuffer===!1&&(V.push(l),H.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,H)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,V))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<i.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&t.resolveDepthBuffer===!1&&c){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}}function ue(e){return Math.min(i.maxSamples,e.samples)}function W(e){let n=r.get(e);return e.samples>0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function G(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function de(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(X.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function fe(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=ce,this.setupRenderTarget=B,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=U,this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=R,this.useMultisampledRTT=W}function hu(e,t){function n(n,r=``){let i,a=X.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.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(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var gu=` 3918void main() { 3919 3920 gl_Position = vec4( position, 1.0 ); 3921 3922}`,_u=` 3923uniform sampler2DArray depthColor; 3924uniform float depthWidth; 3925uniform float depthHeight; 3926 3927void main() { 3928 3929 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3930 3931 if ( coord.x >= 1.0 ) { 3932 3933 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3934 3935 } else { 3936 3937 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3938 3939 } 3940 3941}`,vu=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new ii,i=e.properties.get(r);i.__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){let t=e.cameras[0].viewport,n=new _o({vertexShader:gu,fragmentShader:_u,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ao(new Vo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},yu=class extends Tr{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new vu,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new q,x=null,S=new So;S.viewport=new ai;let C=new So;C.viewport=new ai;let w=[S,C],T=new ss,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new Ao,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new Ao,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new Ao,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e<v.length;e++){let t=y[e];t!==null&&(y[e]=null,v[e].disconnect(t))}E=null,D=null,m.reset(),e.setRenderTarget(g),f=null,d=null,u=null,r=null,_=null,te.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(g=e.getRenderTarget(),r.addEventListener(`select`,O),r.addEventListener(`selectstart`,O),r.addEventListener(`selectend`,O),r.addEventListener(`squeeze`,O),r.addEventListener(`squeezestart`,O),r.addEventListener(`squeezeend`,O),r.addEventListener(`end`,k),r.addEventListener(`inputsourceschange`,A),h.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(b),typeof XRWebGLBinding<`u`&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;h.depth&&(o=h.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=h.stencil?En:Tn,a=h.stencil?bn:hn);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=new XRWebGLBinding(r,t),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}
vendor: 5,584 bytes, line 3941
3941),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),_=new si(d.textureWidth,d.textureHeight,{format:wn,type:un,depthTexture:new Bo(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:h.stencil,colorSpace:e.outputColorSpace,samples:h.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:h.antialias,alpha:!0,depth:h.depth,stencil:h.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),_=new si(f.framebufferWidth,f.framebufferHeight,{format:wn,type:un,colorSpace:e.outputColorSpace,stencilBuffer:h.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}_.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),te.setContext(r),te.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function A(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=y.indexOf(n);r>=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=y.indexOf(n);if(r===-1){for(let e=0;e<v.length;e++)if(e>=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new J,M=new J;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e<a.length;e++)P(a[e],i);a.length===2?N(T,S,C):T.projectionMatrix.copy(S.projectionMatrix),F(e,T,i)};function F(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=Or*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return T},this.getFoveation=function(){if(!(d===null&&f===null))return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(T)};let I=null;function ee(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(_,f.framebuffer),e.setRenderTarget(_));let n=!1;t.length!==T.cameras.length&&(T.cameras.length=0,n=!0);for(let r=0;r<t.length;r++){let i=t[r],a=null;if(f!==null)a=f.getViewport(i);else{let t=u.getViewSubImage(d,i);a=t.viewport,r===0&&(e.setRenderTargetTextures(_,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(_))}let o=w[r];o===void 0&&(o=new So,o.layers.enable(r),o.viewport=new ai,w[r]=o),o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(i.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),r===0&&(T.matrix.copy(o.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),n===!0&&T.cameras.push(o)}let i=r.enabledFeatures;if(i&&i.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&u){let n=u.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&m.init(e,n,r.renderState)}}for(let e=0;e<v.length;e++){let t=y[e],n=v[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}I&&I(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let te=new Cs;te.setAnimationLoop(ee),this.setAnimationLoop=function(e){I=e},this.dispose=function(){}}},bu=new qi,xu=new Li;function Su(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,po(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isMeshBasicMaterial||t.isMeshLambertMaterial?a(e,t):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMat
vendor: 4,235 bytes, line 3941
3941capMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,bu.copy(o),bu.x*=-1,bu.y*=-1,bu.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(bu.y*=-1,bu.z*=-1),e.envMapRotation.value.setFromMatrix4(xu.makeRotationFromEuler(bu)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dis
vendor: 28,108 bytes, line 3941
3941persion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Cu(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return console.error(`THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=r.length;t<n;t++){let n=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,i=n.length;r<i;r++){let i=n[r];if(p(i,t,r,a)===!0){let t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value],r=0;for(let a=0;a<n.length;a++){let o=n[a],s=h(o);typeof o==`number`||typeof o==`boolean`?(i.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=0,i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=0,i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=0):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return typeof i==`number`||typeof i==`boolean`?r[a]=i:r[a]=i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function m(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=h(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var wu=class{constructor(e={}){let{canvas:t=Br(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=vr;let x=0,S=0,C=null,w=-1,T=null,E=new ai,D=new ai,O=null,k=new Z(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,I=new ai(0,0,j,M),ee=new ai(0,0,j,M),te=!1,ne=new zo,re=!1,ie=!1,ae=new Li,L=new Li,R=new J,oe=new ai,se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},z=!1;function ce(){return C===null?N:1}let B=n;function le(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r178`),t.addEventListener(`webglcontextlost`,je,!1),t.addEventListener(`webglcontextrestored`,Me,!1),t.addEventListener(`webglcontextcreationerror`,Ne,!1),B===null){let t=`webgl2`;if(B=le(t,e),B===null)throw le(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let V,H,U,ue,W,G,de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe;function ke(){V=new rc(B),V.init(),Ee=new hu(B,V),H=new Ms(B,V,e,Ee),U=new pu(B,V),H.reverseDepthBuffer&&d&&U.buffers.depth.setReversed(!0),ue=new oc(B),W=new Zl,G=new mu(B,V,U,W,H,Ee,ue),de=new Ps(y),fe=new nc(y),pe=new ws(B),De=new As(B,pe),me=new ic(B,pe,ue,De),he=new cc(B,me,pe,ue),Ce=new sc(B,H,G),be=new Ns(W),ge=new Xl(y,de,fe,V,H,De,be),_e=new Su(y,W),ve=new tu,ye=new cu(V),Se=new ks(y,de,fe,U,he,f,s),xe=new du(y,he,H),Oe=new Cu(B,ue,H,U),we=new js(B,V,ue),Te=new ac(B,V,ue),ue.programs=ge.programs,y.capabilities=H,y.extensions=V,y.properties=W,y.renderLists=ve,y.shadowMap=xe,y.state=U,y.info=ue}ke();let Ae=new yu(y,B);this.xr=Ae,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let e=V.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=V.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Ae.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),U.viewport(E.copy(I).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(ee)},this.setScissor=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),U.scissor(D.copy(ee).multiplyScalar(N).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(e){U.setScissorTest(te=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor(...arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=Se.getClearColor(),r=Se.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,B.clearBufferuiv(B.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,B.clearBufferiv(B.COLOR,0,m))}else r|=B.COLOR_BUFFER_BIT}t&&(r|=B.DEPTH_BUFFER_BIT),n&&(r|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B.clear(r)},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`,je,!1),t.removeEventListener(`webglcontextrestored`,Me,!1),t.removeEventListener(`webglcontextcreationerror`,Ne,!1),Se.dispose(),ve.dispose(),ye.dispose(),W.dispose(),de.dispose(),fe.dispose(),he.dispose(),De.dispose(),Oe.dispose(),ge.dispose(),Ae.dispose(),Ae.removeEventListener(`sessionstart`,Be),Ae.removeEventListener(`sessionend`,Ve),He.stop()};function je(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function Me(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=ue.autoReset,t=xe.enabled,n=xe.autoUpdate,r=xe.needsUpdate,i=xe.type;ke(),ue.autoReset=e,xe.enabled=t,xe.autoUpdate=n,xe.needsUpdate=r,xe.type=i}function Ne(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Pe(e){let t=e.target;t.removeEventListener(`dispose`,Pe),Fe(t)}function Fe(e){Ie(e),W.remove(e)}function Ie(e){let t=W.get(e).programs;t!==void 0&&(t.forEach(function(e){ge.releaseProgram(e)}),e.isShaderMaterial&&ge.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=se);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=Ze(e,t,n,r,i);U.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=me.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;De.setup(i,r,s,n,c);let h,g=we;if(c!==null&&(h=pe.get(c),g=Te,g.setIndex(h)),i.isMesh)r.wireframe===!0?(U.setLineWidth(r.wireframeLinewidth*ce()),g.setMode(B.LINES)):g.setMode(B.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),U.setLineWidth(e*ce()),i.isLineSegments?g.setMode(B.LINES):i.isLineLoop?g.setMode(B.LINE_LOOP):g.setMode(B.LINE_STRIP)}else i.isPoints?g.setMode(B.POINTS):i.isSprite&&g.setMode(B.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)Hr(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(V.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?pe.get(c).bytesPerElement:1,o=W.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(B,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function Le(e,t,n){e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,Je(e,t,n),e.side=0,e.needsUpdate=!0,Je(e,t,n),e.side=2):Je(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),g=ye.get(n),g.init(t),v.push(g),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),g.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];Le(a,n,e),r.add(a)}else Le(t,n,e),r.add(t)}),g=v.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){W.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}V.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let Re=null;function ze(e){Re&&Re(e)}function Be(){He.stop()}function Ve(){He.start()}let He=new Cs;He.setAnimationLoop(ze),typeof self<`u`&&He.setContext(self),this.setAnimationLoop=function(e){Re=e,Ae.setAnimationLoop(e),e===null?He.stop():He.start()},Ae.addEventListener(`sessionstart`,Be),Ae.addEventListener(`sessionend`,Ve),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Ae.enabled===!0&&Ae.isPresenting===!0&&(Ae.cameraAutoUpdate===!0&&Ae.updateCamera(t),t=Ae.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=ye.get(e,v.length),g.init(t),v.push(g),L.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ne.setFromProjectionMatrix(L),ie=this.localClippingEnabled,re=be.init(this.clippingPlanes,ie),h=ve.get(e,_.length),h.init(),_.push(h),Ae.enabled===!0&&Ae.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Ue(e,t,-1/0,y.sortObjects)}Ue(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),z=Ae.enabled===!1||Ae.isPresenting===!1||Ae.hasDepthSensing()===!1,z&&Se.addToRenderList(h,e),this.info.render.frame++,re===!0&&be.beginShadows();let n=g.state.shadowsArray;xe.render(n,e,t),re===!0&&be.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t<a;t++){let a=n[t];Ge(r,i,e,a)}z&&Se.render(e);for(let t=0,r=n.length;t<r;t++){let r=n[t];We(h,e,r,r.viewport)}}else i.length>0&&Ge(r,i,e,t),z&&Se.render(e),We(h,e,t);C!==null&&S===0&&(G.updateMultisampleRenderTarget(C),G.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),De.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],re===!0&&be.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Ue(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ne.intersectsSprite(e)){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(L);let t=he.update(e),i=e.material;i.visible&&h.push(e,t,i,n,oe.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ne.intersectsObject(e))){let t=he.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),oe.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),oe.copy(e.boundingSphere.center)),oe.applyMatrix4(e.matrixWorld).applyMatrix4(L)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&h.push(e,t,s,n,oe.z,o)}}else i.visible&&h.push(e,t,i,n,oe.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)Ue(i[e],t,n,r)}function We(e,t,n,r){let i=e.opaque,a=e.transmissive,o=e.transparent;g.setupLightsView(n),re===!0&&be.setGlobalState(y.clippingPlanes,n),r&&U.viewport(E.copy(r)),i.length>0&&Ke(i,t,n),a.length>0&&Ke(a,t,n),o.length>0&&Ke(o,t,n),U.buffers.depth.setTest(!0),U.buffers.depth.setMask(!0),U.buffers.color.setMask(!0),U.setPolygonOffset(!1)}function Ge(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new si(1,1,{generateMipmaps:!0,type:V.has(`EXT_color_buffer_half_float`)||V.has(`EXT_color_buffer_float`)?_n:un,minFilter:ln,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:X.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget(),c=y.getActiveCubeFace(),l=y.getActiveMipmapLevel();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),z&&Se.render(n);let u=y.toneMapping;y.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),re===!0&&be.setGlobalState(y.clippingPlanes,r),Ke(e,n,r),G.updateMultisampleRenderTarget(a),G.updateRenderTargetMipmap(a),V.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i],o=a.object,s=a.geometry,c=a.material,l=a.group;if(c.side===2&&o.layers.test(r.layers)){let t=c.side;c.side=1,c.needsUpdate=!0,qe(o,n,r,s,c,l),c.side=t,c.needsUpdate=!0,e=!0}}e===!0&&(G.updateMultisampleRenderTarget(a),G.updateRenderTargetMipmap(a))}y.setRenderTarget(s,c,l),y.setClearColor(k,A),d!==void 0&&(r.viewport=d),y.toneMapping=u}function Ke(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=a.object,s=a.geometry,c=a.group,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&qe(o,t,n,s,l,c)}}function qe(e,t,n,r,i,a){e.onBeforeRender(y,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(y,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,y.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,y.renderBufferDirect(n,t,r,i,e,a),i.side=2):y.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(y,t,n,r,i,a)}function Je(e,t,n){t.isScene!==!0&&(t=se);let r=W.get(e),i=g.state.lights,a=g.state.shadowsArray,o=i.state.version,s=ge.getParameters(e,i.state,a,t,n),c=ge.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?fe:de).get(e.envMap||r.environment),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,Pe),l=new Map,r.programs=l);let u=l.get(c);if(u!==void 0){if(r.currentProgram===u&&r.lightsStateVersion===o)return Xe(e,s),u}else s.uniforms=ge.getUniforms(e),e.onBeforeCompile(s,y),u=ge.acquireProgram(s,c),l.set(c,u),r.uniforms=s.uniforms;let d=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(d.clippingPlanes=be.uniform),Xe(e,s),r.needsLights=$e(e),r.lightsStateVersion=o,r.needsLights&&(d.ambientLightColor.value=i.state.ambient,d.lightProbe.value=i.state.probe,d.directionalLights.value=i.state.directional,d.directionalLightShadows.value=i.state.directionalShadow,d.spotLights.value=i.state.spot,d.spotLightShadows.value=i.state.spotShadow,d.rectAreaLights.value=i.state.rectArea,d.ltc_1.value=i.state.rectAreaLTC1,d.ltc_2.value=i.state.rectAreaLTC2,d.pointLights.value=i.state.point,d.pointLightShadows.value=i.state.pointShadow,d.hemisphereLights.value=i.state.hemi,d.directionalShadowMap.value=i.state.directionalShadowMap,d.directionalShadowMatrix.value=i.state.directionalShadowMatrix,d.spotShadowMap.value=i.state.spotShadowMap,d.spotLightMatrix.value=i.state.spotLightMatrix,d.spotLightMap.value=i.state.spotLightMap,d.pointShadowMap.value=i.state.pointShadowMap,d.pointShadowMatrix.value=i.state.pointShadowMatrix),r.currentProgram=u,r.uniformsList=null,u}function Ye(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=hl.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Xe(e,t){let n=W.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function Ze(e,t,n,r,i){t.isScene!==!0&&(t=se),G.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=C===null?y.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:yr,c=(r.isMeshStandardMaterial?fe:de).get(r.envMap||o),l=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,u=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=W.get(r),b=g.state.lights;if(re===!0&&(ie===!0||e!==T)){let t=e===T&&r.id===w;be.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==be.numPlanes||v.numIntersection!==be.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=Je(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(U.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){U.buffers.depth.getReversed()?(ae.copy(e.projectionMatrix),Wr(ae),Gr(ae),k.setValue(B,`projectionMatrix`,ae)):k.setValue(B,`projectionMatrix`,e.projectionMatrix),k.setValue(B,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(B,R.setFromMatrixPosition(e.matrixWorld)),H.logarithmicDepthBuffer&&k.setValue(B,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(B,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(B,i,`bindMatrix`),k.setOptional(B,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(B,`boneTexture`,e.boneTexture,G))}i.isBatchedMesh&&(k.setOptional(B,i,`batchingTexture`),k.setValue(B,`batchingTexture`,i._matricesTexture,G),k.setOptional(B,i,`batchingIdTexture`),k.setValue(B,`batchingIdTexture`,i._indirectTexture,G),k.setOptional(B,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(B,`batchingColorTexture`,i._colorsTexture,G));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&Ce.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(B,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(B,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&Qe(A,O),a&&r.fog===!0&&_e.refreshFogUniforms(A,a),_e.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),hl.upload(B,Ye(v),A,G)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(hl.upload(B,Ye(v),A,G),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(B,`center`,i.center),k.setValue(B,`modelViewMatrix`,i.modelViewMatrix),k.setValue(B,`normalMatrix`,i.normalMatrix),k.setValue(B,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Oe.update(n,S),Oe.bind(n,S)}}return S}function Qe(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function $e(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(e,t,n){let r=W.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),W.get(e.texture).__webglTexture=t,W.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=W.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0};let et=B.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){C=e,x=t,S=n;let r=!0,i=null,a=!1,o=!1;if(e){let s=W.get(e);if(s.__useDefaultFramebuffer!==void 0)U.bindFramebuffer(B.FRAMEBUFFER,null),r=!1;else if(s.__webglFramebuffer===void 0)G.setupRenderTarget(e);else if(s.__hasExternalTextures)G.rebindTextures(e,W.get(e.texture).__webglTexture,W.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(s.__boundDepthTexture!==t){if(t!==null&&W.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.`);G.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(o=!0);let l=W.get(e).__webglFramebuffer;
vendor: 4,579 bytes, line 3941
3941e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],a=!0):i=e.samples>0&&G.useMultisampledRTT(e)===!1?W.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(I).multiplyScalar(N).floor(),D.copy(ee).multiplyScalar(N).floor(),O=te;if(n!==0&&(i=et),U.bindFramebuffer(B.FRAMEBUFFER,i)&&r&&U.drawBuffers(e,i),U.viewport(E),U.scissor(D),U.setScissorTest(O),a){let r=W.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=W.get(e.texture),i=t;B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=W.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=W.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){U.bindFramebuffer(B.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!H.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!H.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),B.readPixels(t,n,r,i,Ee.convert(c),Ee.convert(l),a))}finally{let e=C===null?null:W.get(C).__webglFramebuffer;U.bindFramebuffer(B.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=W.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){U.bindFramebuffer(B.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!H.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!H.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.bufferData(B.PIXEL_PACK_BUFFER,a.byteLength,B.STREAM_READ),e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),B.readPixels(t,n,r,i,Ee.convert(l),Ee.convert(u),0);let f=C===null?null:W.get(C).__webglFramebuffer;U.bindFramebuffer(B.FRAMEBUFFER,f);let p=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await Ur(B,p,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,a),B.deleteBuffer(d),B.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;G.setTexture2D(e,0),B.copyTexSubImage2D(B.TEXTURE_2D,n,0,0,o,s,i,a),U.unbindTexture()};let tt=B.createFramebuffer(),nt=B.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(Hr(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ee.convert(t.format),_=Ee.convert(t.type),v;t.isData3DTexture?(G.setTexture3D(t,0),v=B.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(G.setTexture2DArray(t,0),v=B.TEXTURE_2D_ARRAY):(G.setTexture2D(t,0),v=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,t.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,t.unpackAlignment);let y=B.getParameter(B.UNPACK_ROW_LENGTH),b=B.getParameter(B.UNPACK_IMAGE_HEIGHT),x=B.getParameter(B.UNPACK_SKIP_PIXELS),S=B.getParameter(B.UNPACK_SKIP_ROWS),
3941C=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,h.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,h.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,l),B.pixelStorei(B.UNPACK_SKIP_ROWS,u),B.pixelStorei(B.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=W.get(e),r=W.get(t),h=W.get(n.__renderTarget),g=W.get(r.__renderTarget);U.bindFramebuffer(B.READ_FRAMEBUFFER,h.__webglFramebuffer),U.bindFramebuffer(B.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,W.get(e).__webglTexture,i,d+n),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,W.get(t).__webglTexture,a,m+n)),B.blitFramebuffer(l,u,o,s,f,p,o,s,B.DEPTH_BUFFER_BIT,B.NEAREST);U.bindFramebuffer(B.READ_FRAMEBUFFER,null),U.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||W.has(e)){let n=W.get(e),r=W.get(t);U.bindFramebuffer(B.READ_FRAMEBUFFER,tt),U.bindFramebuffer(B.DRAW_FRAMEBUFFER,nt);for(let e=0;e<c;e++)w?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,n.__webglTexture,i),T?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,r.__webglTexture,a),i===0?T?B.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):B.copyTexSubImage2D(v,a,f,p,l,u,o,s):B.blitFramebuffer(l,u,o,s,f,p,o,s,B.COLOR_BUFFER_BIT,B.NEAREST);U.bindFramebuffer(B.READ_FRAMEBUFFER,null),U.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?B.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h);B.pixelStorei(B.UNPACK_ROW_LENGTH,y),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,b),B.pixelStorei(B.UNPACK_SKIP_PIXELS,x),B.pixelStorei(B.UNPACK_SKIP_ROWS,S),B.pixelStorei(B.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&B.generateMipmap(v),U.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,r=null,i=0){return Hr(`WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.`),this.copyTextureToTexture(e,t,n,r,i)},this.initRenderTarget=function(e){W.get(e).__webglFramebuffer===void 0&&G.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?G.setTextureCube(e,0):e.isData3DTexture?G.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?G.setTexture2DArray(e,0):G.setTexture2D(e,0),U.unbindTexture()},this.resetState=function(){x=0,S=0,C=null,U.reset(),De.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return wr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=X._getDrawingBufferColorSpace(e),t.unpackColorSpace=X._getUnpackColorSpace()}};l(),y(),g();var Tu=8,Eu=` 3942varying vec2 vUv; 3943void main() { 3944 vUv = uv; 3945 gl_Position = vec4(position, 1.0); 3946} 3947`,Du=w(x({__name:`ColorBends`,props:{className:{},style:{},rotation:{default:90},speed:{default:.2},colors:{default:()=>[]},transparent:{type:Boolean,default:!0},autoRotate:{default:0},scale:{default:1},frequency:{default:1},warpStrength:{default:1},mouseInfluence:{default:1},parallax:{default:.5},noise:{default:.15},iterations:{default:1},intensity:{default:1.5},bandWidth:{default:6}},setup(e){let r=e,a=` 3948#define MAX_COLORS ${Tu} 3949uniform vec2 uCanvas; 3950uniform float uTime; 3951uniform float uSpeed; 3952uniform vec2 uRot; 3953uniform int uColorCount; 3954uniform vec3 uColors[MAX_COLORS]; 3955uniform int uTransparent; 3956uniform float uScale; 3957uniform float uFrequency; 3958uniform float uWarpStrength; 3959uniform vec2 uPointer; // in NDC [-1,1] 3960uniform float uMouseInfluence; 3961uniform float uParallax; 3962uniform float uNoise; 3963uniform int uIterations; 3964uniform float uIntensity; 3965uniform float uBandWidth; 3966varying vec2 vUv; 3967 3968void main() { 3969 float t = uTime * uSpeed; 3970 vec2 p = vUv * 2.0 - 1.0; 3971 p += uPointer * uParallax * 0.1; 3972 vec2 rp = vec2(p.x * uRot.x - p.y * uRot.y, p.x * uRot.y + p.y * uRot.x); 3973 vec2 q = vec2(rp.x * (uCanvas.x / uCanvas.y), rp.y); 3974 q /= max(uScale, 0.0001); 3975 q /= 0.5 + 0.2 * dot(q, q); 3976 q += 0.2 * cos(t) - 7.56; 3977 vec2 toward = (uPointer - rp); 3978 q += toward * uMouseInfluence * 0.2; 3979 3980 for (int j = 0; j < 5; j++) { 3981 if (j >= uIterations - 1) break; 3982 vec2 rr = sin(1.5 * (q.yx * uFrequency) + 2.0 * cos(q * uFrequency)); 3983 q += (rr - q) * 0.15; 3984 } 3985 3986 vec3 col = vec3(0.0); 3987 float a = 1.0; 3988 3989 if (uColorCount > 0) { 3990 vec2 s = q; 3991 vec3 sumCol = vec3(0.0); 3992 float cover = 0.0; 3993 for (int i = 0; i < MAX_COLORS; ++i) { 3994 if (i >= uColorCount) break; 3995 s -= 0.01; 3996 vec2 r = sin(1.5 * (s.yx * uFrequency) + 2.0 * cos(s * uFrequency)); 3997 float m0 = length(r + sin(5.0 * r.y * uFrequency - 3.0 * t + float(i)) / 4.0); 3998 float kBelow = clamp(uWarpStrength, 0.0, 1.0); 3999 float kMix = pow(kBelow, 0.3); // strong response across 0..1 4000 float gain = 1.0 + max(uWarpStrength - 1.0, 0.0); // allow >1 to amplify displacement 4001 vec2 disp = (r - s) * kBelow; 4002 vec2 warped = s + disp * gain; 4003 float m1 = length(warped + sin(5.0 * warped.y * uFrequency - 3.0 * t + float(i)) / 4.0); 4004 float m = mix(m0, m1, kMix); 4005 float w = 1.0 - exp(-uBandWidth / exp(uBandWidth * m)); 4006 sumCol += uColors[i] * w; 4007 cover = max(cover, w); 4008 } 4009 col = clamp(sumCol, 0.0, 1.0); 4010 a = uTransparent > 0 ? cover : 1.0; 4011 } else { 4012 vec2 s = q;
4013 for (int k = 0; k < 3; ++k) { 4014 s -= 0.01; 4015 vec2 r = sin(1.5 * (s.yx * uFrequency) + 2.0 * cos(s * uFrequency)); 4016 float m0 = length(r + sin(5.0 * r.y * uFrequency - 3.0 * t + float(k)) / 4.0); 4017 float kBelow = clamp(uWarpStrength, 0.0, 1.0); 4018 float kMix = pow(kBelow, 0.3); 4019 float gain = 1.0 + max(uWarpStrength - 1.0, 0.0); 4020 vec2 disp = (r - s) * kBelow; 4021 vec2 warped = s + disp * gain; 4022 float m1 = length(warped + sin(5.0 * warped.y * uFrequency - 3.0 * t + float(k)) / 4.0); 4023 float m = mix(m0, m1, kMix); 4024 col[k] = 1.0 - exp(-uBandWidth / exp(uBandWidth * m)); 4025 } 4026 a = uTransparent > 0 ? max(max(col.r, col.g), col.b) : 1.0; 4027 } 4028 4029 col *= uIntensity; 4030 4031 if (uNoise > 0.0001) { 4032 float n = fract(sin(dot(gl_FragCoord.xy + vec2(uTime), vec2(12.9898, 78.233))) * 43758.5453123); 4033 col += (n - 0.5) * uNoise; 4034 col = clamp(col, 0.0, 1.0); 4035 } 4036 4037 vec3 rgb = (uTransparent > 0) ? col * a : col; 4038 gl_FragColor = vec4(rgb, a); 4039} 4040`,o=_(null),s=_(null),l=_(null),u=_(null),f=_(null),m=_(r.rotation),h=_(r.autoRotate),g=_(new q(0,0)),v=_(new q(0,0)),y=_(8),b=null,x=()=>{let e=o.value,t=new jo,n=new os(-1,1,1,-1,0,1),i=new Vo(2,2),c=Array.from({length:Tu},()=>new J(0,0,0)),d=new _o({vertexShader:Eu,fragmentShader:a,uniforms:{uCanvas:{value:new q(1,1)},uTime:{value:0},uSpeed:{value:r.speed},uRot:{value:new q(1,0)},uColorCount:{value:0},uColors:{value:c},uTransparent:{value:+!!r.transparent},uScale:{value:r.scale},uFrequency:{value:r.frequency},uWarpStrength:{value:r.warpStrength},uPointer:{value:new q(0,0)},uMouseInfluence:{value:r.mouseInfluence},uParallax:{value:r.parallax},uNoise:{value:r.noise},uIterations:{value:r.iterations},uIntensity:{value:r.intensity},uBandWidth:{value:r.bandWidth}},premultipliedAlpha:!0,transparent:!0});u.value=d;let p=new ao(i,d);t.add(p);let _=new wu({antialias:!1,powerPreference:`high-performance`,alpha:!0});s.value=_,_.outputColorSpace=vr,_.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),_.setClearColor(0,+!r.transparent),_.domElement.style.width=`100%`,_.domElement.style.height=`100%`,_.domElement.style.display=`block`,e.appendChild(_.domElement);let x=new cs,S=()=>{let t=e.clientWidth||1,n=e.clientHeight||1;_.setSize(t,n,!1),d.uniforms.uCanvas.value.set(t,n)};if(S(),`ResizeObserver`in window){let t=new ResizeObserver(S);t.observe(e),f.value=t}else window.addEventListener(`resize`,S);let C=()=>{let e=x.getDelta(),r=x.elapsedTime;d.uniforms.uTime.value=r;let i=(m.value%360+h.value*r)*Math.PI/180,a=Math.cos(i),o=Math.sin(i);d.uniforms.uRot.value.set(a,o);let s=v.value,c=g.value,u=Math.min(1,e*y.value);s.lerp(c,u),d.uniforms.uPointer.value.copy(s),_.render(t,n),l.value=requestAnimationFrame(C)};l.value=requestAnimationFrame(C);let w=t=>{let n=e.getBoundingClientRect(),r=(t.clientX-n.left)/(n.width||1)*2-1,i=-((t.clientY-n.top)/(n.height||1)*2-1);g.value.set(r,i)};e.addEventListener(`pointermove`,w),b=()=>{l.value!==null&&cancelAnimationFrame(l.value),f.value?f.value.disconnect():window.removeEventListener(`resize`,S),i.dispose(),d.dispose(),_.dispose(),_.forceContextLoss(),_.domElement&&_.domElement.parentElement===e&&e.removeChild(_.domElement),e.removeEventListener(`pointermove`,w)}},S=()=>{let e=u.value,t=s.value;if(!e)return;m.value=r.rotation,h.value=r.autoRotate,e.uniforms.uSpeed.value=r.speed,e.uniforms.uScale.value=r.scale,e.uniforms.uFrequency.value=r.frequency,e.uniforms.uWarpStrength.value=r.warpStrength,e.uniforms.uMouseInfluence.value=r.mouseInfluence,e.uniforms.uParallax.value=r.parallax,e.uniforms.uNoise.value=r.noise,e.uniforms.uIterations.value=r.iterations,e.uniforms.uIntensity.value=r.intensity,e.uniforms.uBandWidth.value=r.bandWidth;let n=(r.colors||[]).filter(Boolean).slice(0,Tu).map(e=>{let t=e.replace(`#`,``).trim(),[n,r,i]=t.length===3?[parseInt(t[0]+t[0],16),parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16)]:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return new J(n/255,r/255,i/255)});for(let t=0;t<Tu;t++){let r=e.uniforms.uColors.value[t];r&&(t<n.length?r.copy(n[t]):r.set(0,0,0))}e.uniforms.uColorCount.value=n.length,e.uniforms.uTransparent.value=+!!r.transparent,t&&t.setClearColor(0,+!r.transparent)};return d(()=>{x(),S()}),c(()=>{b?.()}),T(()=>[r.rotation,r.autoRotate,r.speed,r.scale,r.frequency,r.warpStrength,r.mouseInfluence,r.parallax,r.noise,r.iterations,r.intensity,r.bandWidth,r.colors,r.transparent],()=>{S()},{deep:!0}),(e,a)=>(t(),n(`div`,{ref_key:`containerRef`,ref:o,class:p([`color-bends-container`,r.className]),style:i(r.style)},null,6))}}),[[`__scopeId`,`data-v-546d1140`]]);l(),y(),v(),g();var Ou={class:`kanban-anim`},ku={class:`kanban-anim__body`},Au={class:`kanban-anim__column`},ju={key:0,class:`kanban-anim__card kanban-anim__card--new`},Mu={key:0,class:`kanban-anim__detail`},Nu={class:`kanban-anim__detail-rating`},Pu=w(x({__name:`HeroKanbanAnimation`,setup(a){let s=_(`idle`),l=_(!1),f=_(0),m=_(0),g=_(!1),v=_(!1),y=_(!1),b=_(`aplikowano`),x=_(!1),S=_(!1),C=_(0),w=_(null),T=_(null),k=_(null),A={start:{x:60,y:85},cardA:{x:30,y:30},cardB:{x:30,y:30},detailText:{x:88,y:50}};function j(e){let t=w.value;if(!t)return{x:50,y:50};let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left+r.
4040width/2,a=r.top+r.height/2;return{x:(i-n.left)/n.width*100,y:(a-n.top)/n.height*100}}function M(e){let t=w.value;if(!t)return{x:50,y:50};let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+28;return{x:(i-n.left)/n.width*100,y:(a-n.top)/n.height*100}}let N=[];function P(e,t){N.push(setTimeout(t,e))}function F(){N.forEach(clearTimeout),N=[]}function I(){F(),s.value=`idle`,l.value=!1,g.value=!1,y.value=!1,b.value=`aplikowano`,x.value=!1,S.value=!1,C.value=0,v.value=!1,f.value=A.start.x,m.value=A.start.y,P(800,()=>{y.value=!0}),P(1800,()=>{l.value=!0,f.value=A.start.x,m.value=A.start.y}),P(2300,()=>{f.value=A.cardA.x,m.value=A.cardA.y}),P(3200,()=>{g.value=!0}),P(3500,()=>{if(k.value){let e=M(k.value);f.value=e.x,m.value=e.y}}),P(4600,()=>{b.value=`oferta`}),P(4900,()=>{g.value=!1}),P(6500,()=>{x.value=!0}),P(7700,()=>{f.value=A.cardB.x,m.value=A.cardB.y}),P(8900,()=>{S.value=!0}),P(9200,()=>{s.value=`detail`}),P(10300,()=>{f.value=A.detailText.x,m.value=A.detailText.y}),P(11500,()=>{if(T.value){let e=j(T.value);f.value=e.x,m.value=e.y}}),P(12700,()=>{C.value=5}),P(13e3,()=>{l.value=!1}),P(15500,()=>{v.value=!0}),P(16400,I)}return d(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){s.value=`detail`,y.value=!0,b.value=`oferta`,x.value=!0,S.value=!0,C.value=5;return}I()}),c(F),(a,c)=>(t(),n(`div`,Ou,[D(`div`,{ref_key:`frameRef`,ref:w,class:p([`kanban-anim__frame`,{"kanban-anim__frame--fadeout":v.value}])},[c[21]||=D(`div`,{class:`kanban-anim__chrome`},[D(`span`,{class:`kanban-anim__dot`}),D(`span`,{class:`kanban-anim__dot`}),D(`span`,{class:`kanban-anim__dot`})],-1),D(`div`,ku,[c[7]||=u(`<div class="kanban-anim__column" data-v-d5b500b4><span class="kanban-anim__column-title" data-v-d5b500b4>Zapisane</span><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div></div>`,1),D(`div`,Au,[c[2]||=D(`span`,{class:`kanban-anim__column-title`},`Aplikowano`,-1),e(E,{name:`kanban-anim-card`},{default:h(()=>[y.value&&b.value===`aplikowano`?(t(),n(`div`,{key:0,class:p([`kanban-anim__card kanban-anim__card--new`,{"kanban-anim__card--dragging":g.value}])},[...c[0]||=[D(`span`,{class:`kanban-anim__card-title`},`Frontend Developer (Vue.js)`,-1),D(`span`,{class:`kanban-anim__card-company`},`TechFlow Sp. z o.o.`,-1),D(`span`,{class:`kanban-anim__card-salary`},`9 000 â 13 000 PLN/mies.`,-1)]],2)):r(``,!0)]),_:1}),e(E,{name:`kanban-anim-card`},{default:h(()=>[x.value?(t(),n(`div`,{key:0,class:p([`kanban-anim__card kanban-anim__card--new`,{"kanban-anim__card--active":S.value}])},[...c[1]||=[D(`span`,{class:`kanban-anim__card-title`},`Backend Engineer (Node.js)`,-1),D(`span`,{class:`kanban-anim__card-company`},`CloudNine`,-1),D(`span`,{class:`kanban-anim__card-salary`},`15 000 â 19 000 PLN/mies.`,-1)]],2)):r(``,!0)]),_:1}),c[3]||=u(`<div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div>`,2)]),c[8]||=u(`<div class="kanban-anim__column" data-v-d5b500b4><span class="kanban-anim__column-title" data-v-d5b500b4>W toku</span><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div></div>`,1),D(`div`,{ref_key:`ofertaColumnRef`,ref:k,class:`kanban-anim__column`},[c[5]||=D(`span`,{class:`kanban-anim__column-title`},`Oferta`,-1),e(E,{name:`kanban-anim-card`},{default:h(()=>[y.value&&b.value===`oferta`?(t(),n(`div`,ju,[...c[4]||=[D(`span`,{class:`kanban-anim__card-title`},`Frontend Developer (Vue.js)`,-1),D(`span`,{class:`kanban-anim__card-company`},`TechFlow Sp. z o.o.`,-1),D(`span`,{class:`kanban-anim__card-salary`},`9 000 â 13 000 PLN/mies.`,-1)]])):r(``,!0)]),_:1}),c[6]||=u(`<div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div><div class="kanban-anim__card" data-v-d5b500b4><span class="kanban-anim__card-line kanban-anim__card-line--title" data-v-d5b500b4></span><span class="kanban-anim__card-line kanban-anim__card-line--sub" data-v-d5b500b4></span></div>`,2)],512)]),e(E,{name:`kanban-anim-detail`},{default:h(()=>[s.value===`detail`?(t(),n(`div`,Mu,[c[10]||=D(`span`,{class:`kanban-anim__detail-title`},`Backend Engineer (Node.js)`,-1),c[11]||=D(`span`,{class:`kanban-anim__detail-company`},`CloudNine`,-1),c[12]||=D(`span`,{class:`kanban-anim__detail-salary`},`15 000 â 19 000 PLN/mies.`,-1),c[13]||=D(`span`,{class:`kanban-anim__detail-label`},`Status`,-1),c[14]||=D(`div`,{class:`kanban-anim__detail-status`},`Aplikowano`,-1),c[15]||=D(`span`,{class:`kanban-anim__detail-label`}
4040,`Opis`,-1),c[16]||=D(`p`,{class:`kanban-anim__detail-desc`},` Szukamy doÅwiadczonego programisty backendowego do zespoÅu odpowiedzialnego za API i integracje. Praca zdalna, elastyczne godziny, nowoczesny stack technologiczny. `,-1),c[17]||=D(`span`,{class:`kanban-anim__detail-label`},`Historia`,-1),c[18]||=D(`div`,{class:`kanban-anim__detail-history`},[D(`div`,{class:`kanban-anim__detail-history-item`},[D(`span`,{class:`kanban-anim__detail-history-dot`}),D(`span`,{class:`kanban-anim__card-line kanban-anim__card-line--sub`})]),D(`div`,{class:`kanban-anim__detail-history-item`},[D(`span`,{class:`kanban-anim__detail-history-dot`}),D(`span`,{class:`kanban-anim__card-line kanban-anim__card-line--sub`})])],-1),c[19]||=D(`span`,{class:`kanban-anim__detail-label`},`Ocena`,-1),D(`div`,Nu,[(t(),n(O,null,o(5,e=>D(`svg`,{key:e,ref_for:!0,ref:e===5?e=>T.value=e:void 0,class:p([`kanban-anim__detail-star`,{"kanban-anim__detail-star--filled":e<=C.value}]),viewBox:`0 0 24 24`,width:`14`,height:`14`},[...c[9]||=[D(`path`,{d:`M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z`},null,-1)]],2)),64))])])):r(``,!0)]),_:1}),e(E,{name:`kanban-anim-cursor`},{default:h(()=>[l.value?(t(),n(`svg`,{key:0,class:p([`kanban-anim__cursor`,{"kanban-anim__cursor--dragging":g.value}]),style:i({left:`${f.value}%`,top:`${m.value}%`}),viewBox:`0 0 24 24`,width:`20`,height:`20`},[...c[20]||=[D(`circle`,{class:`kanban-anim__cursor-ring`,cx:`12`,cy:`12`,r:`9`,fill:`none`,"stroke-width":`1.5`},null,-1),D(`circle`,{class:`kanban-anim__cursor-dot`,cx:`12`,cy:`12`,r:`4`},null,-1)]],6)):r(``,!0)]),_:1})],2)]))}}),[[`__scopeId`,`data-v-d5b500b4`]]);l(),g();var Fu={class:`tasks-mockup`,"aria-hidden":`true`},Iu={class:`tasks-mockup__group`},Lu={class:`tasks-mockup__list`},Ru={class:`tasks-mockup__row`},zu={class:`tasks-mockup__body`},Bu={class:`tasks-mockup__title`},Vu={class:`tasks-mockup__row tasks-mockup__row--done`},Hu={class:`tasks-mockup__check tasks-mockup__check--done`},Uu=w(x({__name:`HeroTasksMockup`,setup(r){return(r,i)=>(t(),n(`div`,Fu,[i[6]||=u(`<div class="tasks-mockup__group" data-v-8eb5e8fc><div class="tasks-mockup__group-header" data-v-8eb5e8fc><span class="tasks-mockup__group-title tasks-mockup__group-title--overdue" data-v-8eb5e8fc>ZalegÅe</span><span class="tasks-mockup__group-count" data-v-8eb5e8fc>1</span></div><ul class="tasks-mockup__list" data-v-8eb5e8fc><li class="tasks-mockup__row" data-v-8eb5e8fc><span class="tasks-mockup__check" data-v-8eb5e8fc></span><span class="tasks-mockup__body" data-v-8eb5e8fc><span class="tasks-mockup__title" data-v-8eb5e8fc><span class="tasks-mockup__title-text" data-v-8eb5e8fc>WysÅaÄ portfolio do Netguru</span></span><span class="tasks-mockup__meta" data-v-8eb5e8fc>2 dni temu · Netguru â Vue Developer</span></span></li></ul></div>`,1),D(`div`,Iu,[i[5]||=D(`div`,{class:`tasks-mockup__group-header`},[D(`span`,{class:`tasks-mockup__group-title tasks-mockup__group-title--today`},`DziÅ`),D(`span`,{class:`tasks-mockup__group-count`},`3`)],-1),D(`ul`,Lu,[D(`li`,Ru,[i[2]||=D(`span`,{class:`tasks-mockup__check`},null,-1),D(`span`,zu,[D(`span`,Bu,[e(b(A),{class:`tasks-mockup__ai`,size:12}),i[0]||=D(`span`,{class:`tasks-mockup__title-text`},`OdpisaÄ rekruterce z Allegro`,-1)]),i[1]||=D(`span`,{class:`tasks-mockup__meta`},`DziÅ, 14:00 · Allegro â Senior Frontend`,-1)])]),i[4]||=u(`<li class="tasks-mockup__row" data-v-8eb5e8fc><span class="tasks-mockup__check" data-v-8eb5e8fc></span><span class="tasks-mockup__body" data-v-8eb5e8fc><span class="tasks-mockup__title" data-v-8eb5e8fc><span class="tasks-mockup__title-text" data-v-8eb5e8fc>PrzygotowaÄ pytania na rozmowÄ technicznÄ
</span></span><span class="tasks-mockup__meta" data-v-8eb5e8fc>DziÅ, 18:00 · Allegro â Senior Frontend</span></span></li>`,1),D(`li`,Vu,[D(`span`,Hu,[e(b(M),{size:12})]),i[3]||=D(`span`,{class:`tasks-mockup__body`},[D(`span`,{class:`tasks-mockup__title`},[D(`span`,{class:`tasks-mockup__title-text`},`SprawdziÄ wideÅki na NoFluffJobs`)])],-1)])])])]))}}),[[`__scopeId`,`data-v-8eb5e8fc`]]);l();var Wu={class:`stats-mockup`,"aria-hidden":`true`},Gu={class:`stats-mockup__panel`},Ku=w(x({__name:`HeroStatsMockup`,setup(r){let i=[{source:`justjoinit`,label:`JustJoin.it`,applied:19,responded:7,offers:2,responseRate:7/19,lowSample:!1}
4040,{source:`pracujpl`,label:`Pracuj.pl`,applied:15,responded:4,offers:1,responseRate:4/15,lowSample:!1},{source:`linkedin`,label:`LinkedIn`,applied:10,responded:1,offers:0,responseRate:1/10,lowSample:!1}];return(r,a)=>(t(),n(`div`,Wu,[D(`div`,Gu,[a[0]||=D(`span`,{class:`stats-mockup__title`},`SkutecznoÅÄ portali`,-1),e(se,{rows:i})])]))}}),[[`__scopeId`,`data-v-0b7ea882`]]);l(),g();var qu={class:`resume-list-mockup`,"aria-hidden":`true`},Ju={class:`resume-list-mockup__search`},Yu={class:`resume-list-mockup__list`},Xu={class:`resume-list-mockup__row`},Zu={class:`resume-list-mockup__icon`},Qu={class:`resume-list-mockup__row`},$u={class:`resume-list-mockup__icon resume-list-mockup__icon--ai`},ed={class:`resume-list-mockup__row`},td={class:`resume-list-mockup__icon`},nd=w(x({__name:`HeroResumeListMockup`,setup(r){return(r,i)=>(t(),n(`div`,qu,[D(`div`,Ju,[e(b(ae),{size:14}),i[0]||=D(`span`,{class:`resume-list-mockup__search-text`},`Szukaj CV po nazwieâ¦`,-1)]),D(`ul`,Yu,[D(`li`,Xu,[D(`span`,Zu,[e(b(P),{size:16})]),i[1]||=D(`span`,{class:`resume-list-mockup__text`},[D(`span`,{class:`resume-list-mockup__name`},`Senior Frontend Developer`),D(`span`,{class:`resume-list-mockup__meta`},`CV bazowe · 04.09.2026`)],-1)]),D(`li`,Qu,[D(`span`,$u,[e(b(A),{size:16})]),i[2]||=D(`span`,{class:`resume-list-mockup__text`},[D(`span`,{class:`resume-list-mockup__name`},`Allegro â Senior Frontend Developer`),D(`span`,{class:`resume-list-mockup__meta`},`Senior Frontend Developer @ Allegro · 04.09.2026`)],-1)]),D(`li`,ed,[D(`span`,td,[e(b(P),{size:16})]),i[3]||=D(`span`,{class:`resume-list-mockup__text`},[D(`span`,{class:`resume-list-mockup__name`},`CV ogólne â Backend`),D(`span`,{class:`resume-list-mockup__meta`},`CV bazowe · 28.08.2026`)],-1)])])]))}}),[[`__scopeId`,`data-v-f8996f9d`]]);l();var rd={class:`ai-review-mockup`,"aria-hidden":`true`},id=w(x({__name:`HeroAiReviewMockup`,setup(e){return(e,r)=>(t(),n(`div`,rd,[...r[0]||=[u(`<div class="ai-review-mockup__header" data-v-e27a3b40><span class="ai-review-mockup__brand" data-v-e27a3b40><svg class="ai-review-mockup__sparkle" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" data-v-e27a3b40><path d="M12 2l1.8 5.2L19 9l-5.2 1.8L12 16l-1.8-5.2L5 9l5.2-1.8L12 2z" data-v-e27a3b40></path><path d="M19 14l.9 2.1L22 17l-2.1.9L19 20l-.9-2.1L16 17l2.1-.9L19 14z" data-v-e27a3b40></path></svg> PrzeglÄ
d zmian AI </span><span class="ai-review-mockup__accept-all signal" data-v-e27a3b40>Zaakceptuj wszystko</span></div><div class="ai-review-mockup__card" data-v-e27a3b40><span class="ai-review-mockup__label" data-v-e27a3b40>Podsumowanie zawodowe</span><p class="ai-review-mockup__text" data-v-e27a3b40> Senior Frontend Developer z 6-letnim doÅwiadczeniem w Vue i TypeScript, skupiony na wydajnych interfejsach dla produktów SaaS. </p><div class="ai-review-mockup__footer" data-v-e27a3b40><span class="ai-review-mockup__tag" style="--tag-color:var(--accent);" data-v-e27a3b40><span class="ai-review-mockup__dot" aria-hidden="true" data-v-e27a3b40></span>Trzymaj siÄ oferty </span><div class="ai-review-mockup__actions" data-v-e27a3b40><span class="ai-review-mockup__ignore" data-v-e27a3b40>Ignoruj</span><span class="ai-review-mockup__apply signal" data-v-e27a3b40>Zastosuj</span></div></div></div><div class="ai-review-mockup__card" data-v-e27a3b40><span class="ai-review-mockup__label" data-v-e27a3b40>UmiejÄtnoÅci</span><p class="ai-review-mockup__text ai-review-mockup__text--added" data-v-e27a3b40>+ Playwright</p><div class="ai-review-mockup__footer" data-v-e27a3b40><span class="ai-review-mockup__tag" style="--tag-color:var(--status-offer);" data-v-e27a3b40><span class="ai-review-mockup__dot" aria-hidden="true" data-v-e27a3b40></span>Pokaż efekt </span><div class="ai-review-mockup__actions" data-v-e27a3b40><span class="ai-review-mockup__ignore" data-v-e27a3b40>Ignoruj</span><span class="ai-review-mockup__apply signal" data-v-e27a3b40>Zastosuj</span></div></div></div>`,3)]]))}}),[[`__scopeId`,`data-v-e27a3b40`]]);l(),g(),y();var ad={class:`hero`},od={class:`hero__content-wrap`},sd={id:`start`,class:`hero__top`},cd={class:`hero__content`},ld={class:`hero__preview`},ud={id:`jak-to-dziala`,class:`hero__steps hero__section--alt`},dd={class:`hero__tabs`},fd=[`onClick`],pd={class:`hero__step-panel`},md={key:0,class:`hero__step-panel-content`},hd={class:`hero__step-title`},gd={class:`hero__step-text`},_d={class:`hero__flow`},vd={class:`hero__flow-list`},yd={class:`hero__flow-node`},bd={class:`hero__flow-icon`},xd={class:`hero__flow-title`},Sd={class:`hero__flow-text`},Cd={key:0,class:`hero__flow-arrow`,"aria-hidden":`true`},wd={id:`funkcje`,class:`hero__features`},Td={class:`hero__features-rows`},Ed={class:`hero-feature__text`},Dd={class:`hero-feature__label`},Od={class:`hero-feature__title`},kd={class:`hero-feature__text-body`},Ad={class:`hero__highlights`},jd={class:`hero__highlights-grid`},Md={class:`hero__highlight-tag`},Nd={class:`hero__highlight-title`},Pd={class:`hero__highlight-text`},Fd={id:`cennik`,class:`hero__pricing hero__section--alt`},Id={class:`hero__pricing-grid`},Ld={class:`hero__pricing-period`},Rd={class:`hero__pricing-price`},zd={key:0,class:`hero__pricing-suffix`},Bd={class:`hero__pricing-note`},Vd={class:`hero__pricing-features`},Hd={id:`faq`,class:`hero__faq`},Ud={class:`hero__faq-list`},Wd=[`aria-expanded`,`onClick`],Gd={class:`hero__faq-answer`},Kd={class:`hero__footer-cta hero__section--alt`},qd=!0,Jd=w(x({__name:`HeroView`,setup(i){let s=ne(),c=ie();d(()=>{s.hash&&document.querySelector(s.hash)?.scrollIntoView({behavior:`smooth`})});let l=[`#3B82F6`,`#1E3A8A`],u=_(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),g=[{id:`aplikuj`,tab:`Aplikuj`,title:`Aplikuj jak zawsze`,text:`Na JustJoin.it, Pracuj.pl, NoFluffJobs, RocketJobs.pl, LinkedIn i OLX Praca rozszerzenie Åapie klikniÄcie âAplikujâ â karta ze stanowiskiem, firmÄ
i linkiem do oferty jest na tablicy, zanim zamkniesz kartÄ przeglÄ
darki. Aplikujesz gdzie indziej, na stronie firmy albo przez inny portal? Nic nie przepada: gdy firma odpisze, Krooki zaÅoży kartÄ z jej maila.`},{id:`status`,tab:`Krooki sprawdza status`,title:`Krooki sprawdza status â bez dostÄpu do Twojej skrzynki`,text:`Raz ustawiasz w Gmailu przekazywanie maili na swój adres w Krooki. Krooki nie ma dostÄpu do Twojej skrzynki â dostaje kopie maili i od razu odrzuca te, które nie dotyczÄ
rekrutacji. Z pozostaÅych czyta każdÄ
przekierowanÄ
wiadomoÅÄ i rozpoznaje, czego dotyczy: potwierdzenie, zaproszenie na rozmowÄ, odrzucenie, ofertÄ albo pytania rekrutera. Nie ma znaczenia, skÄ
d przyszedÅ mail â z portalu, systemu rekrutacyjnego firmy czy prosto od rekrutera, po polsku czy po angielsku.`},{id:`kanban`,tab:`Tablica`,title:`Wszystko na jednej tablicy`,text:`Każda rekrutacja to karta, każdy etap to kolumna â od aplikacji, przez rozmowy, po ofertÄ albo odmowÄ. Karta przesuwa siÄ sama, gdy przyjdzie mail, a przy każdej zmianie zostaje wiadomoÅÄ, która jÄ
wywoÅaÅa, wiÄc zawsze wiesz, co siÄ wydarzyÅo i kiedy. Karty przeniesiesz też rÄcznie, a filtr i wyszukiwarka znajdÄ
każdÄ
firmÄ i stanowisko.`}
4040],v=_(g[0].id),y=[{icon:k,title:`Twój Gmail`,text:`Przekazuje kopiÄ przychodzÄ
cych maili na Twój adres w Krooki. OryginaÅy zostajÄ
w skrzynce nietkniÄte.`},{icon:N,title:`Filtr Krooki`,text:`Zakupy, rachunki, newslettery odpadajÄ
od razu â ich treÅÄ nie jest zapisywana.`},{icon:j,title:`Twoja tablica`,text:`Z maili o rekrutacji Krooki bierze firmÄ, stanowisko, etap i terminy, a potem aktualizuje karty i zadania.`}],x=[{title:`Po polsku, dla polskiego rynku`,text:`Krooki zna szablony polskich portali i sposób, w jaki piszÄ
polscy rekruterzy. Z ofertami i mailami po angielsku radzi sobie tak samo.`,tag:`Lokalizacja`},{title:`Zero rÄcznego przepisywania`,text:`Karta zakÅada siÄ sama â przy aplikowaniu albo z pierwszego maila od firmy â i sama przechodzi dalej, gdy przyjdzie odpowiedź. Nie musisz pamiÄtaÄ o aktualizowaniu tablicy.`,tag:`Automatyzacja`},{title:`Twoje dane zostajÄ
Twoje`,text:`Krooki nie ma dostÄpu do Twojej skrzynki, a z przekazanych maili zapisuje tylko te o rekrutacji. Wszystkie dane usuniesz w każdej chwili w Ustawieniach.`,tag:`PrywatnoÅÄ`}],w=[{tag:`Zadania`,title:`Nic Ci nie umknie`,text:`Rekruter zaprasza na rozmowÄ, prosi o potwierdzenie terminu albo przysyÅa zadanie domowe â Krooki zamienia to w zadanie z terminem, przypiÄte do wÅaÅciwej rekrutacji. WÅasne zadania dodasz obok.`,icon:I,accent:`accent`,mockup:Uu},{tag:`Statystyki`,title:`Zobacz, co naprawdÄ dziaÅa`,text:`Lejek pokazuje, ile aplikacji koÅczy siÄ odpowiedziÄ
i ofertÄ
, a ranking portali â gdzie firmy odpisujÄ
najczÄÅciej. Kolejne CV wysyÅasz tam, gdzie to ma sens, zamiast zgadywaÄ.`,icon:re,accent:`accent`,mockup:Ku},{tag:`CV bazowe`,title:`Jedno miejsce na wszystkie wersje CV`,text:`Zbuduj CV od zera albo wgraj gotowy PDF. Krooki trzyma wszystkie Twoje wersje w jednym miejscu, gotowe do dalszego dopasowania.`,icon:P,accent:`accent`,mockup:nd},{tag:`CV dopasowane · AI`,title:`CV pod konkretnÄ
ofertÄ`,text:`Krooki przepisuje wybrane CV pod wymagania konkretnej oferty, na bazie Twojego doÅwiadczenia. PrzeglÄ
dasz każdÄ
zmianÄ i decydujesz, co zostaje.`,icon:A,accent:`accent2`,mockup:id}],T=[{q:`Czy Krooki czyta wszystkie moje maile?`,a:`Nie. Krooki nie ÅÄ
czy siÄ z TwojÄ
skrzynkÄ
â dostaje tylko kopie maili, które przekaże mu Gmail. Te niezwiÄ
zane z rekrutacjÄ
odpadajÄ
od razu na filtrze i ich treÅÄ nie jest zapisywana. JeÅli chcesz przekazywaÄ mniej, możesz dodatkowo ustawiÄ wÅasny filtr w Gmailu.`},{q:`Z jakimi portalami dziaÅa Krooki?`,a:`Z każdym, z którego firma odpisze Ci mailem. Krooki rozpoznaje maile rekrutacyjne niezależnie od tego, skÄ
d przyszÅy â z portalu, systemu rekrutacyjnego firmy czy prosto od rekrutera â i sam zakÅada kartÄ, jeÅli jeszcze jej nie ma. Rozszerzenie do Chrome dodatkowo wykrywa klikniÄcie âAplikujâ na JustJoin.it, Pracuj.pl, NoFluffJobs, RocketJobs.pl, LinkedIn i OLX Praca, wiÄc tam karta pojawia siÄ od razu, zanim firma w ogóle odpowie.`},{q:`Czy Krooki dziaÅa z innÄ
pocztÄ
niż Gmail?`,a:`Na razie nie. Logujesz siÄ kontem Google, a Krooki czyta maile rekrutacyjne przekierowane z Twojego Gmaila.`},{q:`Co jeÅli Krooki źle rozpozna maila?`,a:`KartÄ przeniesiesz rÄcznie jednym przeciÄ
gniÄciem, a w historii karty zobaczysz fragment maila, który zmieniÅ jej status â wiÄc zawsze wiesz, skÄ
d wziÄÅa siÄ zmiana.`},{q:`Czy Krooki dziaÅa na telefonie?`,a:`Tak. Tablica, zadania i statystyki dziaÅajÄ
w przeglÄ
darce na telefonie, a Krooki możesz dodaÄ do ekranu gÅównego jak zwykÅÄ
aplikacjÄ. Rozszerzenie wykrywajÄ
ce âAplikujâ dziaÅa tylko w Chrome na komputerze â statusy z maili aktualizujÄ
siÄ niezależnie od tego.`},{q:`Czy mogÄ usunÄ
Ä swoje dane?`,a:`Tak, w każdej chwili â w Ustawieniach trwale usuniesz wszystkie zapisane aplikacje.`},{q:`Czy mogÄ zrezygnowaÄ w każdej chwili?`,a:`Tak. Plan kupujesz na wybrany okres i masz dostÄp do jego koÅca â nic nie odnowi siÄ bez Twojej wiedzy.`}],E=_(null);function M(e){E.value=E.value===e?null:e}let ae=[`Nielimitowane automatyczne Åledzenie aplikacji`,`20 automatycznych aktualizacji statusu tygodniowo`,`3 CV generowane przez AI pod konkretnego pracodawcÄ (ÅÄ
cznie)`],se=[`Nielimitowane automatyczne Åledzenie aplikacji`,`Nielimitowane automatyczne aktualizacje statusu`,`20 CV generowanych przez AI pod konkretnego pracodawcÄ tygodniowo`,`Przypomnienia SMS o spotkaniach rekrutacyjnych`,`Cotygodniowe podsumowanie mailowe`],z=[{peri
4040od:`Free`,price:`0 zÅ`,suffix:``,note:`zacznij bez zobowiÄ
zaÅ`,features:ae},{period:`TydzieÅ`,price:`15 zÅ`,suffix:`/tydz`,note:`na start, bez zobowiÄ
zaÅ`,features:se},{period:`MiesiÄ
c`,price:`39 zÅ`,suffix:`/mies`,note:`najpopularniejszy wybór`,highlighted:!0,features:se},{period:`3 miesiÄ
ce`,price:`69 zÅ`,suffix:`/3 mies`,note:`najniższa cena za tydzieÅ`,features:se}];return(i,s)=>{let d=m(`RouterLink`);return t(),n(`div`,ad,[!u.value&&qd?(t(),f(Du,{key:0,class:`hero__prism`,colors:l,speed:.15,intensity:1.2})):u.value?r(``,!0):(t(),f($t,{key:1,class:`hero__prism`,"hue-shift":0,glow:.6,bloom:.6,"animation-type":`rotate`,"time-scale":.3})),D(`div`,od,[e(R),D(`section`,sd,[D(`div`,cd,[e(L,{text:`Åledź rekrutacjÄ, nie arkusz kalkulacyjny`,tag:`h1`,"class-name":`hero__title`,"split-type":`words`,duration:1.4,delay:120}),s[0]||=D(`p`,{class:`hero__subtitle`},` Aplikujesz jak zawsze, a Krooki sam zapisuje każdÄ
rekrutacjÄ i przesuwa jÄ
dalej, gdy w Twoim Gmailu pojawi siÄ odpowiedź â niezależnie od tego, gdzie aplikowaÅeÅ. `,-1),e(d,{to:{name:b(c).user?`kanban`:`login`},class:`hero__cta`},{default:h(()=>[S(C(b(c).user?`Otwórz aplikacjÄ`:`Zacznij za darmo`),1)]),_:1},8,[`to`])])]),D(`section`,ld,[e(Pu)]),s[8]||=D(`section`,{class:`hero__pain`},[D(`h2`,{class:`hero__pain-single-title`},` Masz doÅÄ codziennego przeszukiwania skrzynki w poszukiwaniu odpowiedzi od rekruterów? `),D(`p`,{class:`hero__pain-single-text`},` Przegapione zaproszenie na rozmowÄ, zapomniany termin zadania, âczy ja tam w ogóle aplikowaÅem?â â Krooki pilnuje tego za Ciebie, w tle, bez Twojego udziaÅu. `)],-1),D(`section`,ud,[s[1]||=D(`h2`,{class:`hero__section-title`},`Jak to dziaÅa`,-1),D(`div`,dd,[(t(),n(O,null,o(g,e=>D(`button`,{key:e.id,type:`button`,class:p([`hero__tab`,{"hero__tab--active":v.value===e.id}]),onClick:t=>v.value=e.id},C(e.tab),11,fd)),64))]),D(`div`,pd,[(t(),n(O,null,o(g,e=>
4040(t(),n(O,{key:e.id},[v.value===e.id?(t(),n(`div`,md,[D(`h3`,hd,C(e.title),1),D(`p`,gd,C(e.text),1)])):r(``,!0)],64))),64))])]),D(`section`,_d,[s[2]||=D(`h2`,{class:`hero__section-title`},`Co siÄ dzieje z Twoimi mailami`,-1),D(`ol`,vd,[(t(),n(O,null,o(y,(i,o)=>(t(),n(O,{key:i.title},[D(`li`,yd,[D(`span`,bd,[(t(),f(a(i.icon),{size:20}))]),D(`h3`,xd,C(i.title),1),D(`p`,Sd,C(i.text),1)]),o<y.length-1?(t(),n(`li`,Cd,[e(b(ee),{size:20})])):r(``,!0)],64))),64))]),s[3]||=D(`p`,{class:`hero__flow-note`},` Chcesz przekazywaÄ mniej? Dodaj w Gmailu wÅasny filtr. Przekazywanie wyÅÄ
czysz tam w każdej chwili. `,-1)]),D(`section`,wd,[s[4]||=D(`h2`,{class:`hero__section-title`},`CaÅy proces rekrutacji w jednym miejscu`,-1),D(`div`,Td,[(t(),n(O,null,o(w,n=>D(`div`,{key:n.title,class:`hero-feature`},[D(`div`,Ed,[D(`span`,{class:p([`hero-feature__badge`,`hero-feature__badge--${n.accent}`])},[(t(),f(a(n.icon),{size:20}))],2),D(`span`,Dd,C(n.tag),1),D(`h3`,Od,C(n.title),1),D(`p`,kd,C(n.text),1)]),e(te,{"class-name":`hero-feature__frame`,"spotlight-color":`color-mix(in srgb, var(--${n.accent}) 22%, transparent)`},{default:h(()=>[(t(),f(a(n.mockup)))]),_:2},1032,[`spotlight-color`])])),64))])]),D(`section`,Ad,[D(`div`,jd,[(t(),n(O,null,o(x,e=>D(`div`,{key:e.title,class:`hero__highlight`}
4040,[D(`span`,Md,C(e.tag),1),D(`h3`,Nd,C(e.title),1),D(`p`,Pd,C(e.text),1)])),64))])]),D(`section`,Fd,[s[5]||=D(`h2`,{class:`hero__section-title`},`Wybierz plan`,-1),D(`div`,Id,[(t(),n(O,null,o(z,e=>D(`div`,{key:e.period,class:p([`hero__pricing-card`,{"hero__pricing-card--highlighted":e.highlighted}])},[D(`span`,Ld,C(e.period),1),D(`span`,Rd,[S(C(e.price),1),e.suffix?(t(),n(`span`,zd,C(e.suffix),1)):r(``,!0)]),D(`span`,Bd,C(e.note),1),D(`ul`,Vd,[(t(!0),n(O,null,o(e.features,e=>(t(),n(`li`,{key:e},C(e),1))),128))])],2)),64))])]),D(`section`,Hd,[s[6]||=D(`h2`,{class:`hero__section-title`},`NajczÄstsze pytania`,-1),D(`div`,Ud,[(t(),n(O,null,o(T,t=>D(`div`,{key:t.q,class:`hero__faq-item`},[D(`button`,{type:`button`,class:`hero__faq-question`,"aria-expanded":E.value===t.q,onClick:e=>M(t.q)},[S(C(t.q)+` `,1),e(b(F),{class:p([`hero__faq-chevron`,{"hero__faq-chevron--open":E.value===t.q}]),size:16},null,8,[`class`])],8,Wd),D(`div`,{class:p([`hero__faq-answer-wrap`,{"hero__faq-answer-wrap--open":E.value===t.q}])},[D(`p`,Gd,C(t.a),1)],2)])),64))])]),D(`section`,Kd,[s[7]||=D(`h2`,null,`Zacznij ÅledziÄ swojÄ
rekrutacjÄ`,-1),e(d,{to:{name:b(c).user?`kanban`:`login`},class:`hero__cta hero__cta--sm`},{default:h(()=>[S(C(b(c).user?`Otwórz aplikacjÄ`:`Zacznij za darmo`),1)]),_:1},8,[`to`])]),e(oe)])])}}}),[[`__scopeId`,`data-v-ad828d2b`]]);export{Jd as default};
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.