From e011e147eace27d1770d8699c76aa57cc260aca1 Mon Sep 17 00:00:00 2001 From: Shota Matsuda Date: Fri, 10 Apr 2026 17:26:27 +0900 Subject: [PATCH 1/5] TRAANode: Add velocity node source (#32274) --- examples/jsm/tsl/display/TRAANode.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/examples/jsm/tsl/display/TRAANode.js b/examples/jsm/tsl/display/TRAANode.js index c63db7b19abbd6..19baa234c504a7 100644 --- a/examples/jsm/tsl/display/TRAANode.js +++ b/examples/jsm/tsl/display/TRAANode.js @@ -237,11 +237,20 @@ class TRAANode extends TempNode { /** * Sync the post processing stack with the TRAA node. + * * @private * @type {boolean} */ this._needsPostProcessingSync = false; + /** + * The node used to render the scene's velocity. + * + * @private + * @type {?VelocityNode} + */ + this._velocityNode = null; + } /** @@ -284,7 +293,7 @@ class TRAANode extends TempNode { this.camera.updateProjectionMatrix(); this._originalProjectionMatrix.copy( this.camera.projectionMatrix ); - velocity.setProjectionMatrix( this._originalProjectionMatrix ); + this._velocityNode.setProjectionMatrix( this._originalProjectionMatrix ); // @@ -320,7 +329,7 @@ class TRAANode extends TempNode { this.camera.clearViewOffset(); - velocity.setProjectionMatrix( null ); + this._velocityNode.setProjectionMatrix( null ); // update jitter index @@ -454,6 +463,16 @@ class TRAANode extends TempNode { } + if ( builder.context.velocity !== undefined ) { + + this._velocityNode = builder.context.velocity; + + } else { + + this._velocityNode = velocity; + + } + const currentDepthStruct = struct( { closestDepth: 'float', From bb42b15d02873ff87dce75a80ac1cc6652cd9a96 Mon Sep 17 00:00:00 2001 From: mrdoob Date: Fri, 10 Apr 2026 01:47:43 -0700 Subject: [PATCH 2/5] Added HTMLTexture (#31233) Co-authored-by: Claude Opus 4.6 (1M context) --- examples/files.json | 2 + .../jsm/interaction/InteractionManager.js | 226 ++++++++++++++++++ .../webgl_materials_texture_html.jpg | Bin 0 -> 6076 bytes .../webgpu_materials_texture_html.jpg | Bin 0 -> 6048 bytes examples/webgl_materials_texture_html.html | 175 ++++++++++++++ examples/webgpu_materials_texture_html.html | 177 ++++++++++++++ src/Three.Core.js | 1 + src/renderers/common/Textures.js | 32 ++- src/renderers/webgl/WebGLTextures.js | 60 +++++ .../webgpu/utils/WebGPUTextureUtils.js | 78 ++++++ src/textures/HTMLTexture.js | 74 ++++++ 11 files changed, 824 insertions(+), 1 deletion(-) create mode 100644 examples/jsm/interaction/InteractionManager.js create mode 100644 examples/screenshots/webgl_materials_texture_html.jpg create mode 100644 examples/screenshots/webgpu_materials_texture_html.jpg create mode 100755 examples/webgl_materials_texture_html.html create mode 100644 examples/webgpu_materials_texture_html.html create mode 100644 src/textures/HTMLTexture.js diff --git a/examples/files.json b/examples/files.json index 4cf75f535716d9..7d41857ce5a9a1 100644 --- a/examples/files.json +++ b/examples/files.json @@ -153,6 +153,7 @@ "webgl_materials_texture_anisotropy", "webgl_materials_texture_canvas", "webgl_materials_texture_filters", + "webgl_materials_texture_html", "webgl_materials_texture_manualmipmap", "webgl_materials_texture_partialupdate", "webgl_materials_texture_rotation", @@ -385,6 +386,7 @@ "webgpu_materials_lightmap", "webgpu_materials_matcap", "webgpu_materials_sss", + "webgpu_materials_texture_html", "webgpu_materials_texture_manualmipmap", "webgpu_materials_transmission", "webgpu_materials_toon", diff --git a/examples/jsm/interaction/InteractionManager.js b/examples/jsm/interaction/InteractionManager.js new file mode 100644 index 00000000000000..3bfefb0876f295 --- /dev/null +++ b/examples/jsm/interaction/InteractionManager.js @@ -0,0 +1,226 @@ +import { + Matrix4, + Vector3 +} from 'three'; + +const _pixelToLocal = new Matrix4(); +const _mvp = new Matrix4(); +const _viewport = new Matrix4(); +const _size = new Vector3(); + +/** + * Manages interaction for 3D objects independently of the scene graph. + * + * For objects with an {@link HTMLTexture}, the manager computes CSS `matrix3d` + * transforms each frame so the underlying HTML elements stay aligned with + * their meshes. Because the elements are children of the canvas, the browser + * dispatches pointer events to them natively. + * + * ```js + * const interactions = new InteractionManager(); + * interactions.connect( renderer, camera ); + * + * // Objects live anywhere in the scene graph + * scene.add( mesh ); + * + * // Register for interaction separately + * interactions.add( mesh ); + * + * // In the animation loop + * interactions.update(); + * ``` + * @three_import import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; + */ +class InteractionManager { + + constructor() { + + /** + * The registered interactive objects. + * + * @type {Array} + */ + this.objects = []; + + /** + * The canvas element. + * + * @type {?HTMLCanvasElement} + * @default null + */ + this.element = null; + + /** + * The camera used for computing the element transforms. + * + * @type {?Camera} + * @default null + */ + this.camera = null; + + this._cachedCssW = - 1; + this._cachedCssH = - 1; + + } + + /** + * Adds one or more objects to the manager. + * + * @param {...Object3D} objects - The objects to add. + * @return {this} + */ + add( ...objects ) { + + for ( const object of objects ) { + + if ( this.objects.indexOf( object ) === - 1 ) { + + this.objects.push( object ); + + } + + } + + return this; + + } + + /** + * Removes one or more objects from the manager. + * + * @param {...Object3D} objects - The objects to remove. + * @return {this} + */ + remove( ...objects ) { + + for ( const object of objects ) { + + const index = this.objects.indexOf( object ); + + if ( index !== - 1 ) { + + this.objects.splice( index, 1 ); + + } + + } + + return this; + + } + + /** + * Stores the renderer and camera needed for computing element transforms. + * + * @param {(WebGPURenderer|WebGLRenderer)} renderer - The renderer. + * @param {Camera} camera - The camera. + */ + connect( renderer, camera ) { + + this.camera = camera; + this.element = renderer.domElement; + + } + + /** + * Updates the element transforms for all registered objects. + * Call this once per frame in the animation loop. + */ + update() { + + const canvas = this.element; + const camera = this.camera; + + if ( canvas === null || camera === null ) return; + + // Viewport: NDC (-1,1) to canvas CSS pixels, Y flipped. + // Using CSS pixels (clientWidth/clientHeight) so the resulting matrix + // can be applied directly as a CSS transform without DPR conversion. + + const cssW = canvas.clientWidth; + const cssH = canvas.clientHeight; + + if ( cssW !== this._cachedCssW || cssH !== this._cachedCssH ) { + + _viewport.set( + cssW / 2, 0, 0, cssW / 2, + 0, - cssH / 2, 0, cssH / 2, + 0, 0, 1, 0, + 0, 0, 0, 1 + ); + + this._cachedCssW = cssW; + this._cachedCssH = cssH; + + } + + for ( const object of this.objects ) { + + const texture = object.material.map; + + if ( ! texture || ! texture.isHTMLTexture ) continue; + + const element = texture.image; + + if ( ! element ) continue; + + // Position at canvas origin so the CSS matrix3d maps correctly. + element.style.position = 'absolute'; + element.style.left = '0'; + element.style.top = '0'; + element.style.transformOrigin = '0 0'; + + const elemW = element.offsetWidth; + const elemH = element.offsetHeight; + + // Get mesh dimensions from geometry bounding box + + const geometry = object.geometry; + + if ( ! geometry.boundingBox ) geometry.computeBoundingBox(); + + geometry.boundingBox.getSize( _size ); + + // Map element pixel coords (0,0)-(elemW,elemH) to mesh local coords. + // Front face: top-left at (-sizeX/2, sizeY/2, maxZ), bottom-right at (sizeX/2, -sizeY/2, maxZ). + + _pixelToLocal.set( + _size.x / elemW, 0, 0, - _size.x / 2, + 0, - _size.y / elemH, 0, _size.y / 2, + 0, 0, 1, geometry.boundingBox.max.z, + 0, 0, 0, 1 + ); + + // Model-View-Projection + + _mvp.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); + _mvp.multiply( object.matrixWorld ); + _mvp.multiply( _pixelToLocal ); + + // Apply viewport + + _mvp.premultiply( _viewport ); + + // The browser performs the perspective divide (by w) when applying the matrix3d. + + element.style.transform = 'matrix3d(' + _mvp.elements.join( ',' ) + ')'; + + } + + } + + /** + * Disconnects this manager, clearing the renderer and camera references. + */ + disconnect() { + + this.camera = null; + this.element = null; + this._cachedCssW = - 1; + this._cachedCssH = - 1; + + } + +} + +export { InteractionManager }; diff --git a/examples/screenshots/webgl_materials_texture_html.jpg b/examples/screenshots/webgl_materials_texture_html.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bdf04eeaf83e52a1a4bfbb1e5cb3e016bc5bd367 GIT binary patch literal 6076 zcmeHKc~leWm;EXUDF{MDkR1X7f}+wW$`(j)Vf~HJ?&1p`sL0w40Tg7j6M+yzQZ*H99lK}djKj>IT{-zGb*d_L-+lMK_X=%B z1z@VTyO%qFAOIlj1JE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^PWf9GBj4>S+(x-mAcd5>s8=LVo ztHouKIKOa)z&9=j&vw(_86ET6n zZkgATh532^s((I9&){-Gr<-8b^LAY@{zx(7Ov*AO@PXXAQ*0qo8($e7xEtSPfBfg( zvkm9>ObKUp=uSy=OdNT;&o_b(zu^pF1%nVEsU3G=_;&f8#4$9O+b&$sr~X!Top90t zw`D;y5d}efxN({eb+Gcig}b_?HBqKEmdPp0znr6V<1RJ^$% zsFnI|Fz;RVD;II86Ej|fQS@ZXMT>r+ z8}Df8PH3?0c0j@U)5ybzj$pI{X7LPYf{b?Z>-%>|LTmBstb}sM$ literal 0 HcmV?d00001 diff --git a/examples/screenshots/webgpu_materials_texture_html.jpg b/examples/screenshots/webgpu_materials_texture_html.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c5cc282edd59bd8acd0fbd383b30f89268f2617c GIT binary patch literal 6048 zcmeHLdpuNI|6Y5xF$mMRr6ZnQUV4WRDdSgT=(L;^I>WPEtY~Cy5gmmzX6X zDK**9Z_=}*q$e-F{tSbKVXPER95;3QFLlUMK#&0A&>0va01N?w2@t}Denv53r=X!g zzcvU1i($oaD1=$FQP?nyg2kdp(I+F(dq9kUm0PfMrMUct9XRzs1;ePbS0yx7-6>Xd zuI6eQ?F>31DWx<=dF~Hd+B&3#y2i_vo0yuJTd%gUwOeDqcH^eaTeiBmx_Rx|y=O1g z+b1~Wz`@Y4Lx-b}9y=Zrd*Wnb(z){&k}v+0@^kvNjLfX;oa=Y*<==l$@UZaFv*+xR z(y|xjFKgb`*3~z>Yi#Q1vYF1j?%$MoB2FI(zj_v80BPGgonEP_>kjrg4WBZ!)B*i2hta zM`je!bU@SbAWc9ThETy^0w9BNb%qom0Vd|})87>Qxh$|~>+~EvFku?8fVW>T--^u7 z%W~~M@~+wb+G@4VPSUD5hW7K;mM&|$+2|+3Ol711Pbtwm^4)^du?f$K`Q+$Z*G$>u z_gu}(2)I3YQUMZD;m@4WS_B+v>s6cMn}?xQYZym!~WM8hYKv*C_} zsK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pvR=kbSMDJLyYM;!%Z|NLbDI9u9f@@hC6ANgsQn9<~ zQUbuea$~_ud*KP`xU6_<^F(teTzDq+(ee}c#{7NSO*Ix?ukJ^Ad6rX{vy5k03Vu^C T{~qOULT0p-`On264r%-+Sar~w literal 0 HcmV?d00001 diff --git a/examples/webgl_materials_texture_html.html b/examples/webgl_materials_texture_html.html new file mode 100755 index 00000000000000..5ba69c19536a17 --- /dev/null +++ b/examples/webgl_materials_texture_html.html @@ -0,0 +1,175 @@ + + + + three.js webgl - materials - html texture + + + + + + + +
+ three.js - webgl - HTMLTexture +
+ + + + + + + diff --git a/examples/webgpu_materials_texture_html.html b/examples/webgpu_materials_texture_html.html new file mode 100644 index 00000000000000..4b5237225129ef --- /dev/null +++ b/examples/webgpu_materials_texture_html.html @@ -0,0 +1,177 @@ + + + + three.js webgpu - materials - html texture + + + + + + + +
+ three.js - webgpu - HTMLTexture +
+ + + + + + + diff --git a/src/Three.Core.js b/src/Three.Core.js index 158f575912c4b0..534fc053df051c 100644 --- a/src/Three.Core.js +++ b/src/Three.Core.js @@ -33,6 +33,7 @@ export { CompressedArrayTexture } from './textures/CompressedArrayTexture.js'; export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js'; export { CubeTexture } from './textures/CubeTexture.js'; export { CanvasTexture } from './textures/CanvasTexture.js'; +export { HTMLTexture } from './textures/HTMLTexture.js'; export { DepthTexture } from './textures/DepthTexture.js'; export { CubeDepthTexture } from './textures/CubeDepthTexture.js'; export { ExternalTexture } from './textures/ExternalTexture.js'; diff --git a/src/renderers/common/Textures.js b/src/renderers/common/Textures.js index d4f370ea8db307..305f5f07a6ad77 100644 --- a/src/renderers/common/Textures.js +++ b/src/renderers/common/Textures.js @@ -220,6 +220,30 @@ class Textures extends DataMap { } + // Ensure HTMLTexture elements are in the canvas before measuring size. + + if ( texture.isHTMLTexture && texture.image ) { + + const canvas = this.renderer.domElement; + + if ( 'requestPaint' in canvas ) { + + if ( ! canvas.hasAttribute( 'layoutsubtree' ) ) { + + canvas.setAttribute( 'layoutsubtree', 'true' ); + + } + + if ( texture.image.parentNode !== canvas ) { + + canvas.appendChild( texture.image ); + + } + + } + + } + // const { width, height, depth } = this.getSize( texture ); @@ -390,7 +414,13 @@ class Textures extends DataMap { if ( image.image !== undefined ) image = image.image; - if ( ( typeof HTMLVideoElement !== 'undefined' ) && ( image instanceof HTMLVideoElement ) ) { + if ( texture.isHTMLTexture ) { + + target.width = image.offsetWidth || 1; + target.height = image.offsetHeight || 1; + target.depth = 1; + + } else if ( ( typeof HTMLVideoElement !== 'undefined' ) && ( image instanceof HTMLVideoElement ) ) { target.width = image.videoWidth || 1; target.height = image.videoHeight || 1; diff --git a/src/renderers/webgl/WebGLTextures.js b/src/renderers/webgl/WebGLTextures.js index 2f9f03359e5705..9ff37b9aad94c6 100644 --- a/src/renderers/webgl/WebGLTextures.js +++ b/src/renderers/webgl/WebGLTextures.js @@ -11,6 +11,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const _imageDimensions = new Vector2(); const _videoTextures = new WeakMap(); + const _htmlTextures = new Set(); let _canvas; const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source @@ -334,6 +335,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + if ( texture.isHTMLTexture ) { + + _htmlTextures.delete( texture ); + + } + } function onRenderTargetDispose( event ) { @@ -1247,6 +1254,59 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + } else if ( texture.isHTMLTexture ) { + + if ( 'texElement2D' in _gl ) { + + const canvas = _gl.canvas; + + // Ensure the canvas supports HTML-in-Canvas and the element is a child. + if ( ! canvas.hasAttribute( 'layoutsubtree' ) ) { + + canvas.setAttribute( 'layoutsubtree', 'true' ); + + } + + if ( image.parentNode !== canvas ) { + + canvas.appendChild( image ); + + // Register and set up a shared paint callback for all HTMLTextures. + _htmlTextures.add( texture ); + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of _htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + canvas.requestPaint(); + return; + + } + + const level = 0; + const internalFormat = _gl.RGBA; + const srcFormat = _gl.RGBA; + const srcType = _gl.UNSIGNED_BYTE; + + _gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); + + } + } else { // regular Texture (image, video, canvas) diff --git a/src/renderers/webgpu/utils/WebGPUTextureUtils.js b/src/renderers/webgpu/utils/WebGPUTextureUtils.js index cc452d9fefc9b3..5191db62c63ba0 100644 --- a/src/renderers/webgpu/utils/WebGPUTextureUtils.js +++ b/src/renderers/webgpu/utils/WebGPUTextureUtils.js @@ -95,6 +95,13 @@ class WebGPUTextureUtils { */ this._samplerCache = new Map(); + /** + * A set of HTMLTextures that need paint updates. + * + * @type {Set} + */ + this._htmlTextures = new Set(); + } /** @@ -357,6 +364,8 @@ class WebGPUTextureUtils { if ( textureData.msaaTexture !== undefined ) textureData.msaaTexture.destroy(); + this._htmlTextures.delete( texture ); + backend.delete( texture ); } @@ -566,6 +575,41 @@ class WebGPUTextureUtils { this._copyCubeMapToTexture( texture, textureData.texture, textureDescriptorGPU ); + } else if ( texture.isHTMLTexture ) { + + const device = this.backend.device; + const canvas = this.backend.renderer.domElement; + const image = texture.image; + + if ( typeof device.queue.copyElementImageToTexture !== 'function' ) return; + + // Set up paint callback if not already done. + if ( ! textureData.hasPaintCallback ) { + + textureData.hasPaintCallback = true; + + this._addHTMLTexture( texture ); + + // Wait for the browser to paint the element before uploading. + canvas.requestPaint(); + return; + + } + + const width = textureDescriptorGPU.size.width; + const height = textureDescriptorGPU.size.height; + + device.queue.copyElementImageToTexture( + image, width, height, + { texture: textureData.texture } + ); + + if ( texture.flipY ) { + + this._flipY( textureData.texture, textureDescriptorGPU ); + + } + } else { if ( mipmaps.length > 0 ) { @@ -654,12 +698,46 @@ class WebGPUTextureUtils { } + /** + * Registers an HTMLTexture for paint updates. + * Sets up a single shared `onpaint` handler on the canvas + * that notifies all registered HTMLTextures. + * + * @private + * @param {HTMLTexture} texture - The HTMLTexture to register. + */ + _addHTMLTexture( texture ) { + + this._htmlTextures.add( texture ); + + const canvas = this.backend.renderer.domElement; + const htmlTextures = this._htmlTextures; + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + } + /** * Frees all internal resources. */ dispose() { this._samplerCache.clear(); + this._htmlTextures.clear(); } diff --git a/src/textures/HTMLTexture.js b/src/textures/HTMLTexture.js new file mode 100644 index 00000000000000..864e9f9c94f244 --- /dev/null +++ b/src/textures/HTMLTexture.js @@ -0,0 +1,74 @@ +import { Texture } from './Texture.js'; + +/** + * Creates a texture from an HTML element. + * + * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} + * to `true` immediately and listens for the parent canvas's paint events to trigger updates. + * + * @augments Texture + */ +class HTMLTexture extends Texture { + + /** + * Constructs a new texture. + * + * @param {HTMLElement} [element] - The HTML element. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { + + super( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + this.isHTMLTexture = true; + this.generateMipmaps = false; + + this.needsUpdate = true; + + const parent = element ? element.parentNode : null; + + if ( parent !== null && 'requestPaint' in parent ) { + + parent.onpaint = () => { + + this.needsUpdate = true; + + }; + + parent.requestPaint(); + + } + + } + + dispose() { + + const parent = this.image ? this.image.parentNode : null; + + if ( parent !== null && 'onpaint' in parent ) { + + parent.onpaint = null; + + } + + super.dispose(); + + } + +} + +export { HTMLTexture }; From d8dcddb7448f02ba46c9cb91810194d4b385e4a2 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 10 Apr 2026 17:49:30 +0900 Subject: [PATCH 3/5] Updated builds. --- build/three.cjs | 132 ++++++++++++++++++++++++++++++++ build/three.core.js | 73 +++++++++++++++++- build/three.core.min.js | 2 +- build/three.module.js | 62 ++++++++++++++- build/three.module.min.js | 2 +- build/three.webgpu.js | 112 ++++++++++++++++++++++++++- build/three.webgpu.min.js | 2 +- build/three.webgpu.nodes.js | 112 ++++++++++++++++++++++++++- build/three.webgpu.nodes.min.js | 2 +- 9 files changed, 489 insertions(+), 10 deletions(-) diff --git a/build/three.cjs b/build/three.cjs index 5f1ab52f32e24c..fbda092404baf5 100644 --- a/build/three.cjs +++ b/build/three.cjs @@ -28850,6 +28850,77 @@ class CanvasTexture extends Texture { } +/** + * Creates a texture from an HTML element. + * + * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} + * to `true` immediately and listens for the parent canvas's paint events to trigger updates. + * + * @augments Texture + */ +class HTMLTexture extends Texture { + + /** + * Constructs a new texture. + * + * @param {HTMLElement} [element] - The HTML element. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { + + super( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + this.isHTMLTexture = true; + this.generateMipmaps = false; + + this.needsUpdate = true; + + const parent = element ? element.parentNode : null; + + if ( parent !== null && 'requestPaint' in parent ) { + + parent.onpaint = () => { + + this.needsUpdate = true; + + }; + + parent.requestPaint(); + + } + + } + + dispose() { + + const parent = this.image ? this.image.parentNode : null; + + if ( parent !== null && 'onpaint' in parent ) { + + parent.onpaint = null; + + } + + super.dispose(); + + } + +} + /** * This class can be used to automatically save the depth information of a * rendering into a texture. @@ -70577,6 +70648,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const _imageDimensions = new Vector2(); const _videoTextures = new WeakMap(); + const _htmlTextures = new Set(); let _canvas; const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source @@ -70900,6 +70972,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + if ( texture.isHTMLTexture ) { + + _htmlTextures.delete( texture ); + + } + } function onRenderTargetDispose( event ) { @@ -71813,6 +71891,59 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + } else if ( texture.isHTMLTexture ) { + + if ( 'texElement2D' in _gl ) { + + const canvas = _gl.canvas; + + // Ensure the canvas supports HTML-in-Canvas and the element is a child. + if ( ! canvas.hasAttribute( 'layoutsubtree' ) ) { + + canvas.setAttribute( 'layoutsubtree', 'true' ); + + } + + if ( image.parentNode !== canvas ) { + + canvas.appendChild( image ); + + // Register and set up a shared paint callback for all HTMLTextures. + _htmlTextures.add( texture ); + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of _htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + canvas.requestPaint(); + return; + + } + + const level = 0; + const internalFormat = _gl.RGBA; + const srcFormat = _gl.RGBA; + const srcType = _gl.UNSIGNED_BYTE; + + _gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); + + } + } else { // regular Texture (image, video, canvas) @@ -79141,6 +79272,7 @@ exports.GreaterEqualStencilFunc = GreaterEqualStencilFunc; exports.GreaterStencilFunc = GreaterStencilFunc; exports.GridHelper = GridHelper; exports.Group = Group; +exports.HTMLTexture = HTMLTexture; exports.HalfFloatType = HalfFloatType; exports.HemisphereLight = HemisphereLight; exports.HemisphereLightHelper = HemisphereLightHelper; diff --git a/build/three.core.js b/build/three.core.js index e0c805d38b11c5..4fffe356a1e2d4 100644 --- a/build/three.core.js +++ b/build/three.core.js @@ -28870,6 +28870,77 @@ class CanvasTexture extends Texture { } +/** + * Creates a texture from an HTML element. + * + * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} + * to `true` immediately and listens for the parent canvas's paint events to trigger updates. + * + * @augments Texture + */ +class HTMLTexture extends Texture { + + /** + * Constructs a new texture. + * + * @param {HTMLElement} [element] - The HTML element. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { + + super( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + this.isHTMLTexture = true; + this.generateMipmaps = false; + + this.needsUpdate = true; + + const parent = element ? element.parentNode : null; + + if ( parent !== null && 'requestPaint' in parent ) { + + parent.onpaint = () => { + + this.needsUpdate = true; + + }; + + parent.requestPaint(); + + } + + } + + dispose() { + + const parent = this.image ? this.image.parentNode : null; + + if ( parent !== null && 'onpaint' in parent ) { + + parent.onpaint = null; + + } + + super.dispose(); + + } + +} + /** * This class can be used to automatically save the depth information of a * rendering into a texture. @@ -59628,4 +59699,4 @@ if ( typeof window !== 'undefined' ) { } -export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, setConsoleFunction, warn, warnOnce, yieldToMain }; +export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, setConsoleFunction, warn, warnOnce, yieldToMain }; diff --git a/build/three.core.min.js b/build/three.core.min.js index ff8ddb6ee4c110..6b7f1d07a4a991 100644 --- a/build/three.core.min.js +++ b/build/three.core.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -const t="184dev",e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},i={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=0,r=1,n=2,a=3,o=0,h=1,l=2,c=3,u=0,d=1,p=2,m=0,y=1,g=2,f=3,x=4,b=5,v=6,w=100,M=101,S=102,_=103,A=104,T=200,z=201,C=202,I=203,B=204,k=205,O=206,P=207,R=208,N=209,V=210,E=211,F=212,L=213,j=214,D=0,U=1,W=2,J=3,q=4,X=5,Y=6,H=7,Z=0,G=1,$=2,Q=0,K=1,tt=2,et=3,it=4,st=5,rt=6,nt=7,at="attached",ot="detached",ht=300,lt=301,ct=302,ut=303,dt=304,pt=306,mt=1e3,yt=1001,gt=1002,ft=1003,xt=1004,bt=1004,vt=1005,wt=1005,Mt=1006,St=1007,_t=1007,At=1008,Tt=1008,zt=1009,Ct=1010,It=1011,Bt=1012,kt=1013,Ot=1014,Pt=1015,Rt=1016,Nt=1017,Vt=1018,Et=1020,Ft=35902,Lt=35899,jt=1021,Dt=1022,Ut=1023,Wt=1026,Jt=1027,qt=1028,Xt=1029,Yt=1030,Ht=1031,Zt=1032,Gt=1033,$t=33776,Qt=33777,Kt=33778,te=33779,ee=35840,ie=35841,se=35842,re=35843,ne=36196,ae=37492,oe=37496,he=37488,le=37489,ce=37490,ue=37491,de=37808,pe=37809,me=37810,ye=37811,ge=37812,fe=37813,xe=37814,be=37815,ve=37816,we=37817,Me=37818,Se=37819,_e=37820,Ae=37821,Te=36492,ze=36494,Ce=36495,Ie=36283,Be=36284,ke=36285,Oe=36286,Pe=2200,Re=2201,Ne=2202,Ve=2300,Ee=2301,Fe=2302,Le=2303,je=2400,De=2401,Ue=2402,We=2500,Je=2501,qe=0,Xe=1,Ye=2,He=3200,Ze=3201,Ge=3202,$e=3203,Qe=0,Ke=1,ti="",ei="srgb",ii="srgb-linear",si="linear",ri="srgb",ni="",ai="rg",oi="ga",hi=0,li=7680,ci=7681,ui=7682,di=7683,pi=34055,mi=34056,yi=5386,gi=512,fi=513,xi=514,bi=515,vi=516,wi=517,Mi=518,Si=519,_i=512,Ai=513,Ti=514,zi=515,Ci=516,Ii=517,Bi=518,ki=519,Oi=35044,Pi=35048,Ri=35040,Ni=35045,Vi=35049,Ei=35041,Fi=35046,Li=35050,ji=35042,Di="100",Ui="300 es",Wi=2e3,Ji=2001,qi={COMPUTE:"compute",RENDER:"render"},Xi={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Yi={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Hi={TEXTURE_COMPARE:"depthTextureCompare"};const Zi={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Gi(t,e){return new Zi[t](e)}function $i(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Qi(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ki(){const t=Qi("canvas");return t.style.display="block",t}const ts={};let es=null;function is(t){es=t}function ss(){return es}function rs(...t){const e="THREE."+t.shift();es?es("log",e,...t):console.log(e,...t)}function ns(t){const e=t[0];if("string"==typeof e&&e.startsWith("TSL:")){const e=t[1];e&&e.isStackTrace?t[0]+=" "+e.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function as(...t){const e="THREE."+(t=ns(t)).shift();if(es)es("warn",e,...t);else{const i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function os(...t){const e="THREE."+(t=ns(t)).shift();if(es)es("error",e,...t);else{const i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function hs(...t){const e=t.join(" ");e in ts||(ts[e]=!0,as(...t))}function ls(){return"undefined"!=typeof self&&void 0!==self.scheduler&&void 0!==self.scheduler.yield?self.scheduler.yield():new Promise(t=>{requestAnimationFrame(t)})}function cs(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}const us={[D]:1,[W]:6,[q]:7,[J]:5,[U]:0,[Y]:2,[H]:4,[X]:3};class ds{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const s=i[t];if(void 0!==s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,s=e.length;i>8&255]+ps[t>>16&255]+ps[t>>24&255]+"-"+ps[255&e]+ps[e>>8&255]+"-"+ps[e>>16&15|64]+ps[e>>24&255]+"-"+ps[63&i|128]+ps[i>>8&255]+"-"+ps[i>>16&255]+ps[i>>24&255]+ps[255&s]+ps[s>>8&255]+ps[s>>16&255]+ps[s>>24&255]).toLowerCase()}function xs(t,e,i){return Math.max(e,Math.min(i,t))}function bs(t,e){return(t%e+e)%e}function vs(t,e,i){return(1-i)*t+i*e}function ws(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ms(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ss={DEG2RAD:ys,RAD2DEG:gs,generateUUID:fs,clamp:xs,euclideanModulo:bs,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:vs,damp:function(t,e,i,s){return vs(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(bs(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(ms=t);let e=ms+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ys},radToDeg:function(t){return t*gs},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){const n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),c=a((e+s)/2),u=n((e-s)/2),d=a((e-s)/2),p=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*c,h*u,h*d,o*l);break;case"YZY":t.set(h*d,o*c,h*u,o*l);break;case"ZXZ":t.set(h*u,h*d,o*c,o*l);break;case"XZX":t.set(o*c,h*m,h*p,o*l);break;case"YXY":t.set(h*p,o*c,h*m,o*l);break;case"ZYZ":t.set(h*m,h*p,o*c,o*l);break;default:as("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Ms,denormalize:ws};class _s{static{_s.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=xs(this.x,t.x,e.x),this.y=xs(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=xs(this.x,t,e),this.y=xs(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(xs(i,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(xs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class As{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],c=i[s+3],u=r[n+0],d=r[n+1],p=r[n+2],m=r[n+3];if(c!==m||o!==u||h!==d||l!==p){let t=o*u+h*d+l*p+c*m;t<0&&(u=-u,d=-d,p=-p,m=-m,t=-t);let e=1-a;if(t<.9995){const i=Math.acos(t),s=Math.sin(i);e=Math.sin(e*i)/s,o=o*e+u*(a=Math.sin(a*i)/s),h=h*e+d*a,l=l*e+p*a,c=c*e+m*a}else{o=o*e+u*a,h=h*e+d*a,l=l*e+p*a,c=c*e+m*a;const t=1/Math.sqrt(o*o+h*h+l*l+c*c);o*=t,h*=t,l*=t,c*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,s,r,n){const a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],c=r[n],u=r[n+1],d=r[n+2],p=r[n+3];return t[e]=a*p+l*c+o*d-h*u,t[e+1]=o*p+l*u+h*c-a*d,t[e+2]=h*p+l*d+a*u-o*c,t[e+3]=l*p-a*c-o*u-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),c=a(r/2),u=o(i/2),d=o(s/2),p=o(r/2);switch(n){case"XYZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"YXZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"ZXY":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"ZYX":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"YZX":this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p;break;case"XZY":this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p;break;default:as("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],c=e[10],u=i+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>c){const t=2*Math.sqrt(1+i-a-c);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>c){const t=2*Math.sqrt(1+a-i-c);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+c-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xs(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){const t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ts{static{Ts.prototype.isVector3=!0}constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Cs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Cs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),c=2*(r*i-n*e);return this.x=e+o*h+n*c-a*l,this.y=i+o*l+a*h-r*c,this.z=s+o*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=xs(this.x,t.x,e.x),this.y=xs(this.y,t.y,e.y),this.z=xs(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=xs(this.x,t,e),this.y=xs(this.y,t,e),this.z=xs(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(xs(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return zs.copy(this).projectOnVector(t),this.sub(zs)}reflect(t){return this.sub(zs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(xs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const zs=new Ts,Cs=new As;class Is{static{Is.prototype.isMatrix3=!0}constructor(t,e,i,s,r,n,a,o,h){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){const l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],c=i[7],u=i[2],d=i[5],p=i[8],m=s[0],y=s[3],g=s[6],f=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*f+o*v,r[3]=n*y+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*f+c*v,r[4]=h*y+l*x+c*w,r[7]=h*g+l*b+c*M,r[2]=u*m+d*f+p*v,r[5]=u*y+d*x+p*w,r[8]=u*g+d*b+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=l*n-a*h,u=a*o-l*r,d=h*r-n*o,p=e*c+i*u+s*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=u*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=d*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,a){const o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Bs.makeScale(t,e)),this}rotate(t){return this.premultiply(Bs.makeRotation(-t)),this}translate(t,e){return this.premultiply(Bs.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Bs=new Is,ks=(new Is).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Os=(new Is).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ps(){const t={enabled:!0,workingColorSpace:ii,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===ri&&(t.r=Ns(t.r),t.g=Ns(t.g),t.b=Ns(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===ri&&(t.r=Vs(t.r),t.g=Vs(t.g),t.b=Vs(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?si:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,i){return hs("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,i)},toWorkingColorSpace:function(e,i){return hs("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,i)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],s=[.3127,.329];return t.define({[ii]:{primaries:e,whitePoint:s,transfer:si,toXYZ:ks,fromXYZ:Os,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:ei},outputColorSpaceConfig:{drawingBufferColorSpace:ei}},[ei]:{primaries:e,whitePoint:s,transfer:ri,toXYZ:ks,fromXYZ:Os,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:ei}}}),t}const Rs=Ps();function Ns(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Vs(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Es;class Fs{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Es&&(Es=Qi("canvas")),Es.width=t.width,Es.height=t.height;const e=Es.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Es}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Qi("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;t1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ws).x}get height(){return this.source.getSize(Ws).y}get depth(){return this.source.getSize(Ws).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(void 0===i){as(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const s=this[e];void 0!==s?s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i:as(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ht)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case mt:t.x=t.x-Math.floor(t.x);break;case yt:t.x=t.x<0?0:1;break;case gt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case mt:t.y=t.y-Math.floor(t.y);break;case yt:t.y=t.y<0?0:1;break;case gt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Js.DEFAULT_IMAGE=null,Js.DEFAULT_MAPPING=ht,Js.DEFAULT_ANISOTROPY=1;class qs{static{qs.prototype.isVector4=!0}constructor(t=0,e=0,i=0,s=1){this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r;const n=.01,a=.1,o=t.elements,h=o[0],l=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],y=o[6],g=o[10];if(Math.abs(l-u)o&&t>f?tf?o1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),null!==this.pivot&&(s.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e0){s.children=[];for(let e=0;e0){s.animations=[];for(let e=0;e0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),c.length>0&&(i.nodes=c)}return i.object=s,i;function n(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=null!==t.pivot?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;eo+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=o-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(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,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:t,target:this})));null!==a&&(s=e.getPose(t.targetRaySpace,i),null===s&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(zr)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new Tr;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}const Ir={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},Br={h:0,s:0,l:0},kr={h:0,s:0,l:0};function Or(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Pr{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ei){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Rs.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=Rs.workingColorSpace){return this.r=t,this.g=e,this.b=i,Rs.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=Rs.workingColorSpace){if(t=bs(t,1),e=xs(e,0,1),i=xs(i,0,1),0===e)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=Or(r,s,t+1/3),this.g=Or(r,s,t),this.b=Or(r,s,t-1/3)}return Rs.colorSpaceToWorking(this,s),this}setStyle(t,e=ei){function i(e){void 0!==e&&parseFloat(e)<1&&as("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=s[1],a=s[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:as("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=s[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);as("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ei){const i=Ir[t.toLowerCase()];return void 0!==i?this.setHex(i,e):as("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ns(t.r),this.g=Ns(t.g),this.b=Ns(t.b),this}copyLinearToSRGB(t){return this.r=Vs(t.r),this.g=Vs(t.g),this.b=Vs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ei){return Rs.workingToColorSpace(Rr.copy(this),t),65536*Math.round(xs(255*Rr.r,0,255))+256*Math.round(xs(255*Rr.g,0,255))+Math.round(xs(255*Rr.b,0,255))}getHexString(t=ei){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rs.workingColorSpace){Rs.workingToColorSpace(Rr.copy(this),e);const i=Rr.r,s=Rr.g,r=Rr.b,n=Math.max(i,s,r),a=Math.min(i,s,r);let o,h;const l=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=l<=.5?t/(n+a):t/(2-n-a),n){case i:o=(s-r)/t+(s0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}const Fr=new Ts,Lr=new Ts,jr=new Ts,Dr=new Ts,Ur=new Ts,Wr=new Ts,Jr=new Ts,qr=new Ts,Xr=new Ts,Yr=new Ts,Hr=new qs,Zr=new qs,Gr=new qs;class $r{constructor(t=new Ts,e=new Ts,i=new Ts){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Fr.subVectors(t,e),s.cross(Fr);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){Fr.subVectors(s,e),Lr.subVectors(i,e),jr.subVectors(t,e);const n=Fr.dot(Fr),a=Fr.dot(Lr),o=Fr.dot(jr),h=Lr.dot(Lr),l=Lr.dot(jr),c=n*h-a*a;if(0===c)return r.set(0,0,0),null;const u=1/c,d=(h*o-a*l)*u,p=(n*l-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,Dr)&&(Dr.x>=0&&Dr.y>=0&&Dr.x+Dr.y<=1)}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,Dr)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Dr.x),o.addScaledVector(n,Dr.y),o.addScaledVector(a,Dr.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return Hr.setScalar(0),Zr.setScalar(0),Gr.setScalar(0),Hr.fromBufferAttribute(t,e),Zr.fromBufferAttribute(t,i),Gr.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(Hr,r.x),n.addScaledVector(Zr,r.y),n.addScaledVector(Gr,r.z),n}static isFrontFacing(t,e,i,s){return Fr.subVectors(i,e),Lr.subVectors(t,e),Fr.cross(Lr).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Fr.subVectors(this.c,this.b),Lr.subVectors(this.a,this.b),.5*Fr.cross(Lr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return $r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return $r.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return $r.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return $r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return $r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,r=this.c;let n,a;Ur.subVectors(s,i),Wr.subVectors(r,i),qr.subVectors(t,i);const o=Ur.dot(qr),h=Wr.dot(qr);if(o<=0&&h<=0)return e.copy(i);Xr.subVectors(t,s);const l=Ur.dot(Xr),c=Wr.dot(Xr);if(l>=0&&c<=l)return e.copy(s);const u=o*c-l*h;if(u<=0&&o>=0&&l<=0)return n=o/(o-l),e.copy(i).addScaledVector(Ur,n);Yr.subVectors(t,r);const d=Ur.dot(Yr),p=Wr.dot(Yr);if(p>=0&&d<=p)return e.copy(r);const m=d*h-o*p;if(m<=0&&h>=0&&p<=0)return a=h/(h-p),e.copy(i).addScaledVector(Wr,a);const y=l*p-d*c;if(y<=0&&c-l>=0&&d-p>=0)return Jr.subVectors(r,s),a=(c-l)/(c-l+(d-p)),e.copy(s).addScaledVector(Jr,a);const g=1/(y+m+u);return n=m*g,a=u*g,e.copy(i).addScaledVector(Ur,n).addScaledVector(Wr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class Qr{constructor(t=new Ts(1/0,1/0,1/0),e=new Ts(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tn),tn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ln),cn.subVectors(this.max,ln),sn.subVectors(t.a,ln),rn.subVectors(t.b,ln),nn.subVectors(t.c,ln),an.subVectors(rn,sn),on.subVectors(nn,rn),hn.subVectors(sn,nn);let e=[0,-an.z,an.y,0,-on.z,on.y,0,-hn.z,hn.y,an.z,0,-an.x,on.z,0,-on.x,hn.z,0,-hn.x,-an.y,an.x,0,-on.y,on.x,0,-hn.y,hn.x,0];return!!pn(e,sn,rn,nn,cn)&&(e=[1,0,0,0,1,0,0,0,1],!!pn(e,sn,rn,nn,cn)&&(un.crossVectors(an,on),e=[un.x,un.y,un.z],pn(e,sn,rn,nn,cn)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tn).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Kr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kr)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Kr=[new Ts,new Ts,new Ts,new Ts,new Ts,new Ts,new Ts,new Ts],tn=new Ts,en=new Qr,sn=new Ts,rn=new Ts,nn=new Ts,an=new Ts,on=new Ts,hn=new Ts,ln=new Ts,cn=new Ts,un=new Ts,dn=new Ts;function pn(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){dn.fromArray(t,n);const a=r.x*Math.abs(dn.x)+r.y*Math.abs(dn.y)+r.z*Math.abs(dn.z),o=e.dot(dn),h=i.dot(dn),l=s.dot(dn);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const mn=yn();function yn(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;!(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}function gn(t){Math.abs(t)>65504&&as("DataUtils.toHalfFloat(): Value out of range."),t=xs(t,-65504,65504),mn.floatView[0]=t;const e=mn.uint32View[0],i=e>>23&511;return mn.baseTable[i]+((8388607&e)>>mn.shiftTable[i])}function fn(t){const e=t>>10;return mn.uint32View[0]=mn.mantissaTable[mn.offsetTable[e]+(1023&t)]+mn.exponentTable[e],mn.floatView[0]}class xn{static toHalfFloat(t){return gn(t)}static fromHalfFloat(t){return fn(t)}}const bn=new Ts,vn=new _s;let wn=0;class Mn extends ds{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:wn++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=Oi,this.updateRanges=[],this.gpuType=Pt,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Pn.subVectors(t,this.center);const e=Pn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Pn,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Rn.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Pn.copy(t.center).add(Rn)),this.expandByPoint(Pn.copy(t.center).sub(Rn))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let Vn=0;const En=new Qs,Fn=new Ar,Ln=new Ts,jn=new Qr,Dn=new Qr,Un=new Ts;class Wn extends ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vn++}),this.uuid=fs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?In:zn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Is).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const s=this.attributes.tangent;return void 0!==s&&(s.transformDirection(t),s.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return En.makeRotationFromQuaternion(t),this.applyMatrix4(En),this}rotateX(t){return En.makeRotationX(t),this.applyMatrix4(En),this}rotateY(t){return En.makeRotationY(t),this.applyMatrix4(En),this}rotateZ(t){return En.makeRotationZ(t),this.applyMatrix4(En),this}translate(t,e,i){return En.makeTranslation(t,e,i),this.applyMatrix4(En),this}scale(t,e,i){return En.makeScale(t,e,i),this.applyMatrix4(En),this}lookAt(t){return Fn.lookAt(t),Fn.updateMatrix(),this.applyMatrix4(Fn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ln).negate(),this.translate(Ln.x,Ln.y,Ln.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,s=t.length;ie.count&&as("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return os("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Ts(-1/0,-1/0,-1/0),new Ts(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const s=i[e];t.data.attributes[e]=s.toJSON(t.data)}const s={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const s=t.attributes;for(const t in s){const i=s[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],s=r[t];for(let t=0,r=s.length;t0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){as(`Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];void 0!==s?s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i:as(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==li&&(i.stencilFail=this.stencilFail),this.stencilZFail!==li&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==li&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Gn extends Zn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Pr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const $n=new Ts,Qn=new Ts,Kn=new Ts,ta=new _s,ea=new _s,ia=new Qs,sa=new Ts,ra=new Ts,na=new Ts,aa=new _s,oa=new _s,ha=new _s;class la extends Ar{constructor(t=new Gn){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Yn){Yn=new Wn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Jn(t,5);Yn.setIndex([0,1,2,0,2,3]),Yn.setAttribute("position",new Xn(e,3,0,!1)),Yn.setAttribute("uv",new Xn(e,2,3,!1))}this.geometry=Yn,this.material=t,this.center=new _s(.5,.5),this.count=1}raycast(t,e){null===t.camera&&os('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Qn.setFromMatrixScale(this.matrixWorld),ia.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Kn.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Qn.multiplyScalar(-Kn.z);const i=this.material.rotation;let s,r;0!==i&&(r=Math.cos(i),s=Math.sin(i));const n=this.center;ca(sa.set(-.5,-.5,0),Kn,n,Qn,s,r),ca(ra.set(.5,-.5,0),Kn,n,Qn,s,r),ca(na.set(.5,.5,0),Kn,n,Qn,s,r),aa.set(0,0),oa.set(1,0),ha.set(1,1);let a=t.ray.intersectTriangle(sa,ra,na,!1,$n);if(null===a&&(ca(ra.set(-.5,.5,0),Kn,n,Qn,s,r),oa.set(0,1),a=t.ray.intersectTriangle(sa,na,ra,!1,$n),null===a))return;const o=t.ray.origin.distanceTo($n);ot.far||e.push({distance:o,point:$n.clone(),uv:$r.getInterpolation($n,sa,ra,na,aa,oa,ha,new _s),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ca(t,e,i,s,r,n){ta.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(ea.x=n*ta.x-r*ta.y,ea.y=r*ta.x+n*ta.y):ea.copy(ta),t.copy(e),t.x+=ea.x,t.y+=ea.y,t.applyMatrix4(ia)}const ua=new Ts,da=new Ts;class pa extends Ar{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){ua.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(ua);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){ua.setFromMatrixPosition(t.matrixWorld),da.setFromMatrixPosition(this.matrixWorld);const i=ua.distanceTo(da)/t.zoom;let s,r;for(e[0].object.visible=!0,s=1,r=e.length;s=t))break;e[s-1].object.visible=!1,e[s].object.visible=!0}for(this._currentLevel=s-1;s0)if(c=n*o-a,u=n*a-o,p=r*l,c>=0)if(u>=-p)if(u<=p){const t=1/l;c*=t,u*=t,d=c*(c+n*u+2*a)+u*(n*c+u+2*o)+h}else u=r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u=-r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u<=-p?(c=Math.max(0,-(-n*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h):u<=p?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+h):(c=Math.max(0,-(n*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,c),s&&s.copy(ya).addScaledVector(ga,u),d}intersectSphere(t,e){ma.subVectors(t.center,this.origin);const i=ma.dot(this.direction),s=ma.dot(ma)-i*i,r=t.radius*t.radius;if(s>r)return null;const n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,r,n,a,o;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,s=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,s=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),i>n||r>s?null:((r>i||isNaN(i))&&(i=r),(n=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),i>o||a>s?null:((a>i||i!=i)&&(i=a),(o=0?i:s,e)))}intersectsBox(t){return null!==this.intersectBox(t,ma)}intersectTriangle(t,e,i,s,r){xa.subVectors(e,t),ba.subVectors(i,t),va.crossVectors(xa,ba);let n,a=this.direction.dot(va);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}fa.subVectors(this.origin,t);const o=n*this.direction.dot(ba.crossVectors(fa,ba));if(o<0)return null;const h=n*this.direction.dot(xa.cross(fa));if(h<0)return null;if(o+h>a)return null;const l=-n*fa.dot(va);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ma extends Zn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pr(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 hr,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Sa=new Qs,_a=new wa,Aa=new Nn,Ta=new Ts,za=new Ts,Ca=new Ts,Ia=new Ts,Ba=new Ts,ka=new Ts,Oa=new Ts,Pa=new Ts;class Ra extends Ar{constructor(t=new Wn,e=new Ma){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t(t.far-t.near)**2)return}Sa.copy(r).invert(),_a.copy(t.ray).applyMatrix4(Sa),null!==i.boundingBox&&!1===_a.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,_a)}}_computeIntersections(t,e,i){let s;const r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=u.length;ri.far?null:{distance:l,point:Pa.clone(),object:t}}(t,e,i,s,za,Ca,Ia,Oa);if(c){const t=new Ts;$r.getBarycoord(Oa,za,Ca,Ia,t),r&&(c.uv=$r.getInterpolatedAttribute(r,o,h,l,t,new _s)),n&&(c.uv1=$r.getInterpolatedAttribute(n,o,h,l,t,new _s)),a&&(c.normal=$r.getInterpolatedAttribute(a,o,h,l,t,new Ts),c.normal.dot(s.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:h,c:l,normal:new Ts,materialIndex:0};$r.getNormal(za,Ca,Ia,e.normal),c.face=e,c.barycoord=t}return c}const Va=new qs,Ea=new qs,Fa=new qs,La=new qs,ja=new Qs,Da=new Ts,Ua=new Nn,Wa=new Qs,Ja=new wa;class qa extends Ra{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=at,this.bindMatrix=new Qs,this.bindMatrixInverse=new Qs,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qr),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||ho.getNormalMatrix(t),s=this.coplanarPoint(ao).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const co=new Nn,uo=new _s(.5,.5),po=new Ts;class mo{constructor(t=new lo,e=new lo,i=new lo,s=new lo,r=new lo,n=new lo){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){const s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],c=r[5],u=r[6],d=r[7],p=r[8],m=r[9],y=r[10],g=r[11],f=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,d-l,g-p,v-f).normalize(),s[1].setComponents(h+n,d+l,g+p,v+f).normalize(),s[2].setComponents(h+a,d+c,g+m,v+x).normalize(),s[3].setComponents(h-a,d-c,g-m,v-x).normalize(),i)s[4].setComponents(o,u,y,b).normalize(),s[5].setComponents(h-o,d-u,g-y,v-b).normalize();else if(s[4].setComponents(h-o,d-u,g-y,v-b).normalize(),e===Wi)s[5].setComponents(h+o,d+u,g+y,v+b).normalize();else{if(e!==Ji)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);s[5].setComponents(o,u,y,b).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),co.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),co.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(co)}intersectsSprite(t){co.center.set(0,0,0);const e=uo.distanceTo(t.center);return co.radius=.7071067811865476+e,co.applyMatrix4(t.matrixWorld),this.intersectsSphere(co)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,po.y=s.normal.y>0?t.max.y:t.min.y,po.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(po)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const yo=new Qs,go=new mo;class fo{constructor(){this.coordinateSystem=Wi}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}}const Mo=new Qs,So=new Pr(1,1,1),_o=new mo,Ao=new fo,To=new Qr,zo=new Nn,Co=new Ts,Io=new Ts,Bo=new Ts,ko=new wo,Oo=new Ra,Po=[];function Ro(t,e,i=0){const s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let n=0;n65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new Mn(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(!t.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qr);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(xo),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));const s=this._matricesTexture;Mo.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;const r=this._colorsTexture;return r&&(So.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){this._initializeGeometry(t),this._validateGeometry(t);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const n=t.getIndex();if(null!==n&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=-1===i?n.count:i),-1!==s.indexStart&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(xo),a=this._availableGeometryIds.shift(),r[a]=s):(a=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(a,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,a}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,h=a.reservedVertexCount;a.vertexCount=e.getAttribute("position").count;for(const t in i.attributes){const s=e.getAttribute(t),r=i.getAttribute(t);Ro(s,r,o);const n=s.itemSize;for(let t=s.count,e=h;t=e.length||!1===e[t].active)return this;const i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){const t=new Qr,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){const e=new Nn;this.getBoundingBoxAt(t,To),To.getCenter(e.center);const r=i.index,n=i.attributes.position;let a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`)}const s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Wn,this._initializeGeometry(s));const r=this.geometry;s.index&&No(s.index.array,r.index.array);for(const t in s.attributes)No(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){const i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;Oo.material=this.material,Oo.geometry.index=n.index,Oo.geometry.attributes=n.attributes,null===Oo.geometry.boundingBox&&(Oo.geometry.boundingBox=new Qr),null===Oo.geometry.boundingSphere&&(Oo.geometry.boundingSphere=new Nn);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const n=s.getIndex();let a=null===n?1:n.array.BYTES_PER_ELEMENT,o=1;r.wireframe&&(o=2,a=s.attributes.position.count>65535?4:2);const h=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data,y=i.isArrayCamera?Ao:_o;d&&!i.isArrayCamera&&(Mo.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),_o.setFromProjectionMatrix(Mo,i.coordinateSystem,i.reversedDepth));let g=0;if(this.sortObjects){Mo.copy(this.matrixWorld).invert(),Co.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Mo),Io.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Mo);for(let t=0,e=h.length;t0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;Wo.applyMatrix4(t.matrixWorld);const h=e.ray.origin.distanceTo(Wo);return he.far?void 0:{distance:h,point:Jo.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Yo=new Ts,Ho=new Ts;class Zo extends qo{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class rh extends Js{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class nh extends rh{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class ah extends Js{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=ft,this.minFilter=ft,this.generateMipmaps=!1,this.needsUpdate=!0}}class oh extends Js{constructor(t,e,i,s,r,n,a,o,h,l,c,u){super(null,n,a,o,h,l,s,r,c,u),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class hh extends oh{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=yt,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class lh extends oh{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,lt),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ch extends Js{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class uh extends Js{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class dh extends Js{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,c=1){if(l!==Wt&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:c},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new js(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class ph extends dh{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1},c=[l,l,l,l,l,l];super(t,t,e,i,s,r,n,a,o,h),this.image=c,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class mh extends Js{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class yh extends Wn{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r),n=Math.floor(n);const o=[],h=[],l=[],c=[];let u=0,d=0;function p(t,e,i,s,r,n,p,m,y,g,f){const x=n/y,b=p/g,v=n/2,w=p/2,M=m/2,S=y+1,_=g+1;let A=0,T=0;const z=new Ts;for(let n=0;n<_;n++){const a=n*b-w;for(let o=0;o0?1:-1,l.push(z.x,z.y,z.z),c.push(o/y),c.push(1-n/g),A+=1}}for(let t=0;t0){const t=(f-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x}(),!1===n&&(t>0&&f(!0),e>0&&f(!1)),this.setIndex(l),this.setAttribute("position",new kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class bh extends xh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new bh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class vh extends Wn{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t,e,i,s){const r=s+1,n=[];for(let s=0;s<=r;s++){n[s]=[];const a=t.clone().lerp(i,s/r),o=e.clone().lerp(i,s/r),h=r-s;for(let t=0;t<=h;t++)n[s][t]=0===t&&s===r?a:a.clone().lerp(o,t/h)}for(let t=0;t.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new kn(r,3)),this.setAttribute("normal",new kn(r.slice(),3)),this.setAttribute("uv",new kn(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new vh(t.vertices,t.indices,t.radius,t.detail)}}class wh extends vh{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new wh(t.radius,t.detail)}}const Mh=new Ts,Sh=new Ts,_h=new Ts,Ah=new $r;class Th extends Wn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=4,s=Math.pow(10,i),r=Math.cos(ys*e),n=t.getIndex(),a=t.getAttribute("position"),o=n?n.count:a.count,h=[0,0,0],l=["a","b","c"],c=new Array(3),u={},d=[];for(let t=0;t0)){h=s;break}h=s-1}if(s=h,i[s]===n)return s/(r-1);const l=i[s];return(s+(n-l)/(i[s+1]-l))/(r-1)}getTangent(t,e){const i=1e-4;let s=t-i,r=t+i;s<0&&(s=0),r>1&&(r=1);const n=this.getPoint(s),a=this.getPoint(r),o=e||(n.isVector2?new _s:new Ts);return o.copy(a).sub(n).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Ts,s=[],r=[],n=[],a=new Ts,o=new Qs;for(let e=0;e<=t;e++){const i=e/t;s[e]=this.getTangentAt(i,new Ts)}r[0]=new Ts,n[0]=new Ts;let h=Number.MAX_VALUE;const l=Math.abs(s[0].x),c=Math.abs(s[0].y),u=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),c<=h&&(h=c,i.set(0,1,0)),u<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(xs(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(xs(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ch extends zh{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new _s){const i=e,s=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?a=s[(h-1)%r]:(Oh.subVectors(s[0],s[1]).add(s[0]),a=Oh);const c=s[h%r],u=s[(h+1)%r];if(this.closed||h+2s.length-2?s.length-1:n+1],c=s[n>s.length-3?s.length-1:n+2];return i.set(Eh(a,o.x,h.x,l.x,c.x),Eh(a,o.y,h.y,l.y,c.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){const t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,s=this.curves.length;i1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Gh extends Zh{constructor(t){super(t),this.uuid=fs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,s=this.holes.length;i80*i){o=t[0],h=t[1];let e=o,s=h;for(let n=i;ne&&(e=i),r>s&&(s=r)}l=Math.max(e-o,s-h),l=0!==l?32767/l:0}return tl(n,a,i,o,h,l,0),a}function Qh(t,e,i,s,r){let n;if(r===function(t,e,i,s){let r=0;for(let n=e,a=i-s;n0)for(let r=e;r=e;r-=s)n=vl(r/s|0,t[r],t[r+1],n);return n&&ml(n,n.next)&&(wl(n),n=n.next),n}function Kh(t,e){if(!t)return t;e||(e=t);let i,s=t;do{if(i=!1,s.steiner||!ml(s,s.next)&&0!==pl(s.prev,s,s.next))s=s.next;else{if(wl(s),s=e=s.prev,s===s.next)break;i=!0}}while(i||s!==e);return e}function tl(t,e,i,s,r,n,a){if(!t)return;!a&&n&&function(t,e,i,s){let r=t;do{0===r.z&&(r.z=hl(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(t,s,r,n);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(n?il(t,s,r,n):el(t))e.push(h.i,t.i,l.i),wl(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?tl(t=sl(Kh(t),e),e,i,s,r,n,2):2===a&&rl(t,e,i,s,r,n):tl(Kh(t),e,i,s,r,n,1);break}}}function el(t){const e=t.prev,i=t,s=t.next;if(pl(e,i,s)>=0)return!1;const r=e.x,n=i.x,a=s.x,o=e.y,h=i.y,l=s.y,c=Math.min(r,n,a),u=Math.min(o,h,l),d=Math.max(r,n,a),p=Math.max(o,h,l);let m=s.next;for(;m!==e;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=p&&ul(r,o,n,h,a,l,m.x,m.y)&&pl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function il(t,e,i,s){const r=t.prev,n=t,a=t.next;if(pl(r,n,a)>=0)return!1;const o=r.x,h=n.x,l=a.x,c=r.y,u=n.y,d=a.y,p=Math.min(o,h,l),m=Math.min(c,u,d),y=Math.max(o,h,l),g=Math.max(c,u,d),f=hl(p,m,e,i,s),x=hl(y,g,e,i,s);let b=t.prevZ,v=t.nextZ;for(;b&&b.z>=f&&v&&v.z<=x;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&ul(o,c,h,u,l,d,b.x,b.y)&&pl(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&ul(o,c,h,u,l,d,v.x,v.y)&&pl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=f;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&ul(o,c,h,u,l,d,b.x,b.y)&&pl(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&ul(o,c,h,u,l,d,v.x,v.y)&&pl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function sl(t,e){let i=t;do{const s=i.prev,r=i.next.next;!ml(s,r)&&yl(s,i,i.next,r)&&xl(s,r)&&xl(r,s)&&(e.push(s.i,i.i,r.i),wl(i),wl(i.next),i=t=r),i=i.next}while(i!==t);return Kh(i)}function rl(t,e,i,s,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&dl(a,t)){let o=bl(a,t);return a=Kh(a,a.next),o=Kh(o,o.next),tl(a,e,i,s,r,n,0),void tl(o,e,i,s,r,n,0)}t=t.next}a=a.next}while(a!==t)}function nl(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function al(t,e){const i=function(t,e){let i=e;const s=t.x,r=t.y;let n,a=-1/0;if(ml(t,i))return i;do{if(ml(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>a&&(a=t,n=i.x=i.x&&i.x>=h&&s!==i.x&&cl(rn.x||i.x===n.x&&ol(n,i)))&&(n=i,c=e)}i=i.next}while(i!==o);return n}(t,e);if(!i)return e;const s=bl(i,t);return Kh(s,s.next),Kh(i,i.next)}function ol(t,e){return pl(t.prev,t,e.prev)<0&&pl(e.next,t,t.next)<0}function hl(t,e,i,s,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ll(t){let e=t,i=t;do{(e.x=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function ul(t,e,i,s,r,n,a,o){return!(t===a&&e===o)&&cl(t,e,i,s,r,n,a,o)}function dl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&yl(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(xl(t,e)&&xl(e,t)&&function(t,e){let i=t,s=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(pl(t.prev,t,e.prev)||pl(t,e.prev,e))||ml(t,e)&&pl(t.prev,t,t.next)>0&&pl(e.prev,e,e.next)>0)}function pl(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ml(t,e){return t.x===e.x&&t.y===e.y}function yl(t,e,i,s){const r=fl(pl(t,e,i)),n=fl(pl(t,e,s)),a=fl(pl(i,s,t)),o=fl(pl(i,s,e));return r!==n&&a!==o||(!(0!==r||!gl(t,i,e))||(!(0!==n||!gl(t,s,e))||(!(0!==a||!gl(i,t,s))||!(0!==o||!gl(i,e,s)))))}function gl(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function fl(t){return t>0?1:t<0?-1:0}function xl(t,e){return pl(t.prev,t,t.next)<0?pl(t,e,t.next)>=0&&pl(t,t.prev,e)>=0:pl(t,e,t.prev)<0||pl(t,t.next,e)<0}function bl(t,e){const i=Ml(t.i,t.x,t.y),s=Ml(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function vl(t,e,i,s){const r=Ml(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function wl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ml(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Sl{static triangulate(t,e,i=2){return $h(t,e,i)}}class _l{static area(t){const e=t.length;let i=0;for(let s=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Tl(t,e){for(let i=0;iNumber.EPSILON){const u=Math.sqrt(c),d=Math.sqrt(h*h+l*l),p=e.x-o/u,m=e.y+a/u,y=((i.x-l/d-p)*l-(i.y+h/d-m)*h)/(a*l-o*h);s=p+a*y-t.x,r=m+o*y-t.y;const g=s*s+r*r;if(g<=2)return new _s(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(c)):(s=a,r=o,n=Math.sqrt(c/2))}return new _s(s/n,r/n)}const k=[];for(let t=0,e=z.length,i=e-1,s=t+1;t=0;t--){const e=t/p,i=c*Math.cos(e*Math.PI/2),s=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=z.length;t=0;){const s=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=o+2*p;t0)&&d.push(e,r,h),(t!==i-1||o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Zl extends Hl{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Gl extends Zn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Pr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class $l extends Gl{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new _s(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xs(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pr(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Pr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pr(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Ql extends Zn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Pr(16777215),this.specular=new Pr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Kl extends Zn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class tc extends Zn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class ec extends Zn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Pr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ic extends Zn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class sc extends Zn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class rc extends Zn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nc extends Eo{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function ac(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function oc(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function hc(t,e,i){const s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){const s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function lc(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do{a=n[s],void 0!==a&&(e.push(n.time),i.push(...a)),n=t[r++]}while(void 0!==n);else if(void 0!==a.toArray)do{a=n[s],void 0!==a&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++]}while(void 0!==n);else do{a=n[s],void 0!==a&&(e.push(n.time),i.push(a)),n=t[r++]}while(void 0!==n)}class cc{static convertArray(t,e){return ac(t,e)}static isTypedArray(t){return $i(t)}static getKeyframeOrder(t){return oc(t)}static sortedArray(t,e,i){return hc(t,e,i)}static flattenJSON(t,e,i,s){lc(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){const n=t.clone();n.name=e;const a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=s.times[u]){const t=u*h+o,e=t+h-o;d=s.values.slice(t,e)}else{const t=s.createInterpolant(),e=o,i=h-o;t.evaluate(n),d=t.resultBuffer.slice(e,i)}"quaternion"===r&&(new As).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let t=0;t=r)){const a=e[1];t=r)break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(os("KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,s=this.values,r=i.length;0===r&&(os("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){const s=i[e];if("number"==typeof s&&isNaN(s)){os("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){os("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&$i(s))for(let e=0,i=s.length;e!==i;++e){const i=s[e];if(isNaN(i)){os("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===Fe,r=t.length-1;let n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}gc.prototype.ValueTypeName="",gc.prototype.TimeBufferType=Float32Array,gc.prototype.ValueBufferType=Float32Array,gc.prototype.DefaultInterpolation=Ee;class fc extends gc{constructor(t,e,i){super(t,e,i)}}fc.prototype.ValueTypeName="bool",fc.prototype.ValueBufferType=Array,fc.prototype.DefaultInterpolation=Ve,fc.prototype.InterpolantFactoryMethodLinear=void 0,fc.prototype.InterpolantFactoryMethodSmooth=void 0;class xc extends gc{constructor(t,e,i,s){super(t,e,i,s)}}xc.prototype.ValueTypeName="color";class bc extends gc{constructor(t,e,i,s){super(t,e,i,s)}}bc.prototype.ValueTypeName="number";class vc extends uc{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e);let h=t*a;for(let t=h+a;h!==t;h+=4)As.slerpFlat(r,0,n,h-a,n,h,o);return r}}class wc extends gc{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new vc(this.times,this.values,this.getValueSize(),t)}}wc.prototype.ValueTypeName="quaternion",wc.prototype.InterpolantFactoryMethodSmooth=void 0;class Mc extends gc{constructor(t,e,i){super(t,e,i)}}Mc.prototype.ValueTypeName="string",Mc.prototype.ValueBufferType=Array,Mc.prototype.DefaultInterpolation=Ve,Mc.prototype.InterpolantFactoryMethodLinear=void 0,Mc.prototype.InterpolantFactoryMethodSmooth=void 0;class Sc extends gc{constructor(t,e,i,s){super(t,e,i,s)}}Sc.prototype.ValueTypeName="vector";class _c{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=fs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(Ac(i[t]).scale(s));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(gc.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){const r=e.length,n=[];for(let t=0;t1){const t=n[1];let e=s[t];e||(s[t]=e=[]),e.push(i)}}const n=[];for(const t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(as("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return os("AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,s,r){if(0!==i.length){const n=[],a=[];lc(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode;let o=t.length||-1;const h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==kc[t])return void kc[t].push({onLoad:e,onProgress:i,onError:s});kc[t]=[],kc[t].push({onLoad:e,onProgress:i,onError:s});const n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&as("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=kc[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n;let o=0;const h=new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{o+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}});return new Response(h)}throw new Oc(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,s=new TextDecoder(i);return t.arrayBuffer().then(t=>s.decode(t))}}}).then(e=>{Tc.add(`file:${t}`,e);const i=kc[t];delete kc[t];for(let t=0,s=i.length;t{const i=kc[t];if(void 0===i)throw this.manager.itemError(t),e;delete kc[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Rc extends Bc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Pc(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):os(e),r.manager.itemError(t)}},i,s)}parse(t){const e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=(new Pr).setHex(r.value);break;case"v2":s.uniforms[e].value=(new _s).fromArray(r.value);break;case"v3":s.uniforms[e].value=(new Ts).fromArray(r.value);break;case"v4":s.uniforms[e].value=(new qs).fromArray(r.value);break;case"m3":s.uniforms[e].value=(new Is).fromArray(r.value);break;case"m4":s.uniforms[e].value=(new Qs).fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=(new _s).fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=(new _s).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return du.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:Wl,SpriteMaterial:Gn,RawShaderMaterial:Zl,ShaderMaterial:Hl,PointsMaterial:$o,MeshPhysicalMaterial:$l,MeshStandardMaterial:Gl,MeshPhongMaterial:Ql,MeshToonMaterial:Kl,MeshNormalMaterial:tc,MeshLambertMaterial:ec,MeshDepthMaterial:ic,MeshDistanceMaterial:sc,MeshBasicMaterial:Ma,MeshMatcapMaterial:rc,LineDashedMaterial:nc,LineBasicMaterial:Eo,Material:Zn}[t]}}class pu{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class mu extends Wn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class yu extends Bc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Pc(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):os(e),r.manager.itemError(t)}},i,s)}parse(t){const e={},i={};function s(t,s){if(void 0!==e[s])return e[s];const r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];const s=t.arrayBuffers,r=s[e],n=new Uint32Array(r).buffer;return i[e]=n,n}(t,r.buffer),a=Gi(r.type,n),o=new Jn(a,r.stride);return o.uuid=r.uuid,e[s]=o,o}const r=t.isInstancedBufferGeometry?new mu:new Wn,n=t.data.index;if(void 0!==n){const t=Gi(n.type,n.array);r.setIndex(new Mn(t,1))}const a=t.data.attributes;for(const e in a){const i=a[e];let n;if(i.isInterleavedBufferAttribute){const e=s(t.data,i.data);n=new Xn(e,i.itemSize,i.offset,i.normalized)}else{const t=Gi(i.type,i.array);n=new(i.isInstancedBufferAttribute?$a:Mn)(t,i.itemSize,i.normalized)}void 0!==i.name&&(n.name=i.name),void 0!==i.usage&&n.setUsage(i.usage),r.setAttribute(e,n)}const o=t.data.morphAttributes;if(o)for(const e in o){const i=o[e],n=[];for(let e=0,r=i.length;e0){const i=new Cc(e);r=new Ec(i),r.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){s=new Ec(this.manager),s.setCrossOrigin(this.crossOrigin);for(let e=0,s=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=(new Qr).fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=(new Nn).fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=c(t.matricesTexture.uuid),n._indirectTexture=c(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=c(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=(new Nn).fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=(new Qr).fromJSON(t.boundingBox));break;case"LOD":n=new pa;break;case"Line":n=new qo(h(t.geometry),l(t.material));break;case"LineLoop":n=new Go(h(t.geometry),l(t.material));break;case"LineSegments":n=new Zo(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new ih(h(t.geometry),l(t.material));break;case"Sprite":n=new la(l(t.material));break;case"Group":n=new Tr;break;case"Bone":n=new Xa;break;default:n=new Ar}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.pivot&&(n.pivot=(new Ts).fromArray(t.pivot)),void 0!==t.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),void 0!==t.morphTargetInfluences&&(n.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.static&&(n.static=t.static),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t{if(!0!==wu.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(wu.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return Tc.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),wu.set(o,e),Tc.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});Tc.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Su;class _u{static getContext(){return void 0===Su&&(Su=new(window.AudioContext||window.webkitAudioContext)),Su}static setContext(t){Su=t}}class Au extends Bc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Pc(this.manager);function a(e){s?s(e):os(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{const i=t.slice(0);_u.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}const Tu=new Qs,zu=new Qs,Cu=new Qs;class Iu{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new tu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new tu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Cu.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,r=e.near*Math.tan(ys*e.fov*.5)/e.zoom;let n,a;zu.elements[12]=-i,Tu.elements[12]=i,n=-r*e.aspect+s,a=r*e.aspect+s,Cu.elements[0]=2*e.near/(a-n),Cu.elements[8]=(a+n)/(a-n),this.cameraL.projectionMatrix.copy(Cu),n=-r*e.aspect-s,a=r*e.aspect-s,Cu.elements[0]=2*e.near/(a-n),Cu.elements[8]=(a+n)/(a-n),this.cameraR.projectionMatrix.copy(Cu)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(zu),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Tu)}}const Bu=-90;class ku extends Ar{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new tu(Bu,1,t,e);s.layers=this.layers,this.add(s);const r=new tu(Bu,1,t,e);r.layers=this.layers,this.add(r);const n=new tu(Bu,1,t,e);n.layers=this.layers,this.add(n);const a=new tu(Bu,1,t,e);a.layers=this.layers,this.add(a);const o=new tu(Bu,1,t,e);o.layers=this.layers,this.add(o);const h=new tu(Bu,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(const t of e)this.remove(t);if(t===Wi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Ji)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,a,o,h,l]=this.children,c=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let y=!1;y=!0===t.isWebGLRenderer?t.state.buffers.depth.getReversed():t.reversedDepthBuffer,t.setRenderTarget(i,0,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,r),t.setRenderTarget(i,1,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,n),t.setRenderTarget(i,2,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,a),t.setRenderTarget(i,3,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,o),t.setRenderTarget(i,4,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,l),t.setRenderTarget(c,u,d),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class Ou extends tu{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Pu{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,void 0!==t.hidden&&(this._pageVisibilityHandler=Ru.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==t?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Ru(){!1===this._document.hidden&&this.reset()}const Nu=new Ts,Vu=new As,Eu=new Ts,Fu=new Ts,Lu=new Ts;class ju extends Ar{constructor(){super(),this.type="AudioListener",this.context=_u.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Pu}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this._timer.update();const e=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Nu,Vu,Eu),Fu.set(0,0,-1).applyQuaternion(Vu),Lu.set(0,1,0).applyQuaternion(Vu),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Nu.x,t),e.positionY.linearRampToValueAtTime(Nu.y,t),e.positionZ.linearRampToValueAtTime(Nu.z,t),e.forwardX.linearRampToValueAtTime(Fu.x,t),e.forwardY.linearRampToValueAtTime(Fu.y,t),e.forwardZ.linearRampToValueAtTime(Fu.z,t),e.upX.linearRampToValueAtTime(Lu.x,t),e.upY.linearRampToValueAtTime(Lu.y,t),e.upZ.linearRampToValueAtTime(Lu.z,t)}else e.setPosition(Nu.x,Nu.y,Nu.z),e.setOrientation(Fu.x,Fu.y,Fu.z,Lu.x,Lu.y,Lu.z)}}class Du extends Ar{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void as("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void as("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;as("Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;as("Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i,r=s;t!==r;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){As.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){const n=this._workIndex*r;As.multiplyQuaternionsFlat(t,n,t,e,t,i),As.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){const n=1-s;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){const r=e+n;t[r]=t[r]+t[i+n]*s}}}const Zu="\\[\\]\\.:\\/",Gu=new RegExp("["+Zu+"]","g"),$u="[^"+Zu+"]",Qu="[^"+Zu.replace("\\.","")+"]",Ku=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",$u)+/(WCOD+)?/.source.replace("WCOD",Qu)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",$u)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",$u)+"$"),td=["material","materials","bones","map"];class ed{constructor(t,e,i){this.path=e,this.parsedPath=i||ed.parseTrackName(e),this.node=ed.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new ed.Composite(t,e,i):new ed(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Gu,"")}static parseTrackName(t){const e=Ku.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){const t=i.nodeName.substring(s+1);-1!==td.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let s=0;s=r){const n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,h=e[o];if(void 0!==h)if(delete e[o],h0&&(e[a.uuid]=h),t[h]=a,t.pop();for(let t=0,e=s;t!==e;++t){const e=i[t];e[h]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let s=i[t];const r=this._bindings;if(void 0!==s)return r[s];const n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,c=new Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(c);for(let i=l,s=o.length;i!==s;++i){const s=o[i];c[i]=new ed(s,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class sd{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=new Array(n),o={endingStart:je,endingEnd:je};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings&&Object.assign(o,e.settings),e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){const i=this._clip.duration,s=t._clip.duration,r=s/i,n=i/s;t.warp(1,r,e),this.warp(n,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const s=this._mixer,r=s.time,n=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);const n=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===Je)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let s=this.time+t,r=this._loopCount;const n=2202===i;if(0===t)return-1===r||!n||1&~r?s:e-s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else{if(!(s<0)){this.time=s;break t}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){const i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this._loopCount=r,this.time=s;if(n&&!(1&~r))return e-s}return s}_setEndings(t,e,i){const s=this._interpolantSettings;i?(s.endingStart=De,s.endingEnd=De):(s.endingStart=t?this.zeroSlopeAtStart?De:je:Ue,s.endingEnd=e?this.zeroSlopeAtEnd?De:je:Ue)}_scheduleFading(t,e,i){const s=this._mixer,r=s.time;let n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);const a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}const rd=new Float32Array(1);class nd extends ds{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(t,e){const i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){const r=s[t],h=r.name;let c=l[h];if(void 0!==c)++c.referenceCount,n[t]=c;else{if(c=n[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,h));continue}const s=e&&e._propertyBindings[t].binding.parsedPath;c=new Hu(ed.create(i,h,s),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,h),n[t]=c}a[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(s,t,r,n)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,vd).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Md=new Ts,Sd=new Ts,_d=new Ts,Ad=new Ts,Td=new Ts,zd=new Ts,Cd=new Ts;class Id{constructor(t=new Ts,e=new Ts){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Md.subVectors(t,this.start),Sd.subVectors(this.end,this.start);const i=Sd.dot(Sd);if(0===i)return 0;let s=Sd.dot(Md)/i;return e&&(s=xs(s,0,1)),s}closestPointToPoint(t,e,i){const s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=zd,i=Cd){const s=1e-8*1e-8;let r,n;const a=this.start,o=t.start,h=this.end,l=t.end;_d.subVectors(h,a),Ad.subVectors(l,o),Td.subVectors(a,o);const c=_d.dot(_d),u=Ad.dot(Ad),d=Ad.dot(Td);if(c<=s&&u<=s)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(c<=s)r=0,n=d/u,n=xs(n,0,1);else{const t=_d.dot(Td);if(u<=s)n=0,r=xs(-t/c,0,1);else{const e=_d.dot(Ad),i=c*u-e*e;r=0!==i?xs((e*d-t*u)/i,0,1):0,n=(e*r+d)/u,n<0?(n=0,r=xs(-t/c,0,1)):n>1&&(n=1,r=xs((e-t)/c,0,1))}}return e.copy(a).addScaledVector(_d,r),i.copy(o).addScaledVector(Ad,n),e.distanceToSquared(i)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Bd=new Ts;class kd extends Ar{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new Wn,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,i=32;t1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{ip.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(ip,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class ap extends Zo{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Wn;i.setAttribute("position",new kn(e,3)),i.setAttribute("color",new kn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new Eo({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const s=new Pr,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class op{constructor(){this.type="ShapePath",this.color=new Pr,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Zh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let s=!1;for(let r=i-1,n=0;nNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s}const i=_l.isClockWise,s=this.subPaths;if(0===s.length)return[];let r,n,a;const o=[];if(1===s.length)return n=s[0],a=new Gh,a.curves=n.curves,o.push(a),o;let h=!i(s[0].getPoints());h=t?!h:h;const l=[],c=[];let u,d,p=[],m=0;c[m]=void 0,p[m]=[];for(let e=0,a=s.length;e1){let t=!1,i=0;for(let t=0,e=c.length;t0&&!1===t&&(p=l)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}(t,e)}static cover(t,e){return function(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}(t,e)}static fill(t){return function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}(t)}static getByteLength(t,e,i,s){return lp(t,e,i,s)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?as("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);export{it as ACESFilmicToneMapping,w as AddEquation,$ as AddOperation,Je as AdditiveAnimationBlendMode,g as AdditiveBlending,rt as AgXToneMapping,jt as AlphaFormat,ki as AlwaysCompare,U as AlwaysDepth,Si as AlwaysStencilFunc,hu as AmbientLight,sd as AnimationAction,_c as AnimationClip,Rc as AnimationLoader,nd as AnimationMixer,id as AnimationObjectGroup,cc as AnimationUtils,Ih as ArcCurve,Ou as ArrayCamera,np as ArrowHelper,at as AttachedBindMode,Du as Audio,Yu as AudioAnalyser,_u as AudioContext,ju as AudioListener,Au as AudioLoader,ap as AxesHelper,d as BackSide,He as BasicDepthPacking,o as BasicShadowMap,Vo as BatchedMesh,yc as BezierInterpolant,Xa as Bone,fc as BooleanKeyframeTrack,wd as Box2,Qr as Box3,tp as Box3Helper,yh as BoxGeometry,Kd as BoxHelper,Mn as BufferAttribute,Wn as BufferGeometry,yu as BufferGeometryLoader,Ct as ByteType,Tc as Cache,Gc as Camera,Gd as CameraHelper,uh as CanvasTexture,gh as CapsuleGeometry,Vh as CatmullRomCurve3,et as CineonToneMapping,fh as CircleGeometry,yt as ClampToEdgeWrapping,gd as Clock,Pr as Color,xc as ColorKeyframeTrack,Rs as ColorManagement,Hi as Compatibility,hh as CompressedArrayTexture,lh as CompressedCubeTexture,oh as CompressedTexture,Nc as CompressedTextureLoader,bh as ConeGeometry,L as ConstantAlphaFactor,E as ConstantColorFactor,hp as Controls,ku as CubeCamera,ph as CubeDepthTexture,lt as CubeReflectionMapping,ct as CubeRefractionMapping,ch as CubeTexture,Fc as CubeTextureLoader,pt as CubeUVReflectionMapping,jh as CubicBezierCurve,Dh as CubicBezierCurve3,dc as CubicInterpolant,r as CullFaceBack,n as CullFaceFront,a as CullFaceFrontBack,s as CullFaceNone,zh as Curve,Hh as CurvePath,b as CustomBlending,st as CustomToneMapping,xh as CylinderGeometry,xd as Cylindrical,Gs as Data3DTexture,Hs as DataArrayTexture,Ya as DataTexture,Lc as DataTextureLoader,xn as DataUtils,di as DecrementStencilOp,mi as DecrementWrapStencilOp,Ic as DefaultLoadingManager,Wt as DepthFormat,Jt as DepthStencilFormat,dh as DepthTexture,ot as DetachedBindMode,ou as DirectionalLight,Yd as DirectionalLightHelper,mc as DiscreteInterpolant,wh as DodecahedronGeometry,p as DoubleSide,O as DstAlphaFactor,R as DstColorFactor,Li as DynamicCopyUsage,Pi as DynamicDrawUsage,Vi as DynamicReadUsage,Th as EdgesGeometry,Ch as EllipseCurve,Ti as EqualCompare,q as EqualDepth,xi as EqualStencilFunc,ut as EquirectangularReflectionMapping,dt as EquirectangularRefractionMapping,hr as Euler,ds as EventDispatcher,mh as ExternalTexture,zl as ExtrudeGeometry,Pc as FileLoader,Bn as Float16BufferAttribute,kn as Float32BufferAttribute,Pt as FloatType,Vr as Fog,Nr as FogExp2,ah as FramebufferTexture,u as FrontSide,mo as Frustum,fo as FrustumArray,ud as GLBufferAttribute,Di as GLSL1,Ui as GLSL3,Ci as GreaterCompare,Y as GreaterDepth,Bi as GreaterEqualCompare,X as GreaterEqualDepth,Mi as GreaterEqualStencilFunc,vi as GreaterStencilFunc,Ud as GridHelper,Tr as Group,Rt as HalfFloatType,Uc as HemisphereLight,Dd as HemisphereLightHelper,Il as IcosahedronGeometry,Mu as ImageBitmapLoader,Ec as ImageLoader,Fs as ImageUtils,ui as IncrementStencilOp,pi as IncrementWrapStencilOp,$a as InstancedBufferAttribute,mu as InstancedBufferGeometry,cd as InstancedInterleavedBuffer,no as InstancedMesh,Tn as Int16BufferAttribute,Cn as Int32BufferAttribute,Sn as Int8BufferAttribute,kt as IntType,Jn as InterleavedBuffer,Xn as InterleavedBufferAttribute,uc as Interpolant,Le as InterpolateBezier,Ve as InterpolateDiscrete,Ee as InterpolateLinear,Fe as InterpolateSmooth,Yi as InterpolationSamplingMode,Xi as InterpolationSamplingType,yi as InvertStencilOp,li as KeepStencilOp,gc as KeyframeTrack,pa as LOD,Bl as LatheGeometry,lr as Layers,Ai as LessCompare,W as LessDepth,zi as LessEqualCompare,J as LessEqualDepth,bi as LessEqualStencilFunc,fi as LessStencilFunc,Dc as Light,uu as LightProbe,qo as Line,Id as Line3,Eo as LineBasicMaterial,Uh as LineCurve,Wh as LineCurve3,nc as LineDashedMaterial,Go as LineLoop,Zo as LineSegments,Mt as LinearFilter,pc as LinearInterpolant,Tt as LinearMipMapLinearFilter,_t as LinearMipMapNearestFilter,At as LinearMipmapLinearFilter,St as LinearMipmapNearestFilter,ii as LinearSRGBColorSpace,K as LinearToneMapping,si as LinearTransfer,Bc as Loader,pu as LoaderUtils,Cc as LoadingManager,Pe as LoopOnce,Ne as LoopPingPong,Re as LoopRepeat,e as MOUSE,Zn as Material,v as MaterialBlending,du as MaterialLoader,Ss as MathUtils,bd as Matrix2,Is as Matrix3,Qs as Matrix4,A as MaxEquation,Ra as Mesh,Ma as MeshBasicMaterial,ic as MeshDepthMaterial,sc as MeshDistanceMaterial,ec as MeshLambertMaterial,rc as MeshMatcapMaterial,tc as MeshNormalMaterial,Ql as MeshPhongMaterial,$l as MeshPhysicalMaterial,Gl as MeshStandardMaterial,Kl as MeshToonMaterial,_ as MinEquation,gt as MirroredRepeatWrapping,G as MixOperation,x as MultiplyBlending,Z as MultiplyOperation,ft as NearestFilter,wt as NearestMipMapLinearFilter,bt as NearestMipMapNearestFilter,vt as NearestMipmapLinearFilter,xt as NearestMipmapNearestFilter,nt as NeutralToneMapping,_i as NeverCompare,D as NeverDepth,gi as NeverStencilFunc,m as NoBlending,ti as NoColorSpace,ni as NoNormalPacking,Q as NoToneMapping,We as NormalAnimationBlendMode,y as NormalBlending,oi as NormalGAPacking,ai as NormalRGPacking,Ii as NotEqualCompare,H as NotEqualDepth,wi as NotEqualStencilFunc,bc as NumberKeyframeTrack,Ar as Object3D,fu as ObjectLoader,Ke as ObjectSpaceNormalMap,kl as OctahedronGeometry,z as OneFactor,j as OneMinusConstantAlphaFactor,F as OneMinusConstantColorFactor,P as OneMinusDstAlphaFactor,N as OneMinusDstColorFactor,k as OneMinusSrcAlphaFactor,I as OneMinusSrcColorFactor,nu as OrthographicCamera,h as PCFShadowMap,l as PCFSoftShadowMap,Zh as Path,tu as PerspectiveCamera,lo as Plane,Ol as PlaneGeometry,ep as PlaneHelper,ru as PointLight,Ed as PointLightHelper,ih as Points,$o as PointsMaterial,Wd as PolarGridHelper,vh as PolyhedronGeometry,Xu as PositionalAudio,ed as PropertyBinding,Hu as PropertyMixer,Jh as QuadraticBezierCurve,qh as QuadraticBezierCurve3,As as Quaternion,wc as QuaternionKeyframeTrack,vc as QuaternionLinearInterpolant,he as R11_EAC_Format,gs as RAD2DEG,ke as RED_GREEN_RGTC2_Format,Ie as RED_RGTC1_Format,t as REVISION,ce as RG11_EAC_Format,Ze as RGBADepthPacking,Ut as RGBAFormat,Gt as RGBAIntegerFormat,Se as RGBA_ASTC_10x10_Format,ve as RGBA_ASTC_10x5_Format,we as RGBA_ASTC_10x6_Format,Me as RGBA_ASTC_10x8_Format,_e as RGBA_ASTC_12x10_Format,Ae as RGBA_ASTC_12x12_Format,de as RGBA_ASTC_4x4_Format,pe as RGBA_ASTC_5x4_Format,me as RGBA_ASTC_5x5_Format,ye as RGBA_ASTC_6x5_Format,ge as RGBA_ASTC_6x6_Format,fe as RGBA_ASTC_8x5_Format,xe as RGBA_ASTC_8x6_Format,be as RGBA_ASTC_8x8_Format,Te as RGBA_BPTC_Format,oe as RGBA_ETC2_EAC_Format,re as RGBA_PVRTC_2BPPV1_Format,se as RGBA_PVRTC_4BPPV1_Format,Qt as RGBA_S3TC_DXT1_Format,Kt as RGBA_S3TC_DXT3_Format,te as RGBA_S3TC_DXT5_Format,Ge as RGBDepthPacking,Dt as RGBFormat,Zt as RGBIntegerFormat,ze as RGB_BPTC_SIGNED_Format,Ce as RGB_BPTC_UNSIGNED_Format,ne as RGB_ETC1_Format,ae as RGB_ETC2_Format,ie as RGB_PVRTC_2BPPV1_Format,ee as RGB_PVRTC_4BPPV1_Format,$t as RGB_S3TC_DXT1_Format,$e as RGDepthPacking,Yt as RGFormat,Ht as RGIntegerFormat,Zl as RawShaderMaterial,wa as Ray,pd as Raycaster,lu as RectAreaLight,qt as RedFormat,Xt as RedIntegerFormat,tt as ReinhardToneMapping,Xs as RenderTarget,ad as RenderTarget3D,mt as RepeatWrapping,ci as ReplaceStencilOp,S as ReverseSubtractEquation,us as ReversedDepthFuncs,Pl as RingGeometry,le as SIGNED_R11_EAC_Format,Oe as SIGNED_RED_GREEN_RGTC2_Format,Be as SIGNED_RED_RGTC1_Format,ue as SIGNED_RG11_EAC_Format,ei as SRGBColorSpace,ri as SRGBTransfer,Er as Scene,Hl as ShaderMaterial,Wl as ShadowMaterial,Gh as Shape,Rl as ShapeGeometry,op as ShapePath,_l as ShapeUtils,It as ShortType,Ga as Skeleton,Nd as SkeletonHelper,qa as SkinnedMesh,js as Source,Nn as Sphere,Nl as SphereGeometry,fd as Spherical,cu as SphericalHarmonics3,Xh as SplineCurve,iu as SpotLight,kd as SpotLightHelper,la as Sprite,Gn as SpriteMaterial,B as SrcAlphaFactor,V as SrcAlphaSaturateFactor,C as SrcColorFactor,Fi as StaticCopyUsage,Oi as StaticDrawUsage,Ni as StaticReadUsage,Iu as StereoCamera,ji as StreamCopyUsage,Ri as StreamDrawUsage,Ei as StreamReadUsage,Mc as StringKeyframeTrack,M as SubtractEquation,f as SubtractiveBlending,i as TOUCH,Qe as TangentSpaceNormalMap,Vl as TetrahedronGeometry,Js as Texture,jc as TextureLoader,cp as TextureUtils,Pu as Timer,qi as TimestampQuery,El as TorusGeometry,Fl as TorusKnotGeometry,$r as Triangle,Ye as TriangleFanDrawMode,Xe as TriangleStripDrawMode,qe as TrianglesDrawMode,Ll as TubeGeometry,ht as UVMapping,zn as Uint16BufferAttribute,In as Uint32BufferAttribute,_n as Uint8BufferAttribute,An as Uint8ClampedBufferAttribute,od as Uniform,ld as UniformsGroup,Yl as UniformsUtils,zt as UnsignedByteType,Lt as UnsignedInt101111Type,Et as UnsignedInt248Type,Ft as UnsignedInt5999Type,Ot as UnsignedIntType,Nt as UnsignedShort4444Type,Vt as UnsignedShort5551Type,Bt as UnsignedShortType,c as VSMShadowMap,_s as Vector2,Ts as Vector3,qs as Vector4,Sc as VectorKeyframeTrack,nh as VideoFrameTexture,rh as VideoTexture,$s as WebGL3DRenderTarget,Zs as WebGLArrayRenderTarget,Wi as WebGLCoordinateSystem,Ys as WebGLRenderTarget,Ji as WebGPUCoordinateSystem,Cr as WebXRController,jl as WireframeGeometry,Ue as WrapAroundEnding,je as ZeroCurvatureEnding,T as ZeroFactor,De as ZeroSlopeEnding,hi as ZeroStencilOp,Jl as cloneUniforms,Ki as createCanvasElement,Qi as createElementNS,os as error,lp as getByteLength,ss as getConsoleFunction,Xl as getUnlitUniformColorSpace,$i as isTypedArray,rs as log,ql as mergeUniforms,cs as probeAsync,is as setConsoleFunction,as as warn,hs as warnOnce,ls as yieldToMain}; +const t="184dev",e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},i={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=0,r=1,n=2,a=3,o=0,h=1,l=2,c=3,u=0,d=1,p=2,m=0,y=1,g=2,f=3,x=4,b=5,v=6,w=100,M=101,S=102,_=103,A=104,T=200,z=201,C=202,I=203,B=204,k=205,O=206,P=207,R=208,N=209,V=210,E=211,L=212,F=213,j=214,D=0,U=1,W=2,q=3,J=4,X=5,Y=6,H=7,Z=0,G=1,$=2,Q=0,K=1,tt=2,et=3,it=4,st=5,rt=6,nt=7,at="attached",ot="detached",ht=300,lt=301,ct=302,ut=303,dt=304,pt=306,mt=1e3,yt=1001,gt=1002,ft=1003,xt=1004,bt=1004,vt=1005,wt=1005,Mt=1006,St=1007,_t=1007,At=1008,Tt=1008,zt=1009,Ct=1010,It=1011,Bt=1012,kt=1013,Ot=1014,Pt=1015,Rt=1016,Nt=1017,Vt=1018,Et=1020,Lt=35902,Ft=35899,jt=1021,Dt=1022,Ut=1023,Wt=1026,qt=1027,Jt=1028,Xt=1029,Yt=1030,Ht=1031,Zt=1032,Gt=1033,$t=33776,Qt=33777,Kt=33778,te=33779,ee=35840,ie=35841,se=35842,re=35843,ne=36196,ae=37492,oe=37496,he=37488,le=37489,ce=37490,ue=37491,de=37808,pe=37809,me=37810,ye=37811,ge=37812,fe=37813,xe=37814,be=37815,ve=37816,we=37817,Me=37818,Se=37819,_e=37820,Ae=37821,Te=36492,ze=36494,Ce=36495,Ie=36283,Be=36284,ke=36285,Oe=36286,Pe=2200,Re=2201,Ne=2202,Ve=2300,Ee=2301,Le=2302,Fe=2303,je=2400,De=2401,Ue=2402,We=2500,qe=2501,Je=0,Xe=1,Ye=2,He=3200,Ze=3201,Ge=3202,$e=3203,Qe=0,Ke=1,ti="",ei="srgb",ii="srgb-linear",si="linear",ri="srgb",ni="",ai="rg",oi="ga",hi=0,li=7680,ci=7681,ui=7682,di=7683,pi=34055,mi=34056,yi=5386,gi=512,fi=513,xi=514,bi=515,vi=516,wi=517,Mi=518,Si=519,_i=512,Ai=513,Ti=514,zi=515,Ci=516,Ii=517,Bi=518,ki=519,Oi=35044,Pi=35048,Ri=35040,Ni=35045,Vi=35049,Ei=35041,Li=35046,Fi=35050,ji=35042,Di="100",Ui="300 es",Wi=2e3,qi=2001,Ji={COMPUTE:"compute",RENDER:"render"},Xi={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Yi={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Hi={TEXTURE_COMPARE:"depthTextureCompare"};const Zi={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Gi(t,e){return new Zi[t](e)}function $i(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Qi(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ki(){const t=Qi("canvas");return t.style.display="block",t}const ts={};let es=null;function is(t){es=t}function ss(){return es}function rs(...t){const e="THREE."+t.shift();es?es("log",e,...t):console.log(e,...t)}function ns(t){const e=t[0];if("string"==typeof e&&e.startsWith("TSL:")){const e=t[1];e&&e.isStackTrace?t[0]+=" "+e.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function as(...t){const e="THREE."+(t=ns(t)).shift();if(es)es("warn",e,...t);else{const i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function os(...t){const e="THREE."+(t=ns(t)).shift();if(es)es("error",e,...t);else{const i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function hs(...t){const e=t.join(" ");e in ts||(ts[e]=!0,as(...t))}function ls(){return"undefined"!=typeof self&&void 0!==self.scheduler&&void 0!==self.scheduler.yield?self.scheduler.yield():new Promise(t=>{requestAnimationFrame(t)})}function cs(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}const us={[D]:1,[W]:6,[J]:7,[q]:5,[U]:0,[Y]:2,[H]:4,[X]:3};class ds{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const s=i[t];if(void 0!==s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,s=e.length;i>8&255]+ps[t>>16&255]+ps[t>>24&255]+"-"+ps[255&e]+ps[e>>8&255]+"-"+ps[e>>16&15|64]+ps[e>>24&255]+"-"+ps[63&i|128]+ps[i>>8&255]+"-"+ps[i>>16&255]+ps[i>>24&255]+ps[255&s]+ps[s>>8&255]+ps[s>>16&255]+ps[s>>24&255]).toLowerCase()}function xs(t,e,i){return Math.max(e,Math.min(i,t))}function bs(t,e){return(t%e+e)%e}function vs(t,e,i){return(1-i)*t+i*e}function ws(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ms(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ss={DEG2RAD:ys,RAD2DEG:gs,generateUUID:fs,clamp:xs,euclideanModulo:bs,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:vs,damp:function(t,e,i,s){return vs(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(bs(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(ms=t);let e=ms+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ys},radToDeg:function(t){return t*gs},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){const n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),c=a((e+s)/2),u=n((e-s)/2),d=a((e-s)/2),p=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*c,h*u,h*d,o*l);break;case"YZY":t.set(h*d,o*c,h*u,o*l);break;case"ZXZ":t.set(h*u,h*d,o*c,o*l);break;case"XZX":t.set(o*c,h*m,h*p,o*l);break;case"YXY":t.set(h*p,o*c,h*m,o*l);break;case"ZYZ":t.set(h*m,h*p,o*c,o*l);break;default:as("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Ms,denormalize:ws};class _s{static{_s.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=xs(this.x,t.x,e.x),this.y=xs(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=xs(this.x,t,e),this.y=xs(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(xs(i,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(xs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class As{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],c=i[s+3],u=r[n+0],d=r[n+1],p=r[n+2],m=r[n+3];if(c!==m||o!==u||h!==d||l!==p){let t=o*u+h*d+l*p+c*m;t<0&&(u=-u,d=-d,p=-p,m=-m,t=-t);let e=1-a;if(t<.9995){const i=Math.acos(t),s=Math.sin(i);e=Math.sin(e*i)/s,o=o*e+u*(a=Math.sin(a*i)/s),h=h*e+d*a,l=l*e+p*a,c=c*e+m*a}else{o=o*e+u*a,h=h*e+d*a,l=l*e+p*a,c=c*e+m*a;const t=1/Math.sqrt(o*o+h*h+l*l+c*c);o*=t,h*=t,l*=t,c*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,s,r,n){const a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],c=r[n],u=r[n+1],d=r[n+2],p=r[n+3];return t[e]=a*p+l*c+o*d-h*u,t[e+1]=o*p+l*u+h*c-a*d,t[e+2]=h*p+l*d+a*u-o*c,t[e+3]=l*p-a*c-o*u-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),c=a(r/2),u=o(i/2),d=o(s/2),p=o(r/2);switch(n){case"XYZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"YXZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"ZXY":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"ZYX":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"YZX":this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p;break;case"XZY":this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p;break;default:as("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],c=e[10],u=i+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>c){const t=2*Math.sqrt(1+i-a-c);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>c){const t=2*Math.sqrt(1+a-i-c);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+c-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xs(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){const t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ts{static{Ts.prototype.isVector3=!0}constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Cs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Cs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),c=2*(r*i-n*e);return this.x=e+o*h+n*c-a*l,this.y=i+o*l+a*h-r*c,this.z=s+o*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=xs(this.x,t.x,e.x),this.y=xs(this.y,t.y,e.y),this.z=xs(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=xs(this.x,t,e),this.y=xs(this.y,t,e),this.z=xs(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(xs(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return zs.copy(this).projectOnVector(t),this.sub(zs)}reflect(t){return this.sub(zs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(xs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const zs=new Ts,Cs=new As;class Is{static{Is.prototype.isMatrix3=!0}constructor(t,e,i,s,r,n,a,o,h){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){const l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],c=i[7],u=i[2],d=i[5],p=i[8],m=s[0],y=s[3],g=s[6],f=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*f+o*v,r[3]=n*y+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*f+c*v,r[4]=h*y+l*x+c*w,r[7]=h*g+l*b+c*M,r[2]=u*m+d*f+p*v,r[5]=u*y+d*x+p*w,r[8]=u*g+d*b+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=l*n-a*h,u=a*o-l*r,d=h*r-n*o,p=e*c+i*u+s*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=u*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=d*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,a){const o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Bs.makeScale(t,e)),this}rotate(t){return this.premultiply(Bs.makeRotation(-t)),this}translate(t,e){return this.premultiply(Bs.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Bs=new Is,ks=(new Is).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Os=(new Is).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ps(){const t={enabled:!0,workingColorSpace:ii,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===ri&&(t.r=Ns(t.r),t.g=Ns(t.g),t.b=Ns(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===ri&&(t.r=Vs(t.r),t.g=Vs(t.g),t.b=Vs(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?si:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,i){return hs("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,i)},toWorkingColorSpace:function(e,i){return hs("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,i)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],s=[.3127,.329];return t.define({[ii]:{primaries:e,whitePoint:s,transfer:si,toXYZ:ks,fromXYZ:Os,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:ei},outputColorSpaceConfig:{drawingBufferColorSpace:ei}},[ei]:{primaries:e,whitePoint:s,transfer:ri,toXYZ:ks,fromXYZ:Os,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:ei}}}),t}const Rs=Ps();function Ns(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Vs(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Es;class Ls{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Es&&(Es=Qi("canvas")),Es.width=t.width,Es.height=t.height;const e=Es.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Es}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Qi("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;t1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ws).x}get height(){return this.source.getSize(Ws).y}get depth(){return this.source.getSize(Ws).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(void 0===i){as(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const s=this[e];void 0!==s?s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i:as(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ht)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case mt:t.x=t.x-Math.floor(t.x);break;case yt:t.x=t.x<0?0:1;break;case gt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case mt:t.y=t.y-Math.floor(t.y);break;case yt:t.y=t.y<0?0:1;break;case gt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}qs.DEFAULT_IMAGE=null,qs.DEFAULT_MAPPING=ht,qs.DEFAULT_ANISOTROPY=1;class Js{static{Js.prototype.isVector4=!0}constructor(t=0,e=0,i=0,s=1){this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r;const n=.01,a=.1,o=t.elements,h=o[0],l=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],y=o[6],g=o[10];if(Math.abs(l-u)o&&t>f?tf?o1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),null!==this.pivot&&(s.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e0){s.children=[];for(let e=0;e0){s.animations=[];for(let e=0;e0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),c.length>0&&(i.nodes=c)}return i.object=s,i;function n(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=null!==t.pivot?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;eo+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=o-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(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,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:t,target:this})));null!==a&&(s=e.getPose(t.targetRaySpace,i),null===s&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(zr)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new Tr;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}const Ir={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},Br={h:0,s:0,l:0},kr={h:0,s:0,l:0};function Or(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Pr{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ei){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Rs.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=Rs.workingColorSpace){return this.r=t,this.g=e,this.b=i,Rs.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=Rs.workingColorSpace){if(t=bs(t,1),e=xs(e,0,1),i=xs(i,0,1),0===e)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=Or(r,s,t+1/3),this.g=Or(r,s,t),this.b=Or(r,s,t-1/3)}return Rs.colorSpaceToWorking(this,s),this}setStyle(t,e=ei){function i(e){void 0!==e&&parseFloat(e)<1&&as("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=s[1],a=s[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:as("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=s[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);as("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ei){const i=Ir[t.toLowerCase()];return void 0!==i?this.setHex(i,e):as("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ns(t.r),this.g=Ns(t.g),this.b=Ns(t.b),this}copyLinearToSRGB(t){return this.r=Vs(t.r),this.g=Vs(t.g),this.b=Vs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ei){return Rs.workingToColorSpace(Rr.copy(this),t),65536*Math.round(xs(255*Rr.r,0,255))+256*Math.round(xs(255*Rr.g,0,255))+Math.round(xs(255*Rr.b,0,255))}getHexString(t=ei){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rs.workingColorSpace){Rs.workingToColorSpace(Rr.copy(this),e);const i=Rr.r,s=Rr.g,r=Rr.b,n=Math.max(i,s,r),a=Math.min(i,s,r);let o,h;const l=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=l<=.5?t/(n+a):t/(2-n-a),n){case i:o=(s-r)/t+(s0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}const Lr=new Ts,Fr=new Ts,jr=new Ts,Dr=new Ts,Ur=new Ts,Wr=new Ts,qr=new Ts,Jr=new Ts,Xr=new Ts,Yr=new Ts,Hr=new Js,Zr=new Js,Gr=new Js;class $r{constructor(t=new Ts,e=new Ts,i=new Ts){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Lr.subVectors(t,e),s.cross(Lr);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){Lr.subVectors(s,e),Fr.subVectors(i,e),jr.subVectors(t,e);const n=Lr.dot(Lr),a=Lr.dot(Fr),o=Lr.dot(jr),h=Fr.dot(Fr),l=Fr.dot(jr),c=n*h-a*a;if(0===c)return r.set(0,0,0),null;const u=1/c,d=(h*o-a*l)*u,p=(n*l-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,Dr)&&(Dr.x>=0&&Dr.y>=0&&Dr.x+Dr.y<=1)}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,Dr)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Dr.x),o.addScaledVector(n,Dr.y),o.addScaledVector(a,Dr.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return Hr.setScalar(0),Zr.setScalar(0),Gr.setScalar(0),Hr.fromBufferAttribute(t,e),Zr.fromBufferAttribute(t,i),Gr.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(Hr,r.x),n.addScaledVector(Zr,r.y),n.addScaledVector(Gr,r.z),n}static isFrontFacing(t,e,i,s){return Lr.subVectors(i,e),Fr.subVectors(t,e),Lr.cross(Fr).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Lr.subVectors(this.c,this.b),Fr.subVectors(this.a,this.b),.5*Lr.cross(Fr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return $r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return $r.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return $r.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return $r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return $r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,r=this.c;let n,a;Ur.subVectors(s,i),Wr.subVectors(r,i),Jr.subVectors(t,i);const o=Ur.dot(Jr),h=Wr.dot(Jr);if(o<=0&&h<=0)return e.copy(i);Xr.subVectors(t,s);const l=Ur.dot(Xr),c=Wr.dot(Xr);if(l>=0&&c<=l)return e.copy(s);const u=o*c-l*h;if(u<=0&&o>=0&&l<=0)return n=o/(o-l),e.copy(i).addScaledVector(Ur,n);Yr.subVectors(t,r);const d=Ur.dot(Yr),p=Wr.dot(Yr);if(p>=0&&d<=p)return e.copy(r);const m=d*h-o*p;if(m<=0&&h>=0&&p<=0)return a=h/(h-p),e.copy(i).addScaledVector(Wr,a);const y=l*p-d*c;if(y<=0&&c-l>=0&&d-p>=0)return qr.subVectors(r,s),a=(c-l)/(c-l+(d-p)),e.copy(s).addScaledVector(qr,a);const g=1/(y+m+u);return n=m*g,a=u*g,e.copy(i).addScaledVector(Ur,n).addScaledVector(Wr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class Qr{constructor(t=new Ts(1/0,1/0,1/0),e=new Ts(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tn),tn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ln),cn.subVectors(this.max,ln),sn.subVectors(t.a,ln),rn.subVectors(t.b,ln),nn.subVectors(t.c,ln),an.subVectors(rn,sn),on.subVectors(nn,rn),hn.subVectors(sn,nn);let e=[0,-an.z,an.y,0,-on.z,on.y,0,-hn.z,hn.y,an.z,0,-an.x,on.z,0,-on.x,hn.z,0,-hn.x,-an.y,an.x,0,-on.y,on.x,0,-hn.y,hn.x,0];return!!pn(e,sn,rn,nn,cn)&&(e=[1,0,0,0,1,0,0,0,1],!!pn(e,sn,rn,nn,cn)&&(un.crossVectors(an,on),e=[un.x,un.y,un.z],pn(e,sn,rn,nn,cn)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tn).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Kr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kr)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Kr=[new Ts,new Ts,new Ts,new Ts,new Ts,new Ts,new Ts,new Ts],tn=new Ts,en=new Qr,sn=new Ts,rn=new Ts,nn=new Ts,an=new Ts,on=new Ts,hn=new Ts,ln=new Ts,cn=new Ts,un=new Ts,dn=new Ts;function pn(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){dn.fromArray(t,n);const a=r.x*Math.abs(dn.x)+r.y*Math.abs(dn.y)+r.z*Math.abs(dn.z),o=e.dot(dn),h=i.dot(dn),l=s.dot(dn);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const mn=yn();function yn(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;!(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}function gn(t){Math.abs(t)>65504&&as("DataUtils.toHalfFloat(): Value out of range."),t=xs(t,-65504,65504),mn.floatView[0]=t;const e=mn.uint32View[0],i=e>>23&511;return mn.baseTable[i]+((8388607&e)>>mn.shiftTable[i])}function fn(t){const e=t>>10;return mn.uint32View[0]=mn.mantissaTable[mn.offsetTable[e]+(1023&t)]+mn.exponentTable[e],mn.floatView[0]}class xn{static toHalfFloat(t){return gn(t)}static fromHalfFloat(t){return fn(t)}}const bn=new Ts,vn=new _s;let wn=0;class Mn extends ds{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:wn++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=Oi,this.updateRanges=[],this.gpuType=Pt,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Pn.subVectors(t,this.center);const e=Pn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Pn,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Rn.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Pn.copy(t.center).add(Rn)),this.expandByPoint(Pn.copy(t.center).sub(Rn))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let Vn=0;const En=new Qs,Ln=new Ar,Fn=new Ts,jn=new Qr,Dn=new Qr,Un=new Ts;class Wn extends ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vn++}),this.uuid=fs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?In:zn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Is).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const s=this.attributes.tangent;return void 0!==s&&(s.transformDirection(t),s.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return En.makeRotationFromQuaternion(t),this.applyMatrix4(En),this}rotateX(t){return En.makeRotationX(t),this.applyMatrix4(En),this}rotateY(t){return En.makeRotationY(t),this.applyMatrix4(En),this}rotateZ(t){return En.makeRotationZ(t),this.applyMatrix4(En),this}translate(t,e,i){return En.makeTranslation(t,e,i),this.applyMatrix4(En),this}scale(t,e,i){return En.makeScale(t,e,i),this.applyMatrix4(En),this}lookAt(t){return Ln.lookAt(t),Ln.updateMatrix(),this.applyMatrix4(Ln.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fn).negate(),this.translate(Fn.x,Fn.y,Fn.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,s=t.length;ie.count&&as("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return os("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Ts(-1/0,-1/0,-1/0),new Ts(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const s=i[e];t.data.attributes[e]=s.toJSON(t.data)}const s={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const s=t.attributes;for(const t in s){const i=s[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],s=r[t];for(let t=0,r=s.length;t0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){as(`Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];void 0!==s?s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i:as(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==li&&(i.stencilFail=this.stencilFail),this.stencilZFail!==li&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==li&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Gn extends Zn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Pr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const $n=new Ts,Qn=new Ts,Kn=new Ts,ta=new _s,ea=new _s,ia=new Qs,sa=new Ts,ra=new Ts,na=new Ts,aa=new _s,oa=new _s,ha=new _s;class la extends Ar{constructor(t=new Gn){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Yn){Yn=new Wn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new qn(t,5);Yn.setIndex([0,1,2,0,2,3]),Yn.setAttribute("position",new Xn(e,3,0,!1)),Yn.setAttribute("uv",new Xn(e,2,3,!1))}this.geometry=Yn,this.material=t,this.center=new _s(.5,.5),this.count=1}raycast(t,e){null===t.camera&&os('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Qn.setFromMatrixScale(this.matrixWorld),ia.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Kn.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Qn.multiplyScalar(-Kn.z);const i=this.material.rotation;let s,r;0!==i&&(r=Math.cos(i),s=Math.sin(i));const n=this.center;ca(sa.set(-.5,-.5,0),Kn,n,Qn,s,r),ca(ra.set(.5,-.5,0),Kn,n,Qn,s,r),ca(na.set(.5,.5,0),Kn,n,Qn,s,r),aa.set(0,0),oa.set(1,0),ha.set(1,1);let a=t.ray.intersectTriangle(sa,ra,na,!1,$n);if(null===a&&(ca(ra.set(-.5,.5,0),Kn,n,Qn,s,r),oa.set(0,1),a=t.ray.intersectTriangle(sa,na,ra,!1,$n),null===a))return;const o=t.ray.origin.distanceTo($n);ot.far||e.push({distance:o,point:$n.clone(),uv:$r.getInterpolation($n,sa,ra,na,aa,oa,ha,new _s),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ca(t,e,i,s,r,n){ta.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(ea.x=n*ta.x-r*ta.y,ea.y=r*ta.x+n*ta.y):ea.copy(ta),t.copy(e),t.x+=ea.x,t.y+=ea.y,t.applyMatrix4(ia)}const ua=new Ts,da=new Ts;class pa extends Ar{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){ua.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(ua);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){ua.setFromMatrixPosition(t.matrixWorld),da.setFromMatrixPosition(this.matrixWorld);const i=ua.distanceTo(da)/t.zoom;let s,r;for(e[0].object.visible=!0,s=1,r=e.length;s=t))break;e[s-1].object.visible=!1,e[s].object.visible=!0}for(this._currentLevel=s-1;s0)if(c=n*o-a,u=n*a-o,p=r*l,c>=0)if(u>=-p)if(u<=p){const t=1/l;c*=t,u*=t,d=c*(c+n*u+2*a)+u*(n*c+u+2*o)+h}else u=r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u=-r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u<=-p?(c=Math.max(0,-(-n*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h):u<=p?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+h):(c=Math.max(0,-(n*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,c),s&&s.copy(ya).addScaledVector(ga,u),d}intersectSphere(t,e){ma.subVectors(t.center,this.origin);const i=ma.dot(this.direction),s=ma.dot(ma)-i*i,r=t.radius*t.radius;if(s>r)return null;const n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,r,n,a,o;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,s=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,s=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),i>n||r>s?null:((r>i||isNaN(i))&&(i=r),(n=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),i>o||a>s?null:((a>i||i!=i)&&(i=a),(o=0?i:s,e)))}intersectsBox(t){return null!==this.intersectBox(t,ma)}intersectTriangle(t,e,i,s,r){xa.subVectors(e,t),ba.subVectors(i,t),va.crossVectors(xa,ba);let n,a=this.direction.dot(va);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}fa.subVectors(this.origin,t);const o=n*this.direction.dot(ba.crossVectors(fa,ba));if(o<0)return null;const h=n*this.direction.dot(xa.cross(fa));if(h<0)return null;if(o+h>a)return null;const l=-n*fa.dot(va);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ma extends Zn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pr(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 hr,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Sa=new Qs,_a=new wa,Aa=new Nn,Ta=new Ts,za=new Ts,Ca=new Ts,Ia=new Ts,Ba=new Ts,ka=new Ts,Oa=new Ts,Pa=new Ts;class Ra extends Ar{constructor(t=new Wn,e=new Ma){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t(t.far-t.near)**2)return}Sa.copy(r).invert(),_a.copy(t.ray).applyMatrix4(Sa),null!==i.boundingBox&&!1===_a.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,_a)}}_computeIntersections(t,e,i){let s;const r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=u.length;ri.far?null:{distance:l,point:Pa.clone(),object:t}}(t,e,i,s,za,Ca,Ia,Oa);if(c){const t=new Ts;$r.getBarycoord(Oa,za,Ca,Ia,t),r&&(c.uv=$r.getInterpolatedAttribute(r,o,h,l,t,new _s)),n&&(c.uv1=$r.getInterpolatedAttribute(n,o,h,l,t,new _s)),a&&(c.normal=$r.getInterpolatedAttribute(a,o,h,l,t,new Ts),c.normal.dot(s.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:h,c:l,normal:new Ts,materialIndex:0};$r.getNormal(za,Ca,Ia,e.normal),c.face=e,c.barycoord=t}return c}const Va=new Js,Ea=new Js,La=new Js,Fa=new Js,ja=new Qs,Da=new Ts,Ua=new Nn,Wa=new Qs,qa=new wa;class Ja extends Ra{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=at,this.bindMatrix=new Qs,this.bindMatrixInverse=new Qs,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qr),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||ho.getNormalMatrix(t),s=this.coplanarPoint(ao).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const co=new Nn,uo=new _s(.5,.5),po=new Ts;class mo{constructor(t=new lo,e=new lo,i=new lo,s=new lo,r=new lo,n=new lo){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){const s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],c=r[5],u=r[6],d=r[7],p=r[8],m=r[9],y=r[10],g=r[11],f=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,d-l,g-p,v-f).normalize(),s[1].setComponents(h+n,d+l,g+p,v+f).normalize(),s[2].setComponents(h+a,d+c,g+m,v+x).normalize(),s[3].setComponents(h-a,d-c,g-m,v-x).normalize(),i)s[4].setComponents(o,u,y,b).normalize(),s[5].setComponents(h-o,d-u,g-y,v-b).normalize();else if(s[4].setComponents(h-o,d-u,g-y,v-b).normalize(),e===Wi)s[5].setComponents(h+o,d+u,g+y,v+b).normalize();else{if(e!==qi)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);s[5].setComponents(o,u,y,b).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),co.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),co.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(co)}intersectsSprite(t){co.center.set(0,0,0);const e=uo.distanceTo(t.center);return co.radius=.7071067811865476+e,co.applyMatrix4(t.matrixWorld),this.intersectsSphere(co)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,po.y=s.normal.y>0?t.max.y:t.min.y,po.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(po)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const yo=new Qs,go=new mo;class fo{constructor(){this.coordinateSystem=Wi}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}}const Mo=new Qs,So=new Pr(1,1,1),_o=new mo,Ao=new fo,To=new Qr,zo=new Nn,Co=new Ts,Io=new Ts,Bo=new Ts,ko=new wo,Oo=new Ra,Po=[];function Ro(t,e,i=0){const s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let n=0;n65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new Mn(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(!t.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qr);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(xo),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));const s=this._matricesTexture;Mo.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;const r=this._colorsTexture;return r&&(So.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){this._initializeGeometry(t),this._validateGeometry(t);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const n=t.getIndex();if(null!==n&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=-1===i?n.count:i),-1!==s.indexStart&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(xo),a=this._availableGeometryIds.shift(),r[a]=s):(a=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(a,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,a}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,h=a.reservedVertexCount;a.vertexCount=e.getAttribute("position").count;for(const t in i.attributes){const s=e.getAttribute(t),r=i.getAttribute(t);Ro(s,r,o);const n=s.itemSize;for(let t=s.count,e=h;t=e.length||!1===e[t].active)return this;const i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){const t=new Qr,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){const e=new Nn;this.getBoundingBoxAt(t,To),To.getCenter(e.center);const r=i.index,n=i.attributes.position;let a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`)}const s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Wn,this._initializeGeometry(s));const r=this.geometry;s.index&&No(s.index.array,r.index.array);for(const t in s.attributes)No(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){const i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;Oo.material=this.material,Oo.geometry.index=n.index,Oo.geometry.attributes=n.attributes,null===Oo.geometry.boundingBox&&(Oo.geometry.boundingBox=new Qr),null===Oo.geometry.boundingSphere&&(Oo.geometry.boundingSphere=new Nn);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const n=s.getIndex();let a=null===n?1:n.array.BYTES_PER_ELEMENT,o=1;r.wireframe&&(o=2,a=s.attributes.position.count>65535?4:2);const h=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data,y=i.isArrayCamera?Ao:_o;d&&!i.isArrayCamera&&(Mo.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),_o.setFromProjectionMatrix(Mo,i.coordinateSystem,i.reversedDepth));let g=0;if(this.sortObjects){Mo.copy(this.matrixWorld).invert(),Co.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Mo),Io.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Mo);for(let t=0,e=h.length;t0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;Wo.applyMatrix4(t.matrixWorld);const h=e.ray.origin.distanceTo(Wo);return he.far?void 0:{distance:h,point:qo.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Yo=new Ts,Ho=new Ts;class Zo extends Jo{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class rh extends qs{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class nh extends rh{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class ah extends qs{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=ft,this.minFilter=ft,this.generateMipmaps=!1,this.needsUpdate=!0}}class oh extends qs{constructor(t,e,i,s,r,n,a,o,h,l,c,u){super(null,n,a,o,h,l,s,r,c,u),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class hh extends oh{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=yt,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class lh extends oh{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,lt),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ch extends qs{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class uh extends qs{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class dh extends qs{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const l=t?t.parentNode:null;null!==l&&"requestPaint"in l&&(l.onpaint=()=>{this.needsUpdate=!0},l.requestPaint())}dispose(){const t=this.image?this.image.parentNode:null;null!==t&&"onpaint"in t&&(t.onpaint=null),super.dispose()}}class ph extends qs{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,c=1){if(l!==Wt&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:c},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new js(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class mh extends ph{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1},c=[l,l,l,l,l,l];super(t,t,e,i,s,r,n,a,o,h),this.image=c,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class yh extends qs{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class gh extends Wn{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r),n=Math.floor(n);const o=[],h=[],l=[],c=[];let u=0,d=0;function p(t,e,i,s,r,n,p,m,y,g,f){const x=n/y,b=p/g,v=n/2,w=p/2,M=m/2,S=y+1,_=g+1;let A=0,T=0;const z=new Ts;for(let n=0;n<_;n++){const a=n*b-w;for(let o=0;o0?1:-1,l.push(z.x,z.y,z.z),c.push(o/y),c.push(1-n/g),A+=1}}for(let t=0;t0){const t=(f-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x}(),!1===n&&(t>0&&f(!0),e>0&&f(!1)),this.setIndex(l),this.setAttribute("position",new kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class vh extends bh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new vh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class wh extends Wn{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t,e,i,s){const r=s+1,n=[];for(let s=0;s<=r;s++){n[s]=[];const a=t.clone().lerp(i,s/r),o=e.clone().lerp(i,s/r),h=r-s;for(let t=0;t<=h;t++)n[s][t]=0===t&&s===r?a:a.clone().lerp(o,t/h)}for(let t=0;t.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new kn(r,3)),this.setAttribute("normal",new kn(r.slice(),3)),this.setAttribute("uv",new kn(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wh(t.vertices,t.indices,t.radius,t.detail)}}class Mh extends wh{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Mh(t.radius,t.detail)}}const Sh=new Ts,_h=new Ts,Ah=new Ts,Th=new $r;class zh extends Wn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=4,s=Math.pow(10,i),r=Math.cos(ys*e),n=t.getIndex(),a=t.getAttribute("position"),o=n?n.count:a.count,h=[0,0,0],l=["a","b","c"],c=new Array(3),u={},d=[];for(let t=0;t0)){h=s;break}h=s-1}if(s=h,i[s]===n)return s/(r-1);const l=i[s];return(s+(n-l)/(i[s+1]-l))/(r-1)}getTangent(t,e){const i=1e-4;let s=t-i,r=t+i;s<0&&(s=0),r>1&&(r=1);const n=this.getPoint(s),a=this.getPoint(r),o=e||(n.isVector2?new _s:new Ts);return o.copy(a).sub(n).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Ts,s=[],r=[],n=[],a=new Ts,o=new Qs;for(let e=0;e<=t;e++){const i=e/t;s[e]=this.getTangentAt(i,new Ts)}r[0]=new Ts,n[0]=new Ts;let h=Number.MAX_VALUE;const l=Math.abs(s[0].x),c=Math.abs(s[0].y),u=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),c<=h&&(h=c,i.set(0,1,0)),u<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(xs(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(xs(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ih extends Ch{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new _s){const i=e,s=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?a=s[(h-1)%r]:(Ph.subVectors(s[0],s[1]).add(s[0]),a=Ph);const c=s[h%r],u=s[(h+1)%r];if(this.closed||h+2s.length-2?s.length-1:n+1],c=s[n>s.length-3?s.length-1:n+2];return i.set(Lh(a,o.x,h.x,l.x,c.x),Lh(a,o.y,h.y,l.y,c.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){const t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,s=this.curves.length;i1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class $h extends Gh{constructor(t){super(t),this.uuid=fs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,s=this.holes.length;i80*i){o=t[0],h=t[1];let e=o,s=h;for(let n=i;ne&&(e=i),r>s&&(s=r)}l=Math.max(e-o,s-h),l=0!==l?32767/l:0}return el(n,a,i,o,h,l,0),a}function Kh(t,e,i,s,r){let n;if(r===function(t,e,i,s){let r=0;for(let n=e,a=i-s;n0)for(let r=e;r=e;r-=s)n=wl(r/s|0,t[r],t[r+1],n);return n&&yl(n,n.next)&&(Ml(n),n=n.next),n}function tl(t,e){if(!t)return t;e||(e=t);let i,s=t;do{if(i=!1,s.steiner||!yl(s,s.next)&&0!==ml(s.prev,s,s.next))s=s.next;else{if(Ml(s),s=e=s.prev,s===s.next)break;i=!0}}while(i||s!==e);return e}function el(t,e,i,s,r,n,a){if(!t)return;!a&&n&&function(t,e,i,s){let r=t;do{0===r.z&&(r.z=ll(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(t,s,r,n);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(n?sl(t,s,r,n):il(t))e.push(h.i,t.i,l.i),Ml(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?el(t=rl(tl(t),e),e,i,s,r,n,2):2===a&&nl(t,e,i,s,r,n):el(tl(t),e,i,s,r,n,1);break}}}function il(t){const e=t.prev,i=t,s=t.next;if(ml(e,i,s)>=0)return!1;const r=e.x,n=i.x,a=s.x,o=e.y,h=i.y,l=s.y,c=Math.min(r,n,a),u=Math.min(o,h,l),d=Math.max(r,n,a),p=Math.max(o,h,l);let m=s.next;for(;m!==e;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=p&&dl(r,o,n,h,a,l,m.x,m.y)&&ml(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function sl(t,e,i,s){const r=t.prev,n=t,a=t.next;if(ml(r,n,a)>=0)return!1;const o=r.x,h=n.x,l=a.x,c=r.y,u=n.y,d=a.y,p=Math.min(o,h,l),m=Math.min(c,u,d),y=Math.max(o,h,l),g=Math.max(c,u,d),f=ll(p,m,e,i,s),x=ll(y,g,e,i,s);let b=t.prevZ,v=t.nextZ;for(;b&&b.z>=f&&v&&v.z<=x;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&dl(o,c,h,u,l,d,b.x,b.y)&&ml(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&dl(o,c,h,u,l,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=f;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&dl(o,c,h,u,l,d,b.x,b.y)&&ml(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&dl(o,c,h,u,l,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function rl(t,e){let i=t;do{const s=i.prev,r=i.next.next;!yl(s,r)&&gl(s,i,i.next,r)&&bl(s,r)&&bl(r,s)&&(e.push(s.i,i.i,r.i),Ml(i),Ml(i.next),i=t=r),i=i.next}while(i!==t);return tl(i)}function nl(t,e,i,s,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&pl(a,t)){let o=vl(a,t);return a=tl(a,a.next),o=tl(o,o.next),el(a,e,i,s,r,n,0),void el(o,e,i,s,r,n,0)}t=t.next}a=a.next}while(a!==t)}function al(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function ol(t,e){const i=function(t,e){let i=e;const s=t.x,r=t.y;let n,a=-1/0;if(yl(t,i))return i;do{if(yl(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>a&&(a=t,n=i.x=i.x&&i.x>=h&&s!==i.x&&ul(rn.x||i.x===n.x&&hl(n,i)))&&(n=i,c=e)}i=i.next}while(i!==o);return n}(t,e);if(!i)return e;const s=vl(i,t);return tl(s,s.next),tl(i,i.next)}function hl(t,e){return ml(t.prev,t,e.prev)<0&&ml(e.next,t,t.next)<0}function ll(t,e,i,s,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function cl(t){let e=t,i=t;do{(e.x=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function dl(t,e,i,s,r,n,a,o){return!(t===a&&e===o)&&ul(t,e,i,s,r,n,a,o)}function pl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&gl(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(bl(t,e)&&bl(e,t)&&function(t,e){let i=t,s=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(ml(t.prev,t,e.prev)||ml(t,e.prev,e))||yl(t,e)&&ml(t.prev,t,t.next)>0&&ml(e.prev,e,e.next)>0)}function ml(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function yl(t,e){return t.x===e.x&&t.y===e.y}function gl(t,e,i,s){const r=xl(ml(t,e,i)),n=xl(ml(t,e,s)),a=xl(ml(i,s,t)),o=xl(ml(i,s,e));return r!==n&&a!==o||(!(0!==r||!fl(t,i,e))||(!(0!==n||!fl(t,s,e))||(!(0!==a||!fl(i,t,s))||!(0!==o||!fl(i,e,s)))))}function fl(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function xl(t){return t>0?1:t<0?-1:0}function bl(t,e){return ml(t.prev,t,t.next)<0?ml(t,e,t.next)>=0&&ml(t,t.prev,e)>=0:ml(t,e,t.prev)<0||ml(t,t.next,e)<0}function vl(t,e){const i=Sl(t.i,t.x,t.y),s=Sl(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function wl(t,e,i,s){const r=Sl(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function Ml(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Sl(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class _l{static triangulate(t,e,i=2){return Qh(t,e,i)}}class Al{static area(t){const e=t.length;let i=0;for(let s=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function zl(t,e){for(let i=0;iNumber.EPSILON){const u=Math.sqrt(c),d=Math.sqrt(h*h+l*l),p=e.x-o/u,m=e.y+a/u,y=((i.x-l/d-p)*l-(i.y+h/d-m)*h)/(a*l-o*h);s=p+a*y-t.x,r=m+o*y-t.y;const g=s*s+r*r;if(g<=2)return new _s(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(c)):(s=a,r=o,n=Math.sqrt(c/2))}return new _s(s/n,r/n)}const k=[];for(let t=0,e=z.length,i=e-1,s=t+1;t=0;t--){const e=t/p,i=c*Math.cos(e*Math.PI/2),s=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=z.length;t=0;){const s=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=o+2*p;t0)&&d.push(e,r,h),(t!==i-1||o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Gl extends Zl{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class $l extends Zn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Pr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ql extends $l{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new _s(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xs(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pr(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Pr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pr(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Kl extends Zn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Pr(16777215),this.specular=new Pr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class tc extends Zn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class ec extends Zn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class ic extends Zn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Pr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new hr,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class sc extends Zn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class rc extends Zn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nc extends Zn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new _s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ac extends Eo{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function oc(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function hc(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function lc(t,e,i){const s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){const s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function cc(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do{a=n[s],void 0!==a&&(e.push(n.time),i.push(...a)),n=t[r++]}while(void 0!==n);else if(void 0!==a.toArray)do{a=n[s],void 0!==a&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++]}while(void 0!==n);else do{a=n[s],void 0!==a&&(e.push(n.time),i.push(a)),n=t[r++]}while(void 0!==n)}class uc{static convertArray(t,e){return oc(t,e)}static isTypedArray(t){return $i(t)}static getKeyframeOrder(t){return hc(t)}static sortedArray(t,e,i){return lc(t,e,i)}static flattenJSON(t,e,i,s){cc(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){const n=t.clone();n.name=e;const a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=s.times[u]){const t=u*h+o,e=t+h-o;d=s.values.slice(t,e)}else{const t=s.createInterpolant(),e=o,i=h-o;t.evaluate(n),d=t.resultBuffer.slice(e,i)}"quaternion"===r&&(new As).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let t=0;t=r)){const a=e[1];t=r)break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(os("KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,s=this.values,r=i.length;0===r&&(os("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){const s=i[e];if("number"==typeof s&&isNaN(s)){os("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){os("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&$i(s))for(let e=0,i=s.length;e!==i;++e){const i=s[e];if(isNaN(i)){os("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===Le,r=t.length-1;let n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}fc.prototype.ValueTypeName="",fc.prototype.TimeBufferType=Float32Array,fc.prototype.ValueBufferType=Float32Array,fc.prototype.DefaultInterpolation=Ee;class xc extends fc{constructor(t,e,i){super(t,e,i)}}xc.prototype.ValueTypeName="bool",xc.prototype.ValueBufferType=Array,xc.prototype.DefaultInterpolation=Ve,xc.prototype.InterpolantFactoryMethodLinear=void 0,xc.prototype.InterpolantFactoryMethodSmooth=void 0;class bc extends fc{constructor(t,e,i,s){super(t,e,i,s)}}bc.prototype.ValueTypeName="color";class vc extends fc{constructor(t,e,i,s){super(t,e,i,s)}}vc.prototype.ValueTypeName="number";class wc extends dc{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e);let h=t*a;for(let t=h+a;h!==t;h+=4)As.slerpFlat(r,0,n,h-a,n,h,o);return r}}class Mc extends fc{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new wc(this.times,this.values,this.getValueSize(),t)}}Mc.prototype.ValueTypeName="quaternion",Mc.prototype.InterpolantFactoryMethodSmooth=void 0;class Sc extends fc{constructor(t,e,i){super(t,e,i)}}Sc.prototype.ValueTypeName="string",Sc.prototype.ValueBufferType=Array,Sc.prototype.DefaultInterpolation=Ve,Sc.prototype.InterpolantFactoryMethodLinear=void 0,Sc.prototype.InterpolantFactoryMethodSmooth=void 0;class _c extends fc{constructor(t,e,i,s){super(t,e,i,s)}}_c.prototype.ValueTypeName="vector";class Ac{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=fs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(Tc(i[t]).scale(s));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(fc.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){const r=e.length,n=[];for(let t=0;t1){const t=n[1];let e=s[t];e||(s[t]=e=[]),e.push(i)}}const n=[];for(const t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(as("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return os("AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,s,r){if(0!==i.length){const n=[],a=[];cc(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode;let o=t.length||-1;const h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==Oc[t])return void Oc[t].push({onLoad:e,onProgress:i,onError:s});Oc[t]=[],Oc[t].push({onLoad:e,onProgress:i,onError:s});const n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&as("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Oc[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n;let o=0;const h=new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{o+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}});return new Response(h)}throw new Pc(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,s=new TextDecoder(i);return t.arrayBuffer().then(t=>s.decode(t))}}}).then(e=>{zc.add(`file:${t}`,e);const i=Oc[t];delete Oc[t];for(let t=0,s=i.length;t{const i=Oc[t];if(void 0===i)throw this.manager.itemError(t),e;delete Oc[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Nc extends kc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Rc(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):os(e),r.manager.itemError(t)}},i,s)}parse(t){const e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=(new Pr).setHex(r.value);break;case"v2":s.uniforms[e].value=(new _s).fromArray(r.value);break;case"v3":s.uniforms[e].value=(new Ts).fromArray(r.value);break;case"v4":s.uniforms[e].value=(new Js).fromArray(r.value);break;case"m3":s.uniforms[e].value=(new Is).fromArray(r.value);break;case"m4":s.uniforms[e].value=(new Qs).fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=(new _s).fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=(new _s).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return pu.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:ql,SpriteMaterial:Gn,RawShaderMaterial:Gl,ShaderMaterial:Zl,PointsMaterial:$o,MeshPhysicalMaterial:Ql,MeshStandardMaterial:$l,MeshPhongMaterial:Kl,MeshToonMaterial:tc,MeshNormalMaterial:ec,MeshLambertMaterial:ic,MeshDepthMaterial:sc,MeshDistanceMaterial:rc,MeshBasicMaterial:Ma,MeshMatcapMaterial:nc,LineDashedMaterial:ac,LineBasicMaterial:Eo,Material:Zn}[t]}}class mu{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class yu extends Wn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class gu extends kc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Rc(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):os(e),r.manager.itemError(t)}},i,s)}parse(t){const e={},i={};function s(t,s){if(void 0!==e[s])return e[s];const r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];const s=t.arrayBuffers,r=s[e],n=new Uint32Array(r).buffer;return i[e]=n,n}(t,r.buffer),a=Gi(r.type,n),o=new qn(a,r.stride);return o.uuid=r.uuid,e[s]=o,o}const r=t.isInstancedBufferGeometry?new yu:new Wn,n=t.data.index;if(void 0!==n){const t=Gi(n.type,n.array);r.setIndex(new Mn(t,1))}const a=t.data.attributes;for(const e in a){const i=a[e];let n;if(i.isInterleavedBufferAttribute){const e=s(t.data,i.data);n=new Xn(e,i.itemSize,i.offset,i.normalized)}else{const t=Gi(i.type,i.array);n=new(i.isInstancedBufferAttribute?$a:Mn)(t,i.itemSize,i.normalized)}void 0!==i.name&&(n.name=i.name),void 0!==i.usage&&n.setUsage(i.usage),r.setAttribute(e,n)}const o=t.data.morphAttributes;if(o)for(const e in o){const i=o[e],n=[];for(let e=0,r=i.length;e0){const i=new Ic(e);r=new Lc(i),r.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){s=new Lc(this.manager),s.setCrossOrigin(this.crossOrigin);for(let e=0,s=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=(new Qr).fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=(new Nn).fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=c(t.matricesTexture.uuid),n._indirectTexture=c(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=c(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=(new Nn).fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=(new Qr).fromJSON(t.boundingBox));break;case"LOD":n=new pa;break;case"Line":n=new Jo(h(t.geometry),l(t.material));break;case"LineLoop":n=new Go(h(t.geometry),l(t.material));break;case"LineSegments":n=new Zo(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new ih(h(t.geometry),l(t.material));break;case"Sprite":n=new la(l(t.material));break;case"Group":n=new Tr;break;case"Bone":n=new Xa;break;default:n=new Ar}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.pivot&&(n.pivot=(new Ts).fromArray(t.pivot)),void 0!==t.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),void 0!==t.morphTargetInfluences&&(n.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.static&&(n.static=t.static),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t{if(!0!==Mu.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(Mu.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return zc.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),Mu.set(o,e),zc.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});zc.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let _u;class Au{static getContext(){return void 0===_u&&(_u=new(window.AudioContext||window.webkitAudioContext)),_u}static setContext(t){_u=t}}class Tu extends kc{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Rc(this.manager);function a(e){s?s(e):os(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{const i=t.slice(0);Au.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}const zu=new Qs,Cu=new Qs,Iu=new Qs;class Bu{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new eu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new eu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Iu.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,r=e.near*Math.tan(ys*e.fov*.5)/e.zoom;let n,a;Cu.elements[12]=-i,zu.elements[12]=i,n=-r*e.aspect+s,a=r*e.aspect+s,Iu.elements[0]=2*e.near/(a-n),Iu.elements[8]=(a+n)/(a-n),this.cameraL.projectionMatrix.copy(Iu),n=-r*e.aspect-s,a=r*e.aspect-s,Iu.elements[0]=2*e.near/(a-n),Iu.elements[8]=(a+n)/(a-n),this.cameraR.projectionMatrix.copy(Iu)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Cu),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(zu)}}const ku=-90;class Ou extends Ar{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new eu(ku,1,t,e);s.layers=this.layers,this.add(s);const r=new eu(ku,1,t,e);r.layers=this.layers,this.add(r);const n=new eu(ku,1,t,e);n.layers=this.layers,this.add(n);const a=new eu(ku,1,t,e);a.layers=this.layers,this.add(a);const o=new eu(ku,1,t,e);o.layers=this.layers,this.add(o);const h=new eu(ku,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(const t of e)this.remove(t);if(t===Wi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==qi)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,a,o,h,l]=this.children,c=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let y=!1;y=!0===t.isWebGLRenderer?t.state.buffers.depth.getReversed():t.reversedDepthBuffer,t.setRenderTarget(i,0,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,r),t.setRenderTarget(i,1,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,n),t.setRenderTarget(i,2,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,a),t.setRenderTarget(i,3,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,o),t.setRenderTarget(i,4,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),y&&!1===t.autoClear&&t.clearDepth(),t.render(e,l),t.setRenderTarget(c,u,d),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class Pu extends eu{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Ru{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,void 0!==t.hidden&&(this._pageVisibilityHandler=Nu.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==t?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Nu(){!1===this._document.hidden&&this.reset()}const Vu=new Ts,Eu=new As,Lu=new Ts,Fu=new Ts,ju=new Ts;class Du extends Ar{constructor(){super(),this.type="AudioListener",this.context=Au.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ru}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this._timer.update();const e=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Vu,Eu,Lu),Fu.set(0,0,-1).applyQuaternion(Eu),ju.set(0,1,0).applyQuaternion(Eu),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Vu.x,t),e.positionY.linearRampToValueAtTime(Vu.y,t),e.positionZ.linearRampToValueAtTime(Vu.z,t),e.forwardX.linearRampToValueAtTime(Fu.x,t),e.forwardY.linearRampToValueAtTime(Fu.y,t),e.forwardZ.linearRampToValueAtTime(Fu.z,t),e.upX.linearRampToValueAtTime(ju.x,t),e.upY.linearRampToValueAtTime(ju.y,t),e.upZ.linearRampToValueAtTime(ju.z,t)}else e.setPosition(Vu.x,Vu.y,Vu.z),e.setOrientation(Fu.x,Fu.y,Fu.z,ju.x,ju.y,ju.z)}}class Uu extends Ar{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void as("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void as("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;as("Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;as("Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i,r=s;t!==r;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){As.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){const n=this._workIndex*r;As.multiplyQuaternionsFlat(t,n,t,e,t,i),As.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){const n=1-s;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){const r=e+n;t[r]=t[r]+t[i+n]*s}}}const Gu="\\[\\]\\.:\\/",$u=new RegExp("["+Gu+"]","g"),Qu="[^"+Gu+"]",Ku="[^"+Gu.replace("\\.","")+"]",td=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Qu)+/(WCOD+)?/.source.replace("WCOD",Ku)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qu)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qu)+"$"),ed=["material","materials","bones","map"];class id{constructor(t,e,i){this.path=e,this.parsedPath=i||id.parseTrackName(e),this.node=id.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new id.Composite(t,e,i):new id(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace($u,"")}static parseTrackName(t){const e=td.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){const t=i.nodeName.substring(s+1);-1!==ed.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let s=0;s=r){const n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,h=e[o];if(void 0!==h)if(delete e[o],h0&&(e[a.uuid]=h),t[h]=a,t.pop();for(let t=0,e=s;t!==e;++t){const e=i[t];e[h]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let s=i[t];const r=this._bindings;if(void 0!==s)return r[s];const n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,c=new Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(c);for(let i=l,s=o.length;i!==s;++i){const s=o[i];c[i]=new id(s,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class rd{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=new Array(n),o={endingStart:je,endingEnd:je};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings&&Object.assign(o,e.settings),e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){const i=this._clip.duration,s=t._clip.duration,r=s/i,n=i/s;t.warp(1,r,e),this.warp(n,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const s=this._mixer,r=s.time,n=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);const n=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===qe)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let s=this.time+t,r=this._loopCount;const n=2202===i;if(0===t)return-1===r||!n||1&~r?s:e-s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else{if(!(s<0)){this.time=s;break t}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){const i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this._loopCount=r,this.time=s;if(n&&!(1&~r))return e-s}return s}_setEndings(t,e,i){const s=this._interpolantSettings;i?(s.endingStart=De,s.endingEnd=De):(s.endingStart=t?this.zeroSlopeAtStart?De:je:Ue,s.endingEnd=e?this.zeroSlopeAtEnd?De:je:Ue)}_scheduleFading(t,e,i){const s=this._mixer,r=s.time;let n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);const a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}const nd=new Float32Array(1);class ad extends ds{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(t,e){const i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){const r=s[t],h=r.name;let c=l[h];if(void 0!==c)++c.referenceCount,n[t]=c;else{if(c=n[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,h));continue}const s=e&&e._propertyBindings[t].binding.parsedPath;c=new Zu(id.create(i,h,s),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,h),n[t]=c}a[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(s,t,r,n)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,wd).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Sd=new Ts,_d=new Ts,Ad=new Ts,Td=new Ts,zd=new Ts,Cd=new Ts,Id=new Ts;class Bd{constructor(t=new Ts,e=new Ts){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Sd.subVectors(t,this.start),_d.subVectors(this.end,this.start);const i=_d.dot(_d);if(0===i)return 0;let s=_d.dot(Sd)/i;return e&&(s=xs(s,0,1)),s}closestPointToPoint(t,e,i){const s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=Cd,i=Id){const s=1e-8*1e-8;let r,n;const a=this.start,o=t.start,h=this.end,l=t.end;Ad.subVectors(h,a),Td.subVectors(l,o),zd.subVectors(a,o);const c=Ad.dot(Ad),u=Td.dot(Td),d=Td.dot(zd);if(c<=s&&u<=s)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(c<=s)r=0,n=d/u,n=xs(n,0,1);else{const t=Ad.dot(zd);if(u<=s)n=0,r=xs(-t/c,0,1);else{const e=Ad.dot(Td),i=c*u-e*e;r=0!==i?xs((e*d-t*u)/i,0,1):0,n=(e*r+d)/u,n<0?(n=0,r=xs(-t/c,0,1)):n>1&&(n=1,r=xs((e-t)/c,0,1))}}return e.copy(a).addScaledVector(Ad,r),i.copy(o).addScaledVector(Td,n),e.distanceToSquared(i)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const kd=new Ts;class Od extends Ar{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new Wn,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,i=32;t1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{sp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(sp,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class op extends Zo{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Wn;i.setAttribute("position",new kn(e,3)),i.setAttribute("color",new kn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new Eo({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const s=new Pr,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class hp{constructor(){this.type="ShapePath",this.color=new Pr,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Gh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let s=!1;for(let r=i-1,n=0;nNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s}const i=Al.isClockWise,s=this.subPaths;if(0===s.length)return[];let r,n,a;const o=[];if(1===s.length)return n=s[0],a=new $h,a.curves=n.curves,o.push(a),o;let h=!i(s[0].getPoints());h=t?!h:h;const l=[],c=[];let u,d,p=[],m=0;c[m]=void 0,p[m]=[];for(let e=0,a=s.length;e1){let t=!1,i=0;for(let t=0,e=c.length;t0&&!1===t&&(p=l)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}(t,e)}static cover(t,e){return function(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}(t,e)}static fill(t){return function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}(t)}static getByteLength(t,e,i,s){return cp(t,e,i,s)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?as("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);export{it as ACESFilmicToneMapping,w as AddEquation,$ as AddOperation,qe as AdditiveAnimationBlendMode,g as AdditiveBlending,rt as AgXToneMapping,jt as AlphaFormat,ki as AlwaysCompare,U as AlwaysDepth,Si as AlwaysStencilFunc,lu as AmbientLight,rd as AnimationAction,Ac as AnimationClip,Nc as AnimationLoader,ad as AnimationMixer,sd as AnimationObjectGroup,uc as AnimationUtils,Bh as ArcCurve,Pu as ArrayCamera,ap as ArrowHelper,at as AttachedBindMode,Uu as Audio,Hu as AudioAnalyser,Au as AudioContext,Du as AudioListener,Tu as AudioLoader,op as AxesHelper,d as BackSide,He as BasicDepthPacking,o as BasicShadowMap,Vo as BatchedMesh,gc as BezierInterpolant,Xa as Bone,xc as BooleanKeyframeTrack,Md as Box2,Qr as Box3,ep as Box3Helper,gh as BoxGeometry,tp as BoxHelper,Mn as BufferAttribute,Wn as BufferGeometry,gu as BufferGeometryLoader,Ct as ByteType,zc as Cache,$c as Camera,$d as CameraHelper,uh as CanvasTexture,fh as CapsuleGeometry,Eh as CatmullRomCurve3,et as CineonToneMapping,xh as CircleGeometry,yt as ClampToEdgeWrapping,fd as Clock,Pr as Color,bc as ColorKeyframeTrack,Rs as ColorManagement,Hi as Compatibility,hh as CompressedArrayTexture,lh as CompressedCubeTexture,oh as CompressedTexture,Vc as CompressedTextureLoader,vh as ConeGeometry,F as ConstantAlphaFactor,E as ConstantColorFactor,lp as Controls,Ou as CubeCamera,mh as CubeDepthTexture,lt as CubeReflectionMapping,ct as CubeRefractionMapping,ch as CubeTexture,Fc as CubeTextureLoader,pt as CubeUVReflectionMapping,Dh as CubicBezierCurve,Uh as CubicBezierCurve3,pc as CubicInterpolant,r as CullFaceBack,n as CullFaceFront,a as CullFaceFrontBack,s as CullFaceNone,Ch as Curve,Zh as CurvePath,b as CustomBlending,st as CustomToneMapping,bh as CylinderGeometry,bd as Cylindrical,Gs as Data3DTexture,Hs as DataArrayTexture,Ya as DataTexture,jc as DataTextureLoader,xn as DataUtils,di as DecrementStencilOp,mi as DecrementWrapStencilOp,Bc as DefaultLoadingManager,Wt as DepthFormat,qt as DepthStencilFormat,ph as DepthTexture,ot as DetachedBindMode,hu as DirectionalLight,Hd as DirectionalLightHelper,yc as DiscreteInterpolant,Mh as DodecahedronGeometry,p as DoubleSide,O as DstAlphaFactor,R as DstColorFactor,Fi as DynamicCopyUsage,Pi as DynamicDrawUsage,Vi as DynamicReadUsage,zh as EdgesGeometry,Ih as EllipseCurve,Ti as EqualCompare,J as EqualDepth,xi as EqualStencilFunc,ut as EquirectangularReflectionMapping,dt as EquirectangularRefractionMapping,hr as Euler,ds as EventDispatcher,yh as ExternalTexture,Cl as ExtrudeGeometry,Rc as FileLoader,Bn as Float16BufferAttribute,kn as Float32BufferAttribute,Pt as FloatType,Vr as Fog,Nr as FogExp2,ah as FramebufferTexture,u as FrontSide,mo as Frustum,fo as FrustumArray,dd as GLBufferAttribute,Di as GLSL1,Ui as GLSL3,Ci as GreaterCompare,Y as GreaterDepth,Bi as GreaterEqualCompare,X as GreaterEqualDepth,Mi as GreaterEqualStencilFunc,vi as GreaterStencilFunc,Wd as GridHelper,Tr as Group,dh as HTMLTexture,Rt as HalfFloatType,Wc as HemisphereLight,Ud as HemisphereLightHelper,Bl as IcosahedronGeometry,Su as ImageBitmapLoader,Lc as ImageLoader,Ls as ImageUtils,ui as IncrementStencilOp,pi as IncrementWrapStencilOp,$a as InstancedBufferAttribute,yu as InstancedBufferGeometry,ud as InstancedInterleavedBuffer,no as InstancedMesh,Tn as Int16BufferAttribute,Cn as Int32BufferAttribute,Sn as Int8BufferAttribute,kt as IntType,qn as InterleavedBuffer,Xn as InterleavedBufferAttribute,dc as Interpolant,Fe as InterpolateBezier,Ve as InterpolateDiscrete,Ee as InterpolateLinear,Le as InterpolateSmooth,Yi as InterpolationSamplingMode,Xi as InterpolationSamplingType,yi as InvertStencilOp,li as KeepStencilOp,fc as KeyframeTrack,pa as LOD,kl as LatheGeometry,lr as Layers,Ai as LessCompare,W as LessDepth,zi as LessEqualCompare,q as LessEqualDepth,bi as LessEqualStencilFunc,fi as LessStencilFunc,Uc as Light,du as LightProbe,Jo as Line,Bd as Line3,Eo as LineBasicMaterial,Wh as LineCurve,qh as LineCurve3,ac as LineDashedMaterial,Go as LineLoop,Zo as LineSegments,Mt as LinearFilter,mc as LinearInterpolant,Tt as LinearMipMapLinearFilter,_t as LinearMipMapNearestFilter,At as LinearMipmapLinearFilter,St as LinearMipmapNearestFilter,ii as LinearSRGBColorSpace,K as LinearToneMapping,si as LinearTransfer,kc as Loader,mu as LoaderUtils,Ic as LoadingManager,Pe as LoopOnce,Ne as LoopPingPong,Re as LoopRepeat,e as MOUSE,Zn as Material,v as MaterialBlending,pu as MaterialLoader,Ss as MathUtils,vd as Matrix2,Is as Matrix3,Qs as Matrix4,A as MaxEquation,Ra as Mesh,Ma as MeshBasicMaterial,sc as MeshDepthMaterial,rc as MeshDistanceMaterial,ic as MeshLambertMaterial,nc as MeshMatcapMaterial,ec as MeshNormalMaterial,Kl as MeshPhongMaterial,Ql as MeshPhysicalMaterial,$l as MeshStandardMaterial,tc as MeshToonMaterial,_ as MinEquation,gt as MirroredRepeatWrapping,G as MixOperation,x as MultiplyBlending,Z as MultiplyOperation,ft as NearestFilter,wt as NearestMipMapLinearFilter,bt as NearestMipMapNearestFilter,vt as NearestMipmapLinearFilter,xt as NearestMipmapNearestFilter,nt as NeutralToneMapping,_i as NeverCompare,D as NeverDepth,gi as NeverStencilFunc,m as NoBlending,ti as NoColorSpace,ni as NoNormalPacking,Q as NoToneMapping,We as NormalAnimationBlendMode,y as NormalBlending,oi as NormalGAPacking,ai as NormalRGPacking,Ii as NotEqualCompare,H as NotEqualDepth,wi as NotEqualStencilFunc,vc as NumberKeyframeTrack,Ar as Object3D,xu as ObjectLoader,Ke as ObjectSpaceNormalMap,Ol as OctahedronGeometry,z as OneFactor,j as OneMinusConstantAlphaFactor,L as OneMinusConstantColorFactor,P as OneMinusDstAlphaFactor,N as OneMinusDstColorFactor,k as OneMinusSrcAlphaFactor,I as OneMinusSrcColorFactor,au as OrthographicCamera,h as PCFShadowMap,l as PCFSoftShadowMap,Gh as Path,eu as PerspectiveCamera,lo as Plane,Pl as PlaneGeometry,ip as PlaneHelper,nu as PointLight,Ld as PointLightHelper,ih as Points,$o as PointsMaterial,qd as PolarGridHelper,wh as PolyhedronGeometry,Yu as PositionalAudio,id as PropertyBinding,Zu as PropertyMixer,Jh as QuadraticBezierCurve,Xh as QuadraticBezierCurve3,As as Quaternion,Mc as QuaternionKeyframeTrack,wc as QuaternionLinearInterpolant,he as R11_EAC_Format,gs as RAD2DEG,ke as RED_GREEN_RGTC2_Format,Ie as RED_RGTC1_Format,t as REVISION,ce as RG11_EAC_Format,Ze as RGBADepthPacking,Ut as RGBAFormat,Gt as RGBAIntegerFormat,Se as RGBA_ASTC_10x10_Format,ve as RGBA_ASTC_10x5_Format,we as RGBA_ASTC_10x6_Format,Me as RGBA_ASTC_10x8_Format,_e as RGBA_ASTC_12x10_Format,Ae as RGBA_ASTC_12x12_Format,de as RGBA_ASTC_4x4_Format,pe as RGBA_ASTC_5x4_Format,me as RGBA_ASTC_5x5_Format,ye as RGBA_ASTC_6x5_Format,ge as RGBA_ASTC_6x6_Format,fe as RGBA_ASTC_8x5_Format,xe as RGBA_ASTC_8x6_Format,be as RGBA_ASTC_8x8_Format,Te as RGBA_BPTC_Format,oe as RGBA_ETC2_EAC_Format,re as RGBA_PVRTC_2BPPV1_Format,se as RGBA_PVRTC_4BPPV1_Format,Qt as RGBA_S3TC_DXT1_Format,Kt as RGBA_S3TC_DXT3_Format,te as RGBA_S3TC_DXT5_Format,Ge as RGBDepthPacking,Dt as RGBFormat,Zt as RGBIntegerFormat,ze as RGB_BPTC_SIGNED_Format,Ce as RGB_BPTC_UNSIGNED_Format,ne as RGB_ETC1_Format,ae as RGB_ETC2_Format,ie as RGB_PVRTC_2BPPV1_Format,ee as RGB_PVRTC_4BPPV1_Format,$t as RGB_S3TC_DXT1_Format,$e as RGDepthPacking,Yt as RGFormat,Ht as RGIntegerFormat,Gl as RawShaderMaterial,wa as Ray,md as Raycaster,cu as RectAreaLight,Jt as RedFormat,Xt as RedIntegerFormat,tt as ReinhardToneMapping,Xs as RenderTarget,od as RenderTarget3D,mt as RepeatWrapping,ci as ReplaceStencilOp,S as ReverseSubtractEquation,us as ReversedDepthFuncs,Rl as RingGeometry,le as SIGNED_R11_EAC_Format,Oe as SIGNED_RED_GREEN_RGTC2_Format,Be as SIGNED_RED_RGTC1_Format,ue as SIGNED_RG11_EAC_Format,ei as SRGBColorSpace,ri as SRGBTransfer,Er as Scene,Zl as ShaderMaterial,ql as ShadowMaterial,$h as Shape,Nl as ShapeGeometry,hp as ShapePath,Al as ShapeUtils,It as ShortType,Ga as Skeleton,Vd as SkeletonHelper,Ja as SkinnedMesh,js as Source,Nn as Sphere,Vl as SphereGeometry,xd as Spherical,uu as SphericalHarmonics3,Yh as SplineCurve,su as SpotLight,Od as SpotLightHelper,la as Sprite,Gn as SpriteMaterial,B as SrcAlphaFactor,V as SrcAlphaSaturateFactor,C as SrcColorFactor,Li as StaticCopyUsage,Oi as StaticDrawUsage,Ni as StaticReadUsage,Bu as StereoCamera,ji as StreamCopyUsage,Ri as StreamDrawUsage,Ei as StreamReadUsage,Sc as StringKeyframeTrack,M as SubtractEquation,f as SubtractiveBlending,i as TOUCH,Qe as TangentSpaceNormalMap,El as TetrahedronGeometry,qs as Texture,Dc as TextureLoader,up as TextureUtils,Ru as Timer,Ji as TimestampQuery,Ll as TorusGeometry,Fl as TorusKnotGeometry,$r as Triangle,Ye as TriangleFanDrawMode,Xe as TriangleStripDrawMode,Je as TrianglesDrawMode,jl as TubeGeometry,ht as UVMapping,zn as Uint16BufferAttribute,In as Uint32BufferAttribute,_n as Uint8BufferAttribute,An as Uint8ClampedBufferAttribute,hd as Uniform,cd as UniformsGroup,Hl as UniformsUtils,zt as UnsignedByteType,Ft as UnsignedInt101111Type,Et as UnsignedInt248Type,Lt as UnsignedInt5999Type,Ot as UnsignedIntType,Nt as UnsignedShort4444Type,Vt as UnsignedShort5551Type,Bt as UnsignedShortType,c as VSMShadowMap,_s as Vector2,Ts as Vector3,Js as Vector4,_c as VectorKeyframeTrack,nh as VideoFrameTexture,rh as VideoTexture,$s as WebGL3DRenderTarget,Zs as WebGLArrayRenderTarget,Wi as WebGLCoordinateSystem,Ys as WebGLRenderTarget,qi as WebGPUCoordinateSystem,Cr as WebXRController,Dl as WireframeGeometry,Ue as WrapAroundEnding,je as ZeroCurvatureEnding,T as ZeroFactor,De as ZeroSlopeEnding,hi as ZeroStencilOp,Jl as cloneUniforms,Ki as createCanvasElement,Qi as createElementNS,os as error,cp as getByteLength,ss as getConsoleFunction,Yl as getUnlitUniformColorSpace,$i as isTypedArray,rs as log,Xl as mergeUniforms,cs as probeAsync,is as setConsoleFunction,as as warn,hs as warnOnce,ls as yieldToMain}; diff --git a/build/three.module.js b/build/three.module.js index 32d3d5f2bfa2f9..739a819d590989 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ import { Matrix3, Vector2, Color, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Matrix4, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, warn, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, CubeReflectionMapping, CubeRefractionMapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, error, NoBlending, WebGLRenderTarget, BufferAttribute, LinearSRGBColorSpace, LinearFilter, CubeTexture, LinearMipmapLinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, DataArrayTexture, Vector4, DepthTexture, Float32BufferAttribute, RawShaderMaterial, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, Data3DTexture, GreaterEqualCompare, LessEqualCompare, Texture, GLSL3, VSMShadowMap, PCFShadowMap, AddOperation, MixOperation, MultiplyOperation, LinearTransfer, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, RGFormat, RG11_EAC_Format, RED_GREEN_RGTC2_Format, MeshDepthMaterial, MeshDistanceMaterial, PCFSoftShadowMap, DepthFormat, NearestFilter, CubeDepthTexture, UnsignedIntType, Frustum, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, ReversedDepthFuncs, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, DataTexture, createCanvasElement, SRGBColorSpace, REVISION, log, WebGLCoordinateSystem, probeAsync } from './three.core.js'; -export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js'; +export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js'; function WebGLAnimation() { @@ -10975,6 +10975,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const _imageDimensions = new Vector2(); const _videoTextures = new WeakMap(); + const _htmlTextures = new Set(); let _canvas; const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source @@ -11298,6 +11299,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + if ( texture.isHTMLTexture ) { + + _htmlTextures.delete( texture ); + + } + } function onRenderTargetDispose( event ) { @@ -12211,6 +12218,59 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + } else if ( texture.isHTMLTexture ) { + + if ( 'texElement2D' in _gl ) { + + const canvas = _gl.canvas; + + // Ensure the canvas supports HTML-in-Canvas and the element is a child. + if ( ! canvas.hasAttribute( 'layoutsubtree' ) ) { + + canvas.setAttribute( 'layoutsubtree', 'true' ); + + } + + if ( image.parentNode !== canvas ) { + + canvas.appendChild( image ); + + // Register and set up a shared paint callback for all HTMLTextures. + _htmlTextures.add( texture ); + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of _htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + canvas.requestPaint(); + return; + + } + + const level = 0; + const internalFormat = _gl.RGBA; + const srcFormat = _gl.RGBA; + const srcType = _gl.UNSIGNED_BYTE; + + _gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); + + } + } else { // regular Texture (image, video, canvas) diff --git a/build/three.module.min.js b/build/three.module.min.js index 740d47331c94d4..c42d713996cb60 100644 --- a/build/three.module.min.js +++ b/build/three.module.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -import{Matrix3 as e,Vector2 as t,Color as n,mergeUniforms as i,Vector3 as r,CubeUVReflectionMapping as a,Mesh as o,BoxGeometry as s,ShaderMaterial as l,BackSide as c,cloneUniforms as d,Matrix4 as u,ColorManagement as f,SRGBTransfer as p,PlaneGeometry as m,FrontSide as h,getUnlitUniformColorSpace as _,IntType as g,warn as v,HalfFloatType as E,UnsignedByteType as S,FloatType as M,RGBAFormat as T,Plane as x,CubeReflectionMapping as A,CubeRefractionMapping as R,BufferGeometry as b,OrthographicCamera as C,PerspectiveCamera as P,NoToneMapping as L,MeshBasicMaterial as U,error as D,NoBlending as w,WebGLRenderTarget as I,BufferAttribute as N,LinearSRGBColorSpace as y,LinearFilter as O,CubeTexture as F,LinearMipmapLinearFilter as B,CubeCamera as G,EquirectangularReflectionMapping as H,EquirectangularRefractionMapping as V,warnOnce as W,Uint32BufferAttribute as k,Uint16BufferAttribute as z,DataArrayTexture as X,Vector4 as K,DepthTexture as Y,Float32BufferAttribute as q,RawShaderMaterial as j,CustomToneMapping as Z,NeutralToneMapping as $,AgXToneMapping as Q,ACESFilmicToneMapping as J,CineonToneMapping as ee,ReinhardToneMapping as te,LinearToneMapping as ne,Data3DTexture as ie,GreaterEqualCompare as re,LessEqualCompare as ae,Texture as oe,GLSL3 as se,VSMShadowMap as le,PCFShadowMap as ce,AddOperation as de,MixOperation as ue,MultiplyOperation as fe,LinearTransfer as pe,UniformsUtils as me,DoubleSide as he,NormalBlending as _e,TangentSpaceNormalMap as ge,ObjectSpaceNormalMap as ve,Layers as Ee,RGFormat as Se,RG11_EAC_Format as Me,RED_GREEN_RGTC2_Format as Te,MeshDepthMaterial as xe,MeshDistanceMaterial as Ae,PCFSoftShadowMap as Re,DepthFormat as be,NearestFilter as Ce,CubeDepthTexture as Pe,UnsignedIntType as Le,Frustum as Ue,LessEqualDepth as De,ReverseSubtractEquation as we,SubtractEquation as Ie,AddEquation as Ne,OneMinusConstantAlphaFactor as ye,ConstantAlphaFactor as Oe,OneMinusConstantColorFactor as Fe,ConstantColorFactor as Be,OneMinusDstAlphaFactor as Ge,OneMinusDstColorFactor as He,OneMinusSrcAlphaFactor as Ve,OneMinusSrcColorFactor as We,DstAlphaFactor as ke,DstColorFactor as ze,SrcAlphaSaturateFactor as Xe,SrcAlphaFactor as Ke,SrcColorFactor as Ye,OneFactor as qe,ZeroFactor as je,NotEqualDepth as Ze,GreaterDepth as $e,GreaterEqualDepth as Qe,EqualDepth as Je,LessDepth as et,AlwaysDepth as tt,NeverDepth as nt,CullFaceNone as it,CullFaceBack as rt,CullFaceFront as at,CustomBlending as ot,MultiplyBlending as st,SubtractiveBlending as lt,AdditiveBlending as ct,ReversedDepthFuncs as dt,MinEquation as ut,MaxEquation as ft,MirroredRepeatWrapping as pt,ClampToEdgeWrapping as mt,RepeatWrapping as ht,LinearMipmapNearestFilter as _t,NearestMipmapLinearFilter as gt,NearestMipmapNearestFilter as vt,NotEqualCompare as Et,GreaterCompare as St,EqualCompare as Mt,LessCompare as Tt,AlwaysCompare as xt,NeverCompare as At,NoColorSpace as Rt,DepthStencilFormat as bt,getByteLength as Ct,UnsignedInt248Type as Pt,UnsignedShortType as Lt,createElementNS as Ut,UnsignedShort4444Type as Dt,UnsignedShort5551Type as wt,UnsignedInt5999Type as It,UnsignedInt101111Type as Nt,ByteType as yt,ShortType as Ot,AlphaFormat as Ft,RGBFormat as Bt,RedFormat as Gt,RedIntegerFormat as Ht,RGIntegerFormat as Vt,RGBAIntegerFormat as Wt,RGB_S3TC_DXT1_Format as kt,RGBA_S3TC_DXT1_Format as zt,RGBA_S3TC_DXT3_Format as Xt,RGBA_S3TC_DXT5_Format as Kt,RGB_PVRTC_4BPPV1_Format as Yt,RGB_PVRTC_2BPPV1_Format as qt,RGBA_PVRTC_4BPPV1_Format as jt,RGBA_PVRTC_2BPPV1_Format as Zt,RGB_ETC1_Format as $t,RGB_ETC2_Format as Qt,RGBA_ETC2_EAC_Format as Jt,R11_EAC_Format as en,SIGNED_R11_EAC_Format as tn,SIGNED_RG11_EAC_Format as nn,RGBA_ASTC_4x4_Format as rn,RGBA_ASTC_5x4_Format as an,RGBA_ASTC_5x5_Format as on,RGBA_ASTC_6x5_Format as sn,RGBA_ASTC_6x6_Format as ln,RGBA_ASTC_8x5_Format as cn,RGBA_ASTC_8x6_Format as dn,RGBA_ASTC_8x8_Format as un,RGBA_ASTC_10x5_Format as fn,RGBA_ASTC_10x6_Format as pn,RGBA_ASTC_10x8_Format as mn,RGBA_ASTC_10x10_Format as hn,RGBA_ASTC_12x10_Format as _n,RGBA_ASTC_12x12_Format as gn,RGBA_BPTC_Format as vn,RGB_BPTC_SIGNED_Format as En,RGB_BPTC_UNSIGNED_Format as Sn,RED_RGTC1_Format as Mn,SIGNED_RED_RGTC1_Format as Tn,SIGNED_RED_GREEN_RGTC2_Format as xn,ExternalTexture as An,EventDispatcher as Rn,ArrayCamera as bn,WebXRController as Cn,RAD2DEG as Pn,DataTexture as Ln,createCanvasElement as Un,SRGBColorSpace as Dn,REVISION as wn,log as In,WebGLCoordinateSystem as Nn,probeAsync as yn}from"./three.core.min.js";export{AdditiveAnimationBlendMode,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BasicDepthPacking,BasicShadowMap,BatchedMesh,BezierInterpolant,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxHelper,BufferGeometryLoader,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CircleGeometry,Clock,ColorKeyframeTrack,Compatibility,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,Controls,CubeTextureLoader,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceFrontBack,Curve,CurvePath,CylinderGeometry,Cylindrical,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DodecahedronGeometry,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualStencilFunc,Euler,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Fog,FogExp2,FramebufferTexture,FrustumArray,GLBufferAttribute,GLSL1,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateBezier,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InterpolationSamplingMode,InterpolationSamplingType,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,Loader,LoaderUtils,LoadingManager,LoopOnce,LoopPingPong,LoopRepeat,MOUSE,Material,MaterialBlending,MaterialLoader,MathUtils,Matrix2,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NeverStencilFunc,NoNormalPacking,NormalAnimationBlendMode,NormalGAPacking,NormalRGPacking,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,OctahedronGeometry,Path,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RGBADepthPacking,RGBDepthPacking,RGBIntegerFormat,RGDepthPacking,Ray,Raycaster,RectAreaLight,RenderTarget,RenderTarget3D,ReplaceStencilOp,RingGeometry,Scene,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,TOUCH,TetrahedronGeometry,TextureLoader,TextureUtils,Timer,TimestampQuery,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,VectorKeyframeTrack,VideoFrameTexture,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroSlopeEnding,ZeroStencilOp,getConsoleFunction,setConsoleFunction}from"./three.core.min.js";function On(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&null!==e&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){null!==e&&e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Fn(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.versione.start-t.start);let t=0;for(let e=1;e 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn 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 );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid 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 ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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 ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\treturn 0.5 / max( gv + gl, EPSILON );\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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 ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\n\t}\n#endif\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid 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 ) {\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#if defined( USE_PACKED_NORMALMAP )\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\t#endif\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\t\t\t#else\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Gn={common:{diffuse:{value:new n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new e}},envmap:{envMap:{value:null},envMapRotation:{value:new e},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new e},normalScale:{value:new t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new n(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0},uvTransform:{value:new e}},sprite:{diffuse:{value:new n(16777215)},opacity:{value:1},center:{value:new t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}}},Hn={basic:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.fog]),vertexShader:Bn.meshbasic_vert,fragmentShader:Bn.meshbasic_frag},lambert:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},envMapIntensity:{value:1}}]),vertexShader:Bn.meshlambert_vert,fragmentShader:Bn.meshlambert_frag},phong:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},specular:{value:new n(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Bn.meshphong_vert,fragmentShader:Bn.meshphong_frag},standard:{uniforms:i([Gn.common,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.roughnessmap,Gn.metalnessmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bn.meshphysical_vert,fragmentShader:Bn.meshphysical_frag},toon:{uniforms:i([Gn.common,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.gradientmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)}}]),vertexShader:Bn.meshtoon_vert,fragmentShader:Bn.meshtoon_frag},matcap:{uniforms:i([Gn.common,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,{matcap:{value:null}}]),vertexShader:Bn.meshmatcap_vert,fragmentShader:Bn.meshmatcap_frag},points:{uniforms:i([Gn.points,Gn.fog]),vertexShader:Bn.points_vert,fragmentShader:Bn.points_frag},dashed:{uniforms:i([Gn.common,Gn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bn.linedashed_vert,fragmentShader:Bn.linedashed_frag},depth:{uniforms:i([Gn.common,Gn.displacementmap]),vertexShader:Bn.depth_vert,fragmentShader:Bn.depth_frag},normal:{uniforms:i([Gn.common,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,{opacity:{value:1}}]),vertexShader:Bn.meshnormal_vert,fragmentShader:Bn.meshnormal_frag},sprite:{uniforms:i([Gn.sprite,Gn.fog]),vertexShader:Bn.sprite_vert,fragmentShader:Bn.sprite_frag},background:{uniforms:{uvTransform:{value:new e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Bn.background_vert,fragmentShader:Bn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new e}},vertexShader:Bn.backgroundCube_vert,fragmentShader:Bn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bn.cube_vert,fragmentShader:Bn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bn.equirect_vert,fragmentShader:Bn.equirect_frag},distance:{uniforms:i([Gn.common,Gn.displacementmap,{referencePosition:{value:new r},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bn.distance_vert,fragmentShader:Bn.distance_frag},shadow:{uniforms:i([Gn.lights,Gn.fog,{color:{value:new n(0)},opacity:{value:1}}]),vertexShader:Bn.shadow_vert,fragmentShader:Bn.shadow_frag}};Hn.physical={uniforms:i([Hn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new e},clearcoatNormalScale:{value:new t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new e},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new e},sheen:{value:0},sheenColor:{value:new n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new e},transmissionSamplerSize:{value:new t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new e},attenuationDistance:{value:0},attenuationColor:{value:new n(0)},specularColor:{value:new n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new e},anisotropyVector:{value:new t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new e}}]),vertexShader:Bn.meshphysical_vert,fragmentShader:Bn.meshphysical_frag};const Vn={r:0,b:0,g:0},Wn=new u,kn=new e;function zn(e,t,i,r,u,g){const v=new n(0);let E,S,M=!0===u?0:1,T=null,x=0,A=null;function R(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){const i=e.backgroundBlurriness>0;n=t.get(n,i)}return n}function b(t,n){t.getRGB(Vn,_(e)),i.buffers.color.setClear(Vn.r,Vn.g,Vn.b,n,g)}return{getClearColor:function(){return v},setClearColor:function(e,t=1){v.set(e),M=t,b(v,M)},getClearAlpha:function(){return M},setClearAlpha:function(e){M=e,b(v,M)},render:function(t){let n=!1;const r=R(t);null===r?b(v,M):r&&r.isColor&&(b(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,g):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,g),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=R(n);i&&(i.isCubeTexture||i.mapping===a)?(void 0===S&&(S=new o(new s(1,1,1),new l({name:"BackgroundCubeMaterial",uniforms:d(Hn.backgroundCube.uniforms),vertexShader:Hn.backgroundCube.vertexShader,fragmentShader:Hn.backgroundCube.fragmentShader,side:c,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),S.geometry.deleteAttribute("normal"),S.geometry.deleteAttribute("uv"),S.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(S.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(S)),S.material.uniforms.envMap.value=i,S.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,S.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,S.material.uniforms.backgroundRotation.value.setFromMatrix4(Wn.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&!1===i.isRenderTargetTexture&&S.material.uniforms.backgroundRotation.value.premultiply(kn),S.material.toneMapped=f.getTransfer(i.colorSpace)!==p,T===i&&x===i.version&&A===e.toneMapping||(S.material.needsUpdate=!0,T=i,x=i.version,A=e.toneMapping),S.layers.enableAll(),t.unshift(S,S.geometry,S.material,0,0,null)):i&&i.isTexture&&(void 0===E&&(E=new o(new m(2,2),new l({name:"BackgroundMaterial",uniforms:d(Hn.background.uniforms),vertexShader:Hn.background.vertexShader,fragmentShader:Hn.background.fragmentShader,side:h,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),E.geometry.deleteAttribute("normal"),Object.defineProperty(E.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(E)),E.material.uniforms.t2D.value=i,E.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,E.material.toneMapped=f.getTransfer(i.colorSpace)!==p,!0===i.matrixAutoUpdate&&i.updateMatrix(),E.material.uniforms.uvTransform.value.copy(i.matrix),T===i&&x===i.version&&A===e.toneMapping||(E.material.needsUpdate=!0,T=i,x=i.version,A=e.toneMapping),E.layers.enableAll(),t.unshift(E,E.geometry,E.material,0,0,null))},dispose:function(){void 0!==S&&(S.geometry.dispose(),S.material.dispose(),S=void 0),void 0!==E&&(E.geometry.dispose(),E.material.dispose(),E=void 0)}}}function Xn(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}}return a.attributesNum!==s||a.index!==i}(n,h,l,_),v&&function(e,t,n,i){const r={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}}a.attributes=r,a.attributesNum=s,a.index=i}(n,h,l,_),null!==_&&t.update(_,e.ELEMENT_ARRAY_BUFFER),(v||o)&&(o=!1,function(n,i,r,a){d();const o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(const i in s){const r=s[i];if(r.location>=0){let s=o[i];if(void 0===s&&("instanceMatrix"===i&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,d=l.type,p=l.bytesPerElement,h=d===e.INT||d===e.UNSIGNED_INT||s.gpuType===g;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,_=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(v("WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control");!0===n.reversedDepthBuffer&&!1===c&&v("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===T||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===E&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==S&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==M&&!r)},precision:o,logarithmicDepthBuffer:l,reversedDepthBuffer:c,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function qn(t){const n=this;let i=null,r=0,a=!1,o=!1;const s=new x,l=new e,c={value:null,needsUpdate:!1};function d(e,t,i,r){const a=null!==e?e.length:0;let o=null;if(0!==a){if(o=c.value,!0!==r||null===o){const n=i+4*a,r=t.matrixWorldInverse;l.getNormalMatrix(r),(null===o||o.length0);n.numPlanes=r,n.numIntersection=0}();else{const e=o?0:r,t=4*e;let n=m.clippingState||null;c.value=n,n=d(u,s,t,l);for(let e=0;e!==t;++e)n[e]=i[e];m.clippingState=n,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}}}kn.set(-1,0,0,0,1,0,0,0,1);const jn=[.125,.215,.35,.446,.526,.582],Zn=20,$n=new C,Qn=new n;let Jn=null,ei=0,ti=0,ni=!1;const ii=new r;class ri{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){const{size:a=256,position:o=ii}=r;Jn=this._renderer.getRenderTarget(),ei=this._renderer.getActiveCubeFace(),ti=this._renderer.getActiveMipmapLevel(),ni=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,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(){null===this._cubemapMaterial&&(this._cubemapMaterial=li(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=si(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=jn[s-e+4-1]:0===s&&(l=0),n.push(l);const c=1/(a-2),d=-c,u=1+c,f=[d,d,u,d,u,u,d,d,u,u,d,u],p=6,m=6,h=3,_=2,g=1,v=new Float32Array(h*m*p),E=new Float32Array(_*m*p),S=new Float32Array(g*m*p);for(let e=0;e2?0:-1,i=[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];v.set(i,h*m*e),E.set(f,_*m*e);const r=[e,e,e,e,e,e];S.set(r,g*m*e)}const M=new b;M.setAttribute("position",new N(v,h)),M.setAttribute("uv",new N(E,_)),M.setAttribute("faceIndex",new N(S,g)),i.push(new o(M,null)),r>4&&r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(Zn),a=new r(0,1,0),o=new l({name:"SphericalGaussianBlur",defines:{n:Zn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1});return o}(i,e,t),this._ggxMaterial=function(e,t,n){const i=new l({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:ci(),fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:w,depthTest:!1,depthWrite:!1});return i}(i,e,t)}return i}_compileMaterial(e){const t=new o(new b,e);this._renderer.compile(t,$n)}_sceneToCubeUV(e,t,n,i,r){const a=new P(90,1,t,n),l=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,p=u.toneMapping;u.getClearColor(Qn),u.toneMapping=L,u.autoClear=!1;u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new o(new s,new U({name:"PMREM.Background",side:c,depthWrite:!1,depthTest:!1})));const m=this._backgroundBox,h=m.material;let _=!1;const g=e.background;g?g.isColor&&(h.color.copy(g),e.background=null,_=!0):(h.color.copy(Qn),_=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(a.up.set(0,l[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+d[t],r.y,r.z)):1===n?(a.up.set(0,0,l[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+d[t],r.z)):(a.up.set(0,l[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+d[t]));const o=this._cubeSize;oi(i,n*o,t>2?o:0,o,o),u.setRenderTarget(i),_&&u.render(m,a),u.render(e,a)}u.toneMapping=p,u.autoClear=f,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===A||e.mapping===R;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=li()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=si());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;r.uniforms.envMap.value=e;const o=this._cubeSize;oi(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,$n)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let t=1;tu-4?n-u+4:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=d,s.mipInt.value=u-t,oi(r,p,m,3*f,2*f),i.setRenderTarget(r),i.render(o,$n),s.envMap.value=r.texture,s.roughness.value=0,s.mipInt.value=u-n,oi(e,p,m,3*f,2*f),i.setRenderTarget(e),i.render(o,$n)}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&D("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[i];c.material=l;const d=l.uniforms,u=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/f,m=isFinite(r)?1+Math.floor(3*p):Zn;m>Zn&&v(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const h=[];let _=0;for(let e=0;eg-4?i-g+4:0),4*(this._cubeSize-E),3*E,2*E),s.setRenderTarget(t),s.render(c,$n)}}function ai(e,t,n){const i=new I(e,t,n);return i.texture.mapping=a,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function oi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function si(){return new l({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1})}function li(){return new l({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1})}function ci(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}class di extends I{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new F(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new s(5,5,5),r=new l({name:"CubemapFromEquirect",uniforms:d(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:c,blending:w});r.uniforms.tEquirect.value=t;const a=new o(i,r),u=t.minFilter;t.minFilter===B&&(t.minFilter=O);return new G(1,10,this).update(e,a),t.minFilter=u,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}function ui(e){let t=new WeakMap,n=new WeakMap,i=null;function r(e,t){return t===H?e.mapping=A:t===V&&(e.mapping=R),e}function a(e){const n=e.target;n.removeEventListener("dispose",a);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}function o(e){const t=e.target;t.removeEventListener("dispose",o);const i=n.get(t);void 0!==i&&(n.delete(t),i.dispose())}return{get:function(s,l=!1){return null==s?null:l?function(t){if(t&&t.isTexture){const r=t.mapping,a=r===H||r===V,s=r===A||r===R;if(a||s){let r=n.get(t);const l=void 0!==r?r.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===i&&(i=new ri(e)),r=a?i.fromEquirectangular(t,r):i.fromCubemap(t,r),r.texture.pmremVersion=t.pmremVersion,n.set(t,r),r.texture;if(void 0!==r)return r.texture;{const l=t.image;return a&&l&&l.height>0||s&&l&&function(e){let t=0;const n=6;for(let i=0;i0){const o=new di(i.height);return o.fromEquirectangularTexture(e,n),t.set(n,o),n.addEventListener("dispose",a),r(o.texture,n.mapping)}return null}}}return n}(s)},dispose:function(){t=new WeakMap,n=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function fi(e){const t={};function n(n){if(void 0!==t[n])return t[n];const i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},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){const t=n(e);return null===t&&W("WebGLRenderer: "+e+" extension not supported."),t}}}function pi(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(void 0===r)return;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t=65535?k:z)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.versionn.maxTextureSize&&(T=Math.ceil(S/n.maxTextureSize),S=n.maxTextureSize);const x=new Float32Array(S*T*4*u),A=new X(x,S,T,u);A.type=M,A.needsUpdate=!0;const R=4*E;for(let C=0;C\n\t\t\t#include \n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:!1,depthWrite:!1}),d=new o(l,c),u=new C(-1,1,1,-1,0,1);let m,h=null,_=null,g=!1,v=null,S=[],M=!1;this.setSize=function(e,t){a.setSize(e,t),s.setSize(e,t);for(let n=0;n0&&!0===S[0].isRenderPass;const t=a.width,n=a.height;for(let e=0;e0)return e;const r=t*n;let a=Ri[r];if(void 0===a&&(a=new Float32Array(r),Ri[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function Di(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function Rr(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let br=0;const Cr=new e;function Pr(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Lr(e,t){const n=function(e){f._getMatrix(Cr,f.workingColorSpace,e);const t=`mat3( ${Cr.elements.map(e=>e.toFixed(4))} )`;switch(f.getTransfer(e)){case pe:return[t,"LinearTransferOETF"];case p:return[t,"sRGBTransferOETF"];default:return v("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}const Ur={[ne]:"Linear",[te]:"Reinhard",[ee]:"Cineon",[J]:"ACESFilmic",[Q]:"AgX",[$]:"Neutral",[Z]:"Custom"};function Dr(e,t){const n=Ur[t];return void 0===n?(v("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const wr=new r;function Ir(){f.getLuminanceCoefficients(wr);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${wr.x.toFixed(4)}, ${wr.y.toFixed(4)}, ${wr.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Nr(e){return""!==e}function yr(e,t){const 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 Or(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Fr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Br(e){return e.replace(Fr,Hr)}const Gr=new Map;function Hr(e,t){let n=Bn[t];if(void 0===n){const e=Gr.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Bn[e],v('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return Br(n)}const Vr=/#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 Wr(e){return e.replace(Vr,kr)}function kr(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(_+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Nr).join("\n"),g.length>0&&(g+="\n")):(_=[zr(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#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 "+d:"",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&&!1===n.flatShading?"#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&&!1===n.flatShading?"#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 "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Nr).join("\n"),g=[zr(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.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+l:"",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_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==L?"#define TONE_MAPPING":"",n.toneMapping!==L?Bn.tonemapping_pars_fragment:"",n.toneMapping!==L?Dr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Bn.colorspace_pars_fragment,Lr("linearToOutputTexel",n.outputColorSpace),Ir(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Nr).join("\n")),o=Br(o),o=yr(o,n),o=Or(o,n),s=Br(s),s=yr(s,n),s=Or(s,n),o=Wr(o),s=Wr(s),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",_=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,g=["#define varying in",n.glslVersion===se?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===se?"":"#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("\n")+"\n"+g);const S=E+_+o,M=E+g+s,T=Rr(r,r.VERTEX_SHADER,S),x=Rr(r,r.FRAGMENT_SHADER,M);function A(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(h)||"",i=r.getShaderInfoLog(T)||"",a=r.getShaderInfoLog(x)||"",o=n.trim(),s=i.trim(),l=a.trim();let c=!0,d=!0;if(!1===r.getProgramParameter(h,r.LINK_STATUS))if(c=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,h,T,x);else{const e=Pr(r,T,"vertex"),n=Pr(r,x,"fragment");D("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(h,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?v("WebGLProgram: Program Info Log:",o):""!==s&&""!==l||(d=!1);d&&(t.diagnostics={runnable:c,programLog:o,vertexShader:{log:s,prefix:_},fragmentShader:{log:l,prefix:g}})}r.deleteShader(T),r.deleteShader(x),R=new Ar(r,h),b=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,Q=r.clearcoat>0,J=r.dispersion>0,ee=r.iridescence>0,te=r.sheen>0,ne=r.transmission>0,ie=$&&!!r.anisotropyMap,re=Q&&!!r.clearcoatMap,ae=Q&&!!r.clearcoatNormalMap,oe=Q&&!!r.clearcoatRoughnessMap,se=ee&&!!r.iridescenceMap,le=ee&&!!r.iridescenceThicknessMap,ce=te&&!!r.sheenColorMap,de=te&&!!r.sheenRoughnessMap,ue=!!r.specularMap,fe=!!r.specularColorMap,pe=!!r.specularIntensityMap,me=ne&&!!r.transmissionMap,Ee=ne&&!!r.thicknessMap,xe=!!r.gradientMap,Ae=!!r.alphaMap,Re=r.alphaTest>0,be=!!r.alphaHash,Ce=!!r.extensions;let Pe=L;r.toneMapped&&(null!==O&&!0!==O.isXRRenderTarget||(Pe=e.toneMapping));const Le={shaderID:C,shaderType:r.type,shaderName:r.name,vertexShader:D,fragmentShader:w,defines:r.defines,customVertexShaderID:I,customFragmentShaderID:N,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:_,batching:G,batchingColor:G&&null!==S._colorsTexture,instancing:B,instancingColor:B&&null!==S.instanceColor,instancingMorph:B&&null!==S.morphTexture,outputColorSpace:null===O?e.outputColorSpace:!0===O.isXRRenderTarget?O.texture.colorSpace:f.workingColorSpace,alphaToCoverage:!!r.alphaToCoverage,map:H,matcap:V,envMap:W,envMapMode:W&&R.mapping,envMapCubeUVHeight:b,aoMap:k,lightMap:z,bumpMap:X,normalMap:K,displacementMap:Y,emissiveMap:q,normalMapObjectSpace:K&&r.normalMapType===ve,normalMapTangentSpace:K&&r.normalMapType===ge,packedNormalMap:K&&r.normalMapType===ge&&(Ue=r.normalMap.format,Ue===Se||Ue===Me||Ue===Te),metalnessMap:j,roughnessMap:Z,anisotropy:$,anisotropyMap:ie,clearcoat:Q,clearcoatMap:re,clearcoatNormalMap:ae,clearcoatRoughnessMap:oe,dispersion:J,iridescence:ee,iridescenceMap:se,iridescenceThicknessMap:le,sheen:te,sheenColorMap:ce,sheenRoughnessMap:de,specularMap:ue,specularColorMap:fe,specularIntensityMap:pe,transmission:ne,transmissionMap:me,thicknessMap:Ee,gradientMap:xe,opaque:!1===r.transparent&&r.blending===_e&&!1===r.alphaToCoverage,alphaMap:Ae,alphaTest:Re,alphaHash:be,combine:r.combine,mapUv:H&&E(r.map.channel),aoMapUv:k&&E(r.aoMap.channel),lightMapUv:z&&E(r.lightMap.channel),bumpMapUv:X&&E(r.bumpMap.channel),normalMapUv:K&&E(r.normalMap.channel),displacementMapUv:Y&&E(r.displacementMap.channel),emissiveMapUv:q&&E(r.emissiveMap.channel),metalnessMapUv:j&&E(r.metalnessMap.channel),roughnessMapUv:Z&&E(r.roughnessMap.channel),anisotropyMapUv:ie&&E(r.anisotropyMap.channel),clearcoatMapUv:re&&E(r.clearcoatMap.channel),clearcoatNormalMapUv:ae&&E(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&E(r.clearcoatRoughnessMap.channel),iridescenceMapUv:se&&E(r.iridescenceMap.channel),iridescenceThicknessMapUv:le&&E(r.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&E(r.sheenColorMap.channel),sheenRoughnessMapUv:de&&E(r.sheenRoughnessMap.channel),specularMapUv:ue&&E(r.specularMap.channel),specularColorMapUv:fe&&E(r.specularColorMap.channel),specularIntensityMapUv:pe&&E(r.specularIntensityMap.channel),transmissionMapUv:me&&E(r.transmissionMap.channel),thicknessMapUv:Ee&&E(r.thicknessMap.channel),alphaMapUv:Ae&&E(r.alphaMap.channel),vertexTangents:!!T.attributes.tangent&&(K||$),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!T.attributes.color&&4===T.attributes.color.itemSize,pointsUvs:!0===S.isPoints&&!!T.attributes.uv&&(H||Ae),fog:!!M,useFog:!0===r.fog,fogExp2:!!M&&M.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===T.attributes.normal&&!1===K&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:F,skinning:!0===S.isSkinnedMesh,morphTargets:void 0!==T.morphAttributes.position,morphNormals:void 0!==T.morphAttributes.normal,morphColors:void 0!==T.morphAttributes.color,morphTargetsCount:U,morphTextureStride:y,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:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Pe,decodeVideoTexture:H&&!0===r.map.isVideoTexture&&f.getTransfer(r.map.colorSpace)===p,decodeVideoTextureEmissive:q&&!0===r.emissiveMap.isVideoTexture&&f.getTransfer(r.emissiveMap.colorSpace)===p,premultipliedAlpha:r.premultipliedAlpha,doubleSided:r.side===he,flipSided:r.side===c,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:Ce&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&!0===r.extensions.multiDraw||G)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};var Ue;return Le.vertexUv1s=d.has(1),Le.vertexUv2s=d.has(2),Le.vertexUv3s=d.has(3),d.clear(),Le},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(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)}(n,t),function(e,t){s.disableAll(),t.instancing&&s.enable(0);t.instancingColor&&s.enable(1);t.instancingMorph&&s.enable(2);t.matcap&&s.enable(3);t.envMap&&s.enable(4);t.normalMapObjectSpace&&s.enable(5);t.normalMapTangentSpace&&s.enable(6);t.clearcoat&&s.enable(7);t.iridescence&&s.enable(8);t.alphaTest&&s.enable(9);t.vertexColors&&s.enable(10);t.vertexAlphas&&s.enable(11);t.vertexUv1s&&s.enable(12);t.vertexUv2s&&s.enable(13);t.vertexUv3s&&s.enable(14);t.vertexTangents&&s.enable(15);t.anisotropy&&s.enable(16);t.alphaHash&&s.enable(17);t.batching&&s.enable(18);t.dispersion&&s.enable(19);t.batchingColor&&s.enable(20);t.gradientMap&&s.enable(21);t.packedNormalMap&&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.reversedDepthBuffer&&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)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=g[e.type];let n;if(t){const e=Hn[t];n=me.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i=m.get(n);return void 0!==i?++i.usedTimes:(i=new jr(e,n,t,r),u.push(i),m.set(n,i)),i},releaseProgram:function(e){if(0===--e.usedTimes){const t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),m.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function ea(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ta(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.materialVariant!==t.materialVariant?e.materialVariant-t.materialVariant:e.z!==t.z?e.z-t.z:e.id-t.id}function na(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function ia(){const e=[];let t=0;const n=[],i=[],r=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function o(n,i,r,o,s,l){let c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:i,material:r,materialVariant:a(n),groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=r,c.materialVariant=a(n),c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,s,l,c){const d=o(e,t,a,s,l,c);a.transmission>0?i.push(d):!0===a.transparent?r.push(d):n.push(d)},unshift:function(e,t,a,s,l,c){const d=o(e,t,a,s,l,c);a.transmission>0?i.unshift(d):!0===a.transparent?r.unshift(d):n.unshift(d)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||ta),i.length>1&&i.sort(t||na),r.length>1&&r.sort(t||na)}}}function ra(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new ia,e.set(t,[r])):n>=i.length?(r=new ia,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function aa(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new r,color:new n};break;case"SpotLight":i={position:new r,direction:new r,color:new n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new r,color:new n,distance:0,decay:0};break;case"HemisphereLight":i={direction:new r,skyColor:new n,groundColor:new n};break;case"RectAreaLight":i={color:new n,position:new r,halfWidth:new r,halfHeight:new r}}return e[t.id]=i,i}}}let oa=0;function sa(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function la(e){const n=new aa,i=function(){const e={};return{get:function(n){if(void 0!==e[n.id])return e[n.id];let i;switch(n.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t,shadowCameraNear:1,shadowCameraFar:1e3}}return e[n.id]=i,i}}}(),a={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++)a.probe.push(new r);const o=new r,s=new u,l=new u;return{setup:function(t){let r=0,o=0,s=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let l=0,c=0,d=0,u=0,f=0,p=0,m=0,h=0,_=0,g=0,v=0;t.sort(sa);for(let e=0,E=t.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Gn.LTC_FLOAT_1,a.rectAreaLTC2=Gn.LTC_FLOAT_2):(a.rectAreaLTC1=Gn.LTC_HALF_1,a.rectAreaLTC2=Gn.LTC_HALF_2)),a.ambient[0]=r,a.ambient[1]=o,a.ambient[2]=s;const E=a.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===d&&E.rectAreaLength===u&&E.hemiLength===f&&E.numDirectionalShadows===p&&E.numPointShadows===m&&E.numSpotShadows===h&&E.numSpotMaps===_&&E.numLightProbes===v||(a.directional.length=l,a.spot.length=d,a.rectArea.length=u,a.point.length=c,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+_-g,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=g,a.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=d,E.rectAreaLength=u,E.hemiLength=f,E.numDirectionalShadows=p,E.numPointShadows=m,E.numSpotShadows=h,E.numSpotMaps=_,E.numLightProbes=v,a.version=oa++)},setupView:function(e,t){let n=0,i=0,r=0,c=0,d=0;const u=t.matrixWorldInverse;for(let t=0,f=e.length;t=r.length?(a=new ca(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}const ua=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],fa=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],pa=new u,ma=new r,ha=new r;function _a(e,n,i){let r=new Ue;const a=new t,s=new t,d=new K,u=new xe,f=new Ae,p={},m=i.maxTextureSize,_={[h]:c,[c]:h,[he]:he},g=new l({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),S=g.clone();S.defines.HORIZONTAL_PASS=1;const T=new b;T.setAttribute("position",new N(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new o(T,g),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ce;let R=this.type;function C(t,i){const r=n.update(x);g.defines.VSM_SAMPLES!==t.blurSamples&&(g.defines.VSM_SAMPLES=t.blurSamples,S.defines.VSM_SAMPLES=t.blurSamples,g.needsUpdate=!0,S.needsUpdate=!0),null===t.mapPass&&(t.mapPass=new I(a.x,a.y,{format:Se,type:E})),g.uniforms.shadow_pass.value=t.map.depthTexture,g.uniforms.resolution.value=t.mapSize,g.uniforms.radius.value=t.radius,e.setRenderTarget(t.mapPass),e.clear(),e.renderBufferDirect(i,null,r,g,x,null),S.uniforms.shadow_pass.value=t.mapPass.texture,S.uniforms.resolution.value=t.mapSize,S.uniforms.radius.value=t.radius,e.setRenderTarget(t.map),e.clear(),e.renderBufferDirect(i,null,r,S,x,null)}function P(t,n,i,r){let a=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?f:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=a.uuid,t=n.uuid;let i=p[e];void 0===i&&(i={},p[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",U)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===le?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:_[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.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,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){e.properties.get(a).light=i}return a}function L(t,i,a,o,s){if(!1===t.visible)return;if(t.layers.test(i.layers)&&(t.isMesh||t.isLine||t.isPoints)&&(t.castShadow||t.receiveShadow&&s===le)&&(!t.frustumCulled||r.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,t.matrixWorld);const r=n.update(t),l=t.material;if(Array.isArray(l)){const n=r.groups;for(let c=0,d=n.length;ce.needsUpdate=!0):e.material.needsUpdate=!0)});for(let o=0,l=t.length;om||a.y>m)&&(a.x>m&&(s.x=Math.floor(m/p.x),a.x=s.x*p.x,c.mapSize.x=s.x),a.y>m&&(s.y=Math.floor(m/p.y),a.y=s.y*p.y,c.mapSize.y=s.y));const h=e.state.buffers.depth.getReversed();if(c.camera._reversedDepth=h,null===c.map||!0===f){if(null!==c.map&&(null!==c.map.depthTexture&&(c.map.depthTexture.dispose(),c.map.depthTexture=null),c.map.dispose()),this.type===le){if(l.isPointLight){v("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}c.map=new I(a.x,a.y,{format:Se,type:E,minFilter:O,magFilter:O,generateMipmaps:!1}),c.map.texture.name=l.name+".shadowMap",c.map.depthTexture=new Y(a.x,a.y,M),c.map.depthTexture.name=l.name+".shadowMapDepth",c.map.depthTexture.format=be,c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=Ce,c.map.depthTexture.magFilter=Ce}else l.isPointLight?(c.map=new di(a.x),c.map.depthTexture=new Pe(a.x,Le)):(c.map=new I(a.x,a.y),c.map.depthTexture=new Y(a.x,a.y,Le)),c.map.depthTexture.name=l.name+".shadowMap",c.map.depthTexture.format=be,this.type===ce?(c.map.depthTexture.compareFunction=h?re:ae,c.map.depthTexture.minFilter=O,c.map.depthTexture.magFilter=O):(c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=Ce,c.map.depthTexture.magFilter=Ce);c.camera.updateProjectionMatrix()}const _=c.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(c.map.isWebGLCubeRenderTarget)e.setRenderTarget(c.map,t),e.clear();else{0===t&&(e.setRenderTarget(c.map),e.clear());const n=c.getViewport(t);d.set(s.x*n.x,s.y*n.y,s.x*n.z,s.y*n.w),u.viewport(d)}if(l.isPointLight){const e=c.camera,n=c.matrix,i=l.distance||e.far;i!==e.far&&(e.far=i,e.updateProjectionMatrix()),ma.setFromMatrixPosition(l.matrixWorld),e.position.copy(ma),ha.copy(e.position),ha.add(ua[t]),e.up.copy(fa[t]),e.lookAt(ha),e.updateMatrixWorld(),n.makeTranslation(-ma.x,-ma.y,-ma.z),pa.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),c._frustum.setFromProjectionMatrix(pa,e.coordinateSystem,e.reversedDepth)}else c.updateMatrices(l);r=c.getFrustum(),L(n,i,c.camera,l,this.type)}!0!==c.isPointLightShadow&&this.type===le&&C(c,i),c.needsUpdate=!1}R=this.type,A.needsUpdate=!1,e.setRenderTarget(o,l,c)}}function ga(e,t){const i=new function(){let t=!1;const n=new K;let i=null;const r=new K(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},r=new function(){let n=!1,i=!1,r=null,a=null,o=null;return{setReversed:function(e){if(i!==e){const 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),i=e;const r=o;o=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(t){t?X(e.DEPTH_TEST):Y(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=dt[t]),a!==t){switch(t){case nt:e.depthFunc(e.NEVER);break;case tt:e.depthFunc(e.ALWAYS);break;case et:e.depthFunc(e.LESS);break;case De:e.depthFunc(e.LEQUAL);break;case Je:e.depthFunc(e.EQUAL);break;case Qe:e.depthFunc(e.GEQUAL);break;case $e:e.depthFunc(e.GREATER);break;case Ze:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,i&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,r=null,a=null,o=null,i=!1}}},a=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?X(e.STENCIL_TEST):Y(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},o=new WeakMap,s=new WeakMap;let l={},d={},u={},f=new WeakMap,p=[],m=null,h=!1,_=null,g=null,v=null,E=null,S=null,M=null,T=null,x=new n(0,0,0),A=0,R=!1,b=null,C=null,P=null,L=null,U=null;const I=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=!1,y=0;const O=e.getParameter(e.VERSION);-1!==O.indexOf("WebGL")?(y=parseFloat(/^WebGL (\d)/.exec(O)[1]),N=y>=1):-1!==O.indexOf("OpenGL ES")&&(y=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=y>=2);let F=null,B={};const G=e.getParameter(e.SCISSOR_BOX),H=e.getParameter(e.VIEWPORT),V=(new K).fromArray(G),W=(new K).fromArray(H);function k(t,n,i,r){const 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;on||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===m&&(m=g(n,a));const o=t?g(n,a):m;o.width=n,o.height=a;return o.getContext("2d").drawImage(e,0,0,n,a),v("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),o}return"data"in e&&v("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function x(e){return e.generateMipmaps}function A(t){e.generateMipmap(t)}function R(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 b(t,i,r,a,o,s=!1){if(null!==t){if(void 0!==e[t])return e[t];v("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let l;a&&(l=n.get("EXT_texture_norm16"),l||v("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let c=i;if(i===e.RED&&(r===e.FLOAT&&(c=e.R32F),r===e.HALF_FLOAT&&(c=e.R16F),r===e.UNSIGNED_BYTE&&(c=e.R8),r===e.UNSIGNED_SHORT&&l&&(c=l.R16_EXT),r===e.SHORT&&l&&(c=l.R16_SNORM_EXT)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.R8UI),r===e.UNSIGNED_SHORT&&(c=e.R16UI),r===e.UNSIGNED_INT&&(c=e.R32UI),r===e.BYTE&&(c=e.R8I),r===e.SHORT&&(c=e.R16I),r===e.INT&&(c=e.R32I)),i===e.RG&&(r===e.FLOAT&&(c=e.RG32F),r===e.HALF_FLOAT&&(c=e.RG16F),r===e.UNSIGNED_BYTE&&(c=e.RG8),r===e.UNSIGNED_SHORT&&l&&(c=l.RG16_EXT),r===e.SHORT&&l&&(c=l.RG16_SNORM_EXT)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RG8UI),r===e.UNSIGNED_SHORT&&(c=e.RG16UI),r===e.UNSIGNED_INT&&(c=e.RG32UI),r===e.BYTE&&(c=e.RG8I),r===e.SHORT&&(c=e.RG16I),r===e.INT&&(c=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RGB8UI),r===e.UNSIGNED_SHORT&&(c=e.RGB16UI),r===e.UNSIGNED_INT&&(c=e.RGB32UI),r===e.BYTE&&(c=e.RGB8I),r===e.SHORT&&(c=e.RGB16I),r===e.INT&&(c=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(c=e.RGBA16UI),r===e.UNSIGNED_INT&&(c=e.RGBA32UI),r===e.BYTE&&(c=e.RGBA8I),r===e.SHORT&&(c=e.RGBA16I),r===e.INT&&(c=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_SHORT&&l&&(c=l.RGB16_EXT),r===e.SHORT&&l&&(c=l.RGB16_SNORM_EXT),r===e.UNSIGNED_INT_5_9_9_9_REV&&(c=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(c=e.R11F_G11F_B10F)),i===e.RGBA){const t=s?pe:f.getTransfer(o);r===e.FLOAT&&(c=e.RGBA32F),r===e.HALF_FLOAT&&(c=e.RGBA16F),r===e.UNSIGNED_BYTE&&(c=t===p?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT&&l&&(c=l.RGBA16_EXT),r===e.SHORT&&l&&(c=l.RGBA16_SNORM_EXT),r===e.UNSIGNED_SHORT_4_4_4_4&&(c=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(c=e.RGB5_A1)}return c!==e.R16F&&c!==e.R32F&&c!==e.RG16F&&c!==e.RG32F&&c!==e.RGBA16F&&c!==e.RGBA32F||n.get("EXT_color_buffer_float"),c}function C(t,n){let i;return t?null===n||n===Le||n===Pt?i=e.DEPTH24_STENCIL8:n===M?i=e.DEPTH32F_STENCIL8:n===Lt&&(i=e.DEPTH24_STENCIL8,v("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Le||n===Pt?i=e.DEPTH_COMPONENT24:n===M?i=e.DEPTH_COMPONENT32F:n===Lt&&(i=e.DEPTH_COMPONENT16),i}function P(e,t){return!0===x(e)||e.isFramebufferTexture&&e.minFilter!==Ce&&e.minFilter!==O?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function L(e){const t=e.target;t.removeEventListener("dispose",L),function(e){const t=r.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=h.get(n);if(i){const r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&w(e),0===Object.keys(i).length&&h.delete(n)}r.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function U(t){const n=t.target;n.removeEventListener("dispose",U),function(t){const n=r.get(t);t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i0&&a.__version!==t.version){const e=t.image;if(null===e)v("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void z(a,t,n);v("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);i.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+n)}const F={[ht]:e.REPEAT,[mt]:e.CLAMP_TO_EDGE,[pt]:e.MIRRORED_REPEAT},G={[Ce]:e.NEAREST,[vt]:e.NEAREST_MIPMAP_NEAREST,[gt]:e.NEAREST_MIPMAP_LINEAR,[O]:e.LINEAR,[_t]:e.LINEAR_MIPMAP_NEAREST,[B]:e.LINEAR_MIPMAP_LINEAR},H={[At]:e.NEVER,[xt]:e.ALWAYS,[Tt]:e.LESS,[ae]:e.LEQUAL,[Mt]:e.EQUAL,[re]:e.GEQUAL,[St]:e.GREATER,[Et]:e.NOTEQUAL};function V(t,i){if(i.type!==M||!1!==n.has("OES_texture_float_linear")||i.magFilter!==O&&i.magFilter!==_t&&i.magFilter!==gt&&i.magFilter!==B&&i.minFilter!==O&&i.minFilter!==_t&&i.minFilter!==gt&&i.minFilter!==B||v("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,F[i.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,F[i.wrapT]),t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY||e.texParameteri(t,e.TEXTURE_WRAP_R,F[i.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,G[i.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,G[i.minFilter]),i.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,H[i.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic")){if(i.magFilter===Ce)return;if(i.minFilter!==gt&&i.minFilter!==B)return;if(i.type===M&&!1===n.has("OES_texture_float_linear"))return;if(i.anisotropy>1||r.get(i).__currentAnisotropy){const o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}}function W(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",L));const r=n.source;let a=h.get(r);void 0===a&&(a={},h.set(r,a));const o=function(e){const t=[];return 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()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&w(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function k(e,t,n){return Math.floor(Math.floor(e/n)/t)}function z(t,n,s){let l=e.TEXTURE_2D;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),n.isData3DTexture&&(l=e.TEXTURE_3D);const c=W(t,n),d=n.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const u=r.get(d);if(d.version!==u.__version||!0===c){i.activeTexture(e.TEXTURE0+s);if(!1===("undefined"!=typeof ImageBitmap&&n.image instanceof ImageBitmap)){const t=f.getPrimaries(f.workingColorSpace),r=n.colorSpace===Rt?null:f.getPrimaries(n.colorSpace),a=n.colorSpace===Rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;i.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),i.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),i.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,a)}i.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment);let t=E(n.image,!1,a.maxTextureSize);t=J(n,t);const r=o.convert(n.format,n.colorSpace),p=o.convert(n.type);let m,h=b(n.internalFormat,r,p,n.normalized,n.colorSpace,n.isVideoTexture);V(l,n);const _=n.mipmaps,g=!0!==n.isVideoTexture,S=void 0===u.__version||!0===c,M=d.dataReady,R=P(n,t);if(n.isDepthTexture)h=C(n.format===bt,n.type),S&&(g?i.texStorage2D(e.TEXTURE_2D,1,h,t.width,t.height):i.texImage2D(e.TEXTURE_2D,0,h,t.width,t.height,0,r,p,null));else if(n.isDataTexture)if(_.length>0){g&&S&&i.texStorage2D(e.TEXTURE_2D,R,h,_[0].width,_[0].height);for(let t=0,n=_.length;te.start-t.start);let s=0;for(let e=1;e0){const t=Ct(m.width,m.height,n.format,n.type);for(const o of n.layerUpdates){const n=m.data.subarray(o*t/m.data.BYTES_PER_ELEMENT,(o+1)*t/m.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,o,m.width,m.height,1,r,n)}n.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,m.width,m.height,t.depth,r,m.data)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,a,h,m.width,m.height,t.depth,0,m.data,0,0);else v("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else g?M&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,m.width,m.height,t.depth,r,p,m.data):i.texImage3D(e.TEXTURE_2D_ARRAY,a,h,m.width,m.height,t.depth,0,r,p,m.data)}else{g&&S&&i.texStorage2D(e.TEXTURE_2D,R,h,_[0].width,_[0].height);for(let t=0,a=_.length;t0){const a=Ct(t.width,t.height,n.format,n.type);for(const o of n.layerUpdates){const n=t.data.subarray(o*a/t.data.BYTES_PER_ELEMENT,(o+1)*a/t.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,o,t.width,t.height,1,r,p,n)}n.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,h,t.width,t.height,t.depth,0,r,p,t.data);else if(n.isData3DTexture)g?(S&&i.texStorage3D(e.TEXTURE_3D,R,h,t.width,t.height,t.depth),M&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):i.texImage3D(e.TEXTURE_3D,0,h,t.width,t.height,t.depth,0,r,p,t.data);else if(n.isFramebufferTexture){if(S)if(g)i.texStorage2D(e.TEXTURE_2D,R,h,t.width,t.height);else{let n=t.width,a=t.height;for(let t=0;t>=1,a>>=1}}else if(_.length>0){if(g&&S){const t=ee(_[0]);i.texStorage2D(e.TEXTURE_2D,R,h,t.width,t.height)}for(let t=0,n=_.length;t>d),r=Math.max(1,n.height>>d);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?i.texImage3D(c,d,p,t,r,n.depth,0,u,f,null):i.texImage2D(c,d,p,t,r,0,u,f,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),Q(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,c,h.__webglTexture,0,$(n)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,c,h.__webglTexture,d),i.bindFramebuffer(e.FRAMEBUFFER,null)}function K(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,o=C(n.stencilBuffer,a),s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;Q(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,$(n),o,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,$(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)Y(n.__webglFramebuffer[e],t,e);else{const e=t.texture.mipmaps;e&&e.length>0?Y(n.__webglFramebuffer[0],t,0):Y(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[r]),void 0===n.__webglDepthbuffer[r])n.__webglDepthbuffer[r]=e.createRenderbuffer(),K(n.__webglDepthbuffer[r],t,!1);else{const i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,a)}}else{const r=t.texture.mipmaps;if(r&&r.length>0?i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),K(n.__webglDepthbuffer,t,!1);else{const i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,r)}}i.bindFramebuffer(e.FRAMEBUFFER,null)}const j=[],Z=[];function $(e){return Math.min(a.maxSamples,e.samples)}function Q(e){const t=r.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function J(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==y&&n!==Rt&&(f.getTransfer(n)===p?i===T&&r===S||v("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):D("WebGLTextures: Unsupported texture color space:",n)),t}function ee(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(d.width=e.naturalWidth||e.width,d.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(d.width=e.displayWidth,d.height=e.displayHeight):(d.width=e.width,d.height=e.height),d}this.allocateTextureUnit=function(){const e=I;return e>=a.maxTextures&&v("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),I+=1,e},this.resetTextureUnits=function(){I=0},this.getTextureUnits=function(){return I},this.setTextureUnits=function(e){I=e},this.setTexture2D=N,this.setTexture2DArray=function(t,n){const a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?z(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){const a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?z(a,t,n):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,n){const s=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&s.__version!==t.version?function(t,n,s){if(6!==n.image.length)return;const l=W(t,n),c=n.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const d=r.get(c);if(c.version!==d.__version||!0===l){i.activeTexture(e.TEXTURE0+s);const t=f.getPrimaries(f.workingColorSpace),r=n.colorSpace===Rt?null:f.getPrimaries(n.colorSpace),u=n.colorSpace===Rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;i.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),i.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),i.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment),i.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const p=n.isCompressedTexture||n.image[0].isCompressedTexture,m=n.image[0]&&n.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=p||m?m?n.image[e].image:n.image[e]:E(n.image[e],!0,a.maxCubemapSize),h[e]=J(n,h[e]);const _=h[0],g=o.convert(n.format,n.colorSpace),S=o.convert(n.type),M=b(n.internalFormat,g,S,n.normalized,n.colorSpace),R=!0!==n.isVideoTexture,C=void 0===d.__version||!0===l,L=c.dataReady;let U,D=P(n,_);if(V(e.TEXTURE_CUBE_MAP,n),p){R&&C&&i.texStorage2D(e.TEXTURE_CUBE_MAP,D,M,_.width,_.height);for(let t=0;t<6;t++){U=h[t].mipmaps;for(let r=0;r0&&D++;const t=ee(h[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,D,M,t.width,t.height)}for(let t=0;t<6;t++)if(m){R?L&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h[t].width,h[t].height,g,S,h[t].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,M,h[t].width,h[t].height,0,g,S,h[t].data);for(let n=0;n1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),d){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let i=0;i0){a.__webglFramebuffer=[];for(let t=0;t0&&!1===Q(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let i=0;i0)if(!1===Q(t)){const n=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,d=r.get(t),u=n.length>1;if(u)for(let t=0;t0?i.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer[0]):i.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer);for(let i=0;i= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new o(new m(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ma extends Rn{constructor(e,n){super();const i=this;let a=null,o=1,s=null,l="local-floor",c=1,d=null,u=null,f=null,p=null,m=null,h=null;const _="undefined"!=typeof XRWebGLBinding,g=new Sa,E={},M=n.getContextAttributes();let x=null,A=null;const R=[],b=[],C=new t;let L=null;const U=new P;U.viewport=new K;const D=new P;D.viewport=new K;const w=[U,D],N=new bn;let y=null,O=null;function F(e){const t=b.indexOf(e.inputSource);if(-1===t)return;const n=R[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){a.removeEventListener("select",F),a.removeEventListener("selectstart",F),a.removeEventListener("selectend",F),a.removeEventListener("squeeze",F),a.removeEventListener("squeezestart",F),a.removeEventListener("squeezeend",F),a.removeEventListener("end",B),a.removeEventListener("inputsourceschange",G);for(let e=0;e=0&&(b[i]=null,R[i].disconnect(n))}for(let t=0;t=b.length){b.push(n),i=e;break}if(null===b[e]){b[e]=n,i=e;break}}if(-1===i)break}const r=R[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getGripSpace()},this.getHand=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===i.isPresenting&&v("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===i.isPresenting&&v("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||s},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==p?p:m},this.getBinding=function(){return null===f&&_&&(f=new XRWebGLBinding(a,n)),f},this.getFrame=function(){return h},this.getSession=function(){return a},this.setSession=async function(t){if(a=t,null!==a){x=e.getRenderTarget(),a.addEventListener("select",F),a.addEventListener("selectstart",F),a.addEventListener("selectend",F),a.addEventListener("squeeze",F),a.addEventListener("squeezestart",F),a.addEventListener("squeezeend",F),a.addEventListener("end",B),a.addEventListener("inputsourceschange",G),!0!==M.xrCompatible&&await n.makeXRCompatible(),L=e.getPixelRatio(),e.getSize(C);if(_&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,r=null;M.depth&&(r=M.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=M.stencil?bt:be,i=M.stencil?Pt:Le);const s={colorFormat:n.RGBA8,depthFormat:r,scaleFactor:o};f=this.getBinding(),p=f.createProjectionLayer(s),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),A=new I(p.textureWidth,p.textureHeight,{format:T,type:S,depthTexture:new Y(p.textureWidth,p.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})}else{const t={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(a,n,t),a.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),A=new I(m.framebufferWidth,m.framebufferHeight,{format:T,type:S,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})}A.isXRRenderTarget=!0,this.setFoveation(c),d=null,s=await a.requestReferenceSpace(l),z.setContext(a),z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};const H=new r,V=new r;function W(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===a)return;let t=e.near,n=e.far;null!==g.texture&&(g.depthNear>0&&(t=g.depthNear),g.depthFar>0&&(n=g.depthFar)),N.near=D.near=U.near=t,N.far=D.far=U.far=n,y===N.near&&O===N.far||(a.updateRenderState({depthNear:N.near,depthFar:N.far}),y=N.near,O=N.far),N.layers.mask=6|e.layers.mask,U.layers.mask=-5&N.layers.mask,D.layers.mask=-3&N.layers.mask;const i=e.parent,r=N.cameras;W(N,i);for(let e=0;e0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,o=r.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Ta.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&e.envMapRotation.value.premultiply(xa),e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,_(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isNodeMaterial?r.uniformsNeedUpdate=!1:r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?(i(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(i(e,r),function(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)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){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===c&&e.clearcoatNormalScale.value.negate()));t.dispersion>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=i.texture,e.transmissionSamplerSize.value.set(i.width,i.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))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(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))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,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)}(e,r,a,o):r.isSpriteMaterial?function(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)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ra(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return"number"==typeof r||"boolean"==typeof r?i[a]=r:ArrayBuffer.isView(r)?i[a]=r.slice():i[a]=r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else{if(ArrayBuffer.isView(r))return!0;if(!1===e.equals(r))return e.copy(r),!0}}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(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?v("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):v("WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){const n=t.target;n.removeEventListener("dispose",d);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,u){let f=r[n.id];void 0===f&&(!function(e){const t=e.uniforms;let n=0;const i=16;for(let e=0,r=t.length;e0&&(n+=i-r);e.__size=n,e.__cache={}}(n),f=function(t){const n=function(){for(let e=0;e0),p=!!n.morphAttributes.position,m=!!n.morphAttributes.normal,h=!!n.morphAttributes.color;let _=L;i.toneMapped&&(null!==k&&!0!==k.isXRRenderTarget||(_=F.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,S=Me.get(i),M=U.state.lights;if(!0===se&&(!0===le||e!==X)){const t=e===X&&i.id===z;Ie.setState(i,e,t)}let T=!1;i.version===S.__version?S.needsLights&&S.lightsStateVersion!==M.state.version||S.outputColorSpace!==s||r.isBatchedMesh&&!1===S.batching?T=!0:r.isBatchedMesh||!0!==S.batching?r.isBatchedMesh&&!0===S.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===S.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===S.instancing?T=!0:r.isInstancedMesh||!0!==S.instancing?r.isSkinnedMesh&&!1===S.skinning?T=!0:r.isSkinnedMesh||!0!==S.skinning?r.isInstancedMesh&&!0===S.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===S.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===S.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===S.instancingMorph&&null!==r.morphTexture||S.envMap!==c||!0===i.fog&&S.fog!==a?T=!0:void 0===S.numClippingPlanes||S.numClippingPlanes===Ie.numPlanes&&S.numIntersection===Ie.numIntersection?(S.vertexAlphas!==d||S.vertexTangents!==u||S.morphTargets!==p||S.morphNormals!==m||S.morphColors!==h||S.toneMapping!==_||S.morphTargetsCount!==v)&&(T=!0):T=!0:T=!0:T=!0:T=!0:(T=!0,S.__version=i.version);let x=S.currentProgram;!0===T&&(x=ot(i,t,r),H&&i.isNodeMaterial&&H.onUpdateProgram(i,x,S));let A=!1,R=!1,b=!1;const C=x.getUniforms(),P=S.uniforms;ve.useProgram(x.program)&&(A=!0,R=!0,b=!0);i.id!==z&&(z=i.id,R=!0);if(A||X!==e){ve.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),C.setValue(We,"projectionMatrix",e.projectionMatrix),C.setValue(We,"viewMatrix",e.matrixWorldInverse);const t=C.map.cameraPosition;void 0!==t&&t.setValue(We,de.setFromMatrixPosition(e.matrixWorld)),ge.logarithmicDepthBuffer&&C.setValue(We,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(We,"isOrthographic",!0===e.isOrthographicCamera),X!==e&&(X=e,R=!0,b=!0)}S.needsLights&&(M.state.directionalShadowMap.length>0&&C.setValue(We,"directionalShadowMap",M.state.directionalShadowMap,Te),M.state.spotShadowMap.length>0&&C.setValue(We,"spotShadowMap",M.state.spotShadowMap,Te),M.state.pointShadowMap.length>0&&C.setValue(We,"pointShadowMap",M.state.pointShadowMap,Te));if(r.isSkinnedMesh){C.setOptional(We,r,"bindMatrix"),C.setOptional(We,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),C.setValue(We,"boneTexture",e.boneTexture,Te))}r.isBatchedMesh&&(C.setOptional(We,r,"batchingTexture"),C.setValue(We,"batchingTexture",r._matricesTexture,Te),C.setOptional(We,r,"batchingIdTexture"),C.setValue(We,"batchingIdTexture",r._indirectTexture,Te),C.setOptional(We,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(We,"batchingColorTexture",r._colorsTexture,Te));const D=n.morphAttributes;void 0===D.position&&void 0===D.normal&&void 0===D.color||Oe.update(r,n,x);(R||S.receiveShadow!==r.receiveShadow)&&(S.receiveShadow=r.receiveShadow,C.setValue(We,"receiveShadow",r.receiveShadow));(i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial)&&null===i.envMap&&null!==t.environment&&(P.envMapIntensity.value=t.environmentIntensity);void 0!==P.dfgLUT&&(P.dfgLUT.value=(null===Ca&&(Ca=new Ln(ba,16,16,Se,E),Ca.name="DFG_LUT",Ca.minFilter=O,Ca.magFilter=O,Ca.wrapS=mt,Ca.wrapT=mt,Ca.generateMipmaps=!1,Ca.needsUpdate=!0),Ca));R&&(C.setValue(We,"toneMappingExposure",F.toneMappingExposure),S.needsLights&&(I=b,(w=P).ambientLightColor.needsUpdate=I,w.lightProbe.needsUpdate=I,w.directionalLights.needsUpdate=I,w.directionalLightShadows.needsUpdate=I,w.pointLights.needsUpdate=I,w.pointLightShadows.needsUpdate=I,w.spotLights.needsUpdate=I,w.spotLightShadows.needsUpdate=I,w.rectAreaLights.needsUpdate=I,w.hemisphereLights.needsUpdate=I),a&&!0===i.fog&&Pe.refreshFogUniforms(P,a),Pe.refreshMaterialUniforms(P,i,ee,J,U.state.transmissionRenderTarget[e.id]),Ar.upload(We,st(S),P,Te));var w,I;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ar.upload(We,st(S),P,Te),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&C.setValue(We,"center",r.center);if(C.setValue(We,"modelViewMatrix",r.modelViewMatrix),C.setValue(We,"normalMatrix",r.normalMatrix),C.setValue(We,"modelMatrix",r.matrixWorld),void 0!==i.uniformsGroups){const e=i.uniformsGroups;for(let t=0,n=e.length;t{function n(){i.forEach(function(e){Me.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==_e.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let $e=null;function Qe(){et.stop()}function Je(){et.start()}const et=new On;function tt(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)U.pushLight(e),e.castShadow&&U.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||oe.intersectsSprite(e)){i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ce);const t=be.update(e),r=e.material;r.visible&&P.push(e,t,r,n,ue.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||oe.intersectsObject(e))){const t=be.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ue.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ue.copy(t.boundingSphere.center)),ue.applyMatrix4(e.matrixWorld).applyMatrix4(ce)),Array.isArray(r)){const i=t.groups;for(let a=0,o=i.length;a0&&rt(r,t,n),a.length>0&&rt(a,t,n),o.length>0&&rt(o,t,n),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function it(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===U.state.transmissionRenderTarget[i.id]){const e=_e.has("EXT_color_buffer_half_float")||_e.has("EXT_color_buffer_float");U.state.transmissionRenderTarget[i.id]=new I(1,1,{generateMipmaps:!0,type:e?E:S,minFilter:B,samples:Math.max(4,ge.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:f.workingColorSpace})}const r=U.state.transmissionRenderTarget[i.id],a=i.viewport||Y;r.setSize(a.z*F.transmissionResolutionScale,a.w*F.transmissionResolutionScale);const s=F.getRenderTarget(),l=F.getActiveCubeFace(),d=F.getActiveMipmapLevel();F.setRenderTarget(r),F.getClearColor(Z),$=F.getClearAlpha(),$<1&&F.setClearColor(16777215,.5),F.clear(),pe&&ye.render(n);const u=F.toneMapping;F.toneMapping=L;const p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),U.setupLightsView(i),!0===se&&Ie.setGlobalState(F.clippingPlanes,i),rt(e,n,i),Te.updateMultisampleRenderTarget(r),Te.updateRenderTargetMipmap(r),!1===_e.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r0)for(let t=0,a=r.length;t0&&it(n,i,e,t),pe&&ye.render(e),nt(P,e,t)}null!==k&&0===W&&(Te.updateMultisampleRenderTarget(k),Te.updateRenderTargetMipmap(k)),i&&y.end(F),!0===e.isScene&&e.onAfterRender(F,e,t),He.resetDefaultState(),z=-1,X=null,N.pop(),N.length>0?(U=N[N.length-1],Te.setTextureUnits(U.state.textureUnits),!0===se&&Ie.setGlobalState(F.clippingPlanes,U.state.camera)):U=null,w.pop(),P=w.length>0?w[w.length-1]:null,null!==H&&H.renderEnd()},this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return k},this.setRenderTargetTextures=function(e,t,n){const i=Me.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),Me.get(e.texture).__webglTexture=t,Me.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=Me.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const ct=We.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){k=e,V=t,W=n;let i=null,r=!1,a=!1;if(e){const o=Me.get(e);if(void 0!==o.__useDefaultFramebuffer)return ve.bindFramebuffer(We.FRAMEBUFFER,o.__webglFramebuffer),Y.copy(e.viewport),q.copy(e.scissor),j=e.scissorTest,ve.viewport(Y),ve.scissor(q),ve.setScissorTest(j),void(z=-1);if(void 0===o.__webglFramebuffer)Te.setupRenderTarget(e);else if(o.__hasExternalTextures)Te.rebindTextures(e,Me.get(e.texture).__webglTexture,Me.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&Me.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Te.setupDepthRenderbuffer(e)}}const s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);const l=Me.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],r=!0):i=e.samples>0&&!1===Te.useMultisampledRTT(e)?Me.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,Y.copy(e.viewport),q.copy(e.scissor),j=e.scissorTest}else Y.copy(ie).multiplyScalar(ee).floor(),q.copy(re).multiplyScalar(ee).floor(),j=ae;0!==n&&(i=ct);if(ve.bindFramebuffer(We.FRAMEBUFFER,i)&&ve.drawBuffers(e,i),ve.viewport(Y),ve.scissor(q),ve.setScissorTest(j),r){const i=Me.get(e.texture);We.framebufferTexture2D(We.FRAMEBUFFER,We.COLOR_ATTACHMENT0,We.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=t;for(let t=0;t1&&We.readBuffer(We.COLOR_ATTACHMENT0+s),!ge.textureFormatReadable(l))return void D("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(c))return void D("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&We.readPixels(t,n,i,r,Ge.convert(l),Ge.convert(c),a)}finally{const e=null!==k?Me.get(k).__webglFramebuffer:null;ve.bindFramebuffer(We.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,o,s=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=Me.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(l=l[o]),l){if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){ve.bindFramebuffer(We.FRAMEBUFFER,l);const o=e.textures[s],c=o.format,d=o.type;if(e.textures.length>1&&We.readBuffer(We.COLOR_ATTACHMENT0+s),!ge.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(d))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const u=We.createBuffer();We.bindBuffer(We.PIXEL_PACK_BUFFER,u),We.bufferData(We.PIXEL_PACK_BUFFER,a.byteLength,We.STREAM_READ),We.readPixels(t,n,i,r,Ge.convert(c),Ge.convert(d),0);const f=null!==k?Me.get(k).__webglFramebuffer:null;ve.bindFramebuffer(We.FRAMEBUFFER,f);const p=We.fenceSync(We.SYNC_GPU_COMMANDS_COMPLETE,0);return We.flush(),await yn(We,p,4),We.bindBuffer(We.PIXEL_PACK_BUFFER,u),We.getBufferSubData(We.PIXEL_PACK_BUFFER,0,a),We.deleteBuffer(u),We.deleteSync(p),a}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),o=null!==t?t.x:0,s=null!==t?t.y:0;Te.setTexture2D(e,0),We.copyTexSubImage2D(We.TEXTURE_2D,n,0,0,o,s,r,a),ve.unbindTexture()};const dt=We.createFramebuffer(),ut=We.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,a=0){let o,s,l,c,d,u,f,p,m;const h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(null!==n)o=n.max.x-n.min.x,s=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,d=n.min.y,u=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);o=Math.floor(h.width*t),s=Math.floor(h.height*t),l=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,c=0,d=0,u=0}null!==i?(f=i.x,p=i.y,m=i.z):(f=0,p=0,m=0);const _=Ge.convert(t.format),g=Ge.convert(t.type);let v;t.isData3DTexture?(Te.setTexture3D(t,0),v=We.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Te.setTexture2DArray(t,0),v=We.TEXTURE_2D_ARRAY):(Te.setTexture2D(t,0),v=We.TEXTURE_2D),ve.activeTexture(We.TEXTURE0),ve.pixelStorei(We.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(We.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(We.UNPACK_ALIGNMENT,t.unpackAlignment);const E=ve.getParameter(We.UNPACK_ROW_LENGTH),S=ve.getParameter(We.UNPACK_IMAGE_HEIGHT),M=ve.getParameter(We.UNPACK_SKIP_PIXELS),T=ve.getParameter(We.UNPACK_SKIP_ROWS),x=ve.getParameter(We.UNPACK_SKIP_IMAGES);ve.pixelStorei(We.UNPACK_ROW_LENGTH,h.width),ve.pixelStorei(We.UNPACK_IMAGE_HEIGHT,h.height),ve.pixelStorei(We.UNPACK_SKIP_PIXELS,c),ve.pixelStorei(We.UNPACK_SKIP_ROWS,d),ve.pixelStorei(We.UNPACK_SKIP_IMAGES,u);const A=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=Me.get(e),i=Me.get(t),h=Me.get(n.__renderTarget),_=Me.get(i.__renderTarget);ve.bindFramebuffer(We.READ_FRAMEBUFFER,h.__webglFramebuffer),ve.bindFramebuffer(We.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;ne.start-t.start);let t=0;for(let e=1;e 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn 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 );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid 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 ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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 ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\treturn 0.5 / max( gv + gl, EPSILON );\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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 ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\n\t}\n#endif\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid 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 ) {\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#if defined( USE_PACKED_NORMALMAP )\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\t#endif\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\t\t\t#else\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Gn={common:{diffuse:{value:new n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new e}},envmap:{envMap:{value:null},envMapRotation:{value:new e},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new e},normalScale:{value:new t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new n(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0},uvTransform:{value:new e}},sprite:{diffuse:{value:new n(16777215)},opacity:{value:1},center:{value:new t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}}},Hn={basic:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.fog]),vertexShader:Bn.meshbasic_vert,fragmentShader:Bn.meshbasic_frag},lambert:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},envMapIntensity:{value:1}}]),vertexShader:Bn.meshlambert_vert,fragmentShader:Bn.meshlambert_frag},phong:{uniforms:i([Gn.common,Gn.specularmap,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},specular:{value:new n(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Bn.meshphong_vert,fragmentShader:Bn.meshphong_frag},standard:{uniforms:i([Gn.common,Gn.envmap,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.roughnessmap,Gn.metalnessmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bn.meshphysical_vert,fragmentShader:Bn.meshphysical_frag},toon:{uniforms:i([Gn.common,Gn.aomap,Gn.lightmap,Gn.emissivemap,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.gradientmap,Gn.fog,Gn.lights,{emissive:{value:new n(0)}}]),vertexShader:Bn.meshtoon_vert,fragmentShader:Bn.meshtoon_frag},matcap:{uniforms:i([Gn.common,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,Gn.fog,{matcap:{value:null}}]),vertexShader:Bn.meshmatcap_vert,fragmentShader:Bn.meshmatcap_frag},points:{uniforms:i([Gn.points,Gn.fog]),vertexShader:Bn.points_vert,fragmentShader:Bn.points_frag},dashed:{uniforms:i([Gn.common,Gn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bn.linedashed_vert,fragmentShader:Bn.linedashed_frag},depth:{uniforms:i([Gn.common,Gn.displacementmap]),vertexShader:Bn.depth_vert,fragmentShader:Bn.depth_frag},normal:{uniforms:i([Gn.common,Gn.bumpmap,Gn.normalmap,Gn.displacementmap,{opacity:{value:1}}]),vertexShader:Bn.meshnormal_vert,fragmentShader:Bn.meshnormal_frag},sprite:{uniforms:i([Gn.sprite,Gn.fog]),vertexShader:Bn.sprite_vert,fragmentShader:Bn.sprite_frag},background:{uniforms:{uvTransform:{value:new e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Bn.background_vert,fragmentShader:Bn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new e}},vertexShader:Bn.backgroundCube_vert,fragmentShader:Bn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bn.cube_vert,fragmentShader:Bn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bn.equirect_vert,fragmentShader:Bn.equirect_frag},distance:{uniforms:i([Gn.common,Gn.displacementmap,{referencePosition:{value:new r},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bn.distance_vert,fragmentShader:Bn.distance_frag},shadow:{uniforms:i([Gn.lights,Gn.fog,{color:{value:new n(0)},opacity:{value:1}}]),vertexShader:Bn.shadow_vert,fragmentShader:Bn.shadow_frag}};Hn.physical={uniforms:i([Hn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new e},clearcoatNormalScale:{value:new t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new e},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new e},sheen:{value:0},sheenColor:{value:new n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new e},transmissionSamplerSize:{value:new t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new e},attenuationDistance:{value:0},attenuationColor:{value:new n(0)},specularColor:{value:new n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new e},anisotropyVector:{value:new t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new e}}]),vertexShader:Bn.meshphysical_vert,fragmentShader:Bn.meshphysical_frag};const Vn={r:0,b:0,g:0},Wn=new u,kn=new e;function zn(e,t,i,r,u,g){const v=new n(0);let E,S,T=!0===u?0:1,M=null,x=0,A=null;function R(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){const i=e.backgroundBlurriness>0;n=t.get(n,i)}return n}function b(t,n){t.getRGB(Vn,_(e)),i.buffers.color.setClear(Vn.r,Vn.g,Vn.b,n,g)}return{getClearColor:function(){return v},setClearColor:function(e,t=1){v.set(e),T=t,b(v,T)},getClearAlpha:function(){return T},setClearAlpha:function(e){T=e,b(v,T)},render:function(t){let n=!1;const r=R(t);null===r?b(v,T):r&&r.isColor&&(b(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,g):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,g),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=R(n);i&&(i.isCubeTexture||i.mapping===a)?(void 0===S&&(S=new o(new s(1,1,1),new l({name:"BackgroundCubeMaterial",uniforms:d(Hn.backgroundCube.uniforms),vertexShader:Hn.backgroundCube.vertexShader,fragmentShader:Hn.backgroundCube.fragmentShader,side:c,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),S.geometry.deleteAttribute("normal"),S.geometry.deleteAttribute("uv"),S.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(S.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(S)),S.material.uniforms.envMap.value=i,S.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,S.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,S.material.uniforms.backgroundRotation.value.setFromMatrix4(Wn.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&!1===i.isRenderTargetTexture&&S.material.uniforms.backgroundRotation.value.premultiply(kn),S.material.toneMapped=f.getTransfer(i.colorSpace)!==p,M===i&&x===i.version&&A===e.toneMapping||(S.material.needsUpdate=!0,M=i,x=i.version,A=e.toneMapping),S.layers.enableAll(),t.unshift(S,S.geometry,S.material,0,0,null)):i&&i.isTexture&&(void 0===E&&(E=new o(new m(2,2),new l({name:"BackgroundMaterial",uniforms:d(Hn.background.uniforms),vertexShader:Hn.background.vertexShader,fragmentShader:Hn.background.fragmentShader,side:h,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),E.geometry.deleteAttribute("normal"),Object.defineProperty(E.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(E)),E.material.uniforms.t2D.value=i,E.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,E.material.toneMapped=f.getTransfer(i.colorSpace)!==p,!0===i.matrixAutoUpdate&&i.updateMatrix(),E.material.uniforms.uvTransform.value.copy(i.matrix),M===i&&x===i.version&&A===e.toneMapping||(E.material.needsUpdate=!0,M=i,x=i.version,A=e.toneMapping),E.layers.enableAll(),t.unshift(E,E.geometry,E.material,0,0,null))},dispose:function(){void 0!==S&&(S.geometry.dispose(),S.material.dispose(),S=void 0),void 0!==E&&(E.geometry.dispose(),E.material.dispose(),E=void 0)}}}function Xn(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}}return a.attributesNum!==s||a.index!==i}(n,h,l,_),v&&function(e,t,n,i){const r={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}}a.attributes=r,a.attributesNum=s,a.index=i}(n,h,l,_),null!==_&&t.update(_,e.ELEMENT_ARRAY_BUFFER),(v||o)&&(o=!1,function(n,i,r,a){d();const o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(const i in s){const r=s[i];if(r.location>=0){let s=o[i];if(void 0===s&&("instanceMatrix"===i&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,d=l.type,p=l.bytesPerElement,h=d===e.INT||d===e.UNSIGNED_INT||s.gpuType===g;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,_=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(v("WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control");!0===n.reversedDepthBuffer&&!1===c&&v("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===M||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===E&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==S&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==T&&!r)},precision:o,logarithmicDepthBuffer:l,reversedDepthBuffer:c,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function qn(t){const n=this;let i=null,r=0,a=!1,o=!1;const s=new x,l=new e,c={value:null,needsUpdate:!1};function d(e,t,i,r){const a=null!==e?e.length:0;let o=null;if(0!==a){if(o=c.value,!0!==r||null===o){const n=i+4*a,r=t.matrixWorldInverse;l.getNormalMatrix(r),(null===o||o.length0);n.numPlanes=r,n.numIntersection=0}();else{const e=o?0:r,t=4*e;let n=m.clippingState||null;c.value=n,n=d(u,s,t,l);for(let e=0;e!==t;++e)n[e]=i[e];m.clippingState=n,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}}}kn.set(-1,0,0,0,1,0,0,0,1);const jn=[.125,.215,.35,.446,.526,.582],Zn=20,$n=new C,Qn=new n;let Jn=null,ei=0,ti=0,ni=!1;const ii=new r;class ri{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){const{size:a=256,position:o=ii}=r;Jn=this._renderer.getRenderTarget(),ei=this._renderer.getActiveCubeFace(),ti=this._renderer.getActiveMipmapLevel(),ni=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,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(){null===this._cubemapMaterial&&(this._cubemapMaterial=li(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=si(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=jn[s-e+4-1]:0===s&&(l=0),n.push(l);const c=1/(a-2),d=-c,u=1+c,f=[d,d,u,d,u,u,d,d,u,u,d,u],p=6,m=6,h=3,_=2,g=1,v=new Float32Array(h*m*p),E=new Float32Array(_*m*p),S=new Float32Array(g*m*p);for(let e=0;e2?0:-1,i=[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];v.set(i,h*m*e),E.set(f,_*m*e);const r=[e,e,e,e,e,e];S.set(r,g*m*e)}const T=new b;T.setAttribute("position",new N(v,h)),T.setAttribute("uv",new N(E,_)),T.setAttribute("faceIndex",new N(S,g)),i.push(new o(T,null)),r>4&&r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(Zn),a=new r(0,1,0),o=new l({name:"SphericalGaussianBlur",defines:{n:Zn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1});return o}(i,e,t),this._ggxMaterial=function(e,t,n){const i=new l({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:ci(),fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:w,depthTest:!1,depthWrite:!1});return i}(i,e,t)}return i}_compileMaterial(e){const t=new o(new b,e);this._renderer.compile(t,$n)}_sceneToCubeUV(e,t,n,i,r){const a=new P(90,1,t,n),l=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,p=u.toneMapping;u.getClearColor(Qn),u.toneMapping=L,u.autoClear=!1;u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new o(new s,new U({name:"PMREM.Background",side:c,depthWrite:!1,depthTest:!1})));const m=this._backgroundBox,h=m.material;let _=!1;const g=e.background;g?g.isColor&&(h.color.copy(g),e.background=null,_=!0):(h.color.copy(Qn),_=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(a.up.set(0,l[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+d[t],r.y,r.z)):1===n?(a.up.set(0,0,l[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+d[t],r.z)):(a.up.set(0,l[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+d[t]));const o=this._cubeSize;oi(i,n*o,t>2?o:0,o,o),u.setRenderTarget(i),_&&u.render(m,a),u.render(e,a)}u.toneMapping=p,u.autoClear=f,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===A||e.mapping===R;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=li()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=si());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;r.uniforms.envMap.value=e;const o=this._cubeSize;oi(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,$n)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let t=1;tu-4?n-u+4:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=d,s.mipInt.value=u-t,oi(r,p,m,3*f,2*f),i.setRenderTarget(r),i.render(o,$n),s.envMap.value=r.texture,s.roughness.value=0,s.mipInt.value=u-n,oi(e,p,m,3*f,2*f),i.setRenderTarget(e),i.render(o,$n)}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&D("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[i];c.material=l;const d=l.uniforms,u=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/f,m=isFinite(r)?1+Math.floor(3*p):Zn;m>Zn&&v(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const h=[];let _=0;for(let e=0;eg-4?i-g+4:0),4*(this._cubeSize-E),3*E,2*E),s.setRenderTarget(t),s.render(c,$n)}}function ai(e,t,n){const i=new I(e,t,n);return i.texture.mapping=a,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function oi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function si(){return new l({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1})}function li(){return new l({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ci(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:w,depthTest:!1,depthWrite:!1})}function ci(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}class di extends I{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new F(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new s(5,5,5),r=new l({name:"CubemapFromEquirect",uniforms:d(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:c,blending:w});r.uniforms.tEquirect.value=t;const a=new o(i,r),u=t.minFilter;t.minFilter===B&&(t.minFilter=O);return new G(1,10,this).update(e,a),t.minFilter=u,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}function ui(e){let t=new WeakMap,n=new WeakMap,i=null;function r(e,t){return t===H?e.mapping=A:t===V&&(e.mapping=R),e}function a(e){const n=e.target;n.removeEventListener("dispose",a);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}function o(e){const t=e.target;t.removeEventListener("dispose",o);const i=n.get(t);void 0!==i&&(n.delete(t),i.dispose())}return{get:function(s,l=!1){return null==s?null:l?function(t){if(t&&t.isTexture){const r=t.mapping,a=r===H||r===V,s=r===A||r===R;if(a||s){let r=n.get(t);const l=void 0!==r?r.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===i&&(i=new ri(e)),r=a?i.fromEquirectangular(t,r):i.fromCubemap(t,r),r.texture.pmremVersion=t.pmremVersion,n.set(t,r),r.texture;if(void 0!==r)return r.texture;{const l=t.image;return a&&l&&l.height>0||s&&l&&function(e){let t=0;const n=6;for(let i=0;i0){const o=new di(i.height);return o.fromEquirectangularTexture(e,n),t.set(n,o),n.addEventListener("dispose",a),r(o.texture,n.mapping)}return null}}}return n}(s)},dispose:function(){t=new WeakMap,n=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function fi(e){const t={};function n(n){if(void 0!==t[n])return t[n];const i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},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){const t=n(e);return null===t&&W("WebGLRenderer: "+e+" extension not supported."),t}}}function pi(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(void 0===r)return;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t=65535?k:z)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.versionn.maxTextureSize&&(M=Math.ceil(S/n.maxTextureSize),S=n.maxTextureSize);const x=new Float32Array(S*M*4*u),A=new X(x,S,M,u);A.type=T,A.needsUpdate=!0;const R=4*E;for(let C=0;C\n\t\t\t#include \n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:!1,depthWrite:!1}),d=new o(l,c),u=new C(-1,1,1,-1,0,1);let m,h=null,_=null,g=!1,v=null,S=[],T=!1;this.setSize=function(e,t){a.setSize(e,t),s.setSize(e,t);for(let n=0;n0&&!0===S[0].isRenderPass;const t=a.width,n=a.height;for(let e=0;e0)return e;const r=t*n;let a=Ri[r];if(void 0===a&&(a=new Float32Array(r),Ri[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function Di(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function Rr(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let br=0;const Cr=new e;function Pr(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Lr(e,t){const n=function(e){f._getMatrix(Cr,f.workingColorSpace,e);const t=`mat3( ${Cr.elements.map(e=>e.toFixed(4))} )`;switch(f.getTransfer(e)){case pe:return[t,"LinearTransferOETF"];case p:return[t,"sRGBTransferOETF"];default:return v("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}const Ur={[ne]:"Linear",[te]:"Reinhard",[ee]:"Cineon",[J]:"ACESFilmic",[Q]:"AgX",[$]:"Neutral",[Z]:"Custom"};function Dr(e,t){const n=Ur[t];return void 0===n?(v("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const wr=new r;function Ir(){f.getLuminanceCoefficients(wr);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${wr.x.toFixed(4)}, ${wr.y.toFixed(4)}, ${wr.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Nr(e){return""!==e}function yr(e,t){const 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 Or(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Fr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Br(e){return e.replace(Fr,Hr)}const Gr=new Map;function Hr(e,t){let n=Bn[t];if(void 0===n){const e=Gr.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Bn[e],v('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return Br(n)}const Vr=/#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 Wr(e){return e.replace(Vr,kr)}function kr(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(_+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Nr).join("\n"),g.length>0&&(g+="\n")):(_=[zr(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#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 "+d:"",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&&!1===n.flatShading?"#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&&!1===n.flatShading?"#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 "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Nr).join("\n"),g=[zr(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.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+l:"",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_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==L?"#define TONE_MAPPING":"",n.toneMapping!==L?Bn.tonemapping_pars_fragment:"",n.toneMapping!==L?Dr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Bn.colorspace_pars_fragment,Lr("linearToOutputTexel",n.outputColorSpace),Ir(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Nr).join("\n")),o=Br(o),o=yr(o,n),o=Or(o,n),s=Br(s),s=yr(s,n),s=Or(s,n),o=Wr(o),s=Wr(s),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",_=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,g=["#define varying in",n.glslVersion===se?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===se?"":"#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("\n")+"\n"+g);const S=E+_+o,T=E+g+s,M=Rr(r,r.VERTEX_SHADER,S),x=Rr(r,r.FRAGMENT_SHADER,T);function A(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(h)||"",i=r.getShaderInfoLog(M)||"",a=r.getShaderInfoLog(x)||"",o=n.trim(),s=i.trim(),l=a.trim();let c=!0,d=!0;if(!1===r.getProgramParameter(h,r.LINK_STATUS))if(c=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,h,M,x);else{const e=Pr(r,M,"vertex"),n=Pr(r,x,"fragment");D("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(h,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?v("WebGLProgram: Program Info Log:",o):""!==s&&""!==l||(d=!1);d&&(t.diagnostics={runnable:c,programLog:o,vertexShader:{log:s,prefix:_},fragmentShader:{log:l,prefix:g}})}r.deleteShader(M),r.deleteShader(x),R=new Ar(r,h),b=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,Q=r.clearcoat>0,J=r.dispersion>0,ee=r.iridescence>0,te=r.sheen>0,ne=r.transmission>0,ie=$&&!!r.anisotropyMap,re=Q&&!!r.clearcoatMap,ae=Q&&!!r.clearcoatNormalMap,oe=Q&&!!r.clearcoatRoughnessMap,se=ee&&!!r.iridescenceMap,le=ee&&!!r.iridescenceThicknessMap,ce=te&&!!r.sheenColorMap,de=te&&!!r.sheenRoughnessMap,ue=!!r.specularMap,fe=!!r.specularColorMap,pe=!!r.specularIntensityMap,me=ne&&!!r.transmissionMap,Ee=ne&&!!r.thicknessMap,xe=!!r.gradientMap,Ae=!!r.alphaMap,Re=r.alphaTest>0,be=!!r.alphaHash,Ce=!!r.extensions;let Pe=L;r.toneMapped&&(null!==O&&!0!==O.isXRRenderTarget||(Pe=e.toneMapping));const Le={shaderID:C,shaderType:r.type,shaderName:r.name,vertexShader:D,fragmentShader:w,defines:r.defines,customVertexShaderID:I,customFragmentShaderID:N,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:_,batching:G,batchingColor:G&&null!==S._colorsTexture,instancing:B,instancingColor:B&&null!==S.instanceColor,instancingMorph:B&&null!==S.morphTexture,outputColorSpace:null===O?e.outputColorSpace:!0===O.isXRRenderTarget?O.texture.colorSpace:f.workingColorSpace,alphaToCoverage:!!r.alphaToCoverage,map:H,matcap:V,envMap:W,envMapMode:W&&R.mapping,envMapCubeUVHeight:b,aoMap:k,lightMap:z,bumpMap:X,normalMap:K,displacementMap:Y,emissiveMap:q,normalMapObjectSpace:K&&r.normalMapType===ve,normalMapTangentSpace:K&&r.normalMapType===ge,packedNormalMap:K&&r.normalMapType===ge&&(Ue=r.normalMap.format,Ue===Se||Ue===Te||Ue===Me),metalnessMap:j,roughnessMap:Z,anisotropy:$,anisotropyMap:ie,clearcoat:Q,clearcoatMap:re,clearcoatNormalMap:ae,clearcoatRoughnessMap:oe,dispersion:J,iridescence:ee,iridescenceMap:se,iridescenceThicknessMap:le,sheen:te,sheenColorMap:ce,sheenRoughnessMap:de,specularMap:ue,specularColorMap:fe,specularIntensityMap:pe,transmission:ne,transmissionMap:me,thicknessMap:Ee,gradientMap:xe,opaque:!1===r.transparent&&r.blending===_e&&!1===r.alphaToCoverage,alphaMap:Ae,alphaTest:Re,alphaHash:be,combine:r.combine,mapUv:H&&E(r.map.channel),aoMapUv:k&&E(r.aoMap.channel),lightMapUv:z&&E(r.lightMap.channel),bumpMapUv:X&&E(r.bumpMap.channel),normalMapUv:K&&E(r.normalMap.channel),displacementMapUv:Y&&E(r.displacementMap.channel),emissiveMapUv:q&&E(r.emissiveMap.channel),metalnessMapUv:j&&E(r.metalnessMap.channel),roughnessMapUv:Z&&E(r.roughnessMap.channel),anisotropyMapUv:ie&&E(r.anisotropyMap.channel),clearcoatMapUv:re&&E(r.clearcoatMap.channel),clearcoatNormalMapUv:ae&&E(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&E(r.clearcoatRoughnessMap.channel),iridescenceMapUv:se&&E(r.iridescenceMap.channel),iridescenceThicknessMapUv:le&&E(r.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&E(r.sheenColorMap.channel),sheenRoughnessMapUv:de&&E(r.sheenRoughnessMap.channel),specularMapUv:ue&&E(r.specularMap.channel),specularColorMapUv:fe&&E(r.specularColorMap.channel),specularIntensityMapUv:pe&&E(r.specularIntensityMap.channel),transmissionMapUv:me&&E(r.transmissionMap.channel),thicknessMapUv:Ee&&E(r.thicknessMap.channel),alphaMapUv:Ae&&E(r.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(K||$),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===S.isPoints&&!!M.attributes.uv&&(H||Ae),fog:!!T,useFog:!0===r.fog,fogExp2:!!T&&T.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===M.attributes.normal&&!1===K&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:F,skinning:!0===S.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:U,morphTextureStride:y,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:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Pe,decodeVideoTexture:H&&!0===r.map.isVideoTexture&&f.getTransfer(r.map.colorSpace)===p,decodeVideoTextureEmissive:q&&!0===r.emissiveMap.isVideoTexture&&f.getTransfer(r.emissiveMap.colorSpace)===p,premultipliedAlpha:r.premultipliedAlpha,doubleSided:r.side===he,flipSided:r.side===c,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:Ce&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&!0===r.extensions.multiDraw||G)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};var Ue;return Le.vertexUv1s=d.has(1),Le.vertexUv2s=d.has(2),Le.vertexUv3s=d.has(3),d.clear(),Le},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(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)}(n,t),function(e,t){s.disableAll(),t.instancing&&s.enable(0);t.instancingColor&&s.enable(1);t.instancingMorph&&s.enable(2);t.matcap&&s.enable(3);t.envMap&&s.enable(4);t.normalMapObjectSpace&&s.enable(5);t.normalMapTangentSpace&&s.enable(6);t.clearcoat&&s.enable(7);t.iridescence&&s.enable(8);t.alphaTest&&s.enable(9);t.vertexColors&&s.enable(10);t.vertexAlphas&&s.enable(11);t.vertexUv1s&&s.enable(12);t.vertexUv2s&&s.enable(13);t.vertexUv3s&&s.enable(14);t.vertexTangents&&s.enable(15);t.anisotropy&&s.enable(16);t.alphaHash&&s.enable(17);t.batching&&s.enable(18);t.dispersion&&s.enable(19);t.batchingColor&&s.enable(20);t.gradientMap&&s.enable(21);t.packedNormalMap&&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.reversedDepthBuffer&&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)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=g[e.type];let n;if(t){const e=Hn[t];n=me.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i=m.get(n);return void 0!==i?++i.usedTimes:(i=new jr(e,n,t,r),u.push(i),m.set(n,i)),i},releaseProgram:function(e){if(0===--e.usedTimes){const t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),m.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function ea(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ta(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.materialVariant!==t.materialVariant?e.materialVariant-t.materialVariant:e.z!==t.z?e.z-t.z:e.id-t.id}function na(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function ia(){const e=[];let t=0;const n=[],i=[],r=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function o(n,i,r,o,s,l){let c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:i,material:r,materialVariant:a(n),groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=r,c.materialVariant=a(n),c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,s,l,c){const d=o(e,t,a,s,l,c);a.transmission>0?i.push(d):!0===a.transparent?r.push(d):n.push(d)},unshift:function(e,t,a,s,l,c){const d=o(e,t,a,s,l,c);a.transmission>0?i.unshift(d):!0===a.transparent?r.unshift(d):n.unshift(d)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||ta),i.length>1&&i.sort(t||na),r.length>1&&r.sort(t||na)}}}function ra(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new ia,e.set(t,[r])):n>=i.length?(r=new ia,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function aa(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new r,color:new n};break;case"SpotLight":i={position:new r,direction:new r,color:new n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new r,color:new n,distance:0,decay:0};break;case"HemisphereLight":i={direction:new r,skyColor:new n,groundColor:new n};break;case"RectAreaLight":i={color:new n,position:new r,halfWidth:new r,halfHeight:new r}}return e[t.id]=i,i}}}let oa=0;function sa(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function la(e){const n=new aa,i=function(){const e={};return{get:function(n){if(void 0!==e[n.id])return e[n.id];let i;switch(n.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t,shadowCameraNear:1,shadowCameraFar:1e3}}return e[n.id]=i,i}}}(),a={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++)a.probe.push(new r);const o=new r,s=new u,l=new u;return{setup:function(t){let r=0,o=0,s=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let l=0,c=0,d=0,u=0,f=0,p=0,m=0,h=0,_=0,g=0,v=0;t.sort(sa);for(let e=0,E=t.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Gn.LTC_FLOAT_1,a.rectAreaLTC2=Gn.LTC_FLOAT_2):(a.rectAreaLTC1=Gn.LTC_HALF_1,a.rectAreaLTC2=Gn.LTC_HALF_2)),a.ambient[0]=r,a.ambient[1]=o,a.ambient[2]=s;const E=a.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===d&&E.rectAreaLength===u&&E.hemiLength===f&&E.numDirectionalShadows===p&&E.numPointShadows===m&&E.numSpotShadows===h&&E.numSpotMaps===_&&E.numLightProbes===v||(a.directional.length=l,a.spot.length=d,a.rectArea.length=u,a.point.length=c,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+_-g,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=g,a.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=d,E.rectAreaLength=u,E.hemiLength=f,E.numDirectionalShadows=p,E.numPointShadows=m,E.numSpotShadows=h,E.numSpotMaps=_,E.numLightProbes=v,a.version=oa++)},setupView:function(e,t){let n=0,i=0,r=0,c=0,d=0;const u=t.matrixWorldInverse;for(let t=0,f=e.length;t=r.length?(a=new ca(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}const ua=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],fa=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],pa=new u,ma=new r,ha=new r;function _a(e,n,i){let r=new Ue;const a=new t,s=new t,d=new K,u=new xe,f=new Ae,p={},m=i.maxTextureSize,_={[h]:c,[c]:h,[he]:he},g=new l({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),S=g.clone();S.defines.HORIZONTAL_PASS=1;const M=new b;M.setAttribute("position",new N(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new o(M,g),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ce;let R=this.type;function C(t,i){const r=n.update(x);g.defines.VSM_SAMPLES!==t.blurSamples&&(g.defines.VSM_SAMPLES=t.blurSamples,S.defines.VSM_SAMPLES=t.blurSamples,g.needsUpdate=!0,S.needsUpdate=!0),null===t.mapPass&&(t.mapPass=new I(a.x,a.y,{format:Se,type:E})),g.uniforms.shadow_pass.value=t.map.depthTexture,g.uniforms.resolution.value=t.mapSize,g.uniforms.radius.value=t.radius,e.setRenderTarget(t.mapPass),e.clear(),e.renderBufferDirect(i,null,r,g,x,null),S.uniforms.shadow_pass.value=t.mapPass.texture,S.uniforms.resolution.value=t.mapSize,S.uniforms.radius.value=t.radius,e.setRenderTarget(t.map),e.clear(),e.renderBufferDirect(i,null,r,S,x,null)}function P(t,n,i,r){let a=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?f:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=a.uuid,t=n.uuid;let i=p[e];void 0===i&&(i={},p[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",U)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===le?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:_[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.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,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){e.properties.get(a).light=i}return a}function L(t,i,a,o,s){if(!1===t.visible)return;if(t.layers.test(i.layers)&&(t.isMesh||t.isLine||t.isPoints)&&(t.castShadow||t.receiveShadow&&s===le)&&(!t.frustumCulled||r.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,t.matrixWorld);const r=n.update(t),l=t.material;if(Array.isArray(l)){const n=r.groups;for(let c=0,d=n.length;ce.needsUpdate=!0):e.material.needsUpdate=!0)});for(let o=0,l=t.length;om||a.y>m)&&(a.x>m&&(s.x=Math.floor(m/p.x),a.x=s.x*p.x,c.mapSize.x=s.x),a.y>m&&(s.y=Math.floor(m/p.y),a.y=s.y*p.y,c.mapSize.y=s.y));const h=e.state.buffers.depth.getReversed();if(c.camera._reversedDepth=h,null===c.map||!0===f){if(null!==c.map&&(null!==c.map.depthTexture&&(c.map.depthTexture.dispose(),c.map.depthTexture=null),c.map.dispose()),this.type===le){if(l.isPointLight){v("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}c.map=new I(a.x,a.y,{format:Se,type:E,minFilter:O,magFilter:O,generateMipmaps:!1}),c.map.texture.name=l.name+".shadowMap",c.map.depthTexture=new Y(a.x,a.y,T),c.map.depthTexture.name=l.name+".shadowMapDepth",c.map.depthTexture.format=be,c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=Ce,c.map.depthTexture.magFilter=Ce}else l.isPointLight?(c.map=new di(a.x),c.map.depthTexture=new Pe(a.x,Le)):(c.map=new I(a.x,a.y),c.map.depthTexture=new Y(a.x,a.y,Le)),c.map.depthTexture.name=l.name+".shadowMap",c.map.depthTexture.format=be,this.type===ce?(c.map.depthTexture.compareFunction=h?re:ae,c.map.depthTexture.minFilter=O,c.map.depthTexture.magFilter=O):(c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=Ce,c.map.depthTexture.magFilter=Ce);c.camera.updateProjectionMatrix()}const _=c.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(c.map.isWebGLCubeRenderTarget)e.setRenderTarget(c.map,t),e.clear();else{0===t&&(e.setRenderTarget(c.map),e.clear());const n=c.getViewport(t);d.set(s.x*n.x,s.y*n.y,s.x*n.z,s.y*n.w),u.viewport(d)}if(l.isPointLight){const e=c.camera,n=c.matrix,i=l.distance||e.far;i!==e.far&&(e.far=i,e.updateProjectionMatrix()),ma.setFromMatrixPosition(l.matrixWorld),e.position.copy(ma),ha.copy(e.position),ha.add(ua[t]),e.up.copy(fa[t]),e.lookAt(ha),e.updateMatrixWorld(),n.makeTranslation(-ma.x,-ma.y,-ma.z),pa.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),c._frustum.setFromProjectionMatrix(pa,e.coordinateSystem,e.reversedDepth)}else c.updateMatrices(l);r=c.getFrustum(),L(n,i,c.camera,l,this.type)}!0!==c.isPointLightShadow&&this.type===le&&C(c,i),c.needsUpdate=!1}R=this.type,A.needsUpdate=!1,e.setRenderTarget(o,l,c)}}function ga(e,t){const i=new function(){let t=!1;const n=new K;let i=null;const r=new K(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},r=new function(){let n=!1,i=!1,r=null,a=null,o=null;return{setReversed:function(e){if(i!==e){const 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),i=e;const r=o;o=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(t){t?X(e.DEPTH_TEST):Y(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=dt[t]),a!==t){switch(t){case nt:e.depthFunc(e.NEVER);break;case tt:e.depthFunc(e.ALWAYS);break;case et:e.depthFunc(e.LESS);break;case De:e.depthFunc(e.LEQUAL);break;case Je:e.depthFunc(e.EQUAL);break;case Qe:e.depthFunc(e.GEQUAL);break;case $e:e.depthFunc(e.GREATER);break;case Ze:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,i&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,r=null,a=null,o=null,i=!1}}},a=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?X(e.STENCIL_TEST):Y(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},o=new WeakMap,s=new WeakMap;let l={},d={},u={},f=new WeakMap,p=[],m=null,h=!1,_=null,g=null,v=null,E=null,S=null,T=null,M=null,x=new n(0,0,0),A=0,R=!1,b=null,C=null,P=null,L=null,U=null;const I=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=!1,y=0;const O=e.getParameter(e.VERSION);-1!==O.indexOf("WebGL")?(y=parseFloat(/^WebGL (\d)/.exec(O)[1]),N=y>=1):-1!==O.indexOf("OpenGL ES")&&(y=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=y>=2);let F=null,B={};const G=e.getParameter(e.SCISSOR_BOX),H=e.getParameter(e.VIEWPORT),V=(new K).fromArray(G),W=(new K).fromArray(H);function k(t,n,i,r){const 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;on||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===h&&(h=E(n,a));const o=t?E(n,a):h;o.width=n,o.height=a;return o.getContext("2d").drawImage(e,0,0,n,a),v("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),o}return"data"in e&&v("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function A(e){return e.generateMipmaps}function R(t){e.generateMipmap(t)}function b(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 C(t,i,r,a,o,s=!1){if(null!==t){if(void 0!==e[t])return e[t];v("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let l;a&&(l=n.get("EXT_texture_norm16"),l||v("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let c=i;if(i===e.RED&&(r===e.FLOAT&&(c=e.R32F),r===e.HALF_FLOAT&&(c=e.R16F),r===e.UNSIGNED_BYTE&&(c=e.R8),r===e.UNSIGNED_SHORT&&l&&(c=l.R16_EXT),r===e.SHORT&&l&&(c=l.R16_SNORM_EXT)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.R8UI),r===e.UNSIGNED_SHORT&&(c=e.R16UI),r===e.UNSIGNED_INT&&(c=e.R32UI),r===e.BYTE&&(c=e.R8I),r===e.SHORT&&(c=e.R16I),r===e.INT&&(c=e.R32I)),i===e.RG&&(r===e.FLOAT&&(c=e.RG32F),r===e.HALF_FLOAT&&(c=e.RG16F),r===e.UNSIGNED_BYTE&&(c=e.RG8),r===e.UNSIGNED_SHORT&&l&&(c=l.RG16_EXT),r===e.SHORT&&l&&(c=l.RG16_SNORM_EXT)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RG8UI),r===e.UNSIGNED_SHORT&&(c=e.RG16UI),r===e.UNSIGNED_INT&&(c=e.RG32UI),r===e.BYTE&&(c=e.RG8I),r===e.SHORT&&(c=e.RG16I),r===e.INT&&(c=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RGB8UI),r===e.UNSIGNED_SHORT&&(c=e.RGB16UI),r===e.UNSIGNED_INT&&(c=e.RGB32UI),r===e.BYTE&&(c=e.RGB8I),r===e.SHORT&&(c=e.RGB16I),r===e.INT&&(c=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(c=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(c=e.RGBA16UI),r===e.UNSIGNED_INT&&(c=e.RGBA32UI),r===e.BYTE&&(c=e.RGBA8I),r===e.SHORT&&(c=e.RGBA16I),r===e.INT&&(c=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_SHORT&&l&&(c=l.RGB16_EXT),r===e.SHORT&&l&&(c=l.RGB16_SNORM_EXT),r===e.UNSIGNED_INT_5_9_9_9_REV&&(c=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(c=e.R11F_G11F_B10F)),i===e.RGBA){const t=s?pe:f.getTransfer(o);r===e.FLOAT&&(c=e.RGBA32F),r===e.HALF_FLOAT&&(c=e.RGBA16F),r===e.UNSIGNED_BYTE&&(c=t===p?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT&&l&&(c=l.RGBA16_EXT),r===e.SHORT&&l&&(c=l.RGBA16_SNORM_EXT),r===e.UNSIGNED_SHORT_4_4_4_4&&(c=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(c=e.RGB5_A1)}return c!==e.R16F&&c!==e.R32F&&c!==e.RG16F&&c!==e.RG32F&&c!==e.RGBA16F&&c!==e.RGBA32F||n.get("EXT_color_buffer_float"),c}function P(t,n){let i;return t?null===n||n===Le||n===Pt?i=e.DEPTH24_STENCIL8:n===T?i=e.DEPTH32F_STENCIL8:n===Lt&&(i=e.DEPTH24_STENCIL8,v("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Le||n===Pt?i=e.DEPTH_COMPONENT24:n===T?i=e.DEPTH_COMPONENT32F:n===Lt&&(i=e.DEPTH_COMPONENT16),i}function L(e,t){return!0===A(e)||e.isFramebufferTexture&&e.minFilter!==Ce&&e.minFilter!==O?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function U(e){const t=e.target;t.removeEventListener("dispose",U),function(e){const t=r.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=_.get(n);if(i){const r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&I(e),0===Object.keys(i).length&&_.delete(n)}r.remove(e)}(t),t.isVideoTexture&&u.delete(t),t.isHTMLTexture&&m.delete(t)}function w(t){const n=t.target;n.removeEventListener("dispose",w),function(t){const n=r.get(t);t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i0&&a.__version!==t.version){const e=t.image;if(null===e)v("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void X(a,t,n);v("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);i.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+n)}const G={[ht]:e.REPEAT,[mt]:e.CLAMP_TO_EDGE,[pt]:e.MIRRORED_REPEAT},H={[Ce]:e.NEAREST,[vt]:e.NEAREST_MIPMAP_NEAREST,[gt]:e.NEAREST_MIPMAP_LINEAR,[O]:e.LINEAR,[_t]:e.LINEAR_MIPMAP_NEAREST,[B]:e.LINEAR_MIPMAP_LINEAR},V={[At]:e.NEVER,[xt]:e.ALWAYS,[Mt]:e.LESS,[ae]:e.LEQUAL,[Tt]:e.EQUAL,[re]:e.GEQUAL,[St]:e.GREATER,[Et]:e.NOTEQUAL};function W(t,i){if(i.type!==T||!1!==n.has("OES_texture_float_linear")||i.magFilter!==O&&i.magFilter!==_t&&i.magFilter!==gt&&i.magFilter!==B&&i.minFilter!==O&&i.minFilter!==_t&&i.minFilter!==gt&&i.minFilter!==B||v("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,G[i.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,G[i.wrapT]),t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY||e.texParameteri(t,e.TEXTURE_WRAP_R,G[i.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,H[i.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,H[i.minFilter]),i.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,V[i.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic")){if(i.magFilter===Ce)return;if(i.minFilter!==gt&&i.minFilter!==B)return;if(i.type===T&&!1===n.has("OES_texture_float_linear"))return;if(i.anisotropy>1||r.get(i).__currentAnisotropy){const o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}}function k(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",U));const r=n.source;let a=_.get(r);void 0===a&&(a={},_.set(r,a));const o=function(e){const t=[];return 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()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&I(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function z(e,t,n){return Math.floor(Math.floor(e/n)/t)}function X(t,n,s){let l=e.TEXTURE_2D;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),n.isData3DTexture&&(l=e.TEXTURE_3D);const c=k(t,n),d=n.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const u=r.get(d);if(d.version!==u.__version||!0===c){i.activeTexture(e.TEXTURE0+s);if(!1===("undefined"!=typeof ImageBitmap&&n.image instanceof ImageBitmap)){const t=f.getPrimaries(f.workingColorSpace),r=n.colorSpace===Rt?null:f.getPrimaries(n.colorSpace),a=n.colorSpace===Rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;i.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),i.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),i.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,a)}i.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment);let t=x(n.image,!1,a.maxTextureSize);t=ee(n,t);const r=o.convert(n.format,n.colorSpace),p=o.convert(n.type);let h,_=C(n.internalFormat,r,p,n.normalized,n.colorSpace,n.isVideoTexture);W(l,n);const g=n.mipmaps,E=!0!==n.isVideoTexture,S=void 0===u.__version||!0===c,T=d.dataReady,b=L(n,t);if(n.isDepthTexture)_=P(n.format===bt,n.type),S&&(E?i.texStorage2D(e.TEXTURE_2D,1,_,t.width,t.height):i.texImage2D(e.TEXTURE_2D,0,_,t.width,t.height,0,r,p,null));else if(n.isDataTexture)if(g.length>0){E&&S&&i.texStorage2D(e.TEXTURE_2D,b,_,g[0].width,g[0].height);for(let t=0,n=g.length;te.start-t.start);let s=0;for(let e=1;e0){const t=Ct(h.width,h.height,n.format,n.type);for(const o of n.layerUpdates){const n=h.data.subarray(o*t/h.data.BYTES_PER_ELEMENT,(o+1)*t/h.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,o,h.width,h.height,1,r,n)}n.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,h.width,h.height,t.depth,r,h.data)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,a,_,h.width,h.height,t.depth,0,h.data,0,0);else v("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?T&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,h.width,h.height,t.depth,r,p,h.data):i.texImage3D(e.TEXTURE_2D_ARRAY,a,_,h.width,h.height,t.depth,0,r,p,h.data)}else{E&&S&&i.texStorage2D(e.TEXTURE_2D,b,_,g[0].width,g[0].height);for(let t=0,a=g.length;t0){const a=Ct(t.width,t.height,n.format,n.type);for(const o of n.layerUpdates){const n=t.data.subarray(o*a/t.data.BYTES_PER_ELEMENT,(o+1)*a/t.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,o,t.width,t.height,1,r,p,n)}n.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,_,t.width,t.height,t.depth,0,r,p,t.data);else if(n.isData3DTexture)E?(S&&i.texStorage3D(e.TEXTURE_3D,b,_,t.width,t.height,t.depth),T&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):i.texImage3D(e.TEXTURE_3D,0,_,t.width,t.height,t.depth,0,r,p,t.data);else if(n.isFramebufferTexture){if(S)if(E)i.texStorage2D(e.TEXTURE_2D,b,_,t.width,t.height);else{let n=t.width,a=t.height;for(let t=0;t>=1,a>>=1}}else if(n.isHTMLTexture){if("texElement2D"in e){const i=e.canvas;if(i.hasAttribute("layoutsubtree")||i.setAttribute("layoutsubtree","true"),t.parentNode!==i)return i.appendChild(t),m.add(n),i.onpaint=e=>{const t=e.changedElements;for(const e of m)t.includes(e.image)&&(e.needsUpdate=!0)},void i.requestPaint();const r=0,a=e.RGBA,o=e.RGBA,s=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,r,a,o,s,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(g.length>0){if(E&&S){const t=te(g[0]);i.texStorage2D(e.TEXTURE_2D,b,_,t.width,t.height)}for(let t=0,n=g.length;t>d),r=Math.max(1,n.height>>d);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?i.texImage3D(c,d,p,t,r,n.depth,0,u,f,null):i.texImage2D(c,d,p,t,r,0,u,f,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),J(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,c,h.__webglTexture,0,Q(n)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,c,h.__webglTexture,d),i.bindFramebuffer(e.FRAMEBUFFER,null)}function Y(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,o=P(n.stencilBuffer,a),s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;J(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Q(n),o,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,Q(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)q(n.__webglFramebuffer[e],t,e);else{const e=t.texture.mipmaps;e&&e.length>0?q(n.__webglFramebuffer[0],t,0):q(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[r]),void 0===n.__webglDepthbuffer[r])n.__webglDepthbuffer[r]=e.createRenderbuffer(),Y(n.__webglDepthbuffer[r],t,!1);else{const i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,a)}}else{const r=t.texture.mipmaps;if(r&&r.length>0?i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),Y(n.__webglDepthbuffer,t,!1);else{const i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,r)}}i.bindFramebuffer(e.FRAMEBUFFER,null)}const Z=[],$=[];function Q(e){return Math.min(a.maxSamples,e.samples)}function J(e){const t=r.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function ee(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==y&&n!==Rt&&(f.getTransfer(n)===p?i===M&&r===S||v("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):D("WebGLTextures: Unsupported texture color space:",n)),t}function te(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(d.width=e.naturalWidth||e.width,d.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(d.width=e.displayWidth,d.height=e.displayHeight):(d.width=e.width,d.height=e.height),d}this.allocateTextureUnit=function(){const e=N;return e>=a.maxTextures&&v("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),N+=1,e},this.resetTextureUnits=function(){N=0},this.getTextureUnits=function(){return N},this.setTextureUnits=function(e){N=e},this.setTexture2D=F,this.setTexture2DArray=function(t,n){const a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?X(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){const a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?X(a,t,n):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,n){const s=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&s.__version!==t.version?function(t,n,s){if(6!==n.image.length)return;const l=k(t,n),c=n.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const d=r.get(c);if(c.version!==d.__version||!0===l){i.activeTexture(e.TEXTURE0+s);const t=f.getPrimaries(f.workingColorSpace),r=n.colorSpace===Rt?null:f.getPrimaries(n.colorSpace),u=n.colorSpace===Rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;i.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),i.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),i.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment),i.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const p=n.isCompressedTexture||n.image[0].isCompressedTexture,m=n.image[0]&&n.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=p||m?m?n.image[e].image:n.image[e]:x(n.image[e],!0,a.maxCubemapSize),h[e]=ee(n,h[e]);const _=h[0],g=o.convert(n.format,n.colorSpace),E=o.convert(n.type),S=C(n.internalFormat,g,E,n.normalized,n.colorSpace),T=!0!==n.isVideoTexture,b=void 0===d.__version||!0===l,P=c.dataReady;let U,D=L(n,_);if(W(e.TEXTURE_CUBE_MAP,n),p){T&&b&&i.texStorage2D(e.TEXTURE_CUBE_MAP,D,S,_.width,_.height);for(let t=0;t<6;t++){U=h[t].mipmaps;for(let r=0;r0&&D++;const t=te(h[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,D,S,t.width,t.height)}for(let t=0;t<6;t++)if(m){T?P&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h[t].width,h[t].height,g,E,h[t].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,h[t].width,h[t].height,0,g,E,h[t].data);for(let n=0;n1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),d){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let i=0;i0){a.__webglFramebuffer=[];for(let t=0;t0&&!1===J(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let i=0;i0)if(!1===J(t)){const n=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,d=r.get(t),u=n.length>1;if(u)for(let t=0;t0?i.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer[0]):i.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer);for(let i=0;i= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new o(new m(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ta extends Rn{constructor(e,n){super();const i=this;let a=null,o=1,s=null,l="local-floor",c=1,d=null,u=null,f=null,p=null,m=null,h=null;const _="undefined"!=typeof XRWebGLBinding,g=new Sa,E={},T=n.getContextAttributes();let x=null,A=null;const R=[],b=[],C=new t;let L=null;const U=new P;U.viewport=new K;const D=new P;D.viewport=new K;const w=[U,D],N=new bn;let y=null,O=null;function F(e){const t=b.indexOf(e.inputSource);if(-1===t)return;const n=R[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){a.removeEventListener("select",F),a.removeEventListener("selectstart",F),a.removeEventListener("selectend",F),a.removeEventListener("squeeze",F),a.removeEventListener("squeezestart",F),a.removeEventListener("squeezeend",F),a.removeEventListener("end",B),a.removeEventListener("inputsourceschange",G);for(let e=0;e=0&&(b[i]=null,R[i].disconnect(n))}for(let t=0;t=b.length){b.push(n),i=e;break}if(null===b[e]){b[e]=n,i=e;break}}if(-1===i)break}const r=R[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getGripSpace()},this.getHand=function(e){let t=R[e];return void 0===t&&(t=new Cn,R[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===i.isPresenting&&v("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===i.isPresenting&&v("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||s},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==p?p:m},this.getBinding=function(){return null===f&&_&&(f=new XRWebGLBinding(a,n)),f},this.getFrame=function(){return h},this.getSession=function(){return a},this.setSession=async function(t){if(a=t,null!==a){x=e.getRenderTarget(),a.addEventListener("select",F),a.addEventListener("selectstart",F),a.addEventListener("selectend",F),a.addEventListener("squeeze",F),a.addEventListener("squeezestart",F),a.addEventListener("squeezeend",F),a.addEventListener("end",B),a.addEventListener("inputsourceschange",G),!0!==T.xrCompatible&&await n.makeXRCompatible(),L=e.getPixelRatio(),e.getSize(C);if(_&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,r=null;T.depth&&(r=T.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=T.stencil?bt:be,i=T.stencil?Pt:Le);const s={colorFormat:n.RGBA8,depthFormat:r,scaleFactor:o};f=this.getBinding(),p=f.createProjectionLayer(s),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),A=new I(p.textureWidth,p.textureHeight,{format:M,type:S,depthTexture:new Y(p.textureWidth,p.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:T.stencil,colorSpace:e.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})}else{const t={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(a,n,t),a.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),A=new I(m.framebufferWidth,m.framebufferHeight,{format:M,type:S,colorSpace:e.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})}A.isXRRenderTarget=!0,this.setFoveation(c),d=null,s=await a.requestReferenceSpace(l),z.setContext(a),z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};const H=new r,V=new r;function W(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===a)return;let t=e.near,n=e.far;null!==g.texture&&(g.depthNear>0&&(t=g.depthNear),g.depthFar>0&&(n=g.depthFar)),N.near=D.near=U.near=t,N.far=D.far=U.far=n,y===N.near&&O===N.far||(a.updateRenderState({depthNear:N.near,depthFar:N.far}),y=N.near,O=N.far),N.layers.mask=6|e.layers.mask,U.layers.mask=-5&N.layers.mask,D.layers.mask=-3&N.layers.mask;const i=e.parent,r=N.cameras;W(N,i);for(let e=0;e0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,o=r.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Ma.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&e.envMapRotation.value.premultiply(xa),e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,_(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isNodeMaterial?r.uniformsNeedUpdate=!1:r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?(i(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(i(e,r),function(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)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){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===c&&e.clearcoatNormalScale.value.negate()));t.dispersion>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=i.texture,e.transmissionSamplerSize.value.set(i.width,i.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))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(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))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,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)}(e,r,a,o):r.isSpriteMaterial?function(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)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ra(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return"number"==typeof r||"boolean"==typeof r?i[a]=r:ArrayBuffer.isView(r)?i[a]=r.slice():i[a]=r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else{if(ArrayBuffer.isView(r))return!0;if(!1===e.equals(r))return e.copy(r),!0}}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(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?v("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):v("WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){const n=t.target;n.removeEventListener("dispose",d);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,u){let f=r[n.id];void 0===f&&(!function(e){const t=e.uniforms;let n=0;const i=16;for(let e=0,r=t.length;e0&&(n+=i-r);e.__size=n,e.__cache={}}(n),f=function(t){const n=function(){for(let e=0;e0),p=!!n.morphAttributes.position,m=!!n.morphAttributes.normal,h=!!n.morphAttributes.color;let _=L;i.toneMapped&&(null!==k&&!0!==k.isXRRenderTarget||(_=F.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,S=Te.get(i),T=U.state.lights;if(!0===se&&(!0===le||e!==X)){const t=e===X&&i.id===z;Ie.setState(i,e,t)}let M=!1;i.version===S.__version?S.needsLights&&S.lightsStateVersion!==T.state.version||S.outputColorSpace!==s||r.isBatchedMesh&&!1===S.batching?M=!0:r.isBatchedMesh||!0!==S.batching?r.isBatchedMesh&&!0===S.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===S.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===S.instancing?M=!0:r.isInstancedMesh||!0!==S.instancing?r.isSkinnedMesh&&!1===S.skinning?M=!0:r.isSkinnedMesh||!0!==S.skinning?r.isInstancedMesh&&!0===S.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===S.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===S.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===S.instancingMorph&&null!==r.morphTexture||S.envMap!==c||!0===i.fog&&S.fog!==a?M=!0:void 0===S.numClippingPlanes||S.numClippingPlanes===Ie.numPlanes&&S.numIntersection===Ie.numIntersection?(S.vertexAlphas!==d||S.vertexTangents!==u||S.morphTargets!==p||S.morphNormals!==m||S.morphColors!==h||S.toneMapping!==_||S.morphTargetsCount!==v)&&(M=!0):M=!0:M=!0:M=!0:M=!0:(M=!0,S.__version=i.version);let x=S.currentProgram;!0===M&&(x=ot(i,t,r),H&&i.isNodeMaterial&&H.onUpdateProgram(i,x,S));let A=!1,R=!1,b=!1;const C=x.getUniforms(),P=S.uniforms;ve.useProgram(x.program)&&(A=!0,R=!0,b=!0);i.id!==z&&(z=i.id,R=!0);if(A||X!==e){ve.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),C.setValue(We,"projectionMatrix",e.projectionMatrix),C.setValue(We,"viewMatrix",e.matrixWorldInverse);const t=C.map.cameraPosition;void 0!==t&&t.setValue(We,de.setFromMatrixPosition(e.matrixWorld)),ge.logarithmicDepthBuffer&&C.setValue(We,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(We,"isOrthographic",!0===e.isOrthographicCamera),X!==e&&(X=e,R=!0,b=!0)}S.needsLights&&(T.state.directionalShadowMap.length>0&&C.setValue(We,"directionalShadowMap",T.state.directionalShadowMap,Me),T.state.spotShadowMap.length>0&&C.setValue(We,"spotShadowMap",T.state.spotShadowMap,Me),T.state.pointShadowMap.length>0&&C.setValue(We,"pointShadowMap",T.state.pointShadowMap,Me));if(r.isSkinnedMesh){C.setOptional(We,r,"bindMatrix"),C.setOptional(We,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),C.setValue(We,"boneTexture",e.boneTexture,Me))}r.isBatchedMesh&&(C.setOptional(We,r,"batchingTexture"),C.setValue(We,"batchingTexture",r._matricesTexture,Me),C.setOptional(We,r,"batchingIdTexture"),C.setValue(We,"batchingIdTexture",r._indirectTexture,Me),C.setOptional(We,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(We,"batchingColorTexture",r._colorsTexture,Me));const D=n.morphAttributes;void 0===D.position&&void 0===D.normal&&void 0===D.color||Oe.update(r,n,x);(R||S.receiveShadow!==r.receiveShadow)&&(S.receiveShadow=r.receiveShadow,C.setValue(We,"receiveShadow",r.receiveShadow));(i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial)&&null===i.envMap&&null!==t.environment&&(P.envMapIntensity.value=t.environmentIntensity);void 0!==P.dfgLUT&&(P.dfgLUT.value=(null===Ca&&(Ca=new Ln(ba,16,16,Se,E),Ca.name="DFG_LUT",Ca.minFilter=O,Ca.magFilter=O,Ca.wrapS=mt,Ca.wrapT=mt,Ca.generateMipmaps=!1,Ca.needsUpdate=!0),Ca));R&&(C.setValue(We,"toneMappingExposure",F.toneMappingExposure),S.needsLights&&(I=b,(w=P).ambientLightColor.needsUpdate=I,w.lightProbe.needsUpdate=I,w.directionalLights.needsUpdate=I,w.directionalLightShadows.needsUpdate=I,w.pointLights.needsUpdate=I,w.pointLightShadows.needsUpdate=I,w.spotLights.needsUpdate=I,w.spotLightShadows.needsUpdate=I,w.rectAreaLights.needsUpdate=I,w.hemisphereLights.needsUpdate=I),a&&!0===i.fog&&Pe.refreshFogUniforms(P,a),Pe.refreshMaterialUniforms(P,i,ee,J,U.state.transmissionRenderTarget[e.id]),Ar.upload(We,st(S),P,Me));var w,I;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ar.upload(We,st(S),P,Me),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&C.setValue(We,"center",r.center);if(C.setValue(We,"modelViewMatrix",r.modelViewMatrix),C.setValue(We,"normalMatrix",r.normalMatrix),C.setValue(We,"modelMatrix",r.matrixWorld),void 0!==i.uniformsGroups){const e=i.uniformsGroups;for(let t=0,n=e.length;t{function n(){i.forEach(function(e){Te.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==_e.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let $e=null;function Qe(){et.stop()}function Je(){et.start()}const et=new On;function tt(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)U.pushLight(e),e.castShadow&&U.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||oe.intersectsSprite(e)){i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ce);const t=be.update(e),r=e.material;r.visible&&P.push(e,t,r,n,ue.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||oe.intersectsObject(e))){const t=be.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ue.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ue.copy(t.boundingSphere.center)),ue.applyMatrix4(e.matrixWorld).applyMatrix4(ce)),Array.isArray(r)){const i=t.groups;for(let a=0,o=i.length;a0&&rt(r,t,n),a.length>0&&rt(a,t,n),o.length>0&&rt(o,t,n),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function it(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===U.state.transmissionRenderTarget[i.id]){const e=_e.has("EXT_color_buffer_half_float")||_e.has("EXT_color_buffer_float");U.state.transmissionRenderTarget[i.id]=new I(1,1,{generateMipmaps:!0,type:e?E:S,minFilter:B,samples:Math.max(4,ge.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:f.workingColorSpace})}const r=U.state.transmissionRenderTarget[i.id],a=i.viewport||Y;r.setSize(a.z*F.transmissionResolutionScale,a.w*F.transmissionResolutionScale);const s=F.getRenderTarget(),l=F.getActiveCubeFace(),d=F.getActiveMipmapLevel();F.setRenderTarget(r),F.getClearColor(Z),$=F.getClearAlpha(),$<1&&F.setClearColor(16777215,.5),F.clear(),pe&&ye.render(n);const u=F.toneMapping;F.toneMapping=L;const p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),U.setupLightsView(i),!0===se&&Ie.setGlobalState(F.clippingPlanes,i),rt(e,n,i),Me.updateMultisampleRenderTarget(r),Me.updateRenderTargetMipmap(r),!1===_e.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r0)for(let t=0,a=r.length;t0&&it(n,i,e,t),pe&&ye.render(e),nt(P,e,t)}null!==k&&0===W&&(Me.updateMultisampleRenderTarget(k),Me.updateRenderTargetMipmap(k)),i&&y.end(F),!0===e.isScene&&e.onAfterRender(F,e,t),He.resetDefaultState(),z=-1,X=null,N.pop(),N.length>0?(U=N[N.length-1],Me.setTextureUnits(U.state.textureUnits),!0===se&&Ie.setGlobalState(F.clippingPlanes,U.state.camera)):U=null,w.pop(),P=w.length>0?w[w.length-1]:null,null!==H&&H.renderEnd()},this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return k},this.setRenderTargetTextures=function(e,t,n){const i=Te.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),Te.get(e.texture).__webglTexture=t,Te.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=Te.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const ct=We.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){k=e,V=t,W=n;let i=null,r=!1,a=!1;if(e){const o=Te.get(e);if(void 0!==o.__useDefaultFramebuffer)return ve.bindFramebuffer(We.FRAMEBUFFER,o.__webglFramebuffer),Y.copy(e.viewport),q.copy(e.scissor),j=e.scissorTest,ve.viewport(Y),ve.scissor(q),ve.setScissorTest(j),void(z=-1);if(void 0===o.__webglFramebuffer)Me.setupRenderTarget(e);else if(o.__hasExternalTextures)Me.rebindTextures(e,Te.get(e.texture).__webglTexture,Te.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&Te.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Me.setupDepthRenderbuffer(e)}}const s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);const l=Te.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],r=!0):i=e.samples>0&&!1===Me.useMultisampledRTT(e)?Te.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,Y.copy(e.viewport),q.copy(e.scissor),j=e.scissorTest}else Y.copy(ie).multiplyScalar(ee).floor(),q.copy(re).multiplyScalar(ee).floor(),j=ae;0!==n&&(i=ct);if(ve.bindFramebuffer(We.FRAMEBUFFER,i)&&ve.drawBuffers(e,i),ve.viewport(Y),ve.scissor(q),ve.setScissorTest(j),r){const i=Te.get(e.texture);We.framebufferTexture2D(We.FRAMEBUFFER,We.COLOR_ATTACHMENT0,We.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=t;for(let t=0;t1&&We.readBuffer(We.COLOR_ATTACHMENT0+s),!ge.textureFormatReadable(l))return void D("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(c))return void D("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&We.readPixels(t,n,i,r,Ge.convert(l),Ge.convert(c),a)}finally{const e=null!==k?Te.get(k).__webglFramebuffer:null;ve.bindFramebuffer(We.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,o,s=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=Te.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(l=l[o]),l){if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){ve.bindFramebuffer(We.FRAMEBUFFER,l);const o=e.textures[s],c=o.format,d=o.type;if(e.textures.length>1&&We.readBuffer(We.COLOR_ATTACHMENT0+s),!ge.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(d))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const u=We.createBuffer();We.bindBuffer(We.PIXEL_PACK_BUFFER,u),We.bufferData(We.PIXEL_PACK_BUFFER,a.byteLength,We.STREAM_READ),We.readPixels(t,n,i,r,Ge.convert(c),Ge.convert(d),0);const f=null!==k?Te.get(k).__webglFramebuffer:null;ve.bindFramebuffer(We.FRAMEBUFFER,f);const p=We.fenceSync(We.SYNC_GPU_COMMANDS_COMPLETE,0);return We.flush(),await yn(We,p,4),We.bindBuffer(We.PIXEL_PACK_BUFFER,u),We.getBufferSubData(We.PIXEL_PACK_BUFFER,0,a),We.deleteBuffer(u),We.deleteSync(p),a}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),o=null!==t?t.x:0,s=null!==t?t.y:0;Me.setTexture2D(e,0),We.copyTexSubImage2D(We.TEXTURE_2D,n,0,0,o,s,r,a),ve.unbindTexture()};const dt=We.createFramebuffer(),ut=We.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,a=0){let o,s,l,c,d,u,f,p,m;const h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(null!==n)o=n.max.x-n.min.x,s=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,d=n.min.y,u=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);o=Math.floor(h.width*t),s=Math.floor(h.height*t),l=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,c=0,d=0,u=0}null!==i?(f=i.x,p=i.y,m=i.z):(f=0,p=0,m=0);const _=Ge.convert(t.format),g=Ge.convert(t.type);let v;t.isData3DTexture?(Me.setTexture3D(t,0),v=We.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Me.setTexture2DArray(t,0),v=We.TEXTURE_2D_ARRAY):(Me.setTexture2D(t,0),v=We.TEXTURE_2D),ve.activeTexture(We.TEXTURE0),ve.pixelStorei(We.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(We.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(We.UNPACK_ALIGNMENT,t.unpackAlignment);const E=ve.getParameter(We.UNPACK_ROW_LENGTH),S=ve.getParameter(We.UNPACK_IMAGE_HEIGHT),T=ve.getParameter(We.UNPACK_SKIP_PIXELS),M=ve.getParameter(We.UNPACK_SKIP_ROWS),x=ve.getParameter(We.UNPACK_SKIP_IMAGES);ve.pixelStorei(We.UNPACK_ROW_LENGTH,h.width),ve.pixelStorei(We.UNPACK_IMAGE_HEIGHT,h.height),ve.pixelStorei(We.UNPACK_SKIP_PIXELS,c),ve.pixelStorei(We.UNPACK_SKIP_ROWS,d),ve.pixelStorei(We.UNPACK_SKIP_IMAGES,u);const A=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=Te.get(e),i=Te.get(t),h=Te.get(n.__renderTarget),_=Te.get(i.__renderTarget);ve.bindFramebuffer(We.READ_FRAMEBUFFER,h.__webglFramebuffer),ve.bindFramebuffer(We.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n} + */ + this._htmlTextures = new Set(); + } /** @@ -73216,6 +73253,8 @@ class WebGPUTextureUtils { if ( textureData.msaaTexture !== undefined ) textureData.msaaTexture.destroy(); + this._htmlTextures.delete( texture ); + backend.delete( texture ); } @@ -73425,6 +73464,41 @@ class WebGPUTextureUtils { this._copyCubeMapToTexture( texture, textureData.texture, textureDescriptorGPU ); + } else if ( texture.isHTMLTexture ) { + + const device = this.backend.device; + const canvas = this.backend.renderer.domElement; + const image = texture.image; + + if ( typeof device.queue.copyElementImageToTexture !== 'function' ) return; + + // Set up paint callback if not already done. + if ( ! textureData.hasPaintCallback ) { + + textureData.hasPaintCallback = true; + + this._addHTMLTexture( texture ); + + // Wait for the browser to paint the element before uploading. + canvas.requestPaint(); + return; + + } + + const width = textureDescriptorGPU.size.width; + const height = textureDescriptorGPU.size.height; + + device.queue.copyElementImageToTexture( + image, width, height, + { texture: textureData.texture } + ); + + if ( texture.flipY ) { + + this._flipY( textureData.texture, textureDescriptorGPU ); + + } + } else { if ( mipmaps.length > 0 ) { @@ -73513,12 +73587,46 @@ class WebGPUTextureUtils { } + /** + * Registers an HTMLTexture for paint updates. + * Sets up a single shared `onpaint` handler on the canvas + * that notifies all registered HTMLTextures. + * + * @private + * @param {HTMLTexture} texture - The HTMLTexture to register. + */ + _addHTMLTexture( texture ) { + + this._htmlTextures.add( texture ); + + const canvas = this.backend.renderer.domElement; + const htmlTextures = this._htmlTextures; + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + } + /** * Frees all internal resources. */ dispose() { this._samplerCache.clear(); + this._htmlTextures.clear(); } diff --git a/build/three.webgpu.min.js b/build/three.webgpu.min.js index b1c7d453ceb20a..07c0799a97f8cf 100644 --- a/build/three.webgpu.min.js +++ b/build/three.webgpu.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -import{Color as e,Vector2 as t,Vector3 as r,Vector4 as s,Matrix2 as i,Matrix3 as n,Matrix4 as a,error as o,EventDispatcher as u,MathUtils as l,warn as d,WebGLCoordinateSystem as c,WebGPUCoordinateSystem as h,ColorManagement as p,SRGBTransfer as g,NoToneMapping as m,StaticDrawUsage as f,InterleavedBufferAttribute as y,InterleavedBuffer as b,DynamicDrawUsage as x,NoColorSpace as T,log as _,warnOnce as v,Texture as N,UnsignedIntType as S,IntType as R,Compatibility as E,LessCompare as A,LessEqualCompare as w,GreaterCompare as C,GreaterEqualCompare as M,NearestFilter as B,Sphere as F,BackSide as L,DoubleSide as P,CubeTexture as D,CubeReflectionMapping as U,CubeRefractionMapping as I,TangentSpaceNormalMap as O,NoNormalPacking as V,NormalRGPacking as k,NormalGAPacking as G,ObjectSpaceNormalMap as z,RGFormat as $,RED_GREEN_RGTC2_Format as W,RG11_EAC_Format as H,InstancedBufferAttribute as q,InstancedInterleavedBuffer as j,DataArrayTexture as X,FloatType as K,FramebufferTexture as Q,LinearMipmapLinearFilter as Y,DepthTexture as Z,Material as J,LineBasicMaterial as ee,LineDashedMaterial as te,NoBlending as re,MeshNormalMaterial as se,SRGBColorSpace as ie,RenderTarget as ne,BoxGeometry as ae,Mesh as oe,Scene as ue,LinearFilter as le,CubeCamera as de,EquirectangularReflectionMapping as ce,EquirectangularRefractionMapping as he,AddOperation as pe,MixOperation as ge,MultiplyOperation as me,MeshBasicMaterial as fe,MeshLambertMaterial as ye,MeshPhongMaterial as be,DataTexture as xe,HalfFloatType as Te,ClampToEdgeWrapping as _e,BufferGeometry as ve,OrthographicCamera as Ne,PerspectiveCamera as Se,LinearSRGBColorSpace as Re,RGBAFormat as Ee,CubeUVReflectionMapping as Ae,BufferAttribute as we,MeshStandardMaterial as Ce,MeshPhysicalMaterial as Me,MeshToonMaterial as Be,MeshMatcapMaterial as Fe,SpriteMaterial as Le,PointsMaterial as Pe,ShadowMaterial as De,Uint32BufferAttribute as Ue,Uint16BufferAttribute as Ie,ByteType as Oe,UnsignedByteType as Ve,ShortType as ke,UnsignedShortType as Ge,AlphaFormat as ze,RedFormat as $e,RedIntegerFormat as We,DepthFormat as He,DepthStencilFormat as qe,RGIntegerFormat as je,RGBFormat as Xe,RGBIntegerFormat as Ke,UnsignedShort4444Type as Qe,UnsignedShort5551Type as Ye,UnsignedInt248Type as Ze,UnsignedInt5999Type as Je,UnsignedInt101111Type as et,NormalBlending as tt,SrcAlphaFactor as rt,OneMinusSrcAlphaFactor as st,AddEquation as it,MaterialBlending as nt,Object3D as at,LinearMipMapLinearFilter as ot,Plane as ut,Float32BufferAttribute as lt,UVMapping as dt,PCFShadowMap as ct,PCFSoftShadowMap as ht,VSMShadowMap as pt,BasicShadowMap as gt,CubeDepthTexture as mt,SphereGeometry as ft,LinearMipmapNearestFilter as yt,NearestMipmapLinearFilter as bt,Float16BufferAttribute as xt,yieldToMain as Tt,REVISION as _t,ArrayCamera as vt,PlaneGeometry as Nt,FrontSide as St,CustomBlending as Rt,ZeroFactor as Et,CylinderGeometry as At,Quaternion as wt,WebXRController as Ct,RAD2DEG as Mt,FrustumArray as Bt,Frustum as Ft,RGBAIntegerFormat as Lt,TimestampQuery as Pt,createCanvasElement as Dt,ReverseSubtractEquation as Ut,SubtractEquation as It,OneMinusDstAlphaFactor as Ot,OneMinusDstColorFactor as Vt,OneMinusSrcColorFactor as kt,DstAlphaFactor as Gt,DstColorFactor as zt,SrcAlphaSaturateFactor as $t,SrcColorFactor as Wt,OneFactor as Ht,CullFaceNone as qt,CullFaceBack as jt,CullFaceFront as Xt,MultiplyBlending as Kt,SubtractiveBlending as Qt,AdditiveBlending as Yt,NotEqualDepth as Zt,GreaterDepth as Jt,GreaterEqualDepth as er,EqualDepth as tr,LessEqualDepth as rr,LessDepth as sr,AlwaysDepth as ir,NeverDepth as nr,ReversedDepthFuncs as ar,RGB_S3TC_DXT1_Format as or,RGBA_S3TC_DXT1_Format as ur,RGBA_S3TC_DXT3_Format as lr,RGBA_S3TC_DXT5_Format as dr,RGB_PVRTC_4BPPV1_Format as cr,RGB_PVRTC_2BPPV1_Format as hr,RGBA_PVRTC_4BPPV1_Format as pr,RGBA_PVRTC_2BPPV1_Format as gr,RGB_ETC1_Format as mr,RGB_ETC2_Format as fr,RGBA_ETC2_EAC_Format as yr,R11_EAC_Format as br,SIGNED_R11_EAC_Format as xr,SIGNED_RG11_EAC_Format as Tr,RGBA_ASTC_4x4_Format as _r,RGBA_ASTC_5x4_Format as vr,RGBA_ASTC_5x5_Format as Nr,RGBA_ASTC_6x5_Format as Sr,RGBA_ASTC_6x6_Format as Rr,RGBA_ASTC_8x5_Format as Er,RGBA_ASTC_8x6_Format as Ar,RGBA_ASTC_8x8_Format as wr,RGBA_ASTC_10x5_Format as Cr,RGBA_ASTC_10x6_Format as Mr,RGBA_ASTC_10x8_Format as Br,RGBA_ASTC_10x10_Format as Fr,RGBA_ASTC_12x10_Format as Lr,RGBA_ASTC_12x12_Format as Pr,RGBA_BPTC_Format as Dr,RED_RGTC1_Format as Ur,SIGNED_RED_RGTC1_Format as Ir,SIGNED_RED_GREEN_RGTC2_Format as Or,MirroredRepeatWrapping as Vr,RepeatWrapping as kr,NearestMipmapNearestFilter as Gr,NotEqualCompare as zr,EqualCompare as $r,AlwaysCompare as Wr,NeverCompare as Hr,LinearTransfer as qr,getByteLength as jr,isTypedArray as Xr,NotEqualStencilFunc as Kr,GreaterStencilFunc as Qr,GreaterEqualStencilFunc as Yr,EqualStencilFunc as Zr,LessEqualStencilFunc as Jr,LessStencilFunc as es,AlwaysStencilFunc as ts,NeverStencilFunc as rs,DecrementWrapStencilOp as ss,IncrementWrapStencilOp as is,DecrementStencilOp as ns,IncrementStencilOp as as,InvertStencilOp as os,ReplaceStencilOp as us,ZeroStencilOp as ls,KeepStencilOp as ds,MaxEquation as cs,MinEquation as hs,SpotLight as ps,PointLight as gs,DirectionalLight as ms,RectAreaLight as fs,AmbientLight as ys,HemisphereLight as bs,LightProbe as xs,LinearToneMapping as Ts,ReinhardToneMapping as _s,CineonToneMapping as vs,ACESFilmicToneMapping as Ns,AgXToneMapping as Ss,NeutralToneMapping as Rs,Group as Es,Loader as As,FileLoader as ws,MaterialLoader as Cs,ObjectLoader as Ms}from"./three.core.min.js";export{AdditiveAnimationBlendMode,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BasicDepthPacking,BatchedMesh,BezierInterpolant,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxHelper,BufferGeometryLoader,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CircleGeometry,Clock,ColorKeyframeTrack,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,Controls,CubeTextureLoader,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceFrontBack,Curve,CurvePath,CustomToneMapping,Cylindrical,Data3DTexture,DataTextureLoader,DataUtils,DefaultLoadingManager,DetachedBindMode,DirectionalLightHelper,DiscreteInterpolant,DodecahedronGeometry,DynamicCopyUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,Euler,ExternalTexture,ExtrudeGeometry,Fog,FogExp2,GLBufferAttribute,GLSL1,GLSL3,GridHelper,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,InstancedBufferGeometry,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,Interpolant,InterpolateBezier,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InterpolationSamplingMode,InterpolationSamplingType,KeyframeTrack,LOD,LatheGeometry,Layers,Light,Line,Line3,LineCurve,LineCurve3,LineLoop,LineSegments,LinearInterpolant,LinearMipMapNearestFilter,LoaderUtils,LoadingManager,LoopOnce,LoopPingPong,LoopRepeat,MOUSE,MeshDepthMaterial,MeshDistanceMaterial,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NormalAnimationBlendMode,NumberKeyframeTrack,OctahedronGeometry,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,Path,PlaneHelper,PointLightHelper,Points,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RGBADepthPacking,RGBDepthPacking,RGB_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGDepthPacking,RawShaderMaterial,Ray,Raycaster,RenderTarget3D,RingGeometry,ShaderMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,Skeleton,SkeletonHelper,SkinnedMesh,Source,Spherical,SphericalHarmonics3,SplineCurve,SpotLightHelper,Sprite,StaticCopyUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,TOUCH,TetrahedronGeometry,TextureLoader,TextureUtils,Timer,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,VectorKeyframeTrack,VideoFrameTexture,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLRenderTarget,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroSlopeEnding,getConsoleFunction,setConsoleFunction}from"./three.core.min.js";const Bs=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Fs=new WeakMap,Ls=new WeakMap,Ps=new WeakMap;class Ds{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=!0===e.object.isSkinnedMesh,this.refreshUniforms=Bs,this.renderId=0}firstInitialization(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}needsVelocity(e){const t=e.getMRT();return null!==t&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(void 0===t){const{geometry:r,object:s}=e;if(t={geometryId:r.id,worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),e.material.transmission>0){const{width:r,height:s}=e.context;t.bufferWidth=r,t.bufferHeight=s}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const r in e){const s=e[r];t[r]={id:s.id,version:s.version}}return t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Ps.get(e);return void 0===t&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Ps.set(e,t)),t}getMaterialData(e){let t=Ls.get(e);if(void 0===t){t={_renderId:-1,_equal:!1};for(const r of this.refreshUniforms){const s=e[r];null!=s&&("object"==typeof s&&void 0!==s.clone?!0===s.isTexture?t[r]={id:s.id,version:s.version}:t[r]=s.clone():t[r]=s)}Ls.set(e,t)}return t}equals(e,t,r){const{object:s,material:i,geometry:n}=e,a=this.getRenderObjectData(e);if(!0!==a.worldMatrix.equals(s.matrixWorld))return a.worldMatrix.copy(s.matrixWorld),!1;const o=this.getMaterialData(e.material);if(o._renderId!==r){o._renderId=r;for(const e in o){const t=o[e],r=i[e];if("_renderId"!==e&&"_equal"!==e)if(void 0!==t.equals){if(!1===t.equals(r))return t.copy(r),o._equal=!1,!1}else if(!0===r.isTexture){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,o._equal=!1,!1}else if(t!==r)return o[e]=r,o._equal=!1,!1}if(o.transmission>0){const{width:t,height:r}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==r)return a.bufferWidth=t,a.bufferHeight=r,o._equal=!1,!1}o._equal=!0}else if(!1===o._equal)return!1;if(a.geometryId!==n.id)return a.geometryId=n.id,!1;const u=this.getGeometryData(e.geometry);if(u._renderId!==r){u._renderId=r;const e=n.attributes,t=u.attributes;let s=0,i=0;for(const t in e)s++;for(const r in t){i++;const s=t[r],n=e[r];if(void 0===n)return delete t[r],u._equal=!1,!1;if(s.id!==n.id||s.version!==n.version)return s.id=n.id,s.version=n.version,u._equal=!1,!1}if(i!==s)return u.attributes=this.getAttributesData(e),u._equal=!1,!1;const a=n.index,o=u.indexId,l=u.indexVersion,d=a?a.id:null,c=a?a.version:null;if(o!==d||l!==c)return u.indexId=d,u.indexVersion=c,u._equal=!1,!1;if(u.drawRange.start!==n.drawRange.start||u.drawRange.count!==n.drawRange.count)return u.drawRange.start=n.drawRange.start,u.drawRange.count=n.drawRange.count,u._equal=!1,!1;u._equal=!0}else if(!1===u._equal)return!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t{const r=e.match(t);if(!r)return null;const s=r[1]||r[2]||"",i=r[3].split("?")[0],n=parseInt(r[4],10),a=parseInt(r[5],10);return{fn:s,file:i.split("/").pop(),line:n,column:a}}).filter(e=>e&&!Us.some(t=>t.test(e.file)))}(e||(new Error).stack)}getLocation(){if(0===this.stack.length)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(0===this.stack.length)return e;return`${e}\n${this.stack.map(e=>{const t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join("\n")}`}}function Os(e,t=0){let r=3735928559^t,s=1103547991^t;if(Array.isArray(e))for(let t,i=0;i>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const Vs=e=>Os(e),ks=e=>Os(e),Gs=(...e)=>Os(e),zs=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),$s=new WeakMap;function Ws(e){return zs.get(e)}function Hs(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function qs(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function js(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Xs(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)||/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Ks(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Qs(o,...u){const l=o?o.slice(-4):void 0;return 1===u.length&&("vec2"===l?u=[u[0],u[0]]:"vec3"===l?u=[u[0],u[0],u[0]]:"vec4"===l&&(u=[u[0],u[0],u[0],u[0]])),"color"===o?new e(...u):"vec2"===l?new t(...u):"vec3"===l?new r(...u):"vec4"===l?new s(...u):"mat2"===l?new i(...u):"mat3"===l?new n(...u):"mat4"===l?new a(...u):"bool"===o?u[0]||!1:"float"===o||"int"===o||"uint"===o?u[0]||0:"string"===o?u[0]||"":"ArrayBuffer"===o?Js(u[0]):null}function Ys(e){let t=$s.get(e);return void 0===t&&(t={},$s.set(e,t)),t}function Zs(e){let t="";const r=new Uint8Array(e);for(let e=0;ee.charCodeAt(0)).buffer}var ei=Object.freeze({__proto__:null,arrayBufferToBase64:Zs,base64ToArrayBuffer:Js,getAlignmentFromType:Xs,getDataFromObject:Ys,getLengthFromType:qs,getMemoryLengthFromType:js,getTypeFromLength:Ws,getTypedArrayFromType:Hs,getValueFromType:Qs,getValueType:Ks,hash:Gs,hashArray:ks,hashString:Vs});const ti={VERTEX:"vertex",FRAGMENT:"fragment"},ri={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},si={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},ii={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},ni=["fragment","vertex"],ai=["setup","analyze","generate"],oi=[...ni,"compute"],ui=["x","y","z","w"],li={analyze:"setup",generate:"analyze"};let di=0;class ci extends u{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=ri.NONE,this.updateBeforeType=ri.NONE,this.updateAfterType=ri.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=di++,this.stackTrace=null,!0===ci.captureStackTrace&&(this.stackTrace=new Is)}set needsUpdate(e){!0===e&&this.version++}get uuid(){return null===this._uuid&&(this._uuid=l.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,ri.FRAME)}onRenderUpdate(e){return this.onUpdate(e,ri.RENDER)}onObjectUpdate(e){return this.onUpdate(e,ri.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const r of Object.getOwnPropertyNames(this)){const s=this[r];if(!0!==r.startsWith("_")&&!e.has(s))if(!0===Array.isArray(s))for(let e=0;e0&&(e.inputNodes=r)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){const s=[];for(const i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if("object"==typeof e.inputNodes[r]){const s={};for(const i in e.inputNodes[r]){const n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{const s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){const{uuid:t,type:r}=this,s=void 0===e||"string"==typeof e;s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];function n(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(void 0===i&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==s&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),s){const t=n(e.textures),r=n(e.images),s=n(e.nodes);t.length>0&&(i.textures=t),r.length>0&&(i.images=r),s.length>0&&(i.nodes=s)}return i}}ci.captureStackTrace=!1;class hi extends ci{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class pi extends ci{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){const t=this.node.getNodeType(e);let r=null;for(const s of this.convertTo.split("|"))null!==r&&e.getTypeLength(t)!==e.getTypeLength(s)||(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}}class gi extends ci{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(void 0!==s.propertyName)return e.format(s.propertyName,r,t);if("void"!==r&&"void"!==t&&this.hasDependencies(e)){const i=super.build(e,r),n=e.getVarFromNode(this,null,r),a=e.getPropertyName(n);return e.addLineFlowCode(`${a} = ${i}`,this),s.snippet=i,s.propertyName=a,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class mi extends gi{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){const r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[];let u=0;for(const t of i){if(u>=s){o(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let i,l=t.getNodeType(e),d=e.getTypeLength(l);u+d>s&&(o(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=s-u,l=e.getTypeFromLength(d)),u+=d,i=t.build(e,l);if(e.getComponentType(l)!==n){const t=e.getTypeFromLength(d,n);i=e.format(i,l,t)}a.push(i)}const l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}}const fi=ui.join("");class yi extends ci{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ui.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const r=this.node,s=e.getTypeLength(r.getNodeType(e));let i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=r.build(e,n);i=this.components.length===s&&this.components===fi.slice(0,this.components.length)?e.format(a,n,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class bi extends gi{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),u=t.build(e,i),l=e.getTypeLength(i),d=[];for(let e=0;e(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");ci.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==Si?Si.assign(this,...e):o("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Is),this;{const t=Ri.get("assign");return this.addToStack(t(...e))}},ci.prototype.toVarIntent=function(){return this},ci.prototype.get=function(e){return new Ni(this,e)};const wi={};function Ci(e,t,r){wi[e]=wi[t]=wi[r]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new yi(this,e),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};const s=e.toUpperCase(),i=t.toUpperCase(),n=r.toUpperCase();ci.prototype["set"+s]=ci.prototype["set"+i]=ci.prototype["set"+n]=function(t){const r=Ai(e);return new bi(this,r,tn(t))},ci.prototype["flip"+s]=ci.prototype["flip"+i]=ci.prototype["flip"+n]=function(){const t=Ai(e);return new xi(this,t)}}const Mi=["x","y","z","w"],Bi=["r","g","b","a"],Fi=["s","t","p","q"];for(let e=0;e<4;e++){let t=Mi[e],r=Bi[e],s=Fi[e];Ci(t,r,s);for(let i=0;i<4;i++){t=Mi[e]+Mi[i],r=Bi[e]+Bi[i],s=Fi[e]+Fi[i],Ci(t,r,s);for(let n=0;n<4;n++){t=Mi[e]+Mi[i]+Mi[n],r=Bi[e]+Bi[i]+Bi[n],s=Fi[e]+Fi[i]+Fi[n],Ci(t,r,s);for(let a=0;a<4;a++)t=Mi[e]+Mi[i]+Mi[n]+Mi[a],r=Bi[e]+Bi[i]+Bi[n]+Bi[a],s=Fi[e]+Fi[i]+Fi[n]+Fi[a],Ci(t,r,s)}}}for(let e=0;e<32;e++)wi[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new hi(this,new vi(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};Object.defineProperties(ci.prototype,wi);const Li=new WeakMap,Pi=function(e,t=null){for(const r in e)e[r]=tn(e[r],t);return e},Di=function(e,t=null){const r=e.length;for(let s=0;su?(o(`TSL: "${r}" parameter length exceeds limit.`,new Is),t.slice(0,u)):t}return null===t?n=(...t)=>i(new e(...nn(d(t)))):null!==r?(r=tn(r),n=(...s)=>i(new e(t,...nn(d(s)),r))):n=(...r)=>i(new e(t,...nn(d(r)))),n.setParameterLength=(...e)=>(1===e.length?a=u=e[0]:2===e.length&&([a,u]=e),n),n.setName=e=>(l=e,n),n},Ii=function(e,...t){return new e(...nn(t))};class Oi extends ci{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:r}=this,s=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||"",n=i||"default";if(s[n])return s[n];const a=e.subBuildFn,o=e.fnCall;e.subBuildFn=i,e.fnCall=this;let u=null;if(t.layout){let s=Li.get(e.constructor);void 0===s&&(s=new WeakMap,Li.set(e.constructor,s));let i=s.get(t);void 0===i&&(i=tn(e.buildFunctionNode(t)),s.set(t,i)),e.addInclude(i);const n=r?function(e){let t;sn(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(r):null;u=tn(i.call(n))}else{const s=new Proxy(e,{get:(e,t,r)=>{let s;return s=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,r),s}}),i=r?function(e){let t=0;return sn(e),new Proxy(e,{get:(r,s,i)=>{let n;if("length"===s)return n=e.length,n;if(Symbol.iterator===s)n=function*(){for(const t of e)yield tn(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const r=e[0];n=void 0===r[s]?r[t++]:Reflect.get(r,s,i)}else e[0]instanceof ci&&(n=void 0===e[s]?e[t++]:Reflect.get(e,s,i));else n=Reflect.get(r,s,i);n=tn(n)}return n}})}(r):null,n=Array.isArray(r)?r.length>0:null!==r,a=t.jsFunc,o=n||a.length>1?a(i,s):a(s);u=tn(o)}return e.subBuildFn=a,e.fnCall=o,t.once&&(s[n]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null;const s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getSubBuildOutput(this),a=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===s){const t=e.getSubBuildProperty("initialized",this);if(!0!==i[t]&&(i[t]=!0,i[n]=this.getOutputNode(e),i[n].build(e),this.shaderNode.subBuilds))for(const t of e.chaining){const r=e.getDataFromNode(t,"any");r.subBuilds=r.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)r.subBuilds.add(e)}r=i[n]}else"analyze"===s?a.build(e,t):"generate"===s&&(r=a.build(e,t)||"");return e.fnCall=o,r}}class Vi extends ci{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Oi(this,e)}setup(){return this.call()}}const ki=[!1,!0],Gi=[0,1,2,3],zi=[-1,-2],$i=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Wi=new Map;for(const e of ki)Wi.set(e,new vi(e));const Hi=new Map;for(const e of Gi)Hi.set(e,new vi(e,"uint"));const qi=new Map([...Hi].map(e=>new vi(e.value,"int")));for(const e of zi)qi.set(e,new vi(e,"int"));const ji=new Map([...qi].map(e=>new vi(e.value)));for(const e of $i)ji.set(e,new vi(e));for(const e of $i)ji.set(-e,new vi(-e));const Xi={bool:Wi,uint:Hi,ints:qi,float:ji},Ki=new Map([...Wi,...ji]),Qi=(e,t)=>Ki.has(e)?Ki.get(e):!0===e.isNode?e:new vi(e,t),Yi=function(e,t=null){return(...r)=>{for(const t of r)if(void 0===t)return o(`TSL: Invalid parameter for the type "${e}".`,new Is),new vi(0,e);if((0===r.length||!["bool","float","int","uint"].includes(e)&&r.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(r=[Qs(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return rn(t.get(r[0]));if(1===r.length){const t=Qi(r[0],e);return t.nodeType===e?rn(t):rn(new pi(t,e))}const s=r.map(e=>Qi(e));return rn(new mi(s,e))}};function Zi(e){return e&&e.isNode&&e.traverse(t=>{t.isConstNode&&(e=t.value)}),Boolean(e)}const Ji=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function en(e,t){return new Vi(e,t)}const tn=(e,t=null)=>function(e,t=null){const r=Ks(e);return"node"===r?e:null===t&&("float"===r||"boolean"===r)||r&&"shader"!==r&&"string"!==r?tn(Qi(e,t)):"shader"===r?e.isFn?e:cn(e):e}(e,t),rn=(e,t=null)=>tn(e,t).toVarIntent(),sn=(e,t=null)=>new Pi(e,t),nn=(e,t=null)=>new Di(e,t),an=(e,t=null,r=null,s=null)=>new Ui(e,t,r,s),on=(e,...t)=>new Ii(e,...t),un=(e,t=null,r=null,s={})=>new Ui(e,t,r,{...s,intent:!0});let ln=0;class dn extends ci{constructor(e,t=null){super();let r=null;null!==t&&("object"==typeof t?r=t.return:("string"==typeof t?r=t:o("TSL: Invalid layout type.",new Is),t=null)),this.shaderNode=new en(e,r),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const r={name:"fn"+ln++,type:t,inputs:[]};for(const t in e)"return"!==t&&r.inputs.push({name:t,type:e[t]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return o('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function cn(e,t=null){const r=new dn(e,t);return new Proxy(()=>{},{apply:(e,t,s)=>r.call(...s),get:(e,t,s)=>Reflect.get(r,t,s),set:(e,t,s,i)=>Reflect.set(r,t,s,i)})}const hn=e=>{Si=e},pn=()=>Si,gn=(...e)=>Si.If(...e);function mn(e){return Si&&Si.addToStack(e),e}Ei("toStack",mn);const fn=new Yi("color"),yn=new Yi("float",Xi.float),bn=new Yi("int",Xi.ints),xn=new Yi("uint",Xi.uint),Tn=new Yi("bool",Xi.bool),_n=new Yi("vec2"),vn=new Yi("ivec2"),Nn=new Yi("uvec2"),Sn=new Yi("bvec2"),Rn=new Yi("vec3"),En=new Yi("ivec3"),An=new Yi("uvec3"),wn=new Yi("bvec3"),Cn=new Yi("vec4"),Mn=new Yi("ivec4"),Bn=new Yi("uvec4"),Fn=new Yi("bvec4"),Ln=new Yi("mat2"),Pn=new Yi("mat3"),Dn=new Yi("mat4");Ei("toColor",fn),Ei("toFloat",yn),Ei("toInt",bn),Ei("toUint",xn),Ei("toBool",Tn),Ei("toVec2",_n),Ei("toIVec2",vn),Ei("toUVec2",Nn),Ei("toBVec2",Sn),Ei("toVec3",Rn),Ei("toIVec3",En),Ei("toUVec3",An),Ei("toBVec3",wn),Ei("toVec4",Cn),Ei("toIVec4",Mn),Ei("toUVec4",Bn),Ei("toBVec4",Fn),Ei("toMat2",Ln),Ei("toMat3",Pn),Ei("toMat4",Dn);const Un=an(hi).setParameterLength(2),In=(e,t)=>new pi(tn(e),t);Ei("element",Un),Ei("convert",In);Ei("append",e=>(d("TSL: .append() has been renamed to .toStack().",new Is),mn(e)));class On extends ci{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return Vs(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Vn=(e,t)=>new On(e,t),kn=(e,t)=>new On(e,t,!0),Gn=on(On,"vec4","DiffuseColor"),zn=on(On,"vec3","DiffuseContribution"),$n=on(On,"vec3","EmissiveColor"),Wn=on(On,"float","Roughness"),Hn=on(On,"float","Metalness"),qn=on(On,"float","Clearcoat"),jn=on(On,"float","ClearcoatRoughness"),Xn=on(On,"vec3","Sheen"),Kn=on(On,"float","SheenRoughness"),Qn=on(On,"float","Iridescence"),Yn=on(On,"float","IridescenceIOR"),Zn=on(On,"float","IridescenceThickness"),Jn=on(On,"float","AlphaT"),ea=on(On,"float","Anisotropy"),ta=on(On,"vec3","AnisotropyT"),ra=on(On,"vec3","AnisotropyB"),sa=on(On,"color","SpecularColor"),ia=on(On,"color","SpecularColorBlended"),na=on(On,"float","SpecularF90"),aa=on(On,"float","Shininess"),oa=on(On,"vec4","Output"),ua=on(On,"float","dashSize"),la=on(On,"float","gapSize"),da=on(On,"float","pointWidth"),ca=on(On,"float","IOR"),ha=on(On,"float","Transmission"),pa=on(On,"float","Thickness"),ga=on(On,"float","AttenuationDistance"),ma=on(On,"color","AttenuationColor"),fa=on(On,"float","Dispersion");class ya extends ci{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1,s=null){super("string"),this.name=e,this.shared=t,this.order=r,this.updateType=s,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const ba=(e,t=1,r=null)=>new ya(e,!1,t,r),xa=(e,t=0,r=null)=>new ya(e,!0,t,r),Ta=xa("frame",0,ri.FRAME),_a=xa("render",0,ri.RENDER),va=ba("object",1,ri.OBJECT);class Na extends Ti{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=va}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const r=e(t,this);void 0!==r&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const r=this.getNodeType(e),s=this.getUniformHash(e);let i=e.getNodeFromHash(s);void 0===i&&(e.setHashNode(this,s),i=this);const n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let u=o;if("bool"===r){const t=e.getDataFromNode(this);let s=t.propertyName;if(void 0===s){const i=e.getVarFromNode(this,null,"bool");s=e.getPropertyName(i),t.propertyName=s,u=e.format(o,n,r),e.addLineFlowCode(`${s} = ${u}`,this)}u=s}return e.format(u,r,t)}}const Sa=(e,t)=>{const r=Ji(t||e);if(r===e&&(e=Qs(r)),e&&!0===e.isNode){let t=e.value;e.traverse(e=>{!0===e.isConstNode&&(t=e.value)}),e=t}return new Na(e,r)};class Ra extends gi{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return null===this.nodeType?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return null===this.nodeType?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const Ea=(...e)=>{let t;if(1===e.length){const r=e[0];t=new Ra(null,r.length,r)}else{const r=e[0],s=e[1];t=new Ra(r,s)}return tn(t)};Ei("toArray",(e,t)=>Ea(Array(t).fill(e)));class Aa extends gi{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const r=e.getTypeLength(t.node.getNodeType(e));return ui.join("").slice(0,r)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:r}=this,s=t.getScope();e.getDataFromNode(s).assign=!0;const i=e.getNodeProperties(this);i.sourceNode=r,i.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.build(e),a=r.getNodeType(e),o=s.build(e,a),u=s.getNodeType(e),l=e.getDataFromNode(this);let d;if(!0===l.initialized)"void"!==t&&(d=n);else if(i){const s=e.getVarFromNode(this,null,a),i=e.getPropertyName(s);e.addLineFlowCode(`${i} = ${o}`,this);const u=r.node,l=u.node.context({assign:!0}).build(e);for(let t=0;t{const s=r.type;let i;return i="pointer"===s?"&"+t.build(e):t.build(e,s),i};if(Array.isArray(i)){if(i.length>s.length)o("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length(t=t.length>1||t[0]&&!0===t[0].isNode?nn(t):sn(t[0]),new Ca(tn(e),t));Ei("call",Ma);const Ba={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Fa extends gi{static get type(){return"OperatorNode"}constructor(e,t,r,...s){if(super(),s.length>0){let i=new Fa(e,t,r);for(let t=0;t>"===r||"<<"===r)return e.getIntegerType(n);if("!"===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r){const t=Math.max(e.getTypeLength(n),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(n)){if("float"===a)return n;if(e.isVector(a))return e.getVectorFromMatrix(n);if(e.isMatrix(a))return n}else if(e.isMatrix(a)){if("float"===n)return a;if(e.isVector(n))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(n)?a:n}generate(e,t){const r=this.op,{aNode:s,bNode:i}=this,n=this.getNodeType(e,t);let a=null,o=null;"void"!==n?(a=s.getNodeType(e),o=i?i.getNodeType(e):null,"<"===r||">"===r||"<="===r||">="===r||"=="===r||"!="===r?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===r||"<<"===r?(a=n,o=e.changeComponentType(o,"uint")):"%"===r?(a=n,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=n):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=n:o=n):a=o=n;const u=s.build(e,a),l=i?i.build(e,o):null,d=e.getFunctionOperator(r);if("void"!==t){const s=e.renderer.coordinateSystem===c;if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r)return s&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${u}, ${l} )`,n,t):e.format(`( ${u} ${r} ${l} )`,n,t);if("%"===r)return e.isInteger(o)?e.format(`( ${u} % ${l} )`,n,t):e.format(`${this.getOperatorMethod(e,n)}( ${u}, ${l} )`,n,t);if("!"===r||"~"===r)return e.format(`(${r}${u})`,a,t);if(d)return e.format(`${d}( ${u}, ${l} )`,n,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${l} ${r} ${u} )`,n,t);if("float"===a&&e.isMatrix(o))return e.format(`${u} ${r} ${l}`,n,t);{let i=`( ${u} ${r} ${l} )`;return!s&&"bool"===n&&e.isVector(a)&&e.isVector(o)&&(i=`all${i}`),e.format(i,n,t)}}if("void"!==a)return d?e.format(`${d}( ${u}, ${l} )`,n,t):e.isMatrix(a)&&"float"===o?e.format(`${l} ${r} ${u}`,n,t):e.format(`${u} ${r} ${l}`,n,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const La=un(Fa,"+").setParameterLength(2,1/0).setName("add"),Pa=un(Fa,"-").setParameterLength(2,1/0).setName("sub"),Da=un(Fa,"*").setParameterLength(2,1/0).setName("mul"),Ua=un(Fa,"/").setParameterLength(2,1/0).setName("div"),Ia=un(Fa,"%").setParameterLength(2).setName("mod"),Oa=un(Fa,"==").setParameterLength(2).setName("equal"),Va=un(Fa,"!=").setParameterLength(2).setName("notEqual"),ka=un(Fa,"<").setParameterLength(2).setName("lessThan"),Ga=un(Fa,">").setParameterLength(2).setName("greaterThan"),za=un(Fa,"<=").setParameterLength(2).setName("lessThanEqual"),$a=un(Fa,">=").setParameterLength(2).setName("greaterThanEqual"),Wa=un(Fa,"&&").setParameterLength(2,1/0).setName("and"),Ha=un(Fa,"||").setParameterLength(2,1/0).setName("or"),qa=un(Fa,"!").setParameterLength(1).setName("not"),ja=un(Fa,"^^").setParameterLength(2).setName("xor"),Xa=un(Fa,"&").setParameterLength(2).setName("bitAnd"),Ka=un(Fa,"~").setParameterLength(1).setName("bitNot"),Qa=un(Fa,"|").setParameterLength(2).setName("bitOr"),Ya=un(Fa,"^").setParameterLength(2).setName("bitXor"),Za=un(Fa,"<<").setParameterLength(2).setName("shiftLeft"),Ja=un(Fa,">>").setParameterLength(2).setName("shiftRight"),eo=cn(([e])=>(e.addAssign(1),e)),to=cn(([e])=>(e.subAssign(1),e)),ro=cn(([e])=>{const t=bn(e).toConst();return e.addAssign(1),t}),so=cn(([e])=>{const t=bn(e).toConst();return e.subAssign(1),t});Ei("add",La),Ei("sub",Pa),Ei("mul",Da),Ei("div",Ua),Ei("mod",Ia),Ei("equal",Oa),Ei("notEqual",Va),Ei("lessThan",ka),Ei("greaterThan",Ga),Ei("lessThanEqual",za),Ei("greaterThanEqual",$a),Ei("and",Wa),Ei("or",Ha),Ei("not",qa),Ei("xor",ja),Ei("bitAnd",Xa),Ei("bitNot",Ka),Ei("bitOr",Qa),Ei("bitXor",Ya),Ei("shiftLeft",Za),Ei("shiftRight",Ja),Ei("incrementBefore",eo),Ei("decrementBefore",to),Ei("increment",ro),Ei("decrement",so);const io=(e,t)=>(d('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new Is),Ia(bn(e),bn(t)));Ei("modInt",io);class no extends gi{static get type(){return"MathNode"}constructor(e,t,r=null,s=null){if(super(),(e===no.MAX||e===no.MIN)&&arguments.length>3){let i=new no(e,t,r);for(let t=2;tn&&i>a?t:n>a?r:a>i?s:t}generateNodeType(e){const t=this.method;return t===no.LENGTH||t===no.DISTANCE||t===no.DOT?"float":t===no.CROSS?"vec3":t===no.ALL||t===no.ANY?"bool":t===no.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:r,method:s}=this;let i=null;if(s===no.ONE_MINUS)i=Pa(1,t);else if(s===no.RECIPROCAL)i=Ua(1,t);else if(s===no.DIFFERENCE)i=Vo(Pa(t,r));else if(s===no.TRANSFORM_DIRECTION){let s=t,n=r;e.isMatrix(s.getNodeType(e))?n=Cn(Rn(n),0):s=Cn(Rn(s),0);const a=Da(s,n).xyz;i=Ro(a)}return null!==i?i:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method;const s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=this.cNode,u=e.renderer.coordinateSystem;if(r===no.NEGATE)return e.format("( - "+n.build(e,i)+" )",s,t);{const l=[];return r===no.CROSS?l.push(n.build(e,s),a.build(e,s)):u===c&&r===no.STEP?l.push(n.build(e,1===e.getTypeLength(n.getNodeType(e))?"float":i),a.build(e,i)):u!==c||r!==no.MIN&&r!==no.MAX?r===no.REFRACT?l.push(n.build(e,i),a.build(e,i),o.build(e,"float")):r===no.MIX?l.push(n.build(e,i),a.build(e,i),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":i)):(u===h&&r===no.ATAN&&null!==a&&(r="atan2"),"fragment"===e.shaderStage||r!==no.DFDX&&r!==no.DFDY||(d(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),l.push(n.build(e,i)),null!==a&&l.push(a.build(e,i)),null!==o&&l.push(o.build(e,i))):l.push(n.build(e,i),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":i)),e.format(`${e.getMethod(r,s)}( ${l.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}no.ALL="all",no.ANY="any",no.RADIANS="radians",no.DEGREES="degrees",no.EXP="exp",no.EXP2="exp2",no.LOG="log",no.LOG2="log2",no.SQRT="sqrt",no.INVERSE_SQRT="inversesqrt",no.FLOOR="floor",no.CEIL="ceil",no.NORMALIZE="normalize",no.FRACT="fract",no.SIN="sin",no.SINH="sinh",no.COS="cos",no.COSH="cosh",no.TAN="tan",no.TANH="tanh",no.ASIN="asin",no.ASINH="asinh",no.ACOS="acos",no.ACOSH="acosh",no.ATAN="atan",no.ATANH="atanh",no.ABS="abs",no.SIGN="sign",no.LENGTH="length",no.NEGATE="negate",no.ONE_MINUS="oneMinus",no.DFDX="dFdx",no.DFDY="dFdy",no.ROUND="round",no.RECIPROCAL="reciprocal",no.TRUNC="trunc",no.FWIDTH="fwidth",no.TRANSPOSE="transpose",no.DETERMINANT="determinant",no.INVERSE="inverse",no.EQUALS="equals",no.MIN="min",no.MAX="max",no.STEP="step",no.REFLECT="reflect",no.DISTANCE="distance",no.DIFFERENCE="difference",no.DOT="dot",no.CROSS="cross",no.POW="pow",no.TRANSFORM_DIRECTION="transformDirection",no.MIX="mix",no.CLAMP="clamp",no.REFRACT="refract",no.SMOOTHSTEP="smoothstep",no.FACEFORWARD="faceforward";const ao=yn(1e-6),oo=yn(1e6),uo=yn(Math.PI),lo=yn(2*Math.PI),co=yn(2*Math.PI),ho=yn(.5*Math.PI),po=un(no,no.ALL).setParameterLength(1),go=un(no,no.ANY).setParameterLength(1),mo=un(no,no.RADIANS).setParameterLength(1),fo=un(no,no.DEGREES).setParameterLength(1),yo=un(no,no.EXP).setParameterLength(1),bo=un(no,no.EXP2).setParameterLength(1),xo=un(no,no.LOG).setParameterLength(1),To=un(no,no.LOG2).setParameterLength(1),_o=un(no,no.SQRT).setParameterLength(1),vo=un(no,no.INVERSE_SQRT).setParameterLength(1),No=un(no,no.FLOOR).setParameterLength(1),So=un(no,no.CEIL).setParameterLength(1),Ro=un(no,no.NORMALIZE).setParameterLength(1),Eo=un(no,no.FRACT).setParameterLength(1),Ao=un(no,no.SIN).setParameterLength(1),wo=un(no,no.SINH).setParameterLength(1),Co=un(no,no.COS).setParameterLength(1),Mo=un(no,no.COSH).setParameterLength(1),Bo=un(no,no.TAN).setParameterLength(1),Fo=un(no,no.TANH).setParameterLength(1),Lo=un(no,no.ASIN).setParameterLength(1),Po=un(no,no.ASINH).setParameterLength(1),Do=un(no,no.ACOS).setParameterLength(1),Uo=un(no,no.ACOSH).setParameterLength(1),Io=un(no,no.ATAN).setParameterLength(1,2),Oo=un(no,no.ATANH).setParameterLength(1),Vo=un(no,no.ABS).setParameterLength(1),ko=un(no,no.SIGN).setParameterLength(1),Go=un(no,no.LENGTH).setParameterLength(1),zo=un(no,no.NEGATE).setParameterLength(1),$o=un(no,no.ONE_MINUS).setParameterLength(1),Wo=un(no,no.DFDX).setParameterLength(1),Ho=un(no,no.DFDY).setParameterLength(1),qo=un(no,no.ROUND).setParameterLength(1),jo=un(no,no.RECIPROCAL).setParameterLength(1),Xo=un(no,no.TRUNC).setParameterLength(1),Ko=un(no,no.FWIDTH).setParameterLength(1),Qo=un(no,no.TRANSPOSE).setParameterLength(1),Yo=un(no,no.DETERMINANT).setParameterLength(1),Zo=un(no,no.INVERSE).setParameterLength(1),Jo=un(no,no.MIN).setParameterLength(2,1/0),eu=un(no,no.MAX).setParameterLength(2,1/0),tu=un(no,no.STEP).setParameterLength(2),ru=un(no,no.REFLECT).setParameterLength(2),su=un(no,no.DISTANCE).setParameterLength(2),iu=un(no,no.DIFFERENCE).setParameterLength(2),nu=un(no,no.DOT).setParameterLength(2),au=un(no,no.CROSS).setParameterLength(2),ou=un(no,no.POW).setParameterLength(2),uu=e=>Da(e,e),lu=e=>Da(e,e,e),du=e=>Da(e,e,e,e),cu=un(no,no.TRANSFORM_DIRECTION).setParameterLength(2),hu=e=>Da(ko(e),ou(Vo(e),1/3)),pu=e=>nu(e,e),gu=un(no,no.MIX).setParameterLength(3),mu=(e,t=0,r=1)=>new no(no.CLAMP,tn(e),tn(t),tn(r)),fu=e=>mu(e),yu=un(no,no.REFRACT).setParameterLength(3),bu=un(no,no.SMOOTHSTEP).setParameterLength(3),xu=un(no,no.FACEFORWARD).setParameterLength(3),Tu=cn(([e])=>{const t=nu(e.xy,_n(12.9898,78.233)),r=Ia(t,uo);return Eo(Ao(r).mul(43758.5453))}),_u=(e,t,r)=>gu(t,r,e),vu=(e,t,r)=>bu(t,r,e),Nu=(e,t)=>tu(t,e),Su=xu,Ru=vo;Ei("all",po),Ei("any",go),Ei("radians",mo),Ei("degrees",fo),Ei("exp",yo),Ei("exp2",bo),Ei("log",xo),Ei("log2",To),Ei("sqrt",_o),Ei("inverseSqrt",vo),Ei("floor",No),Ei("ceil",So),Ei("normalize",Ro),Ei("fract",Eo),Ei("sin",Ao),Ei("sinh",wo),Ei("cos",Co),Ei("cosh",Mo),Ei("tan",Bo),Ei("tanh",Fo),Ei("asin",Lo),Ei("asinh",Po),Ei("acos",Do),Ei("acosh",Uo),Ei("atan",Io),Ei("atanh",Oo),Ei("abs",Vo),Ei("sign",ko),Ei("length",Go),Ei("lengthSq",pu),Ei("negate",zo),Ei("oneMinus",$o),Ei("dFdx",Wo),Ei("dFdy",Ho),Ei("round",qo),Ei("reciprocal",jo),Ei("trunc",Xo),Ei("fwidth",Ko),Ei("min",Jo),Ei("max",eu),Ei("step",Nu),Ei("reflect",ru),Ei("distance",su),Ei("dot",nu),Ei("cross",au),Ei("pow",ou),Ei("pow2",uu),Ei("pow3",lu),Ei("pow4",du),Ei("transformDirection",cu),Ei("mix",_u),Ei("clamp",mu),Ei("refract",yu),Ei("smoothstep",vu),Ei("faceForward",xu),Ei("difference",iu),Ei("saturate",fu),Ei("cbrt",hu),Ei("transpose",Qo),Ei("determinant",Yo),Ei("inverse",Zo),Ei("rand",Tu);class Eu extends ci{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}generateNodeType(e){const{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const s=t.getNodeType(e);if(null!==r){const t=r.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(s))return t}return s}setup(e){const t=this.condNode,r=this.ifNode.isolate(),s=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,null!==s&&(e.getDataFromNode(s).parentNodeBlock=i);const n=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n?r:r.context({nodeBlock:r}),a.elseNode=s?n?s:s.context({nodeBlock:s}):null}generate(e,t){const r=this.getNodeType(e),s=e.getDataFromNode(this);if(void 0!==s.nodeProperty)return s.nodeProperty;const{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,u="void"!==t,l=u?Vn(r).build(e):"";s.nodeProperty=l;const c=i.build(e,"bool");if(e.context.uniformFlow&&null!==a){const s=n.build(e,r),i=a.build(e,r),o=e.getTernary(c,s,i);return e.format(o,r,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=n.build(e,r);if(h&&(u?h=l+" = "+h+";":(h="return "+h+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,r);t&&(u?t=l+" = "+t+";":(t="return "+t+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,r,t)}}const Au=an(Eu).setParameterLength(2,3);Ei("select",Au);class wu extends ci{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{!0===t.isContextNode&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const r=e.addContext(this.value),s=this.node.build(e,t);return e.setContext(r),s}}const Cu=(e=null,t={})=>{let r=e;return null!==r&&!0===r.isNode||(t=r||t,r=null),new wu(r,t)},Mu=e=>Cu(e,{uniformFlow:!0}),Bu=(e,t)=>Cu(e,{nodeName:t});function Fu(e,t,r=null){return Cu(r,{getShadow:({light:r,shadowColorNode:s})=>t===r?s.mul(e):s})}function Lu(e,t=null){return Cu(t,{getAO:(t,{material:r})=>!0===r.transparent?t:null!==t?t.mul(e):e})}function Pu(e,t){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),Bu(e,t)}Ei("context",Cu),Ei("label",Pu),Ei("uniformFlow",Mu),Ei("setName",Bu),Ei("builtinShadowContext",(e,t,r)=>Fu(t,r,e)),Ei("builtinAOContext",(e,t)=>Lu(t,e));class Du extends ci{static get type(){return"VarNode"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return!0!==e.getDataFromNode(this).forceDeclaration&&this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;if(this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&t.fnCall&&t.fnCall.shaderNode){if(t.getDataFromNode(this.node.shaderNode).hasLoop){t.getDataFromNode(this).forceDeclaration=!0,e=!0}}const r=t.getBaseStack();e?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:r,readOnly:s}=this,{renderer:i}=e,n=!0===i.backend.isWebGPUBackend;let a=!1,u=!1;s&&(a=e.isDeterministic(t),u=n?s:a);const l=this.getNodeType(e);if("void"==l){!0!==this.isIntent(e)&&o('TSL: ".toVar()" can not be used with void type.',this.stackTrace);return t.build(e)}const d=e.getVectorType(l),c=t.build(e,d),h=e.getVarFromNode(this,r,d,void 0,u),p=e.getPropertyName(h);let g=p;if(u)if(n)g=a?`const ${p}`:`let ${p}`;else{const r=t.getArrayCount(e);g=`const ${e.getVar(h.type,p,r)}`}return e.addLineFlowCode(`${g} = ${c}`,this),p}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}const Uu=an(Du),Iu=(e,t=null)=>Uu(e,t).toStack(),Ou=(e,t=null)=>Uu(e,t,!0).toStack(),Vu=e=>Uu(e).setIntent(!0).toStack();Ei("toVar",Iu),Ei("toConst",Ou),Ei("toVarIntent",Vu);class ku extends ci{static get type(){return"SubBuild"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const r=this.node.build(e,...t);return e.removeSubBuild(),r}}const Gu=(e,t,r=null)=>new ku(tn(e),t,r);class zu extends ci{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Gu(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let r=t.varying;if(void 0===r){const s=this.name,i=this.getNodeType(e),n=this.interpolationType,a=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,s,i,n,a),t.node=Gu(this.node,"VERTEX")}return r.needsInterpolation||(r.needsInterpolation="fragment"===e.shaderStage),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),r=e.getNodeProperties(this),s=this.setupVarying(e);if(void 0===r[t]){const i=this.getNodeType(e),n=e.getPropertyName(s,ti.VERTEX);e.flowNodeFromShaderStage(ti.VERTEX,r.node,i,n),r[t]=n}return e.getPropertyName(s)}}const $u=an(zu).setParameterLength(1,2),Wu=e=>$u(e);Ei("toVarying",$u),Ei("toVertexStage",Wu);const Hu=cn(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),r=e.mul(.0773993808),s=e.lessThanEqual(.04045);return gu(t,r,s)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qu=cn(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),s=e.lessThanEqual(.0031308);return gu(t,r,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),ju="WorkingColorSpace";class Xu extends gi{static get type(){return"ColorSpaceNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===ju?p.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),s=this.resolveColorSpace(e,this.target);let i=t;return!1!==p.enabled&&r!==s&&r&&s?(p.getTransfer(r)===g&&(i=Cn(Hu(i.rgb),i.a)),p.getPrimaries(r)!==p.getPrimaries(s)&&(i=Cn(Pn(p._getMatrix(new n,r,s)).mul(i.rgb),i.a)),p.getTransfer(s)===g&&(i=Cn(qu(i.rgb),i.a)),i):i}}const Ku=(e,t)=>new Xu(tn(e),ju,t),Qu=(e,t)=>new Xu(tn(e),t,ju);Ei("workingToColorSpace",Ku),Ei("colorSpaceToWorking",Qu);let Yu=class extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(),s=this.getNodeType();return e.format(t,r,s)}};class Zu extends ci{static get type(){return"ReferenceBaseNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.updateType=ri.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Yu(this,tn(e))}setNodeType(e){const t=Sa(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Ju(e,t,r);class tl extends gi{static get type(){return"ToneMappingNode"}constructor(e,t=sl,r=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return Gs(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,r=this._toneMapping;if(r===m)return t;let s=null;const i=e.renderer.library.getToneMappingFunction(r);return null!==i?s=Cn(i(t.rgb,this.exposureNode),t.a):(o("ToneMappingNode: Unsupported Tone Mapping configuration.",r),s=t),s}}const rl=(e,t,r)=>new tl(e,tn(t),tn(r)),sl=el("toneMappingExposure","float");Ei("toneMapping",(e,t,r)=>rl(t,r,e));const il=new WeakMap;function nl(e,t){let r=il.get(e);return void 0===r&&(r=new b(e,t),il.set(e,r)),r}class al extends Ti{static get type(){return"BufferAttributeNode"}constructor(e,t=null,r=0,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=s,this.usage=f,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(0===this.bufferStride&&0===this.bufferOffset){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}generateNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),r=e.getTypeLength(t),s=this.value,i=this.bufferStride||r,n=this.bufferOffset;let a;a=!0===s.isInterleavedBuffer?s:!0===s.isBufferAttribute?nl(s.array,i):nl(s,i);const o=new y(a,r,n);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),r=e.getBufferAttributeFromNode(this,t),s=e.getPropertyName(r);let i=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=s,i=s;else{i=$u(this).build(e,t)}return i}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function ol(e,t=null,r=0,s=0,i=f,n=!1){return"mat3"===t||null===t&&9===e.itemSize?Pn(new al(e,"vec3",9,0).setUsage(i).setInstanced(n),new al(e,"vec3",9,3).setUsage(i).setInstanced(n),new al(e,"vec3",9,6).setUsage(i).setInstanced(n)):"mat4"===t||null===t&&16===e.itemSize?Dn(new al(e,"vec4",16,0).setUsage(i).setInstanced(n),new al(e,"vec4",16,4).setUsage(i).setInstanced(n),new al(e,"vec4",16,8).setUsage(i).setInstanced(n),new al(e,"vec4",16,12).setUsage(i).setInstanced(n)):new al(e,t,r,s).setUsage(i)}const ul=(e,t=null,r=0,s=0)=>ol(e,t,r,s),ll=(e,t=null,r=0,s=0)=>ol(e,t,r,s,f,!0),dl=(e,t=null,r=0,s=0)=>ol(e,t,r,s,x,!0);Ei("toAttribute",e=>ul(e.value));class cl extends ci{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),r=this.scope;let s,i;if(r===cl.VERTEX)s=e.getVertexIndex();else if(r===cl.INSTANCE)s=e.getInstanceIndex();else if(r===cl.DRAW)s=e.getDrawIndex();else if(r===cl.INVOCATION_LOCAL)s=e.getInvocationLocalIndex();else if(r===cl.INVOCATION_SUBGROUP)s=e.getInvocationSubgroupIndex();else{if(r!==cl.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+r);s=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)i=s;else{i=$u(this).build(e,t)}return i}}cl.VERTEX="vertex",cl.INSTANCE="instance",cl.SUBGROUP="subgroup",cl.INVOCATION_LOCAL="invocationLocal",cl.INVOCATION_SUBGROUP="invocationSubgroup",cl.DRAW="draw";const hl=on(cl,cl.VERTEX),pl=on(cl,cl.INSTANCE),gl=on(cl,cl.SUBGROUP),ml=on(cl,cl.INVOCATION_SUBGROUP),fl=on(cl,cl.INVOCATION_LOCAL),yl=on(cl,cl.DRAW);class bl extends ci{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=ri.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){null!==this.count&&null===this.countNode&&(this.countNode=Sa(this.count,"uint").onObjectUpdate(()=>this.count));const t=this.computeNode.build(e);if(t){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:r}=e;if("compute"===r){const t=this.computeNode.build(e,"void");if(""!==t&&e.addLineFlowCode(t,this),null!==this.count&&!0===e.allowEarlyReturns){const t=this.countNode.build(e,"uint"),r=pl.build(e,"uint");e.flow.code=`${e.tab}if ( ${r} >= ${t} ) { return; }\n\n${e.flow.code}`}}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const xl=(e,t=[64])=>{(0===t.length||t.length>3)&&o("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Is);for(let e=0;e{const s=xl(e,r);return"number"==typeof t?s.count=t:s.dispatchSize=t,s};Ei("compute",Tl),Ei("computeKernel",xl);class _l extends ci{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){const t=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.getNodeType(e);return e.setCache(t),s}build(e,...t){const r=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const i=this.node.build(e,...t);return e.setCache(r),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const vl=e=>new _l(tn(e));function Nl(e,t=!0){return d('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),vl(e).setParent(t)}Ei("cache",Nl),Ei("isolate",vl);class Sl extends ci{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Rl=an(Sl).setParameterLength(2);Ei("bypass",Rl);const El=cn(([e,t,r,s=yn(0),i=yn(1),n=Tn(!1)])=>{let a=e.sub(t).div(r.sub(t));return Zi(n)&&(a=a.clamp()),a.mul(i.sub(s)).add(s)});function Al(e,t,r,s=yn(0),i=yn(1)){return El(e,t,r,s,i,!0)}Ei("remap",El),Ei("remapClamp",Al);class wl extends ci{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const r=this.getNodeType(e),s=this.snippet;if("void"!==r)return e.format(s,r,t);e.addLineFlowCode(s,this)}}const Cl=an(wl).setParameterLength(1,2),Ml=e=>(e?Au(e,Cl("discard")):Cl("discard")).toStack();Ei("discard",Ml);class Bl extends gi{static get type(){return"RenderOutputNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const r=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||m,s=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||T;return r!==m&&(t=t.toneMapping(r)),s!==T&&s!==p.workingColorSpace&&(t=t.workingToColorSpace(s)),t}}const Fl=(e,t=null,r=null)=>new Bl(tn(e),t,r);Ei("renderOutput",Fl);class Ll extends gi{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,r=this.node.build(e);if(null!==t)t(e,r);else{const t="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(t.length);let i="";i+="// #"+t+"#\n",i+=e.flow.code.replace(/^\t/gm,"")+"\n",i+="/* ... */ "+r+" /* ... */\n",i+="// #"+s+"#\n",_(i)}return r}}const Pl=(e,t=null)=>new Ll(tn(e),t).toStack();Ei("debug",Pl);class Dl extends u{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class Ul extends ci{static get type(){return"InspectorNode"}constructor(e,t="",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=ri.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==Dl&&v('TSL: ".toInspector()" is only available with WebGPU.'),t}}function Il(e,t="",r=null){return(e=tn(e)).before(new Ul(e,t,r))}Ei("toInspector",Il);class Ol extends ci{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(null===t){const r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){const s=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(s)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),r=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const s=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(s),n=e.getAttribute(t,i);if("vertex"===e.shaderStage)return e.format(n.name,i,r);return $u(this).build(e,r)}return d(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(r)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Vl=(e,t=null)=>new Ol(e,t),kl=(e=0)=>Vl("uv"+(e>0?e:""),"vec2");class Gl extends ci{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const r=this.textureNode.build(e,"property"),s=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${r}, ${s} )`,this.getNodeType(e),t)}}const zl=an(Gl).setParameterLength(1,2);class $l extends Na{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=ri.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&void 0!==r.width){const{width:e,height:t}=r;this.value=Math.log2(Math.max(e,t))}}}const Wl=an($l).setParameterLength(1);class Hl extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const ql=new N;class jl extends Na{static get type(){return"TextureNode"}constructor(e=ql,t=null,r=null,s=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=s,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=ri.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===S?"uvec4":this.value.type===R?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return kl(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=Sa(this.value.matrix)),this._matrixUniform.mul(Rn(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=Sa(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(bn(zl(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const r=this.value;if(!r||!0!==r.isTexture)throw new Hl("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const s=cn(()=>{let t=this.uvNode;return null!==t&&!0!==e.context.forceUVContext||!e.context.getUV||(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?ri.OBJECT:ri.NONE,t})();let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this));let n=null,a=null;if(null!==this.compareNode)if(e.renderer.hasCompatibility(E.TEXTURE_COMPARE))n=this.compareNode;else{const e=r.compareFunction;null===e||e===A||e===w||e===C||e===M?a=this.compareNode:(n=this.compareNode,v('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=s,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=n,t.compareStepNode=a,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;let d;return d=i?e.generateTextureBias(l,t,r,i,n,u):o?e.generateTextureGrad(l,t,r,o,n,u):a?e.generateTextureCompare(l,t,r,a,n,u):!1===this.sampler?e.generateTextureLoad(l,t,r,s,n,u):s?e.generateTextureLevel(l,t,r,s,n,u):e.generateTexture(l,t,r,n,u),d}generate(e,t){const r=this.value,s=e.getNodeProperties(this),i=super.generate(e,"property");if(/^sampler/.test(t))return i+"_sampler";if(e.isReference(t))return i;{const n=e.getDataFromNode(this),a=this.getNodeType(e);let o=n.propertyName;if(void 0===o){const{uvNode:t,levelNode:u,biasNode:l,compareNode:d,compareStepNode:c,depthNode:h,gradNode:p,offsetNode:g}=s,m=this.generateUV(e,t),f=u?u.build(e,"float"):null,y=l?l.build(e,"float"):null,b=h?h.build(e,"int"):null,x=d?d.build(e,"float"):null,T=c?c.build(e,"float"):null,_=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,v=g?this.generateOffset(e,g):null;let N=b;null===N&&r.isArrayTexture&&!0!==this.isTexture3DNode&&(N="0");const S=e.getVarFromNode(this);o=e.getPropertyName(S);let R=this.generateSnippet(e,i,m,f,y,N,x,_,v);if(null!==T){const t=r.compareFunction;R=t===C||t===M?tu(Cl(R,a),Cl(T,"float")).build(e,a):tu(Cl(T,"float"),Cl(R,a)).build(e,a)}e.addLineFlowCode(`${o} = ${R}`,this),n.snippet=R,n.propertyName=o}let u=o;return e.needsToWorkingColorSpace(r)&&(u=Qu(Cl(u,a),r.colorSpace).setup(e).build(e,a)),e.format(u,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=tn(e),t.referenceNode=this.getBase(),tn(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=tn(e).mul(Wl(t)),t.referenceNode=this.getBase();const r=t.value;return!1===t.generateMipmaps&&(r&&!1===r.generateMipmaps||r.minFilter===B||r.magFilter===B)&&(d("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),tn(t)}level(e){const t=this.clone();return t.levelNode=tn(e),t.referenceNode=this.getBase(),tn(t)}size(e){return zl(this,e)}bias(e){const t=this.clone();return t.biasNode=tn(e),t.referenceNode=this.getBase(),tn(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=tn(e),t.referenceNode=this.getBase(),tn(t)}grad(e,t){const r=this.clone();return r.gradNode=[tn(e),tn(t)],r.referenceNode=this.getBase(),tn(r)}depth(e){const t=this.clone();return t.depthNode=tn(e),t.referenceNode=this.getBase(),tn(t)}offset(e){const t=this.clone();return t.offsetNode=tn(e),t.referenceNode=this.getBase(),tn(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();const r=this._flipYUniform;null!==r&&(r.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const Xl=an(jl).setParameterLength(1,4).setName("texture"),Kl=(e=ql,t=null,r=null,s=null)=>{let i;return e&&!0===e.isTextureNode?(i=tn(e.clone()),i.referenceNode=e.getBase(),null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=Xl(e,t,r,s),i},Ql=(...e)=>Kl(...e).setSampler(!1);class Yl extends Na{static get type(){return"BufferNode"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Zl=(e,t,r)=>new Yl(e,t,r);class Jl extends hi{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),r=this.getNodeType(e),s=this.node.getPaddedType();return e.format(t,s,r)}}class ed extends Yl{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?Ks(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=ri.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,r=this.elementType;if("float"===r||"int"===r||"uint"===r)for(let r=0;rnew ed(e,t);class rd extends ci{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const sd=an(rd).setParameterLength(1);let id,nd;class ad extends ci{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===ad.DPR?"float":this.scope===ad.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=ri.NONE;return this.scope!==ad.SIZE&&this.scope!==ad.VIEWPORT&&this.scope!==ad.DPR||(e=ri.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ad.VIEWPORT?null!==t?nd.copy(t.viewport):(e.getViewport(nd),nd.multiplyScalar(e.getPixelRatio())):this.scope===ad.DPR?this._output.value=e.getPixelRatio():null!==t?(id.width=t.width,id.height=t.height):e.getDrawingBufferSize(id)}setup(){const e=this.scope;let r=null;return r=e===ad.SIZE?Sa(id||(id=new t)):e===ad.VIEWPORT?Sa(nd||(nd=new s)):e===ad.DPR?Sa(1):_n(dd.div(ld)),this._output=r,r}generate(e){if(this.scope===ad.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const r=e.getNodeProperties(ld).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${r}.y - ${t}.y )`}return t}return super.generate(e)}}ad.COORDINATE="coordinate",ad.VIEWPORT="viewport",ad.SIZE="size",ad.UV="uv",ad.DPR="dpr";const od=on(ad,ad.DPR),ud=on(ad,ad.UV),ld=on(ad,ad.SIZE),dd=on(ad,ad.COORDINATE),cd=on(ad,ad.VIEWPORT),hd=cd.zw,pd=dd.sub(cd.xy),gd=pd.div(hd),md=cn(()=>(d('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Is),ld),"vec2").once()();let fd=null,yd=null,bd=null,xd=null,Td=null,_d=null,vd=null,Nd=null,Sd=null,Rd=null,Ed=null,Ad=null,wd=null,Cd=null;const Md=Sa(0,"uint").setName("u_cameraIndex").setGroup(xa("cameraIndex")).toVarying("v_cameraIndex"),Bd=Sa("float").setName("cameraNear").setGroup(_a).onRenderUpdate(({camera:e})=>e.near),Fd=Sa("float").setName("cameraFar").setGroup(_a).onRenderUpdate(({camera:e})=>e.far),Ld=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrix);null===yd?yd=td(r).setGroup(_a).setName("cameraProjectionMatrices"):yd.array=r,t=yd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrix")}else null===fd&&(fd=Sa(e.projectionMatrix).setName("cameraProjectionMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=fd;return t}).once()(),Pd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrixInverse);null===xd?xd=td(r).setGroup(_a).setName("cameraProjectionMatricesInverse"):xd.array=r,t=xd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrixInverse")}else null===bd&&(bd=Sa(e.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=bd;return t}).once()(),Dd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorldInverse);null===_d?_d=td(r).setGroup(_a).setName("cameraViewMatrices"):_d.array=r,t=_d.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraViewMatrix")}else null===Td&&(Td=Sa(e.matrixWorldInverse).setName("cameraViewMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=Td;return t}).once()(),Ud=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorld);null===Nd?Nd=td(r).setGroup(_a).setName("cameraWorldMatrices"):Nd.array=r,t=Nd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraWorldMatrix")}else null===vd&&(vd=Sa(e.matrixWorld).setName("cameraWorldMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=vd;return t}).once()(),Id=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.normalMatrix);null===Rd?Rd=td(r).setGroup(_a).setName("cameraNormalMatrices"):Rd.array=r,t=Rd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraNormalMatrix")}else null===Sd&&(Sd=Sa(e.normalMatrix).setName("cameraNormalMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=Sd;return t}).once()(),Od=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const s=[];for(let t=0,i=e.cameras.length;t{const r=e.cameras,s=t.array;for(let e=0,t=r.length;et.value.setFromMatrixPosition(e.matrixWorld))),t=Ed;return t}).once()(),Vd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.viewport);null===Cd?Cd=td(r,"vec4").setGroup(_a).setName("cameraViewports"):Cd.array=r,t=Cd.element(Md).toConst("cameraViewport")}else null===wd&&(wd=Cn(0,0,ld.x,ld.y).toConst("cameraViewport")),t=wd;return t}).once()(),kd=new F;class Gd extends ci{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=ri.OBJECT,this.uniformNode=new Na(null)}generateNodeType(){const e=this.scope;return e===Gd.WORLD_MATRIX?"mat4":e===Gd.POSITION||e===Gd.VIEW_POSITION||e===Gd.DIRECTION||e===Gd.SCALE?"vec3":e===Gd.RADIUS?"float":void 0}update(e){const t=this.object3d,s=this.uniformNode,i=this.scope;if(i===Gd.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===Gd.POSITION)s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===Gd.SCALE)s.value=s.value||new r,s.value.setFromMatrixScale(t.matrixWorld);else if(i===Gd.DIRECTION)s.value=s.value||new r,t.getWorldDirection(s.value);else if(i===Gd.VIEW_POSITION){const i=e.camera;s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(i.matrixWorldInverse)}else if(i===Gd.RADIUS){const r=e.object.geometry;null===r.boundingSphere&&r.computeBoundingSphere(),kd.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),s.value=kd.radius}}generate(e){const t=this.scope;return t===Gd.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===Gd.POSITION||t===Gd.VIEW_POSITION||t===Gd.DIRECTION||t===Gd.SCALE?this.uniformNode.nodeType="vec3":t===Gd.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Gd.WORLD_MATRIX="worldMatrix",Gd.POSITION="position",Gd.SCALE="scale",Gd.VIEW_POSITION="viewPosition",Gd.DIRECTION="direction",Gd.RADIUS="radius";const zd=an(Gd,Gd.DIRECTION).setParameterLength(1),$d=an(Gd,Gd.WORLD_MATRIX).setParameterLength(1),Wd=an(Gd,Gd.POSITION).setParameterLength(1),Hd=an(Gd,Gd.SCALE).setParameterLength(1),qd=an(Gd,Gd.VIEW_POSITION).setParameterLength(1),jd=an(Gd,Gd.RADIUS).setParameterLength(1);class Xd extends Gd{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const Kd=on(Xd,Xd.DIRECTION),Qd=on(Xd,Xd.WORLD_MATRIX),Yd=on(Xd,Xd.POSITION),Zd=on(Xd,Xd.SCALE),Jd=on(Xd,Xd.VIEW_POSITION),ec=on(Xd,Xd.RADIUS),tc=Sa(new n).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),rc=Sa(new a).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),sc=cn(e=>e.context.modelViewMatrix||ic).once()().toVar("modelViewMatrix"),ic=Dd.mul(Qd),nc=cn(e=>(e.context.isHighPrecisionModelViewMatrix=!0,Sa("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),ac=cn(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return Sa("mat3").onObjectUpdate(({object:e,camera:r})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),oc=cn(e=>"fragment"!==e.shaderStage?(v("TSL: `clipSpace` is only available in fragment stage."),Cn()):e.context.clipSpace.toVarying("v_clipSpace")).once()(),uc=Vl("position","vec3"),lc=uc.toVarying("positionLocal"),dc=uc.toVarying("positionPrevious"),cc=cn(e=>Qd.mul(lc).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),hc=cn(()=>lc.transformDirection(Qd).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),pc=cn(e=>{if("fragment"===e.shaderStage&&e.material.vertexNode){const e=Pd.mul(oc);return e.xyz.div(e.w).toVar("positionView")}return e.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),gc=cn(e=>{let t;return t=e.camera.isOrthographicCamera?Rn(0,0,1):pc.negate().toVarying("v_positionViewDirection").normalize(),t.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class mc extends ci{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return t.side===L?"false":e.getFrontFacing()}}const fc=on(mc),yc=yn(fc).mul(2).sub(1),bc=cn(([e],{material:t})=>{const r=t.side;return r===L?e=e.mul(-1):r===P&&(e=e.mul(yc)),e}),xc=Vl("normal","vec3"),Tc=cn(e=>!1===e.geometry.hasAttribute("normal")?(d('TSL: Vertex attribute "normal" not found on geometry.'),Rn(0,1,0)):xc,"vec3").once()().toVar("normalLocal"),_c=pc.dFdx().cross(pc.dFdy()).normalize().toVar("normalFlat"),vc=cn(e=>{let t;return t=e.isFlatShading()?_c:wc(Tc).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),Nc=cn(e=>{let t=vc.transformDirection(Dd);return!0!==e.isFlatShading()&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),Sc=cn(e=>{let t;return"NORMAL"===e.subBuildFn||"VERTEX"===e.subBuildFn?(t=vc,!0!==e.isFlatShading()&&(t=bc(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Rc=Sc.transformDirection(Dd).toVar("normalWorld"),Ec=cn(({subBuildFn:e,context:t})=>{let r;return r="NORMAL"===e||"VERTEX"===e?Sc:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),r},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Ac=cn(([e,t=Qd])=>{const r=Pn(t),s=e.div(Rn(r[0].dot(r[0]),r[1].dot(r[1]),r[2].dot(r[2])));return r.mul(s).xyz}),wc=cn(([e],t)=>{const r=t.context.modelNormalViewMatrix;if(r)return r.transformDirection(e);const s=tc.mul(e);return Dd.transformDirection(s)}),Cc=cn(()=>(d('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),Sc)).once(["NORMAL","VERTEX"])(),Mc=cn(()=>(d('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Rc)).once(["NORMAL","VERTEX"])(),Bc=cn(()=>(d('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Ec)).once(["NORMAL","VERTEX"])(),Fc=new a,Lc=Sa(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),Pc=Sa(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),Dc=Sa(new a).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const r=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return r?Fc.makeRotationFromEuler(r).transpose():Fc.identity(),Fc}),Uc=gc.negate().reflect(Sc),Ic=gc.negate().refract(Sc,Lc),Oc=Uc.transformDirection(Dd).toVar("reflectVector"),Vc=Ic.transformDirection(Dd).toVar("reflectVector"),kc=new D;class Gc extends jl{static get type(){return"CubeTextureNode"}constructor(e,t=null,r=null,s=null){super(e,t,r,s),this.isCubeTextureNode=!0}getInputType(){return!0===this.value.isDepthTexture?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===U?Oc:e.mapping===I?Vc:(o('CubeTextureNode: Mapping "%s" not supported.',e.mapping),Rn(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const r=this.value;return!0===r.isDepthTexture?e.renderer.coordinateSystem===h?Rn(t.x,t.y.negate(),t.z):t:(t=Dc.mul(t),e.renderer.coordinateSystem!==h&&r.isRenderTargetTexture||(t=Rn(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}const zc=an(Gc).setParameterLength(1,4).setName("cubeTexture"),$c=(e=kc,t=null,r=null,s=null)=>{let i;return e&&!0===e.isCubeTextureNode?(i=tn(e.clone()),i.referenceNode=e,null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=zc(e,t,r,s),i};class Wc extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(e),s=this.getNodeType(e);return e.format(t,r,s)}}class Hc extends ci{static get type(){return"ReferenceNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=ri.OBJECT}element(e){return new Wc(this,tn(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?Zl(null,e,this.count):Array.isArray(this.getValueFromReference())?td(null,e):"texture"===e?Kl(null):"cubeTexture"===e?$c(null):Sa(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Hc(e,t,r),jc=(e,t,r,s)=>new Hc(e,t,s,r);class Xc extends Hc{static get type(){return"MaterialReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const Kc=(e,t,r=null)=>new Xc(e,t,r),Qc=kl(),Yc=pc.dFdx(),Zc=pc.dFdy(),Jc=Qc.dFdx(),eh=Qc.dFdy(),th=Sc,rh=Zc.cross(th),sh=th.cross(Yc),ih=rh.mul(Jc.x).add(sh.mul(eh.x)),nh=rh.mul(Jc.y).add(sh.mul(eh.y)),ah=ih.dot(ih).max(nh.dot(nh)),oh=ah.equal(0).select(0,ah.inverseSqrt()),uh=ih.mul(oh).toVar("tangentViewFrame"),lh=nh.mul(oh).toVar("bitangentViewFrame"),dh=Vl("tangent","vec4"),ch=dh.xyz.toVar("tangentLocal"),hh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?sc.mul(Cn(ch,0)).xyz.toVarying("v_tangentView").normalize():uh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),ph=hh.transformDirection(Dd).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),gh=cn(([e,t],r)=>{let s=e.mul(dh.w).xyz;return"NORMAL"===r.subBuildFn&&!0!==r.isFlatShading()&&(s=s.toVarying(t)),s}).once(["NORMAL"]),mh=gh(xc.cross(dh),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),fh=gh(Tc.cross(ch),"v_bitangentLocal").normalize().toVar("bitangentLocal"),yh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?gh(Sc.cross(hh),"v_bitangentView").normalize():lh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),bh=gh(Rc.cross(ph),"v_bitangentWorld").normalize().toVar("bitangentWorld"),xh=Pn(hh,yh,Sc).toVar("TBNViewMatrix"),Th=gc.mul(xh),_h=cn(()=>{let e=ra.cross(gc);return e=e.cross(ra).normalize(),e=gu(e,Sc,ea.mul(Wn.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),vh=e=>tn(e).mul(.5).add(.5),Nh=e=>Rn(e,_o(fu(yn(1).sub(nu(e,e)))));class Sh extends gi{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=O,this.unpackNormalMode=V}setup(e){const{normalMapType:t,scaleNode:r,unpackNormalMode:s}=this;let i=this.node.mul(2).sub(1);if(t===O?s===k?i=Nh(i.xy):s===G?i=Nh(i.yw):s!==V&&o(`THREE.NodeMaterial: Unexpected unpack normal mode: ${s}`):s!==V&&o(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${s}'`),null!==r){let t=r;!0===e.isFlatShading()&&(t=bc(t)),i=Rn(i.xy.mul(t),i.z)}let n=null;return t===z?n=wc(i):t===O?n=xh.mul(i).normalize():(o(`NodeMaterial: Unsupported normal map type: ${t}`),n=Sc),n}}const Rh=an(Sh).setParameterLength(1,2),Eh=cn(({textureNode:e,bumpScale:t})=>{const r=t=>e.isolate().context({getUV:e=>t(e.uvNode||kl()),forceUVContext:!0}),s=yn(r(e=>e));return _n(yn(r(e=>e.add(e.dFdx()))).sub(s),yn(r(e=>e.add(e.dFdy()))).sub(s)).mul(t)}),Ah=cn(e=>{const{surf_pos:t,surf_norm:r,dHdxy:s}=e,i=t.dFdx().normalize(),n=r,a=t.dFdy().normalize().cross(n),o=n.cross(i),u=i.dot(a).mul(yc),l=u.sign().mul(s.x.mul(a).add(s.y.mul(o)));return u.abs().mul(r).sub(l).normalize()});class wh extends gi{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=Eh({textureNode:this.textureNode,bumpScale:e});return Ah({surf_pos:pc,surf_norm:Sc,dHdxy:t})}}const Ch=an(wh).setParameterLength(1,2),Mh=new Map;class Bh extends ci{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let r=Mh.get(e);return void 0===r&&(r=Kc(e,t),Mh.set(e,r)),r}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,r=this.scope;let s=null;if(r===Bh.COLOR){const e=void 0!==t.color?this.getColor(r):Rn();s=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(r===Bh.OPACITY){const e=this.getFloat(r);s=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(r===Bh.SPECULAR_STRENGTH)s=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:yn(1);else if(r===Bh.SPECULAR_INTENSITY){const e=this.getFloat(r);s=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(r).a):e}else if(r===Bh.SPECULAR_COLOR){const e=this.getColor(r);s=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(r).rgb):e}else if(r===Bh.ROUGHNESS){const e=this.getFloat(r);s=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(r).g):e}else if(r===Bh.METALNESS){const e=this.getFloat(r);s=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(r).b):e}else if(r===Bh.EMISSIVE){const e=this.getFloat("emissiveIntensity"),i=this.getColor(r).mul(e);s=t.emissiveMap&&!0===t.emissiveMap.isTexture?i.mul(this.getTexture(r)):i}else if(r===Bh.NORMAL)t.normalMap?(s=Rh(this.getTexture("normal"),this.getCache("normalScale","vec2")),s.normalMapType=t.normalMapType,t.normalMap.format!=$&&t.normalMap.format!=W&&t.normalMap.format!=H||(s.unpackNormalMode=k)):s=t.bumpMap?Ch(this.getTexture("bump").r,this.getFloat("bumpScale")):Sc;else if(r===Bh.CLEARCOAT){const e=this.getFloat(r);s=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_ROUGHNESS){const e=this.getFloat(r);s=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_NORMAL)s=t.clearcoatNormalMap?Rh(this.getTexture(r),this.getCache(r+"Scale","vec2")):Sc;else if(r===Bh.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));s=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(r===Bh.SHEEN_ROUGHNESS){const e=this.getFloat(r);s=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(r).a):e,s=s.clamp(1e-4,1)}else if(r===Bh.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(r);s=Ln(mp.x,mp.y,mp.y.negate(),mp.x).mul(e.rg.mul(2).sub(_n(1)).normalize().mul(e.b))}else s=mp;else if(r===Bh.IRIDESCENCE_THICKNESS){const e=qc("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=qc("0","float",t.iridescenceThicknessRange);s=e.sub(i).mul(this.getTexture(r).g).add(i)}else s=e}else if(r===Bh.TRANSMISSION){const e=this.getFloat(r);s=t.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===Bh.THICKNESS){const e=this.getFloat(r);s=t.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===Bh.IOR)s=this.getFloat(r);else if(r===Bh.LIGHT_MAP)s=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===Bh.AO)s=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(r===Bh.LINE_DASH_OFFSET)s=t.dashOffset?this.getFloat(r):yn(0);else{const t=this.getNodeType(e);s=this.getCache(r,t)}return s}}Bh.ALPHA_TEST="alphaTest",Bh.COLOR="color",Bh.OPACITY="opacity",Bh.SHININESS="shininess",Bh.SPECULAR="specular",Bh.SPECULAR_STRENGTH="specularStrength",Bh.SPECULAR_INTENSITY="specularIntensity",Bh.SPECULAR_COLOR="specularColor",Bh.REFLECTIVITY="reflectivity",Bh.ROUGHNESS="roughness",Bh.METALNESS="metalness",Bh.NORMAL="normal",Bh.CLEARCOAT="clearcoat",Bh.CLEARCOAT_ROUGHNESS="clearcoatRoughness",Bh.CLEARCOAT_NORMAL="clearcoatNormal",Bh.EMISSIVE="emissive",Bh.ROTATION="rotation",Bh.SHEEN="sheen",Bh.SHEEN_ROUGHNESS="sheenRoughness",Bh.ANISOTROPY="anisotropy",Bh.IRIDESCENCE="iridescence",Bh.IRIDESCENCE_IOR="iridescenceIOR",Bh.IRIDESCENCE_THICKNESS="iridescenceThickness",Bh.IOR="ior",Bh.TRANSMISSION="transmission",Bh.THICKNESS="thickness",Bh.ATTENUATION_DISTANCE="attenuationDistance",Bh.ATTENUATION_COLOR="attenuationColor",Bh.LINE_SCALE="scale",Bh.LINE_DASH_SIZE="dashSize",Bh.LINE_GAP_SIZE="gapSize",Bh.LINE_WIDTH="linewidth",Bh.LINE_DASH_OFFSET="dashOffset",Bh.POINT_SIZE="size",Bh.DISPERSION="dispersion",Bh.LIGHT_MAP="light",Bh.AO="ao";const Fh=on(Bh,Bh.ALPHA_TEST),Lh=on(Bh,Bh.COLOR),Ph=on(Bh,Bh.SHININESS),Dh=on(Bh,Bh.EMISSIVE),Uh=on(Bh,Bh.OPACITY),Ih=on(Bh,Bh.SPECULAR),Oh=on(Bh,Bh.SPECULAR_INTENSITY),Vh=on(Bh,Bh.SPECULAR_COLOR),kh=on(Bh,Bh.SPECULAR_STRENGTH),Gh=on(Bh,Bh.REFLECTIVITY),zh=on(Bh,Bh.ROUGHNESS),$h=on(Bh,Bh.METALNESS),Wh=on(Bh,Bh.NORMAL),Hh=on(Bh,Bh.CLEARCOAT),qh=on(Bh,Bh.CLEARCOAT_ROUGHNESS),jh=on(Bh,Bh.CLEARCOAT_NORMAL),Xh=on(Bh,Bh.ROTATION),Kh=on(Bh,Bh.SHEEN),Qh=on(Bh,Bh.SHEEN_ROUGHNESS),Yh=on(Bh,Bh.ANISOTROPY),Zh=on(Bh,Bh.IRIDESCENCE),Jh=on(Bh,Bh.IRIDESCENCE_IOR),ep=on(Bh,Bh.IRIDESCENCE_THICKNESS),tp=on(Bh,Bh.TRANSMISSION),rp=on(Bh,Bh.THICKNESS),sp=on(Bh,Bh.IOR),ip=on(Bh,Bh.ATTENUATION_DISTANCE),np=on(Bh,Bh.ATTENUATION_COLOR),ap=on(Bh,Bh.LINE_SCALE),op=on(Bh,Bh.LINE_DASH_SIZE),up=on(Bh,Bh.LINE_GAP_SIZE),lp=on(Bh,Bh.LINE_WIDTH),dp=on(Bh,Bh.LINE_DASH_OFFSET),cp=on(Bh,Bh.POINT_SIZE),hp=on(Bh,Bh.DISPERSION),pp=on(Bh,Bh.LIGHT_MAP),gp=on(Bh,Bh.AO),mp=Sa(new t).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),fp=cn(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class yp extends hi{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r;const s=e.context.assign;if(r=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===s||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}const bp=an(yp).setParameterLength(2);class xp extends Yl{static get type(){return"StorageBufferNode"}constructor(e,t=null,r=0){let s,i=null;t&&t.isStruct?(s="struct",i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(s=Ws(e.itemSize),r=e.count):s=t,super(e,s,r),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=ii.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(0===this.bufferCount){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return bp(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(ii.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=ul(this.value),this._varying=$u(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:r}=this.getAttributeData(),s=r.build(e);return e.registerTransform(s,t),s}}const Tp=(e,t=null,r=0)=>new xp(e,t,r);class _p extends ci{static get type(){return"InstanceNode"}constructor(e,t,r=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=r,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=ri.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}get isStorageColor(){const{instanceColor:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}setup(e){let{instanceMatrixNode:t,instanceColorNode:r}=this;null===t&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);const{instanceColor:s,isStorageColor:i}=this;if(s&&null===r){if(i)r=Tp(s,"vec3",Math.max(s.count,1)).element(pl);else{const e=new q(s.array,3),t=s.usage===x?dl:ll;this.bufferColor=e,r=Rn(t(e,"vec3",3,0))}this.instanceColorNode=r}const n=t.mul(lc).xyz;if(lc.assign(n),e.needsPreviousData()&&dc.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){const e=Ac(Tc,t);Tc.assign(e)}null!==this.instanceColorNode&&kn("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){null!==this.buffer&&!0!==this.isStorageMatrix&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&!0!==this.isStorageColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),null!==this.previousInstanceMatrixNode&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){const t=e.object;return null===this.previousInstanceMatrixNode&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(dc).xyz}_createInstanceMatrixNode(e,t){let r;const{instanceMatrix:s}=this,{count:i}=s;if(this.isStorageMatrix)r=Tp(s,"mat4",Math.max(i,1)).element(pl);else{if(16*i*4<=t.getUniformBufferLimit())r=Zl(s.array,"mat4",Math.max(i,1)).element(pl);else{const t=new j(s.array,16,1);!0===e&&(this.buffer=t);const i=s.usage===x?dl:ll,n=[i(t,"vec4",16,0),i(t,"vec4",16,4),i(t,"vec4",16,8),i(t,"vec4",16,12)];r=Dn(...n)}}return r}}const vp=an(_p).setParameterLength(2,3);class Np extends _p{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:r,instanceColor:s}=e;super(t,r,s),this.instancedMesh=e}}const Sp=an(Np).setParameterLength(1);class Rp extends ci{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=pl:this.batchingIdNode=yl);const t=cn(([e])=>{const t=bn(zl(Ql(this.batchMesh._indirectTexture),0).x).toConst(),r=bn(e).mod(t).toConst(),s=bn(e).div(t).toConst();return Ql(this.batchMesh._indirectTexture,vn(r,s)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),r=t(bn(this.batchingIdNode)),s=this.batchMesh._matricesTexture,i=bn(zl(Ql(s),0).x).toConst(),n=yn(r).mul(4).toInt().toConst(),a=n.mod(i).toConst(),o=n.div(i).toConst(),u=Dn(Ql(s,vn(a,o)),Ql(s,vn(a.add(1),o)),Ql(s,vn(a.add(2),o)),Ql(s,vn(a.add(3),o))),l=this.batchMesh._colorsTexture;if(null!==l){const e=cn(([e])=>{const t=bn(zl(Ql(l),0).x).toConst(),r=e,s=r.mod(t).toConst(),i=r.div(t).toConst();return Ql(l,vn(s,i)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),t=e(r);kn("vec3","vBatchColor").assign(t)}const d=Pn(u);lc.assign(u.mul(lc));const c=Tc.div(Rn(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),h=d.mul(c).xyz;Tc.assign(h),e.hasGeometryAttribute("tangent")&&ch.mulAssign(d)}}const Ep=an(Rp).setParameterLength(1),Ap=new WeakMap;class wp extends ci{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=ri.OBJECT,this.skinIndexNode=Vl("skinIndex","uvec4"),this.skinWeightNode=Vl("skinWeight","vec4"),this.bindMatrixNode=qc("bindMatrix","mat4"),this.bindMatrixInverseNode=qc("bindMatrixInverse","mat4"),this.boneMatricesNode=jc("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=lc,this.toPositionNode=lc,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:r,skinWeightNode:s,bindMatrixNode:i,bindMatrixInverseNode:n}=this,a=e.element(r.x),o=e.element(r.y),u=e.element(r.z),l=e.element(r.w),d=i.mul(t),c=La(a.mul(s.x).mul(d),o.mul(s.y).mul(d),u.mul(s.z).mul(d),l.mul(s.w).mul(d));return n.mul(c).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=Tc,r=ch){const{skinIndexNode:s,skinWeightNode:i,bindMatrixNode:n,bindMatrixInverseNode:a}=this,o=e.element(s.x),u=e.element(s.y),l=e.element(s.z),d=e.element(s.w);let c=La(i.x.mul(o),i.y.mul(u),i.z.mul(l),i.w.mul(d));c=a.mul(c).mul(n);return{skinNormal:c.transformDirection(t).xyz,skinTangent:c.transformDirection(r).xyz}}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=jc("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,dc)}setup(e){e.needsPreviousData()&&dc.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const{skinNormal:t,skinTangent:r}=this.getSkinnedNormalAndTangent();Tc.assign(t),e.hasGeometryAttribute("tangent")&&ch.assign(r)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;Ap.get(t)!==e.frameId&&(Ap.set(t,e.frameId),null!==this.previousBoneMatricesNode&&(null===t.previousBoneMatrices&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const Cp=e=>new wp(e);class Mp extends ci{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const r={};for(let e=0,t=this.params.length-1;eNumber(l)?">=":"<")),a)n=`while ( ${l} )`;else{const r={start:u,end:l},s=r.start,i=r.end;let a;const g=()=>h.includes("<")?"+=":"-=";if(null!=p)switch(typeof p){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=d+" "+g()+" "+e.generateConst(c,p);break;case"string":a=d+" "+p;break;default:p.isNode?a=d+" "+g()+" "+p.build(e):(o("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),a="break /* invalid update */")}else p="int"===c||"uint"===c?h.includes("<")?"++":"--":g()+" 1.",a=d+" "+p;n=`for ( ${e.getVar(c,d)+" = "+s}; ${d+" "+h+" "+i}; ${a} )`}e.addFlowCode((0===s?"\n":"")+e.tab+n+" {\n\n").addFlowTab()}const i=s.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+i);for(let t=0,r=this.params.length-1;tnew Mp(nn(e,"int")).toStack(),Fp=()=>Cl("break").toStack(),Lp=new WeakMap,Pp=new s,Dp=cn(({bufferMap:e,influence:t,stride:r,width:s,depth:i,offset:n})=>{const a=bn(hl).mul(r).add(n),o=a.div(s),u=a.sub(o.mul(s));return Ql(e,vn(u,o)).depth(i).xyz.mul(t)});class Up extends ci{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Sa(1),this.updateType=ri.OBJECT}setup(e){const{geometry:r}=e,s=void 0!==r.morphAttributes.position,i=r.hasAttribute("normal")&&void 0!==r.morphAttributes.normal,n=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,a=void 0!==n?n.length:0,{texture:o,stride:u,size:l}=function(e){const r=void 0!==e.morphAttributes.position,s=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,n=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=void 0!==n?n.length:0;let o=Lp.get(e);if(void 0===o||o.count!==a){void 0!==o&&o.texture.dispose();const u=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],d=e.morphAttributes.color||[];let c=0;!0===r&&(c=1),!0===s&&(c=2),!0===i&&(c=3);let h=e.attributes.position.count*c,p=1;const g=4096;h>g&&(p=Math.ceil(h/g),h=g);const m=new Float32Array(h*p*4*a),f=new X(m,h,p,a);f.type=K,f.needsUpdate=!0;const y=4*c;for(let x=0;x{const t=yn(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(Ql(this.mesh.morphTexture,vn(bn(e).add(1),bn(pl))).r):t.assign(qc("morphTargetInfluences","float").element(e).toVar()),gn(t.notEqual(0),()=>{!0===s&&lc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(0)})),!0===i&&Tc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const Ip=an(Up).setParameterLength(1);class Op extends ci{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Vp extends Op{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class kp extends wu{static get type(){return"LightingContextNode"}constructor(e,t=null,r=null,s=null){super(e),this.lightingModel=t,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,r={directDiffuse:Rn().toVar("directDiffuse"),directSpecular:Rn().toVar("directSpecular"),indirectDiffuse:Rn().toVar("indirectDiffuse"),indirectSpecular:Rn().toVar("indirectSpecular")};return{radiance:Rn().toVar("radiance"),irradiance:Rn().toVar("irradiance"),iblIrradiance:Rn().toVar("iblIrradiance"),ambientOcclusion:yn(1).toVar("ambientOcclusion"),reflectedLight:r,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Gp=an(kp);class zp extends Op{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const $p=new t;class Wp extends jl{static get type(){return"ViewportTextureNode"}constructor(e=ud,t=null,r=null){let s=null;null===r?(s=new Q,s.minFilter=Y,r=s):s=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=s,this.isOutputTextureNode=!0,this.updateBeforeType=ri.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),null===e)return t;if(!1===r.has(e)){const s=t.clone();r.set(e,s)}return r.get(e)}updateReference(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;return this.value=this.getTextureForReference(i),this.value}updateBefore(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;null===i?t.getDrawingBufferSize($p):i.getDrawingBufferSize?i.getDrawingBufferSize($p):$p.set(i.width,i.height);const n=this.getTextureForReference(i);n.image.width===$p.width&&n.image.height===$p.height||(n.image.width=$p.width,n.image.height=$p.height,n.needsUpdate=!0);const a=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=a}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Hp=an(Wp).setParameterLength(0,3),qp=an(Wp,null,null,{generateMipmaps:!0}).setParameterLength(0,3),jp=qp(),Xp=(e=ud,t=null)=>jp.sample(e,t);let Kp=null;class Qp extends Wp{static get type(){return"ViewportDepthTextureNode"}constructor(e=ud,t=null,r=null){null===r&&(null===Kp&&(Kp=new Z),r=Kp),super(e,t,r)}}const Yp=an(Qp).setParameterLength(0,3);class Zp extends ci{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Zp.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,r=this.valueNode;let s=null;if(t===Zp.DEPTH_BASE)null!==r&&(s=ng().assign(r));else if(t===Zp.DEPTH)s=e.isPerspectiveCamera?tg(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd);else if(t===Zp.LINEAR_DEPTH)if(null!==r)if(e.isPerspectiveCamera){const e=sg(r,Bd,Fd);s=Jp(e,Bd,Fd)}else s=r;else s=Jp(pc.z,Bd,Fd);return s}}Zp.DEPTH_BASE="depthBase",Zp.DEPTH="depth",Zp.LINEAR_DEPTH="linearDepth";const Jp=(e,t,r)=>e.add(t).div(t.sub(r)),eg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),tg=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),rg=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),sg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),ig=(e,t,r)=>{t=t.max(1e-6).toVar();const s=To(e.negate().div(t)),i=To(r.div(t));return s.div(i)},ng=an(Zp,Zp.DEPTH_BASE),ag=on(Zp,Zp.DEPTH),og=an(Zp,Zp.LINEAR_DEPTH).setParameterLength(0,1),ug=og(Yp());ag.assign=e=>ng(e);class lg extends ci{static get type(){return"ClippingNode"}constructor(e=lg.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:r,unionPlanes:s}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===lg.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(r,s):this.scope===lg.HARDWARE?this.setupHardwareClipping(s,e):this.setupDefault(r,s)}setupAlphaToCoverage(e,t){return cn(()=>{const r=yn().toVar("distanceToPlane"),s=yn().toVar("distanceToGradient"),i=yn(1).toVar("clipOpacity"),n=t.length;if(!1===this.hardwareClipping&&n>0){const e=td(t).setGroup(_a);Bp(n,({i:t})=>{const n=e.element(t);r.assign(pc.dot(n.xyz).negate().add(n.w)),s.assign(r.fwidth().div(2)),i.mulAssign(bu(s.negate(),s,r))})}const a=e.length;if(a>0){const t=td(e).setGroup(_a),n=yn(1).toVar("intersectionClipOpacity");Bp(a,({i:e})=>{const i=t.element(e);r.assign(pc.dot(i.xyz).negate().add(i.w)),s.assign(r.fwidth().div(2)),n.mulAssign(bu(s.negate(),s,r).oneMinus())}),i.mulAssign(n.oneMinus())}Gn.a.mulAssign(i),Gn.a.equal(0).discard()})()}setupDefault(e,t){return cn(()=>{const r=t.length;if(!1===this.hardwareClipping&&r>0){const e=td(t).setGroup(_a);Bp(r,({i:t})=>{const r=e.element(t);pc.dot(r.xyz).greaterThan(r.w).discard()})}const s=e.length;if(s>0){const t=td(e).setGroup(_a),r=Tn(!0).toVar("clipped");Bp(s,({i:e})=>{const s=t.element(e);r.assign(pc.dot(s.xyz).greaterThan(s.w).and(r))}),r.discard()}})()}setupHardwareClipping(e,t){const r=e.length;return t.enableHardwareClipping(r),cn(()=>{const s=td(e).setGroup(_a),i=sd(t.getClipDistance());Bp(r,({i:e})=>{const t=s.element(e),r=pc.dot(t.xyz).sub(t.w).negate();i.element(e).assign(r)})})()}}lg.ALPHA_TO_COVERAGE="alphaToCoverage",lg.DEFAULT="default",lg.HARDWARE="hardware";const dg=cn(([e])=>Eo(Da(1e4,Ao(Da(17,e.x).add(Da(.1,e.y)))).mul(La(.1,Vo(Ao(Da(13,e.y).add(e.x))))))),cg=cn(([e])=>dg(_n(dg(e.xy),e.z))),hg=cn(([e])=>{const t=eu(Go(Wo(e.xyz)),Go(Ho(e.xyz))),r=yn(1).div(yn(.05).mul(t)).toVar("pixScale"),s=_n(bo(No(To(r))),bo(So(To(r)))),i=_n(cg(No(s.x.mul(e.xyz))),cg(No(s.y.mul(e.xyz)))),n=Eo(To(r)),a=La(Da(n.oneMinus(),i.x),Da(n,i.y)),o=Jo(n,n.oneMinus()),u=Rn(a.mul(a).div(Da(2,o).mul(Pa(1,o))),a.sub(Da(.5,o)).div(Pa(1,o)),Pa(1,Pa(1,a).mul(Pa(1,a)).div(Da(2,o).mul(Pa(1,o))))),l=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(u.x,u.y),u.z);return mu(l,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class pg extends Ol{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let r;return r=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new s(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const gg=(e=0)=>new pg(e),mg=cn(([e,t])=>Jo(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fg=cn(([e,t])=>Jo(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yg=cn(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bg=cn(([e,t])=>gu(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),tu(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xg=cn(([e,t])=>{const r=t.a.add(e.a.mul(t.a.oneMinus()));return Cn(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Tg=cn(([e])=>Cn(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),_g=cn(([e])=>(gn(e.a.equal(0),()=>Cn(0)),Cn(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class vg extends J{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;const r=this[t];r&&!0===r.isNode&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:r}of this._getNodeChildren())e.push(Vs(t.slice(0,-4)),r.getCacheKey());return this.type+ks(e)}build(e){this.setup(e)}setupObserver(e){return new Ds(e)}setup(e){e.context.setupNormal=()=>Gu(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,r=t.getRenderTarget();e.addStack();const s=this.setupVertex(e),i=Gu(this.vertexNode||s,"VERTEX");let n;e.context.clipSpace=i,e.stack.outputNode=i,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==r?!0===r.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const s=this.setupLighting(e);null!==a&&e.stack.addToStack(a);const i=Cn(s,Gn.a).max(0);n=this.setupOutput(e,i),oa.assign(n);const o=null!==this.outputNode;if(o&&(n=this.outputNode),e.context.getOutput&&(n=e.context.getOutput(n,e)),null!==r){const e=t.getMRT(),r=this.mrtNode;null!==e?(o&&oa.assign(n),n=e,null!==r&&(n=e.merge(r))):null!==r&&(n=r)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Cn(t)),n=this.setupOutput(e,t)}e.stack.outputNode=n,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:r}=e.clippingContext;let s=null;if(t.length>0||r.length>0){const t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?s=new lg(lg.ALPHA_TO_COVERAGE):e.stack.addToStack(new lg)}return s}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(new lg(lg.HARDWARE)),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:r}=e;let s=this.depthNode;if(null===s){const e=t.getMRT();e&&e.has("depth")?s=e.get("depth"):!0===t.logarithmicDepthBuffer&&(s=r.isPerspectiveCamera?ig(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd))}null!==s&&ag.assign(s).toStack()}setupPositionView(){return sc.mul(lc).xyz}setupModelViewProjection(){return Ld.mul(pc)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),fp}setupPosition(e){const{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&Ip(t).toStack(),!0===t.isSkinnedMesh&&Cp(t).toStack(),this.displacementMap){const e=Kc("displacementMap","texture"),t=Kc("displacementScale","float"),r=Kc("displacementBias","float");lc.addAssign(Tc.normalize().mul(e.x.mul(t).add(r)))}return t.isBatchedMesh&&Ep(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&Sp(t).toStack(),null!==this.positionNode&&lc.assign(Gu(this.positionNode,"POSITION","vec3")),lc}setupDiffuseColor(e){const{object:t,geometry:r}=e;null!==this.maskNode&&Tn(this.maskNode).not().discard();let s=this.colorNode?Cn(this.colorNode):Lh;if(!0===this.vertexColors&&r.hasAttribute("color")&&(s=s.mul(gg())),t.instanceColor){s=kn("vec3","vInstanceColor").mul(s)}if(t.isBatchedMesh&&t._colorsTexture){s=kn("vec3","vBatchColor").mul(s)}Gn.assign(s);const i=this.opacityNode?yn(this.opacityNode):Uh;Gn.a.assign(Gn.a.mul(i));let n=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(n=null!==this.alphaTestNode?yn(this.alphaTestNode):Fh,!0===this.alphaToCoverage?(Gn.a=bu(n,n.add(Ko(Gn.a)),Gn.a),Gn.a.lessThanEqual(0).discard()):Gn.a.lessThanEqual(n).discard()),!0===this.alphaHash&&Gn.a.lessThan(hg(lc)).discard(),e.isOpaque()&&Gn.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?Rn(0):Gn.rgb}setupNormal(){return this.normalNode?Rn(this.normalNode):Wh}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Kc("envMap","cubeTexture"):Kc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new zp(pp)),t}setupLights(e){const t=[],r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);const s=this.setupLightMap(e);s&&s.isLightingNode&&t.push(s);let i=this.aoNode;null===i&&e.material.aoMap&&(i=gp),e.context.getAO&&(i=e.context.getAO(i,e)),i&&t.push(new Vp(i));let n=this.lightsNode||e.lightsNode;return t.length>0&&(n=e.renderer.lighting.createNode([...n.getLights(),...t])),n}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:r,backdropAlphaNode:s,emissiveNode:i}=this,n=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(n&&n.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=Gp(n,t,r,s)}else null!==r&&(a=Rn(null!==s?gu(a,r,s):r));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&($n.assign(Rn(i||Dh)),a=a.add($n)),a}setupFog(e,t){const r=e.fogNode;return r&&(oa.assign(t),t=Cn(r.toVar())),t}setupPremultipliedAlpha(e,t){return Tg(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const t in e){const r=e[t];void 0===this[t]&&(this[t]=r,r&&r.clone&&(this[t]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const r=J.prototype.toJSON.call(this,e);r.inputNodes={};for(const{property:t,childNode:s}of this._getNodeChildren())r.inputNodes[t]=s.toJSON(e).uuid;function s(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(t){const t=s(e.textures),i=s(e.images),n=s(e.nodes);t.length>0&&(r.textures=t),i.length>0&&(r.images=i),n.length>0&&(r.nodes=n)}return r}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const Ng=new ee;class Sg extends vg{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Ng),this.setValues(e)}}const Rg=new te;class Eg extends vg{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Rg),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?yn(this.offsetNode):dp,t=this.dashScaleNode?yn(this.dashScaleNode):ap,r=this.dashSizeNode?yn(this.dashSizeNode):op,s=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(r),la.assign(s);const i=$u(Vl("lineDistance").mul(t));(e?i.add(e):i).mod(ua.add(la)).greaterThan(ua).discard()}}const Ag=new te;class wg extends vg{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(Ag),this.vertexColors=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=re,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,r=this._useAlphaToCoverage,s=this.vertexColors,i=this._useDash,n=this._useWorldUnits,a=cn(({start:e,end:t})=>{const r=Ld.element(2).element(2),s=Ld.element(3).element(2).mul(-.5).div(r).sub(e.z).div(t.z.sub(e.z));return Cn(gu(e.xyz,t.xyz,s),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=cn(()=>{const e=Vl("instanceStart"),t=Vl("instanceEnd"),r=Cn(sc.mul(Cn(e,1))).toVar("start"),s=Cn(sc.mul(Cn(t,1))).toVar("end");if(i){const e=this.dashScaleNode?yn(this.dashScaleNode):ap,t=this.offsetNode?yn(this.offsetNode):dp,r=Vl("instanceDistanceStart"),s=Vl("instanceDistanceEnd");let i=uc.y.lessThan(.5).select(e.mul(r),e.mul(s));i=i.add(t),kn("float","lineDistance").assign(i)}n&&(kn("vec3","worldStart").assign(r.xyz),kn("vec3","worldEnd").assign(s.xyz));const o=cd.z.div(cd.w),u=Ld.element(2).element(3).equal(-1);gn(u,()=>{gn(r.z.lessThan(0).and(s.z.greaterThan(0)),()=>{s.assign(a({start:r,end:s}))}).ElseIf(s.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{r.assign(a({start:s,end:r}))})});const l=Ld.mul(r),d=Ld.mul(s),c=l.xyz.div(l.w),h=d.xyz.div(d.w),p=h.xy.sub(c.xy).toVar();p.x.assign(p.x.mul(o)),p.assign(p.normalize());const g=Cn().toVar();if(n){const e=s.xyz.sub(r.xyz).normalize(),t=gu(r.xyz,s.xyz,.5).normalize(),n=e.cross(t).normalize(),a=e.cross(n),o=kn("vec4","worldPos");o.assign(uc.y.lessThan(.5).select(r,s));const u=lp.mul(.5);o.addAssign(Cn(uc.x.lessThan(0).select(n.mul(u),n.mul(u).negate()),0)),i||(o.addAssign(Cn(uc.y.lessThan(.5).select(e.mul(u).negate(),e.mul(u)),0)),o.addAssign(Cn(a.mul(u),0)),gn(uc.y.greaterThan(1).or(uc.y.lessThan(0)),()=>{o.subAssign(Cn(a.mul(2).mul(u),0))})),g.assign(Ld.mul(o));const l=Rn().toVar();l.assign(uc.y.lessThan(.5).select(c,h)),g.z.assign(l.z.mul(g.w))}else{const e=_n(p.y,p.x.negate()).toVar("offset");p.x.assign(p.x.div(o)),e.x.assign(e.x.div(o)),e.assign(uc.x.lessThan(0).select(e.negate(),e)),gn(uc.y.lessThan(0),()=>{e.assign(e.sub(p))}).ElseIf(uc.y.greaterThan(1),()=>{e.assign(e.add(p))}),e.assign(e.mul(lp)),e.assign(e.div(cd.w.div(od))),g.assign(uc.y.lessThan(.5).select(l,d)),e.assign(e.mul(g.w)),g.assign(g.add(Cn(e,0,0)))}return g})();const o=cn(({p1:e,p2:t,p3:r,p4:s})=>{const i=e.sub(r),n=s.sub(r),a=t.sub(e),o=i.dot(n),u=n.dot(a),l=i.dot(a),d=n.dot(n),c=a.dot(a).mul(d).sub(u.mul(u)),h=o.mul(u).sub(l.mul(d)).div(c).clamp(),p=o.add(u.mul(h)).div(d).clamp();return _n(h,p)});if(this.colorNode=cn(()=>{const e=kl();if(i){const t=this.dashSizeNode?yn(this.dashSizeNode):op,r=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(t),la.assign(r);const s=kn("float","lineDistance");e.y.lessThan(-1).or(e.y.greaterThan(1)).discard(),s.mod(ua.add(la)).greaterThan(ua).discard()}const a=yn(1).toVar("alpha");if(n){const e=kn("vec3","worldStart"),s=kn("vec3","worldEnd"),n=kn("vec4","worldPos").xyz.normalize().mul(1e5),u=s.sub(e),l=o({p1:e,p2:s,p3:Rn(0,0,0),p4:n}),d=e.add(u.mul(l.x)),c=n.mul(l.y),h=d.sub(c).length().div(lp);if(!i)if(r&&t.currentSamples>0){const e=h.fwidth();a.assign(bu(e.negate().add(.5),e.add(.5),h).oneMinus())}else h.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1)),s=t.mul(t).add(r.mul(r)),i=yn(s.fwidth()).toVar("dlen");gn(e.y.abs().greaterThan(1),()=>{a.assign(bu(i.oneMinus(),i.add(1),s).oneMinus())})}else gn(e.y.abs().greaterThan(1),()=>{const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1));t.mul(t).add(r.mul(r)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(s){const e=Vl("instanceColorStart"),t=Vl("instanceColorEnd");u=uc.y.lessThan(.5).select(e,t).mul(Lh)}else u=Lh;return Cn(u,a)})(),this.transparent){const e=this.opacityNode?yn(this.opacityNode):Uh;this.outputNode=Cn(this.colorNode.rgb.mul(e).add(Xp().rgb.mul(e.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}copy(e){return super.copy(e),this.vertexColors=e.vertexColors,this.dashOffset=e.dashOffset,this.lineColorNode=e.lineColorNode,this.offsetNode=e.offsetNode,this.dashScaleNode=e.dashScaleNode,this.dashSizeNode=e.dashSizeNode,this.gapSizeNode=e.gapSizeNode,this._useDash=e._useDash,this._useAlphaToCoverage=e._useAlphaToCoverage,this._useWorldUnits=e._useWorldUnits,this}}const Cg=new se;class Mg extends vg{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Cg),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?yn(this.opacityNode):Uh;Gn.assign(Qu(Cn(vh(Sc),e),ie))}}const Bg=cn(([e=hc])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),r=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return _n(t,r)});class Fg extends ne{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new D(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const r=t.minFilter,s=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i=new ae(5,5,5),n=Bg(hc),a=new vg;a.colorNode=Kl(t,n,0),a.side=L,a.blending=re;const o=new oe(i,a),u=new ue;u.add(o),t.minFilter===Y&&(t.minFilter=le);const l=new de(1,10,this),d=e.getMRT();return e.setMRT(null),l.update(e,u),e.setMRT(d),t.minFilter=r,t.generateMipmaps=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,s=!0){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,r,s);e.setRenderTarget(i)}}const Lg=new WeakMap;class Pg extends gi{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=$c(null);const t=new D;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=ri.RENDER}updateBefore(e){const{renderer:t,material:r}=e,s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const e=s.isTextureNode?s.value:r[s.property];if(e&&e.isTexture){const r=e.mapping;if(r===ce||r===he){if(Lg.has(e)){const t=Lg.get(e);Ug(t,e.mapping),this._cubeTexture=t}else{const r=e.image;if(function(e){return null!=e&&e.height>0}(r)){const s=new Fg(r.height);s.fromEquirectangularTexture(t,e),Ug(s.texture,e.mapping),this._cubeTexture=s.texture,Lg.set(e,s.texture),e.addEventListener("dispose",Dg)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function Dg(e){const t=e.target;t.removeEventListener("dispose",Dg);const r=Lg.get(t);void 0!==r&&(Lg.delete(t),r.dispose())}function Ug(e,t){t===ce?e.mapping=U:t===he&&(e.mapping=I)}const Ig=an(Pg).setParameterLength(1);class Og extends Op{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Ig(this.envNode)}}class Vg extends Op{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=yn(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class kg{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Gg extends kg{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,r=e.reflectedLight,s=e.irradianceLightMap;r.indirectDiffuse.assign(Cn(0)),s?r.indirectDiffuse.addAssign(s):r.indirectDiffuse.addAssign(Cn(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(Gn.rgb)}finish(e){const{material:t,context:r}=e,s=r.outgoingLight,i=e.context.environment;if(i)switch(t.combine){case me:s.rgb.assign(gu(s.rgb,s.rgb.mul(i.rgb),kh.mul(Gh)));break;case ge:s.rgb.assign(gu(s.rgb,i.rgb,kh.mul(Gh)));break;case pe:s.rgb.addAssign(i.rgb.mul(kh.mul(Gh)));break;default:d("BasicLightingModel: Unsupported .combine value:",t.combine)}}}const zg=new fe;class $g extends vg{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(zg),this.setValues(e)}setupNormal(){return bc(vc)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Vg(pp)),t}setupOutgoingLight(){return Gn.rgb}setupLightingModel(){return new Gg}}const Wg=cn(({f0:e,f90:t,dotVH:r})=>{const s=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(s.oneMinus()).add(t.mul(s))}),Hg=cn(e=>e.diffuseColor.mul(1/Math.PI)),qg=cn(({dotNH:e})=>aa.mul(yn(.5)).add(1).mul(yn(1/Math.PI)).mul(e.pow(aa))),jg=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(t).clamp(),s=gc.dot(t).clamp(),i=Wg({f0:sa,f90:1,dotVH:s}),n=yn(.25),a=qg({dotNH:r});return i.mul(n).mul(a)});class Xg extends Gg{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t);r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:Gn.rgb}))),!0===this.specular&&r.directSpecular.addAssign(s.mul(jg({lightDirection:e})).mul(kh))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Kg=new ye;class Qg extends vg{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Kg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg(!1)}}const Yg=new be;class Zg extends vg{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Yg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg}setupVariants(){const e=(this.shininessNode?yn(this.shininessNode):Ph).max(1e-4);aa.assign(e);const t=this.specularNode||Ih;sa.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const Jg=cn(e=>{if(!1===e.geometry.hasAttribute("normal"))return yn(0);const t=vc.dFdx().abs().max(vc.dFdy().abs());return t.x.max(t.y).max(t.z)}),em=cn(e=>{const{roughness:t}=e,r=Jg();let s=t.max(.0525);return s=s.add(r),s=s.min(1),s}),tm=cn(({alpha:e,dotNL:t,dotNV:r})=>{const s=e.pow2(),i=t.mul(s.add(s.oneMinus().mul(r.pow2())).sqrt()),n=r.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt());return Ua(.5,i.add(n).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),rm=cn(({alphaT:e,alphaB:t,dotTV:r,dotBV:s,dotTL:i,dotBL:n,dotNV:a,dotNL:o})=>{const u=o.mul(Rn(e.mul(r),t.mul(s),a).length()),l=a.mul(Rn(e.mul(i),t.mul(n),o).length());return Ua(.5,u.add(l).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),sm=cn(({alpha:e,dotNH:t})=>{const r=e.pow2(),s=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),im=yn(1/Math.PI),nm=cn(({alphaT:e,alphaB:t,dotNH:r,dotTH:s,dotBH:i})=>{const n=e.mul(t),a=Rn(t.mul(s),e.mul(i),n.mul(r)),o=a.dot(a),u=n.div(o);return im.mul(n.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),am=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,normalView:n=Sc,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const u=s.pow2(),l=e.add(gc).normalize(),d=n.dot(e).clamp(),c=n.dot(gc).clamp(),h=n.dot(l).clamp(),p=gc.dot(l).clamp();let g,m,f=Wg({f0:t,f90:r,dotVH:p});if(Zi(a)&&(f=Qn.mix(f,i)),Zi(o)){const t=ta.dot(e),r=ta.dot(gc),s=ta.dot(l),i=ra.dot(e),n=ra.dot(gc),a=ra.dot(l);g=rm({alphaT:Jn,alphaB:u,dotTV:r,dotBV:n,dotTL:t,dotBL:i,dotNV:c,dotNL:d}),m=nm({alphaT:Jn,alphaB:u,dotNH:h,dotTH:s,dotBH:a})}else g=tm({alpha:u,dotNL:d,dotNV:c}),m=sm({alpha:u,dotNH:h});return f.mul(g).mul(m)}),om=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let um=null;const lm=cn(({roughness:e,dotNV:t})=>{null===um&&(um=new xe(om,16,16,$,Te),um.name="DFG_LUT",um.minFilter=le,um.magFilter=le,um.wrapS=_e,um.wrapT=_e,um.generateMipmaps=!1,um.needsUpdate=!0);const r=_n(e,t);return Kl(um,r).rg}),dm=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a})=>{const o=am({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a}),u=Sc.dot(e).clamp(),l=Sc.dot(gc).clamp(),d=lm({roughness:s,dotNV:l}),c=lm({roughness:s,dotNV:u}),h=t.mul(d.x).add(r.mul(d.y)),p=t.mul(c.x).add(r.mul(c.y)),g=d.x.add(d.y),m=c.x.add(c.y),f=yn(1).sub(g),y=yn(1).sub(m),b=t.add(t.oneMinus().mul(.047619)),x=h.mul(p).mul(b).div(yn(1).sub(f.mul(y).mul(b).mul(b)).add(ao)),T=f.mul(y),_=x.mul(T);return o.add(_)}),cm=cn(e=>{const{dotNV:t,specularColor:r,specularF90:s,roughness:i}=e,n=lm({dotNV:t,roughness:i});return r.mul(n.x).add(s.mul(n.y))}),hm=cn(({f:e,f90:t,dotVH:r})=>{const s=r.oneMinus().saturate(),i=s.mul(s),n=s.mul(i,i).clamp(0,.9999);return e.sub(Rn(t).mul(n)).div(n.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pm=cn(({roughness:e,dotNH:t})=>{const r=e.pow2(),s=yn(1).div(r),i=t.pow2().oneMinus().max(.0078125);return yn(2).add(s).mul(i.pow(s.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),gm=cn(({dotNV:e,dotNL:t})=>yn(1).div(yn(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),mm=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(e).clamp(),s=Sc.dot(gc).clamp(),i=Sc.dot(t).clamp(),n=pm({roughness:Kn,dotNH:i}),a=gm({dotNV:s,dotNL:r});return Xn.mul(n).mul(a)}),fm=cn(({N:e,V:t,roughness:r})=>{const s=e.dot(t).saturate(),i=_n(r,s.oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),ym=cn(({f:e})=>{const t=e.length();return eu(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),bm=cn(({v1:e,v2:t})=>{const r=e.dot(t),s=r.abs().toVar(),i=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),n=s.add(4.1616724).mul(s).add(3.417594).toVar(),a=i.div(n),o=r.greaterThan(0).select(a,eu(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),xm=cn(({N:e,V:t,P:r,mInv:s,p0:i,p1:n,p2:a,p3:o})=>{const u=n.sub(i).toVar(),l=o.sub(i).toVar(),d=u.cross(l),c=Rn().toVar();return gn(d.dot(r.sub(i)).greaterThanEqual(0),()=>{const u=t.sub(e.mul(t.dot(e))).normalize(),l=e.cross(u).negate(),d=s.mul(Pn(u,l,e).transpose()).toVar(),h=d.mul(i.sub(r)).normalize().toVar(),p=d.mul(n.sub(r)).normalize().toVar(),g=d.mul(a.sub(r)).normalize().toVar(),m=d.mul(o.sub(r)).normalize().toVar(),f=Rn(0).toVar();f.addAssign(bm({v1:h,v2:p})),f.addAssign(bm({v1:p,v2:g})),f.addAssign(bm({v1:g,v2:m})),f.addAssign(bm({v1:m,v2:h})),c.assign(Rn(ym({f:f})))}),c}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Tm=cn(({P:e,p0:t,p1:r,p2:s,p3:i})=>{const n=r.sub(t).toVar(),a=i.sub(t).toVar(),o=n.cross(a),u=Rn().toVar();return gn(o.dot(e.sub(t)).greaterThanEqual(0),()=>{const n=t.sub(e).normalize().toVar(),a=r.sub(e).normalize().toVar(),o=s.sub(e).normalize().toVar(),l=i.sub(e).normalize().toVar(),d=Rn(0).toVar();d.addAssign(bm({v1:n,v2:a})),d.addAssign(bm({v1:a,v2:o})),d.addAssign(bm({v1:o,v2:l})),d.addAssign(bm({v1:l,v2:n})),u.assign(Rn(ym({f:d.abs()})))}),u}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),_m=1/6,vm=e=>Da(_m,Da(e,Da(e,e.negate().add(3)).sub(3)).add(1)),Nm=e=>Da(_m,Da(e,Da(e,Da(3,e).sub(6))).add(4)),Sm=e=>Da(_m,Da(e,Da(e,Da(-3,e).add(3)).add(3)).add(1)),Rm=e=>Da(_m,ou(e,3)),Em=e=>vm(e).add(Nm(e)),Am=e=>Sm(e).add(Rm(e)),wm=e=>La(-1,Nm(e).div(vm(e).add(Nm(e)))),Cm=e=>La(1,Rm(e).div(Sm(e).add(Rm(e)))),Mm=(e,t,r)=>{const s=e.uvNode,i=Da(s,t.zw).add(.5),n=No(i),a=Eo(i),o=Em(a.x),u=Am(a.x),l=wm(a.x),d=Cm(a.x),c=wm(a.y),h=Cm(a.y),p=_n(n.x.add(l),n.y.add(c)).sub(.5).mul(t.xy),g=_n(n.x.add(d),n.y.add(c)).sub(.5).mul(t.xy),m=_n(n.x.add(l),n.y.add(h)).sub(.5).mul(t.xy),f=_n(n.x.add(d),n.y.add(h)).sub(.5).mul(t.xy),y=Em(a.y).mul(La(o.mul(e.sample(p).level(r)),u.mul(e.sample(g).level(r)))),b=Am(a.y).mul(La(o.mul(e.sample(m).level(r)),u.mul(e.sample(f).level(r))));return y.add(b)},Bm=cn(([e,t])=>{const r=_n(e.size(bn(t))),s=_n(e.size(bn(t.add(1)))),i=Ua(1,r),n=Ua(1,s),a=Mm(e,Cn(i,r),No(t)),o=Mm(e,Cn(n,s),So(t));return Eo(t).mix(a,o)}),Fm=cn(([e,t])=>{const r=t.mul(Wl(e));return Bm(e,r)}),Lm=cn(([e,t,r,s,i])=>{const n=Rn(yu(t.negate(),Ro(e),Ua(1,s))),a=Rn(Go(i[0].xyz),Go(i[1].xyz),Go(i[2].xyz));return Ro(n).mul(r.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Pm=cn(([e,t])=>e.mul(mu(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Dm=qp(),Um=Xp(),Im=cn(([e,t,r],{material:s})=>{const i=(s.side===L?Dm:Um).sample(e),n=To(ld.x).mul(Pm(t,r));return Bm(i,n)}),Om=cn(([e,t,r])=>(gn(r.notEqual(0),()=>{const s=xo(t).negate().div(r);return yo(s.negate().mul(e))}),Rn(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Vm=cn(([e,t,r,s,i,n,a,o,u,l,d,c,h,p,g])=>{let m,f;if(g){m=Cn().toVar(),f=Rn().toVar();const i=d.sub(1).mul(g.mul(.025)),n=Rn(d.sub(i),d,d.add(i));Bp({start:0,end:3},({i:i})=>{const d=n.element(i),g=Lm(e,t,c,d,o),y=a.add(g),b=l.mul(u.mul(Cn(y,1))),x=_n(b.xy.div(b.w)).toVar();x.addAssign(1),x.divAssign(2),x.assign(_n(x.x,x.y.oneMinus()));const T=Im(x,r,d);m.element(i).assign(T.element(i)),m.a.addAssign(T.a),f.element(i).assign(s.element(i).mul(Om(Go(g),h,p).element(i)))}),m.a.divAssign(3)}else{const i=Lm(e,t,c,d,o),n=a.add(i),g=l.mul(u.mul(Cn(n,1))),y=_n(g.xy.div(g.w)).toVar();y.addAssign(1),y.divAssign(2),y.assign(_n(y.x,y.y.oneMinus())),m=Im(y,r,d),f=s.mul(Om(Go(i),h,p))}const y=f.rgb.mul(m.rgb),b=e.dot(t).clamp(),x=Rn(cm({dotNV:b,specularColor:i,specularF90:n,roughness:r})),T=f.r.add(f.g,f.b).div(3);return Cn(x.oneMinus().mul(y),m.a.oneMinus().mul(T).oneMinus())}),km=Pn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Gm=(e,t)=>e.sub(t).div(e.add(t)).pow2(),zm=cn(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:s,baseF0:i})=>{const n=gu(e,t,bu(0,.03,s)),a=e.div(n).pow2().mul(r.pow2().oneMinus()).oneMinus();gn(a.lessThan(0),()=>Rn(1));const o=a.sqrt(),u=Gm(n,e),l=Wg({f0:u,f90:1,dotVH:r}),d=l.oneMinus(),c=n.lessThan(e).select(Math.PI,0),h=yn(Math.PI).sub(c),p=(e=>{const t=e.sqrt();return Rn(1).add(t).div(Rn(1).sub(t))})(i.clamp(0,.9999)),g=Gm(p,n.toVec3()),m=Wg({f0:g,f90:1,dotVH:o}),f=Rn(p.x.lessThan(n).select(Math.PI,0),p.y.lessThan(n).select(Math.PI,0),p.z.lessThan(n).select(Math.PI,0)),y=n.mul(s,o,2),b=Rn(h).add(f),x=l.mul(m).clamp(1e-5,.9999),T=x.sqrt(),_=d.pow2().mul(m).div(Rn(1).sub(x)),v=l.add(_).toVar(),N=_.sub(d).toVar();return Bp({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{N.mulAssign(T);const t=((e,t)=>{const r=e.mul(2*Math.PI*1e-9),s=Rn(54856e-17,44201e-17,52481e-17),i=Rn(1681e3,1795300,2208400),n=Rn(43278e5,93046e5,66121e5),a=yn(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(r.mul(2239900).add(t.x).cos()).mul(r.pow2().mul(-45282e5).exp());let o=s.mul(n.mul(2*Math.PI).sqrt()).mul(i.mul(r).add(t).cos()).mul(r.pow2().negate().mul(n).exp());return o=Rn(o.x.add(a),o.y,o.z).div(1.0685e-7),km.mul(o)})(yn(e).mul(y),yn(e).mul(b)).mul(2);v.addAssign(N.mul(t))}),v.max(Rn(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),$m=cn(({normal:e,viewDir:t,roughness:r})=>{const s=e.dot(t).saturate(),i=r.mul(r),n=r.add(.1).reciprocal(),a=yn(-1.9362).add(r.mul(1.0678)).add(i.mul(.4573)).sub(n.mul(.8469)),o=yn(-.6014).add(r.mul(.5538)).sub(i.mul(.467)).sub(n.mul(.1255));return a.mul(s).add(o).exp().saturate()}),Wm=Rn(.04),Hm=yn(1);class qm extends kg{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=s,this.transmission=i,this.dispersion=n,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=Rn().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Rn().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Rn().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=Rn().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Rn().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=Sc.dot(gc).clamp(),t=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:sa}),r=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:Gn.rgb});this.iridescenceFresnel=gu(t,r,Hn),this.iridescenceF0Dielectric=hm({f:t,f90:1,dotVH:e}),this.iridescenceF0Metallic=hm({f:r,f90:1,dotVH:e}),this.iridescenceF0=gu(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hn)}if(!0===this.transmission){const t=cc,r=Od.sub(cc).normalize(),s=Rc,i=e.context;i.backdrop=Vm(s,r,Wn,zn,ia,na,t,Qd,Dd,Ld,ca,pa,ma,ga,this.dispersion?fa:null),i.backdropAlpha=ha,Gn.a.mulAssign(gu(1,i.backdrop.a,ha))}super.start(e)}computeMultiscattering(e,t,r,s,i=null){const n=Sc.dot(gc).clamp(),a=lm({roughness:Wn,dotNV:n}),o=i?Qn.mix(s,i):s,u=o.mul(a.x).add(r.mul(a.y)),l=a.x.add(a.y).oneMinus(),d=o.add(o.oneMinus().mul(.047619)),c=u.mul(d).div(l.mul(d).oneMinus());e.addAssign(u),t.addAssign(c.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t).toVar();if(!0===this.sheen){this.sheenSpecularDirect.addAssign(s.mul(mm({lightDirection:e})));const t=$m({normal:Sc,viewDir:gc,roughness:Kn}),r=$m({normal:Sc,viewDir:e,roughness:Kn}),i=Xn.r.max(Xn.g).max(Xn.b).mul(t.max(r)).oneMinus();s.mulAssign(i)}if(!0===this.clearcoat){const r=Ec.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(r.mul(am({lightDirection:e,f0:Wm,f90:Hm,roughness:jn,normalView:Ec})))}r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:zn}))),r.directSpecular.addAssign(s.mul(dm({lightDirection:e,f0:ia,f90:1,roughness:Wn,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s,reflectedLight:i,ltc_1:n,ltc_2:a}){const o=t.add(r).sub(s),u=t.sub(r).sub(s),l=t.sub(r).add(s),d=t.add(r).add(s),c=Sc,h=gc,p=pc.toVar(),g=fm({N:c,V:h,roughness:Wn}),m=n.sample(g).toVar(),f=a.sample(g).toVar(),y=Pn(Rn(m.x,0,m.y),Rn(0,1,0),Rn(m.z,0,m.w)).toVar(),b=ia.mul(f.x).add(na.sub(ia).mul(f.y)).toVar();if(i.directSpecular.addAssign(e.mul(b).mul(xm({N:c,V:h,P:p,mInv:y,p0:o,p1:u,p2:l,p3:d}))),i.directDiffuse.addAssign(e.mul(zn).mul(xm({N:c,V:h,P:p,mInv:Pn(1,0,0,0,1,0,0,0,1),p0:o,p1:u,p2:l,p3:d}))),!0===this.clearcoat){const t=Ec,r=fm({N:t,V:h,roughness:jn}),s=n.sample(r),i=a.sample(r),c=Pn(Rn(s.x,0,s.y),Rn(0,1,0),Rn(s.z,0,s.w)),g=Wm.mul(i.x).add(Hm.sub(Wm).mul(i.y));this.clearcoatSpecularDirect.addAssign(e.mul(g).mul(xm({N:t,V:h,P:p,mInv:c,p0:o,p1:u,p2:l,p3:d})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:r}=e.context,s=t.mul(Hg({diffuseColor:zn})).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();s.mulAssign(t)}r.indirectDiffuse.addAssign(s)}indirectSpecular(e){const{radiance:t,iblIrradiance:r,reflectedLight:s}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(r.mul(Xn,$m({normal:Sc,viewDir:gc,roughness:Kn}))),!0===this.clearcoat){const e=Ec.dot(gc).clamp(),t=cm({dotNV:e,specularColor:Wm,specularF90:Hm,roughness:jn});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=Rn().toVar("singleScatteringDielectric"),n=Rn().toVar("multiScatteringDielectric"),a=Rn().toVar("singleScatteringMetallic"),o=Rn().toVar("multiScatteringMetallic");this.computeMultiscattering(i,n,na,sa,this.iridescenceF0Dielectric),this.computeMultiscattering(a,o,na,Gn.rgb,this.iridescenceF0Metallic);const u=gu(i,a,Hn),l=gu(n,o,Hn),d=i.add(n),c=zn.mul(d.oneMinus()),h=r.mul(1/Math.PI),p=t.mul(u).add(l.mul(h)).toVar(),g=c.mul(h).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();p.mulAssign(t),g.mulAssign(t)}s.indirectSpecular.addAssign(p),s.indirectDiffuse.addAssign(g)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:r}=e.context,s=Sc.dot(gc).clamp().add(t),i=Wn.mul(-16).oneMinus().negate().exp2(),n=t.sub(s.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(n)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=Ec.dot(gc).clamp(),r=Wg({dotVH:e,f0:Wm,f90:Hm}),s=t.mul(qn.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(qn));t.assign(s)}if(!0===this.sheen){const e=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(e)}}}const jm=yn(1),Xm=yn(-2),Km=yn(.8),Qm=yn(-1),Ym=yn(.4),Zm=yn(2),Jm=yn(.305),ef=yn(3),tf=yn(.21),rf=yn(4),sf=yn(4),nf=yn(16),af=cn(([e])=>{const t=Rn(Vo(e)).toVar(),r=yn(-1).toVar();return gn(t.x.greaterThan(t.z),()=>{gn(t.x.greaterThan(t.y),()=>{r.assign(Au(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}).Else(()=>{gn(t.z.greaterThan(t.y),()=>{r.assign(Au(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),of=cn(([e,t])=>{const r=_n().toVar();return gn(t.equal(0),()=>{r.assign(_n(e.z,e.y).div(Vo(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(_n(e.x.negate(),e.z.negate()).div(Vo(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(_n(e.x.negate(),e.y).div(Vo(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(_n(e.z.negate(),e.y).div(Vo(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(_n(e.x.negate(),e.z).div(Vo(e.y)))}).Else(()=>{r.assign(_n(e.x,e.y).div(Vo(e.z)))}),Da(.5,r.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),uf=cn(([e])=>{const t=yn(0).toVar();return gn(e.greaterThanEqual(Km),()=>{t.assign(jm.sub(e).mul(Qm.sub(Xm)).div(jm.sub(Km)).add(Xm))}).ElseIf(e.greaterThanEqual(Ym),()=>{t.assign(Km.sub(e).mul(Zm.sub(Qm)).div(Km.sub(Ym)).add(Qm))}).ElseIf(e.greaterThanEqual(Jm),()=>{t.assign(Ym.sub(e).mul(ef.sub(Zm)).div(Ym.sub(Jm)).add(Zm))}).ElseIf(e.greaterThanEqual(tf),()=>{t.assign(Jm.sub(e).mul(rf.sub(ef)).div(Jm.sub(tf)).add(ef))}).Else(()=>{t.assign(yn(-2).mul(To(Da(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),lf=cn(([e,t])=>{const r=e.toVar();r.assign(Da(2,r).sub(1));const s=Rn(r,1).toVar();return gn(t.equal(0),()=>{s.assign(s.zyx)}).ElseIf(t.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),df=cn(([e,t,r,s,i,n])=>{const a=yn(r),o=Rn(t),u=mu(uf(a),Xm,n),l=Eo(u),d=No(u),c=Rn(cf(e,o,d,s,i,n)).toVar();return gn(l.notEqual(0),()=>{const t=Rn(cf(e,o,d.add(1),s,i,n)).toVar();c.assign(gu(c,t,l))}),c}),cf=cn(([e,t,r,s,i,n])=>{const a=yn(r).toVar(),o=Rn(t),u=yn(af(o)).toVar(),l=yn(eu(sf.sub(a),0)).toVar();a.assign(eu(a,sf));const d=yn(bo(a)).toVar(),c=_n(of(o,u).mul(d.sub(2)).add(1)).toVar();return gn(u.greaterThan(2),()=>{c.y.addAssign(d),u.subAssign(3)}),c.x.addAssign(u.mul(d)),c.x.addAssign(l.mul(Da(3,nf))),c.y.addAssign(Da(4,bo(n).sub(d))),c.x.mulAssign(s),c.y.mulAssign(i),e.sample(c).grad(_n(),_n())}),hf=cn(({envMap:e,mipInt:t,outputDirection:r,theta:s,axis:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Co(s),l=r.mul(u).add(i.cross(r).mul(Ao(s))).add(i.mul(i.dot(r).mul(u.oneMinus())));return cf(e,l,t,n,a,o)}),pf=cn(({n:e,latitudinal:t,poleAxis:r,outputDirection:s,weights:i,samples:n,dTheta:a,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})=>{const h=Rn(Au(t,r,au(r,s))).toVar();gn(h.equal(Rn(0)),()=>{h.assign(Rn(s.z,0,s.x.negate()))}),h.assign(Ro(h));const p=Rn().toVar();return p.addAssign(i.element(0).mul(hf({theta:0,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),Bp({start:bn(1),end:e},({i:e})=>{gn(e.greaterThanEqual(n),()=>{Fp()});const t=yn(a.mul(yn(e))).toVar();p.addAssign(i.element(e).mul(hf({theta:t.mul(-1),axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),p.addAssign(i.element(e).mul(hf({theta:t,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})))}),Cn(p,1)}),gf=cn(([e])=>{const t=xn(e).toVar();return t.assign(t.shiftLeft(xn(16)).bitOr(t.shiftRight(xn(16)))),t.assign(t.bitAnd(xn(1431655765)).shiftLeft(xn(1)).bitOr(t.bitAnd(xn(2863311530)).shiftRight(xn(1)))),t.assign(t.bitAnd(xn(858993459)).shiftLeft(xn(2)).bitOr(t.bitAnd(xn(3435973836)).shiftRight(xn(2)))),t.assign(t.bitAnd(xn(252645135)).shiftLeft(xn(4)).bitOr(t.bitAnd(xn(4042322160)).shiftRight(xn(4)))),t.assign(t.bitAnd(xn(16711935)).shiftLeft(xn(8)).bitOr(t.bitAnd(xn(4278255360)).shiftRight(xn(8)))),yn(t).mul(2.3283064365386963e-10)}),mf=cn(([e,t])=>_n(yn(e).div(yn(t)),gf(e))),ff=cn(([e,t,r])=>{const s=r.mul(r).toConst(),i=Rn(1,0,0).toConst(),n=au(t,i).toConst(),a=_o(e.x).toConst(),o=Da(2,3.14159265359).mul(e.y).toConst(),u=a.mul(Co(o)).toConst(),l=a.mul(Ao(o)).toVar(),d=Da(.5,t.z.add(1)).toConst();l.assign(d.oneMinus().mul(_o(u.mul(u).oneMinus())).add(d.mul(l)));const c=i.mul(u).add(n.mul(l)).add(t.mul(_o(eu(0,u.mul(u).add(l.mul(l)).oneMinus()))));return Ro(Rn(s.mul(c.x),s.mul(c.y),eu(0,c.z)))}),yf=cn(({roughness:e,mipInt:t,envMap:r,N_immutable:s,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Rn(s).toVar(),l=Rn(0).toVar(),d=yn(0).toVar();return gn(e.lessThan(.001),()=>{l.assign(cf(r,u,t,n,a,o))}).Else(()=>{const s=Au(Vo(u.z).lessThan(.999),Rn(0,0,1),Rn(1,0,0)),c=Ro(au(s,u)).toVar(),h=au(u,c).toVar();Bp({start:xn(0),end:i},({i:s})=>{const p=mf(s,i),g=ff(p,Rn(0,0,1),e),m=Ro(c.mul(g.x).add(h.mul(g.y)).add(u.mul(g.z))),f=Ro(m.mul(nu(u,m).mul(2)).sub(u)),y=eu(nu(u,f),0);gn(y.greaterThan(0),()=>{const e=cf(r,f,t,n,a,o);l.addAssign(e.mul(y)),d.addAssign(y)})}),gn(d.greaterThan(0),()=>{l.assign(l.div(d))})}),Cn(l,1)}),bf=[.125,.215,.35,.446,.526,.582],xf=20,Tf=new Ne(-1,1,1,-1,0,1),_f=new Se(90,1),vf=new e;let Nf=null,Sf=0,Rf=0;const Ef=new r,Af=new WeakMap,wf=[3,1,5,0,4,2],Cf=lf(kl(),Vl("faceIndex")).normalize(),Mf=Rn(Cf.x,Cf.y,Cf.z);class Bf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,s=100,i={}){const{size:n=256,position:a=Ef,renderTarget:o=null}=i;if(this._setSize(n),!1===this._hasInitialized){d('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const n=o||this._allocateTarget();return i.renderTarget=n,this.fromSceneAsync(e,t,r,s,i),n}Nf=this._renderer.getRenderTarget(),Sf=this._renderer.getActiveCubeFace(),Rf=this._renderer.getActiveMipmapLevel();const u=o||this._allocateTarget();return u.depthBuffer=!0,this._init(u),this._sceneToCubeUV(e,r,s,u,a),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}async fromSceneAsync(e,t=0,r=.1,s=100,i={}){return v('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,r,s,i)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){d('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromEquirectangularAsync(e,r),r}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return v('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){d("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromCubemapAsync(e,t),r}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return v('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Df(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===U||e.mapping===I?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=bf[a-e+4-1]:0===a&&(o=0),r.push(o);const u=1/(n-2),l=-u,d=1+u,c=[l,l,d,l,d,d,l,l,d,d,l,d],h=6,p=6,g=3,m=2,f=1,y=new Float32Array(g*p*h),b=new Float32Array(m*p*h),x=new Float32Array(f*p*h);for(let e=0;e2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0],i=wf[e];y.set(s,g*p*i),b.set(c,m*p*i);const n=[i,i,i,i,i,i];x.set(n,f*p*i)}const T=new ve;T.setAttribute("position",new we(y,g)),T.setAttribute("uv",new we(b,m)),T.setAttribute("faceIndex",new we(x,f)),s.push(new oe(T,null)),i>4&&i--}return{lodMeshes:s,sizeLods:t,sigmas:r}}(t)),this._blurMaterial=function(e,t,s){const i=td(new Array(xf).fill(0)),n=Sa(new r(0,1,0)),a=Sa(0),o=yn(xf),u=Sa(0),l=Sa(1),d=Kl(),c=Sa(0),h=yn(1/t),p=yn(1/s),g=yn(e),m={n:o,latitudinal:u,weights:i,poleAxis:n,outputDirection:Mf,dTheta:a,samples:l,envMap:d,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g},f=Lf("blur");return f.fragmentNode=pf({...m,latitudinal:u.equal(1)}),Af.set(f,m),f}(t,e.width,e.height),this._ggxMaterial=function(e,t,r){const s=Kl(),i=Sa(0),n=Sa(0),a=yn(1/t),o=yn(1/r),u=yn(e),l={envMap:s,roughness:i,mipInt:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u},d=Lf("ggx");return d.fragmentNode=yf({...l,N_immutable:Mf,GGX_SAMPLES:xn(512)}),Af.set(d,l),d}(t,e.width,e.height)}}async _compileMaterial(e){const t=new oe(new ve,e);await this._renderer.compile(t,Tf)}_sceneToCubeUV(e,t,r,s,i){const n=_f;n.near=t,n.far=r;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],u=this._renderer,l=u.autoClear;u.getClearColor(vf),u.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new oe(new ae,new fe({name:"PMREM.Background",side:L,depthWrite:!1,depthTest:!1})));const d=this._backgroundBox,c=d.material;let h=!1;const p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,h=!0):(c.color.copy(vf),h=!0),u.setRenderTarget(s),u.clear(),h&&u.render(d,n);for(let t=0;t<6;t++){const r=t%3;0===r?(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x+o[t],i.y,i.z)):1===r?(n.up.set(0,0,a[t]),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y+o[t],i.z)):(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y,i.z+o[t]));const l=this._cubeSize;this._setViewport(s,r*l,t>2?l:0,l,l),u.render(e,n)}u.autoClear=l,e.background=p}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===U||e.mapping===I;s?null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(e)):null===this._equirectMaterial&&(this._equirectMaterial=Df(e));const i=s?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;const n=this._lodMeshes[0];n.material=i;const a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),r.setRenderTarget(t),r.render(n,Tf)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let t=1;tc-4?r-c+4:0),g=4*(this._cubeSize-h);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=d,o.mipInt.value=c-t,this._setViewport(i,p,g,3*h,2*h),s.setRenderTarget(i),s.render(a,Tf),i.texture.frame=(i.texture.frame||0)+1,o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=c-r,this._setViewport(e,p,g,3*h,2*h),s.setRenderTarget(e),s.render(a,Tf)}_blur(e,t,r,s,i){const n=this._pingPongRenderTarget;this._halfBlur(e,n,t,r,s,"latitudinal",i),this._halfBlur(n,e,r,r,s,"longitudinal",i)}_halfBlur(e,t,r,s,i,n,a){const u=this._renderer,l=this._blurMaterial;"latitudinal"!==n&&"longitudinal"!==n&&o("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[s];c.material=l;const h=Af.get(l),p=this._sizeLods[r]-1,g=isFinite(i)?Math.PI/(2*p):2*Math.PI/39,m=i/g,f=isFinite(i)?1+Math.floor(3*m):xf;f>xf&&d(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const y=[];let b=0;for(let e=0;ex-4?s-x+4:0),v=4*(this._cubeSize-T);this._setViewport(t,_,v,3*T,2*T),u.setRenderTarget(t),u.render(c,Tf)}_setViewport(e,t,r,s,i){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-i-r,s,i),e.scissor.set(t,e.height-i-r,s,i)):(e.viewport.set(t,r,s,i),e.scissor.set(t,r,s,i))}}function Ff(e,t){const r=new ne(e,t,{magFilter:le,minFilter:le,generateMipmaps:!1,type:Te,format:Ee,colorSpace:Re});return r.texture.mapping=Ae,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function Lf(e){const t=new vg;return t.depthTest=!1,t.depthWrite=!1,t.blending=re,t.name=`PMREM_${e}`,t}function Pf(e){const t=Lf("cubemap");return t.fragmentNode=$c(e,Mf),t}function Df(e){const t=Lf("equirect");return t.fragmentNode=Kl(e,Bg(Mf),0),t}const Uf=new WeakMap;function If(e,t,r){const s=function(e){let t=Uf.get(e);void 0===t&&(t=new WeakMap,Uf.set(e,t));return t}(t);let i=s.get(e);if((void 0!==i?i.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const r=6;for(let s=0;s0}(t))return null;i=r.fromEquirectangular(e,i)}i.pmremVersion=e.pmremVersion,s.set(e,i)}return i.texture}class Of extends gi{static get type(){return"PMREMNode"}constructor(e,t=null,r=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;const s=new N;s.isRenderTargetTexture=!0,this._texture=Kl(s),this._width=Sa(0),this._height=Sa(0),this._maxMip=Sa(0),this.updateBeforeType=ri.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const r=t?t.pmremVersion:-1,s=this._value;r!==s.pmremVersion&&(t=!0===s.isPMREMTexture?s:If(s,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new Bf(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this,e)),t=Dc.mul(Rn(t.x,t.y.negate(),t.z));let r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),df(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const Vf=an(Of).setParameterLength(1,3),kf=new WeakMap;class Gf extends Op{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:t[r.property],i=this._getPMREMNodeCache(e.renderer);let n=i.get(s);void 0===n&&(n=Vf(s),i.set(s,n)),r=n}const s=!0===t.useAnisotropy||t.anisotropy>0?_h:Sc,i=r.context(zf(Wn,s)).mul(Pc),n=r.context($f(Rc)).mul(Math.PI).mul(Pc),a=vl(i),o=vl(n);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const u=e.context.lightingModel.clearcoatRadiance;if(u){const e=r.context(zf(jn,Ec)).mul(Pc),t=vl(e);u.addAssign(t)}}_getPMREMNodeCache(e){let t=kf.get(e);return void 0===t&&(t=new WeakMap,kf.set(e,t)),t}}const zf=(e,t)=>{let r=null;return{getUV:()=>(null===r&&(r=gc.negate().reflect(t),r=du(e).mix(r,t).normalize(),r=r.transformDirection(Dd)),r),getTextureLevel:()=>e}},$f=e=>({getUV:()=>e,getTextureLevel:()=>yn(1)}),Wf=new Ce;class Hf extends vg{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Wf),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new Gf(t):null}setupLightingModel(){return new qm}setupSpecular(){const e=gu(Rn(.04),Gn.rgb,Hn);sa.assign(Rn(.04)),ia.assign(e),na.assign(1)}setupVariants(){const e=this.metalnessNode?yn(this.metalnessNode):$h;Hn.assign(e);let t=this.roughnessNode?yn(this.roughnessNode):zh;t=em({roughness:t}),Wn.assign(t),this.setupSpecular(),zn.assign(Gn.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qf=new Me;class jf extends Hf{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qf),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?yn(this.iorNode):sp;ca.assign(e),sa.assign(Jo(uu(ca.sub(1).div(ca.add(1))).mul(Vh),Rn(1)).mul(Oh)),ia.assign(gu(sa,Gn.rgb,Hn)),na.assign(gu(Oh,1,Hn))}setupLightingModel(){return new qm(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?yn(this.clearcoatNode):Hh,t=this.clearcoatRoughnessNode?yn(this.clearcoatRoughnessNode):qh;qn.assign(e),jn.assign(em({roughness:t}))}if(this.useSheen){const e=this.sheenNode?Rn(this.sheenNode):Kh,t=this.sheenRoughnessNode?yn(this.sheenRoughnessNode):Qh;Xn.assign(e),Kn.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?yn(this.iridescenceNode):Zh,t=this.iridescenceIORNode?yn(this.iridescenceIORNode):Jh,r=this.iridescenceThicknessNode?yn(this.iridescenceThicknessNode):ep;Qn.assign(e),Yn.assign(t),Zn.assign(r)}if(this.useAnisotropy){const e=(this.anisotropyNode?_n(this.anisotropyNode):Yh).toVar();ea.assign(e.length()),gn(ea.equal(0),()=>{e.assign(_n(1,0))}).Else(()=>{e.divAssign(_n(ea)),ea.assign(ea.saturate())}),Jn.assign(ea.pow2().mix(Wn.pow2(),1)),ta.assign(xh[0].mul(e.x).add(xh[1].mul(e.y))),ra.assign(xh[1].mul(e.x).sub(xh[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?yn(this.transmissionNode):tp,t=this.thicknessNode?yn(this.thicknessNode):rp,r=this.attenuationDistanceNode?yn(this.attenuationDistanceNode):ip,s=this.attenuationColorNode?Rn(this.attenuationColorNode):np;if(ha.assign(e),pa.assign(t),ga.assign(r),ma.assign(s),this.useDispersion){const e=this.dispersionNode?yn(this.dispersionNode):hp;fa.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Rn(this.clearcoatNormalNode):jh}setup(e){e.context.setupClearcoatNormal=()=>Gu(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class Xf extends qm{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1,a=!1){super(e,t,r,s,i,n),this.useSSS=a}direct({lightDirection:e,lightColor:t,reflectedLight:r},s){if(!0===this.useSSS){const i=s.material,{thicknessColorNode:n,thicknessDistortionNode:a,thicknessAmbientNode:o,thicknessAttenuationNode:u,thicknessPowerNode:l,thicknessScaleNode:d}=i,c=e.add(Sc.mul(a)).normalize(),h=yn(gc.dot(c.negate()).saturate().pow(l).mul(d)),p=Rn(h.add(o).mul(n));r.directDiffuse.addAssign(p.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:r},s)}}class Kf extends jf{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=yn(.1),this.thicknessAmbientNode=yn(0),this.thicknessAttenuationNode=yn(.1),this.thicknessPowerNode=yn(2),this.thicknessScaleNode=yn(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new Xf(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const Qf=cn(({normal:e,lightDirection:t,builder:r})=>{const s=e.dot(t),i=_n(s.mul(.5).add(.5),0);if(r.material.gradientMap){const e=Kc("gradientMap","texture").context({getUV:()=>i});return Rn(e.r)}{const e=i.fwidth().mul(.5);return gu(Rn(.7),Rn(1),bu(yn(.7).sub(e.x),yn(.7).add(e.x),i.x))}});class Yf extends kg{direct({lightDirection:e,lightColor:t,reflectedLight:r},s){const i=Qf({normal:xc,lightDirection:e,builder:s}).mul(t);r.directDiffuse.addAssign(i.mul(Hg({diffuseColor:Gn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Zf=new Be;class Jf extends vg{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Zf),this.setValues(e)}setupLightingModel(){return new Yf}}const ey=cn(()=>{const e=Rn(gc.z,0,gc.x.negate()).normalize(),t=gc.cross(e);return _n(e.dot(Sc),t.dot(Sc)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),ty=new Fe;class ry extends vg{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(ty),this.setValues(e)}setupVariants(e){const t=ey;let r;r=e.material.matcap?Kc("matcap","texture").context({getUV:()=>t}):Rn(gu(.2,.8,t.y)),Gn.rgb.mulAssign(r.rgb)}}class sy extends gi{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:r}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),s=t.sin();return Ln(e,s,s.negate(),e).mul(r)}{const e=t,s=Dn(Cn(1,0,0,0),Cn(0,Co(e.x),Ao(e.x).negate(),0),Cn(0,Ao(e.x),Co(e.x),0),Cn(0,0,0,1)),i=Dn(Cn(Co(e.y),0,Ao(e.y),0),Cn(0,1,0,0),Cn(Ao(e.y).negate(),0,Co(e.y),0),Cn(0,0,0,1)),n=Dn(Cn(Co(e.z),Ao(e.z).negate(),0,0),Cn(Ao(e.z),Co(e.z),0,0),Cn(0,0,1,0),Cn(0,0,0,1));return s.mul(i).mul(n).mul(Cn(r,1)).xyz}}}const iy=an(sy).setParameterLength(2),ny=new Le;class ay extends vg{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(ny),this.setValues(e)}setupPositionView(e){const{object:t,camera:r}=e,{positionNode:s,rotationNode:i,scaleNode:n,sizeAttenuation:a}=this,o=sc.mul(Rn(s||0));let u=_n(Qd[0].xyz.length(),Qd[1].xyz.length());null!==n&&(u=u.mul(_n(n))),r.isPerspectiveCamera&&!1===a&&(u=u.mul(o.z.negate()));let l=uc.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,r)=>new Zu(e,t,r))("center","vec2",t);l=l.sub(e.sub(.5))}l=l.mul(u);const d=yn(i||Xh),c=iy(l,d);return Cn(o.xy.add(c),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const oy=new Pe,uy=new t;class ly extends ay{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(oy),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return sc.mul(Rn(e||lc)).xyz}setupVertexSprite(e){const{material:t,camera:r}=e,{rotationNode:s,scaleNode:i,sizeNode:n,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let u=null!==n?_n(n):cp;u=u.mul(od),r.isPerspectiveCamera&&!0===a&&(u=u.mul(dy.div(pc.z.negate()))),i&&i.isNode&&(u=u.mul(_n(i)));let l=uc.xy;if(s&&s.isNode){const e=yn(s);l=iy(l,e)}return l=l.mul(u),l=l.div(hd.div(2)),l=l.mul(o.w),o=o.add(Cn(l,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const dy=Sa(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(uy);this.value=.5*t.y});class cy extends kg{constructor(){super(),this.shadowNode=yn(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Gn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Gn.rgb)}}const hy=new De;class py extends vg{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(hy),this.setValues(e)}setupLightingModel(){return new cy}}const gy=Vn("vec3"),my=Vn("vec3"),fy=Vn("vec3");class yy extends kg{constructor(){super()}start(e){const{material:t}=e,r=Vn("vec3"),s=Vn("vec3");gn(Od.sub(cc).length().greaterThan(ec.mul(2)),()=>{r.assign(Od),s.assign(cc)}).Else(()=>{r.assign(cc),s.assign(Od)});const i=s.sub(r),n=Sa("int").onRenderUpdate(({material:e})=>e.steps),a=i.length().div(n).toVar(),o=i.normalize().toVar(),u=yn(0).toVar(),l=Rn(1).toVar();t.offsetNode&&u.addAssign(t.offsetNode.mul(a)),Bp(n,()=>{const s=r.add(o.mul(u)),i=Dd.mul(Cn(s,1)).xyz;let n;null!==t.depthNode&&(my.assign(og(tg(i.z,Bd,Fd))),e.context.sceneDepthNode=og(t.depthNode).toVar()),e.context.positionWorld=s,e.context.shadowPositionWorld=s,e.context.positionView=i,gy.assign(0),t.scatteringNode&&(n=t.scatteringNode({positionRay:s})),super.start(e),n&&gy.mulAssign(n);const d=gy.mul(.01).negate().mul(a).exp();l.mulAssign(d),u.addAssign(a)}),fy.addAssign(l.saturate().oneMinus())}scatteringLight(e,t){const r=t.context.sceneDepthNode;r?gn(r.greaterThanEqual(my),()=>{gy.addAssign(e)}):gy.addAssign(e)}direct({lightNode:e,lightColor:t},r){if(void 0===e.light.distance)return;const s=t.xyz.toVar();s.mulAssign(e.shadowNode),this.scatteringLight(s,r)}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s},i){const n=t.add(r).sub(s),a=t.sub(r).sub(s),o=t.sub(r).add(s),u=t.add(r).add(s),l=i.context.positionView,d=e.xyz.mul(Tm({P:l,p0:n,p1:a,p2:o,p3:u})).pow(1.5);this.scatteringLight(d,i)}finish(e){e.context.outgoingLight.assign(fy)}}class by extends vg{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=L,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new yy}}class xy{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){null!==this._context&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Ty{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let r=this.weakMaps[t];return void 0===r&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],s=new Set,i={};for(const n of e){let e;if(n.node&&n.node.attribute?e=n.node.attribute:(e=t.getAttribute(n.name),i[n.name]=e.id),void 0===e)continue;r.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;s.add(a)}return this.attributes=r,this.attributesId=i,this.vertexBuffers=Array.from(s.values()),r}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:r,group:s,drawRange:i}=this,n=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let u=1;if(!0===r.isInstancedBufferGeometry?u=r.instanceCount:void 0!==e.count&&(u=Math.max(0,e.count)),0===u)return null;if(n.instanceCount=u,!0===e.isBatchedMesh)return n;let l=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(l=2);let d=i.start*l,c=(i.start+i.count)*l;null!==s&&(d=Math.max(d,s.start*l),c=Math.min(c,(s.start+s.count)*l));const h=r.attributes.position;let p=1/0;o?p=a.count:null!=h&&(p=h.count),d=Math.max(d,0),c=Math.min(c,p);const g=c-d;return g<0||g===1/0?null:(n.vertexCount=g,n.firstVertex=d,n)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const r of Object.keys(e.attributes).sort()){const s=e.attributes[r];t+=r+",",s.data&&(t+=s.data.stride+","),s.offset&&(t+=s.offset+","),s.itemSize&&(t+=s.itemSize+","),s.normalized&&(t+="n,")}for(const r of Object.keys(e.morphAttributes).sort()){const s=e.morphAttributes[r];t+="morph-"+r+",";for(let e=0,r=s.length;e1||Array.isArray(e.morphTargetInfluences))&&(s+=e.uuid+","),s+=this.context.id+",",s+=e.receiveShadow+",",Vs(s)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const r=this.geometry.getAttribute(t);if(void 0===r||e[t]!==r.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Gs(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Gs(e,1)),e=Gs(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const Ny=[];class Sy{constructor(e,t,r,s,i,n){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=s,this.bindings=i,this.info=n,this.chainMaps={}}get(e,t,r,s,i,n,a,o){const u=this.getChainMap(o);Ny[0]=e,Ny[1]=t,Ny[2]=n,Ny[3]=i;let l=u.get(Ny);return void 0===l?(l=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,s,i,n,a,o),u.set(Ny,l)):(l.camera=s,l.updateClipping(a),l.needsGeometryUpdate&&l.setGeometry(e.geometry),(l.version!==t.version||l.needsUpdate)&&(l.initialCacheKey!==l.getCacheKey()?(l.dispose(),l=this.get(e,t,r,s,i,n,a,o)):l.version=t.version)),Ny[0]=null,Ny[1]=null,Ny[2]=null,Ny[3]=null,l}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ty)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,s,i,n,a,o,u,l,d){const c=this.getChainMap(d),h=new vy(e,t,r,s,i,n,a,o,u,l);return h.onDispose=()=>{this.pipelines.delete(h),this.bindings.deleteForRender(h),this.nodes.delete(h),c.delete(h.getChainArray())},h}}class Ry{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const Ey=1,Ay=2,wy=3,Cy=4,My=16;class By extends Ry{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){const t=super.delete(e);return null!==t&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){const r=this.get(e);if(void 0===r.version)t===Ey?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Ay?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===wy?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Cy&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),r.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(r.version=65535?Ue:Ie)(t,1);return i.version=Fy(e),i.__id=Ly(e),i}class Dy extends Ry{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;const r=()=>{this.info.memory.geometries--;const s=t.index,i=e.getAttributes();null!==s&&this.attributes.delete(s);for(const e of i)this.attributes.delete(e);const n=this.wireframes.get(t);void 0!==n&&this.attributes.delete(n),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){const t=e.getAttributes();for(const e of t)e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute?this.updateAttribute(e,wy):this.updateAttribute(e,Ey);const r=this.getIndex(e);null!==r&&this.updateAttribute(r,Ay);const s=e.geometry.indirect;null!==s&&this.updateAttribute(s,Cy)}updateAttribute(e,t){const r=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:r}=e;let s=t.index;if(!0===r.wireframe){const e=this.wireframes;let r=e.get(t);void 0===r?(r=Py(t),e.set(t,r)):r.version===Fy(t)&&r.__id===Ly(t)||(this.attributes.delete(r),r=Py(t),e.set(t,r)),s=r}return s}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class Uy{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0,attributes:0,indexAttributes:0,storageAttributes:0,indirectStorageAttributes:0,readbackBuffers:0,programs:0,renderTargets:0,total:0,texturesSize:0,attributesSize:0,indexAttributesSize:0,storageAttributesSize:0,indirectStorageAttributesSize:0,readbackBuffersSize:0,programsSize:0},this.memoryMap=new Map}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=r*(t/3):e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=r*(t/2):e.isLine?this.render.lines+=r*(t-1):o("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(const e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){const t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){const r=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:r,type:t}),this.memory[t]++,this.memory.total+=r,this.memory[t+"Size"]+=r}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){const t=this._getAttributeMemorySize(e.attribute);this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){this.destroyAttribute(e)}createProgram(e){const t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oe||e.type===Ve?t=1:e.type===ke||e.type===Ge||e.type===Te?t=2:e.type!==R&&e.type!==S&&e.type!==K||(t=4);let r=4;e.format===ze||e.format===$e||e.format===We||e.format===He||e.format===qe?r=1:e.format===$||e.format===je?r=2:e.format!==Xe&&e.format!==Ke||(r=3);let s=t*r;e.type===Qe||e.type===Ye?s=2:e.type!==Ze&&e.type!==Je&&e.type!==et||(s=4);const i=e.width||1,n=e.height||1,a=e.isCubeTexture?6:e.depth||1;let o=i*n*a*s;const u=e.mipmaps;if(u&&u.length>0){let e=0;for(let t=0;t>t))*(r.height||Math.max(1,n>>t))*a*s}}o+=e}else e.generateMipmaps&&(o*=1.333);return Math.round(o)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}}class Iy{constructor(e){this.cacheKey=e,this.usedTimes=0}}class Oy extends Iy{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}}class Vy extends Iy{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let ky=0;class Gy{constructor(e,t,r,s=null,i=null){this.id=ky++,this.code=e,this.stage=t,this.name=r,this.transforms=s,this.attributes=i,this.usedTimes=0}}class zy extends Ry{constructor(e,t,r){super(),this.backend=e,this.nodes=t,this.info=r,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:r}=this,s=this.get(e);if(this._needsComputeUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.computeProgram.usedTimes--);const n=this.nodes.getForCompute(e);let a=this.programs.compute.get(n.computeShader);void 0===a&&(i&&0===i.computeProgram.usedTimes&&this._releaseProgram(i.computeProgram),a=new Gy(n.computeShader,"compute",e.name,n.transforms,n.nodeAttributes),this.programs.compute.set(n.computeShader,a),r.createProgram(a),this.info.createProgram(a));const o=this._getComputeCacheKey(e,a);let u=this.caches.get(o);void 0===u&&(i&&0===i.usedTimes&&this._releasePipeline(i),u=this._getComputePipeline(e,a,o,t)),u.usedTimes++,a.usedTimes++,s.version=e.version,s.pipeline=u}return s.pipeline}getForRender(e,t=null){const{backend:r}=this,s=this.get(e);if(this._needsRenderUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.vertexProgram.usedTimes--,i.fragmentProgram.usedTimes--);const n=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(n.vertexShader);void 0===o&&(i&&0===i.vertexProgram.usedTimes&&this._releaseProgram(i.vertexProgram),o=new Gy(n.vertexShader,"vertex",a),this.programs.vertex.set(n.vertexShader,o),r.createProgram(o),this.info.createProgram(o));let u=this.programs.fragment.get(n.fragmentShader);void 0===u&&(i&&0===i.fragmentProgram.usedTimes&&this._releaseProgram(i.fragmentProgram),u=new Gy(n.fragmentShader,"fragment",a),this.programs.fragment.set(n.fragmentShader,u),r.createProgram(u),this.info.createProgram(u));const l=this._getRenderCacheKey(e,o,u);let d=this.caches.get(l);void 0===d?(i&&0===i.usedTimes&&this._releasePipeline(i),d=this._getRenderPipeline(e,o,u,l,t)):e.pipeline=d,d.usedTimes++,o.usedTimes++,u.usedTimes++,s.pipeline=d}return s.pipeline}isReady(e){const t=this.get(e).pipeline;if(void 0===t)return!1;const r=this.backend.get(t);return void 0!==r.pipeline&&null!==r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,s){r=r||this._getComputeCacheKey(e,t);let i=this.caches.get(r);return void 0===i&&(i=new Vy(r,t),this.caches.set(r,i),this.backend.createComputePipeline(i,s)),i}_getRenderPipeline(e,t,r,s,i){s=s||this._getRenderCacheKey(e,t,r);let n=this.caches.get(s);return void 0===n&&(n=new Oy(s,t,r),this.caches.set(s,n),e.pipeline=n,this.backend.createRenderPipeline(e,i)),n}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,r){return t.id+","+r.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,r=e.stage;this.programs[r].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){const t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class $y extends Ry{constructor(e,t,r,s,i,n){super(),this.backend=e,this.textures=r,this.pipelines=i,this.attributes=s,this.nodes=t,this.info=n,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}deleteForRender(e){const t=e.getBindings();for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const e=t.attribute,r=e.isIndirectStorageBufferAttribute?Cy:wy;this.attributes.update(e,r)}}_update(e,t){const{backend:r}=this;let s=!1,i=!0,n=0,a=0;for(const t of e.bindings){if(!1!==this.nodes.updateGroup(t)){if(t.isStorageBuffer){const e=t.attribute,i=e.isIndirectStorageBufferAttribute?Cy:wy,n=r.get(t);this.attributes.update(e,i),n.attribute!==e&&(n.attribute=e,s=!0)}if(t.isUniformBuffer){t.update()&&r.updateBinding(t)}else if(t.isSampledTexture){const o=t.update(),u=t.texture,l=this.textures.get(u);o&&(this.textures.updateTexture(u),t.generation!==l.generation&&(t.generation=l.generation,s=!0),l.bindGroups.add(e));if(void 0!==r.get(u).externalTexture||l.isDefaultTexture?i=!1:(n=10*n+u.id,a+=u.version),!0===u.isStorageTexture&&!0===u.mipmapsAutoUpdate){const e=this.get(u);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(u)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(u),e.needsMipmap=!1)}}else if(t.isSampler){if(t.update()){const e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,s=!0)}}t.isBuffer&&t.updateRanges.length>0&&t.clearUpdateRanges()}}!0===s&&this.backend.updateBindings(e,t,i?n:0,a)}}function Wy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function Hy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function qy(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&e.side===P&&!1===e.forceSinglePass}class jy{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,r),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,s,i,n,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:s,renderOrder:e.renderOrder,z:i,group:n,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=s,o.renderOrder=e.renderOrder,o.z=i,o.group=n,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Wy),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Hy),this.transparent.length>1&&this.transparent.sort(t||Hy)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,u=a.height>>t;let l=e.depthTexture||i[t];const d=!0===e.depthBuffer||!0===e.stencilBuffer;let c=!1;void 0===l&&d&&(l=new Z,l.format=e.stencilBuffer?qe:He,l.type=e.stencilBuffer?Ze:S,l.image.width=o,l.image.height=u,l.image.depth=a.depth,l.renderTarget=e,l.isArrayTexture=!0===e.multiview&&a.depth>1,i[t]=l),r.width===a.width&&a.height===r.height||(c=!0,l&&(l.needsUpdate=!0,l.image.width=o,l.image.height=u,l.image.depth=l.isArrayTexture?l.image.depth:1)),r.width=a.width,r.height=a.height,r.textures=n,r.depthTexture=l||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==s&&(c=!0,l&&(l.needsUpdate=!0),r.sampleCount=s);const h={sampleCount:s};if(!0!==e.isXRRenderTarget){for(let e=0;e{this._destroyRenderTarget(e)},e.addEventListener("dispose",r.onDispose))}updateTexture(e,t={}){const r=this.get(e);if(!0===r.initialized&&r.version===e.version)return;const s=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,i=this.backend;if(s&&!0===r.initialized&&i.destroyTexture(e),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:Ve}const{width:n,height:a,depth:o}=this.getSize(e);if(t.width=n,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,n,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,s||!0===e.isStorageTexture||!0===e.isExternalTexture)i.createTexture(e,t),r.generation=e.version;else if(e.version>0){const s=e.image;if(void 0===s)d("Renderer: Texture marked for update but image is undefined.");else if(!1===s.complete)d("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const r=[];for(const t of e.images)r.push(t);t.images=r}else t.image=s;void 0!==r.isDefaultTexture&&!0!==r.isDefaultTexture||(i.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),!0===e.source.dataReady&&i.updateTexture(e,t);const n=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!n&&i.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else i.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;!0!==r.initialized&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&!0===p.enabled&&p.getTransfer(e.colorSpace)!==g&&d("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=eb){let r=e.images?e.images[0]:e.image;return r?(void 0!==r.image&&(r=r.image),"undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):"undefined"!=typeof VideoFrame&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){let s;return s=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,r)))+1,s}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){const t=this.get(e),r=t.textures,s=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e=2)for(let r=0;r{if(this._currentNode=t,!t.isVarNode||!t.isIntent(e)||!0===t.isAssign(e))if("setup"===s)t.build(e);else if("analyze"===s)t.build(e,this);else if("generate"===s){const r=e.getDataFromNode(t,"any").stages,s=r&&r[e.shaderStage];if(t.isVarNode&&s&&1===s.length&&s[0]&&s[0].isStackNode)return;t.build(e,"void")}},n=[...this.nodes];for(const e of n)i(e);this._currentNode=null;const a=this.nodes.filter(e=>-1===n.indexOf(e));for(const e of a)i(e);let o;return o=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),hn(r),e.removeActiveStack(this),o}}const nb=an(ib).setParameterLength(0,1);class ab extends ci{static get type(){return"StructTypeNode"}constructor(e,t=null){var r;super("struct"),this.membersLayout=(r=e,Object.entries(r).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,r=0;for(const s of this.membersLayout){const i=s.type,n=js(i),a=Xs(i)/e;t=Math.max(t,a);const o=r%t%a;0!==o&&(r+=a-o),r+=n}return Math.ceil(r/t)*t}getMemberType(e,t){const r=this.membersLayout.find(e=>e.name===t);return r?r.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class ob extends ci{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),r=t.type,s=e.getPropertyName(t);return e.addLineFlowCode(`${s} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class ub extends ci{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(void 0===t.membersLayout){const r=this.members,s=[];for(let t=0;tnew fb(e,"uint","float"),xb={};class Tb extends no{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,r){"int"===r?t.assign(yb(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return xn;case"int":return bn;case"uvec2":return Nn;case"uvec3":return An;case"uvec4":return Bn;case"ivec2":return vn;case"ivec3":return En;case"ivec4":return Mn}}_createTrailingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t);const i=yn(s.bitAnd(zo(s))),n=bb(i).shiftRight(23).sub(127);return r(n)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{gn(e.equal(xn(0)),()=>xn(32));const s=xn(0),i=xn(0);return this._resolveElementType(e,s,t),gn(s.shiftRight(16).equal(0),()=>{i.addAssign(16),s.shiftLeftAssign(16)}),gn(s.shiftRight(24).equal(0),()=>{i.addAssign(8),s.shiftLeftAssign(8)}),gn(s.shiftRight(28).equal(0),()=>{i.addAssign(4),s.shiftLeftAssign(4)}),gn(s.shiftRight(30).equal(0),()=>{i.addAssign(2),s.shiftLeftAssign(2)}),gn(s.shiftRight(31).equal(0),()=>{i.addAssign(1)}),r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t),s.assign(s.sub(s.shiftRight(xn(1)).bitAnd(xn(1431655765)))),s.assign(s.bitAnd(xn(858993459)).add(s.shiftRight(xn(2)).bitAnd(xn(858993459))));const i=s.add(s.shiftRight(xn(4))).bitAnd(xn(252645135)).mul(xn(16843009)).shiftRight(xn(24));return r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,r,s){const i=this._returnDataNode(t);return cn(([e])=>{if(1===r)return i(s(e));{const t=i(0),n=["x","y","z","w"];for(let i=0;id(r))()}}Tb.COUNT_TRAILING_ZEROS="countTrailingZeros",Tb.COUNT_LEADING_ZEROS="countLeadingZeros",Tb.COUNT_ONE_BITS="countOneBits";const _b=un(Tb,Tb.COUNT_TRAILING_ZEROS).setParameterLength(1),vb=un(Tb,Tb.COUNT_LEADING_ZEROS).setParameterLength(1),Nb=un(Tb,Tb.COUNT_ONE_BITS).setParameterLength(1),Sb=cn(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return r.shiftRight(22).bitXor(r).toFloat().mul(1/2**32)}),Rb=(e,t)=>ou(Da(4,e.mul(Pa(1,e))),t);class Eb extends gi{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const Ab=un(Eb,"snorm").setParameterLength(1),wb=un(Eb,"unorm").setParameterLength(1),Cb=un(Eb,"float16").setParameterLength(1);class Mb extends gi{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const Bb=un(Mb,"snorm").setParameterLength(1),Fb=un(Mb,"unorm").setParameterLength(1),Lb=un(Mb,"float16").setParameterLength(1),Pb=cn(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Db=cn(([e])=>Rn(Pb(e.z.add(Pb(e.y.mul(1)))),Pb(e.z.add(Pb(e.x.mul(1)))),Pb(e.y.add(Pb(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ub=cn(([e,t,r])=>{const s=Rn(e).toVar(),i=yn(1.4).toVar(),n=yn(0).toVar(),a=Rn(s).toVar();return Bp({start:yn(0),end:yn(3),type:"float",condition:"<="},()=>{const e=Rn(Db(a.mul(2))).toVar();s.addAssign(e.add(r.mul(yn(.1).mul(t)))),a.mulAssign(1.8),i.mulAssign(1.5),s.mulAssign(1.2);const o=yn(Pb(s.z.add(Pb(s.x.add(Pb(s.y)))))).toVar();n.addAssign(o.div(i)),a.addAssign(.14)}),n}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Ib extends ci{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let r=this._candidateFn;if(null===r){let s=null,i=-1;for(const r of this.functionNodes){const n=r.shaderNode.layout;if(null===n)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=n.inputs;if(t.length===a.length){let n=0;for(let r=0;ri&&(s=r,i=n)}}this._candidateFn=r=s}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const Ob=an(Ib),Vb=e=>(...t)=>Ob(e,...t),kb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.time),Gb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.deltaTime),zb=Sa(0,"uint").setGroup(_a).onRenderUpdate(e=>e.frameId);const $b=cn(([e,t,r=_n(.5)])=>iy(e.sub(r),t).add(r)),Wb=cn(([e,t,r=_n(.5)])=>{const s=e.sub(r),i=s.dot(s),n=i.mul(i).mul(t);return e.add(s.mul(n))}),Hb=cn(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let s;null!==e?(s=Qd.toVar(),s[3][0]=e.x,s[3][1]=e.y,s[3][2]=e.z):s=Qd;const i=Dd.mul(s);return Zi(t)&&(i[0][0]=Qd[0].length(),i[0][1]=0,i[0][2]=0),Zi(r)&&(i[1][0]=0,i[1][1]=Qd[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,Ld.mul(i).mul(lc)}),qb=cn(([e=null])=>{const t=og();return og(Yp(e)).sub(t).lessThan(0).select(ud,e)}),jb=cn(([e,t=kl(),r=yn(0)])=>{const s=e.x,i=e.y,n=r.mod(s.mul(i)).floor(),a=n.mod(s),o=i.sub(n.add(1).div(s).ceil()),u=e.reciprocal(),l=_n(a,o);return t.add(l).mul(u)}),Xb=cn(([e,t=null,r=null,s=yn(1),i=lc,n=Tc])=>{let a=n.abs().normalize();a=a.div(a.dot(Rn(1)));const o=i.yz.mul(s),u=i.zx.mul(s),l=i.xy.mul(s),d=e.value,c=null!==t?t.value:d,h=null!==r?r.value:d,p=Kl(d,o).mul(a.x),g=Kl(c,u).mul(a.y),m=Kl(h,l).mul(a.z);return La(p,g,m)}),Kb=new ut,Qb=new r,Yb=new r,Zb=new r,Jb=new a,ex=new r(0,0,-1),tx=new s,rx=new r,sx=new r,ix=new s,nx=new t,ax=new ne,ox=ud.flipX();ax.depthTexture=new Z(1,1);let ux=!1;class lx extends jl{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||ax.texture,ox),this._reflectorBaseNode=e.reflector||new dx(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new lx({defaultTexture:ax.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class dx extends ci{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:r=new at,resolutionScale:s=1,generateMipmaps:i=!1,bounces:n=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=s,void 0!==t.resolution&&(v('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=n,this.depth=a,this.samples=o,this.updateBeforeType=n?ri.RENDER:ri.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const r=this.resolutionScale;t.getDrawingBufferSize(nx),e.setSize(Math.round(nx.width*r),Math.round(nx.height*r))}setup(e){return this._updateResolution(ax,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new ne(0,0,{type:Te,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=ot,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new Z),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&ux)return!1;ux=!0;const{scene:t,camera:r,renderer:s,material:i}=e,{target:n}=this,a=this.getVirtualCamera(r),o=this.getRenderTarget(a);s.getDrawingBufferSize(nx),this._updateResolution(o,s),Yb.setFromMatrixPosition(n.matrixWorld),Zb.setFromMatrixPosition(r.matrixWorld),Jb.extractRotation(n.matrixWorld),Qb.set(0,0,1),Qb.applyMatrix4(Jb),rx.subVectors(Yb,Zb);let u=!1;if(!0===rx.dot(Qb)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(ux=!1);u=!0}rx.reflect(Qb).negate(),rx.add(Yb),Jb.extractRotation(r.matrixWorld),ex.set(0,0,-1),ex.applyMatrix4(Jb),ex.add(Zb),sx.subVectors(Yb,ex),sx.reflect(Qb).negate(),sx.add(Yb),a.coordinateSystem=r.coordinateSystem,a.position.copy(rx),a.up.set(0,1,0),a.up.applyMatrix4(Jb),a.up.reflect(Qb),a.lookAt(sx),a.near=r.near,a.far=r.far,a.updateMatrixWorld(),a.projectionMatrix.copy(r.projectionMatrix),Kb.setFromNormalAndCoplanarPoint(Qb,Yb),Kb.applyMatrix4(a.matrixWorldInverse),tx.set(Kb.normal.x,Kb.normal.y,Kb.normal.z,Kb.constant);const l=a.projectionMatrix;ix.x=(Math.sign(tx.x)+l.elements[8])/l.elements[0],ix.y=(Math.sign(tx.y)+l.elements[9])/l.elements[5],ix.z=-1,ix.w=(1+l.elements[10])/l.elements[14],tx.multiplyScalar(1/tx.dot(ix));l.elements[2]=tx.x,l.elements[6]=tx.y,l.elements[10]=s.coordinateSystem===h?tx.z-0:tx.z+1-0,l.elements[14]=tx.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),i.visible=!1;const d=s.getRenderTarget(),c=s.getMRT(),p=s.autoClear;s.setMRT(null),s.setRenderTarget(o),s.autoClear=!0;const g=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(s.clear(),this.hasOutput=!1):(s.render(t,a),this.hasOutput=!0),t.name=g,s.setMRT(c),s.setRenderTarget(d),s.autoClear=p,i.visible=!0,ux=!1,this.forceUpdate=!1}get resolution(){return v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const cx=new Ne(-1,1,1,-1,0,1);class hx extends ve{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new lt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lt(t,2))}}const px=new hx;class gx extends oe{constructor(e=null){super(px,e),this.camera=cx,this.isQuadMesh=!0}async renderAsync(e){v('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,cx)}render(e){e.render(this,cx)}}const mx=new t;class fx extends jl{static get type(){return"RTTNode"}constructor(e,t=null,r=null,s={type:Te}){const i=new ne(t,r,s);super(i.texture,kl()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new gx(new vg),this.updateBeforeType=ri.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const r=e*this.pixelRatio,s=t*this.pixelRatio;this.renderTarget.setSize(r,s),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),r=e.getSize(mx),s=Math.floor(r.width*t),i=Math.floor(r.height*t);s===this.renderTarget.width&&i===this.renderTarget.height||(this.renderTarget.setSize(s,i),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(r)}clone(){const e=new jl(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yx=(e,...t)=>new fx(tn(e),...t),bx=cn(([e,t,r],s)=>{let i;s.renderer.coordinateSystem===h?(e=_n(e.x,e.y.oneMinus()).mul(2).sub(1),i=Cn(Rn(e,t),1)):i=Cn(Rn(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const n=Cn(r.mul(i));return n.xyz.div(n.w)}),xx=cn(([e,t])=>{const r=t.mul(Cn(e,1)),s=r.xy.div(r.w).mul(.5).add(.5).toVar();return _n(s.x,s.y.oneMinus())}),Tx=cn(([e,t,r])=>{const s=zl(Ql(t)),i=vn(e.mul(s)).toVar(),n=Ql(t,i).toVar(),a=Ql(t,i.sub(vn(2,0))).toVar(),o=Ql(t,i.sub(vn(1,0))).toVar(),u=Ql(t,i.add(vn(1,0))).toVar(),l=Ql(t,i.add(vn(2,0))).toVar(),d=Ql(t,i.add(vn(0,2))).toVar(),c=Ql(t,i.add(vn(0,1))).toVar(),h=Ql(t,i.sub(vn(0,1))).toVar(),p=Ql(t,i.sub(vn(0,2))).toVar(),g=Vo(Pa(yn(2).mul(o).sub(a),n)).toVar(),m=Vo(Pa(yn(2).mul(u).sub(l),n)).toVar(),f=Vo(Pa(yn(2).mul(c).sub(d),n)).toVar(),y=Vo(Pa(yn(2).mul(h).sub(p),n)).toVar(),b=bx(e,n,r).toVar(),x=g.lessThan(m).select(b.sub(bx(e.sub(_n(yn(1).div(s.x),0)),o,r)),b.negate().add(bx(e.add(_n(yn(1).div(s.x),0)),u,r))),T=f.lessThan(y).select(b.sub(bx(e.add(_n(0,yn(1).div(s.y))),c,r)),b.negate().add(bx(e.sub(_n(0,yn(1).div(s.y))),h,r)));return Ro(au(x,T))}),_x=cn(([e])=>Eo(yn(52.9829189).mul(Eo(nu(e,_n(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),vx=cn(([e,t,r])=>{const s=yn(2.399963229728653),i=_o(yn(e).add(.5).div(yn(t))),n=yn(e).mul(s).add(r);return _n(Co(n),Ao(n)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class Nx extends ci{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(kl())}sample(e){return this.callback(e)}}class Sx extends ci{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Sx.OBJECT?this.updateType=ri.OBJECT:e===Sx.MATERIAL?this.updateType=ri.RENDER:e===Sx.BEFORE_OBJECT?this.updateBeforeType=ri.OBJECT:e===Sx.BEFORE_MATERIAL&&(this.updateBeforeType=ri.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Sx.OBJECT="object",Sx.MATERIAL="material",Sx.BEFORE_OBJECT="beforeObject",Sx.BEFORE_MATERIAL="beforeMaterial";const Rx=(e,t)=>new Sx(e,t).toStack();class Ex extends q{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class Ax extends we{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageBufferAttribute=!0}}class wx extends ci{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Cx=on(wx),Mx=new a,Bx=Sa(0).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Fx=Sa(1).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Lx=Sa(new a).setGroup(_a).onRenderUpdate(({scene:e})=>{const t=e.background;return null!==t&&t.isTexture&&t.mapping!==dt?Mx.makeRotationFromEuler(e.backgroundRotation).transpose():Mx.identity(),Mx});class Px extends jl{static get type(){return"StorageTextureNode"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=ii.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return null!==this.storeNode?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;return e.generateStorageTextureLoad(l,t,r,s,n,u)}toReadWrite(){return this.setAccess(ii.READ_WRITE)}toReadOnly(){return this.setAccess(ii.READ_ONLY)}toWriteOnly(){return this.setAccess(ii.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:r,storeNode:s,depthNode:i}=t,n=super.generate(e,"property"),a=r.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=s.build(e,"vec4"),u=i?i.build(e,"int"):null,l=e.generateTextureStore(this.value,n,a,u,o);e.addLineFlowCode(l,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const Dx=an(Px).setParameterLength(1,3),Ux=cn(({texture:e,uv:t})=>{const r=1e-4,s=Rn().toVar();return gn(t.x.lessThan(r),()=>{s.assign(Rn(1,0,0))}).ElseIf(t.y.lessThan(r),()=>{s.assign(Rn(0,1,0))}).ElseIf(t.z.lessThan(r),()=>{s.assign(Rn(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{s.assign(Rn(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{s.assign(Rn(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{s.assign(Rn(0,0,-1))}).Else(()=>{const r=.01,i=e.sample(t.add(Rn(-.01,0,0))).r.sub(e.sample(t.add(Rn(r,0,0))).r),n=e.sample(t.add(Rn(0,-.01,0))).r.sub(e.sample(t.add(Rn(0,r,0))).r),a=e.sample(t.add(Rn(0,0,-.01))).r.sub(e.sample(t.add(Rn(0,0,r))).r);s.assign(Rn(i,n,a))}),s.normalize()});class Ix extends jl{static get type(){return"Texture3DNode"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Rn(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Ux({texture:this,uv:e})}}const Ox=an(Ix).setParameterLength(1,3);class Vx extends Hc{static get type(){return"UserDataNode"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const kx=new WeakMap;class Gx extends gi{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=ri.OBJECT,this.updateAfterType=ri.OBJECT,this.previousModelWorldMatrix=Sa(new a),this.previousProjectionMatrix=Sa(new a).setGroup(_a),this.previousCameraViewMatrix=Sa(new a)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){const s=$x(r);this.previousModelWorldMatrix.value.copy(s);const i=zx(t);i.frameId!==e&&(i.frameId=e,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new a,i.previousCameraViewMatrix=new a,i.currentProjectionMatrix=new a,i.currentCameraViewMatrix=new a,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){$x(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?Ld:Sa(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(sc).mul(lc),s=this.previousProjectionMatrix.mul(t).mul(dc),i=r.xy.div(r.w),n=s.xy.div(s.w);return Pa(i,n)}}function zx(e){let t=kx.get(e);return void 0===t&&(t={},kx.set(e,t)),t}function $x(e,t=0){const r=zx(e);let s=r[t];return void 0===s&&(r[t]=s=new a,r[t].copy(e.matrixWorld)),s}const Wx=on(Gx),Hx=cn(([e])=>Kx(e.rgb)),qx=cn(([e,t=yn(1)])=>t.mix(Kx(e.rgb),e.rgb)),jx=cn(([e,t=yn(1)])=>{const r=La(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return gu(e.rgb,s,i)}),Xx=cn(([e,t=yn(1)])=>{const r=Rn(.57735,.57735,.57735),s=t.cos();return Rn(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(nu(r,e.rgb).mul(s.oneMinus())))))}),Kx=(e,t=Rn(p.getLuminanceCoefficients(new r)))=>nu(e,t),Qx=cn(([e,t=Rn(1),s=Rn(0),i=Rn(1),n=yn(1),a=Rn(p.getLuminanceCoefficients(new r,Re))])=>{const o=e.rgb.dot(Rn(a)),u=eu(e.rgb.mul(t).add(s),0).toVar(),l=u.pow(i).toVar();return gn(u.r.greaterThan(0),()=>{u.r.assign(l.r)}),gn(u.g.greaterThan(0),()=>{u.g.assign(l.g)}),gn(u.b.greaterThan(0),()=>{u.b.assign(l.b)}),u.assign(o.add(u.sub(o).mul(n))),Cn(u.rgb,e.a)}),Yx=cn(([e,t])=>e.mul(t).floor().div(t));let Zx=null;class Jx extends Wp{static get type(){return"ViewportSharedTextureNode"}constructor(e=ud,t=null){null===Zx&&(Zx=new Q),super(e,t,Zx)}getTextureForReference(){return Zx}updateReference(){return this}}const eT=an(Jx).setParameterLength(0,2),tT=new t;class rT extends jl{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){return e.getNodeProperties(this).passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class sT extends rT{static get type(){return"PassMultipleTextureNode"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class iT extends gi{static get type(){return"PassNode"}constructor(e,t,r,s={}){super("vec4"),this.scope=e,this.scene=t,this.camera=r,this.options=s,this._pixelRatio=1,this._width=1,this._height=1;const i=new Z;i.isRenderTargetTexture=!0,i.name="depth";const n=new ne(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Te,...s});n.texture.name="output",n.depthTexture=i,this.renderTarget=n,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:n.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Sa(0),this._cameraFar=Sa(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=ri.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return d("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return d("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const r=this._textures[e],s=this.renderTarget.textures.indexOf(r);this.renderTarget.textures[s]=t,this._textures[e]=t,this._previousTextures[e]=r,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(t=new sT(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=new sT(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar;this._viewZNodes[e]=t=sg(this.getTextureNode(e),r,s)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=Jp(i,r,s)}return t}async compileAsync(e){const t=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(r)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),!0===e.reversedDepthBuffer&&(this.renderTarget.depthTexture.type=K),this.scope===iT.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:r}=this;let s,i;const n=t.getOutputRenderTarget();n&&!0===n.isXRRenderTarget?(i=1,s=t.xr.getCamera(),t.xr.updateCamera(s),tT.set(n.width,n.height)):(s=this.camera,i=t.getPixelRatio(),t.getSize(tT)),this._pixelRatio=i,this.setSize(tT.width,tT.height);const a=t.getRenderTarget(),o=t.getMRT(),u=t.autoClear,l=t.transparent,d=t.opaque,c=s.layers.mask,h=t.contextNode,p=r.overrideMaterial;this._cameraNear.value=s.near,this._cameraFar.value=s.far,null!==this._layers&&(s.layers.mask=this._layers.mask);for(const e in this._previousTextures)this.toggleTexture(e);null!==this.overrideMaterial&&(r.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,null!==this.contextNode&&(null!==this._contextNodeCache&&this._contextNodeCache.version===this.version||(this._contextNodeCache={version:this.version,context:Cu({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const g=r.name;r.name=this.name?this.name:r.name,t.render(r,s),r.name=g,r.overrideMaterial=p,t.setRenderTarget(a),t.setMRT(o),t.autoClear=u,t.transparent=l,t.opaque=d,t.contextNode=h,s.layers.mask=c}setSize(e,t){this._width=e,this._height=t;const r=Math.floor(this._width*this._pixelRatio*this._resolutionScale),s=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(r,s),null!==this._scissor?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._pixelRatio*this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._pixelRatio*this._resolutionScale).floor()}setScissor(e,t,r,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new s),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,r,i))}setViewport(e,t,r,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new s),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,r,i))}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}iT.COLOR="color",iT.DEPTH="depth";class nT extends iT{static get type(){return"ToonOutlinePassNode"}constructor(e,t,r,s,i){super(iT.COLOR,e,t),this.colorNode=r,this.thicknessNode=s,this.alphaNode=i,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((e,r,s,i,n,a,o,u)=>{if((n.isMeshToonMaterial||n.isMeshToonNodeMaterial)&&!1===n.wireframe){const l=this._getOutlineMaterial(n);t.renderObject(e,r,s,i,l,a,o,u)}t.renderObject(e,r,s,i,n,a,o,u)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){const e=new vg;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=L;const t=Tc.negate(),r=Ld.mul(sc),s=yn(1),i=r.mul(Cn(lc,1)),n=r.mul(Cn(lc.add(t),1)),a=Ro(i.sub(n));return e.vertexNode=i.add(a.mul(this.thicknessNode).mul(i.w).mul(s)),e.colorNode=Cn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const aT=cn(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),oT=cn(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),uT=cn(([e,t])=>{const r=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),s=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lT=cn(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),dT=cn(([e,t])=>{const r=Pn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=Pn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=r.mul(e),e=lT(e),(e=s.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cT=Pn(Rn(1.6605,-.1246,-.0182),Rn(-.5876,1.1329,-.1006),Rn(-.0728,-.0083,1.1187)),hT=Pn(Rn(.6274,.0691,.0164),Rn(.3293,.9195,.088),Rn(.0433,.0113,.8956)),pT=cn(([e])=>{const t=Rn(e).toVar(),r=Rn(t.mul(t)).toVar(),s=Rn(r.mul(r)).toVar();return yn(15.5).mul(s.mul(r)).sub(Da(40.14,s.mul(t))).add(Da(31.96,s).sub(Da(6.868,r.mul(t))).add(Da(.4298,r).add(Da(.1191,t).sub(.00232))))}),gT=cn(([e,t])=>{const r=Rn(e).toVar(),s=Pn(Rn(.856627153315983,.137318972929847,.11189821299995),Rn(.0951212405381588,.761241990602591,.0767994186031903),Rn(.0482516061458583,.101439036467562,.811302368396859)),i=Pn(Rn(1.1271005818144368,-.1413297634984383,-.14132976349843826),Rn(-.11060664309660323,1.157823702216272,-.11060664309660294),Rn(-.016493938717834573,-.016493938717834257,1.2519364065950405)),n=yn(-12.47393),a=yn(4.026069);return r.mulAssign(t),r.assign(hT.mul(r)),r.assign(s.mul(r)),r.assign(eu(r,1e-10)),r.assign(To(r)),r.assign(r.sub(n).div(a.sub(n))),r.assign(mu(r,0,1)),r.assign(pT(r)),r.assign(i.mul(r)),r.assign(ou(eu(Rn(0),r),Rn(2.2))),r.assign(cT.mul(r)),r.assign(mu(r,0,1)),r}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),mT=cn(([e,t])=>{const r=yn(.76),s=yn(.15);e=e.mul(t);const i=Jo(e.r,Jo(e.g,e.b)),n=Au(i.lessThan(.08),i.sub(Da(6.25,i.mul(i))),.04);e.subAssign(n);const a=eu(e.r,eu(e.g,e.b));gn(a.lessThan(r),()=>e);const o=Pa(1,r),u=Pa(1,o.mul(o).div(a.add(o.sub(r))));e.mulAssign(u.div(a));const l=Pa(1,Ua(1,s.mul(a.sub(u)).add(1)));return gu(e,Rn(u),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class fT extends ci{static get type(){return"CodeNode"}constructor(e="",t=[],r=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const yT=an(fT).setParameterLength(1,3);class bT extends fT{static get type(){return"FunctionNode"}constructor(e="",t=[],r=""){super(e,t,r)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let r=t.nodeFunction;return void 0===r&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}generate(e,t){super.generate(e);const r=this.getNodeFunction(e),s=r.name,i=r.type,n=e.getCodeFromNode(this,i);""!==s&&(n.name=s);const a=e.getPropertyName(n),o=this.getNodeFunction(e).getCode(a);return n.code=o+"\n","property"===t?a:e.format(`${a}()`,i,t)}}const xT=(e,t=[],r="")=>{for(let e=0;es.call(...e);return i.functionNode=s,i};function TT(e){let t;const r=e.context.getViewZ;return void 0!==r&&(t=r(this)),(t||pc.z).negate()}const _T=cn(([e,t],r)=>{const s=TT(r);return bu(e,t,s)}),vT=cn(([e],t)=>{const r=TT(t);return e.mul(e,r,r).negate().exp().oneMinus()}),NT=cn(([e,t],r)=>{const s=TT(r),i=t.sub(cc.y).max(0).toConst().mul(s).toConst();return e.mul(e,i,i).negate().exp().oneMinus()}),ST=cn(([e,t])=>Cn(t.toFloat().mix(oa.rgb,e.toVec3()),oa.a));let RT=null,ET=null;class AT extends ci{static get type(){return"RangeNode"}constructor(e=yn(),t=yn()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),s=e.getTypeLength(Ks(t.value)),i=e.getTypeLength(Ks(r.value));return s>i?s:i}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new Hl('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let r=null;if(t.count>1){const i=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),a=i.value,o=n.value,u=e.getTypeLength(Ks(a)),d=e.getTypeLength(Ks(o));RT=RT||new s,ET=ET||new s,RT.setScalar(0),ET.setScalar(0),1===u?RT.setScalar(a):a.isColor?RT.set(a.r,a.g,a.b,1):RT.set(a.x,a.y,a.z||0,a.w||0),1===d?ET.setScalar(o):o.isColor?ET.set(o.r,o.g,o.b,1):ET.set(o.x,o.y,o.z||0,o.w||0);const c=4,h=c*t.count,p=new Float32Array(h);for(let e=0;enew CT(e,t),BT=MT("numWorkgroups","uvec3"),FT=MT("workgroupId","uvec3"),LT=MT("globalId","uvec3"),PT=MT("localId","uvec3"),DT=MT("subgroupSize","uint");class UT extends ci{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){const{scope:t}=this,{renderer:r}=e;!0===r.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}}const IT=an(UT);class OT extends hi{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r;const s=e.context.assign;if(r=super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}class VT extends ci{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new OT(this,e)}generate(e){const t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class kT extends ci{static get type(){return"AtomicFunctionNode"}constructor(e,t,r){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),r=t.parents,s=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.pointerNode,o=this.valueNode,u=[];u.push(`&${a.build(e,n)}`),null!==o&&u.push(o.build(e,n));const l=`${e.getMethod(s,i)}( ${u.join(", ")} )`;if(!(!!r&&(1===r.length&&!0===r[0].isStackNode)))return void 0===t.constNode&&(t.constNode=Cl(l,i).toConst()),t.constNode.build(e);e.addLineFlowCode(l,this)}}kT.ATOMIC_LOAD="atomicLoad",kT.ATOMIC_STORE="atomicStore",kT.ATOMIC_ADD="atomicAdd",kT.ATOMIC_SUB="atomicSub",kT.ATOMIC_MAX="atomicMax",kT.ATOMIC_MIN="atomicMin",kT.ATOMIC_AND="atomicAnd",kT.ATOMIC_OR="atomicOr",kT.ATOMIC_XOR="atomicXor";const GT=an(kT),zT=(e,t,r)=>GT(e,t,r).toStack();class $T extends gi{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=r}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,r=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(r)?0:e.getTypeLength(r))?t:r}generateNodeType(e){const t=this.method;return t===$T.SUBGROUP_ELECT?"bool":t===$T.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const r=this.method,s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=[];if(r===$T.SUBGROUP_BROADCAST||r===$T.SUBGROUP_SHUFFLE||r===$T.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(n.build(e,s),a.build(e,"float"===t?"int":s))}else r===$T.SUBGROUP_SHUFFLE_XOR||r===$T.SUBGROUP_SHUFFLE_DOWN||r===$T.SUBGROUP_SHUFFLE_UP?o.push(n.build(e,s),a.build(e,"uint")):(null!==n&&o.push(n.build(e,i)),null!==a&&o.push(a.build(e,i)));const u=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(r,s)}${u}`,s,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}$T.SUBGROUP_ELECT="subgroupElect",$T.SUBGROUP_BALLOT="subgroupBallot",$T.SUBGROUP_ADD="subgroupAdd",$T.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",$T.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",$T.SUBGROUP_MUL="subgroupMul",$T.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",$T.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",$T.SUBGROUP_AND="subgroupAnd",$T.SUBGROUP_OR="subgroupOr",$T.SUBGROUP_XOR="subgroupXor",$T.SUBGROUP_MIN="subgroupMin",$T.SUBGROUP_MAX="subgroupMax",$T.SUBGROUP_ALL="subgroupAll",$T.SUBGROUP_ANY="subgroupAny",$T.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",$T.QUAD_SWAP_X="quadSwapX",$T.QUAD_SWAP_Y="quadSwapY",$T.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",$T.SUBGROUP_BROADCAST="subgroupBroadcast",$T.SUBGROUP_SHUFFLE="subgroupShuffle",$T.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",$T.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",$T.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",$T.QUAD_BROADCAST="quadBroadcast";const WT=un($T,$T.SUBGROUP_ELECT).setParameterLength(0),HT=un($T,$T.SUBGROUP_BALLOT).setParameterLength(1),qT=un($T,$T.SUBGROUP_ADD).setParameterLength(1),jT=un($T,$T.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),XT=un($T,$T.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),KT=un($T,$T.SUBGROUP_MUL).setParameterLength(1),QT=un($T,$T.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),YT=un($T,$T.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ZT=un($T,$T.SUBGROUP_AND).setParameterLength(1),JT=un($T,$T.SUBGROUP_OR).setParameterLength(1),e_=un($T,$T.SUBGROUP_XOR).setParameterLength(1),t_=un($T,$T.SUBGROUP_MIN).setParameterLength(1),r_=un($T,$T.SUBGROUP_MAX).setParameterLength(1),s_=un($T,$T.SUBGROUP_ALL).setParameterLength(0),i_=un($T,$T.SUBGROUP_ANY).setParameterLength(0),n_=un($T,$T.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),a_=un($T,$T.QUAD_SWAP_X).setParameterLength(1),o_=un($T,$T.QUAD_SWAP_Y).setParameterLength(1),u_=un($T,$T.QUAD_SWAP_DIAGONAL).setParameterLength(1),l_=un($T,$T.SUBGROUP_BROADCAST).setParameterLength(2),d_=un($T,$T.SUBGROUP_SHUFFLE).setParameterLength(2),c_=un($T,$T.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),h_=un($T,$T.SUBGROUP_SHUFFLE_UP).setParameterLength(2),p_=un($T,$T.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),g_=un($T,$T.QUAD_BROADCAST).setParameterLength(1);let m_;function f_(e){m_=m_||new WeakMap;let t=m_.get(e);return void 0===t&&m_.set(e,t={}),t}function y_(e){const t=f_(e);return t.shadowMatrix||(t.shadowMatrix=Sa("mat4").setGroup(_a).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function b_(e,t=cc){const r=y_(e).mul(t);return r.xyz.div(r.w)}function x_(e){const t=f_(e);return t.position||(t.position=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.matrixWorld)))}function T_(e){const t=f_(e);return t.targetPosition||(t.targetPosition=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.target.matrixWorld)))}function __(e){const t=f_(e);return t.viewPosition||(t.viewPosition=Sa(new r).setGroup(_a).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new r,s.value.setFromMatrixPosition(e.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const v_=e=>Dd.transformDirection(x_(e).sub(T_(e))),N_=(e,t)=>{for(const r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},S_=new WeakMap,R_=[];class E_ extends ci{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Vn("vec3","totalDiffuse"),this.totalSpecularNode=Vn("vec3","totalSpecular"),this.outgoingLightNode=Vn("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let t=0;te.sort((e,t)=>e.id-t.id))(this._lights),i=e.renderer.library;for(const e of s)if(e.isNode)t.push(tn(e));else{let s=null;if(null!==r&&(s=N_(e.id,r)),null===s){const t=i.getLightNodeClass(e.constructor);if(null===t){d(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}!1===S_.has(e)&&S_.set(e,new t(e)),s=S_.get(e)}t.push(s)}this._lightNodes=t}setupDirectLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.direct({...r,lightNode:t,reflectedLight:i},e)}setupDirectRectAreaLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.directRectArea({...r,lightNode:t,reflectedLight:i},e)}setupLights(e,t){for(const r of t)r.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode;const s=e.context,i=s.lightingModel,n=e.getNodeProperties(this);if(i){const{totalDiffuseNode:t,totalSpecularNode:a}=this;s.outgoingLight=r;const o=e.addStack();n.nodes=o.nodes,i.start(e);const{backdrop:u,backdropAlpha:l}=s,{directDiffuse:d,directSpecular:c,indirectDiffuse:h,indirectSpecular:p}=s.reflectedLight;let g=d.add(h);null!==u&&(g=Rn(null!==l?l.mix(g,u):u)),t.assign(g),a.assign(c.add(p)),r.assign(t.add(a)),i.finish(e),r=r.bypass(e.removeStack())}else n.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class A_ extends ci{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=ri.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){w_.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||cc)}}const w_=Vn("vec3","shadowPositionWorld");function C_(t,r={}){return r.toneMapping=t.toneMapping,r.toneMappingExposure=t.toneMappingExposure,r.outputColorSpace=t.outputColorSpace,r.renderTarget=t.getRenderTarget(),r.activeCubeFace=t.getActiveCubeFace(),r.activeMipmapLevel=t.getActiveMipmapLevel(),r.renderObjectFunction=t.getRenderObjectFunction(),r.pixelRatio=t.getPixelRatio(),r.mrt=t.getMRT(),r.clearColor=t.getClearColor(r.clearColor||new e),r.clearAlpha=t.getClearAlpha(),r.autoClear=t.autoClear,r.scissorTest=t.getScissorTest(),r}function M_(e,t){return t=C_(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function B_(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function F_(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function L_(e,t){return t=F_(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function P_(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function D_(e,t,r){return r=L_(t,r=M_(e,r))}function U_(e,t,r){B_(e,r),P_(t,r)}var I_=Object.freeze({__proto__:null,resetRendererAndSceneState:D_,resetRendererState:M_,resetSceneState:L_,restoreRendererAndSceneState:U_,restoreRendererState:B_,restoreSceneState:P_,saveRendererAndSceneState:function(e,t,r={}){return r=F_(t,r=C_(e,r))},saveRendererState:C_,saveSceneState:F_});const O_=new WeakMap,V_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let s=Kl(e,t.xy).setName("t_basic");return e.isArrayTexture&&(s=s.depth(r)),s.compare(t.z)}),k_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=qc("radius","float",r).setGroup(_a),o=_n(1).div(n),u=a.mul(o.x),l=_x(dd.xy).mul(6.28318530718);return La(i(t.xy.add(vx(0,5,l).mul(u)),t.z),i(t.xy.add(vx(1,5,l).mul(u)),t.z),i(t.xy.add(vx(2,5,l).mul(u)),t.z),i(t.xy.add(vx(3,5,l).mul(u)),t.z),i(t.xy.add(vx(4,5,l).mul(u)),t.z)).mul(.2)}),G_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=_n(1).div(n),o=a.x,u=a.y,l=t.xy,d=Eo(l.mul(n).add(.5));return l.subAssign(d.mul(a)),La(i(l,t.z),i(l.add(_n(o,0)),t.z),i(l.add(_n(0,u)),t.z),i(l.add(a),t.z),gu(i(l.add(_n(o.negate(),0)),t.z),i(l.add(_n(o.mul(2),0)),t.z),d.x),gu(i(l.add(_n(o.negate(),u)),t.z),i(l.add(_n(o.mul(2),u)),t.z),d.x),gu(i(l.add(_n(0,u.negate())),t.z),i(l.add(_n(0,u.mul(2))),t.z),d.y),gu(i(l.add(_n(o,u.negate())),t.z),i(l.add(_n(o,u.mul(2))),t.z),d.y),gu(gu(i(l.add(_n(o.negate(),u.negate())),t.z),i(l.add(_n(o.mul(2),u.negate())),t.z),d.x),gu(i(l.add(_n(o.negate(),u.mul(2))),t.z),i(l.add(_n(o.mul(2),u.mul(2))),t.z),d.x),d.y)).mul(1/9)}),z_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r},s)=>{let i=Kl(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(r)),i=i.rg;const n=i.x,a=eu(1e-7,i.y.mul(i.y)),o=s.renderer.reversedDepthBuffer?tu(n,t.z):tu(t.z,n),u=yn(1).toVar();return gn(o.notEqual(1),()=>{const e=t.z.sub(n);let r=a.div(a.add(e.mul(e)));r=mu(Pa(r,.3).div(.65)),u.assign(eu(o,r))}),u}),$_=e=>{let t=O_.get(e);return void 0===t&&(t=new vg,t.colorNode=Cn(0,0,0,1),t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.blending=re,t.fog=!1,O_.set(e,t)),t},W_=e=>{const t=O_.get(e);void 0!==t&&(t.dispose(),O_.delete(e))},H_=new Ty,q_=[],j_=(e,t,r,s)=>{q_[0]=e,q_[1]=t;let i=H_.get(q_);return void 0!==i&&i.shadowType===r&&i.useVelocity===s||(i=(i,n,a,o,u,l,...d)=>{(!0===i.castShadow||i.receiveShadow&&r===pt)&&(s&&(Ys(i).useVelocity=!0),i.onBeforeShadow(e,i,a,t.camera,o,n.overrideMaterial,l),e.renderObject(i,n,a,o,u,l,...d),i.onAfterShadow(e,i,a,t.camera,o,n.overrideMaterial,l))},i.shadowType=r,i.useVelocity=s,H_.set(q_,i)),q_[0]=null,q_[1]=null,i},X_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanVertical"),a=yn(0).toVar("squareMeanVertical"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(0,l).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),d=d.x,n.addAssign(d),a.addAssign(d.mul(d))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),K_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanHorizontal"),a=yn(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(l,0).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),n.addAssign(d.x),a.addAssign(La(d.y.mul(d.y),d.x.mul(d.x)))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),Q_=[V_,k_,G_,z_];let Y_;const Z_=new gx;class J_ extends A_{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n}){const a=s.x.greaterThanEqual(0).and(s.x.lessThanEqual(1)).and(s.y.greaterThanEqual(0)).and(s.y.lessThanEqual(1)).and(s.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n});return a.select(o,yn(1))}setupShadowCoord(e,t){const{shadow:r}=this,{renderer:s}=e,i=r.biasNode||qc("bias","float",r).setGroup(_a);let n,a=t;if(r.camera.isOrthographicCamera||!0!==s.logarithmicDepthBuffer)a=a.xyz.div(a.w),n=a.z;else{const e=a.w;a=a.xy.div(e);const t=qc("near","float",r.camera).setGroup(_a),s=qc("far","float",r.camera).setGroup(_a);n=ig(e.negate(),t,s)}return a=Rn(a.x,a.y.oneMinus(),s.reversedDepthBuffer?n.sub(i):n.add(i)),a}getShadowFilterFn(e){return Q_[e]}setupRenderTarget(e,t){const r=new Z(e.mapSize.width,e.mapSize.height);r.name="ShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return s.texture.name="ShadowMap",s.texture.type=e.mapType,s.depthTexture=r,{shadowMap:s,depthTexture:r}}setupShadow(e){const{renderer:t,camera:r}=e,{light:s,shadow:i}=this,{depthTexture:n,shadowMap:a}=this.setupRenderTarget(i,e),o=t.shadowMap.type,u=t.hasCompatibility(E.TEXTURE_COMPARE);if(o!==ct&&o!==ht||!u?(n.minFilter=B,n.magFilter=B):(n.minFilter=le,n.magFilter=le),i.camera.coordinateSystem=r.coordinateSystem,i.camera.updateProjectionMatrix(),o===pt&&!0!==i.isPointLightShadow){n.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}));let t=Kl(n);n.isArrayTexture&&(t=t.depth(this.depthLayer));let r=Kl(this.vsmShadowMapVertical.texture);n.isArrayTexture&&(r=r.depth(this.depthLayer));const s=qc("blurSamples","float",i).setGroup(_a),o=qc("radius","float",i).setGroup(_a),u=qc("mapSize","vec2",i).setGroup(_a);let l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new vg);l.fragmentNode=X_({samples:s,radius:o,size:u,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMVertical",l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new vg),l.fragmentNode=K_({samples:s,radius:o,size:u,shadowPass:r,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMHorizontal"}const l=qc("intensity","float",i).setGroup(_a),d=qc("normalBias","float",i).setGroup(_a),c=y_(s),h=Rc.mul(d);let p;if(!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld)p=c.mul(w_.add(h));else{p=Sa("mat4").onObjectUpdate(({object:e},t)=>t.value.multiplyMatrices(c.value,e.matrixWorld)).mul(lc).add(c.mul(Cn(h,0)))}const g=this.setupShadowCoord(e,p),m=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===m)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const f=o===pt&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:n,y=this.setupShadowFilter(e,{filterFn:m,shadowTexture:a.texture,depthTexture:f,shadowCoord:g,shadow:i,depthLayer:this.depthLayer});let b,x;!0===t.shadowMap.transmitted&&(a.texture.isCubeTexture?b=$c(a.texture,g.xyz):(b=Kl(a.texture,g),n.isArrayTexture&&(b=b.depth(this.depthLayer)))),x=b?gu(1,y.rgb.mix(b,1),l.mul(b.a)).toVar():gu(1,y,l).toVar(),this.shadowMap=a,this.shadow.map=a;const T=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return b&&x.toInspector(`${T} / Color`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture):Kl(this.shadowMap.texture)),x.toInspector(`${T} / Depth`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture).r.oneMinus():Ql(this.shadowMap.depthTexture,kl().mul(zl(Kl(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return cn(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),null===r&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e;t.updateMatrices(s),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);const a=n.name;n.name=`Shadow Map [ ${s.name||"ID: "+s.id} ]`,i.render(n,t.camera),n.name=a}updateShadow(e){const{shadowMap:t,light:r,shadow:s}=this,{renderer:i,scene:n,camera:a}=e,o=i.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u;const l=s.camera.layers.mask;4294967294&s.camera.layers.mask||(s.camera.layers.mask=a.layers.mask);const d=i.getRenderObjectFunction(),c=i.getMRT(),h=!!c&&c.has("velocity");Y_=D_(i,n,Y_),n.overrideMaterial=$_(r),i.setRenderObjectFunction(j_(i,s,o,h)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(d),o===pt&&!0!==s.isPointLightShadow&&this.vsmPass(i),s.camera.layers.mask=l,U_(i,n,Y_)}vsmPass(e){const{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),Z_.material=this.vsmMaterialVertical,Z_.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Z_.material=this.vsmMaterialHorizontal,Z_.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,W_(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const ev=(e,t)=>new J_(e,t),tv=new e,rv=new a,sv=new r,iv=new r,nv=[new r(1,0,0),new r(-1,0,0),new r(0,-1,0),new r(0,1,0),new r(0,0,1),new r(0,0,-1)],av=[new r(0,-1,0),new r(0,-1,0),new r(0,0,-1),new r(0,0,1),new r(0,-1,0),new r(0,-1,0)],ov=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],uv=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],lv=cn(({depthTexture:e,bd3D:t,dp:r})=>$c(e,t).compare(r)),dv=cn(({depthTexture:e,bd3D:t,dp:r,shadow:s})=>{const i=qc("radius","float",s).setGroup(_a),n=qc("mapSize","vec2",s).setGroup(_a),a=i.div(n.x),o=Vo(t),u=Ro(au(t,o.x.greaterThan(o.z).select(Rn(0,1,0),Rn(1,0,0)))),l=au(t,u),d=_x(dd.xy).mul(6.28318530718),c=vx(0,5,d),h=vx(1,5,d),p=vx(2,5,d),g=vx(3,5,d),m=vx(4,5,d);return $c(e,t.add(u.mul(c.x).add(l.mul(c.y)).mul(a))).compare(r).add($c(e,t.add(u.mul(h.x).add(l.mul(h.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(p.x).add(l.mul(p.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(g.x).add(l.mul(g.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(m.x).add(l.mul(m.y)).mul(a))).compare(r)).mul(.2)}),cv=cn(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:s},i)=>{const n=r.xyz.toConst(),a=n.abs().toConst(),o=a.x.max(a.y).max(a.z),u=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.near),l=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.far),d=qc("bias","float",s).setGroup(_a),c=yn(1).toVar();return gn(o.sub(l).lessThanEqual(0).and(o.sub(u).greaterThanEqual(0)),()=>{let r;i.renderer.reversedDepthBuffer?(r=rg(o.negate(),u,l),r.subAssign(d)):(r=tg(o.negate(),u,l),r.addAssign(d));const a=n.normalize();c.assign(e({depthTexture:t,bd3D:a,dp:r,shadow:s}))}),c});class hv extends J_{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===gt?lv:dv}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i}){return cv({filterFn:t,depthTexture:r,shadowCoord:s,shadow:i})}setupRenderTarget(e,t){const r=new mt(e.mapSize.width);r.name="PointShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createCubeRenderTarget(e.mapSize.width);return s.texture.name="PointShadowMap",s.depthTexture=r,{shadowMap:s,depthTexture:r}}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e,a=t.camera,o=t.matrix,u=i.coordinateSystem===h,l=u?nv:ov,d=u?av:uv;r.setSize(t.mapSize.width,t.mapSize.width);const c=i.autoClear,p=i.getClearColor(tv),g=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){i.setRenderTarget(r,e),i.clear();const u=s.distance||a.far;u!==a.far&&(a.far=u,a.updateProjectionMatrix()),sv.setFromMatrixPosition(s.matrixWorld),a.position.copy(sv),iv.copy(a.position),iv.add(l[e]),a.up.copy(d[e]),a.lookAt(iv),a.updateMatrixWorld(),o.makeTranslation(-sv.x,-sv.y,-sv.z),rv.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(rv,a.coordinateSystem,a.reversedDepth);const c=n.name;n.name=`Point Light Shadow [ ${s.name||"ID: "+s.id} ] - Face ${e+1}`,i.render(n,a),n.name=c}i.autoClear=c,i.setClearColor(p,g)}}const pv=(e,t)=>new hv(e,t);class gv extends Op{static get type(){return"AnalyticLightNode"}constructor(t=null){super(),this.light=t,this.color=new e,this.colorNode=t&&t.colorNode||Sa(this.color).setGroup(_a),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=ri.FRAME,t&&t.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},t.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,null!==this.baseColorNode&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return __(this.light).sub(e.context.positionView||pc)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return ev(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let r=this.shadowColorNode;if(null===r){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?tn(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=r=this.colorNode.mul(t),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const mv=cn(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{const s=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(s.mul(e.div(t).pow4().oneMinus().clamp().pow2()),s)}),fv=({color:e,lightVector:t,cutoffDistance:r,decayExponent:s})=>{const i=t.normalize(),n=t.length(),a=mv({lightDistance:n,cutoffDistance:r,decayExponent:s});return{lightDirection:i,lightColor:e.mul(a)}};class yv extends gv{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(2).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return pv(this.light)}setupDirect(e){return fv({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const bv=cn(([e=kl()])=>{const t=e.mul(2),r=t.x.floor(),s=t.y.floor();return r.add(s).mod(2).sign()}),xv=cn(([e=kl()],{renderer:t,material:r})=>{const s=pu(e.mul(2).sub(1));let i;if(r.alphaToCoverage&&t.currentSamples>0){const e=yn(s.fwidth()).toVar();i=bu(e.oneMinus(),e.add(1),s).oneMinus()}else i=Au(s.greaterThan(1),0,1);return i}),Tv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=Tn(e).toVar();return Au(n,i,s)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),_v=cn(([e,t])=>{const r=Tn(t).toVar(),s=yn(e).toVar();return Au(r,s.negate(),s)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),vv=cn(([e])=>{const t=yn(e).toVar();return bn(No(t))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Nv=cn(([e,t])=>{const r=yn(e).toVar();return t.assign(vv(r)),r.sub(yn(t))}),Sv=Vb([cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=yn(s).toVar(),l=yn(r).toVar(),d=yn(t).toVar(),c=yn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=Rn(s).toVar(),l=Rn(r).toVar(),d=Rn(t).toVar(),c=Rn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),Rv=Vb([cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=yn(o).toVar(),m=yn(a).toVar(),f=yn(n).toVar(),y=yn(i).toVar(),b=yn(s).toVar(),x=yn(r).toVar(),T=yn(t).toVar(),_=yn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=Rn(o).toVar(),m=Rn(a).toVar(),f=Rn(n).toVar(),y=Rn(i).toVar(),b=Rn(s).toVar(),x=Rn(r).toVar(),T=Rn(t).toVar(),_=Rn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),Ev=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=xn(e).toVar(),a=xn(n.bitAnd(xn(7))).toVar(),o=yn(Tv(a.lessThan(xn(4)),i,s)).toVar(),u=yn(Da(2,Tv(a.lessThan(xn(4)),s,i))).toVar();return _v(o,Tn(a.bitAnd(xn(1)))).add(_v(u,Tn(a.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Av=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=xn(e).toVar(),u=xn(o.bitAnd(xn(15))).toVar(),l=yn(Tv(u.lessThan(xn(8)),a,n)).toVar(),d=yn(Tv(u.lessThan(xn(4)),n,Tv(u.equal(xn(12)).or(u.equal(xn(14))),a,i))).toVar();return _v(l,Tn(u.bitAnd(xn(1)))).add(_v(d,Tn(u.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),wv=Vb([Ev,Av]),Cv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=An(e).toVar();return Rn(wv(n.x,i,s),wv(n.y,i,s),wv(n.z,i,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Mv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=An(e).toVar();return Rn(wv(o.x,a,n,i),wv(o.y,a,n,i),wv(o.z,a,n,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Bv=Vb([Cv,Mv]),Fv=cn(([e])=>{const t=yn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Lv=cn(([e])=>{const t=yn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Pv=Vb([Fv,cn(([e])=>{const t=Rn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Dv=Vb([Lv,cn(([e])=>{const t=Rn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Uv=cn(([e,t])=>{const r=bn(t).toVar(),s=xn(e).toVar();return s.shiftLeft(r).bitOr(s.shiftRight(bn(32).sub(r)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Iv=cn(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(Uv(r,bn(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(Uv(r,bn(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(4))),t.addAssign(e)}),Ov=cn(([e,t,r])=>{const s=xn(r).toVar(),i=xn(t).toVar(),n=xn(e).toVar();return s.bitXorAssign(i),s.subAssign(Uv(i,bn(14))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(11))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(25))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(16))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(4))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(14))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Vv=cn(([e])=>{const t=xn(e).toVar();return yn(t).div(yn(xn(bn(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),kv=cn(([e])=>{const t=yn(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Gv=Vb([cn(([e])=>{const t=bn(e).toVar(),r=xn(xn(1)).toVar(),s=xn(xn(bn(3735928559)).add(r.shiftLeft(xn(2))).add(xn(13))).toVar();return Ov(s.add(xn(t)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(xn(2)).toVar(),n=xn().toVar(),a=xn().toVar(),o=xn().toVar();return n.assign(a.assign(o.assign(xn(bn(3735928559)).add(i.shiftLeft(xn(2))).add(xn(13))))),n.addAssign(xn(s)),a.addAssign(xn(r)),Ov(n,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(xn(3)).toVar(),o=xn().toVar(),u=xn().toVar(),l=xn().toVar();return o.assign(u.assign(l.assign(xn(bn(3735928559)).add(a.shiftLeft(xn(2))).add(xn(13))))),o.addAssign(xn(n)),u.addAssign(xn(i)),l.addAssign(xn(s)),Ov(o,u,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cn(([e,t,r,s])=>{const i=bn(s).toVar(),n=bn(r).toVar(),a=bn(t).toVar(),o=bn(e).toVar(),u=xn(xn(4)).toVar(),l=xn().toVar(),d=xn().toVar(),c=xn().toVar();return l.assign(d.assign(c.assign(xn(bn(3735928559)).add(u.shiftLeft(xn(2))).add(xn(13))))),l.addAssign(xn(o)),d.addAssign(xn(a)),c.addAssign(xn(n)),Iv(l,d,c),l.addAssign(xn(i)),Ov(l,d,c)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),cn(([e,t,r,s,i])=>{const n=bn(i).toVar(),a=bn(s).toVar(),o=bn(r).toVar(),u=bn(t).toVar(),l=bn(e).toVar(),d=xn(xn(5)).toVar(),c=xn().toVar(),h=xn().toVar(),p=xn().toVar();return c.assign(h.assign(p.assign(xn(bn(3735928559)).add(d.shiftLeft(xn(2))).add(xn(13))))),c.addAssign(xn(l)),h.addAssign(xn(u)),p.addAssign(xn(o)),Iv(c,h,p),c.addAssign(xn(a)),h.addAssign(xn(n)),Ov(c,h,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),zv=Vb([cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(Gv(s,r)).toVar(),n=An().toVar();return n.x.assign(i.bitAnd(bn(255))),n.y.assign(i.shiftRight(bn(8)).bitAnd(bn(255))),n.z.assign(i.shiftRight(bn(16)).bitAnd(bn(255))),n}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(Gv(n,i,s)).toVar(),o=An().toVar();return o.x.assign(a.bitAnd(bn(255))),o.y.assign(a.shiftRight(bn(8)).bitAnd(bn(255))),o.z.assign(a.shiftRight(bn(16)).bitAnd(bn(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),$v=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=yn(Sv(wv(Gv(r,s),i,n),wv(Gv(r.add(bn(1)),s),i.sub(1),n),wv(Gv(r,s.add(bn(1))),i,n.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=yn(Rv(wv(Gv(r,s,i),n,a,o),wv(Gv(r.add(bn(1)),s,i),n.sub(1),a,o),wv(Gv(r,s.add(bn(1)),i),n,a.sub(1),o),wv(Gv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),wv(Gv(r,s,i.add(bn(1))),n,a,o.sub(1)),wv(Gv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),wv(Gv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),Wv=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=Rn(Sv(Bv(zv(r,s),i,n),Bv(zv(r.add(bn(1)),s),i.sub(1),n),Bv(zv(r,s.add(bn(1))),i,n.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=Rn(Rv(Bv(zv(r,s,i),n,a,o),Bv(zv(r.add(bn(1)),s,i),n.sub(1),a,o),Bv(zv(r,s.add(bn(1)),i),n,a.sub(1),o),Bv(zv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),Bv(zv(r,s,i.add(bn(1))),n,a,o.sub(1)),Bv(zv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),Bv(zv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),Hv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Vv(Gv(r))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Vv(Gv(r,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Vv(Gv(r,s,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Vv(Gv(r,s,i,n))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),qv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Rn(Vv(Gv(r,bn(0))),Vv(Gv(r,bn(1))),Vv(Gv(r,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Rn(Vv(Gv(r,s,bn(0))),Vv(Gv(r,s,bn(1))),Vv(Gv(r,s,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Rn(Vv(Gv(r,s,i,bn(0))),Vv(Gv(r,s,i,bn(1))),Vv(Gv(r,s,i,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Rn(Vv(Gv(r,s,i,n,bn(0))),Vv(Gv(r,s,i,n,bn(1))),Vv(Gv(r,s,i,n,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),jv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=yn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul($v(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Xv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul(Wv(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Kv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar();return _n(jv(o,a,n,i),jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Qv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(Xv(o,a,n,i)).toVar(),l=yn(jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i)).toVar();return Cn(u,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Yv=Vb([cn(([e,t,r,s,i,n,a])=>{const o=bn(a).toVar(),u=yn(n).toVar(),l=bn(i).toVar(),d=bn(s).toVar(),c=bn(r).toVar(),h=bn(t).toVar(),p=_n(e).toVar(),g=Rn(qv(_n(h.add(d),c.add(l)))).toVar(),m=_n(g.x,g.y).toVar();m.subAssign(.5),m.mulAssign(u),m.addAssign(.5);const f=_n(_n(yn(h),yn(c)).add(m)).toVar(),y=_n(f.sub(p)).toVar();return gn(o.equal(bn(2)),()=>Vo(y.x).add(Vo(y.y))),gn(o.equal(bn(3)),()=>eu(Vo(y.x),Vo(y.y))),nu(y,y)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cn(([e,t,r,s,i,n,a,o,u])=>{const l=bn(u).toVar(),d=yn(o).toVar(),c=bn(a).toVar(),h=bn(n).toVar(),p=bn(i).toVar(),g=bn(s).toVar(),m=bn(r).toVar(),f=bn(t).toVar(),y=Rn(e).toVar(),b=Rn(qv(Rn(f.add(p),m.add(h),g.add(c)))).toVar();b.subAssign(.5),b.mulAssign(d),b.addAssign(.5);const x=Rn(Rn(yn(f),yn(m),yn(g)).add(b)).toVar(),T=Rn(x.sub(y)).toVar();return gn(l.equal(bn(2)),()=>Vo(T.x).add(Vo(T.y)).add(Vo(T.z))),gn(l.equal(bn(3)),()=>eu(Vo(T.x),Vo(T.y),Vo(T.z))),nu(T,T)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),Zv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();l.assign(Jo(l,r))})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Jv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.y.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),eN=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(r)}).ElseIf(r.lessThan(l.z),()=>{l.z.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tN=Vb([Zv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();d.assign(Jo(d,n))})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),rN=Vb([Jv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.y.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),sN=Vb([eN,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(n)}).ElseIf(n.lessThan(d.z),()=>{d.z.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),iN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=_n(t).toVar(),p=_n(r).toVar(),g=_n(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(Rn(v,0),x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=Rn(t).toVar(),p=Rn(r).toVar(),g=Rn(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(v,x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aN=cn(([e])=>{const t=e.y,r=e.z,s=Rn().toVar();return gn(t.lessThan(1e-4),()=>{s.assign(Rn(r,r,r))}).Else(()=>{let i=e.x;i=i.sub(No(i)).mul(6).toVar();const n=bn(Xo(i)),a=i.sub(yn(n)),o=r.mul(t.oneMinus()),u=r.mul(t.mul(a).oneMinus()),l=r.mul(t.mul(a.oneMinus()).oneMinus());gn(n.equal(bn(0)),()=>{s.assign(Rn(r,l,o))}).ElseIf(n.equal(bn(1)),()=>{s.assign(Rn(u,r,o))}).ElseIf(n.equal(bn(2)),()=>{s.assign(Rn(o,r,l))}).ElseIf(n.equal(bn(3)),()=>{s.assign(Rn(o,u,r))}).ElseIf(n.equal(bn(4)),()=>{s.assign(Rn(l,o,r))}).Else(()=>{s.assign(Rn(r,o,u))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),oN=cn(([e])=>{const t=Rn(e).toVar(),r=yn(t.x).toVar(),s=yn(t.y).toVar(),i=yn(t.z).toVar(),n=yn(Jo(r,Jo(s,i))).toVar(),a=yn(eu(r,eu(s,i))).toVar(),o=yn(a.sub(n)).toVar(),u=yn().toVar(),l=yn().toVar(),d=yn().toVar();return d.assign(a),gn(a.greaterThan(0),()=>{l.assign(o.div(a))}).Else(()=>{l.assign(0)}),gn(l.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{gn(r.greaterThanEqual(a),()=>{u.assign(s.sub(i).div(o))}).ElseIf(s.greaterThanEqual(a),()=>{u.assign(La(2,i.sub(r).div(o)))}).Else(()=>{u.assign(La(4,r.sub(s).div(o)))}),u.mulAssign(1/6),gn(u.lessThan(0),()=>{u.addAssign(1)})}),Rn(u,l,d)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),uN=cn(([e])=>{const t=Rn(e).toVar(),r=wn(Ga(t,Rn(.04045))).toVar(),s=Rn(t.div(12.92)).toVar(),i=Rn(ou(eu(t.add(Rn(.055)),Rn(0)).div(1.055),Rn(2.4))).toVar();return gu(s,i,r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),lN=(e,t)=>{e=yn(e),t=yn(t);const r=_n(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return bu(e.sub(r),e.add(r),t)},dN=(e,t,r,s)=>gu(e,t,r[s].clamp()),cN=(e,t,r,s,i)=>gu(e,t,lN(r,s[i])),hN=cn(([e,t,r])=>{const s=Ro(e).toVar(),i=Pa(yn(.5).mul(t.sub(r)),cc).div(s).toVar(),n=Pa(yn(-.5).mul(t.sub(r)),cc).div(s).toVar(),a=Rn().toVar();a.x=s.x.greaterThan(yn(0)).select(i.x,n.x),a.y=s.y.greaterThan(yn(0)).select(i.y,n.y),a.z=s.z.greaterThan(yn(0)).select(i.z,n.z);const o=Jo(a.x,a.y,a.z).toVar();return cc.add(s.mul(o)).toVar().sub(r)}),pN=cn(([e,t])=>{const r=e.x,s=e.y,i=e.z;let n=t.element(0).mul(.886227);return n=n.add(t.element(1).mul(1.023328).mul(s)),n=n.add(t.element(2).mul(1.023328).mul(i)),n=n.add(t.element(3).mul(1.023328).mul(r)),n=n.add(t.element(4).mul(.858086).mul(r).mul(s)),n=n.add(t.element(5).mul(.858086).mul(s).mul(i)),n=n.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),n=n.add(t.element(7).mul(.858086).mul(r).mul(i)),n=n.add(t.element(8).mul(.429043).mul(Da(r,r).sub(Da(s,s)))),n});var gN=Object.freeze({__proto__:null,BRDF_GGX:am,BRDF_Lambert:Hg,BasicPointShadowFilter:lv,BasicShadowFilter:V_,Break:Fp,Const:Ou,Continue:()=>Cl("continue").toStack(),DFGLUT:lm,D_GGX:sm,Discard:Ml,EPSILON:ao,F_Schlick:Wg,Fn:cn,HALF_PI:ho,INFINITY:oo,If:gn,Loop:Bp,NodeAccess:ii,NodeShaderStage:ti,NodeType:si,NodeUpdateType:ri,OnBeforeMaterialUpdate:e=>Rx(Sx.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>Rx(Sx.BEFORE_OBJECT,e),OnMaterialUpdate:e=>Rx(Sx.MATERIAL,e),OnObjectUpdate:e=>Rx(Sx.OBJECT,e),PCFShadowFilter:k_,PCFSoftShadowFilter:G_,PI:uo,PI2:lo,PointShadowFilter:dv,Return:()=>Cl("return").toStack(),Schlick_to_F0:hm,ShaderNode:en,Stack:mn,Switch:(...e)=>Si.Switch(...e),TBNViewMatrix:xh,TWO_PI:co,VSMShadowFilter:z_,V_GGX_SmithCorrelated:tm,Var:Iu,VarIntent:Vu,abs:Vo,acesFilmicToneMapping:dT,acos:Do,acosh:Uo,add:La,addMethodChaining:Ei,addNodeElement:function(e){d("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:gT,all:po,alphaT:Jn,and:Wa,anisotropy:ea,anisotropyB:ra,anisotropyT:ta,any:go,append:e=>(d("TSL: append() has been renamed to Stack().",new Is),mn(e)),array:Ea,arrayBuffer:e=>new vi(e,"ArrayBuffer"),asin:Lo,asinh:Po,assign:wa,atan:Io,atanh:Oo,atomicAdd:(e,t)=>zT(kT.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>zT(kT.ATOMIC_AND,e,t),atomicFunc:zT,atomicLoad:e=>zT(kT.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>zT(kT.ATOMIC_MAX,e,t),atomicMin:(e,t)=>zT(kT.ATOMIC_MIN,e,t),atomicOr:(e,t)=>zT(kT.ATOMIC_OR,e,t),atomicStore:(e,t)=>zT(kT.ATOMIC_STORE,e,t),atomicSub:(e,t)=>zT(kT.ATOMIC_SUB,e,t),atomicXor:(e,t)=>zT(kT.ATOMIC_XOR,e,t),attenuationColor:ma,attenuationDistance:ga,attribute:Vl,attributeArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ax(e,r,s);return Tp(i,t,e)},backgroundBlurriness:Bx,backgroundIntensity:Fx,backgroundRotation:Lx,batch:Ep,bentNormalView:_h,billboarding:Hb,bitAnd:Xa,bitNot:Ka,bitOr:Qa,bitXor:Ya,bitangentGeometry:mh,bitangentLocal:fh,bitangentView:yh,bitangentWorld:bh,bitcast:yb,blendBurn:mg,blendColor:xg,blendDodge:fg,blendOverlay:bg,blendScreen:yg,blur:pf,bool:Tn,buffer:Zl,bufferAttribute:ul,builtin:sd,builtinAOContext:Lu,builtinShadowContext:Fu,bumpMap:Ch,bvec2:Sn,bvec3:wn,bvec4:Fn,bypass:Rl,cache:Nl,call:Ma,cameraFar:Fd,cameraIndex:Md,cameraNear:Bd,cameraNormalMatrix:Id,cameraPosition:Od,cameraProjectionMatrix:Ld,cameraProjectionMatrixInverse:Pd,cameraViewMatrix:Dd,cameraViewport:Vd,cameraWorldMatrix:Ud,cbrt:hu,cdl:Qx,ceil:So,checker:bv,cineonToneMapping:uT,clamp:mu,clearcoat:qn,clearcoatNormalView:Ec,clearcoatRoughness:jn,clipSpace:oc,code:yT,color:fn,colorSpaceToWorking:Qu,colorToDirection:e=>tn(e).mul(2).sub(1),compute:Tl,computeKernel:xl,computeSkinning:(e,t=null)=>{const r=new wp(e);return r.positionNode=Tp(new q(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinIndexNode=Tp(new q(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinWeightNode=Tp(new q(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.bindMatrixNode=Sa(e.bindMatrix,"mat4"),r.bindMatrixInverseNode=Sa(e.bindMatrixInverse,"mat4"),r.boneMatricesNode=Zl(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),r.toPositionNode=t,tn(r)},context:Cu,convert:In,convertColorSpace:(e,t,r)=>new Xu(tn(e),t,r),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():yx(e,...t),cos:Co,cosh:Mo,countLeadingZeros:vb,countOneBits:Nb,countTrailingZeros:_b,cross:au,cubeTexture:$c,cubeTextureBase:zc,dFdx:Wo,dFdy:Ho,dashSize:ua,debug:Pl,decrement:so,decrementBefore:to,defaultBuildStages:ai,defaultShaderStages:ni,defined:Zi,degrees:fo,deltaTime:Gb,densityFogFactor:vT,depth:ag,depthPass:(e,t,r)=>new iT(iT.DEPTH,e,t,r),determinant:Yo,difference:iu,diffuseColor:Gn,diffuseContribution:zn,directPointLight:fv,directionToColor:vh,directionToFaceDirection:bc,dispersion:fa,disposeShadowMaterial:W_,distance:su,div:Ua,dot:nu,drawIndex:yl,dynamicBufferAttribute:(e,t=null,r=0,s=0)=>ol(e,t,r,s,x),element:Un,emissive:$n,equal:Oa,equirectUV:Bg,exp:yo,exp2:bo,exponentialHeightFogFactor:NT,expression:Cl,faceDirection:yc,faceForward:xu,faceforward:Su,float:yn,floatBitsToInt:e=>new fb(e,"int","float"),floatBitsToUint:bb,floor:No,fog:ST,fract:Eo,frameGroup:Ta,frameId:zb,frontFacing:fc,fwidth:Ko,gain:(e,t)=>e.lessThan(.5)?Rb(e.mul(2),t).div(2):Pa(1,Rb(Da(Pa(1,e),2),t).div(2)),gapSize:la,getConstNodeType:Ji,getCurrentStack:pn,getDirection:lf,getDistanceAttenuation:mv,getGeometryRoughness:Jg,getNormalFromDepth:Tx,getParallaxCorrectNormal:hN,getRoughness:em,getScreenPosition:xx,getShIrradianceAt:pN,getShadowMaterial:$_,getShadowRenderObjectFunction:j_,getTextureIndex:pb,getViewPosition:bx,ggxConvolution:yf,globalId:LT,glsl:(e,t)=>yT(e,t,"glsl"),glslFn:(e,t)=>xT(e,t,"glsl"),grayscale:Hx,greaterThan:Ga,greaterThanEqual:$a,hash:Sb,highpModelNormalViewMatrix:ac,highpModelViewMatrix:nc,hue:Xx,increment:ro,incrementBefore:eo,inspector:Il,instance:vp,instanceIndex:pl,instancedArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ex(e,r,s);return Tp(i,t,i.count)},instancedBufferAttribute:ll,instancedDynamicBufferAttribute:dl,instancedMesh:Sp,int:bn,intBitsToFloat:e=>new fb(e,"float","int"),interleavedGradientNoise:_x,inverse:Zo,inverseSqrt:vo,inversesqrt:Ru,invocationLocalIndex:fl,invocationSubgroupIndex:ml,ior:ca,iridescence:Qn,iridescenceIOR:Yn,iridescenceThickness:Zn,isolate:vl,ivec2:vn,ivec3:En,ivec4:Mn,js:(e,t)=>yT(e,t,"js"),label:Pu,length:Go,lengthSq:pu,lessThan:ka,lessThanEqual:za,lightPosition:x_,lightProjectionUV:b_,lightShadowMatrix:y_,lightTargetDirection:v_,lightTargetPosition:T_,lightViewPosition:__,lightingContext:Gp,lights:(e=[])=>(new E_).setLights(e),linearDepth:og,linearToneMapping:aT,localId:PT,log:xo,log2:To,logarithmicDepthToViewZ:(e,t,r)=>{const s=e.mul(xo(r.div(t)));return yn(Math.E).pow(s).mul(t).negate()},luminance:Kx,mat2:Ln,mat3:Pn,mat4:Dn,matcapUV:ey,materialAO:gp,materialAlphaTest:Fh,materialAnisotropy:Yh,materialAnisotropyVector:mp,materialAttenuationColor:np,materialAttenuationDistance:ip,materialClearcoat:Hh,materialClearcoatNormal:jh,materialClearcoatRoughness:qh,materialColor:Lh,materialDispersion:hp,materialEmissive:Dh,materialEnvIntensity:Pc,materialEnvRotation:Dc,materialIOR:sp,materialIridescence:Zh,materialIridescenceIOR:Jh,materialIridescenceThickness:ep,materialLightMap:pp,materialLineDashOffset:dp,materialLineDashSize:op,materialLineGapSize:up,materialLineScale:ap,materialLineWidth:lp,materialMetalness:$h,materialNormal:Wh,materialOpacity:Uh,materialPointSize:cp,materialReference:Kc,materialReflectivity:Gh,materialRefractionRatio:Lc,materialRotation:Xh,materialRoughness:zh,materialSheen:Kh,materialSheenRoughness:Qh,materialShininess:Ph,materialSpecular:Ih,materialSpecularColor:Vh,materialSpecularIntensity:Oh,materialSpecularStrength:kh,materialThickness:rp,materialTransmission:tp,max:eu,maxMipLevel:Wl,mediumpModelViewMatrix:ic,metalness:Hn,min:Jo,mix:gu,mixElement:_u,mod:Ia,modInt:io,modelDirection:Kd,modelNormalMatrix:tc,modelPosition:Yd,modelRadius:ec,modelScale:Zd,modelViewMatrix:sc,modelViewPosition:Jd,modelViewProjection:fp,modelWorldMatrix:Qd,modelWorldMatrixInverse:rc,morphReference:Ip,mrt:mb,mul:Da,mx_aastep:lN,mx_add:(e,t=yn(0))=>La(e,t),mx_atan2:(e=yn(0),t=yn(1))=>Io(e,t),mx_cell_noise_float:(e=kl())=>Hv(e.convert("vec2|vec3")),mx_contrast:(e,t=1,r=.5)=>yn(e).sub(r).mul(t).add(r),mx_divide:(e,t=yn(1))=>Ua(e,t),mx_fractal_noise_float:(e=kl(),t=3,r=2,s=.5,i=1)=>jv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec2:(e=kl(),t=3,r=2,s=.5,i=1)=>Kv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec3:(e=kl(),t=3,r=2,s=.5,i=1)=>Xv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec4:(e=kl(),t=3,r=2,s=.5,i=1)=>Qv(e,bn(t),r,s).mul(i),mx_frame:()=>zb,mx_heighttonormal:(e,t)=>(e=Rn(e),t=yn(t),Ch(e,t)),mx_hsvtorgb:aN,mx_ifequal:(e,t,r,s)=>e.equal(t).mix(r,s),mx_ifgreater:(e,t,r,s)=>e.greaterThan(t).mix(r,s),mx_ifgreatereq:(e,t,r,s)=>e.greaterThanEqual(t).mix(r,s),mx_invert:(e,t=yn(1))=>Pa(t,e),mx_modulo:(e,t=yn(1))=>Ia(e,t),mx_multiply:(e,t=yn(1))=>Da(e,t),mx_noise_float:(e=kl(),t=1,r=0)=>$v(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec3:(e=kl(),t=1,r=0)=>Wv(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec4:(e=kl(),t=1,r=0)=>{e=e.convert("vec2|vec3");return Cn(Wv(e),$v(e.add(_n(19,73)))).mul(t).add(r)},mx_place2d:(e,t=_n(.5,.5),r=_n(1,1),s=yn(0),i=_n(0,0))=>{let n=e;if(t&&(n=n.sub(t)),r&&(n=n.mul(r)),s){const e=s.mul(Math.PI/180),t=e.cos(),r=e.sin();n=_n(n.x.mul(t).sub(n.y.mul(r)),n.x.mul(r).add(n.y.mul(t)))}return t&&(n=n.add(t)),i&&(n=n.add(i)),n},mx_power:(e,t=yn(1))=>ou(e,t),mx_ramp4:(e,t,r,s,i=kl())=>{const n=i.x.clamp(),a=i.y.clamp(),o=gu(e,t,n),u=gu(r,s,n);return gu(o,u,a)},mx_ramplr:(e,t,r=kl())=>dN(e,t,r,"x"),mx_ramptb:(e,t,r=kl())=>dN(e,t,r,"y"),mx_rgbtohsv:oN,mx_rotate2d:(e,t)=>{e=_n(e);const r=(t=yn(t)).mul(Math.PI/180);return iy(e,r)},mx_rotate3d:(e,t,r)=>{e=Rn(e),t=yn(t),r=Rn(r);const s=t.mul(Math.PI/180),i=r.normalize(),n=s.cos(),a=s.sin(),o=yn(1).sub(n);return e.mul(n).add(i.cross(e).mul(a)).add(i.mul(i.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=yn(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},s=t.replace(/^out/,"").toLowerCase();if(void 0!==r[s])return e.element(r[s])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==r[t])return e.element(r[t])}return e},mx_splitlr:(e,t,r,s=kl())=>cN(e,t,r,s,"x"),mx_splittb:(e,t,r,s=kl())=>cN(e,t,r,s,"y"),mx_srgb_texture_to_lin_rec709:uN,mx_subtract:(e,t=yn(0))=>Pa(e,t),mx_timer:()=>kb,mx_transform_uv:(e=1,t=0,r=kl())=>r.mul(e).add(t),mx_unifiednoise2d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>iN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_unifiednoise3d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>nN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_worley_noise_float:(e=kl(),t=1)=>tN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec2:(e=kl(),t=1)=>rN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec3:(e=kl(),t=1)=>sN(e.convert("vec2|vec3"),t,bn(1)),negate:zo,neutralToneMapping:mT,nodeArray:nn,nodeImmutable:on,nodeObject:tn,nodeObjectIntent:rn,nodeObjects:sn,nodeProxy:an,nodeProxyIntent:un,normalFlat:_c,normalGeometry:xc,normalLocal:Tc,normalMap:Rh,normalView:Sc,normalViewGeometry:vc,normalWorld:Rc,normalWorldGeometry:Nc,normalize:Ro,not:qa,notEqual:Va,numWorkgroups:BT,objectDirection:zd,objectGroup:va,objectPosition:Wd,objectRadius:jd,objectScale:Hd,objectViewPosition:qd,objectWorldMatrix:$d,oneMinus:$o,or:Ha,orthographicDepthToViewZ:eg,oscSawtooth:(e=kb)=>e.fract(),oscSine:(e=kb)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=kb)=>e.fract().round(),oscTriangle:(e=kb)=>e.add(.5).fract().mul(2).sub(1).abs(),output:oa,outputStruct:lb,overloadingFn:Vb,packHalf2x16:Cb,packSnorm2x16:Ab,packUnorm2x16:wb,parabola:Rb,parallaxDirection:Th,parallaxUV:(e,t)=>e.sub(Th.mul(t)),parameter:(e,t)=>new sb(e,t),pass:(e,t,r)=>new iT(iT.COLOR,e,t,r),passTexture:(e,t)=>new rT(e,t),pcurve:(e,t,r)=>ou(Ua(ou(e,t),La(ou(e,t),ou(Pa(1,e),r))),1/t),perspectiveDepthToViewZ:sg,pmremTexture:Vf,pointShadow:pv,pointUV:Cx,pointWidth:da,positionGeometry:uc,positionLocal:lc,positionPrevious:dc,positionView:pc,positionViewDirection:gc,positionWorld:cc,positionWorldDirection:hc,posterize:Yx,pow:ou,pow2:uu,pow3:lu,pow4:du,premultiplyAlpha:Tg,property:Vn,quadBroadcast:g_,quadSwapDiagonal:u_,quadSwapX:a_,quadSwapY:o_,radians:mo,rand:Tu,range:wT,rangeFogFactor:_T,reciprocal:jo,reference:qc,referenceBuffer:jc,reflect:ru,reflectVector:Oc,reflectView:Uc,reflector:e=>new lx(e),refract:yu,refractVector:Vc,refractView:Ic,reinhardToneMapping:oT,remap:El,remapClamp:Al,renderGroup:_a,renderOutput:Fl,rendererReference:el,replaceDefaultUV:function(e,t=null){return Cu(t,{getUV:"function"==typeof e?e:()=>e})},rotate:iy,rotateUV:$b,roughness:Wn,round:qo,rtt:yx,sRGBTransferEOTF:Hu,sRGBTransferOETF:qu,sample:(e,t=null)=>new Nx(e,tn(t)),sampler:e=>(!0===e.isNode?e:Kl(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:Kl(e)).convert("samplerComparison"),saturate:fu,saturation:qx,screenCoordinate:dd,screenDPR:od,screenSize:ld,screenUV:ud,select:Au,setCurrentStack:hn,setName:Bu,shaderStages:oi,shadow:ev,shadowPositionWorld:w_,shapeCircle:xv,sharedUniformGroup:xa,sheen:Xn,sheenRoughness:Kn,shiftLeft:Za,shiftRight:Ja,shininess:aa,sign:ko,sin:Ao,sinc:(e,t)=>Ao(uo.mul(t.mul(e).sub(1))).div(uo.mul(t.mul(e).sub(1))),sinh:wo,skinning:Cp,smoothstep:bu,smoothstepElement:vu,specularColor:sa,specularColorBlended:ia,specularF90:na,spherizeUV:Wb,split:(e,t)=>new yi(tn(e),t),spritesheetUV:jb,sqrt:_o,stack:nb,step:tu,stepElement:Nu,storage:Tp,storageBarrier:()=>IT("storage").toStack(),storageTexture:Dx,string:(e="")=>new vi(e,"string"),struct:(e,t=null)=>{const r=new ab(e,t),s=(...t)=>{let s=null;if(t.length>0)if(t[0].isNode){s={};const r=Object.keys(e);for(let e=0;eOx(e,t).level(r),texture3DLoad:(...e)=>Ox(...e).setSampler(!1),textureBarrier:()=>IT("texture").toStack(),textureBicubic:Fm,textureBicubicLevel:Bm,textureCubeUV:df,textureLevel:(e,t,r)=>Kl(e,t).level(r),textureLoad:Ql,textureSize:zl,textureStore:(e,t,r)=>{let s;return!0===e.isStorageTextureNode?(s=e.clone(),s.uvNode=t,s.storeNode=r):s=Dx(e,t,r),null!==r&&s.toStack(),s},thickness:pa,time:kb,toneMapping:rl,toneMappingExposure:sl,toonOutlinePass:(t,r,s=new e(0,0,0),i=.003,n=1)=>new nT(t,r,tn(s),tn(i),tn(n)),transformDirection:cu,transformNormal:Ac,transformNormalToView:wc,transformedClearcoatNormalView:Bc,transformedNormalView:Cc,transformedNormalWorld:Mc,transmission:ha,transpose:Qo,triNoise3D:Ub,triplanarTexture:(...e)=>Xb(...e),triplanarTextures:Xb,trunc:Xo,uint:xn,uintBitsToFloat:e=>new fb(e,"float","uint"),uniform:Sa,uniformArray:td,uniformCubeTexture:(e=kc)=>zc(e),uniformFlow:Mu,uniformGroup:ba,uniformTexture:(e=ql)=>Kl(e),unpackHalf2x16:Lb,unpackNormal:Nh,unpackSnorm2x16:Bb,unpackUnorm2x16:Fb,unpremultiplyAlpha:_g,userData:(e,t,r)=>new Vx(e,t,r),uv:kl,uvec2:Nn,uvec3:An,uvec4:Bn,varying:$u,varyingProperty:kn,vec2:_n,vec3:Rn,vec4:Cn,vectorComponents:ui,velocity:Wx,vertexColor:gg,vertexIndex:hl,vertexStage:Wu,vibrance:jx,viewZToLogarithmicDepth:ig,viewZToOrthographicDepth:Jp,viewZToPerspectiveDepth:tg,viewZToReversedOrthographicDepth:(e,t,r)=>e.add(r).div(r.sub(t)),viewZToReversedPerspectiveDepth:rg,viewport:cd,viewportCoordinate:pd,viewportDepthTexture:Yp,viewportLinearDepth:ug,viewportMipTexture:qp,viewportOpaqueMipTexture:Xp,viewportResolution:md,viewportSafeUV:qb,viewportSharedTexture:eT,viewportSize:hd,viewportTexture:Hp,viewportUV:gd,vogelDiskSample:vx,wgsl:(e,t)=>yT(e,t,"wgsl"),wgslFn:(e,t)=>xT(e,t,"wgsl"),workgroupArray:(e,t)=>new VT("Workgroup",e,t),workgroupBarrier:()=>IT("workgroup").toStack(),workgroupId:FT,workingToColorSpace:Ku,xor:ja});const mN=new rb;class fN extends Ry{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,r){const s=this.renderer,i=this.nodes.getBackgroundNode(e)||e.background;let n=!1;if(null===i)s._clearColor.getRGB(mN),mN.a=s._clearColor.a;else if(!0===i.isColor)i.getRGB(mN),mN.a=1,n=!0;else if(!0===i.isNode){const u=this.get(e),l=i;mN.copy(s._clearColor);let d=u.backgroundMesh;if(void 0===d){const h=Cn(l).mul(Fx).context({getUV:()=>Lx.mul(Nc),getTextureLevel:()=>Bx}),p=Ld.element(3).element(3).equal(1),g=Ua(1,Ld.element(1).element(1)).mul(3),m=p.select(lc.mul(g),lc),f=sc.mul(Cn(m,0));let y=Ld.mul(Cn(f.xyz,1));y=y.setZ(y.w);const b=new vg;function x(){i.removeEventListener("dispose",x),d.material.dispose(),d.geometry.dispose()}b.name="Background.material",b.side=L,b.depthTest=!1,b.depthWrite=!1,b.allowOverride=!1,b.fog=!1,b.lights=!1,b.vertexNode=y,b.colorNode=h,u.backgroundMeshNode=h,u.backgroundMesh=d=new oe(new ft(1,32,32),b),d.frustumCulled=!1,d.name="Background.mesh",i.addEventListener("dispose",x)}const c=l.getCacheKey();u.backgroundCacheKey!==c&&(u.backgroundMeshNode.node=Cn(l).mul(Fx),u.backgroundMeshNode.needsUpdate=!0,d.material.needsUpdate=!0,u.backgroundCacheKey=c),t.unshift(d,d.geometry,d.material,0,0,null,null)}else o("Renderer: Unsupported background configuration.",i);const a=s.xr.getEnvironmentBlendMode();if("additive"===a?mN.set(0,0,0,1):"alpha-blend"===a&&mN.set(0,0,0,0),!0===s.autoClear||!0===n){const T=r.clearColorValue;T.r=mN.r,T.g=mN.g,T.b=mN.b,T.a=mN.a,!0!==s.backend.isWebGLBackend&&!0!==s.alpha||(T.r*=T.a,T.g*=T.a,T.b*=T.a),r.depthClearValue=s.getClearDepth(),r.stencilClearValue=s.getClearStencil(),r.clearColor=!0===s.autoClearColor,r.clearDepth=!0===s.autoClearDepth,r.clearStencil=!0===s.autoClearStencil}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}}let yN=0;class bN{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=yN++}}class xN{constructor(e,t,r,s,i,n,a,o,u,l=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=l,this.nodeAttributes=s,this.bindings=i,this.updateNodes=n,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=u,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const r=new bN(t.name,[]);e.push(r);for(const e of t.bindings)r.bindings.push(e.clone())}else e.push(t)}return e}}class TN{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}}class _N{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class vN{constructor(e,t,r=!1,s=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=s}}class NN extends vN{constructor(e,t,r=null,s=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=s}}class SN{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}let RN=0;class EN{constructor(e=null){this.id=RN++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class AN{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class wN{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class CN extends wN{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class MN extends wN{constructor(e,r=new t){super(e,r),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class BN extends wN{constructor(e,t=new r){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class FN extends wN{constructor(e,t=new s){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class LN extends wN{constructor(t,r=new e){super(t,r),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class PN extends wN{constructor(e,t=new i){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class DN extends wN{constructor(e,t=new n){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class UN extends wN{constructor(e,t=new a){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class IN extends CN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class ON extends MN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class VN extends BN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kN extends FN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class GN extends LN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zN extends PN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class $N extends DN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class WN extends UN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let HN=0;const qN=new WeakMap,jN=new WeakMap,XN=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),KN=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class QN{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=nb(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new EN,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:HN++})}isFlatShading(){return!0===this.material.flatShading||!1===this.geometry.hasAttribute("normal")}isOpaque(){const e=this.material;return!1===e.transparent&&e.blending===tt&&!1===e.alphaToCoverage}createRenderTarget(e,t,r){return new ne(e,t,r)}createCubeRenderTarget(e,t){return new Fg(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const r=t[0].groupNode;let s,i=r.shared;if(i)for(let e=1;ee.nodeUniform.node.id-t.nodeUniform.node.id);for(const t of e.uniforms)r+=t.nodeUniform.node.id}else r+=e.nodeUniform.id;const i=this.renderer._currentRenderContext||this.renderer;let n=qN.get(i);void 0===n&&(n=new Map,qN.set(i,n));const a=Vs(r);s=n.get(a),void 0===s&&(s=new bN(e,t),n.set(a,s))}else s=new bN(e,t);return s}getBindGroupArray(e,t){const r=this.bindings[t];let s=r[e];return void 0===s&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=s=[]),s}getBindings(){let e=this.bindGroups;if(null===e){const t={},r=this.bindings;for(const e of oi)for(const s in r[e]){const i=r[e][s],n=t[s]||(t[s]=[]);for(const e of i)!1===n.includes(e)&&n.push(e)}e=[];for(const r in t){const s=t[r],i=this._getBindGroup(r,s);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(n)}u`:"0u";if("bool"===i)return n?"true":"false";if("color"===i)return`${this.getType("vec3")}( ${KN(n.r)}, ${KN(n.g)}, ${KN(n.b)} )`;const a=this.getTypeLength(i),o=this.getComponentType(i),u=e=>this.generateConst(o,e);if(2===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)} )`;if(3===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)} )`;if(4===a&&"mat2"!==i)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)}, ${u(n.w)} )`;if(a>=4&&n&&(n.isMatrix2||n.isMatrix3||n.isMatrix4))return`${this.getType(i)}( ${n.elements.map(u).join(", ")} )`;if(a>4)return`${this.getType(i)}()`;throw new Error(`NodeBuilder: Type '${i}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const r=this.attributes;for(const t of r)if(t.name===e)return t;const s=new TN(e,t);return this.registerDeclaration(s),r.push(s),s}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===R)return"int";if(t===S)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let r=Ws(e);const s="float"===t?"":t[0];return!0===/mat2/.test(t)&&(r=r.replace("vec","mat")),s+r}getTypeFromArray(e){return XN.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const r=t.array,s=e.itemSize,i=e.normalized;let n;return e instanceof xt||!0===i||(n=this.getTypeFromArray(r)),this.getTypeFromLength(s,n)}getTypeLength(e){const t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]!==e)throw new Error("NodeBuilder: Invalid active stack removal.");this.activeStacks.pop()}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=nb(this.stack);const e=pn();return this.stacks.push(e),hn(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){this.getDataFromNode(t).stack=e}return this.stack=e.parent,hn(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){let s=(r=null===r?e.isGlobal(this)?this.globalCache:this.cache:r).getData(e);void 0===s&&(s={},r.setData(e,s)),void 0===s[t]&&(s[t]={});let i=s[t];const n=s.any?s.any.subBuilds:null,a=this.getClosestSubBuild(n);return a&&(void 0===i.subBuildsCache&&(i.subBuildsCache={}),i=i.subBuildsCache[a]||(i.subBuildsCache[a]={}),i.subBuilds=n),i}getNodeProperties(e,t="any"){const r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const r=this.getDataFromNode(e,"vertex");let s=r.bufferAttribute;if(void 0===s){const i=this.uniforms.index++;s=new TN("nodeAttribute"+i,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,s=this.shaderStage){const i=this.getDataFromNode(e,s,this.globalCache);let n=i.structType;if(void 0===n){const a=this.structs.index++;null===r&&(r="StructType"+a),n=new AN(r,t),this.structs[s].push(n),this.types[s][r]=e,i.structType=n}return n}getOutputStructTypeFromNode(e,t){const r=this.getStructTypeFromNode(e,t,"OutputType","fragment");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,s=null){const i=this.getDataFromNode(e,r,this.globalCache);let n=i.uniform;if(void 0===n){const a=this.uniforms.index++;n=new _N(s||"nodeUniform"+a,t,e),this.uniforms[r].push(n),this.registerDeclaration(n),i.uniform=n}return n}getVarFromNode(e,t=null,r=e.getNodeType(this),s=this.shaderStage,i=!1){const n=this.getDataFromNode(e,s),a=this.getSubBuildProperty("variable",n.subBuilds);let o=n[a];if(void 0===o){const u=i?"_const":"_var",l=this.vars[s]||(this.vars[s]=[]),d=this.vars[u]||(this.vars[u]=0);null===t&&(t=(i?"nodeConst":"nodeVar")+d,this.vars[u]++),"variable"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds));const c=e.getArrayCount(this);o=new vN(t,r,i,c),i||l.push(o),this.registerDeclaration(o),n[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,r=e.getNodeType(this),s=null,i=null){const n=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",n.subBuilds);let o=n[a];if(void 0===o){const e=this.varyings,u=e.length;null===t&&(t="nodeVarying"+u),"varying"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds)),o=new NN(t,r,s,i),e.push(o),this.registerDeclaration(o),n[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),s=this.getPropertyName(e);let i=1,n=s;for(;void 0!==r[n];)n=s+"_"+i++;i>1&&(e.name=n,d(`TSL: Declaration name '${s}' of '${e.type}' already in use. Renamed to '${n}'.`)),r[n]=e}getCodeFromNode(e,t,r=this.shaderStage){const s=this.getDataFromNode(e);let i=s.code;if(void 0===i){const e=this.codes[r]||(this.codes[r]=[]),n=e.length;i=new SN("nodeCode"+n,t),e.push(i),s.code=i}return i}addFlowCodeHierarchy(e,t){const{flowCodes:r,flowCodeBlock:s}=this.getDataFromNode(e);let i=!0,n=t;for(;n;){if(!0===s.get(n)){i=!1;break}n=this.getDataFromNode(n).parentNodeBlock}if(i)for(const e of r)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,r){const s=this.getDataFromNode(e),i=s.flowCodes||(s.flowCodes=[]),n=s.flowCodeBlock||(s.flowCodeBlock=new WeakMap);i.push(t),n.set(r,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new bT,r=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=r,t}flowShaderNode(e){const t=e.layout,r={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const e of t.inputs)r[e.name]=new sb(e.type,e.name);e.layout=null;const s=e.call(r),i=this.flowStagesNode(s,t.type);return e.layout=t,i}flowBuildStage(e,t,r=null){const s=this.getBuildStage();this.setBuildStage(t);const i=e.build(this,r);return this.setBuildStage(s),i}flowStagesNode(e,t=null){const r=this.flow,s=this.vars,i=this.declarations,n=this.cache,a=this.buildStage,o=this.stack,u={code:""};this.flow=u,this.vars={},this.declarations={},this.cache=new EN,this.stack=nb();for(const r of ai)this.setBuildStage(r),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=s,this.declarations=i,this.cache=n,this.stack=o,this.setBuildStage(a),u}getFunctionOperator(){return null}buildFunctionCode(){d("Abstract function.")}flowChildNode(e,t=null){const r=this.flow,s={code:""};return this.flow=s,s.result=e.build(this,t),this.flow=r,s}flowNodeFromShaderStage(e,t,r=null,s=null){const i=this.tab,n=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const u={...this.context};delete u.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=u;let l=null;if("generate"===this.buildStage){const i=this.flowChildNode(t,r);null!==s&&(i.code+=`${this.tab+s} = ${i.result};\n`),this.flowCode[e]=this.flowCode[e]+i.code,l=i}else l=t.build(this);return this.setShaderStage(a),this.cache=n,this.tab=i,this.context=o,l}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){d("Abstract function.")}getVaryings(){d("Abstract function.")}getVar(e,t,r=null){return`${null!==r?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e,t=!1){const r=[],s=this.vars[e];if(void 0!==s)for(const e of s)r.push(`${this.getVar(e.type,e.name,e.count)};`);return r.join(t?"\n":"\n\t")}getUniforms(){d("Abstract function.")}getCodes(e){const t=this.codes[e];let r="";if(void 0!==t)for(const e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){d("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const r=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){const s=t[e];if(r.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let r,s;return r=null!==t?this.getClosestSubBuild(t):this.subBuildFn,s=r?e?r+"_"+e:r:e,s}prebuild(){const{object:e,renderer:t,material:r}=this;if(!0===t.contextNode.isContextNode?this.context={...this.context,...t.contextNode.getFlowContextData()}:o('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),r&&r.contextNode&&(!0===r.contextNode.isContextNode?this.context={...this.context,...r.contextNode.getFlowContextData()}:o('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),null!==r){let e=t.library.fromMaterial(r);null===e&&(o(`NodeBuilder: Material "${r.type}" is not compatible.`),e=new vg),e.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this);await Tt()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=jN.get(e);return void 0===t&&(t={}),t}getNodeUniform(e,t){const r=this.getSharedDataFromNode(e);let s=r.cache;if(void 0===s){if("float"===t||"int"===t||"uint"===t)s=new IN(e);else if("vec2"===t||"ivec2"===t||"uvec2"===t)s=new ON(e);else if("vec3"===t||"ivec3"===t||"uvec3"===t)s=new VN(e);else if("vec4"===t||"ivec4"===t||"uvec4"===t)s=new kN(e);else if("color"===t)s=new GN(e);else if("mat2"===t)s=new zN(e);else if("mat3"===t)s=new $N(e);else{if("mat4"!==t)throw new Error(`Uniform "${t}" not implemented.`);s=new WN(e)}r.cache=s}return s}format(e,t,r){if((t=this.getVectorType(t))===(r=this.getVectorType(r))||null===r||this.isReference(r))return e;const s=this.getTypeLength(t),i=this.getTypeLength(r);return 16===s&&9===i?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===s&&4===i?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:s>4||i>4||0===i?e:s===i?`${this.getType(r)}( ${e} )`:s>i?(e="bool"===r?`all( ${e} )`:`${e}.${"xyz".slice(0,i)}`,this.format(e,this.getTypeFromLength(i,this.getComponentType(t)),r)):4===i&&s>1?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===s?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===s&&i>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r${_t} - Node System\n`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||!0===Ys(this.object).useVelocity}}class YN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return void 0===r&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){const t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateBeforeMap,r);if(t.frameId!==this.frameId){const r=t.frameId;t.frameId=this.frameId,!1===e.updateBefore(this)&&(t.frameId=r)}}else if(t===ri.RENDER){const t=this._getMaps(this.updateBeforeMap,r);if(t.renderId!==this.renderId){const r=t.renderId;t.renderId=this.renderId,!1===e.updateBefore(this)&&(t.renderId=r)}}else t===ri.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateAfterMap,r);t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateAfterMap,r);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateMap,r);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateMap,r);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class ZN{constructor(e,t,r=null,s="",i=!1){this.type=e,this.name=t,this.count=r,this.qualifier=s,this.isConst=i}}ZN.isNodeFunctionInput=!0;class JN extends gv{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class eS extends gv{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:v_(this.light),lightColor:e}}}class tS extends gv{static get type(){return"HemisphereLightNode"}constructor(t=null){super(t),this.lightPositionNode=x_(t),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Sa(new e).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:r,lightDirectionNode:s}=this,i=Rc.dot(s).mul(.5).add(.5),n=gu(r,t,i);e.context.irradiance.addAssign(n)}}class rS extends gv{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Sa(0).setGroup(_a),this.penumbraCosNode=Sa(0).setGroup(_a),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(0).setGroup(_a),this.colorNode=Sa(this.color).setGroup(_a)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:r,penumbraCosNode:s}=this;return bu(r,s,t)}getLightCoord(e){const t=e.getNodeProperties(this);let r=t.projectionUV;return void 0===r&&(r=b_(this.light,e.context.positionWorld),t.projectionUV=r),r}setupDirect(e){const{colorNode:t,cutoffDistanceNode:r,decayExponentNode:s,light:i}=this,n=this.getLightVector(e),a=n.normalize(),o=a.dot(v_(i)),u=this.getSpotAttenuation(e,o),l=n.length(),d=mv({lightDistance:l,cutoffDistance:r,decayExponent:s});let c,h,p=t.mul(u).mul(d);if(i.colorNode?(h=this.getLightCoord(e),c=i.colorNode(h)):i.map&&(h=this.getLightCoord(e),c=Kl(i.map,h.xy).onRenderUpdate(()=>i.map)),c){p=h.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(c),p)}return{lightColor:p,lightDirection:a}}}class sS extends rS{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const r=this.light.iesMap;let s=null;if(r&&!0===r.isTexture){const e=t.acos().mul(1/Math.PI);s=Kl(r,_n(e,0),0).r}else s=super.getSpotAttenuation(t);return s}}class iS extends gv{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new r);this.lightProbe=td(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=pN(Rc,this.lightProbe);e.context.irradiance.addAssign(t)}}const nS=cn(([e,t])=>{const r=e.abs().sub(t);return Go(eu(r,0)).add(Jo(eu(r.x,r.y),0))});class aS extends rS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=yn(0),r=this.penumbraCosNode,s=y_(this.light).mul(e.context.positionWorld||cc);return gn(s.w.greaterThan(0),()=>{const e=s.xyz.div(s.w),i=nS(e.xy.sub(_n(.5)),_n(.5)),n=Ua(-1,Pa(1,Do(r)).sub(1));t.assign(fu(i.mul(-2).mul(n)))}),t}}const oS=new a,uS=new a;let lS=null;class dS extends gv{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Sa(new r).setGroup(_a),this.halfWidth=Sa(new r).setGroup(_a),this.updateType=ri.RENDER}update(e){super.update(e);const{light:t}=this,r=e.camera.matrixWorldInverse;uS.identity(),oS.copy(t.matrixWorld),oS.premultiply(r),uS.extractRotation(oS),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(uS),this.halfHeight.value.applyMatrix4(uS)}setupDirectRectArea(e){let t,r;e.isAvailable("float32Filterable")?(t=Kl(lS.LTC_FLOAT_1),r=Kl(lS.LTC_FLOAT_2)):(t=Kl(lS.LTC_HALF_1),r=Kl(lS.LTC_HALF_2));const{colorNode:s,light:i}=this;return{lightColor:s,lightPosition:__(i),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){lS=e}}class cS{parseFunction(){d("Abstract function.")}}class hS{constructor(e,t,r="",s=""){this.type=e,this.inputs=t,this.name=r,this.precision=s}getCode(){d("Abstract function.")}}hS.isNodeFunction=!0;const pS=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,gS=/[a-z_0-9]+/gi,mS="#pragma main";class fS extends hS{constructor(e){const{type:t,inputs:r,name:s,precision:i,inputsCode:n,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(mS),r=-1!==t?e.slice(t+12):e,s=r.match(pS);if(null!==s&&5===s.length){const i=s[4],n=[];let a=null;for(;null!==(a=gS.exec(i));)n.push(a);const o=[];let u=0;for(;u{let r=this._createNodeBuilder(e,e.material);try{t?await r.buildAsync():r.build()}catch(s){r=this._createNodeBuilder(e,new vg),t?await r.buildAsync():r.build(),o("TSL: "+s)}return r})().then(e=>(s=this._createNodeBuilderState(e),i.set(n,s),s.usedTimes++,r.nodeBuilderState=s,s));{let t=this._createNodeBuilder(e,e.material);try{t.build()}catch(r){t=this._createNodeBuilder(e,new vg),t.build();let s=r.stackTrace;!s&&r.stack&&(s=new Is(r.stack)),o("TSL: "+r,s)}s=this._createNodeBuilderState(t),i.set(n,s)}}s.usedTimes++,r.nodeBuilderState=s}return s}getForRenderAsync(e){const t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){const t=this.get(e);if(void 0!==t.nodeBuilderState)return t.nodeBuilderState;const r=this.getForRenderCacheKey(e),s=this.nodeBuilderCache.get(r);return void 0!==s?(s.usedTimes++,t.nodeBuilderState=s,s):(!0!==t.pendingBuild&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||0===this._buildQueue.length)return;this._buildInProgress=!0;this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;void 0!==t&&(t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){const t=this.get(e);let r=t.nodeBuilderState;if(void 0===r){const s=this.backend.createNodeBuilder(e,this.renderer);s.build(),r=this._createNodeBuilderState(s),t.nodeBuilderState=r}return r}_createNodeBuilderState(e){return new xN(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){bS[0]=e,bS[1]=t;const r=this.renderer.info.calls,s=this.callHashCache.get(bS)||{};if(s.callId!==r){const i=this.getEnvironmentNode(e),n=this.getFogNode(e);t&&xS.push(t.getCacheKey(!0)),i&&xS.push(i.getCacheKey()),n&&xS.push(n.getCacheKey()),xS.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),xS.push(this.renderer.shadowMap.enabled?1:0),xS.push(this.renderer.shadowMap.type),s.callId=r,s.cacheKey=ks(xS),this.callHashCache.set(bS,s),xS.length=0}return bS[0]=null,bS[1]=null,s.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),r=e.background;if(r){const s=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==r||s){const i=this.getCacheNode("background",r,()=>{if(!0===r.isCubeTexture||r.mapping===ce||r.mapping===he||r.mapping===Ae){if(e.backgroundBlurriness>0||r.mapping===Ae)return Vf(r);{let e;return e=!0===r.isCubeTexture?$c(r):Kl(r),Ig(e)}}if(!0===r.isTexture)return Kl(r,ud.flipY()).setUpdateMatrix(!0);!0!==r.isColor&&o("WebGPUNodes: Unsupported background configuration.",r)},s);t.backgroundNode=i,t.background=r,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,s=!1){const i=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let n=i.get(t);return(void 0===n||s)&&(n=r(),i.set(t,n)),n}updateFog(e){const t=this.get(e),r=e.fog;if(r){if(t.fog!==r){const e=this.getCacheNode("fog",r,()=>{if(r.isFogExp2){const e=qc("color","color",r).setGroup(_a),t=qc("density","float",r).setGroup(_a);return ST(e,vT(t))}if(r.isFog){const e=qc("color","color",r).setGroup(_a),t=qc("near","float",r).setGroup(_a),s=qc("far","float",r).setGroup(_a);return ST(e,_T(t,s))}o("Renderer: Unsupported fog configuration.",r)});t.fogNode=e,t.fog=r}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),r=e.environment;if(r){if(t.environment!==r){const e=this.getCacheNode("environment",r,()=>!0===r.isCubeTexture?$c(r):!0===r.isTexture?Kl(r):void o("Nodes: Unsupported environment configuration.",r));t.environmentNode=e,t.environment=r}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,s=null,i=null){const n=this.nodeFrame;return n.renderer=e,n.scene=t,n.object=r,n.camera=s,n.material=i,n}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){const t=this.renderer;return e.isArrayTexture?Kl(e,ud).depth(sd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):Kl(e,ud).renderOutput(t.toneMapping,t.currentColorSpace)}updateBefore(e){const t=e.getNodeBuilderState();for(const r of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(r)}updateAfter(e){const t=e.getNodeBuilderState();for(const r of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(r)}updateForCompute(e){const t=this.getNodeFrame(),r=this.getForCompute(e);for(const e of r.updateNodes)t.updateNode(e)}updateForRender(e){const t=this.getNodeFrameForRender(e),r=e.getNodeBuilderState();for(const e of r.updateNodes)t.updateNode(e)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new YN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const _S=new ut;class vS{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new n,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,r){const s=e.length;for(let i=0;iFl(e,i.toneMapping,i.outputColorSpace)}),LS.set(r,n))}else n=r;i.contextNode=n,i.setRenderTarget(t.renderTarget),t.rendercall(),i.contextNode=r}i.setRenderTarget(o),i._setXRLayerSize(a.x,a.y),this.isPresenting=n}getSession(){return this._session}async setSession(e){const t=this._renderer,r=t.backend;this._gl=t.getContext();const s=this._gl,i=s.getContextAttributes();if(this._session=e,null!==e){if(!0===r.isWebGPUBackend)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await r.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),!0===this._supportsLayers){let r=null,n=null,a=null;t.depth&&(a=t.stencil?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24,r=t.stencil?qe:He,n=t.stencil?Ze:S);const o={colorFormat:s.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const u=this._glBinding.createProjectionLayer(o),l=[u];this._glProjLayer=u,t.setPixelRatio(1),t._setXRLayerSize(u.textureWidth,u.textureHeight);const d=this._useMultiview?2:1,c=new Z(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,r,d);if(this._xrRenderTarget=new MS(u.textureWidth,u.textureHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,depthTexture:c,stencilBuffer:t.stencil,samples:i.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const e of this._layers)e.plane.material=new fe({color:16777215,side:"cylinder"===e.type?L:St}),e.plane.material.blending=Rt,e.plane.material.blendEquation=it,e.plane.material.blendSrc=Et,e.plane.material.blendDst=Et,e.xrlayer=this._createXRLayer(e),l.unshift(e.xrlayer);e.updateRenderState({layers:l})}else{const r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},i=new XRWebGLLayer(e,s,r);this._glBaseLayer=i,e.updateRenderState({baseLayer:i}),t.setPixelRatio(1),t._setXRLayerSize(i.framebufferWidth,i.framebufferHeight),this._xrRenderTarget=new MS(i.framebufferWidth,i.framebufferHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===i.ignoreDepthValues,resolveStencilBuffer:!1===i.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(null===t)return;const r=e.near,s=e.far,i=this._cameraXR,n=this._cameraL,a=this._cameraR;i.near=a.near=n.near=r,i.far=a.far=n.far=s,i.isMultiViewCamera=this._useMultiview,this._currentDepthNear===i.near&&this._currentDepthFar===i.far||(t.updateRenderState({depthNear:i.near,depthFar:i.far}),this._currentDepthNear=i.near,this._currentDepthFar=i.far),i.layers.mask=6|e.layers.mask,n.layers.mask=-5&i.layers.mask,a.layers.mask=-3&i.layers.mask;const o=e.parent,u=i.cameras;DS(i,o);for(let e=0;e=0&&(r[n]=null,t[n].disconnect(i))}for(let s=0;s=r.length){r.push(i),n=e;break}if(null===r[e]){r[e]=i,n=e;break}}if(-1===n)break}const a=t[n];a&&a.connect(i)}}function VS(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function kS(e,t){if(void 0===t)return;const r=this._cameraXR,i=this._renderer,n=i.backend,a=this._glBaseLayer,o=this.getReferenceSpace(),u=t.getViewerPose(o);if(this._xrFrame=t,null!==u){const e=u.views;null!==this._glBaseLayer&&n.setXRTarget(a.framebuffer);let t=!1;e.length!==r.cameras.length&&(r.cameras.length=0,t=!0);for(let i=0;i{await this.compileAsync(e,t);const s=this._renderLists.get(e,t),i=this._renderContexts.get(this._renderTarget,this._mrt),n=e.overrideMaterial||r.material,a=this._objects.get(r,n,e,t,s.lightsNode,i,i.clippingContext),{fragmentShader:o,vertexShader:u}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:u}}}}async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=r=this._getFallback(e),await r.init(this)}catch(e){return void t(e)}}this._nodes=new TS(this,r),this._animation=new xy(this,this._nodes,this.info),this._attributes=new By(r,this.info),this._background=new fN(this,this._nodes),this._geometries=new Dy(this._attributes,this.info),this._textures=new tb(this,r,this.info),this._pipelines=new zy(r,this._nodes,this.info),this._bindings=new $y(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new Sy(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Ky(this.lighting),this._bundles=new RS,this._renderContexts=new Jy(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const s=this._nodes.nodeFrame,i=s.renderId,n=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._handleObjectFunction,u=this._compilationPromises;null===r&&(r=e);const l=!0===e.isScene?e:!0===r.isScene?r:$S,d=this.needsFrameBufferTarget&&null===this._renderTarget?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,c=this._renderContexts.get(d,this._mrt),h=this._activeMipmapLevel,p=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,s.renderId++,s.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new vS),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,d);const g=this._renderLists.get(l,t);if(g.begin(),this._projectObject(e,t,0,g,c.clippingContext),r!==e&&r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&g.pushLight(e)}),g.finish(),null!==d){this._textures.updateRenderTarget(d,h);const e=this._textures.get(d);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;r!==e?this._background.update(r,g,c):this._background.update(l,g,c);const m=g.opaque,f=g.transparent,y=g.transparentDoublePass,b=g.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,l,b),!0===this.transparent&&f.length>0&&this._renderTransparents(f,y,t,l,b),s.renderId=i,this._currentRenderContext=n,this._currentRenderObjectFunction=a,this._handleObjectFunction=o,this._compilationPromises=u;for(const e of p){const t=this._objects.get(e.object,e.material,e.scene,e.camera,e.lightsNode,e.renderContext,e.clippingContext,e.passId);t.drawRange=e.object.geometry.drawRange,t.group=e.group,this._geometries.updateForRender(t),await this._nodes.getForRenderAsync(t),this._nodes.updateBefore(t),this._nodes.updateForRender(t),this._bindings.updateForRender(t);const r=[];this._pipelines.getForRender(t,r),r.length>0&&await Promise.all(r),this._nodes.updateAfter(t),await Tt()}}async renderAsync(e,t){v('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){o("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;!0===e?(t.modelViewMatrix=nc,t.modelNormalViewMatrix=ac):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===nc&&e.modelNormalViewMatrix===ac}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return v('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),o(t),this._isDeviceLost=!0}_renderBundle(e,t,r){const{bundleGroup:s,camera:i,renderList:n}=e,a=this._currentRenderContext,o=this._bundles.get(s,i,a),u=this.backend.get(o),l=s.version!==u.version;if(l||void 0===u.bundleGPU){this.backend.beginBundle(a),(void 0===u.renderObjects||l)&&(u.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:d,opaque:c}=n;!0===this.opaque&&c.length>0&&this._renderObjects(c,i,t,r),!0===this.transparent&&d.length>0&&this._renderTransparents(d,e,i,t,r),this._currentRenderBundle=null,this.backend.finishBundle(a,o),u.version=s.version}else{const{renderObjects:e}=u;for(let t=0,r=e.length;t{u.removeEventListener("dispose",e),l.dispose(),this._frameBufferTargets.delete(u)};u.addEventListener("dispose",e),this._frameBufferTargets.set(u,l)}const d=this.getOutputRenderTarget();l.depthBuffer=a,l.stencilBuffer=o,null!==d?l.setSize(d.width,d.height,d.depth):l.setSize(i,n,1);const c=this._outputRenderTarget?this._outputRenderTarget.viewport:u._viewport,h=this._outputRenderTarget?this._outputRenderTarget.scissor:u._scissor,g=this._outputRenderTarget?1:u._pixelRatio,f=this._outputRenderTarget?this._outputRenderTarget.scissorTest:u._scissorTest;return l.viewport.copy(c),l.scissor.copy(h),l.viewport.multiplyScalar(g),l.scissor.multiplyScalar(g),l.scissorTest=f,l.multiview=null!==d&&d.multiview,l.resolveDepthBuffer=null===d||d.resolveDepthBuffer,l._autoAllocateDepthBuffer=null!==d&&d._autoAllocateDepthBuffer,l}_renderScene(e,t,r=!0){if(!0===this._isDeviceLost)return;const s=r?this._getFrameBufferTarget():null,i=this._nodes.nodeFrame,n=i.renderId,a=this._currentRenderContext,o=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;const l=!0===e.isScene?e:$S,d=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,h=this._activeMipmapLevel;let p;if(null!==s?(p=s,this.setRenderTarget(p)):p=d,null!==p&&!0===p.depthBuffer){const e=this._textures.get(p);!0!==e.depthInitialized&&((!1===this.autoClear||!0===this.autoClear&&!1===this.autoClearDepth)&&this.clearDepth(),e.depthInitialized=!0)}const g=this._renderContexts.get(p,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,i.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,p);const m=this.xr;if(!1===m.isPresenting){let e=!1;if(!0===this.reversedDepthBuffer&&!0!==t.reversedDepth){if(t._reversedDepth=!0,t.isArrayCamera)for(const e of t.cameras)e._reversedDepth=!0;e=!0}const r=this.coordinateSystem;if(t.coordinateSystem!==r){if(t.coordinateSystem=r,t.isArrayCamera)for(const e of t.cameras)e.coordinateSystem=r;e=!0}if(!0===e&&(t.updateProjectionMatrix(),t.isArrayCamera))for(const e of t.cameras)e.updateProjectionMatrix()}!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===m.enabled&&!0===m.isPresenting&&(!0===m.cameraAutoUpdate&&m.updateCamera(t),t=m.getCamera());const f=this._canvasTarget;let y=f._viewport,b=f._scissor,x=f._pixelRatio;null!==p&&(y=p.viewport,b=p.scissor,x=1),this.getDrawingBufferSize(WS),HS.set(0,0,WS.width,WS.height);const T=void 0===y.minDepth?0:y.minDepth,_=void 0===y.maxDepth?1:y.maxDepth;g.viewportValue.copy(y).multiplyScalar(x).floor(),g.viewportValue.width>>=h,g.viewportValue.height>>=h,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=_,g.viewport=!1===g.viewportValue.equals(HS),g.scissorValue.copy(b).multiplyScalar(x).floor(),g.scissor=f._scissorTest&&!1===g.scissorValue.equals(HS),g.scissorValue.width>>=h,g.scissorValue.height>>=h,g.clippingContext||(g.clippingContext=new vS),g.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,p);const v=t.isArrayCamera?jS:qS;t.isArrayCamera||(XS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),v.setFromProjectionMatrix(XS,t.coordinateSystem,t.reversedDepth));const N=this._renderLists.get(e,t);if(N.begin(),this._projectObject(e,t,0,N,g.clippingContext),N.finish(),!0===this.sortObjects&&N.sort(this._opaqueSort,this._transparentSort),null!==p){this._textures.updateRenderTarget(p,h);const e=this._textures.get(p);g.textures=e.textures,g.depthTexture=e.depthTexture,g.width=e.width,g.height=e.height,g.renderTarget=p,g.depth=p.depthBuffer,g.stencil=p.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=WS.width,g.height=WS.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=h,g.height>>=h,g.activeCubeFace=c,g.activeMipmapLevel=h,g.occlusionQueryCount=N.occlusionQueryCount,g.scissorValue.max(KS.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(l,N,g),g.camera=t,this.backend.beginRender(g);const{bundles:S,lightsNode:R,transparentDoublePass:E,transparent:A,opaque:w}=N;return S.length>0&&this._renderBundles(S,l,R),!0===this.opaque&&w.length>0&&this._renderObjects(w,t,l,R),!0===this.transparent&&A.length>0&&this._renderTransparents(A,E,t,l,R),this.backend.finishRender(g),i.renderId=n,this._currentRenderContext=a,this._currentRenderObjectFunction=o,this._handleObjectFunction=u,this._callDepth--,null!==s&&(this.setRenderTarget(d,c,h),this._renderOutput(p)),l.onAfterRender(this,e,t,p),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._nodes.getOutputCacheKey();let r,s=this._quadCache.get(e.texture);if(void 0===s){r=new gx(new vg),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),s={quad:r,cacheKey:t},this._quadCache.set(e.texture,s);const i=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",i)};e.texture.addEventListener("dispose",i)}else r=s.quad,s.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,s.cacheKey=t);const i=this.autoClear,n=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(r,r.camera,!1),this.autoClear=i,this.xr.enabled=n}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){let t=e;if(!0!==t.isReadbackBuffer){const r=e,s=this.backend.get(r);if(t=s.readbackBuffer,void 0===t){t=new zS(r);const e=()=>{r.removeEventListener("dispose",e),t.dispose(),delete s.readbackBuffer};r.addEventListener("dispose",e),s.readbackBuffer=t}}if(!1===this.info.memoryMap.has(t)){this.info.createReadbackBuffer(t);const e=()=>{t.removeEventListener("dispose",e),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",e)}return t.release(),await this.backend.getArrayBufferAsync(t)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,s){this._canvasTarget.setScissor(e,t,r,s)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,s,i=0,n=1){this._canvasTarget.setViewport(e,t,r,s,i,n)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return!0===this.reversedDepthBuffer?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(!1===this._initialized)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const s=this._renderTarget||this._getFrameBufferTarget();let i=null;if(null!==s){this._textures.updateRenderTarget(s);const e=this._textures.get(s);i=this._renderContexts.get(s,null,-1),i.textures=e.textures,i.depthTexture=e.depthTexture,i.width=e.width,i.height=e.height,i.renderTarget=s,i.depth=s.depthBuffer,i.stencil=s.stencilBuffer;const t=this.backend.getClearColor();i.clearColorValue.r=t.r,i.clearColorValue.g=t.g,i.clearColorValue.b=t.b,i.clearColorValue.a=t.a,i.clearDepthValue=this.getClearDepth(),i.clearStencilValue=this.getClearStencil(),i.activeCubeFace=this.getActiveCubeFace(),i.activeMipmapLevel=this.getActiveMipmapLevel(),!0===s.depthBuffer&&(e.depthInitialized=!0)}this.backend.clear(e,t,r,i),null!==s&&null===this._renderTarget&&this._renderOutput(s)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){v('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){v('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){v('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){v('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==m,t=this.currentColorSpace!==p.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:m}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:p.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){if(!0===this._initialized){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(const e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(const e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return d("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const r=this._nodes.nodeFrame,s=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const i=this.backend,n=this._pipelines,a=this._bindings,o=this._nodes,u=Array.isArray(e)?e:[e];if(void 0===u[0]||!0!==u[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");i.beginCompute(e);for(const r of u){if(!1===n.has(r)){const e=()=>{r.removeEventListener("dispose",e),n.delete(r),a.deleteForCompute(r),o.delete(r)};r.addEventListener("dispose",e);const t=r.onInitFunction;null!==t&&t.call(r,{renderer:this})}o.updateForCompute(r),a.updateForCompute(r);const s=a.getForCompute(r),u=n.getForCompute(r,s);i.compute(e,r,s,u,t)}i.finishCompute(e),r.renderId=s,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return v('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){v('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(!1===this._initialized)throw new Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=KS.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void o("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=KS.copy(t).floor()}else t=KS.set(0,0,e.image.width,e.image.height);let r,s=this._currentRenderContext;null!==s?r=s.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),null!==r&&(this._textures.updateRenderTarget(r),s=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,s,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,s=null,i=0,n=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,s,i,n),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,s,i,n=0,a=0){return this.backend.copyTextureToBuffer(e.textures[n],t,r,s,i,a)}_projectObject(e,t,r,s,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(i=i.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)s.pushLight(e);else if(e.isSprite){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsSprite(e,t)){!0===this.sortObjects&&KS.setFromMatrixPosition(e.matrixWorld).applyMatrix4(XS);const{geometry:t,material:n}=e;n.visible&&s.push(e,t,n,r,KS.z,null,i)}}else if(e.isLineLoop)o("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsObject(e,t)){const{geometry:t,material:n}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),KS.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(XS)),Array.isArray(n)){const a=t.groups;for(let o=0,u=a.length;o0){for(const{material:e}of t)e.side=L;this._renderObjects(t,r,s,i,"backSide");for(const{material:e}of t)e.side=St;this._renderObjects(e,r,s,i);for(const{material:e}of t)e.side=P}else this._renderObjects(e,r,s,i)}_renderObjects(e,t,r,s,i=null){for(let n=0,a=e.length;n(t.not().discard(),e))(u)}}e.depthNode&&e.depthNode.isNode&&(l=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:u,depthNode:l,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}renderObject(e,t,r,s,i,n,a,o=null,u=null){let l,d,c,h,p=!1;if(e.onBeforeRender(this,t,r,s,i,n),!0===i.allowOverride&&null!==t.overrideMaterial){const e=t.overrideMaterial;if(p=!0,l=e.isNodeMaterial?e.colorNode:null,d=e.isNodeMaterial?e.depthNode:null,c=e.isNodeMaterial?e.positionNode:null,h=t.overrideMaterial.side,i.positionNode&&i.positionNode.isNode&&(e.positionNode=i.positionNode),e.alphaTest=i.alphaTest,e.alphaMap=i.alphaMap,e.transparent=i.transparent||i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode||i.backdropNode&&i.backdropNode.isNode,e.isShadowPassMaterial){const{colorNode:t,depthNode:r,positionNode:s}=this._getShadowNodes(i);this.shadowMap.type===pt?e.side=null!==i.shadowSide?i.shadowSide:i.side:e.side=null!==i.shadowSide?i.shadowSide:QS[i.side],null!==t&&(e.colorNode=t),null!==r&&(e.depthNode=r),null!==s&&(e.positionNode=s)}i=e}!0===i.transparent&&i.side===P&&!1===i.forceSinglePass?(i.side=L,this._handleObjectFunction(e,i,t,r,a,n,o,"backSide"),i.side=St,this._handleObjectFunction(e,i,t,r,a,n,o,u),i.side=P):this._handleObjectFunction(e,i,t,r,a,n,o,u),p&&(t.overrideMaterial.colorNode=l,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=h),e.onAfterRender(this,t,r,s,i,n)}hasCompatibility(e){if(!1===this._initialized)throw new Error('Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,s,i,n,a,o){const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);if(u.drawRange=e.geometry.drawRange,u.group=n,null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(u),u.bundle=this._currentRenderBundle.bundleGroup}const l=this._nodes.needsRefresh(u);l&&(this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u)),this._pipelines.updateForRender(u),this._pipelines.isReady(u)&&(this.backend.draw(u,this.info),l&&this._nodes.updateAfter(u))}_createObjectPipeline(e,t,r,s,i,n,a,o){if(null!==this._compilationPromises)return void this._compilationPromises.push({object:e,material:t,scene:r,camera:s,lightsNode:i,group:n,clippingContext:a,passId:o,renderContext:this._currentRenderContext});const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);u.drawRange=e.geometry.drawRange,u.group=n,this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u),this._pipelines.getForRender(u,this._compilationPromises),this._nodes.updateAfter(u)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class ZS{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}class JS extends ZS{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return(e=this._buffer.byteLength)+(My-e%My)%My;var e}get buffer(){return this._buffer}update(){return!0}}class eR extends JS{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let tR=0;class rR extends eR{constructor(e,t){super("UniformBuffer_"+tR++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class sR extends eR{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){const t=e.index;if(!0!==this._updateRangeCache.has(t)){const r=this.updateRanges,s={start:e.offset,count:e.itemSize};r.push(s),this._updateRangeCache.set(t,s)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let r=0,s=this.uniforms.length;r{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let oR=0;class uR extends aR{constructor(e,t){super(e,t),this.id=oR++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class lR extends uR{constructor(e,t,r,s=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=s}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class dR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledCubeTexture=!0}}class cR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledTexture3D=!0}}const hR={bitcast_int_uint:new fT("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new fT("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},pR={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},gR={low:"lowp",medium:"mediump",high:"highp"},mR={swizzleAssign:!0,storageBuffer:!1},fR={perspective:"smooth",linear:"noperspective"},yR={centroid:"centroid"},bR="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision highp sampler2DShadow;\nprecision highp sampler2DArrayShadow;\nprecision highp samplerCubeShadow;\n";class xR extends QN{constructor(e,t){super(e,t,new yS),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==T}_include(e){const t=hR[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==hR[e]&&this._include(e),pR[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {\n\n\t${r.vars}\n\n${r.code}\n\treturn ${r.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,r=t.count*t.itemSize,{itemSize:s}=t,i=t.array.constructor.name.toLowerCase().includes("int");let n=i?We:$e;2===s?n=i?je:$:3===s?n=i?Ke:Xe:4===s&&(n=i?Lt:Ee);const a={Float32Array:K,Uint8Array:Ve,Uint16Array:Ge,Uint32Array:S,Int8Array:Oe,Int16Array:ke,Int32Array:R,Uint8ClampedArray:Ve},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let u=Math.ceil(r/s/o);o*u*s0?i:"";t=`${r.name} {\n\t${s} ${e.name}[${n}];\n};\n`}else{const t=e.groupNode.name;if(void 0===s[t]){const e=this.uniformGroups[t];if(void 0!==e){const r=[];for(const t of e.uniforms){const e=t.getType(),s=this.getVectorType(e),i=t.nodeUniform.node.precision;let n=`${s} ${t.name};`;null!==i&&(n=gR[i]+" "+n),r.push("\t"+n)}s[t]=r}}i=!0}if(!i){const s=e.node.precision;null!==s&&(t=gR[s]+" "+t),t="uniform "+t,r.push(t)}}let i="";for(const e in s){const t=s[e];i+=this._getGLSLUniformStruct(e,t.join("\n"))+"\n"}return i+=r.join("\n"),i}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==R){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);const s=r.array;!1==(s instanceof Uint32Array||s instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let r=0;for(const s of e)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};\n`}return t}getStructMembers(e){const t=[];for(const r of e.members)t.push(`\t${r.type} ${r.name};`);return t.join("\n")}getStructs(e){const t=[],r=this.structs[e],s=[];for(const e of r)if(e.output)for(const t of e.members)s.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let r="struct "+e.name+" {\n";r+=this.getStructMembers(e),r+="\n};\n",t.push(r)}return 0===s.length&&s.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+s.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const r=this.varyings;if("vertex"===e||"compute"===e)for(const s of r){"compute"===e&&(s.needsInterpolation=!0);const r=this.getType(s.type);if(s.needsInterpolation)if(s.interpolationType){t+=`${fR[s.interpolationType]||s.interpolationType} ${yR[s.interpolationSampling]||""} out ${r} ${s.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}out ${r} ${s.name};\n`}else t+=`${r} ${s.name};\n`}else if("fragment"===e)for(const e of r)if(e.needsInterpolation){const r=this.getType(e.type);if(e.interpolationType){t+=`${fR[e.interpolationType]||e.interpolationType} ${yR[e.interpolationSampling]||""} in ${r} ${e.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}in ${r} ${e.name};\n`}}for(const r of this.builtins[e])t+=`${r};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,r=this.shaderStage){const s=this.extensions[r]||(this.extensions[r]=new Map);!1===s.has(e)&&s.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const r=this.extensions[e];if(void 0!==r)for(const{name:e,behavior:s}of r.values())t.push(`#extension ${e} : ${s}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=mR[e];if(void 0===t){let r;switch(t=!1,e){case"float32Filterable":r="OES_texture_float_linear";break;case"clipDistance":r="WEBGL_clip_cull_distance"}if(void 0!==r){const e=this.renderer.backend.extensions;e.has(r)&&(e.get(r),t=!0)}mR[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let r=0;r0&&(r+="\n"),r+=`\t// flow -> ${n}\n\t`),r+=`${s.code}\n\t`,e===i&&"compute"!==t&&(r+="// result\n\t","vertex"===t?(r+="gl_Position = ",r+=`${s.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(r+="fragColor = ",r+=`${s.result};`)))}const n=e[t];if(n.extensions=this.getExtensions(t),n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.vars=this.getVars(t,!0),n.structs=this.getStructs(t),n.codes=this.getCodes(t),n.transforms=this.getTransforms(t),n.flow=r,"vertex"===t){const e=this.renderer.backend.extensions;this.object.isBatchedMesh&&!1===e.has("WEBGL_multi_draw")&&(n.uniforms+="\nuniform uint nodeUniformDrawId;\n")}}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);let a=n.uniformGPU;if(void 0===a){const s=e.groupNode,o=s.name,u=this.getBindGroupArray(o,r);if("texture"===t)a=new lR(i.name,i.node,s),u.push(a);else if("cubeTexture"===t||"cubeDepthTexture"===t)a=new dR(i.name,i.node,s),u.push(a);else if("texture3D"===t)a=new cR(i.name,i.node,s),u.push(a);else if("buffer"===t){i.name=`buffer${e.id}`;const t=this.getSharedDataFromNode(e);let r=t.buffer;void 0===r&&(e.name=`NodeBuffer_${e.id}`,r=new rR(e,s),r.name=e.name,t.buffer=r),u.push(r),a=r}else{let e=this.uniformGroups[o];void 0===e?(e=new nR(o,s),this.uniformGroups[o]=e,u.push(e)):-1===u.indexOf(e)&&u.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}}let TR=null,_R=null;class vR{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Pt.RENDER]:null,[Pt.COMPUTE]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),r=this.renderer.info.frame;let s;s=!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls,t.timestampUID=s+":"+e.id+":f"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?Pt.COMPUTE:Pt.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void v("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return;const r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return TR=TR||new t,this.renderer.getDrawingBufferSize(TR)}setScissorTest(){}getClearColor(){const e=this.renderer;return _R=_R||new rb,e.getClearColor(_R),_R.getRGB(_R),_R}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Dt(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${_t} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let NR,SR,RR=0;class ER{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class AR{constructor(e){this.backend=e}createAttribute(e,t){const r=this.backend,{gl:s}=r,i=e.array,n=e.usage||s.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=r.get(a);let u,l=o.bufferGPU;if(void 0===l&&(l=this._createBuffer(s,t,i,n),o.bufferGPU=l,o.bufferType=t,o.version=a.version),i instanceof Float32Array)u=s.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)u=s.HALF_FLOAT;else if(i instanceof Uint16Array)u=e.isFloat16BufferAttribute?s.HALF_FLOAT:s.UNSIGNED_SHORT;else if(i instanceof Int16Array)u=s.SHORT;else if(i instanceof Uint32Array)u=s.UNSIGNED_INT;else if(i instanceof Int32Array)u=s.INT;else if(i instanceof Int8Array)u=s.BYTE;else if(i instanceof Uint8Array)u=s.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+i);u=s.UNSIGNED_BYTE}let d={bufferGPU:l,bufferType:t,type:u,byteLength:i.byteLength,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===s.INT||u===s.UNSIGNED_INT||e.gpuType===R,id:RR++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(s,t,i,n);d=new ER(d,e)}r.set(e,d)}updateAttribute(e){const t=this.backend,{gl:r}=t,s=e.array,i=e.isInterleavedBufferAttribute?e.data:e,n=t.get(i),a=n.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(a,n.bufferGPU),0===o.length)r.bufferSubData(a,0,s);else{for(let e=0,t=o.length;e{r.deleteBuffer(l),t.delete(e),e.removeEventListener("dispose",s)};e.addEventListener("dispose",s),u.writeBuffer=l}else r.bindBuffer(r.COPY_WRITE_BUFFER,l);r.copyBufferSubData(r.COPY_READ_BUFFER,r.COPY_WRITE_BUFFER,0,0,o),await t.utils._clientWaitAsync();const d=new s.array.constructor(a.length);return r.bindBuffer(r.COPY_WRITE_BUFFER,l),r.getBufferSubData(r.COPY_WRITE_BUFFER,0,d),r.bindBuffer(r.COPY_READ_BUFFER,null),r.bindBuffer(r.COPY_WRITE_BUFFER,null),d}_createBuffer(e,t,r,s){const i=e.createBuffer();return e.bindBuffer(t,i),e.bufferData(t,r,s),e.bindBuffer(t,null),i}}class wR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;NR={[it]:e.FUNC_ADD,[It]:e.FUNC_SUBTRACT,[Ut]:e.FUNC_REVERSE_SUBTRACT},SR={[Et]:e.ZERO,[Ht]:e.ONE,[Wt]:e.SRC_COLOR,[rt]:e.SRC_ALPHA,[$t]:e.SRC_ALPHA_SATURATE,[zt]:e.DST_COLOR,[Gt]:e.DST_ALPHA,[kt]:e.ONE_MINUS_SRC_COLOR,[st]:e.ONE_MINUS_SRC_ALPHA,[Vt]:e.ONE_MINUS_DST_COLOR,[Ot]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=(new s).fromArray(t),this.currentViewport=(new s).fromArray(r),this._tempVec4=new s}enable(e){const{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==qt?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===jt?t.cullFace(t.BACK):e===Xt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){const s=this.gl,i=this.backend.drawBuffersIndexedExt;if(i)for(let n=0;n0?this.enable(s.SAMPLE_ALPHA_TO_COVERAGE):this.disable(s.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r){const e=12288;for(let t=0;t<8;t++)t{!function i(){const n=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(n===e.WAIT_FAILED)return e.deleteSync(t),void s();n!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),r()):requestAnimationFrame(i)}()})}}let MR,BR,FR,LR=!1;class PR{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===LR&&(this._init(),LR=!0)}_init(){const e=this.gl;MR={[kr]:e.REPEAT,[_e]:e.CLAMP_TO_EDGE,[Vr]:e.MIRRORED_REPEAT},BR={[B]:e.NEAREST,[Gr]:e.NEAREST_MIPMAP_NEAREST,[bt]:e.NEAREST_MIPMAP_LINEAR,[le]:e.LINEAR,[yt]:e.LINEAR_MIPMAP_NEAREST,[Y]:e.LINEAR_MIPMAP_LINEAR},FR={[Hr]:e.NEVER,[Wr]:e.ALWAYS,[A]:e.LESS,[w]:e.LEQUAL,[$r]:e.EQUAL,[M]:e.GEQUAL,[C]:e.GREATER,[zr]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let r;return r=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,r}getInternalFormat(e,t,r,s,i,n=!1){const{gl:a,extensions:o}=this;if(null!==e){if(void 0!==a[e])return a[e];d("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=null;s&&(u=o.get("EXT_texture_norm16"),u||d("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let l=t;if(t===a.RED&&(r===a.FLOAT&&(l=a.R32F),r===a.HALF_FLOAT&&(l=a.R16F),r===a.UNSIGNED_BYTE&&(l=a.R8),r===a.BYTE&&(l=a.R8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.R16_EXT),r===a.SHORT&&u&&(l=u.R16_SNORM_EXT)),t===a.RED_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.R8UI),r===a.UNSIGNED_SHORT&&(l=a.R16UI),r===a.UNSIGNED_INT&&(l=a.R32UI),r===a.BYTE&&(l=a.R8I),r===a.SHORT&&(l=a.R16I),r===a.INT&&(l=a.R32I)),t===a.RG&&(r===a.FLOAT&&(l=a.RG32F),r===a.HALF_FLOAT&&(l=a.RG16F),r===a.UNSIGNED_BYTE&&(l=a.RG8),r===a.BYTE&&(l=a.RG8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RG16_EXT),r===a.SHORT&&u&&(l=u.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RG8UI),r===a.UNSIGNED_SHORT&&(l=a.RG16UI),r===a.UNSIGNED_INT&&(l=a.RG32UI),r===a.BYTE&&(l=a.RG8I),r===a.SHORT&&(l=a.RG16I),r===a.INT&&(l=a.RG32I)),t===a.RGB){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGB32F),r===a.HALF_FLOAT&&(l=a.RGB16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8:a.RGB8),r===a.BYTE&&(l=a.RGB8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGB16_EXT),r===a.SHORT&&u&&(l=u.RGB16_SNORM_EXT),r===a.UNSIGNED_SHORT_5_6_5&&(l=a.RGB565),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGB4),r===a.UNSIGNED_INT_5_9_9_9_REV&&(l=a.RGB9_E5),r===a.UNSIGNED_INT_10F_11F_11F_REV&&(l=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGB8UI),r===a.UNSIGNED_SHORT&&(l=a.RGB16UI),r===a.UNSIGNED_INT&&(l=a.RGB32UI),r===a.BYTE&&(l=a.RGB8I),r===a.SHORT&&(l=a.RGB16I),r===a.INT&&(l=a.RGB32I)),t===a.RGBA){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGBA32F),r===a.HALF_FLOAT&&(l=a.RGBA16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8_ALPHA8:a.RGBA8),r===a.BYTE&&(l=a.RGBA8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGBA16_EXT),r===a.SHORT&&u&&(l=u.RGBA16_SNORM_EXT),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGBA4),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGBA8UI),r===a.UNSIGNED_SHORT&&(l=a.RGBA16UI),r===a.UNSIGNED_INT&&(l=a.RGBA32UI),r===a.BYTE&&(l=a.RGBA8I),r===a.SHORT&&(l=a.RGBA16I),r===a.INT&&(l=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(r===a.UNSIGNED_SHORT&&(l=a.DEPTH_COMPONENT16),r===a.UNSIGNED_INT&&(l=a.DEPTH_COMPONENT24),r===a.FLOAT&&(l=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&r===a.UNSIGNED_INT_24_8&&(l=a.DEPTH24_STENCIL8),l!==a.R16F&&l!==a.R32F&&l!==a.RG16F&&l!==a.RG32F&&l!==a.RGBA16F&&l!==a.RGBA32F||o.get("EXT_color_buffer_float"),l}setTextureParameters(e,t){const{gl:r,extensions:s,backend:i}=this,{state:n}=this.backend,a=p.getPrimaries(p.workingColorSpace),o=t.colorSpace===T?null:p.getPrimaries(t.colorSpace),u=t.colorSpace===T||a===o?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,u),r.texParameteri(e,r.TEXTURE_WRAP_S,MR[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,MR[t.wrapT]),e!==r.TEXTURE_3D&&e!==r.TEXTURE_2D_ARRAY||t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,MR[t.wrapR]),r.texParameteri(e,r.TEXTURE_MAG_FILTER,BR[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,d=t.minFilter===le&&l?Y:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,BR[d]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,FR[t.compareFunction])),!0===s.has("EXT_texture_filter_anisotropic")){if(t.magFilter===B)return;if(t.minFilter!==bt&&t.minFilter!==Y)return;if(t.type===K&&!1===s.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const n=s.get("EXT_texture_filter_anisotropic");r.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:r,defaultTextures:s}=this,i=this.getGLTextureType(e);let n=s[i];void 0===n&&(n=t.createTexture(),r.state.bindTexture(i,n),t.texParameteri(i,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(i,t.TEXTURE_MAG_FILTER,t.NEAREST),s[i]=n),r.set(e,{textureGPU:n,glTextureType:i})}createTexture(e,t){const{gl:r,backend:s}=this,{levels:i,width:n,height:a,depth:o}=t,u=s.utils.convert(e.format,e.colorSpace),l=s.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,u,l,e.normalized,e.colorSpace,e.isVideoTexture),c=r.createTexture(),h=this.getGLTextureType(e);s.state.bindTexture(h,c),this.setTextureParameters(h,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,i,d,n,a,o):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,i,d,n,a,o):e.isVideoTexture||r.texStorage2D(h,i,d,n,a),s.set(e,{textureGPU:c,glTextureType:h,glFormat:u,glType:l,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:r,backend:s}=this,{state:i}=s,{textureGPU:n,glTextureType:a,glFormat:o,glType:u}=s.get(t),{width:l,height:d}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),s.state.bindTexture(a,n),i.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(a,0,0,0,l,d,o,u,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),s.state.unbindTexture()}updateTexture(e,t){const{gl:r}=this,{width:s,height:i}=t,{textureGPU:n,glTextureType:a,glFormat:o,glType:u,glInternalFormat:l}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==n)if(this.backend.state.bindTexture(a,n),this.setTextureParameters(a,e),e.isCompressedTexture){const s=e.mipmaps,i=t.image;for(let t=0;t0){const t=jr(s.width,s.height,e.format,e.type);for(const i of e.layerUpdates){const e=s.data.subarray(i*t/s.data.BYTES_PER_ELEMENT,(i+1)*t/s.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,i,s.width,s.height,1,o,u,e)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,s.width,s.height,s.depth,o,u,s.data)}else if(e.isData3DTexture){const e=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,u,e.data)}else if(e.isVideoTexture)e.update(),r.texImage2D(a,0,l,o,u,t.image);else{const n=e.mipmaps;if(n.length>0)for(let e=0,t=n.length;e0,c=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(d){const r=0!==a||0!==o;let d,h;if(!0===e.isDepthTexture?(d=s.DEPTH_BUFFER_BIT,h=s.DEPTH_ATTACHMENT,t.stencil&&(d|=s.STENCIL_BUFFER_BIT)):(d=s.COLOR_BUFFER_BIT,h=s.COLOR_ATTACHMENT0),r){const e=this.backend.get(t.renderTarget),r=e.framebuffers[t.getCacheKey()],h=e.msaaFrameBuffer;i.bindFramebuffer(s.DRAW_FRAMEBUFFER,r),i.bindFramebuffer(s.READ_FRAMEBUFFER,h);const p=c-o-l;s.blitFramebuffer(a,p,a+u,p+l,a,p,a+u,p+l,d,s.NEAREST),i.bindFramebuffer(s.READ_FRAMEBUFFER,r),i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,p,u,l),i.unbindTexture()}else{const e=s.createFramebuffer();i.bindFramebuffer(s.DRAW_FRAMEBUFFER,e),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,h,s.TEXTURE_2D,n,0),s.blitFramebuffer(0,0,u,l,0,0,u,l,d,s.NEAREST),s.deleteFramebuffer(e)}}else i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,c-l-o,u,l),i.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,s=!1){const{gl:i}=this,n=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:u,width:l,height:d}=n;if(i.bindRenderbuffer(i.RENDERBUFFER,e),o&&!u){let t=i.DEPTH_COMPONENT24;if(!0===s){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(i.RENDERBUFFER,n.samples,t,l,d)}else r>0?(a&&a.isDepthTexture&&a.type===i.FLOAT&&(t=i.DEPTH_COMPONENT32F),i.renderbufferStorageMultisample(i.RENDERBUFFER,r,t,l,d)):i.renderbufferStorage(i.RENDERBUFFER,t,l,d);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e)}else o&&u&&(r>0?i.renderbufferStorageMultisample(i.RENDERBUFFER,r,i.DEPTH24_STENCIL8,l,d):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,l,d),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e));i.bindRenderbuffer(i.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,s,i,n){const{backend:a,gl:o}=this,{textureGPU:u,glFormat:l,glType:d}=this.backend.get(e),c=o.createFramebuffer();a.state.bindFramebuffer(o.READ_FRAMEBUFFER,c);const h=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+n:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,u,0);const p=this._getTypedArrayType(d),g=s*i*this._getBytesPerTexel(d,l),m=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.bufferData(o.PIXEL_PACK_BUFFER,g,o.STREAM_READ),o.readPixels(t,r,s,i,l,d,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const f=new p(g/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,f),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(c),f}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:r}=this;let s=0;return e===r.UNSIGNED_BYTE&&(s=1),e!==r.UNSIGNED_SHORT_4_4_4_4&&e!==r.UNSIGNED_SHORT_5_5_5_1&&e!==r.UNSIGNED_SHORT_5_6_5&&e!==r.UNSIGNED_SHORT&&e!==r.HALF_FLOAT||(s=2),e!==r.UNSIGNED_INT&&e!==r.FLOAT||(s=4),t===r.RGBA?4*s:t===r.RGB?3*s:t===r.ALPHA?s:void 0}dispose(){const{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function DR(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class UR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class IR{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(null!==this.maxUniformBlockSize)return this.maxUniformBlockSize;const e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}}const OR={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class VR{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:r,mode:s,object:i,type:n,info:a,index:o}=this;0!==o?r.drawElements(s,t,n,e):r.drawArrays(s,e,t),a.update(i,t,1)}renderInstances(e,t,r){const{gl:s,mode:i,type:n,index:a,object:o,info:u}=this;0!==r&&(0!==a?s.drawElementsInstanced(i,t,n,e,r):s.drawArraysInstanced(i,e,t,r),u.update(o,t,r))}renderMultiDraw(e,t,r){const{extensions:s,mode:i,object:n,info:a}=this;if(0===r)return;const o=s.get("WEBGL_multi_draw");if(null===o)for(let s=0;sthis.maxQueries)return v(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null==t)return;if(null!==this.activeQuery)return;const r=this.queries[t];if(r)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){o("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){o("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[t,r]of this.queryOffsets){if("ended"===this.queryStates.get(r)){const s=this.queries[r];e.set(t,this.resolveQuery(s))}}if(0===e.size)return this.lastValue;const t={},r=[];for(const[s,i]of e){const e=s.match(/^(.*):f(\d+)$/),n=parseInt(e[2]);!1===r.includes(n)&&r.push(n),void 0===t[n]&&(t[n]=0);const a=await i;this.timestamps.set(s,a),t[n]+=a}const s=t[r[r.length-1]];return this.lastValue=s,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,s}catch(e){return o("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let r,s=!1;const i=e=>{s||(s=!0,r&&(clearTimeout(r),r=null),t(e))},n=()=>{if(this.isDisposed)i(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void i(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(r=setTimeout(n,1));const s=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(s)/1e6)}catch(e){o("Error checking query:",e),t(this.lastValue)}};n()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class zR extends vR{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},s=void 0!==t.context?t.context:e.domElement.getContext("webgl2",r);function i(t){t.preventDefault();const r={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(r)}this._onContextLost=i,e.domElement.addEventListener("webglcontextlost",i,!1),this.gl=s,this.extensions=new UR(this),this.capabilities=new IR(this),this.attributeUtils=new AR(this),this.textureUtils=new PR(this),this.bufferRenderer=new VR(this),this.state=new wR(this),this.utils=new CR(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(d("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return c}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){const s=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:s.RGBA8}),null!==r){const t=e.stencilBuffer?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&d("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new GR(this.gl,e,2048));const r=this.timestampQueryPool[e];null!==r.allocateQueriesForContext(t)&&r.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.viewport(0,0,e,r)}if(e.scissor)this.updateScissor(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.scissor(0,0,e,r)}this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const s=e.occlusionQueryCount;s>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=new Array(s),r.occlusionQueryObjects=new Array(s),r.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:r}=this,s=this.get(e),i=s.previousContext;r.resetVertexState();const n=e.occlusionQueryCount;n>0&&(n>s.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let e=0;e{let a=0;for(let t=0;t1?t.renderInstances(r,s,i):t.render(r,s)}draw(e){const{object:t,pipeline:r,material:s,context:i,hardwareClippingPlanes:n}=e,{programGPU:a}=this.get(r),{gl:o,state:u}=this,l=this.get(i),d=e.getDrawParameters();if(null===d)return;this._bindUniforms(e.getBindings());const c=t.isMesh&&t.matrixWorld.determinant()<0;u.setMaterial(s,c,n),null!==i.mrt&&null!==i.textures&&u.setMRTBlending(i.textures,i.mrt,s),u.useProgram(a);const h=e.getAttributes(),p=this.get(h);let g=p.vaoGPU;if(void 0===g){const e=this._getVaoKey(h);g=this.vaoCache[e],void 0===g&&(g=this._createVao(h),this.vaoCache[e]=g,p.vaoGPU=g)}const m=e.getIndex(),f=null!==m?this.get(m).bufferGPU:null;u.setVertexState(g,f);const y=l.lastOcclusionObject;if(y!==t&&void 0!==y){if(null!==y&&!0===y.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),l.occlusionQueryIndex++),!0===t.occlusionTest){const e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),l.occlusionQueries[l.occlusionQueryIndex]=e,l.occlusionQueryObjects[l.occlusionQueryIndex]=t}l.lastOcclusionObject=t}const b=this.bufferRenderer;t.isPoints?b.mode=o.POINTS:t.isLineSegments?b.mode=o.LINES:t.isLine?b.mode=o.LINE_STRIP:t.isLineLoop?b.mode=o.LINE_LOOP:!0===s.wireframe?(u.setLineWidth(s.wireframeLinewidth*this.renderer.getPixelRatio()),b.mode=o.LINES):b.mode=o.TRIANGLES;const{vertexCount:x,instanceCount:T}=d;let{firstVertex:_}=d;if(b.object=t,null!==m){_*=m.array.BYTES_PER_ELEMENT;const e=this.get(m);b.index=m.count,b.type=e.type}else b.index=0;if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const r=this.get(e.camera),s=e.camera.cameras,i=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===r.indexesGPU||r.indexesGPU.length!==s.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let r=0,i=s.length;r{const i=this.parallel,n=()=>{r.getProgramParameter(a,i.COMPLETION_STATUS_KHR)?(this._completeCompile(e,s),t()):requestAnimationFrame(n)};n()});return void t.push(i)}this._completeCompile(e,s)}_handleSource(e,t){const r=e.split("\n"),s=[],i=Math.max(t-6,0),n=Math.min(t+6,r.length);for(let e=i;e":" "} ${i}: ${r[e]}`)}return s.join("\n")}_getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(s&&""===i)return"";const n=/ERROR: 0:(\d+)/.exec(i);if(n){const s=parseInt(n[1]);return r.toUpperCase()+"\n\n"+i+"\n\n"+this._handleSource(e.getShaderSource(t),s)}return i}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){const s=this.gl,i=(s.getProgramInfoLog(e)||"").trim();if(!1===s.getProgramParameter(e,s.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(s,e,r,t);else{const n=this._getShaderErrors(s,r,"vertex"),a=this._getShaderErrors(s,t,"fragment");o("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(e,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+n+"\n"+a)}else""!==i&&d("WebGLProgram: Program Info Log:",i)}}_completeCompile(e,t){const{state:r,gl:s}=this,i=this.get(t),{programGPU:n,fragmentShader:a,vertexShader:o}=i;!1===s.getProgramParameter(n,s.LINK_STATUS)&&this._logProgramError(n,a,o),r.useProgram(n);const u=e.getBindings();this._setupBindings(u,n),this.set(t,{programGPU:n,pipeline:n})}createComputePipeline(e,t){const{state:r,gl:s}=this,i={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(i);const{computeProgram:n}=e,a=s.createProgram(),o=this.get(i).shaderGPU,u=this.get(n).shaderGPU,l=n.transforms,d=[],c=[];for(let e=0;eOR[t]===e),r=this.extensions;for(let e=0;e1,h=!0===i.isXRRenderTarget,p=!0===h&&!0===i._hasExternalTextures;let g=n.msaaFrameBuffer,m=n.depthRenderbuffer;const f=this.extensions.get("WEBGL_multisampled_render_to_texture"),y=this.extensions.get("OVR_multiview2"),b=this._useMultisampledExtension(i),x=Zy(e);let T;if(l?(n.cubeFramebuffers||(n.cubeFramebuffers={}),T=n.cubeFramebuffers[x]):h&&!1===p?T=this._xrFramebuffer:(n.framebuffers||(n.framebuffers={}),T=n.framebuffers[x]),void 0===T){T=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,T);const s=e.textures,o=[];if(l){n.cubeFramebuffers[x]=T;const{textureGPU:e}=this.get(s[0]),r=this.renderer._activeCubeFace,i=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,i)}else{n.framebuffers[x]=T;for(let r=0;r0&&!1===b&&!i.multiview){if(void 0===g){const s=[];g=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,g);const i=[],l=e.textures;for(let r=0;r0&&!1===this._useMultisampledExtension(s)){const n=i.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;s.resolveDepthBuffer&&(s.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),s.stencilBuffer&&s.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=i.msaaFrameBuffer,u=i.msaaRenderbuffers,l=e.textures,d=l.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,n),d)for(let e=0;e0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const $R="point-list",WR="line-list",HR="line-strip",qR="triangle-list",jR="undefined"!=typeof self&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},XR="never",KR="less",QR="equal",YR="less-equal",ZR="greater",JR="not-equal",eE="greater-equal",tE="always",rE="store",sE="load",iE="clear",nE="ccw",aE="cw",oE="none",uE="back",lE="uint16",dE="uint32",cE="r8unorm",hE="r8snorm",pE="r8uint",gE="r8sint",mE="r16uint",fE="r16sint",yE="r16float",bE="rg8unorm",xE="rg8snorm",TE="rg8uint",_E="rg8sint",vE="r16unorm",NE="r16snorm",SE="r32uint",RE="r32sint",EE="r32float",AE="rg16uint",wE="rg16sint",CE="rg16float",ME="rgba8unorm",BE="rgba8unorm-srgb",FE="rgba8snorm",LE="rgba8uint",PE="rgba8sint",DE="bgra8unorm",UE="bgra8unorm-srgb",IE="rg16unorm",OE="rg16snorm",VE="rgb9e5ufloat",kE="rgb10a2unorm",GE="rg11b10ufloat",zE="rg32uint",$E="rg32sint",WE="rg32float",HE="rgba16uint",qE="rgba16sint",jE="rgba16float",XE="rgba16unorm",KE="rgba16snorm",QE="rgba32uint",YE="rgba32sint",ZE="rgba32float",JE="depth16unorm",eA="depth24plus",tA="depth24plus-stencil8",rA="depth32float",sA="depth32float-stencil8",iA="bc1-rgba-unorm",nA="bc1-rgba-unorm-srgb",aA="bc2-rgba-unorm",oA="bc2-rgba-unorm-srgb",uA="bc3-rgba-unorm",lA="bc3-rgba-unorm-srgb",dA="bc4-r-unorm",cA="bc4-r-snorm",hA="bc5-rg-unorm",pA="bc5-rg-snorm",gA="bc6h-rgb-ufloat",mA="bc6h-rgb-float",fA="bc7-rgba-unorm",yA="bc7-rgba-unorm-srgb",bA="etc2-rgb8unorm",xA="etc2-rgb8unorm-srgb",TA="etc2-rgb8a1unorm",_A="etc2-rgb8a1unorm-srgb",vA="etc2-rgba8unorm",NA="etc2-rgba8unorm-srgb",SA="eac-r11unorm",RA="eac-r11snorm",EA="eac-rg11unorm",AA="eac-rg11snorm",wA="astc-4x4-unorm",CA="astc-4x4-unorm-srgb",MA="astc-5x4-unorm",BA="astc-5x4-unorm-srgb",FA="astc-5x5-unorm",LA="astc-5x5-unorm-srgb",PA="astc-6x5-unorm",DA="astc-6x5-unorm-srgb",UA="astc-6x6-unorm",IA="astc-6x6-unorm-srgb",OA="astc-8x5-unorm",VA="astc-8x5-unorm-srgb",kA="astc-8x6-unorm",GA="astc-8x6-unorm-srgb",zA="astc-8x8-unorm",$A="astc-8x8-unorm-srgb",WA="astc-10x5-unorm",HA="astc-10x5-unorm-srgb",qA="astc-10x6-unorm",jA="astc-10x6-unorm-srgb",XA="astc-10x8-unorm",KA="astc-10x8-unorm-srgb",QA="astc-10x10-unorm",YA="astc-10x10-unorm-srgb",ZA="astc-12x10-unorm",JA="astc-12x10-unorm-srgb",ew="astc-12x12-unorm",tw="astc-12x12-unorm-srgb",rw="clamp-to-edge",sw="repeat",iw="mirror-repeat",nw="linear",aw="nearest",ow="zero",uw="one",lw="src",dw="one-minus-src",cw="src-alpha",hw="one-minus-src-alpha",pw="dst",gw="one-minus-dst",mw="dst-alpha",fw="one-minus-dst-alpha",yw="src-alpha-saturated",bw="constant",xw="one-minus-constant",Tw="add",_w="subtract",vw="reverse-subtract",Nw="min",Sw="max",Rw=0,Ew=15,Aw="keep",ww="zero",Cw="replace",Mw="invert",Bw="increment-clamp",Fw="decrement-clamp",Lw="increment-wrap",Pw="decrement-wrap",Dw="storage",Uw="read-only-storage",Iw="write-only",Ow="read-only",Vw="read-write",kw="non-filtering",Gw="comparison",zw="float",$w="unfilterable-float",Ww="depth",Hw="sint",qw="uint",jw="2d",Xw="3d",Kw="2d",Qw="2d-array",Yw="cube",Zw="3d",Jw="all",eC="vertex",tC="instance",rC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},sC={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class iC extends aR{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class nC extends JS{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let aC=0;class oC extends nC{constructor(e,t){super("StorageBuffer_"+aC++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:ii.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class uC extends Ry{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:nw}),this.flipYSampler=e.createSampler({minFilter:aw}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4f,\n\t@location( 0 ) vTex : vec2f,\n\t@location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32,\n};\n\n@group( 0 ) @binding ( 2 )\nvar flipY: u32;\n\n@vertex\nfn mainVS(\n\t\t@builtin( vertex_index ) vertexIndex : u32,\n\t\t@builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array(\n\t\tvec2f( -1, -1 ),\n\t\tvec2f( -1, 3 ),\n\t\tvec2f( 3, -1 ),\n\t);\n\n\tlet p = pos[ vertexIndex ];\n\tlet mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 );\n\tVarys.vTex = p * mult + vec2f( 0.5 );\n\tVarys.Position = vec4f( p, 0, 1 );\n\tVarys.vBaseArrayLayer = instanceIndex;\n\n\treturn Varys;\n\n}\n\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img2d : texture_2d;\n\n@fragment\nfn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2d, imgSampler, Varys.vTex );\n\n}\n\n@group( 0 ) @binding( 1 )\nvar img2dArray : texture_2d_array;\n\n@fragment\nfn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer );\n\n}\n\nconst faceMat = array(\n mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x\n mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x\n mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y\n mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y\n mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z\n mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z\n);\n\n@group( 0 ) @binding( 1 )\nvar imgCube : texture_cube;\n\n@fragment\nfn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );\n\n}\n"})}getTransferPipeline(e,t){const r=`${e}-${t=t||"2d-array"}`;let s=this.transferPipelines[r];return void 0===s&&(s=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[r]=s),s}flipY(e,t,r=0){const s=t.format,{width:i,height:n}=t.size,a=this.device.createTexture({size:{width:i,height:n},format:s,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),o=this.getTransferPipeline(s,e.textureBindingViewDimension),u=this.getTransferPipeline(s,a.textureBindingViewDimension),l=this.device.createCommandEncoder({}),d=(e,t,r,s,i,n)=>{const a=e.getBindGroupLayout(0),o=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t.createView({dimension:t.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:n?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),u=l.beginRenderPass({colorAttachments:[{view:s.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1}),loadOp:iE,storeOp:rE}]});u.setPipeline(e),u.setBindGroup(0,o),u.draw(3,1,0,r),u.end()};d(o,e,r,a,0,!1),d(u,a,0,e,r,!0),this.device.queue.submit([l.finish()]),a.destroy()}generateMipmaps(e,t=null){const r=this.get(e),s=r.layers||this._mipmapCreateBundles(e),i=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(i,s),null===t&&this.device.queue.submit([i.finish()]),r.layers=s}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",r=this.getTransferPipeline(e.format,t),s=r.getBindGroupLayout(0),i=[];for(let n=1;n0)for(let t=0,n=s.length;t0){for(const s of e.layerUpdates)this._copyBufferToTexture(t.image,r.texture,i,s,e.flipY,s);e.clearLayerUpdates()}else for(let s=0;s0)for(let t=0,n=s.length;t0?e.width:r.size.width,l=a>0?e.height:r.size.height;try{o.queue.copyExternalImageToTexture({source:e,flipY:i},{texture:t,mipLevel:a,origin:{x:0,y:0,z:s},premultipliedAlpha:n},{width:u,height:l,depthOrArrayLayers:1})}catch(e){}}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new uC(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,s,i,n=0,a=0){const o=this.backend.device,u=e.data,l=this._getBytesPerTexel(r.format),d=e.width*l;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:s}},u,{offset:e.width*e.height*l*n,bytesPerRow:d},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===i&&this._flipY(t,r,s)}_copyCompressedBufferToTexture(e,t,r){const s=this.backend.device,i=this._getBlockData(r.format),n=r.size.depthOrArrayLayers>1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,gC=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,mC={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class fC extends hS{constructor(e){const{type:t,inputs:r,name:s,inputsCode:i,blockCode:n,outputType:a}=(e=>{const t=(e=e.trim()).match(pC);if(null!==t&&4===t.length){const r=t[2],s=[];let i=null;for(;null!==(i=gC.exec(r));)s.push({name:i[1],type:i[2]});const n=[];for(let e=0;e "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class yC extends cS{parseFunction(e){return new fC(e)}}const bC={[ii.READ_ONLY]:"read",[ii.WRITE_ONLY]:"write",[ii.READ_WRITE]:"read_write"},xC={[kr]:"repeat",[_e]:"clamp",[Vr]:"mirror"},TC={vertex:jR.VERTEX,fragment:jR.FRAGMENT,compute:jR.COMPUTE},_C={instance:!0,swizzleAssign:!1,storageBuffer:!0},vC={"^^":"tsl_xor"},NC={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},SC={},RC={tsl_xor:new fT("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new fT("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new fT("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new fT("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new fT("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new fT("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new fT("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new fT("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new fT("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new fT("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new fT("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new fT("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new fT("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n"),biquadraticTextureArray:new fT("\nfn tsl_biquadraticTexture_array( map : texture_2d_array, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},EC={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let AC="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(AC+="diagnostic( off, derivative_uniformity );\n");class wC extends QN{constructor(e,t){super(e,t,new yC),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,r,s,i,n=this.shaderStage){return"fragment"===n?s?i?`textureSample( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${s} )`:i?`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`:this.generateTextureSampleLevel(e,t,r,"0",s)}generateTextureSampleLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateWrapFunction(e){const t=`tsl_coord_${xC[e.wrapS]}S_${xC[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let r=SC[t];if(void 0===r){const s=[],i=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let n=`fn ${t}( coord : ${i} ) -> ${i} {\n\n\treturn ${i}(\n`;const a=(e,t)=>{e===kr?(s.push(RC.repeatWrapping_float),n+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===_e?(s.push(RC.clampWrapping_float),n+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===Vr?(s.push(RC.mirrorWrapping_float),n+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):(n+=`\t\tcoord.${t}`,d(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};a(e.wrapS,"x"),n+=",\n",a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(n+=",\n",a(e.wrapR,"z")),n+="\n\t);\n\n}\n",SC[t]=r=new fT(n,s)}return r.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){const s=this.getDataFromNode(e,this.shaderStage,this.cache);void 0===s.dimensionsSnippet&&(s.dimensionsSnippet={});let i=s.dimensionsSnippet[r];if(void 0===s.dimensionsSnippet[r]){let n,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),u=o>1;a=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",n=u||e.isStorageTexture?t:`${t}${r?`, u32( ${r} )`:""}`,i=new Du(new wl(`textureDimensions( ${n} )`,a)),s.dimensionsSnippet[r]=i,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(s.arrayLayerCount=new Du(new wl(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(s.cubeFaceCount=new Du(new wl("6u","u32")))}return i.build(this)}generateFilteredTexture(e,t,r,s,i="0u",n){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,i);return s&&(r=`${r} + vec2(${s}) / ${o}`),n?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${r} ), ${o}, u32( ${n} ), u32( ${i} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${r} ), ${o}, u32( ${i} ) )`)}generateTextureLod(e,t,r,s,i,n="0u"){if(!0===e.isCubeTexture){i&&(r=`${r} + vec3(${i})`);return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${e.isDepthTexture?"u32":"f32"}( ${n} ) )`}const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,n),u=e.is3DTexture||e.isData3DTexture?"vec3":"vec2";i&&(r=`${r} + ${u}(${i}) / ${u}( ${o} )`);return r=`${u}( clamp( floor( ${a}( ${r} ) * ${u}( ${o} ) ), ${`${u}( 0 )`}, ${`${u}( ${o} - ${"vec3"===u?"vec3( 1, 1, 1 )":"vec2( 1, 1 )"} )`} ) )`,this.generateTextureLoad(e,t,r,n,s,null)}generateStorageTextureLoad(e,t,r,s,i,n){let a;return n&&(r=`${r} + ${n}`),a=i?`textureLoad( ${t}, ${r}, ${i} )`:`textureLoad( ${t}, ${r} )`,a}generateTextureLoad(e,t,r,s,i,n){let a;return null===s&&(s="0u"),n&&(r=`${r} + ${n}`),i?a=`textureLoad( ${t}, ${r}, ${i}, u32( ${s} ) )`:(a=`textureLoad( ${t}, ${r}, u32( ${s} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,r,s,i){let n;return n=s?`textureStore( ${t}, ${r}, ${s}, ${i} )`:`textureStore( ${t}, ${r}, ${i} )`,n}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction&&this.renderer.hasCompatibility(E.TEXTURE_COMPARE)}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&e.type===K||!1===this.isSampleCompare(e)&&e.minFilter===B&&e.magFilter===B||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,s,i,n=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,r,s,i,"0",n):this._generateTextureSample(e,t,r,s,i,n),a}generateTextureGrad(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]} )`:n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]} )`;o(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateTextureBias(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,r=e.type;return"texture"===r||"cubeTexture"===r||"cubeDepthTexture"===r||"storageTexture"===r||"texture3D"===r?t:"buffer"===r||"storageBuffer"===r||"indirectStorageBuffer"===r?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=vC[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(d("WebGPURenderer: Atomic operations are only supported in compute shaders."),ii.READ_WRITE):ii.READ_ONLY:e.access}getStorageAccess(e,t){return bC[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);if(void 0===n.uniformGPU){let a;const o=e.groupNode,u=o.name,l=this.getBindGroupArray(u,r);if("texture"===t||"cubeTexture"===t||"cubeDepthTexture"===t||"storageTexture"===t||"texture3D"===t){let s=null;const n=this.getNodeAccess(e,r);"texture"===t||"storageTexture"===t?s=!0===e.value.is3DTexture?new cR(i.name,i.node,o,n):new lR(i.name,i.node,o,n):"cubeTexture"===t||"cubeDepthTexture"===t?s=new dR(i.name,i.node,o,n):"texture3D"===t&&(s=new cR(i.name,i.node,o,n)),s.store=!0===e.isStorageTextureNode,s.mipLevel=s.store?e.mipLevel:0,s.setVisibility(TC[r]);if(!0===e.value.isCubeTexture||!1===this.isUnfilterable(e.value)&&!1===s.store){const e=new iC(`${i.name}_sampler`,i.node,o);e.setVisibility(TC[r]),l.push(e,s),a=[e,s]}else l.push(s),a=[s]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const n=this.getSharedDataFromNode(e);let u=n.buffer;if(void 0===u){u=new("buffer"===t?rR:oC)(e,o),n.buffer=u}u.setVisibility(u.getVisibility()|TC[r]),l.push(u),a=u,i.name=s||"NodeBuffer_"+i.id}else{let e=this.uniformGroups[u];void 0===e&&(e=new nR(u,o),e.setVisibility(jR.VERTEX|jR.FRAGMENT|jR.COMPUTE),this.uniformGroups[u]=e),-1===l.indexOf(e)&&l.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}getBuiltin(e,t,r,s=this.shaderStage){const i=this.builtins[s]||(this.builtins[s]=new Map);return!1===i.has(e)&&i.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(e.name+" : "+this.getType(e.type));let i=`fn ${t.name}( ${s.join(", ")} ) -> ${this.getType(t.type)} {\n${r.vars}\n${r.code}\n`;return r.result&&(i+=`\treturn ${r.result};\n`),i+="\n}\n",i}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],r=this.directives[e];if(void 0!==r)for(const e of r)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],r=this.builtins[e];if(void 0!==r)for(const{name:e,property:s,type:i}of r.values())t.push(`@builtin( ${e} ) ${s} : ${i}`);return t.join(",\n\t")}getScopedArray(e,t,r,s){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:s}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:e,scope:r,bufferType:s,bufferCount:i}of this.scopedArrays.values()){const n=this.getType(s);t.push(`var<${r}> ${e}: array< ${n}, ${i} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const r=this.getAttributesArray();for(let e=0,s=r.length;e"),t.push(`\t${s+r.name} : ${i}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const r=this.structs[e];if(r.length>0){const e=[];for(const t of r){let r=`struct ${t.name} {\n`;r+=this.getStructMembers(t),r+="\n};",e.push(r)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,r=null,s=""){let i=`var${s} ${t} : `;return i+=null!==r?this.generateArrayDeclaration(e,r):this.getType(e),i}getVars(e,t=!1){let r="";t&&(r="");const s=[],i=this.vars[e];if(void 0!==i)for(const e of i)s.push(`${this.getVar(e.type,e.name,e.count,r)};`);return t?s.join("\n"):`\n\t${s.join("\n\t")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","builtinClipSpace","vec4","vertex"),"vertex"===e||"fragment"===e){const r=this.varyings,s=this.vars[e];let i=0;for(let n=0;nr.value.itemSize;return s&&!i}getUniforms(e){const t=this.renderer.backend,r=this.uniforms[e],s=[],i=[],n=[],a={};for(const n of r){const r=n.groupNode.name,o=this.bindingsIndexes[r];if("texture"===n.type||"cubeTexture"===n.type||"cubeDepthTexture"===n.type||"storageTexture"===n.type||"texture3D"===n.type){const r=n.node.value;let i;(!0===r.isCubeTexture||!1===this.isUnfilterable(r)&&!0!==n.node.isStorageTextureNode)&&(this.isSampleCompare(r)?s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler_comparison;`):s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler;`));let a="";const{primarySamples:u}=t.utils.getTextureSampleData(r);if(u>1&&(a="_multisampled"),!0===r.isCubeTexture&&!0===r.isDepthTexture)i="texture_depth_cube";else if(!0===r.isCubeTexture)i="texture_cube";else if(!0===r.isDepthTexture)i=t.compatibilityMode&&null===r.compareFunction?`texture${a}_2d`:`texture_depth${a}_2d${!0===r.isArrayTexture?"_array":""}`;else if(!0===n.node.isStorageTextureNode){const s=hC(r,t.device),a=this.getStorageAccess(n.node,e),o=n.node.value.is3DTexture,u=n.node.value.isArrayTexture;i=`texture_storage_${o?"3d":"2d"+(u?"_array":"")}<${s}, ${a}>`}else if(!0===r.isArrayTexture||!0===r.isDataArrayTexture||!0===r.isCompressedArrayTexture)i="texture_2d_array";else if(!0===r.is3DTexture||!0===r.isData3DTexture)i="texture_3d";else{i=`texture${a}_2d<${this.getComponentTypeFromTexture(r).charAt(0)}32>`}s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name} : ${i};`)}else if("buffer"===n.type||"storageBuffer"===n.type||"indirectStorageBuffer"===n.type){const t=n.node,r=this.getType(t.getNodeType(this)),s=t.bufferCount,a=s>0&&"buffer"===n.type?", "+s:"",u=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(n))i.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var<${u}> ${n.name} : ${r};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${r}>`:`${r}`}${a} >`;i.push(this._getWGSLStructBinding(n.name,e,u,o.binding++,o.group))}}else{const e=n.groupNode.name;if(void 0===a[e]){const t=this.uniformGroups[e];if(void 0!==t){const r=[];for(const e of t.uniforms){const t=e.getType(),s=this.getType(this.getVectorType(t));r.push(`\t${e.name} : ${s}`)}let s=this.uniformGroupsBindings[e];void 0===s&&(s={index:o.binding++,id:o.group},this.uniformGroupsBindings[e]=s),a[e]={index:s.index,id:s.id,snippets:r}}}}}for(const e in a){const t=a[e];n.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}return[...s,...i,...n].join("\n")}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const r=this.allowGlobalVariables,s=e[t];s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.structs=this.getStructs(t),s.vars=this.getVars(t,r),s.codes=this.getCodes(t),s.directives=this.getDirectives(t),s.scopedArrays=this.getScopedArrays(t);let i="// code\n\n";i+=this.flowCode[t];const n=this.flowNodes[t],a=n[n.length-1],o=a.outputNode,u=void 0!==o&&!0===o.isOutputStructNode;for(const e of n){const r=this.getFlowData(e),n=e.name;if(n&&(i.length>0&&(i+="\n"),i+=`\t// flow -> ${n}\n`),i+=`${r.code}\n\t`,e===a&&"compute"!==t)if(i+="// result\n\n\t","vertex"===t)i+=`varyings.builtinClipSpace = ${r.result};`;else if("fragment"===t)if(u)s.returnType=o.getNodeType(this),s.structs+="var output : "+s.returnType+";",i+=`return ${r.result};`;else{let e="\t@location( 0 ) color: vec4";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),s.returnType="OutputStruct",s.structs+=this._getWGSLStruct("OutputStruct",e),s.structs+="\nvar output : OutputStruct;",i+=`output.color = ${r.result};\n\n\treturn output;`}}s.flow=i}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return null!==t&&(r=this._getWGSLMethod(e+"_"+t)),void 0===r&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return NC[e]||e}isAvailable(e){let t=_C[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),_C[e]=t),t}_getWGSLMethod(e){return void 0!==RC[e]&&this._include(e),EC[e]}_include(e){const t=RC[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar varyings : VaryingsStruct;\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${AC}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[r,s,i]=t;return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${this.allowGlobalVariables?e.vars:""}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${r}, ${s}, ${i} )\nfn main( ${e.attributes} ) {\n\n\t// local vars\n\t${this.allowGlobalVariables?"":e.vars}\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${r} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${r} * numWorkgroups.x ) * ( ${s} * numWorkgroups.y );\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,r,s=0,i=0){const n=e+"Struct";return`${this._getWGSLStruct(n,t)}\n@binding( ${s} ) @group( ${i} )\nvar<${r}> ${e} : ${n};`}}class CC{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(t=null!==e.depthTexture?this.getTextureFormatGPU(e.depthTexture):e.stencil?!0===this.backend.renderer.reversedDepthBuffer?sA:tA:!0===this.backend.renderer.reversedDepthBuffer?rA:eA),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const e=this.backend.renderer,r=e.getRenderTarget();t=r?r.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const r=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:r?1:t,isMSAA:r}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?$R:e.isLineSegments||e.isMesh&&!0===t.wireframe?WR:e.isLine?HR:e.isMesh?qR:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===Ve)return DE;if(e===Te)return jE;throw new Error("Unsupported output buffer type.")}}const MC=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&MC.set(Float16Array,["float16"]);const BC=new Map([[xt,["float16"]]]),FC=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class LC{constructor(e){this.backend=e}createAttribute(e,t){const r=this._getBufferAttribute(e),s=this.backend,i=s.get(r);let n=i.buffer;if(void 0===n){const a=s.device;let o=r.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e{o.unmap()},u=()=>{o.destroy(),t.delete(e),e.removeEventListener("release",i),e.removeEventListener("dispose",u)};e.addEventListener("release",i),e.addEventListener("dispose",u),a.readBufferGPU=o}const u=r.createCommandEncoder({label:`readback_encoder_${s.name}`});u.copyBufferToBuffer(i,0,o,0,n);const l=u.finish();r.queue.submit([l]),await o.mapAsync(GPUMapMode.READ);return o.getMappedRange()}_getVertexFormat(e){const{itemSize:t,normalized:r}=e,s=e.array.constructor,i=e.constructor;let n;if(1===t)n=FC.get(s);else{const e=(BC.get(i)||MC.get(s))[r?1:0];if(e){const r=s.BYTES_PER_ELEMENT*t,i=4*Math.floor((r+3)/4)/s.BYTES_PER_ELEMENT;if(i%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");n=`${e}x${i}`}}return n||o("WebGPUAttributeUtils: Vertex format not supported yet."),n}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class PC{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class DC{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,r=t.device,s=t.get(e);if(s.layout)return s.layout.layoutGPU;const i=this._createLayoutEntries(e),n=Vs(JSON.stringify(i));let a=this._bindGroupLayoutCache.get(n);return void 0===a&&(a=new PC(r.createBindGroupLayout({entries:i})),this._bindGroupLayoutCache.set(n,a)),a.usedTimes++,s.layout=a,s.layoutKey=n,a.layoutGPU}createBindings(e,t,r,s=0){const{backend:i}=this,n=i.get(e),a=this.createBindingsLayout(e);let o;r>0&&(void 0===n.groups&&(n.groups=[],n.versions=[]),n.versions[r]===s&&(o=n.groups[r])),void 0===o&&(o=this.createBindGroup(e,a),r>0&&(n.groups[r]=o,n.versions[r]=s)),n.group=o}updateBinding(e){const t=this.backend,r=t.device,s=e.buffer,i=t.get(e).buffer,n=e.updateRanges;if(0===n.length)r.queue.writeBuffer(i,0,s,0);else{const e=Xr(s),t=e?1:s.BYTES_PER_ELEMENT;for(let a=0,o=n.length;a1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${r}-${s}`,a=e[i],void 0===a){const n=Jw;let o;o=t.isSampledCubeTexture?Yw:t.isSampledTexture3D?Zw:t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?Qw:Kw,a=e[i]=e.texture.createView({aspect:n,dimension:o,mipLevelCount:r,baseMipLevel:s})}}n.push({binding:i,resource:a})}else if(t.isSampler){const e=r.get(t.texture);n.push({binding:i,resource:e.sampler})}i++}return s.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:n})}_createLayoutEntries(e){const t=[];let r=0;for(const s of e.bindings){const e=this.backend,i={binding:r,visibility:s.visibility};if(s.isUniformBuffer||s.isStorageBuffer){const e={};s.isStorageBuffer&&(s.visibility&jR.COMPUTE&&(s.access===ii.READ_WRITE||s.access===ii.WRITE_ONLY)?e.type=Dw:e.type=Uw),i.buffer=e}else if(s.isSampledTexture&&s.store){const e={};e.format=this.backend.get(s.texture).texture.format;const t=s.access;e.access=t===ii.READ_WRITE?Vw:t===ii.WRITE_ONLY?Iw:Ow,s.texture.isArrayTexture?e.viewDimension=Qw:s.texture.is3DTexture&&(e.viewDimension=Zw),i.storageTexture=e}else if(s.isSampledTexture){const t={},{primarySamples:r}=e.utils.getTextureSampleData(s.texture);if(r>1&&(t.multisampled=!0,s.texture.isDepthTexture||(t.sampleType=$w)),s.texture.isDepthTexture)e.compatibilityMode&&null===s.texture.compareFunction?t.sampleType=$w:t.sampleType=Ww;else if(s.texture.isDataTexture||s.texture.isDataArrayTexture||s.texture.isData3DTexture||s.texture.isStorageTexture){const e=s.texture.type;e===R?t.sampleType=Hw:e===S?t.sampleType=qw:e===K&&(this.backend.hasFeature("float32-filterable")?t.sampleType=zw:t.sampleType=$w)}s.isSampledCubeTexture?t.viewDimension=Yw:s.texture.isArrayTexture||s.texture.isDataArrayTexture||s.texture.isCompressedArrayTexture?t.viewDimension=Qw:s.isSampledTexture3D&&(t.viewDimension=Zw),i.texture=t}else if(s.isSampler){const t={};s.texture.isDepthTexture&&(null!==s.texture.compareFunction&&e.hasCompatibility(E.TEXTURE_COMPARE)?t.type=Gw:t.type=kw),i.sampler=t}else o(`WebGPUBindingUtils: Unsupported binding "${s}".`);t.push(i),r++}return t}deleteBindGroupData(e){const{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,0===r.layout.usedTimes&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class UC{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}}class IC{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:r,material:s,geometry:i,pipeline:n}=e,{vertexProgram:a,fragmentProgram:u}=n,l=this.backend,d=l.device,c=l.utils,h=l.get(n),p=[];for(const t of e.getBindings()){const e=l.get(t),{layoutGPU:r}=e.layout;p.push(r)}const g=l.attributeUtils.createShaderVertexBuffers(e);let m;s.blending===re||s.blending===tt&&!1===s.transparent||(m=this._getBlending(s));let f={};!0===s.stencilWrite&&(f={compare:this._getStencilCompare(s),failOp:this._getStencilOperation(s.stencilFail),depthFailOp:this._getStencilOperation(s.stencilZFail),passOp:this._getStencilOperation(s.stencilZPass)});const y=this._getColorWriteMask(s),b=[];if(null!==e.context.textures){const t=e.context.textures,r=e.context.mrt;for(let e=0;e1},layout:d.createPipelineLayout({bindGroupLayouts:p})},A={},w=e.context.depth,C=e.context.stencil;if(!0!==w&&!0!==C||(!0===w&&(A.format=S,A.depthWriteEnabled=s.depthWrite,A.depthCompare=N),!0===C&&(A.stencilFront=f,A.stencilBack=f,A.stencilReadMask=s.stencilFuncMask,A.stencilWriteMask=s.stencilWriteMask),!0===s.polygonOffset&&(A.depthBias=s.polygonOffsetUnits,A.depthBiasSlopeScale=s.polygonOffsetFactor,A.depthBiasClamp=0),E.depthStencil=A),d.pushErrorScope("validation"),null===t)h.pipeline=d.createRenderPipeline(E),d.popErrorScope().then(e=>{null!==e&&(h.error=!0,o(e.message))});else{const e=new Promise(async e=>{try{h.pipeline=await d.createRenderPipelineAsync(E)}catch(e){}const t=await d.popErrorScope();null!==t&&(h.error=!0,o(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const r=this.backend,{utils:s,device:i}=r,n=s.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:s.getCurrentColorFormats(e),depthStencilFormat:n,sampleCount:this._getSampleCount(e)};return i.createRenderBundleEncoder(a)}createComputePipeline(e,t){const r=this.backend,s=r.device,i=r.get(e.computeProgram).module,n=r.get(e),a=[];for(const e of t){const t=r.get(e),{layoutGPU:s}=t.layout;a.push(s)}n.pipeline=s.createComputePipeline({compute:i,layout:s.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,r;const s=e.blending,i=e.blendSrc,n=e.blendDst,a=e.blendEquation;if(s===Rt){const s=null!==e.blendSrcAlpha?e.blendSrcAlpha:i,o=null!==e.blendDstAlpha?e.blendDstAlpha:n,u=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(n),operation:this._getBlendOperation(a)},r={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(u)}}else{const i=(e,s,i,n)=>{t={srcFactor:e,dstFactor:s,operation:Tw},r={srcFactor:i,dstFactor:n,operation:Tw}};if(e.premultipliedAlpha)switch(s){case tt:i(uw,hw,uw,hw);break;case Yt:i(uw,uw,uw,uw);break;case Qt:i(ow,dw,ow,uw);break;case Kt:i(pw,hw,ow,uw)}else switch(s){case tt:i(cw,hw,uw,hw);break;case Yt:i(cw,uw,uw,uw);break;case Qt:o(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Kt:o(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`)}}if(void 0!==t&&void 0!==r)return{color:t,alpha:r};o("WebGPURenderer: Invalid blending: ",s)}_getBlendFactor(e){let t;switch(e){case Et:t=ow;break;case Ht:t=uw;break;case Wt:t=lw;break;case kt:t=dw;break;case rt:t=cw;break;case st:t=hw;break;case zt:t=pw;break;case Vt:t=gw;break;case Gt:t=mw;break;case Ot:t=fw;break;case $t:t=yw;break;case 211:t=bw;break;case 212:t=xw;break;default:o("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const r=e.stencilFunc;switch(r){case rs:t=XR;break;case ts:t=tE;break;case es:t=KR;break;case Jr:t=YR;break;case Zr:t=QR;break;case Yr:t=eE;break;case Qr:t=ZR;break;case Kr:t=JR;break;default:o("WebGPURenderer: Invalid stencil function.",r)}return t}_getStencilOperation(e){let t;switch(e){case ds:t=Aw;break;case ls:t=ww;break;case us:t=Cw;break;case os:t=Mw;break;case as:t=Bw;break;case ns:t=Fw;break;case is:t=Lw;break;case ss:t=Pw;break;default:o("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case it:t=Tw;break;case It:t=_w;break;case Ut:t=vw;break;case hs:t=Nw;break;case cs:t=Sw;break;default:o("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,r){const s={},i=this.backend.utils;s.topology=i.getPrimitiveTopology(e,r),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(s.stripIndexFormat=t.index.array instanceof Uint16Array?lE:dE);let n=r.side===L;return e.isMesh&&e.matrixWorld.determinant()<0&&(n=!n),s.frontFace=!0===n?aE:nE,s.cullMode=r.side===P?oE:uE,s}_getColorWriteMask(e){return!0===e.colorWrite?Ew:Rw}_getDepthCompare(e){let t;if(!1===e.depthTest)t=tE;else{const r=this.backend.parameters.reversedDepthBuffer?ar[e.depthFunc]:e.depthFunc;switch(r){case nr:t=XR;break;case ir:t=tE;break;case sr:t=KR;break;case rr:t=YR;break;case tr:t=QR;break;case er:t=eE;break;case Jt:t=ZR;break;case Zt:t=JR;break;default:o("WebGPUPipelineUtils: Invalid depth function.",r)}}return t}}class OC extends kR{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const s=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return v(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const s=this.device.createCommandEncoder();s.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),s.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);const i=s.finish();if(this.device.queue.submit([i]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const n=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),a={},o=[];for(const[t,r]of e){const e=t.match(/^(.*):f(\d+)$/),s=parseInt(e[2]);!1===o.includes(s)&&o.push(s),void 0===a[s]&&(a[s]=0);const i=n[r],u=n[r+1],l=Number(u-i)/1e6;this.timestamps.set(t,l),a[s]+=l}const u=a[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=u,this.frames=o,u}catch(e){return o("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){o("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){o("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}const VC={r:0,g:0,b:0,a:1};class kC extends vR{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new CC(this),this.attributeUtils=new LC(this),this.bindingUtils=new DC(this),this.capabilities=new UC(this),this.pipelineUtils=new IC(this),this.textureUtils=new cC(this),this.occludedResolveCache=new Map;const t="undefined"==typeof navigator||!1===/Android/.test(navigator.userAgent);this._compatibility={[E.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let r;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:"compatibility"},s="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===s)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const i=Object.values(rC),n=[];for(const e of i)s.features.has(e)&&n.push(e);const a={requiredFeatures:n,requiredLimits:t.requiredLimits};r=await s.requestDevice(a)}else r=t.device;this.compatibilityMode=!r.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),r.lost.then(t=>{if("destroyed"===t.reason)return;const r={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(r)}),this.device=r,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(rC.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let r=t.context;if(void 0===r){const s=this.parameters;r=!0===e.isDefaultCanvasTarget&&void 0!==s.context?s.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${_t} webgpu`);const i=s.alpha?"premultiplied":"opaque",n=s.outputType===Te?"extended":"standard";r.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:i,toneMapping:{mode:n}}),t.context=r}return r}get coordinateSystem(){return h}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),s=e.currentSamples;let i=r.descriptor;if(void 0===i||r.samples!==s){i={colorAttachments:[{view:null}]},!0!==e.depth&&!0!==e.stencil||(i.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const t=i.colorAttachments[0];s>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,r.descriptor=i,r.samples=s}const n=i.colorAttachments[0];return s>0?n.resolveTarget=this.context.getCurrentTexture().createView():n.view=this.context.getCurrentTexture().createView(),i}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const r=e.renderTarget,s=this.get(r);let i=s.descriptors;void 0!==i&&s.width===r.width&&s.height===r.height&&s.samples===r.samples||(i={},s.descriptors=i);const n=e.getCacheKey();let a=i[n];if(void 0===a){const t=e.textures,o=[];let u;const l=this._isRenderCameraDepthArray(e);for(let s=0;s1)if(!0===l){const t=e.camera.cameras;for(let e=0;e0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,i=r.createQuerySet({type:"occlusion",count:s,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=i,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(s),t.lastOcclusionObject=null),n=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:sE}),this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e),n),n.occlusionQuerySet=i;const a=n.depthStencilAttachment;if(null!==e.textures){const t=n.colorAttachments;for(let r=0;r0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const s=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const r=[];for(let e=0;e0){const s=8*r;let i=this.occludedResolveCache.get(s);void 0===i&&(i=this.device.createBuffer({size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(s,i));const n=this.device.createBuffer({size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,i,0),t.encoder.copyBufferToBuffer(i,0,n,0,s),t.occlusionQueryBuffer=n,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;eo&&(i[0]=Math.min(a,o),i[1]=Math.ceil(a/o)),n.dispatchSize=i}i=n.dispatchSize}a.dispatchWorkgroups(i[0],i[1]||1,i[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}_draw(e,t,r,s,i,n,a,o,u){const{object:l,material:d,context:c}=e,h=e.getIndex(),p=null!==h;this.pipelineUtils.setPipeline(o,s),u.pipeline=s;const g=u.bindingGroups;for(let e=0,t=i.length;e65535?4:2);for(let n=0;n0){const i=this.get(e.camera),a=e.camera.cameras,c=e.getBindingGroup("cameraIndex");if(void 0===i.indexesGPU||i.indexesGPU.length!==a.length){const e=this.get(c),t=[],r=new Uint32Array([0,0,0,0]);for(let s=0,i=a.length;s(d("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new zR(e)));super(new t(e),e),this.library=new $C,this.isWebGPURenderer=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class HC extends Es{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}}class qC{constructor(e,t=Cn(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const r=new vg;r.name="RenderPipeline",this._quadMesh=new gx(r),this._quadMesh.name="Render Pipeline",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){const e=this.renderer;this._update(),null!==this._context.onBeforeRenderPipeline&&this._context.onBeforeRenderPipeline();const t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=m,e.outputColorSpace=p.workingColorSpace;const s=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=s,e.toneMapping=t,e.outputColorSpace=r,null!==this._context.onAfterRenderPipeline&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),!0===this.needsUpdate){const e=this._toneMapping,t=this._outputColorSpace,r={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null};let s=this.outputNode;!0===this.outputColorTransform?(s=s.context(r),s=Fl(s,e,t)):(r.toneMapping=e,r.outputColorSpace=t,s=s.context(r)),this._context=r,this._quadMesh.material.fragmentNode=s,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){v('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class jC extends qC{constructor(e,t){v('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your code to use "THREE.RenderPipeline" instead.'),super(e,t)}}class XC extends N{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){this.image.width===e&&this.image.height===t||(this.image.width=e,this.image.height=t,this.dispose())}}class KC extends N{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!1,this.image={width:e,height:t,depth:r},this.magFilter=le,this.minFilter=le,this.wrapR=_e,this.isStorageTexture=!0,this.is3DTexture=!0}setSize(e,t,r){this.image.width===e&&this.image.height===t&&this.image.depth===r||(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class QC extends N{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!0,this.image={width:e,height:t,depth:r},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0}setSize(e,t,r){this.image.width===e&&this.image.height===t&&this.image.depth===r||(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class YC extends Ax{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class ZC extends As{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,r,s){const i=new ws(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,r=>{try{t(this.parse(JSON.parse(r)))}catch(t){s?s(t):o(t),this.manager.itemError(e)}},r,s)}parseNodes(e){const t={};if(void 0!==e){for(const r of e){const{uuid:e,type:s}=r;t[e]=this.createNodeFromType(s),t[e].uuid=e}const r={nodes:t,textures:this.textures};for(const s of e){s.meta=r;t[s.uuid].deserialize(s),delete s.meta}}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const r={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(o("NodeLoader: Node type not found:",e),yn()):new this.nodes[e]}}class JC extends Cs{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),r=this.nodes,s=e.inputNodes;for(const e in s){const i=s[e];t[e]=r[i]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class eM extends Ms{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){const r=new ZC;return r.setNodes(this.nodes),r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){const r={};if(void 0!==e){const s=this.parseNodes(this._nodesJSON,t),i=new JC;i.setTextures(t),i.setNodes(s),i.setNodeMaterials(this.nodeMaterials);for(let t=0,s=e.length;t0){const{width:r,height:s}=e.context;t.bufferWidth=r,t.bufferHeight=s}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const r in e){const s=e[r];t[r]={id:s.id,version:s.version}}return t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Ps.get(e);return void 0===t&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Ps.set(e,t)),t}getMaterialData(e){let t=Fs.get(e);if(void 0===t){t={_renderId:-1,_equal:!1};for(const r of this.refreshUniforms){const s=e[r];null!=s&&("object"==typeof s&&void 0!==s.clone?!0===s.isTexture?t[r]={id:s.id,version:s.version}:t[r]=s.clone():t[r]=s)}Fs.set(e,t)}return t}equals(e,t,r){const{object:s,material:i,geometry:n}=e,a=this.getRenderObjectData(e);if(!0!==a.worldMatrix.equals(s.matrixWorld))return a.worldMatrix.copy(s.matrixWorld),!1;const o=this.getMaterialData(e.material);if(o._renderId!==r){o._renderId=r;for(const e in o){const t=o[e],r=i[e];if("_renderId"!==e&&"_equal"!==e)if(void 0!==t.equals){if(!1===t.equals(r))return t.copy(r),o._equal=!1,!1}else if(!0===r.isTexture){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,o._equal=!1,!1}else if(t!==r)return o[e]=r,o._equal=!1,!1}if(o.transmission>0){const{width:t,height:r}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==r)return a.bufferWidth=t,a.bufferHeight=r,o._equal=!1,!1}o._equal=!0}else if(!1===o._equal)return!1;if(a.geometryId!==n.id)return a.geometryId=n.id,!1;const u=this.getGeometryData(e.geometry);if(u._renderId!==r){u._renderId=r;const e=n.attributes,t=u.attributes;let s=0,i=0;for(const t in e)s++;for(const r in t){i++;const s=t[r],n=e[r];if(void 0===n)return delete t[r],u._equal=!1,!1;if(s.id!==n.id||s.version!==n.version)return s.id=n.id,s.version=n.version,u._equal=!1,!1}if(i!==s)return u.attributes=this.getAttributesData(e),u._equal=!1,!1;const a=n.index,o=u.indexId,l=u.indexVersion,d=a?a.id:null,c=a?a.version:null;if(o!==d||l!==c)return u.indexId=d,u.indexVersion=c,u._equal=!1,!1;if(u.drawRange.start!==n.drawRange.start||u.drawRange.count!==n.drawRange.count)return u.drawRange.start=n.drawRange.start,u.drawRange.count=n.drawRange.count,u._equal=!1,!1;u._equal=!0}else if(!1===u._equal)return!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t{const r=e.match(t);if(!r)return null;const s=r[1]||r[2]||"",i=r[3].split("?")[0],n=parseInt(r[4],10),a=parseInt(r[5],10);return{fn:s,file:i.split("/").pop(),line:n,column:a}}).filter(e=>e&&!Us.some(t=>t.test(e.file)))}(e||(new Error).stack)}getLocation(){if(0===this.stack.length)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(0===this.stack.length)return e;return`${e}\n${this.stack.map(e=>{const t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join("\n")}`}}function Os(e,t=0){let r=3735928559^t,s=1103547991^t;if(Array.isArray(e))for(let t,i=0;i>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const Vs=e=>Os(e),ks=e=>Os(e),Gs=(...e)=>Os(e),zs=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),$s=new WeakMap;function Ws(e){return zs.get(e)}function Hs(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function qs(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function js(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Xs(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)||/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Ks(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Qs(o,...u){const l=o?o.slice(-4):void 0;return 1===u.length&&("vec2"===l?u=[u[0],u[0]]:"vec3"===l?u=[u[0],u[0],u[0]]:"vec4"===l&&(u=[u[0],u[0],u[0],u[0]])),"color"===o?new e(...u):"vec2"===l?new t(...u):"vec3"===l?new r(...u):"vec4"===l?new s(...u):"mat2"===l?new i(...u):"mat3"===l?new n(...u):"mat4"===l?new a(...u):"bool"===o?u[0]||!1:"float"===o||"int"===o||"uint"===o?u[0]||0:"string"===o?u[0]||"":"ArrayBuffer"===o?Js(u[0]):null}function Ys(e){let t=$s.get(e);return void 0===t&&(t={},$s.set(e,t)),t}function Zs(e){let t="";const r=new Uint8Array(e);for(let e=0;ee.charCodeAt(0)).buffer}var ei=Object.freeze({__proto__:null,arrayBufferToBase64:Zs,base64ToArrayBuffer:Js,getAlignmentFromType:Xs,getDataFromObject:Ys,getLengthFromType:qs,getMemoryLengthFromType:js,getTypeFromLength:Ws,getTypedArrayFromType:Hs,getValueFromType:Qs,getValueType:Ks,hash:Gs,hashArray:ks,hashString:Vs});const ti={VERTEX:"vertex",FRAGMENT:"fragment"},ri={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},si={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},ii={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},ni=["fragment","vertex"],ai=["setup","analyze","generate"],oi=[...ni,"compute"],ui=["x","y","z","w"],li={analyze:"setup",generate:"analyze"};let di=0;class ci extends u{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=ri.NONE,this.updateBeforeType=ri.NONE,this.updateAfterType=ri.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=di++,this.stackTrace=null,!0===ci.captureStackTrace&&(this.stackTrace=new Is)}set needsUpdate(e){!0===e&&this.version++}get uuid(){return null===this._uuid&&(this._uuid=l.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,ri.FRAME)}onRenderUpdate(e){return this.onUpdate(e,ri.RENDER)}onObjectUpdate(e){return this.onUpdate(e,ri.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const r of Object.getOwnPropertyNames(this)){const s=this[r];if(!0!==r.startsWith("_")&&!e.has(s))if(!0===Array.isArray(s))for(let e=0;e0&&(e.inputNodes=r)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){const s=[];for(const i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if("object"==typeof e.inputNodes[r]){const s={};for(const i in e.inputNodes[r]){const n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{const s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){const{uuid:t,type:r}=this,s=void 0===e||"string"==typeof e;s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];function n(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(void 0===i&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==s&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),s){const t=n(e.textures),r=n(e.images),s=n(e.nodes);t.length>0&&(i.textures=t),r.length>0&&(i.images=r),s.length>0&&(i.nodes=s)}return i}}ci.captureStackTrace=!1;class hi extends ci{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class pi extends ci{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){const t=this.node.getNodeType(e);let r=null;for(const s of this.convertTo.split("|"))null!==r&&e.getTypeLength(t)!==e.getTypeLength(s)||(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}}class gi extends ci{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(void 0!==s.propertyName)return e.format(s.propertyName,r,t);if("void"!==r&&"void"!==t&&this.hasDependencies(e)){const i=super.build(e,r),n=e.getVarFromNode(this,null,r),a=e.getPropertyName(n);return e.addLineFlowCode(`${a} = ${i}`,this),s.snippet=i,s.propertyName=a,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class mi extends gi{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){const r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[];let u=0;for(const t of i){if(u>=s){o(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let i,l=t.getNodeType(e),d=e.getTypeLength(l);u+d>s&&(o(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=s-u,l=e.getTypeFromLength(d)),u+=d,i=t.build(e,l);if(e.getComponentType(l)!==n){const t=e.getTypeFromLength(d,n);i=e.format(i,l,t)}a.push(i)}const l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}}const fi=ui.join("");class yi extends ci{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ui.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const r=this.node,s=e.getTypeLength(r.getNodeType(e));let i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=r.build(e,n);i=this.components.length===s&&this.components===fi.slice(0,this.components.length)?e.format(a,n,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class bi extends gi{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),u=t.build(e,i),l=e.getTypeLength(i),d=[];for(let e=0;e(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");ci.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==Si?Si.assign(this,...e):o("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Is),this;{const t=Ri.get("assign");return this.addToStack(t(...e))}},ci.prototype.toVarIntent=function(){return this},ci.prototype.get=function(e){return new Ni(this,e)};const wi={};function Ci(e,t,r){wi[e]=wi[t]=wi[r]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new yi(this,e),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};const s=e.toUpperCase(),i=t.toUpperCase(),n=r.toUpperCase();ci.prototype["set"+s]=ci.prototype["set"+i]=ci.prototype["set"+n]=function(t){const r=Ai(e);return new bi(this,r,tn(t))},ci.prototype["flip"+s]=ci.prototype["flip"+i]=ci.prototype["flip"+n]=function(){const t=Ai(e);return new xi(this,t)}}const Mi=["x","y","z","w"],Bi=["r","g","b","a"],Li=["s","t","p","q"];for(let e=0;e<4;e++){let t=Mi[e],r=Bi[e],s=Li[e];Ci(t,r,s);for(let i=0;i<4;i++){t=Mi[e]+Mi[i],r=Bi[e]+Bi[i],s=Li[e]+Li[i],Ci(t,r,s);for(let n=0;n<4;n++){t=Mi[e]+Mi[i]+Mi[n],r=Bi[e]+Bi[i]+Bi[n],s=Li[e]+Li[i]+Li[n],Ci(t,r,s);for(let a=0;a<4;a++)t=Mi[e]+Mi[i]+Mi[n]+Mi[a],r=Bi[e]+Bi[i]+Bi[n]+Bi[a],s=Li[e]+Li[i]+Li[n]+Li[a],Ci(t,r,s)}}}for(let e=0;e<32;e++)wi[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new hi(this,new vi(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};Object.defineProperties(ci.prototype,wi);const Fi=new WeakMap,Pi=function(e,t=null){for(const r in e)e[r]=tn(e[r],t);return e},Di=function(e,t=null){const r=e.length;for(let s=0;su?(o(`TSL: "${r}" parameter length exceeds limit.`,new Is),t.slice(0,u)):t}return null===t?n=(...t)=>i(new e(...nn(d(t)))):null!==r?(r=tn(r),n=(...s)=>i(new e(t,...nn(d(s)),r))):n=(...r)=>i(new e(t,...nn(d(r)))),n.setParameterLength=(...e)=>(1===e.length?a=u=e[0]:2===e.length&&([a,u]=e),n),n.setName=e=>(l=e,n),n},Ii=function(e,...t){return new e(...nn(t))};class Oi extends ci{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:r}=this,s=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||"",n=i||"default";if(s[n])return s[n];const a=e.subBuildFn,o=e.fnCall;e.subBuildFn=i,e.fnCall=this;let u=null;if(t.layout){let s=Fi.get(e.constructor);void 0===s&&(s=new WeakMap,Fi.set(e.constructor,s));let i=s.get(t);void 0===i&&(i=tn(e.buildFunctionNode(t)),s.set(t,i)),e.addInclude(i);const n=r?function(e){let t;sn(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(r):null;u=tn(i.call(n))}else{const s=new Proxy(e,{get:(e,t,r)=>{let s;return s=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,r),s}}),i=r?function(e){let t=0;return sn(e),new Proxy(e,{get:(r,s,i)=>{let n;if("length"===s)return n=e.length,n;if(Symbol.iterator===s)n=function*(){for(const t of e)yield tn(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const r=e[0];n=void 0===r[s]?r[t++]:Reflect.get(r,s,i)}else e[0]instanceof ci&&(n=void 0===e[s]?e[t++]:Reflect.get(e,s,i));else n=Reflect.get(r,s,i);n=tn(n)}return n}})}(r):null,n=Array.isArray(r)?r.length>0:null!==r,a=t.jsFunc,o=n||a.length>1?a(i,s):a(s);u=tn(o)}return e.subBuildFn=a,e.fnCall=o,t.once&&(s[n]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null;const s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getSubBuildOutput(this),a=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===s){const t=e.getSubBuildProperty("initialized",this);if(!0!==i[t]&&(i[t]=!0,i[n]=this.getOutputNode(e),i[n].build(e),this.shaderNode.subBuilds))for(const t of e.chaining){const r=e.getDataFromNode(t,"any");r.subBuilds=r.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)r.subBuilds.add(e)}r=i[n]}else"analyze"===s?a.build(e,t):"generate"===s&&(r=a.build(e,t)||"");return e.fnCall=o,r}}class Vi extends ci{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Oi(this,e)}setup(){return this.call()}}const ki=[!1,!0],Gi=[0,1,2,3],zi=[-1,-2],$i=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Wi=new Map;for(const e of ki)Wi.set(e,new vi(e));const Hi=new Map;for(const e of Gi)Hi.set(e,new vi(e,"uint"));const qi=new Map([...Hi].map(e=>new vi(e.value,"int")));for(const e of zi)qi.set(e,new vi(e,"int"));const ji=new Map([...qi].map(e=>new vi(e.value)));for(const e of $i)ji.set(e,new vi(e));for(const e of $i)ji.set(-e,new vi(-e));const Xi={bool:Wi,uint:Hi,ints:qi,float:ji},Ki=new Map([...Wi,...ji]),Qi=(e,t)=>Ki.has(e)?Ki.get(e):!0===e.isNode?e:new vi(e,t),Yi=function(e,t=null){return(...r)=>{for(const t of r)if(void 0===t)return o(`TSL: Invalid parameter for the type "${e}".`,new Is),new vi(0,e);if((0===r.length||!["bool","float","int","uint"].includes(e)&&r.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(r=[Qs(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return rn(t.get(r[0]));if(1===r.length){const t=Qi(r[0],e);return t.nodeType===e?rn(t):rn(new pi(t,e))}const s=r.map(e=>Qi(e));return rn(new mi(s,e))}};function Zi(e){return e&&e.isNode&&e.traverse(t=>{t.isConstNode&&(e=t.value)}),Boolean(e)}const Ji=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function en(e,t){return new Vi(e,t)}const tn=(e,t=null)=>function(e,t=null){const r=Ks(e);return"node"===r?e:null===t&&("float"===r||"boolean"===r)||r&&"shader"!==r&&"string"!==r?tn(Qi(e,t)):"shader"===r?e.isFn?e:cn(e):e}(e,t),rn=(e,t=null)=>tn(e,t).toVarIntent(),sn=(e,t=null)=>new Pi(e,t),nn=(e,t=null)=>new Di(e,t),an=(e,t=null,r=null,s=null)=>new Ui(e,t,r,s),on=(e,...t)=>new Ii(e,...t),un=(e,t=null,r=null,s={})=>new Ui(e,t,r,{...s,intent:!0});let ln=0;class dn extends ci{constructor(e,t=null){super();let r=null;null!==t&&("object"==typeof t?r=t.return:("string"==typeof t?r=t:o("TSL: Invalid layout type.",new Is),t=null)),this.shaderNode=new en(e,r),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const r={name:"fn"+ln++,type:t,inputs:[]};for(const t in e)"return"!==t&&r.inputs.push({name:t,type:e[t]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return o('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function cn(e,t=null){const r=new dn(e,t);return new Proxy(()=>{},{apply:(e,t,s)=>r.call(...s),get:(e,t,s)=>Reflect.get(r,t,s),set:(e,t,s,i)=>Reflect.set(r,t,s,i)})}const hn=e=>{Si=e},pn=()=>Si,gn=(...e)=>Si.If(...e);function mn(e){return Si&&Si.addToStack(e),e}Ei("toStack",mn);const fn=new Yi("color"),yn=new Yi("float",Xi.float),bn=new Yi("int",Xi.ints),xn=new Yi("uint",Xi.uint),Tn=new Yi("bool",Xi.bool),_n=new Yi("vec2"),vn=new Yi("ivec2"),Nn=new Yi("uvec2"),Sn=new Yi("bvec2"),Rn=new Yi("vec3"),En=new Yi("ivec3"),An=new Yi("uvec3"),wn=new Yi("bvec3"),Cn=new Yi("vec4"),Mn=new Yi("ivec4"),Bn=new Yi("uvec4"),Ln=new Yi("bvec4"),Fn=new Yi("mat2"),Pn=new Yi("mat3"),Dn=new Yi("mat4");Ei("toColor",fn),Ei("toFloat",yn),Ei("toInt",bn),Ei("toUint",xn),Ei("toBool",Tn),Ei("toVec2",_n),Ei("toIVec2",vn),Ei("toUVec2",Nn),Ei("toBVec2",Sn),Ei("toVec3",Rn),Ei("toIVec3",En),Ei("toUVec3",An),Ei("toBVec3",wn),Ei("toVec4",Cn),Ei("toIVec4",Mn),Ei("toUVec4",Bn),Ei("toBVec4",Ln),Ei("toMat2",Fn),Ei("toMat3",Pn),Ei("toMat4",Dn);const Un=an(hi).setParameterLength(2),In=(e,t)=>new pi(tn(e),t);Ei("element",Un),Ei("convert",In);Ei("append",e=>(d("TSL: .append() has been renamed to .toStack().",new Is),mn(e)));class On extends ci{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return Vs(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Vn=(e,t)=>new On(e,t),kn=(e,t)=>new On(e,t,!0),Gn=on(On,"vec4","DiffuseColor"),zn=on(On,"vec3","DiffuseContribution"),$n=on(On,"vec3","EmissiveColor"),Wn=on(On,"float","Roughness"),Hn=on(On,"float","Metalness"),qn=on(On,"float","Clearcoat"),jn=on(On,"float","ClearcoatRoughness"),Xn=on(On,"vec3","Sheen"),Kn=on(On,"float","SheenRoughness"),Qn=on(On,"float","Iridescence"),Yn=on(On,"float","IridescenceIOR"),Zn=on(On,"float","IridescenceThickness"),Jn=on(On,"float","AlphaT"),ea=on(On,"float","Anisotropy"),ta=on(On,"vec3","AnisotropyT"),ra=on(On,"vec3","AnisotropyB"),sa=on(On,"color","SpecularColor"),ia=on(On,"color","SpecularColorBlended"),na=on(On,"float","SpecularF90"),aa=on(On,"float","Shininess"),oa=on(On,"vec4","Output"),ua=on(On,"float","dashSize"),la=on(On,"float","gapSize"),da=on(On,"float","pointWidth"),ca=on(On,"float","IOR"),ha=on(On,"float","Transmission"),pa=on(On,"float","Thickness"),ga=on(On,"float","AttenuationDistance"),ma=on(On,"color","AttenuationColor"),fa=on(On,"float","Dispersion");class ya extends ci{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1,s=null){super("string"),this.name=e,this.shared=t,this.order=r,this.updateType=s,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const ba=(e,t=1,r=null)=>new ya(e,!1,t,r),xa=(e,t=0,r=null)=>new ya(e,!0,t,r),Ta=xa("frame",0,ri.FRAME),_a=xa("render",0,ri.RENDER),va=ba("object",1,ri.OBJECT);class Na extends Ti{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=va}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const r=e(t,this);void 0!==r&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const r=this.getNodeType(e),s=this.getUniformHash(e);let i=e.getNodeFromHash(s);void 0===i&&(e.setHashNode(this,s),i=this);const n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let u=o;if("bool"===r){const t=e.getDataFromNode(this);let s=t.propertyName;if(void 0===s){const i=e.getVarFromNode(this,null,"bool");s=e.getPropertyName(i),t.propertyName=s,u=e.format(o,n,r),e.addLineFlowCode(`${s} = ${u}`,this)}u=s}return e.format(u,r,t)}}const Sa=(e,t)=>{const r=Ji(t||e);if(r===e&&(e=Qs(r)),e&&!0===e.isNode){let t=e.value;e.traverse(e=>{!0===e.isConstNode&&(t=e.value)}),e=t}return new Na(e,r)};class Ra extends gi{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return null===this.nodeType?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return null===this.nodeType?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const Ea=(...e)=>{let t;if(1===e.length){const r=e[0];t=new Ra(null,r.length,r)}else{const r=e[0],s=e[1];t=new Ra(r,s)}return tn(t)};Ei("toArray",(e,t)=>Ea(Array(t).fill(e)));class Aa extends gi{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const r=e.getTypeLength(t.node.getNodeType(e));return ui.join("").slice(0,r)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:r}=this,s=t.getScope();e.getDataFromNode(s).assign=!0;const i=e.getNodeProperties(this);i.sourceNode=r,i.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.build(e),a=r.getNodeType(e),o=s.build(e,a),u=s.getNodeType(e),l=e.getDataFromNode(this);let d;if(!0===l.initialized)"void"!==t&&(d=n);else if(i){const s=e.getVarFromNode(this,null,a),i=e.getPropertyName(s);e.addLineFlowCode(`${i} = ${o}`,this);const u=r.node,l=u.node.context({assign:!0}).build(e);for(let t=0;t{const s=r.type;let i;return i="pointer"===s?"&"+t.build(e):t.build(e,s),i};if(Array.isArray(i)){if(i.length>s.length)o("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length(t=t.length>1||t[0]&&!0===t[0].isNode?nn(t):sn(t[0]),new Ca(tn(e),t));Ei("call",Ma);const Ba={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class La extends gi{static get type(){return"OperatorNode"}constructor(e,t,r,...s){if(super(),s.length>0){let i=new La(e,t,r);for(let t=0;t>"===r||"<<"===r)return e.getIntegerType(n);if("!"===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r){const t=Math.max(e.getTypeLength(n),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(n)){if("float"===a)return n;if(e.isVector(a))return e.getVectorFromMatrix(n);if(e.isMatrix(a))return n}else if(e.isMatrix(a)){if("float"===n)return a;if(e.isVector(n))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(n)?a:n}generate(e,t){const r=this.op,{aNode:s,bNode:i}=this,n=this.getNodeType(e,t);let a=null,o=null;"void"!==n?(a=s.getNodeType(e),o=i?i.getNodeType(e):null,"<"===r||">"===r||"<="===r||">="===r||"=="===r||"!="===r?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===r||"<<"===r?(a=n,o=e.changeComponentType(o,"uint")):"%"===r?(a=n,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=n):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=n:o=n):a=o=n;const u=s.build(e,a),l=i?i.build(e,o):null,d=e.getFunctionOperator(r);if("void"!==t){const s=e.renderer.coordinateSystem===c;if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r)return s&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${u}, ${l} )`,n,t):e.format(`( ${u} ${r} ${l} )`,n,t);if("%"===r)return e.isInteger(o)?e.format(`( ${u} % ${l} )`,n,t):e.format(`${this.getOperatorMethod(e,n)}( ${u}, ${l} )`,n,t);if("!"===r||"~"===r)return e.format(`(${r}${u})`,a,t);if(d)return e.format(`${d}( ${u}, ${l} )`,n,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${l} ${r} ${u} )`,n,t);if("float"===a&&e.isMatrix(o))return e.format(`${u} ${r} ${l}`,n,t);{let i=`( ${u} ${r} ${l} )`;return!s&&"bool"===n&&e.isVector(a)&&e.isVector(o)&&(i=`all${i}`),e.format(i,n,t)}}if("void"!==a)return d?e.format(`${d}( ${u}, ${l} )`,n,t):e.isMatrix(a)&&"float"===o?e.format(`${l} ${r} ${u}`,n,t):e.format(`${u} ${r} ${l}`,n,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Fa=un(La,"+").setParameterLength(2,1/0).setName("add"),Pa=un(La,"-").setParameterLength(2,1/0).setName("sub"),Da=un(La,"*").setParameterLength(2,1/0).setName("mul"),Ua=un(La,"/").setParameterLength(2,1/0).setName("div"),Ia=un(La,"%").setParameterLength(2).setName("mod"),Oa=un(La,"==").setParameterLength(2).setName("equal"),Va=un(La,"!=").setParameterLength(2).setName("notEqual"),ka=un(La,"<").setParameterLength(2).setName("lessThan"),Ga=un(La,">").setParameterLength(2).setName("greaterThan"),za=un(La,"<=").setParameterLength(2).setName("lessThanEqual"),$a=un(La,">=").setParameterLength(2).setName("greaterThanEqual"),Wa=un(La,"&&").setParameterLength(2,1/0).setName("and"),Ha=un(La,"||").setParameterLength(2,1/0).setName("or"),qa=un(La,"!").setParameterLength(1).setName("not"),ja=un(La,"^^").setParameterLength(2).setName("xor"),Xa=un(La,"&").setParameterLength(2).setName("bitAnd"),Ka=un(La,"~").setParameterLength(1).setName("bitNot"),Qa=un(La,"|").setParameterLength(2).setName("bitOr"),Ya=un(La,"^").setParameterLength(2).setName("bitXor"),Za=un(La,"<<").setParameterLength(2).setName("shiftLeft"),Ja=un(La,">>").setParameterLength(2).setName("shiftRight"),eo=cn(([e])=>(e.addAssign(1),e)),to=cn(([e])=>(e.subAssign(1),e)),ro=cn(([e])=>{const t=bn(e).toConst();return e.addAssign(1),t}),so=cn(([e])=>{const t=bn(e).toConst();return e.subAssign(1),t});Ei("add",Fa),Ei("sub",Pa),Ei("mul",Da),Ei("div",Ua),Ei("mod",Ia),Ei("equal",Oa),Ei("notEqual",Va),Ei("lessThan",ka),Ei("greaterThan",Ga),Ei("lessThanEqual",za),Ei("greaterThanEqual",$a),Ei("and",Wa),Ei("or",Ha),Ei("not",qa),Ei("xor",ja),Ei("bitAnd",Xa),Ei("bitNot",Ka),Ei("bitOr",Qa),Ei("bitXor",Ya),Ei("shiftLeft",Za),Ei("shiftRight",Ja),Ei("incrementBefore",eo),Ei("decrementBefore",to),Ei("increment",ro),Ei("decrement",so);const io=(e,t)=>(d('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new Is),Ia(bn(e),bn(t)));Ei("modInt",io);class no extends gi{static get type(){return"MathNode"}constructor(e,t,r=null,s=null){if(super(),(e===no.MAX||e===no.MIN)&&arguments.length>3){let i=new no(e,t,r);for(let t=2;tn&&i>a?t:n>a?r:a>i?s:t}generateNodeType(e){const t=this.method;return t===no.LENGTH||t===no.DISTANCE||t===no.DOT?"float":t===no.CROSS?"vec3":t===no.ALL||t===no.ANY?"bool":t===no.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:r,method:s}=this;let i=null;if(s===no.ONE_MINUS)i=Pa(1,t);else if(s===no.RECIPROCAL)i=Ua(1,t);else if(s===no.DIFFERENCE)i=Vo(Pa(t,r));else if(s===no.TRANSFORM_DIRECTION){let s=t,n=r;e.isMatrix(s.getNodeType(e))?n=Cn(Rn(n),0):s=Cn(Rn(s),0);const a=Da(s,n).xyz;i=Ro(a)}return null!==i?i:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method;const s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=this.cNode,u=e.renderer.coordinateSystem;if(r===no.NEGATE)return e.format("( - "+n.build(e,i)+" )",s,t);{const l=[];return r===no.CROSS?l.push(n.build(e,s),a.build(e,s)):u===c&&r===no.STEP?l.push(n.build(e,1===e.getTypeLength(n.getNodeType(e))?"float":i),a.build(e,i)):u!==c||r!==no.MIN&&r!==no.MAX?r===no.REFRACT?l.push(n.build(e,i),a.build(e,i),o.build(e,"float")):r===no.MIX?l.push(n.build(e,i),a.build(e,i),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":i)):(u===h&&r===no.ATAN&&null!==a&&(r="atan2"),"fragment"===e.shaderStage||r!==no.DFDX&&r!==no.DFDY||(d(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),l.push(n.build(e,i)),null!==a&&l.push(a.build(e,i)),null!==o&&l.push(o.build(e,i))):l.push(n.build(e,i),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":i)),e.format(`${e.getMethod(r,s)}( ${l.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}no.ALL="all",no.ANY="any",no.RADIANS="radians",no.DEGREES="degrees",no.EXP="exp",no.EXP2="exp2",no.LOG="log",no.LOG2="log2",no.SQRT="sqrt",no.INVERSE_SQRT="inversesqrt",no.FLOOR="floor",no.CEIL="ceil",no.NORMALIZE="normalize",no.FRACT="fract",no.SIN="sin",no.SINH="sinh",no.COS="cos",no.COSH="cosh",no.TAN="tan",no.TANH="tanh",no.ASIN="asin",no.ASINH="asinh",no.ACOS="acos",no.ACOSH="acosh",no.ATAN="atan",no.ATANH="atanh",no.ABS="abs",no.SIGN="sign",no.LENGTH="length",no.NEGATE="negate",no.ONE_MINUS="oneMinus",no.DFDX="dFdx",no.DFDY="dFdy",no.ROUND="round",no.RECIPROCAL="reciprocal",no.TRUNC="trunc",no.FWIDTH="fwidth",no.TRANSPOSE="transpose",no.DETERMINANT="determinant",no.INVERSE="inverse",no.EQUALS="equals",no.MIN="min",no.MAX="max",no.STEP="step",no.REFLECT="reflect",no.DISTANCE="distance",no.DIFFERENCE="difference",no.DOT="dot",no.CROSS="cross",no.POW="pow",no.TRANSFORM_DIRECTION="transformDirection",no.MIX="mix",no.CLAMP="clamp",no.REFRACT="refract",no.SMOOTHSTEP="smoothstep",no.FACEFORWARD="faceforward";const ao=yn(1e-6),oo=yn(1e6),uo=yn(Math.PI),lo=yn(2*Math.PI),co=yn(2*Math.PI),ho=yn(.5*Math.PI),po=un(no,no.ALL).setParameterLength(1),go=un(no,no.ANY).setParameterLength(1),mo=un(no,no.RADIANS).setParameterLength(1),fo=un(no,no.DEGREES).setParameterLength(1),yo=un(no,no.EXP).setParameterLength(1),bo=un(no,no.EXP2).setParameterLength(1),xo=un(no,no.LOG).setParameterLength(1),To=un(no,no.LOG2).setParameterLength(1),_o=un(no,no.SQRT).setParameterLength(1),vo=un(no,no.INVERSE_SQRT).setParameterLength(1),No=un(no,no.FLOOR).setParameterLength(1),So=un(no,no.CEIL).setParameterLength(1),Ro=un(no,no.NORMALIZE).setParameterLength(1),Eo=un(no,no.FRACT).setParameterLength(1),Ao=un(no,no.SIN).setParameterLength(1),wo=un(no,no.SINH).setParameterLength(1),Co=un(no,no.COS).setParameterLength(1),Mo=un(no,no.COSH).setParameterLength(1),Bo=un(no,no.TAN).setParameterLength(1),Lo=un(no,no.TANH).setParameterLength(1),Fo=un(no,no.ASIN).setParameterLength(1),Po=un(no,no.ASINH).setParameterLength(1),Do=un(no,no.ACOS).setParameterLength(1),Uo=un(no,no.ACOSH).setParameterLength(1),Io=un(no,no.ATAN).setParameterLength(1,2),Oo=un(no,no.ATANH).setParameterLength(1),Vo=un(no,no.ABS).setParameterLength(1),ko=un(no,no.SIGN).setParameterLength(1),Go=un(no,no.LENGTH).setParameterLength(1),zo=un(no,no.NEGATE).setParameterLength(1),$o=un(no,no.ONE_MINUS).setParameterLength(1),Wo=un(no,no.DFDX).setParameterLength(1),Ho=un(no,no.DFDY).setParameterLength(1),qo=un(no,no.ROUND).setParameterLength(1),jo=un(no,no.RECIPROCAL).setParameterLength(1),Xo=un(no,no.TRUNC).setParameterLength(1),Ko=un(no,no.FWIDTH).setParameterLength(1),Qo=un(no,no.TRANSPOSE).setParameterLength(1),Yo=un(no,no.DETERMINANT).setParameterLength(1),Zo=un(no,no.INVERSE).setParameterLength(1),Jo=un(no,no.MIN).setParameterLength(2,1/0),eu=un(no,no.MAX).setParameterLength(2,1/0),tu=un(no,no.STEP).setParameterLength(2),ru=un(no,no.REFLECT).setParameterLength(2),su=un(no,no.DISTANCE).setParameterLength(2),iu=un(no,no.DIFFERENCE).setParameterLength(2),nu=un(no,no.DOT).setParameterLength(2),au=un(no,no.CROSS).setParameterLength(2),ou=un(no,no.POW).setParameterLength(2),uu=e=>Da(e,e),lu=e=>Da(e,e,e),du=e=>Da(e,e,e,e),cu=un(no,no.TRANSFORM_DIRECTION).setParameterLength(2),hu=e=>Da(ko(e),ou(Vo(e),1/3)),pu=e=>nu(e,e),gu=un(no,no.MIX).setParameterLength(3),mu=(e,t=0,r=1)=>new no(no.CLAMP,tn(e),tn(t),tn(r)),fu=e=>mu(e),yu=un(no,no.REFRACT).setParameterLength(3),bu=un(no,no.SMOOTHSTEP).setParameterLength(3),xu=un(no,no.FACEFORWARD).setParameterLength(3),Tu=cn(([e])=>{const t=nu(e.xy,_n(12.9898,78.233)),r=Ia(t,uo);return Eo(Ao(r).mul(43758.5453))}),_u=(e,t,r)=>gu(t,r,e),vu=(e,t,r)=>bu(t,r,e),Nu=(e,t)=>tu(t,e),Su=xu,Ru=vo;Ei("all",po),Ei("any",go),Ei("radians",mo),Ei("degrees",fo),Ei("exp",yo),Ei("exp2",bo),Ei("log",xo),Ei("log2",To),Ei("sqrt",_o),Ei("inverseSqrt",vo),Ei("floor",No),Ei("ceil",So),Ei("normalize",Ro),Ei("fract",Eo),Ei("sin",Ao),Ei("sinh",wo),Ei("cos",Co),Ei("cosh",Mo),Ei("tan",Bo),Ei("tanh",Lo),Ei("asin",Fo),Ei("asinh",Po),Ei("acos",Do),Ei("acosh",Uo),Ei("atan",Io),Ei("atanh",Oo),Ei("abs",Vo),Ei("sign",ko),Ei("length",Go),Ei("lengthSq",pu),Ei("negate",zo),Ei("oneMinus",$o),Ei("dFdx",Wo),Ei("dFdy",Ho),Ei("round",qo),Ei("reciprocal",jo),Ei("trunc",Xo),Ei("fwidth",Ko),Ei("min",Jo),Ei("max",eu),Ei("step",Nu),Ei("reflect",ru),Ei("distance",su),Ei("dot",nu),Ei("cross",au),Ei("pow",ou),Ei("pow2",uu),Ei("pow3",lu),Ei("pow4",du),Ei("transformDirection",cu),Ei("mix",_u),Ei("clamp",mu),Ei("refract",yu),Ei("smoothstep",vu),Ei("faceForward",xu),Ei("difference",iu),Ei("saturate",fu),Ei("cbrt",hu),Ei("transpose",Qo),Ei("determinant",Yo),Ei("inverse",Zo),Ei("rand",Tu);class Eu extends ci{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}generateNodeType(e){const{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const s=t.getNodeType(e);if(null!==r){const t=r.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(s))return t}return s}setup(e){const t=this.condNode,r=this.ifNode.isolate(),s=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,null!==s&&(e.getDataFromNode(s).parentNodeBlock=i);const n=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n?r:r.context({nodeBlock:r}),a.elseNode=s?n?s:s.context({nodeBlock:s}):null}generate(e,t){const r=this.getNodeType(e),s=e.getDataFromNode(this);if(void 0!==s.nodeProperty)return s.nodeProperty;const{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,u="void"!==t,l=u?Vn(r).build(e):"";s.nodeProperty=l;const c=i.build(e,"bool");if(e.context.uniformFlow&&null!==a){const s=n.build(e,r),i=a.build(e,r),o=e.getTernary(c,s,i);return e.format(o,r,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=n.build(e,r);if(h&&(u?h=l+" = "+h+";":(h="return "+h+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,r);t&&(u?t=l+" = "+t+";":(t="return "+t+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,r,t)}}const Au=an(Eu).setParameterLength(2,3);Ei("select",Au);class wu extends ci{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{!0===t.isContextNode&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const r=e.addContext(this.value),s=this.node.build(e,t);return e.setContext(r),s}}const Cu=(e=null,t={})=>{let r=e;return null!==r&&!0===r.isNode||(t=r||t,r=null),new wu(r,t)},Mu=e=>Cu(e,{uniformFlow:!0}),Bu=(e,t)=>Cu(e,{nodeName:t});function Lu(e,t,r=null){return Cu(r,{getShadow:({light:r,shadowColorNode:s})=>t===r?s.mul(e):s})}function Fu(e,t=null){return Cu(t,{getAO:(t,{material:r})=>!0===r.transparent?t:null!==t?t.mul(e):e})}function Pu(e,t){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),Bu(e,t)}Ei("context",Cu),Ei("label",Pu),Ei("uniformFlow",Mu),Ei("setName",Bu),Ei("builtinShadowContext",(e,t,r)=>Lu(t,r,e)),Ei("builtinAOContext",(e,t)=>Fu(t,e));class Du extends ci{static get type(){return"VarNode"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return!0!==e.getDataFromNode(this).forceDeclaration&&this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;if(this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&t.fnCall&&t.fnCall.shaderNode){if(t.getDataFromNode(this.node.shaderNode).hasLoop){t.getDataFromNode(this).forceDeclaration=!0,e=!0}}const r=t.getBaseStack();e?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:r,readOnly:s}=this,{renderer:i}=e,n=!0===i.backend.isWebGPUBackend;let a=!1,u=!1;s&&(a=e.isDeterministic(t),u=n?s:a);const l=this.getNodeType(e);if("void"==l){!0!==this.isIntent(e)&&o('TSL: ".toVar()" can not be used with void type.',this.stackTrace);return t.build(e)}const d=e.getVectorType(l),c=t.build(e,d),h=e.getVarFromNode(this,r,d,void 0,u),p=e.getPropertyName(h);let g=p;if(u)if(n)g=a?`const ${p}`:`let ${p}`;else{const r=t.getArrayCount(e);g=`const ${e.getVar(h.type,p,r)}`}return e.addLineFlowCode(`${g} = ${c}`,this),p}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}const Uu=an(Du),Iu=(e,t=null)=>Uu(e,t).toStack(),Ou=(e,t=null)=>Uu(e,t,!0).toStack(),Vu=e=>Uu(e).setIntent(!0).toStack();Ei("toVar",Iu),Ei("toConst",Ou),Ei("toVarIntent",Vu);class ku extends ci{static get type(){return"SubBuild"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const r=this.node.build(e,...t);return e.removeSubBuild(),r}}const Gu=(e,t,r=null)=>new ku(tn(e),t,r);class zu extends ci{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Gu(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let r=t.varying;if(void 0===r){const s=this.name,i=this.getNodeType(e),n=this.interpolationType,a=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,s,i,n,a),t.node=Gu(this.node,"VERTEX")}return r.needsInterpolation||(r.needsInterpolation="fragment"===e.shaderStage),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),r=e.getNodeProperties(this),s=this.setupVarying(e);if(void 0===r[t]){const i=this.getNodeType(e),n=e.getPropertyName(s,ti.VERTEX);e.flowNodeFromShaderStage(ti.VERTEX,r.node,i,n),r[t]=n}return e.getPropertyName(s)}}const $u=an(zu).setParameterLength(1,2),Wu=e=>$u(e);Ei("toVarying",$u),Ei("toVertexStage",Wu);const Hu=cn(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),r=e.mul(.0773993808),s=e.lessThanEqual(.04045);return gu(t,r,s)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qu=cn(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),s=e.lessThanEqual(.0031308);return gu(t,r,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),ju="WorkingColorSpace";class Xu extends gi{static get type(){return"ColorSpaceNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===ju?p.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),s=this.resolveColorSpace(e,this.target);let i=t;return!1!==p.enabled&&r!==s&&r&&s?(p.getTransfer(r)===g&&(i=Cn(Hu(i.rgb),i.a)),p.getPrimaries(r)!==p.getPrimaries(s)&&(i=Cn(Pn(p._getMatrix(new n,r,s)).mul(i.rgb),i.a)),p.getTransfer(s)===g&&(i=Cn(qu(i.rgb),i.a)),i):i}}const Ku=(e,t)=>new Xu(tn(e),ju,t),Qu=(e,t)=>new Xu(tn(e),t,ju);Ei("workingToColorSpace",Ku),Ei("colorSpaceToWorking",Qu);let Yu=class extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(),s=this.getNodeType();return e.format(t,r,s)}};class Zu extends ci{static get type(){return"ReferenceBaseNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.updateType=ri.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Yu(this,tn(e))}setNodeType(e){const t=Sa(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Ju(e,t,r);class tl extends gi{static get type(){return"ToneMappingNode"}constructor(e,t=sl,r=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return Gs(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,r=this._toneMapping;if(r===m)return t;let s=null;const i=e.renderer.library.getToneMappingFunction(r);return null!==i?s=Cn(i(t.rgb,this.exposureNode),t.a):(o("ToneMappingNode: Unsupported Tone Mapping configuration.",r),s=t),s}}const rl=(e,t,r)=>new tl(e,tn(t),tn(r)),sl=el("toneMappingExposure","float");Ei("toneMapping",(e,t,r)=>rl(t,r,e));const il=new WeakMap;function nl(e,t){let r=il.get(e);return void 0===r&&(r=new b(e,t),il.set(e,r)),r}class al extends Ti{static get type(){return"BufferAttributeNode"}constructor(e,t=null,r=0,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=s,this.usage=f,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(0===this.bufferStride&&0===this.bufferOffset){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}generateNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),r=e.getTypeLength(t),s=this.value,i=this.bufferStride||r,n=this.bufferOffset;let a;a=!0===s.isInterleavedBuffer?s:!0===s.isBufferAttribute?nl(s.array,i):nl(s,i);const o=new y(a,r,n);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),r=e.getBufferAttributeFromNode(this,t),s=e.getPropertyName(r);let i=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=s,i=s;else{i=$u(this).build(e,t)}return i}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function ol(e,t=null,r=0,s=0,i=f,n=!1){return"mat3"===t||null===t&&9===e.itemSize?Pn(new al(e,"vec3",9,0).setUsage(i).setInstanced(n),new al(e,"vec3",9,3).setUsage(i).setInstanced(n),new al(e,"vec3",9,6).setUsage(i).setInstanced(n)):"mat4"===t||null===t&&16===e.itemSize?Dn(new al(e,"vec4",16,0).setUsage(i).setInstanced(n),new al(e,"vec4",16,4).setUsage(i).setInstanced(n),new al(e,"vec4",16,8).setUsage(i).setInstanced(n),new al(e,"vec4",16,12).setUsage(i).setInstanced(n)):new al(e,t,r,s).setUsage(i)}const ul=(e,t=null,r=0,s=0)=>ol(e,t,r,s),ll=(e,t=null,r=0,s=0)=>ol(e,t,r,s,f,!0),dl=(e,t=null,r=0,s=0)=>ol(e,t,r,s,x,!0);Ei("toAttribute",e=>ul(e.value));class cl extends ci{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),r=this.scope;let s,i;if(r===cl.VERTEX)s=e.getVertexIndex();else if(r===cl.INSTANCE)s=e.getInstanceIndex();else if(r===cl.DRAW)s=e.getDrawIndex();else if(r===cl.INVOCATION_LOCAL)s=e.getInvocationLocalIndex();else if(r===cl.INVOCATION_SUBGROUP)s=e.getInvocationSubgroupIndex();else{if(r!==cl.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+r);s=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)i=s;else{i=$u(this).build(e,t)}return i}}cl.VERTEX="vertex",cl.INSTANCE="instance",cl.SUBGROUP="subgroup",cl.INVOCATION_LOCAL="invocationLocal",cl.INVOCATION_SUBGROUP="invocationSubgroup",cl.DRAW="draw";const hl=on(cl,cl.VERTEX),pl=on(cl,cl.INSTANCE),gl=on(cl,cl.SUBGROUP),ml=on(cl,cl.INVOCATION_SUBGROUP),fl=on(cl,cl.INVOCATION_LOCAL),yl=on(cl,cl.DRAW);class bl extends ci{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=ri.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){null!==this.count&&null===this.countNode&&(this.countNode=Sa(this.count,"uint").onObjectUpdate(()=>this.count));const t=this.computeNode.build(e);if(t){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:r}=e;if("compute"===r){const t=this.computeNode.build(e,"void");if(""!==t&&e.addLineFlowCode(t,this),null!==this.count&&!0===e.allowEarlyReturns){const t=this.countNode.build(e,"uint"),r=pl.build(e,"uint");e.flow.code=`${e.tab}if ( ${r} >= ${t} ) { return; }\n\n${e.flow.code}`}}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const xl=(e,t=[64])=>{(0===t.length||t.length>3)&&o("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Is);for(let e=0;e{const s=xl(e,r);return"number"==typeof t?s.count=t:s.dispatchSize=t,s};Ei("compute",Tl),Ei("computeKernel",xl);class _l extends ci{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){const t=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.getNodeType(e);return e.setCache(t),s}build(e,...t){const r=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const i=this.node.build(e,...t);return e.setCache(r),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const vl=e=>new _l(tn(e));function Nl(e,t=!0){return d('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),vl(e).setParent(t)}Ei("cache",Nl),Ei("isolate",vl);class Sl extends ci{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Rl=an(Sl).setParameterLength(2);Ei("bypass",Rl);const El=cn(([e,t,r,s=yn(0),i=yn(1),n=Tn(!1)])=>{let a=e.sub(t).div(r.sub(t));return Zi(n)&&(a=a.clamp()),a.mul(i.sub(s)).add(s)});function Al(e,t,r,s=yn(0),i=yn(1)){return El(e,t,r,s,i,!0)}Ei("remap",El),Ei("remapClamp",Al);class wl extends ci{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const r=this.getNodeType(e),s=this.snippet;if("void"!==r)return e.format(s,r,t);e.addLineFlowCode(s,this)}}const Cl=an(wl).setParameterLength(1,2),Ml=e=>(e?Au(e,Cl("discard")):Cl("discard")).toStack();Ei("discard",Ml);class Bl extends gi{static get type(){return"RenderOutputNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const r=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||m,s=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||T;return r!==m&&(t=t.toneMapping(r)),s!==T&&s!==p.workingColorSpace&&(t=t.workingToColorSpace(s)),t}}const Ll=(e,t=null,r=null)=>new Bl(tn(e),t,r);Ei("renderOutput",Ll);class Fl extends gi{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,r=this.node.build(e);if(null!==t)t(e,r);else{const t="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(t.length);let i="";i+="// #"+t+"#\n",i+=e.flow.code.replace(/^\t/gm,"")+"\n",i+="/* ... */ "+r+" /* ... */\n",i+="// #"+s+"#\n",_(i)}return r}}const Pl=(e,t=null)=>new Fl(tn(e),t).toStack();Ei("debug",Pl);class Dl extends u{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class Ul extends ci{static get type(){return"InspectorNode"}constructor(e,t="",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=ri.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==Dl&&v('TSL: ".toInspector()" is only available with WebGPU.'),t}}function Il(e,t="",r=null){return(e=tn(e)).before(new Ul(e,t,r))}Ei("toInspector",Il);class Ol extends ci{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(null===t){const r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){const s=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(s)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),r=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const s=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(s),n=e.getAttribute(t,i);if("vertex"===e.shaderStage)return e.format(n.name,i,r);return $u(this).build(e,r)}return d(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(r)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Vl=(e,t=null)=>new Ol(e,t),kl=(e=0)=>Vl("uv"+(e>0?e:""),"vec2");class Gl extends ci{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const r=this.textureNode.build(e,"property"),s=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${r}, ${s} )`,this.getNodeType(e),t)}}const zl=an(Gl).setParameterLength(1,2);class $l extends Na{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=ri.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&void 0!==r.width){const{width:e,height:t}=r;this.value=Math.log2(Math.max(e,t))}}}const Wl=an($l).setParameterLength(1);class Hl extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const ql=new N;class jl extends Na{static get type(){return"TextureNode"}constructor(e=ql,t=null,r=null,s=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=s,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=ri.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===S?"uvec4":this.value.type===R?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return kl(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=Sa(this.value.matrix)),this._matrixUniform.mul(Rn(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=Sa(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(bn(zl(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const r=this.value;if(!r||!0!==r.isTexture)throw new Hl("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const s=cn(()=>{let t=this.uvNode;return null!==t&&!0!==e.context.forceUVContext||!e.context.getUV||(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?ri.OBJECT:ri.NONE,t})();let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this));let n=null,a=null;if(null!==this.compareNode)if(e.renderer.hasCompatibility(E.TEXTURE_COMPARE))n=this.compareNode;else{const e=r.compareFunction;null===e||e===A||e===w||e===C||e===M?a=this.compareNode:(n=this.compareNode,v('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=s,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=n,t.compareStepNode=a,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;let d;return d=i?e.generateTextureBias(l,t,r,i,n,u):o?e.generateTextureGrad(l,t,r,o,n,u):a?e.generateTextureCompare(l,t,r,a,n,u):!1===this.sampler?e.generateTextureLoad(l,t,r,s,n,u):s?e.generateTextureLevel(l,t,r,s,n,u):e.generateTexture(l,t,r,n,u),d}generate(e,t){const r=this.value,s=e.getNodeProperties(this),i=super.generate(e,"property");if(/^sampler/.test(t))return i+"_sampler";if(e.isReference(t))return i;{const n=e.getDataFromNode(this),a=this.getNodeType(e);let o=n.propertyName;if(void 0===o){const{uvNode:t,levelNode:u,biasNode:l,compareNode:d,compareStepNode:c,depthNode:h,gradNode:p,offsetNode:g}=s,m=this.generateUV(e,t),f=u?u.build(e,"float"):null,y=l?l.build(e,"float"):null,b=h?h.build(e,"int"):null,x=d?d.build(e,"float"):null,T=c?c.build(e,"float"):null,_=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,v=g?this.generateOffset(e,g):null;let N=b;null===N&&r.isArrayTexture&&!0!==this.isTexture3DNode&&(N="0");const S=e.getVarFromNode(this);o=e.getPropertyName(S);let R=this.generateSnippet(e,i,m,f,y,N,x,_,v);if(null!==T){const t=r.compareFunction;R=t===C||t===M?tu(Cl(R,a),Cl(T,"float")).build(e,a):tu(Cl(T,"float"),Cl(R,a)).build(e,a)}e.addLineFlowCode(`${o} = ${R}`,this),n.snippet=R,n.propertyName=o}let u=o;return e.needsToWorkingColorSpace(r)&&(u=Qu(Cl(u,a),r.colorSpace).setup(e).build(e,a)),e.format(u,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=tn(e),t.referenceNode=this.getBase(),tn(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=tn(e).mul(Wl(t)),t.referenceNode=this.getBase();const r=t.value;return!1===t.generateMipmaps&&(r&&!1===r.generateMipmaps||r.minFilter===B||r.magFilter===B)&&(d("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),tn(t)}level(e){const t=this.clone();return t.levelNode=tn(e),t.referenceNode=this.getBase(),tn(t)}size(e){return zl(this,e)}bias(e){const t=this.clone();return t.biasNode=tn(e),t.referenceNode=this.getBase(),tn(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=tn(e),t.referenceNode=this.getBase(),tn(t)}grad(e,t){const r=this.clone();return r.gradNode=[tn(e),tn(t)],r.referenceNode=this.getBase(),tn(r)}depth(e){const t=this.clone();return t.depthNode=tn(e),t.referenceNode=this.getBase(),tn(t)}offset(e){const t=this.clone();return t.offsetNode=tn(e),t.referenceNode=this.getBase(),tn(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();const r=this._flipYUniform;null!==r&&(r.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const Xl=an(jl).setParameterLength(1,4).setName("texture"),Kl=(e=ql,t=null,r=null,s=null)=>{let i;return e&&!0===e.isTextureNode?(i=tn(e.clone()),i.referenceNode=e.getBase(),null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=Xl(e,t,r,s),i},Ql=(...e)=>Kl(...e).setSampler(!1);class Yl extends Na{static get type(){return"BufferNode"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Zl=(e,t,r)=>new Yl(e,t,r);class Jl extends hi{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),r=this.getNodeType(e),s=this.node.getPaddedType();return e.format(t,s,r)}}class ed extends Yl{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?Ks(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=ri.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,r=this.elementType;if("float"===r||"int"===r||"uint"===r)for(let r=0;rnew ed(e,t);class rd extends ci{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const sd=an(rd).setParameterLength(1);let id,nd;class ad extends ci{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===ad.DPR?"float":this.scope===ad.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=ri.NONE;return this.scope!==ad.SIZE&&this.scope!==ad.VIEWPORT&&this.scope!==ad.DPR||(e=ri.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ad.VIEWPORT?null!==t?nd.copy(t.viewport):(e.getViewport(nd),nd.multiplyScalar(e.getPixelRatio())):this.scope===ad.DPR?this._output.value=e.getPixelRatio():null!==t?(id.width=t.width,id.height=t.height):e.getDrawingBufferSize(id)}setup(){const e=this.scope;let r=null;return r=e===ad.SIZE?Sa(id||(id=new t)):e===ad.VIEWPORT?Sa(nd||(nd=new s)):e===ad.DPR?Sa(1):_n(dd.div(ld)),this._output=r,r}generate(e){if(this.scope===ad.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const r=e.getNodeProperties(ld).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${r}.y - ${t}.y )`}return t}return super.generate(e)}}ad.COORDINATE="coordinate",ad.VIEWPORT="viewport",ad.SIZE="size",ad.UV="uv",ad.DPR="dpr";const od=on(ad,ad.DPR),ud=on(ad,ad.UV),ld=on(ad,ad.SIZE),dd=on(ad,ad.COORDINATE),cd=on(ad,ad.VIEWPORT),hd=cd.zw,pd=dd.sub(cd.xy),gd=pd.div(hd),md=cn(()=>(d('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Is),ld),"vec2").once()();let fd=null,yd=null,bd=null,xd=null,Td=null,_d=null,vd=null,Nd=null,Sd=null,Rd=null,Ed=null,Ad=null,wd=null,Cd=null;const Md=Sa(0,"uint").setName("u_cameraIndex").setGroup(xa("cameraIndex")).toVarying("v_cameraIndex"),Bd=Sa("float").setName("cameraNear").setGroup(_a).onRenderUpdate(({camera:e})=>e.near),Ld=Sa("float").setName("cameraFar").setGroup(_a).onRenderUpdate(({camera:e})=>e.far),Fd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrix);null===yd?yd=td(r).setGroup(_a).setName("cameraProjectionMatrices"):yd.array=r,t=yd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrix")}else null===fd&&(fd=Sa(e.projectionMatrix).setName("cameraProjectionMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=fd;return t}).once()(),Pd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrixInverse);null===xd?xd=td(r).setGroup(_a).setName("cameraProjectionMatricesInverse"):xd.array=r,t=xd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrixInverse")}else null===bd&&(bd=Sa(e.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=bd;return t}).once()(),Dd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorldInverse);null===_d?_d=td(r).setGroup(_a).setName("cameraViewMatrices"):_d.array=r,t=_d.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraViewMatrix")}else null===Td&&(Td=Sa(e.matrixWorldInverse).setName("cameraViewMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=Td;return t}).once()(),Ud=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorld);null===Nd?Nd=td(r).setGroup(_a).setName("cameraWorldMatrices"):Nd.array=r,t=Nd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraWorldMatrix")}else null===vd&&(vd=Sa(e.matrixWorld).setName("cameraWorldMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=vd;return t}).once()(),Id=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.normalMatrix);null===Rd?Rd=td(r).setGroup(_a).setName("cameraNormalMatrices"):Rd.array=r,t=Rd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraNormalMatrix")}else null===Sd&&(Sd=Sa(e.normalMatrix).setName("cameraNormalMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=Sd;return t}).once()(),Od=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const s=[];for(let t=0,i=e.cameras.length;t{const r=e.cameras,s=t.array;for(let e=0,t=r.length;et.value.setFromMatrixPosition(e.matrixWorld))),t=Ed;return t}).once()(),Vd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.viewport);null===Cd?Cd=td(r,"vec4").setGroup(_a).setName("cameraViewports"):Cd.array=r,t=Cd.element(Md).toConst("cameraViewport")}else null===wd&&(wd=Cn(0,0,ld.x,ld.y).toConst("cameraViewport")),t=wd;return t}).once()(),kd=new L;class Gd extends ci{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=ri.OBJECT,this.uniformNode=new Na(null)}generateNodeType(){const e=this.scope;return e===Gd.WORLD_MATRIX?"mat4":e===Gd.POSITION||e===Gd.VIEW_POSITION||e===Gd.DIRECTION||e===Gd.SCALE?"vec3":e===Gd.RADIUS?"float":void 0}update(e){const t=this.object3d,s=this.uniformNode,i=this.scope;if(i===Gd.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===Gd.POSITION)s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===Gd.SCALE)s.value=s.value||new r,s.value.setFromMatrixScale(t.matrixWorld);else if(i===Gd.DIRECTION)s.value=s.value||new r,t.getWorldDirection(s.value);else if(i===Gd.VIEW_POSITION){const i=e.camera;s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(i.matrixWorldInverse)}else if(i===Gd.RADIUS){const r=e.object.geometry;null===r.boundingSphere&&r.computeBoundingSphere(),kd.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),s.value=kd.radius}}generate(e){const t=this.scope;return t===Gd.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===Gd.POSITION||t===Gd.VIEW_POSITION||t===Gd.DIRECTION||t===Gd.SCALE?this.uniformNode.nodeType="vec3":t===Gd.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Gd.WORLD_MATRIX="worldMatrix",Gd.POSITION="position",Gd.SCALE="scale",Gd.VIEW_POSITION="viewPosition",Gd.DIRECTION="direction",Gd.RADIUS="radius";const zd=an(Gd,Gd.DIRECTION).setParameterLength(1),$d=an(Gd,Gd.WORLD_MATRIX).setParameterLength(1),Wd=an(Gd,Gd.POSITION).setParameterLength(1),Hd=an(Gd,Gd.SCALE).setParameterLength(1),qd=an(Gd,Gd.VIEW_POSITION).setParameterLength(1),jd=an(Gd,Gd.RADIUS).setParameterLength(1);class Xd extends Gd{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const Kd=on(Xd,Xd.DIRECTION),Qd=on(Xd,Xd.WORLD_MATRIX),Yd=on(Xd,Xd.POSITION),Zd=on(Xd,Xd.SCALE),Jd=on(Xd,Xd.VIEW_POSITION),ec=on(Xd,Xd.RADIUS),tc=Sa(new n).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),rc=Sa(new a).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),sc=cn(e=>e.context.modelViewMatrix||ic).once()().toVar("modelViewMatrix"),ic=Dd.mul(Qd),nc=cn(e=>(e.context.isHighPrecisionModelViewMatrix=!0,Sa("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),ac=cn(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return Sa("mat3").onObjectUpdate(({object:e,camera:r})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),oc=cn(e=>"fragment"!==e.shaderStage?(v("TSL: `clipSpace` is only available in fragment stage."),Cn()):e.context.clipSpace.toVarying("v_clipSpace")).once()(),uc=Vl("position","vec3"),lc=uc.toVarying("positionLocal"),dc=uc.toVarying("positionPrevious"),cc=cn(e=>Qd.mul(lc).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),hc=cn(()=>lc.transformDirection(Qd).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),pc=cn(e=>{if("fragment"===e.shaderStage&&e.material.vertexNode){const e=Pd.mul(oc);return e.xyz.div(e.w).toVar("positionView")}return e.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),gc=cn(e=>{let t;return t=e.camera.isOrthographicCamera?Rn(0,0,1):pc.negate().toVarying("v_positionViewDirection").normalize(),t.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class mc extends ci{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return t.side===F?"false":e.getFrontFacing()}}const fc=on(mc),yc=yn(fc).mul(2).sub(1),bc=cn(([e],{material:t})=>{const r=t.side;return r===F?e=e.mul(-1):r===P&&(e=e.mul(yc)),e}),xc=Vl("normal","vec3"),Tc=cn(e=>!1===e.geometry.hasAttribute("normal")?(d('TSL: Vertex attribute "normal" not found on geometry.'),Rn(0,1,0)):xc,"vec3").once()().toVar("normalLocal"),_c=pc.dFdx().cross(pc.dFdy()).normalize().toVar("normalFlat"),vc=cn(e=>{let t;return t=e.isFlatShading()?_c:wc(Tc).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),Nc=cn(e=>{let t=vc.transformDirection(Dd);return!0!==e.isFlatShading()&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),Sc=cn(e=>{let t;return"NORMAL"===e.subBuildFn||"VERTEX"===e.subBuildFn?(t=vc,!0!==e.isFlatShading()&&(t=bc(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Rc=Sc.transformDirection(Dd).toVar("normalWorld"),Ec=cn(({subBuildFn:e,context:t})=>{let r;return r="NORMAL"===e||"VERTEX"===e?Sc:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),r},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Ac=cn(([e,t=Qd])=>{const r=Pn(t),s=e.div(Rn(r[0].dot(r[0]),r[1].dot(r[1]),r[2].dot(r[2])));return r.mul(s).xyz}),wc=cn(([e],t)=>{const r=t.context.modelNormalViewMatrix;if(r)return r.transformDirection(e);const s=tc.mul(e);return Dd.transformDirection(s)}),Cc=cn(()=>(d('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),Sc)).once(["NORMAL","VERTEX"])(),Mc=cn(()=>(d('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Rc)).once(["NORMAL","VERTEX"])(),Bc=cn(()=>(d('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Ec)).once(["NORMAL","VERTEX"])(),Lc=new a,Fc=Sa(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),Pc=Sa(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),Dc=Sa(new a).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const r=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return r?Lc.makeRotationFromEuler(r).transpose():Lc.identity(),Lc}),Uc=gc.negate().reflect(Sc),Ic=gc.negate().refract(Sc,Fc),Oc=Uc.transformDirection(Dd).toVar("reflectVector"),Vc=Ic.transformDirection(Dd).toVar("reflectVector"),kc=new D;class Gc extends jl{static get type(){return"CubeTextureNode"}constructor(e,t=null,r=null,s=null){super(e,t,r,s),this.isCubeTextureNode=!0}getInputType(){return!0===this.value.isDepthTexture?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===U?Oc:e.mapping===I?Vc:(o('CubeTextureNode: Mapping "%s" not supported.',e.mapping),Rn(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const r=this.value;return!0===r.isDepthTexture?e.renderer.coordinateSystem===h?Rn(t.x,t.y.negate(),t.z):t:(t=Dc.mul(t),e.renderer.coordinateSystem!==h&&r.isRenderTargetTexture||(t=Rn(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}const zc=an(Gc).setParameterLength(1,4).setName("cubeTexture"),$c=(e=kc,t=null,r=null,s=null)=>{let i;return e&&!0===e.isCubeTextureNode?(i=tn(e.clone()),i.referenceNode=e,null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=zc(e,t,r,s),i};class Wc extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(e),s=this.getNodeType(e);return e.format(t,r,s)}}class Hc extends ci{static get type(){return"ReferenceNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=ri.OBJECT}element(e){return new Wc(this,tn(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?Zl(null,e,this.count):Array.isArray(this.getValueFromReference())?td(null,e):"texture"===e?Kl(null):"cubeTexture"===e?$c(null):Sa(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Hc(e,t,r),jc=(e,t,r,s)=>new Hc(e,t,s,r);class Xc extends Hc{static get type(){return"MaterialReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const Kc=(e,t,r=null)=>new Xc(e,t,r),Qc=kl(),Yc=pc.dFdx(),Zc=pc.dFdy(),Jc=Qc.dFdx(),eh=Qc.dFdy(),th=Sc,rh=Zc.cross(th),sh=th.cross(Yc),ih=rh.mul(Jc.x).add(sh.mul(eh.x)),nh=rh.mul(Jc.y).add(sh.mul(eh.y)),ah=ih.dot(ih).max(nh.dot(nh)),oh=ah.equal(0).select(0,ah.inverseSqrt()),uh=ih.mul(oh).toVar("tangentViewFrame"),lh=nh.mul(oh).toVar("bitangentViewFrame"),dh=Vl("tangent","vec4"),ch=dh.xyz.toVar("tangentLocal"),hh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?sc.mul(Cn(ch,0)).xyz.toVarying("v_tangentView").normalize():uh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),ph=hh.transformDirection(Dd).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),gh=cn(([e,t],r)=>{let s=e.mul(dh.w).xyz;return"NORMAL"===r.subBuildFn&&!0!==r.isFlatShading()&&(s=s.toVarying(t)),s}).once(["NORMAL"]),mh=gh(xc.cross(dh),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),fh=gh(Tc.cross(ch),"v_bitangentLocal").normalize().toVar("bitangentLocal"),yh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?gh(Sc.cross(hh),"v_bitangentView").normalize():lh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),bh=gh(Rc.cross(ph),"v_bitangentWorld").normalize().toVar("bitangentWorld"),xh=Pn(hh,yh,Sc).toVar("TBNViewMatrix"),Th=gc.mul(xh),_h=cn(()=>{let e=ra.cross(gc);return e=e.cross(ra).normalize(),e=gu(e,Sc,ea.mul(Wn.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),vh=e=>tn(e).mul(.5).add(.5),Nh=e=>Rn(e,_o(fu(yn(1).sub(nu(e,e)))));class Sh extends gi{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=O,this.unpackNormalMode=V}setup(e){const{normalMapType:t,scaleNode:r,unpackNormalMode:s}=this;let i=this.node.mul(2).sub(1);if(t===O?s===k?i=Nh(i.xy):s===G?i=Nh(i.yw):s!==V&&o(`THREE.NodeMaterial: Unexpected unpack normal mode: ${s}`):s!==V&&o(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${s}'`),null!==r){let t=r;!0===e.isFlatShading()&&(t=bc(t)),i=Rn(i.xy.mul(t),i.z)}let n=null;return t===z?n=wc(i):t===O?n=xh.mul(i).normalize():(o(`NodeMaterial: Unsupported normal map type: ${t}`),n=Sc),n}}const Rh=an(Sh).setParameterLength(1,2),Eh=cn(({textureNode:e,bumpScale:t})=>{const r=t=>e.isolate().context({getUV:e=>t(e.uvNode||kl()),forceUVContext:!0}),s=yn(r(e=>e));return _n(yn(r(e=>e.add(e.dFdx()))).sub(s),yn(r(e=>e.add(e.dFdy()))).sub(s)).mul(t)}),Ah=cn(e=>{const{surf_pos:t,surf_norm:r,dHdxy:s}=e,i=t.dFdx().normalize(),n=r,a=t.dFdy().normalize().cross(n),o=n.cross(i),u=i.dot(a).mul(yc),l=u.sign().mul(s.x.mul(a).add(s.y.mul(o)));return u.abs().mul(r).sub(l).normalize()});class wh extends gi{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=Eh({textureNode:this.textureNode,bumpScale:e});return Ah({surf_pos:pc,surf_norm:Sc,dHdxy:t})}}const Ch=an(wh).setParameterLength(1,2),Mh=new Map;class Bh extends ci{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let r=Mh.get(e);return void 0===r&&(r=Kc(e,t),Mh.set(e,r)),r}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,r=this.scope;let s=null;if(r===Bh.COLOR){const e=void 0!==t.color?this.getColor(r):Rn();s=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(r===Bh.OPACITY){const e=this.getFloat(r);s=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(r===Bh.SPECULAR_STRENGTH)s=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:yn(1);else if(r===Bh.SPECULAR_INTENSITY){const e=this.getFloat(r);s=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(r).a):e}else if(r===Bh.SPECULAR_COLOR){const e=this.getColor(r);s=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(r).rgb):e}else if(r===Bh.ROUGHNESS){const e=this.getFloat(r);s=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(r).g):e}else if(r===Bh.METALNESS){const e=this.getFloat(r);s=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(r).b):e}else if(r===Bh.EMISSIVE){const e=this.getFloat("emissiveIntensity"),i=this.getColor(r).mul(e);s=t.emissiveMap&&!0===t.emissiveMap.isTexture?i.mul(this.getTexture(r)):i}else if(r===Bh.NORMAL)t.normalMap?(s=Rh(this.getTexture("normal"),this.getCache("normalScale","vec2")),s.normalMapType=t.normalMapType,t.normalMap.format!=$&&t.normalMap.format!=W&&t.normalMap.format!=H||(s.unpackNormalMode=k)):s=t.bumpMap?Ch(this.getTexture("bump").r,this.getFloat("bumpScale")):Sc;else if(r===Bh.CLEARCOAT){const e=this.getFloat(r);s=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_ROUGHNESS){const e=this.getFloat(r);s=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_NORMAL)s=t.clearcoatNormalMap?Rh(this.getTexture(r),this.getCache(r+"Scale","vec2")):Sc;else if(r===Bh.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));s=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(r===Bh.SHEEN_ROUGHNESS){const e=this.getFloat(r);s=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(r).a):e,s=s.clamp(1e-4,1)}else if(r===Bh.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(r);s=Fn(mp.x,mp.y,mp.y.negate(),mp.x).mul(e.rg.mul(2).sub(_n(1)).normalize().mul(e.b))}else s=mp;else if(r===Bh.IRIDESCENCE_THICKNESS){const e=qc("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=qc("0","float",t.iridescenceThicknessRange);s=e.sub(i).mul(this.getTexture(r).g).add(i)}else s=e}else if(r===Bh.TRANSMISSION){const e=this.getFloat(r);s=t.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===Bh.THICKNESS){const e=this.getFloat(r);s=t.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===Bh.IOR)s=this.getFloat(r);else if(r===Bh.LIGHT_MAP)s=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===Bh.AO)s=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(r===Bh.LINE_DASH_OFFSET)s=t.dashOffset?this.getFloat(r):yn(0);else{const t=this.getNodeType(e);s=this.getCache(r,t)}return s}}Bh.ALPHA_TEST="alphaTest",Bh.COLOR="color",Bh.OPACITY="opacity",Bh.SHININESS="shininess",Bh.SPECULAR="specular",Bh.SPECULAR_STRENGTH="specularStrength",Bh.SPECULAR_INTENSITY="specularIntensity",Bh.SPECULAR_COLOR="specularColor",Bh.REFLECTIVITY="reflectivity",Bh.ROUGHNESS="roughness",Bh.METALNESS="metalness",Bh.NORMAL="normal",Bh.CLEARCOAT="clearcoat",Bh.CLEARCOAT_ROUGHNESS="clearcoatRoughness",Bh.CLEARCOAT_NORMAL="clearcoatNormal",Bh.EMISSIVE="emissive",Bh.ROTATION="rotation",Bh.SHEEN="sheen",Bh.SHEEN_ROUGHNESS="sheenRoughness",Bh.ANISOTROPY="anisotropy",Bh.IRIDESCENCE="iridescence",Bh.IRIDESCENCE_IOR="iridescenceIOR",Bh.IRIDESCENCE_THICKNESS="iridescenceThickness",Bh.IOR="ior",Bh.TRANSMISSION="transmission",Bh.THICKNESS="thickness",Bh.ATTENUATION_DISTANCE="attenuationDistance",Bh.ATTENUATION_COLOR="attenuationColor",Bh.LINE_SCALE="scale",Bh.LINE_DASH_SIZE="dashSize",Bh.LINE_GAP_SIZE="gapSize",Bh.LINE_WIDTH="linewidth",Bh.LINE_DASH_OFFSET="dashOffset",Bh.POINT_SIZE="size",Bh.DISPERSION="dispersion",Bh.LIGHT_MAP="light",Bh.AO="ao";const Lh=on(Bh,Bh.ALPHA_TEST),Fh=on(Bh,Bh.COLOR),Ph=on(Bh,Bh.SHININESS),Dh=on(Bh,Bh.EMISSIVE),Uh=on(Bh,Bh.OPACITY),Ih=on(Bh,Bh.SPECULAR),Oh=on(Bh,Bh.SPECULAR_INTENSITY),Vh=on(Bh,Bh.SPECULAR_COLOR),kh=on(Bh,Bh.SPECULAR_STRENGTH),Gh=on(Bh,Bh.REFLECTIVITY),zh=on(Bh,Bh.ROUGHNESS),$h=on(Bh,Bh.METALNESS),Wh=on(Bh,Bh.NORMAL),Hh=on(Bh,Bh.CLEARCOAT),qh=on(Bh,Bh.CLEARCOAT_ROUGHNESS),jh=on(Bh,Bh.CLEARCOAT_NORMAL),Xh=on(Bh,Bh.ROTATION),Kh=on(Bh,Bh.SHEEN),Qh=on(Bh,Bh.SHEEN_ROUGHNESS),Yh=on(Bh,Bh.ANISOTROPY),Zh=on(Bh,Bh.IRIDESCENCE),Jh=on(Bh,Bh.IRIDESCENCE_IOR),ep=on(Bh,Bh.IRIDESCENCE_THICKNESS),tp=on(Bh,Bh.TRANSMISSION),rp=on(Bh,Bh.THICKNESS),sp=on(Bh,Bh.IOR),ip=on(Bh,Bh.ATTENUATION_DISTANCE),np=on(Bh,Bh.ATTENUATION_COLOR),ap=on(Bh,Bh.LINE_SCALE),op=on(Bh,Bh.LINE_DASH_SIZE),up=on(Bh,Bh.LINE_GAP_SIZE),lp=on(Bh,Bh.LINE_WIDTH),dp=on(Bh,Bh.LINE_DASH_OFFSET),cp=on(Bh,Bh.POINT_SIZE),hp=on(Bh,Bh.DISPERSION),pp=on(Bh,Bh.LIGHT_MAP),gp=on(Bh,Bh.AO),mp=Sa(new t).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),fp=cn(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class yp extends hi{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r;const s=e.context.assign;if(r=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===s||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}const bp=an(yp).setParameterLength(2);class xp extends Yl{static get type(){return"StorageBufferNode"}constructor(e,t=null,r=0){let s,i=null;t&&t.isStruct?(s="struct",i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(s=Ws(e.itemSize),r=e.count):s=t,super(e,s,r),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=ii.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(0===this.bufferCount){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return bp(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(ii.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=ul(this.value),this._varying=$u(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:r}=this.getAttributeData(),s=r.build(e);return e.registerTransform(s,t),s}}const Tp=(e,t=null,r=0)=>new xp(e,t,r);class _p extends ci{static get type(){return"InstanceNode"}constructor(e,t,r=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=r,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=ri.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}get isStorageColor(){const{instanceColor:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}setup(e){let{instanceMatrixNode:t,instanceColorNode:r}=this;null===t&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);const{instanceColor:s,isStorageColor:i}=this;if(s&&null===r){if(i)r=Tp(s,"vec3",Math.max(s.count,1)).element(pl);else{const e=new q(s.array,3),t=s.usage===x?dl:ll;this.bufferColor=e,r=Rn(t(e,"vec3",3,0))}this.instanceColorNode=r}const n=t.mul(lc).xyz;if(lc.assign(n),e.needsPreviousData()&&dc.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){const e=Ac(Tc,t);Tc.assign(e)}null!==this.instanceColorNode&&kn("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){null!==this.buffer&&!0!==this.isStorageMatrix&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&!0!==this.isStorageColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),null!==this.previousInstanceMatrixNode&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){const t=e.object;return null===this.previousInstanceMatrixNode&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(dc).xyz}_createInstanceMatrixNode(e,t){let r;const{instanceMatrix:s}=this,{count:i}=s;if(this.isStorageMatrix)r=Tp(s,"mat4",Math.max(i,1)).element(pl);else{if(16*i*4<=t.getUniformBufferLimit())r=Zl(s.array,"mat4",Math.max(i,1)).element(pl);else{const t=new j(s.array,16,1);!0===e&&(this.buffer=t);const i=s.usage===x?dl:ll,n=[i(t,"vec4",16,0),i(t,"vec4",16,4),i(t,"vec4",16,8),i(t,"vec4",16,12)];r=Dn(...n)}}return r}}const vp=an(_p).setParameterLength(2,3);class Np extends _p{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:r,instanceColor:s}=e;super(t,r,s),this.instancedMesh=e}}const Sp=an(Np).setParameterLength(1);class Rp extends ci{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=pl:this.batchingIdNode=yl);const t=cn(([e])=>{const t=bn(zl(Ql(this.batchMesh._indirectTexture),0).x).toConst(),r=bn(e).mod(t).toConst(),s=bn(e).div(t).toConst();return Ql(this.batchMesh._indirectTexture,vn(r,s)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),r=t(bn(this.batchingIdNode)),s=this.batchMesh._matricesTexture,i=bn(zl(Ql(s),0).x).toConst(),n=yn(r).mul(4).toInt().toConst(),a=n.mod(i).toConst(),o=n.div(i).toConst(),u=Dn(Ql(s,vn(a,o)),Ql(s,vn(a.add(1),o)),Ql(s,vn(a.add(2),o)),Ql(s,vn(a.add(3),o))),l=this.batchMesh._colorsTexture;if(null!==l){const e=cn(([e])=>{const t=bn(zl(Ql(l),0).x).toConst(),r=e,s=r.mod(t).toConst(),i=r.div(t).toConst();return Ql(l,vn(s,i)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),t=e(r);kn("vec3","vBatchColor").assign(t)}const d=Pn(u);lc.assign(u.mul(lc));const c=Tc.div(Rn(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),h=d.mul(c).xyz;Tc.assign(h),e.hasGeometryAttribute("tangent")&&ch.mulAssign(d)}}const Ep=an(Rp).setParameterLength(1),Ap=new WeakMap;class wp extends ci{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=ri.OBJECT,this.skinIndexNode=Vl("skinIndex","uvec4"),this.skinWeightNode=Vl("skinWeight","vec4"),this.bindMatrixNode=qc("bindMatrix","mat4"),this.bindMatrixInverseNode=qc("bindMatrixInverse","mat4"),this.boneMatricesNode=jc("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=lc,this.toPositionNode=lc,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:r,skinWeightNode:s,bindMatrixNode:i,bindMatrixInverseNode:n}=this,a=e.element(r.x),o=e.element(r.y),u=e.element(r.z),l=e.element(r.w),d=i.mul(t),c=Fa(a.mul(s.x).mul(d),o.mul(s.y).mul(d),u.mul(s.z).mul(d),l.mul(s.w).mul(d));return n.mul(c).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=Tc,r=ch){const{skinIndexNode:s,skinWeightNode:i,bindMatrixNode:n,bindMatrixInverseNode:a}=this,o=e.element(s.x),u=e.element(s.y),l=e.element(s.z),d=e.element(s.w);let c=Fa(i.x.mul(o),i.y.mul(u),i.z.mul(l),i.w.mul(d));c=a.mul(c).mul(n);return{skinNormal:c.transformDirection(t).xyz,skinTangent:c.transformDirection(r).xyz}}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=jc("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,dc)}setup(e){e.needsPreviousData()&&dc.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const{skinNormal:t,skinTangent:r}=this.getSkinnedNormalAndTangent();Tc.assign(t),e.hasGeometryAttribute("tangent")&&ch.assign(r)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;Ap.get(t)!==e.frameId&&(Ap.set(t,e.frameId),null!==this.previousBoneMatricesNode&&(null===t.previousBoneMatrices&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const Cp=e=>new wp(e);class Mp extends ci{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const r={};for(let e=0,t=this.params.length-1;eNumber(l)?">=":"<")),a)n=`while ( ${l} )`;else{const r={start:u,end:l},s=r.start,i=r.end;let a;const g=()=>h.includes("<")?"+=":"-=";if(null!=p)switch(typeof p){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=d+" "+g()+" "+e.generateConst(c,p);break;case"string":a=d+" "+p;break;default:p.isNode?a=d+" "+g()+" "+p.build(e):(o("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),a="break /* invalid update */")}else p="int"===c||"uint"===c?h.includes("<")?"++":"--":g()+" 1.",a=d+" "+p;n=`for ( ${e.getVar(c,d)+" = "+s}; ${d+" "+h+" "+i}; ${a} )`}e.addFlowCode((0===s?"\n":"")+e.tab+n+" {\n\n").addFlowTab()}const i=s.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+i);for(let t=0,r=this.params.length-1;tnew Mp(nn(e,"int")).toStack(),Lp=()=>Cl("break").toStack(),Fp=new WeakMap,Pp=new s,Dp=cn(({bufferMap:e,influence:t,stride:r,width:s,depth:i,offset:n})=>{const a=bn(hl).mul(r).add(n),o=a.div(s),u=a.sub(o.mul(s));return Ql(e,vn(u,o)).depth(i).xyz.mul(t)});class Up extends ci{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Sa(1),this.updateType=ri.OBJECT}setup(e){const{geometry:r}=e,s=void 0!==r.morphAttributes.position,i=r.hasAttribute("normal")&&void 0!==r.morphAttributes.normal,n=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,a=void 0!==n?n.length:0,{texture:o,stride:u,size:l}=function(e){const r=void 0!==e.morphAttributes.position,s=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,n=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=void 0!==n?n.length:0;let o=Fp.get(e);if(void 0===o||o.count!==a){void 0!==o&&o.texture.dispose();const u=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],d=e.morphAttributes.color||[];let c=0;!0===r&&(c=1),!0===s&&(c=2),!0===i&&(c=3);let h=e.attributes.position.count*c,p=1;const g=4096;h>g&&(p=Math.ceil(h/g),h=g);const m=new Float32Array(h*p*4*a),f=new X(m,h,p,a);f.type=K,f.needsUpdate=!0;const y=4*c;for(let x=0;x{const t=yn(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(Ql(this.mesh.morphTexture,vn(bn(e).add(1),bn(pl))).r):t.assign(qc("morphTargetInfluences","float").element(e).toVar()),gn(t.notEqual(0),()=>{!0===s&&lc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(0)})),!0===i&&Tc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const Ip=an(Up).setParameterLength(1);class Op extends ci{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Vp extends Op{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class kp extends wu{static get type(){return"LightingContextNode"}constructor(e,t=null,r=null,s=null){super(e),this.lightingModel=t,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,r={directDiffuse:Rn().toVar("directDiffuse"),directSpecular:Rn().toVar("directSpecular"),indirectDiffuse:Rn().toVar("indirectDiffuse"),indirectSpecular:Rn().toVar("indirectSpecular")};return{radiance:Rn().toVar("radiance"),irradiance:Rn().toVar("irradiance"),iblIrradiance:Rn().toVar("iblIrradiance"),ambientOcclusion:yn(1).toVar("ambientOcclusion"),reflectedLight:r,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Gp=an(kp);class zp extends Op{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const $p=new t;class Wp extends jl{static get type(){return"ViewportTextureNode"}constructor(e=ud,t=null,r=null){let s=null;null===r?(s=new Q,s.minFilter=Y,r=s):s=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=s,this.isOutputTextureNode=!0,this.updateBeforeType=ri.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),null===e)return t;if(!1===r.has(e)){const s=t.clone();r.set(e,s)}return r.get(e)}updateReference(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;return this.value=this.getTextureForReference(i),this.value}updateBefore(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;null===i?t.getDrawingBufferSize($p):i.getDrawingBufferSize?i.getDrawingBufferSize($p):$p.set(i.width,i.height);const n=this.getTextureForReference(i);n.image.width===$p.width&&n.image.height===$p.height||(n.image.width=$p.width,n.image.height=$p.height,n.needsUpdate=!0);const a=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=a}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Hp=an(Wp).setParameterLength(0,3),qp=an(Wp,null,null,{generateMipmaps:!0}).setParameterLength(0,3),jp=qp(),Xp=(e=ud,t=null)=>jp.sample(e,t);let Kp=null;class Qp extends Wp{static get type(){return"ViewportDepthTextureNode"}constructor(e=ud,t=null,r=null){null===r&&(null===Kp&&(Kp=new Z),r=Kp),super(e,t,r)}}const Yp=an(Qp).setParameterLength(0,3);class Zp extends ci{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Zp.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,r=this.valueNode;let s=null;if(t===Zp.DEPTH_BASE)null!==r&&(s=ng().assign(r));else if(t===Zp.DEPTH)s=e.isPerspectiveCamera?tg(pc.z,Bd,Ld):Jp(pc.z,Bd,Ld);else if(t===Zp.LINEAR_DEPTH)if(null!==r)if(e.isPerspectiveCamera){const e=sg(r,Bd,Ld);s=Jp(e,Bd,Ld)}else s=r;else s=Jp(pc.z,Bd,Ld);return s}}Zp.DEPTH_BASE="depthBase",Zp.DEPTH="depth",Zp.LINEAR_DEPTH="linearDepth";const Jp=(e,t,r)=>e.add(t).div(t.sub(r)),eg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),tg=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),rg=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),sg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),ig=(e,t,r)=>{t=t.max(1e-6).toVar();const s=To(e.negate().div(t)),i=To(r.div(t));return s.div(i)},ng=an(Zp,Zp.DEPTH_BASE),ag=on(Zp,Zp.DEPTH),og=an(Zp,Zp.LINEAR_DEPTH).setParameterLength(0,1),ug=og(Yp());ag.assign=e=>ng(e);class lg extends ci{static get type(){return"ClippingNode"}constructor(e=lg.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:r,unionPlanes:s}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===lg.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(r,s):this.scope===lg.HARDWARE?this.setupHardwareClipping(s,e):this.setupDefault(r,s)}setupAlphaToCoverage(e,t){return cn(()=>{const r=yn().toVar("distanceToPlane"),s=yn().toVar("distanceToGradient"),i=yn(1).toVar("clipOpacity"),n=t.length;if(!1===this.hardwareClipping&&n>0){const e=td(t).setGroup(_a);Bp(n,({i:t})=>{const n=e.element(t);r.assign(pc.dot(n.xyz).negate().add(n.w)),s.assign(r.fwidth().div(2)),i.mulAssign(bu(s.negate(),s,r))})}const a=e.length;if(a>0){const t=td(e).setGroup(_a),n=yn(1).toVar("intersectionClipOpacity");Bp(a,({i:e})=>{const i=t.element(e);r.assign(pc.dot(i.xyz).negate().add(i.w)),s.assign(r.fwidth().div(2)),n.mulAssign(bu(s.negate(),s,r).oneMinus())}),i.mulAssign(n.oneMinus())}Gn.a.mulAssign(i),Gn.a.equal(0).discard()})()}setupDefault(e,t){return cn(()=>{const r=t.length;if(!1===this.hardwareClipping&&r>0){const e=td(t).setGroup(_a);Bp(r,({i:t})=>{const r=e.element(t);pc.dot(r.xyz).greaterThan(r.w).discard()})}const s=e.length;if(s>0){const t=td(e).setGroup(_a),r=Tn(!0).toVar("clipped");Bp(s,({i:e})=>{const s=t.element(e);r.assign(pc.dot(s.xyz).greaterThan(s.w).and(r))}),r.discard()}})()}setupHardwareClipping(e,t){const r=e.length;return t.enableHardwareClipping(r),cn(()=>{const s=td(e).setGroup(_a),i=sd(t.getClipDistance());Bp(r,({i:e})=>{const t=s.element(e),r=pc.dot(t.xyz).sub(t.w).negate();i.element(e).assign(r)})})()}}lg.ALPHA_TO_COVERAGE="alphaToCoverage",lg.DEFAULT="default",lg.HARDWARE="hardware";const dg=cn(([e])=>Eo(Da(1e4,Ao(Da(17,e.x).add(Da(.1,e.y)))).mul(Fa(.1,Vo(Ao(Da(13,e.y).add(e.x))))))),cg=cn(([e])=>dg(_n(dg(e.xy),e.z))),hg=cn(([e])=>{const t=eu(Go(Wo(e.xyz)),Go(Ho(e.xyz))),r=yn(1).div(yn(.05).mul(t)).toVar("pixScale"),s=_n(bo(No(To(r))),bo(So(To(r)))),i=_n(cg(No(s.x.mul(e.xyz))),cg(No(s.y.mul(e.xyz)))),n=Eo(To(r)),a=Fa(Da(n.oneMinus(),i.x),Da(n,i.y)),o=Jo(n,n.oneMinus()),u=Rn(a.mul(a).div(Da(2,o).mul(Pa(1,o))),a.sub(Da(.5,o)).div(Pa(1,o)),Pa(1,Pa(1,a).mul(Pa(1,a)).div(Da(2,o).mul(Pa(1,o))))),l=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(u.x,u.y),u.z);return mu(l,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class pg extends Ol{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let r;return r=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new s(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const gg=(e=0)=>new pg(e),mg=cn(([e,t])=>Jo(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fg=cn(([e,t])=>Jo(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yg=cn(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bg=cn(([e,t])=>gu(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),tu(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xg=cn(([e,t])=>{const r=t.a.add(e.a.mul(t.a.oneMinus()));return Cn(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Tg=cn(([e])=>Cn(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),_g=cn(([e])=>(gn(e.a.equal(0),()=>Cn(0)),Cn(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class vg extends J{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;const r=this[t];r&&!0===r.isNode&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:r}of this._getNodeChildren())e.push(Vs(t.slice(0,-4)),r.getCacheKey());return this.type+ks(e)}build(e){this.setup(e)}setupObserver(e){return new Ds(e)}setup(e){e.context.setupNormal=()=>Gu(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,r=t.getRenderTarget();e.addStack();const s=this.setupVertex(e),i=Gu(this.vertexNode||s,"VERTEX");let n;e.context.clipSpace=i,e.stack.outputNode=i,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==r?!0===r.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const s=this.setupLighting(e);null!==a&&e.stack.addToStack(a);const i=Cn(s,Gn.a).max(0);n=this.setupOutput(e,i),oa.assign(n);const o=null!==this.outputNode;if(o&&(n=this.outputNode),e.context.getOutput&&(n=e.context.getOutput(n,e)),null!==r){const e=t.getMRT(),r=this.mrtNode;null!==e?(o&&oa.assign(n),n=e,null!==r&&(n=e.merge(r))):null!==r&&(n=r)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Cn(t)),n=this.setupOutput(e,t)}e.stack.outputNode=n,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:r}=e.clippingContext;let s=null;if(t.length>0||r.length>0){const t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?s=new lg(lg.ALPHA_TO_COVERAGE):e.stack.addToStack(new lg)}return s}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(new lg(lg.HARDWARE)),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:r}=e;let s=this.depthNode;if(null===s){const e=t.getMRT();e&&e.has("depth")?s=e.get("depth"):!0===t.logarithmicDepthBuffer&&(s=r.isPerspectiveCamera?ig(pc.z,Bd,Ld):Jp(pc.z,Bd,Ld))}null!==s&&ag.assign(s).toStack()}setupPositionView(){return sc.mul(lc).xyz}setupModelViewProjection(){return Fd.mul(pc)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),fp}setupPosition(e){const{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&Ip(t).toStack(),!0===t.isSkinnedMesh&&Cp(t).toStack(),this.displacementMap){const e=Kc("displacementMap","texture"),t=Kc("displacementScale","float"),r=Kc("displacementBias","float");lc.addAssign(Tc.normalize().mul(e.x.mul(t).add(r)))}return t.isBatchedMesh&&Ep(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&Sp(t).toStack(),null!==this.positionNode&&lc.assign(Gu(this.positionNode,"POSITION","vec3")),lc}setupDiffuseColor(e){const{object:t,geometry:r}=e;null!==this.maskNode&&Tn(this.maskNode).not().discard();let s=this.colorNode?Cn(this.colorNode):Fh;if(!0===this.vertexColors&&r.hasAttribute("color")&&(s=s.mul(gg())),t.instanceColor){s=kn("vec3","vInstanceColor").mul(s)}if(t.isBatchedMesh&&t._colorsTexture){s=kn("vec3","vBatchColor").mul(s)}Gn.assign(s);const i=this.opacityNode?yn(this.opacityNode):Uh;Gn.a.assign(Gn.a.mul(i));let n=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(n=null!==this.alphaTestNode?yn(this.alphaTestNode):Lh,!0===this.alphaToCoverage?(Gn.a=bu(n,n.add(Ko(Gn.a)),Gn.a),Gn.a.lessThanEqual(0).discard()):Gn.a.lessThanEqual(n).discard()),!0===this.alphaHash&&Gn.a.lessThan(hg(lc)).discard(),e.isOpaque()&&Gn.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?Rn(0):Gn.rgb}setupNormal(){return this.normalNode?Rn(this.normalNode):Wh}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Kc("envMap","cubeTexture"):Kc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new zp(pp)),t}setupLights(e){const t=[],r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);const s=this.setupLightMap(e);s&&s.isLightingNode&&t.push(s);let i=this.aoNode;null===i&&e.material.aoMap&&(i=gp),e.context.getAO&&(i=e.context.getAO(i,e)),i&&t.push(new Vp(i));let n=this.lightsNode||e.lightsNode;return t.length>0&&(n=e.renderer.lighting.createNode([...n.getLights(),...t])),n}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:r,backdropAlphaNode:s,emissiveNode:i}=this,n=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(n&&n.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=Gp(n,t,r,s)}else null!==r&&(a=Rn(null!==s?gu(a,r,s):r));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&($n.assign(Rn(i||Dh)),a=a.add($n)),a}setupFog(e,t){const r=e.fogNode;return r&&(oa.assign(t),t=Cn(r.toVar())),t}setupPremultipliedAlpha(e,t){return Tg(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const t in e){const r=e[t];void 0===this[t]&&(this[t]=r,r&&r.clone&&(this[t]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const r=J.prototype.toJSON.call(this,e);r.inputNodes={};for(const{property:t,childNode:s}of this._getNodeChildren())r.inputNodes[t]=s.toJSON(e).uuid;function s(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(t){const t=s(e.textures),i=s(e.images),n=s(e.nodes);t.length>0&&(r.textures=t),i.length>0&&(r.images=i),n.length>0&&(r.nodes=n)}return r}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const Ng=new ee;class Sg extends vg{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Ng),this.setValues(e)}}const Rg=new te;class Eg extends vg{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Rg),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?yn(this.offsetNode):dp,t=this.dashScaleNode?yn(this.dashScaleNode):ap,r=this.dashSizeNode?yn(this.dashSizeNode):op,s=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(r),la.assign(s);const i=$u(Vl("lineDistance").mul(t));(e?i.add(e):i).mod(ua.add(la)).greaterThan(ua).discard()}}const Ag=new te;class wg extends vg{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(Ag),this.vertexColors=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=re,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,r=this._useAlphaToCoverage,s=this.vertexColors,i=this._useDash,n=this._useWorldUnits,a=cn(({start:e,end:t})=>{const r=Fd.element(2).element(2),s=Fd.element(3).element(2).mul(-.5).div(r).sub(e.z).div(t.z.sub(e.z));return Cn(gu(e.xyz,t.xyz,s),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=cn(()=>{const e=Vl("instanceStart"),t=Vl("instanceEnd"),r=Cn(sc.mul(Cn(e,1))).toVar("start"),s=Cn(sc.mul(Cn(t,1))).toVar("end");if(i){const e=this.dashScaleNode?yn(this.dashScaleNode):ap,t=this.offsetNode?yn(this.offsetNode):dp,r=Vl("instanceDistanceStart"),s=Vl("instanceDistanceEnd");let i=uc.y.lessThan(.5).select(e.mul(r),e.mul(s));i=i.add(t),kn("float","lineDistance").assign(i)}n&&(kn("vec3","worldStart").assign(r.xyz),kn("vec3","worldEnd").assign(s.xyz));const o=cd.z.div(cd.w),u=Fd.element(2).element(3).equal(-1);gn(u,()=>{gn(r.z.lessThan(0).and(s.z.greaterThan(0)),()=>{s.assign(a({start:r,end:s}))}).ElseIf(s.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{r.assign(a({start:s,end:r}))})});const l=Fd.mul(r),d=Fd.mul(s),c=l.xyz.div(l.w),h=d.xyz.div(d.w),p=h.xy.sub(c.xy).toVar();p.x.assign(p.x.mul(o)),p.assign(p.normalize());const g=Cn().toVar();if(n){const e=s.xyz.sub(r.xyz).normalize(),t=gu(r.xyz,s.xyz,.5).normalize(),n=e.cross(t).normalize(),a=e.cross(n),o=kn("vec4","worldPos");o.assign(uc.y.lessThan(.5).select(r,s));const u=lp.mul(.5);o.addAssign(Cn(uc.x.lessThan(0).select(n.mul(u),n.mul(u).negate()),0)),i||(o.addAssign(Cn(uc.y.lessThan(.5).select(e.mul(u).negate(),e.mul(u)),0)),o.addAssign(Cn(a.mul(u),0)),gn(uc.y.greaterThan(1).or(uc.y.lessThan(0)),()=>{o.subAssign(Cn(a.mul(2).mul(u),0))})),g.assign(Fd.mul(o));const l=Rn().toVar();l.assign(uc.y.lessThan(.5).select(c,h)),g.z.assign(l.z.mul(g.w))}else{const e=_n(p.y,p.x.negate()).toVar("offset");p.x.assign(p.x.div(o)),e.x.assign(e.x.div(o)),e.assign(uc.x.lessThan(0).select(e.negate(),e)),gn(uc.y.lessThan(0),()=>{e.assign(e.sub(p))}).ElseIf(uc.y.greaterThan(1),()=>{e.assign(e.add(p))}),e.assign(e.mul(lp)),e.assign(e.div(cd.w.div(od))),g.assign(uc.y.lessThan(.5).select(l,d)),e.assign(e.mul(g.w)),g.assign(g.add(Cn(e,0,0)))}return g})();const o=cn(({p1:e,p2:t,p3:r,p4:s})=>{const i=e.sub(r),n=s.sub(r),a=t.sub(e),o=i.dot(n),u=n.dot(a),l=i.dot(a),d=n.dot(n),c=a.dot(a).mul(d).sub(u.mul(u)),h=o.mul(u).sub(l.mul(d)).div(c).clamp(),p=o.add(u.mul(h)).div(d).clamp();return _n(h,p)});if(this.colorNode=cn(()=>{const e=kl();if(i){const t=this.dashSizeNode?yn(this.dashSizeNode):op,r=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(t),la.assign(r);const s=kn("float","lineDistance");e.y.lessThan(-1).or(e.y.greaterThan(1)).discard(),s.mod(ua.add(la)).greaterThan(ua).discard()}const a=yn(1).toVar("alpha");if(n){const e=kn("vec3","worldStart"),s=kn("vec3","worldEnd"),n=kn("vec4","worldPos").xyz.normalize().mul(1e5),u=s.sub(e),l=o({p1:e,p2:s,p3:Rn(0,0,0),p4:n}),d=e.add(u.mul(l.x)),c=n.mul(l.y),h=d.sub(c).length().div(lp);if(!i)if(r&&t.currentSamples>0){const e=h.fwidth();a.assign(bu(e.negate().add(.5),e.add(.5),h).oneMinus())}else h.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1)),s=t.mul(t).add(r.mul(r)),i=yn(s.fwidth()).toVar("dlen");gn(e.y.abs().greaterThan(1),()=>{a.assign(bu(i.oneMinus(),i.add(1),s).oneMinus())})}else gn(e.y.abs().greaterThan(1),()=>{const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1));t.mul(t).add(r.mul(r)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(s){const e=Vl("instanceColorStart"),t=Vl("instanceColorEnd");u=uc.y.lessThan(.5).select(e,t).mul(Fh)}else u=Fh;return Cn(u,a)})(),this.transparent){const e=this.opacityNode?yn(this.opacityNode):Uh;this.outputNode=Cn(this.colorNode.rgb.mul(e).add(Xp().rgb.mul(e.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}copy(e){return super.copy(e),this.vertexColors=e.vertexColors,this.dashOffset=e.dashOffset,this.lineColorNode=e.lineColorNode,this.offsetNode=e.offsetNode,this.dashScaleNode=e.dashScaleNode,this.dashSizeNode=e.dashSizeNode,this.gapSizeNode=e.gapSizeNode,this._useDash=e._useDash,this._useAlphaToCoverage=e._useAlphaToCoverage,this._useWorldUnits=e._useWorldUnits,this}}const Cg=new se;class Mg extends vg{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Cg),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?yn(this.opacityNode):Uh;Gn.assign(Qu(Cn(vh(Sc),e),ie))}}const Bg=cn(([e=hc])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),r=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return _n(t,r)});class Lg extends ne{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new D(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const r=t.minFilter,s=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i=new ae(5,5,5),n=Bg(hc),a=new vg;a.colorNode=Kl(t,n,0),a.side=F,a.blending=re;const o=new oe(i,a),u=new ue;u.add(o),t.minFilter===Y&&(t.minFilter=le);const l=new de(1,10,this),d=e.getMRT();return e.setMRT(null),l.update(e,u),e.setMRT(d),t.minFilter=r,t.generateMipmaps=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,s=!0){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,r,s);e.setRenderTarget(i)}}const Fg=new WeakMap;class Pg extends gi{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=$c(null);const t=new D;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=ri.RENDER}updateBefore(e){const{renderer:t,material:r}=e,s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const e=s.isTextureNode?s.value:r[s.property];if(e&&e.isTexture){const r=e.mapping;if(r===ce||r===he){if(Fg.has(e)){const t=Fg.get(e);Ug(t,e.mapping),this._cubeTexture=t}else{const r=e.image;if(function(e){return null!=e&&e.height>0}(r)){const s=new Lg(r.height);s.fromEquirectangularTexture(t,e),Ug(s.texture,e.mapping),this._cubeTexture=s.texture,Fg.set(e,s.texture),e.addEventListener("dispose",Dg)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function Dg(e){const t=e.target;t.removeEventListener("dispose",Dg);const r=Fg.get(t);void 0!==r&&(Fg.delete(t),r.dispose())}function Ug(e,t){t===ce?e.mapping=U:t===he&&(e.mapping=I)}const Ig=an(Pg).setParameterLength(1);class Og extends Op{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Ig(this.envNode)}}class Vg extends Op{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=yn(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class kg{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Gg extends kg{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,r=e.reflectedLight,s=e.irradianceLightMap;r.indirectDiffuse.assign(Cn(0)),s?r.indirectDiffuse.addAssign(s):r.indirectDiffuse.addAssign(Cn(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(Gn.rgb)}finish(e){const{material:t,context:r}=e,s=r.outgoingLight,i=e.context.environment;if(i)switch(t.combine){case me:s.rgb.assign(gu(s.rgb,s.rgb.mul(i.rgb),kh.mul(Gh)));break;case ge:s.rgb.assign(gu(s.rgb,i.rgb,kh.mul(Gh)));break;case pe:s.rgb.addAssign(i.rgb.mul(kh.mul(Gh)));break;default:d("BasicLightingModel: Unsupported .combine value:",t.combine)}}}const zg=new fe;class $g extends vg{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(zg),this.setValues(e)}setupNormal(){return bc(vc)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Vg(pp)),t}setupOutgoingLight(){return Gn.rgb}setupLightingModel(){return new Gg}}const Wg=cn(({f0:e,f90:t,dotVH:r})=>{const s=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(s.oneMinus()).add(t.mul(s))}),Hg=cn(e=>e.diffuseColor.mul(1/Math.PI)),qg=cn(({dotNH:e})=>aa.mul(yn(.5)).add(1).mul(yn(1/Math.PI)).mul(e.pow(aa))),jg=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(t).clamp(),s=gc.dot(t).clamp(),i=Wg({f0:sa,f90:1,dotVH:s}),n=yn(.25),a=qg({dotNH:r});return i.mul(n).mul(a)});class Xg extends Gg{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t);r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:Gn.rgb}))),!0===this.specular&&r.directSpecular.addAssign(s.mul(jg({lightDirection:e})).mul(kh))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Kg=new ye;class Qg extends vg{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Kg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg(!1)}}const Yg=new be;class Zg extends vg{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Yg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg}setupVariants(){const e=(this.shininessNode?yn(this.shininessNode):Ph).max(1e-4);aa.assign(e);const t=this.specularNode||Ih;sa.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const Jg=cn(e=>{if(!1===e.geometry.hasAttribute("normal"))return yn(0);const t=vc.dFdx().abs().max(vc.dFdy().abs());return t.x.max(t.y).max(t.z)}),em=cn(e=>{const{roughness:t}=e,r=Jg();let s=t.max(.0525);return s=s.add(r),s=s.min(1),s}),tm=cn(({alpha:e,dotNL:t,dotNV:r})=>{const s=e.pow2(),i=t.mul(s.add(s.oneMinus().mul(r.pow2())).sqrt()),n=r.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt());return Ua(.5,i.add(n).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),rm=cn(({alphaT:e,alphaB:t,dotTV:r,dotBV:s,dotTL:i,dotBL:n,dotNV:a,dotNL:o})=>{const u=o.mul(Rn(e.mul(r),t.mul(s),a).length()),l=a.mul(Rn(e.mul(i),t.mul(n),o).length());return Ua(.5,u.add(l).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),sm=cn(({alpha:e,dotNH:t})=>{const r=e.pow2(),s=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),im=yn(1/Math.PI),nm=cn(({alphaT:e,alphaB:t,dotNH:r,dotTH:s,dotBH:i})=>{const n=e.mul(t),a=Rn(t.mul(s),e.mul(i),n.mul(r)),o=a.dot(a),u=n.div(o);return im.mul(n.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),am=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,normalView:n=Sc,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const u=s.pow2(),l=e.add(gc).normalize(),d=n.dot(e).clamp(),c=n.dot(gc).clamp(),h=n.dot(l).clamp(),p=gc.dot(l).clamp();let g,m,f=Wg({f0:t,f90:r,dotVH:p});if(Zi(a)&&(f=Qn.mix(f,i)),Zi(o)){const t=ta.dot(e),r=ta.dot(gc),s=ta.dot(l),i=ra.dot(e),n=ra.dot(gc),a=ra.dot(l);g=rm({alphaT:Jn,alphaB:u,dotTV:r,dotBV:n,dotTL:t,dotBL:i,dotNV:c,dotNL:d}),m=nm({alphaT:Jn,alphaB:u,dotNH:h,dotTH:s,dotBH:a})}else g=tm({alpha:u,dotNL:d,dotNV:c}),m=sm({alpha:u,dotNH:h});return f.mul(g).mul(m)}),om=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let um=null;const lm=cn(({roughness:e,dotNV:t})=>{null===um&&(um=new xe(om,16,16,$,Te),um.name="DFG_LUT",um.minFilter=le,um.magFilter=le,um.wrapS=_e,um.wrapT=_e,um.generateMipmaps=!1,um.needsUpdate=!0);const r=_n(e,t);return Kl(um,r).rg}),dm=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a})=>{const o=am({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a}),u=Sc.dot(e).clamp(),l=Sc.dot(gc).clamp(),d=lm({roughness:s,dotNV:l}),c=lm({roughness:s,dotNV:u}),h=t.mul(d.x).add(r.mul(d.y)),p=t.mul(c.x).add(r.mul(c.y)),g=d.x.add(d.y),m=c.x.add(c.y),f=yn(1).sub(g),y=yn(1).sub(m),b=t.add(t.oneMinus().mul(.047619)),x=h.mul(p).mul(b).div(yn(1).sub(f.mul(y).mul(b).mul(b)).add(ao)),T=f.mul(y),_=x.mul(T);return o.add(_)}),cm=cn(e=>{const{dotNV:t,specularColor:r,specularF90:s,roughness:i}=e,n=lm({dotNV:t,roughness:i});return r.mul(n.x).add(s.mul(n.y))}),hm=cn(({f:e,f90:t,dotVH:r})=>{const s=r.oneMinus().saturate(),i=s.mul(s),n=s.mul(i,i).clamp(0,.9999);return e.sub(Rn(t).mul(n)).div(n.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pm=cn(({roughness:e,dotNH:t})=>{const r=e.pow2(),s=yn(1).div(r),i=t.pow2().oneMinus().max(.0078125);return yn(2).add(s).mul(i.pow(s.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),gm=cn(({dotNV:e,dotNL:t})=>yn(1).div(yn(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),mm=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(e).clamp(),s=Sc.dot(gc).clamp(),i=Sc.dot(t).clamp(),n=pm({roughness:Kn,dotNH:i}),a=gm({dotNV:s,dotNL:r});return Xn.mul(n).mul(a)}),fm=cn(({N:e,V:t,roughness:r})=>{const s=e.dot(t).saturate(),i=_n(r,s.oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),ym=cn(({f:e})=>{const t=e.length();return eu(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),bm=cn(({v1:e,v2:t})=>{const r=e.dot(t),s=r.abs().toVar(),i=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),n=s.add(4.1616724).mul(s).add(3.417594).toVar(),a=i.div(n),o=r.greaterThan(0).select(a,eu(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),xm=cn(({N:e,V:t,P:r,mInv:s,p0:i,p1:n,p2:a,p3:o})=>{const u=n.sub(i).toVar(),l=o.sub(i).toVar(),d=u.cross(l),c=Rn().toVar();return gn(d.dot(r.sub(i)).greaterThanEqual(0),()=>{const u=t.sub(e.mul(t.dot(e))).normalize(),l=e.cross(u).negate(),d=s.mul(Pn(u,l,e).transpose()).toVar(),h=d.mul(i.sub(r)).normalize().toVar(),p=d.mul(n.sub(r)).normalize().toVar(),g=d.mul(a.sub(r)).normalize().toVar(),m=d.mul(o.sub(r)).normalize().toVar(),f=Rn(0).toVar();f.addAssign(bm({v1:h,v2:p})),f.addAssign(bm({v1:p,v2:g})),f.addAssign(bm({v1:g,v2:m})),f.addAssign(bm({v1:m,v2:h})),c.assign(Rn(ym({f:f})))}),c}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Tm=cn(({P:e,p0:t,p1:r,p2:s,p3:i})=>{const n=r.sub(t).toVar(),a=i.sub(t).toVar(),o=n.cross(a),u=Rn().toVar();return gn(o.dot(e.sub(t)).greaterThanEqual(0),()=>{const n=t.sub(e).normalize().toVar(),a=r.sub(e).normalize().toVar(),o=s.sub(e).normalize().toVar(),l=i.sub(e).normalize().toVar(),d=Rn(0).toVar();d.addAssign(bm({v1:n,v2:a})),d.addAssign(bm({v1:a,v2:o})),d.addAssign(bm({v1:o,v2:l})),d.addAssign(bm({v1:l,v2:n})),u.assign(Rn(ym({f:d.abs()})))}),u}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),_m=1/6,vm=e=>Da(_m,Da(e,Da(e,e.negate().add(3)).sub(3)).add(1)),Nm=e=>Da(_m,Da(e,Da(e,Da(3,e).sub(6))).add(4)),Sm=e=>Da(_m,Da(e,Da(e,Da(-3,e).add(3)).add(3)).add(1)),Rm=e=>Da(_m,ou(e,3)),Em=e=>vm(e).add(Nm(e)),Am=e=>Sm(e).add(Rm(e)),wm=e=>Fa(-1,Nm(e).div(vm(e).add(Nm(e)))),Cm=e=>Fa(1,Rm(e).div(Sm(e).add(Rm(e)))),Mm=(e,t,r)=>{const s=e.uvNode,i=Da(s,t.zw).add(.5),n=No(i),a=Eo(i),o=Em(a.x),u=Am(a.x),l=wm(a.x),d=Cm(a.x),c=wm(a.y),h=Cm(a.y),p=_n(n.x.add(l),n.y.add(c)).sub(.5).mul(t.xy),g=_n(n.x.add(d),n.y.add(c)).sub(.5).mul(t.xy),m=_n(n.x.add(l),n.y.add(h)).sub(.5).mul(t.xy),f=_n(n.x.add(d),n.y.add(h)).sub(.5).mul(t.xy),y=Em(a.y).mul(Fa(o.mul(e.sample(p).level(r)),u.mul(e.sample(g).level(r)))),b=Am(a.y).mul(Fa(o.mul(e.sample(m).level(r)),u.mul(e.sample(f).level(r))));return y.add(b)},Bm=cn(([e,t])=>{const r=_n(e.size(bn(t))),s=_n(e.size(bn(t.add(1)))),i=Ua(1,r),n=Ua(1,s),a=Mm(e,Cn(i,r),No(t)),o=Mm(e,Cn(n,s),So(t));return Eo(t).mix(a,o)}),Lm=cn(([e,t])=>{const r=t.mul(Wl(e));return Bm(e,r)}),Fm=cn(([e,t,r,s,i])=>{const n=Rn(yu(t.negate(),Ro(e),Ua(1,s))),a=Rn(Go(i[0].xyz),Go(i[1].xyz),Go(i[2].xyz));return Ro(n).mul(r.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Pm=cn(([e,t])=>e.mul(mu(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Dm=qp(),Um=Xp(),Im=cn(([e,t,r],{material:s})=>{const i=(s.side===F?Dm:Um).sample(e),n=To(ld.x).mul(Pm(t,r));return Bm(i,n)}),Om=cn(([e,t,r])=>(gn(r.notEqual(0),()=>{const s=xo(t).negate().div(r);return yo(s.negate().mul(e))}),Rn(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Vm=cn(([e,t,r,s,i,n,a,o,u,l,d,c,h,p,g])=>{let m,f;if(g){m=Cn().toVar(),f=Rn().toVar();const i=d.sub(1).mul(g.mul(.025)),n=Rn(d.sub(i),d,d.add(i));Bp({start:0,end:3},({i:i})=>{const d=n.element(i),g=Fm(e,t,c,d,o),y=a.add(g),b=l.mul(u.mul(Cn(y,1))),x=_n(b.xy.div(b.w)).toVar();x.addAssign(1),x.divAssign(2),x.assign(_n(x.x,x.y.oneMinus()));const T=Im(x,r,d);m.element(i).assign(T.element(i)),m.a.addAssign(T.a),f.element(i).assign(s.element(i).mul(Om(Go(g),h,p).element(i)))}),m.a.divAssign(3)}else{const i=Fm(e,t,c,d,o),n=a.add(i),g=l.mul(u.mul(Cn(n,1))),y=_n(g.xy.div(g.w)).toVar();y.addAssign(1),y.divAssign(2),y.assign(_n(y.x,y.y.oneMinus())),m=Im(y,r,d),f=s.mul(Om(Go(i),h,p))}const y=f.rgb.mul(m.rgb),b=e.dot(t).clamp(),x=Rn(cm({dotNV:b,specularColor:i,specularF90:n,roughness:r})),T=f.r.add(f.g,f.b).div(3);return Cn(x.oneMinus().mul(y),m.a.oneMinus().mul(T).oneMinus())}),km=Pn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Gm=(e,t)=>e.sub(t).div(e.add(t)).pow2(),zm=cn(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:s,baseF0:i})=>{const n=gu(e,t,bu(0,.03,s)),a=e.div(n).pow2().mul(r.pow2().oneMinus()).oneMinus();gn(a.lessThan(0),()=>Rn(1));const o=a.sqrt(),u=Gm(n,e),l=Wg({f0:u,f90:1,dotVH:r}),d=l.oneMinus(),c=n.lessThan(e).select(Math.PI,0),h=yn(Math.PI).sub(c),p=(e=>{const t=e.sqrt();return Rn(1).add(t).div(Rn(1).sub(t))})(i.clamp(0,.9999)),g=Gm(p,n.toVec3()),m=Wg({f0:g,f90:1,dotVH:o}),f=Rn(p.x.lessThan(n).select(Math.PI,0),p.y.lessThan(n).select(Math.PI,0),p.z.lessThan(n).select(Math.PI,0)),y=n.mul(s,o,2),b=Rn(h).add(f),x=l.mul(m).clamp(1e-5,.9999),T=x.sqrt(),_=d.pow2().mul(m).div(Rn(1).sub(x)),v=l.add(_).toVar(),N=_.sub(d).toVar();return Bp({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{N.mulAssign(T);const t=((e,t)=>{const r=e.mul(2*Math.PI*1e-9),s=Rn(54856e-17,44201e-17,52481e-17),i=Rn(1681e3,1795300,2208400),n=Rn(43278e5,93046e5,66121e5),a=yn(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(r.mul(2239900).add(t.x).cos()).mul(r.pow2().mul(-45282e5).exp());let o=s.mul(n.mul(2*Math.PI).sqrt()).mul(i.mul(r).add(t).cos()).mul(r.pow2().negate().mul(n).exp());return o=Rn(o.x.add(a),o.y,o.z).div(1.0685e-7),km.mul(o)})(yn(e).mul(y),yn(e).mul(b)).mul(2);v.addAssign(N.mul(t))}),v.max(Rn(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),$m=cn(({normal:e,viewDir:t,roughness:r})=>{const s=e.dot(t).saturate(),i=r.mul(r),n=r.add(.1).reciprocal(),a=yn(-1.9362).add(r.mul(1.0678)).add(i.mul(.4573)).sub(n.mul(.8469)),o=yn(-.6014).add(r.mul(.5538)).sub(i.mul(.467)).sub(n.mul(.1255));return a.mul(s).add(o).exp().saturate()}),Wm=Rn(.04),Hm=yn(1);class qm extends kg{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=s,this.transmission=i,this.dispersion=n,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=Rn().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Rn().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Rn().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=Rn().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Rn().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=Sc.dot(gc).clamp(),t=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:sa}),r=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:Gn.rgb});this.iridescenceFresnel=gu(t,r,Hn),this.iridescenceF0Dielectric=hm({f:t,f90:1,dotVH:e}),this.iridescenceF0Metallic=hm({f:r,f90:1,dotVH:e}),this.iridescenceF0=gu(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hn)}if(!0===this.transmission){const t=cc,r=Od.sub(cc).normalize(),s=Rc,i=e.context;i.backdrop=Vm(s,r,Wn,zn,ia,na,t,Qd,Dd,Fd,ca,pa,ma,ga,this.dispersion?fa:null),i.backdropAlpha=ha,Gn.a.mulAssign(gu(1,i.backdrop.a,ha))}super.start(e)}computeMultiscattering(e,t,r,s,i=null){const n=Sc.dot(gc).clamp(),a=lm({roughness:Wn,dotNV:n}),o=i?Qn.mix(s,i):s,u=o.mul(a.x).add(r.mul(a.y)),l=a.x.add(a.y).oneMinus(),d=o.add(o.oneMinus().mul(.047619)),c=u.mul(d).div(l.mul(d).oneMinus());e.addAssign(u),t.addAssign(c.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t).toVar();if(!0===this.sheen){this.sheenSpecularDirect.addAssign(s.mul(mm({lightDirection:e})));const t=$m({normal:Sc,viewDir:gc,roughness:Kn}),r=$m({normal:Sc,viewDir:e,roughness:Kn}),i=Xn.r.max(Xn.g).max(Xn.b).mul(t.max(r)).oneMinus();s.mulAssign(i)}if(!0===this.clearcoat){const r=Ec.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(r.mul(am({lightDirection:e,f0:Wm,f90:Hm,roughness:jn,normalView:Ec})))}r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:zn}))),r.directSpecular.addAssign(s.mul(dm({lightDirection:e,f0:ia,f90:1,roughness:Wn,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s,reflectedLight:i,ltc_1:n,ltc_2:a}){const o=t.add(r).sub(s),u=t.sub(r).sub(s),l=t.sub(r).add(s),d=t.add(r).add(s),c=Sc,h=gc,p=pc.toVar(),g=fm({N:c,V:h,roughness:Wn}),m=n.sample(g).toVar(),f=a.sample(g).toVar(),y=Pn(Rn(m.x,0,m.y),Rn(0,1,0),Rn(m.z,0,m.w)).toVar(),b=ia.mul(f.x).add(na.sub(ia).mul(f.y)).toVar();if(i.directSpecular.addAssign(e.mul(b).mul(xm({N:c,V:h,P:p,mInv:y,p0:o,p1:u,p2:l,p3:d}))),i.directDiffuse.addAssign(e.mul(zn).mul(xm({N:c,V:h,P:p,mInv:Pn(1,0,0,0,1,0,0,0,1),p0:o,p1:u,p2:l,p3:d}))),!0===this.clearcoat){const t=Ec,r=fm({N:t,V:h,roughness:jn}),s=n.sample(r),i=a.sample(r),c=Pn(Rn(s.x,0,s.y),Rn(0,1,0),Rn(s.z,0,s.w)),g=Wm.mul(i.x).add(Hm.sub(Wm).mul(i.y));this.clearcoatSpecularDirect.addAssign(e.mul(g).mul(xm({N:t,V:h,P:p,mInv:c,p0:o,p1:u,p2:l,p3:d})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:r}=e.context,s=t.mul(Hg({diffuseColor:zn})).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();s.mulAssign(t)}r.indirectDiffuse.addAssign(s)}indirectSpecular(e){const{radiance:t,iblIrradiance:r,reflectedLight:s}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(r.mul(Xn,$m({normal:Sc,viewDir:gc,roughness:Kn}))),!0===this.clearcoat){const e=Ec.dot(gc).clamp(),t=cm({dotNV:e,specularColor:Wm,specularF90:Hm,roughness:jn});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=Rn().toVar("singleScatteringDielectric"),n=Rn().toVar("multiScatteringDielectric"),a=Rn().toVar("singleScatteringMetallic"),o=Rn().toVar("multiScatteringMetallic");this.computeMultiscattering(i,n,na,sa,this.iridescenceF0Dielectric),this.computeMultiscattering(a,o,na,Gn.rgb,this.iridescenceF0Metallic);const u=gu(i,a,Hn),l=gu(n,o,Hn),d=i.add(n),c=zn.mul(d.oneMinus()),h=r.mul(1/Math.PI),p=t.mul(u).add(l.mul(h)).toVar(),g=c.mul(h).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();p.mulAssign(t),g.mulAssign(t)}s.indirectSpecular.addAssign(p),s.indirectDiffuse.addAssign(g)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:r}=e.context,s=Sc.dot(gc).clamp().add(t),i=Wn.mul(-16).oneMinus().negate().exp2(),n=t.sub(s.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(n)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=Ec.dot(gc).clamp(),r=Wg({dotVH:e,f0:Wm,f90:Hm}),s=t.mul(qn.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(qn));t.assign(s)}if(!0===this.sheen){const e=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(e)}}}const jm=yn(1),Xm=yn(-2),Km=yn(.8),Qm=yn(-1),Ym=yn(.4),Zm=yn(2),Jm=yn(.305),ef=yn(3),tf=yn(.21),rf=yn(4),sf=yn(4),nf=yn(16),af=cn(([e])=>{const t=Rn(Vo(e)).toVar(),r=yn(-1).toVar();return gn(t.x.greaterThan(t.z),()=>{gn(t.x.greaterThan(t.y),()=>{r.assign(Au(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}).Else(()=>{gn(t.z.greaterThan(t.y),()=>{r.assign(Au(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),of=cn(([e,t])=>{const r=_n().toVar();return gn(t.equal(0),()=>{r.assign(_n(e.z,e.y).div(Vo(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(_n(e.x.negate(),e.z.negate()).div(Vo(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(_n(e.x.negate(),e.y).div(Vo(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(_n(e.z.negate(),e.y).div(Vo(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(_n(e.x.negate(),e.z).div(Vo(e.y)))}).Else(()=>{r.assign(_n(e.x,e.y).div(Vo(e.z)))}),Da(.5,r.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),uf=cn(([e])=>{const t=yn(0).toVar();return gn(e.greaterThanEqual(Km),()=>{t.assign(jm.sub(e).mul(Qm.sub(Xm)).div(jm.sub(Km)).add(Xm))}).ElseIf(e.greaterThanEqual(Ym),()=>{t.assign(Km.sub(e).mul(Zm.sub(Qm)).div(Km.sub(Ym)).add(Qm))}).ElseIf(e.greaterThanEqual(Jm),()=>{t.assign(Ym.sub(e).mul(ef.sub(Zm)).div(Ym.sub(Jm)).add(Zm))}).ElseIf(e.greaterThanEqual(tf),()=>{t.assign(Jm.sub(e).mul(rf.sub(ef)).div(Jm.sub(tf)).add(ef))}).Else(()=>{t.assign(yn(-2).mul(To(Da(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),lf=cn(([e,t])=>{const r=e.toVar();r.assign(Da(2,r).sub(1));const s=Rn(r,1).toVar();return gn(t.equal(0),()=>{s.assign(s.zyx)}).ElseIf(t.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),df=cn(([e,t,r,s,i,n])=>{const a=yn(r),o=Rn(t),u=mu(uf(a),Xm,n),l=Eo(u),d=No(u),c=Rn(cf(e,o,d,s,i,n)).toVar();return gn(l.notEqual(0),()=>{const t=Rn(cf(e,o,d.add(1),s,i,n)).toVar();c.assign(gu(c,t,l))}),c}),cf=cn(([e,t,r,s,i,n])=>{const a=yn(r).toVar(),o=Rn(t),u=yn(af(o)).toVar(),l=yn(eu(sf.sub(a),0)).toVar();a.assign(eu(a,sf));const d=yn(bo(a)).toVar(),c=_n(of(o,u).mul(d.sub(2)).add(1)).toVar();return gn(u.greaterThan(2),()=>{c.y.addAssign(d),u.subAssign(3)}),c.x.addAssign(u.mul(d)),c.x.addAssign(l.mul(Da(3,nf))),c.y.addAssign(Da(4,bo(n).sub(d))),c.x.mulAssign(s),c.y.mulAssign(i),e.sample(c).grad(_n(),_n())}),hf=cn(({envMap:e,mipInt:t,outputDirection:r,theta:s,axis:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Co(s),l=r.mul(u).add(i.cross(r).mul(Ao(s))).add(i.mul(i.dot(r).mul(u.oneMinus())));return cf(e,l,t,n,a,o)}),pf=cn(({n:e,latitudinal:t,poleAxis:r,outputDirection:s,weights:i,samples:n,dTheta:a,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})=>{const h=Rn(Au(t,r,au(r,s))).toVar();gn(h.equal(Rn(0)),()=>{h.assign(Rn(s.z,0,s.x.negate()))}),h.assign(Ro(h));const p=Rn().toVar();return p.addAssign(i.element(0).mul(hf({theta:0,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),Bp({start:bn(1),end:e},({i:e})=>{gn(e.greaterThanEqual(n),()=>{Lp()});const t=yn(a.mul(yn(e))).toVar();p.addAssign(i.element(e).mul(hf({theta:t.mul(-1),axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),p.addAssign(i.element(e).mul(hf({theta:t,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})))}),Cn(p,1)}),gf=cn(([e])=>{const t=xn(e).toVar();return t.assign(t.shiftLeft(xn(16)).bitOr(t.shiftRight(xn(16)))),t.assign(t.bitAnd(xn(1431655765)).shiftLeft(xn(1)).bitOr(t.bitAnd(xn(2863311530)).shiftRight(xn(1)))),t.assign(t.bitAnd(xn(858993459)).shiftLeft(xn(2)).bitOr(t.bitAnd(xn(3435973836)).shiftRight(xn(2)))),t.assign(t.bitAnd(xn(252645135)).shiftLeft(xn(4)).bitOr(t.bitAnd(xn(4042322160)).shiftRight(xn(4)))),t.assign(t.bitAnd(xn(16711935)).shiftLeft(xn(8)).bitOr(t.bitAnd(xn(4278255360)).shiftRight(xn(8)))),yn(t).mul(2.3283064365386963e-10)}),mf=cn(([e,t])=>_n(yn(e).div(yn(t)),gf(e))),ff=cn(([e,t,r])=>{const s=r.mul(r).toConst(),i=Rn(1,0,0).toConst(),n=au(t,i).toConst(),a=_o(e.x).toConst(),o=Da(2,3.14159265359).mul(e.y).toConst(),u=a.mul(Co(o)).toConst(),l=a.mul(Ao(o)).toVar(),d=Da(.5,t.z.add(1)).toConst();l.assign(d.oneMinus().mul(_o(u.mul(u).oneMinus())).add(d.mul(l)));const c=i.mul(u).add(n.mul(l)).add(t.mul(_o(eu(0,u.mul(u).add(l.mul(l)).oneMinus()))));return Ro(Rn(s.mul(c.x),s.mul(c.y),eu(0,c.z)))}),yf=cn(({roughness:e,mipInt:t,envMap:r,N_immutable:s,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Rn(s).toVar(),l=Rn(0).toVar(),d=yn(0).toVar();return gn(e.lessThan(.001),()=>{l.assign(cf(r,u,t,n,a,o))}).Else(()=>{const s=Au(Vo(u.z).lessThan(.999),Rn(0,0,1),Rn(1,0,0)),c=Ro(au(s,u)).toVar(),h=au(u,c).toVar();Bp({start:xn(0),end:i},({i:s})=>{const p=mf(s,i),g=ff(p,Rn(0,0,1),e),m=Ro(c.mul(g.x).add(h.mul(g.y)).add(u.mul(g.z))),f=Ro(m.mul(nu(u,m).mul(2)).sub(u)),y=eu(nu(u,f),0);gn(y.greaterThan(0),()=>{const e=cf(r,f,t,n,a,o);l.addAssign(e.mul(y)),d.addAssign(y)})}),gn(d.greaterThan(0),()=>{l.assign(l.div(d))})}),Cn(l,1)}),bf=[.125,.215,.35,.446,.526,.582],xf=20,Tf=new Ne(-1,1,1,-1,0,1),_f=new Se(90,1),vf=new e;let Nf=null,Sf=0,Rf=0;const Ef=new r,Af=new WeakMap,wf=[3,1,5,0,4,2],Cf=lf(kl(),Vl("faceIndex")).normalize(),Mf=Rn(Cf.x,Cf.y,Cf.z);class Bf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,s=100,i={}){const{size:n=256,position:a=Ef,renderTarget:o=null}=i;if(this._setSize(n),!1===this._hasInitialized){d('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const n=o||this._allocateTarget();return i.renderTarget=n,this.fromSceneAsync(e,t,r,s,i),n}Nf=this._renderer.getRenderTarget(),Sf=this._renderer.getActiveCubeFace(),Rf=this._renderer.getActiveMipmapLevel();const u=o||this._allocateTarget();return u.depthBuffer=!0,this._init(u),this._sceneToCubeUV(e,r,s,u,a),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}async fromSceneAsync(e,t=0,r=.1,s=100,i={}){return v('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,r,s,i)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){d('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromEquirectangularAsync(e,r),r}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return v('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){d("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromCubemapAsync(e,t),r}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return v('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Df(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===U||e.mapping===I?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=bf[a-e+4-1]:0===a&&(o=0),r.push(o);const u=1/(n-2),l=-u,d=1+u,c=[l,l,d,l,d,d,l,l,d,d,l,d],h=6,p=6,g=3,m=2,f=1,y=new Float32Array(g*p*h),b=new Float32Array(m*p*h),x=new Float32Array(f*p*h);for(let e=0;e2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0],i=wf[e];y.set(s,g*p*i),b.set(c,m*p*i);const n=[i,i,i,i,i,i];x.set(n,f*p*i)}const T=new ve;T.setAttribute("position",new we(y,g)),T.setAttribute("uv",new we(b,m)),T.setAttribute("faceIndex",new we(x,f)),s.push(new oe(T,null)),i>4&&i--}return{lodMeshes:s,sizeLods:t,sigmas:r}}(t)),this._blurMaterial=function(e,t,s){const i=td(new Array(xf).fill(0)),n=Sa(new r(0,1,0)),a=Sa(0),o=yn(xf),u=Sa(0),l=Sa(1),d=Kl(),c=Sa(0),h=yn(1/t),p=yn(1/s),g=yn(e),m={n:o,latitudinal:u,weights:i,poleAxis:n,outputDirection:Mf,dTheta:a,samples:l,envMap:d,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g},f=Ff("blur");return f.fragmentNode=pf({...m,latitudinal:u.equal(1)}),Af.set(f,m),f}(t,e.width,e.height),this._ggxMaterial=function(e,t,r){const s=Kl(),i=Sa(0),n=Sa(0),a=yn(1/t),o=yn(1/r),u=yn(e),l={envMap:s,roughness:i,mipInt:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u},d=Ff("ggx");return d.fragmentNode=yf({...l,N_immutable:Mf,GGX_SAMPLES:xn(512)}),Af.set(d,l),d}(t,e.width,e.height)}}async _compileMaterial(e){const t=new oe(new ve,e);await this._renderer.compile(t,Tf)}_sceneToCubeUV(e,t,r,s,i){const n=_f;n.near=t,n.far=r;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],u=this._renderer,l=u.autoClear;u.getClearColor(vf),u.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new oe(new ae,new fe({name:"PMREM.Background",side:F,depthWrite:!1,depthTest:!1})));const d=this._backgroundBox,c=d.material;let h=!1;const p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,h=!0):(c.color.copy(vf),h=!0),u.setRenderTarget(s),u.clear(),h&&u.render(d,n);for(let t=0;t<6;t++){const r=t%3;0===r?(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x+o[t],i.y,i.z)):1===r?(n.up.set(0,0,a[t]),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y+o[t],i.z)):(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y,i.z+o[t]));const l=this._cubeSize;this._setViewport(s,r*l,t>2?l:0,l,l),u.render(e,n)}u.autoClear=l,e.background=p}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===U||e.mapping===I;s?null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(e)):null===this._equirectMaterial&&(this._equirectMaterial=Df(e));const i=s?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;const n=this._lodMeshes[0];n.material=i;const a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),r.setRenderTarget(t),r.render(n,Tf)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let t=1;tc-4?r-c+4:0),g=4*(this._cubeSize-h);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=d,o.mipInt.value=c-t,this._setViewport(i,p,g,3*h,2*h),s.setRenderTarget(i),s.render(a,Tf),i.texture.frame=(i.texture.frame||0)+1,o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=c-r,this._setViewport(e,p,g,3*h,2*h),s.setRenderTarget(e),s.render(a,Tf)}_blur(e,t,r,s,i){const n=this._pingPongRenderTarget;this._halfBlur(e,n,t,r,s,"latitudinal",i),this._halfBlur(n,e,r,r,s,"longitudinal",i)}_halfBlur(e,t,r,s,i,n,a){const u=this._renderer,l=this._blurMaterial;"latitudinal"!==n&&"longitudinal"!==n&&o("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[s];c.material=l;const h=Af.get(l),p=this._sizeLods[r]-1,g=isFinite(i)?Math.PI/(2*p):2*Math.PI/39,m=i/g,f=isFinite(i)?1+Math.floor(3*m):xf;f>xf&&d(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const y=[];let b=0;for(let e=0;ex-4?s-x+4:0),v=4*(this._cubeSize-T);this._setViewport(t,_,v,3*T,2*T),u.setRenderTarget(t),u.render(c,Tf)}_setViewport(e,t,r,s,i){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-i-r,s,i),e.scissor.set(t,e.height-i-r,s,i)):(e.viewport.set(t,r,s,i),e.scissor.set(t,r,s,i))}}function Lf(e,t){const r=new ne(e,t,{magFilter:le,minFilter:le,generateMipmaps:!1,type:Te,format:Ee,colorSpace:Re});return r.texture.mapping=Ae,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function Ff(e){const t=new vg;return t.depthTest=!1,t.depthWrite=!1,t.blending=re,t.name=`PMREM_${e}`,t}function Pf(e){const t=Ff("cubemap");return t.fragmentNode=$c(e,Mf),t}function Df(e){const t=Ff("equirect");return t.fragmentNode=Kl(e,Bg(Mf),0),t}const Uf=new WeakMap;function If(e,t,r){const s=function(e){let t=Uf.get(e);void 0===t&&(t=new WeakMap,Uf.set(e,t));return t}(t);let i=s.get(e);if((void 0!==i?i.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const r=6;for(let s=0;s0}(t))return null;i=r.fromEquirectangular(e,i)}i.pmremVersion=e.pmremVersion,s.set(e,i)}return i.texture}class Of extends gi{static get type(){return"PMREMNode"}constructor(e,t=null,r=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;const s=new N;s.isRenderTargetTexture=!0,this._texture=Kl(s),this._width=Sa(0),this._height=Sa(0),this._maxMip=Sa(0),this.updateBeforeType=ri.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const r=t?t.pmremVersion:-1,s=this._value;r!==s.pmremVersion&&(t=!0===s.isPMREMTexture?s:If(s,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new Bf(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this,e)),t=Dc.mul(Rn(t.x,t.y.negate(),t.z));let r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),df(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const Vf=an(Of).setParameterLength(1,3),kf=new WeakMap;class Gf extends Op{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:t[r.property],i=this._getPMREMNodeCache(e.renderer);let n=i.get(s);void 0===n&&(n=Vf(s),i.set(s,n)),r=n}const s=!0===t.useAnisotropy||t.anisotropy>0?_h:Sc,i=r.context(zf(Wn,s)).mul(Pc),n=r.context($f(Rc)).mul(Math.PI).mul(Pc),a=vl(i),o=vl(n);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const u=e.context.lightingModel.clearcoatRadiance;if(u){const e=r.context(zf(jn,Ec)).mul(Pc),t=vl(e);u.addAssign(t)}}_getPMREMNodeCache(e){let t=kf.get(e);return void 0===t&&(t=new WeakMap,kf.set(e,t)),t}}const zf=(e,t)=>{let r=null;return{getUV:()=>(null===r&&(r=gc.negate().reflect(t),r=du(e).mix(r,t).normalize(),r=r.transformDirection(Dd)),r),getTextureLevel:()=>e}},$f=e=>({getUV:()=>e,getTextureLevel:()=>yn(1)}),Wf=new Ce;class Hf extends vg{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Wf),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new Gf(t):null}setupLightingModel(){return new qm}setupSpecular(){const e=gu(Rn(.04),Gn.rgb,Hn);sa.assign(Rn(.04)),ia.assign(e),na.assign(1)}setupVariants(){const e=this.metalnessNode?yn(this.metalnessNode):$h;Hn.assign(e);let t=this.roughnessNode?yn(this.roughnessNode):zh;t=em({roughness:t}),Wn.assign(t),this.setupSpecular(),zn.assign(Gn.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qf=new Me;class jf extends Hf{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qf),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?yn(this.iorNode):sp;ca.assign(e),sa.assign(Jo(uu(ca.sub(1).div(ca.add(1))).mul(Vh),Rn(1)).mul(Oh)),ia.assign(gu(sa,Gn.rgb,Hn)),na.assign(gu(Oh,1,Hn))}setupLightingModel(){return new qm(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?yn(this.clearcoatNode):Hh,t=this.clearcoatRoughnessNode?yn(this.clearcoatRoughnessNode):qh;qn.assign(e),jn.assign(em({roughness:t}))}if(this.useSheen){const e=this.sheenNode?Rn(this.sheenNode):Kh,t=this.sheenRoughnessNode?yn(this.sheenRoughnessNode):Qh;Xn.assign(e),Kn.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?yn(this.iridescenceNode):Zh,t=this.iridescenceIORNode?yn(this.iridescenceIORNode):Jh,r=this.iridescenceThicknessNode?yn(this.iridescenceThicknessNode):ep;Qn.assign(e),Yn.assign(t),Zn.assign(r)}if(this.useAnisotropy){const e=(this.anisotropyNode?_n(this.anisotropyNode):Yh).toVar();ea.assign(e.length()),gn(ea.equal(0),()=>{e.assign(_n(1,0))}).Else(()=>{e.divAssign(_n(ea)),ea.assign(ea.saturate())}),Jn.assign(ea.pow2().mix(Wn.pow2(),1)),ta.assign(xh[0].mul(e.x).add(xh[1].mul(e.y))),ra.assign(xh[1].mul(e.x).sub(xh[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?yn(this.transmissionNode):tp,t=this.thicknessNode?yn(this.thicknessNode):rp,r=this.attenuationDistanceNode?yn(this.attenuationDistanceNode):ip,s=this.attenuationColorNode?Rn(this.attenuationColorNode):np;if(ha.assign(e),pa.assign(t),ga.assign(r),ma.assign(s),this.useDispersion){const e=this.dispersionNode?yn(this.dispersionNode):hp;fa.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Rn(this.clearcoatNormalNode):jh}setup(e){e.context.setupClearcoatNormal=()=>Gu(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class Xf extends qm{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1,a=!1){super(e,t,r,s,i,n),this.useSSS=a}direct({lightDirection:e,lightColor:t,reflectedLight:r},s){if(!0===this.useSSS){const i=s.material,{thicknessColorNode:n,thicknessDistortionNode:a,thicknessAmbientNode:o,thicknessAttenuationNode:u,thicknessPowerNode:l,thicknessScaleNode:d}=i,c=e.add(Sc.mul(a)).normalize(),h=yn(gc.dot(c.negate()).saturate().pow(l).mul(d)),p=Rn(h.add(o).mul(n));r.directDiffuse.addAssign(p.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:r},s)}}class Kf extends jf{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=yn(.1),this.thicknessAmbientNode=yn(0),this.thicknessAttenuationNode=yn(.1),this.thicknessPowerNode=yn(2),this.thicknessScaleNode=yn(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new Xf(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const Qf=cn(({normal:e,lightDirection:t,builder:r})=>{const s=e.dot(t),i=_n(s.mul(.5).add(.5),0);if(r.material.gradientMap){const e=Kc("gradientMap","texture").context({getUV:()=>i});return Rn(e.r)}{const e=i.fwidth().mul(.5);return gu(Rn(.7),Rn(1),bu(yn(.7).sub(e.x),yn(.7).add(e.x),i.x))}});class Yf extends kg{direct({lightDirection:e,lightColor:t,reflectedLight:r},s){const i=Qf({normal:xc,lightDirection:e,builder:s}).mul(t);r.directDiffuse.addAssign(i.mul(Hg({diffuseColor:Gn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Zf=new Be;class Jf extends vg{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Zf),this.setValues(e)}setupLightingModel(){return new Yf}}const ey=cn(()=>{const e=Rn(gc.z,0,gc.x.negate()).normalize(),t=gc.cross(e);return _n(e.dot(Sc),t.dot(Sc)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),ty=new Le;class ry extends vg{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(ty),this.setValues(e)}setupVariants(e){const t=ey;let r;r=e.material.matcap?Kc("matcap","texture").context({getUV:()=>t}):Rn(gu(.2,.8,t.y)),Gn.rgb.mulAssign(r.rgb)}}class sy extends gi{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:r}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),s=t.sin();return Fn(e,s,s.negate(),e).mul(r)}{const e=t,s=Dn(Cn(1,0,0,0),Cn(0,Co(e.x),Ao(e.x).negate(),0),Cn(0,Ao(e.x),Co(e.x),0),Cn(0,0,0,1)),i=Dn(Cn(Co(e.y),0,Ao(e.y),0),Cn(0,1,0,0),Cn(Ao(e.y).negate(),0,Co(e.y),0),Cn(0,0,0,1)),n=Dn(Cn(Co(e.z),Ao(e.z).negate(),0,0),Cn(Ao(e.z),Co(e.z),0,0),Cn(0,0,1,0),Cn(0,0,0,1));return s.mul(i).mul(n).mul(Cn(r,1)).xyz}}}const iy=an(sy).setParameterLength(2),ny=new Fe;class ay extends vg{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(ny),this.setValues(e)}setupPositionView(e){const{object:t,camera:r}=e,{positionNode:s,rotationNode:i,scaleNode:n,sizeAttenuation:a}=this,o=sc.mul(Rn(s||0));let u=_n(Qd[0].xyz.length(),Qd[1].xyz.length());null!==n&&(u=u.mul(_n(n))),r.isPerspectiveCamera&&!1===a&&(u=u.mul(o.z.negate()));let l=uc.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,r)=>new Zu(e,t,r))("center","vec2",t);l=l.sub(e.sub(.5))}l=l.mul(u);const d=yn(i||Xh),c=iy(l,d);return Cn(o.xy.add(c),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const oy=new Pe,uy=new t;class ly extends ay{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(oy),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return sc.mul(Rn(e||lc)).xyz}setupVertexSprite(e){const{material:t,camera:r}=e,{rotationNode:s,scaleNode:i,sizeNode:n,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let u=null!==n?_n(n):cp;u=u.mul(od),r.isPerspectiveCamera&&!0===a&&(u=u.mul(dy.div(pc.z.negate()))),i&&i.isNode&&(u=u.mul(_n(i)));let l=uc.xy;if(s&&s.isNode){const e=yn(s);l=iy(l,e)}return l=l.mul(u),l=l.div(hd.div(2)),l=l.mul(o.w),o=o.add(Cn(l,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const dy=Sa(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(uy);this.value=.5*t.y});class cy extends kg{constructor(){super(),this.shadowNode=yn(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Gn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Gn.rgb)}}const hy=new De;class py extends vg{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(hy),this.setValues(e)}setupLightingModel(){return new cy}}const gy=Vn("vec3"),my=Vn("vec3"),fy=Vn("vec3");class yy extends kg{constructor(){super()}start(e){const{material:t}=e,r=Vn("vec3"),s=Vn("vec3");gn(Od.sub(cc).length().greaterThan(ec.mul(2)),()=>{r.assign(Od),s.assign(cc)}).Else(()=>{r.assign(cc),s.assign(Od)});const i=s.sub(r),n=Sa("int").onRenderUpdate(({material:e})=>e.steps),a=i.length().div(n).toVar(),o=i.normalize().toVar(),u=yn(0).toVar(),l=Rn(1).toVar();t.offsetNode&&u.addAssign(t.offsetNode.mul(a)),Bp(n,()=>{const s=r.add(o.mul(u)),i=Dd.mul(Cn(s,1)).xyz;let n;null!==t.depthNode&&(my.assign(og(tg(i.z,Bd,Ld))),e.context.sceneDepthNode=og(t.depthNode).toVar()),e.context.positionWorld=s,e.context.shadowPositionWorld=s,e.context.positionView=i,gy.assign(0),t.scatteringNode&&(n=t.scatteringNode({positionRay:s})),super.start(e),n&&gy.mulAssign(n);const d=gy.mul(.01).negate().mul(a).exp();l.mulAssign(d),u.addAssign(a)}),fy.addAssign(l.saturate().oneMinus())}scatteringLight(e,t){const r=t.context.sceneDepthNode;r?gn(r.greaterThanEqual(my),()=>{gy.addAssign(e)}):gy.addAssign(e)}direct({lightNode:e,lightColor:t},r){if(void 0===e.light.distance)return;const s=t.xyz.toVar();s.mulAssign(e.shadowNode),this.scatteringLight(s,r)}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s},i){const n=t.add(r).sub(s),a=t.sub(r).sub(s),o=t.sub(r).add(s),u=t.add(r).add(s),l=i.context.positionView,d=e.xyz.mul(Tm({P:l,p0:n,p1:a,p2:o,p3:u})).pow(1.5);this.scatteringLight(d,i)}finish(e){e.context.outgoingLight.assign(fy)}}class by extends vg{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=F,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new yy}}class xy{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){null!==this._context&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Ty{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let r=this.weakMaps[t];return void 0===r&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],s=new Set,i={};for(const n of e){let e;if(n.node&&n.node.attribute?e=n.node.attribute:(e=t.getAttribute(n.name),i[n.name]=e.id),void 0===e)continue;r.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;s.add(a)}return this.attributes=r,this.attributesId=i,this.vertexBuffers=Array.from(s.values()),r}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:r,group:s,drawRange:i}=this,n=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let u=1;if(!0===r.isInstancedBufferGeometry?u=r.instanceCount:void 0!==e.count&&(u=Math.max(0,e.count)),0===u)return null;if(n.instanceCount=u,!0===e.isBatchedMesh)return n;let l=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(l=2);let d=i.start*l,c=(i.start+i.count)*l;null!==s&&(d=Math.max(d,s.start*l),c=Math.min(c,(s.start+s.count)*l));const h=r.attributes.position;let p=1/0;o?p=a.count:null!=h&&(p=h.count),d=Math.max(d,0),c=Math.min(c,p);const g=c-d;return g<0||g===1/0?null:(n.vertexCount=g,n.firstVertex=d,n)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const r of Object.keys(e.attributes).sort()){const s=e.attributes[r];t+=r+",",s.data&&(t+=s.data.stride+","),s.offset&&(t+=s.offset+","),s.itemSize&&(t+=s.itemSize+","),s.normalized&&(t+="n,")}for(const r of Object.keys(e.morphAttributes).sort()){const s=e.morphAttributes[r];t+="morph-"+r+",";for(let e=0,r=s.length;e1||Array.isArray(e.morphTargetInfluences))&&(s+=e.uuid+","),s+=this.context.id+",",s+=e.receiveShadow+",",Vs(s)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const r=this.geometry.getAttribute(t);if(void 0===r||e[t]!==r.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Gs(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Gs(e,1)),e=Gs(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const Ny=[];class Sy{constructor(e,t,r,s,i,n){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=s,this.bindings=i,this.info=n,this.chainMaps={}}get(e,t,r,s,i,n,a,o){const u=this.getChainMap(o);Ny[0]=e,Ny[1]=t,Ny[2]=n,Ny[3]=i;let l=u.get(Ny);return void 0===l?(l=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,s,i,n,a,o),u.set(Ny,l)):(l.camera=s,l.updateClipping(a),l.needsGeometryUpdate&&l.setGeometry(e.geometry),(l.version!==t.version||l.needsUpdate)&&(l.initialCacheKey!==l.getCacheKey()?(l.dispose(),l=this.get(e,t,r,s,i,n,a,o)):l.version=t.version)),Ny[0]=null,Ny[1]=null,Ny[2]=null,Ny[3]=null,l}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ty)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,s,i,n,a,o,u,l,d){const c=this.getChainMap(d),h=new vy(e,t,r,s,i,n,a,o,u,l);return h.onDispose=()=>{this.pipelines.delete(h),this.bindings.deleteForRender(h),this.nodes.delete(h),c.delete(h.getChainArray())},h}}class Ry{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const Ey=1,Ay=2,wy=3,Cy=4,My=16;class By extends Ry{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){const t=super.delete(e);return null!==t&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){const r=this.get(e);if(void 0===r.version)t===Ey?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Ay?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===wy?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Cy&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),r.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(r.version=65535?Ue:Ie)(t,1);return i.version=Ly(e),i.__id=Fy(e),i}class Dy extends Ry{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;const r=()=>{this.info.memory.geometries--;const s=t.index,i=e.getAttributes();null!==s&&this.attributes.delete(s);for(const e of i)this.attributes.delete(e);const n=this.wireframes.get(t);void 0!==n&&this.attributes.delete(n),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){const t=e.getAttributes();for(const e of t)e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute?this.updateAttribute(e,wy):this.updateAttribute(e,Ey);const r=this.getIndex(e);null!==r&&this.updateAttribute(r,Ay);const s=e.geometry.indirect;null!==s&&this.updateAttribute(s,Cy)}updateAttribute(e,t){const r=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:r}=e;let s=t.index;if(!0===r.wireframe){const e=this.wireframes;let r=e.get(t);void 0===r?(r=Py(t),e.set(t,r)):r.version===Ly(t)&&r.__id===Fy(t)||(this.attributes.delete(r),r=Py(t),e.set(t,r)),s=r}return s}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class Uy{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0,attributes:0,indexAttributes:0,storageAttributes:0,indirectStorageAttributes:0,readbackBuffers:0,programs:0,renderTargets:0,total:0,texturesSize:0,attributesSize:0,indexAttributesSize:0,storageAttributesSize:0,indirectStorageAttributesSize:0,readbackBuffersSize:0,programsSize:0},this.memoryMap=new Map}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=r*(t/3):e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=r*(t/2):e.isLine?this.render.lines+=r*(t-1):o("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(const e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){const t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){const r=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:r,type:t}),this.memory[t]++,this.memory.total+=r,this.memory[t+"Size"]+=r}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){const t=this._getAttributeMemorySize(e.attribute);this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){this.destroyAttribute(e)}createProgram(e){const t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oe||e.type===Ve?t=1:e.type===ke||e.type===Ge||e.type===Te?t=2:e.type!==R&&e.type!==S&&e.type!==K||(t=4);let r=4;e.format===ze||e.format===$e||e.format===We||e.format===He||e.format===qe?r=1:e.format===$||e.format===je?r=2:e.format!==Xe&&e.format!==Ke||(r=3);let s=t*r;e.type===Qe||e.type===Ye?s=2:e.type!==Ze&&e.type!==Je&&e.type!==et||(s=4);const i=e.width||1,n=e.height||1,a=e.isCubeTexture?6:e.depth||1;let o=i*n*a*s;const u=e.mipmaps;if(u&&u.length>0){let e=0;for(let t=0;t>t))*(r.height||Math.max(1,n>>t))*a*s}}o+=e}else e.generateMipmaps&&(o*=1.333);return Math.round(o)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}}class Iy{constructor(e){this.cacheKey=e,this.usedTimes=0}}class Oy extends Iy{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}}class Vy extends Iy{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let ky=0;class Gy{constructor(e,t,r,s=null,i=null){this.id=ky++,this.code=e,this.stage=t,this.name=r,this.transforms=s,this.attributes=i,this.usedTimes=0}}class zy extends Ry{constructor(e,t,r){super(),this.backend=e,this.nodes=t,this.info=r,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:r}=this,s=this.get(e);if(this._needsComputeUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.computeProgram.usedTimes--);const n=this.nodes.getForCompute(e);let a=this.programs.compute.get(n.computeShader);void 0===a&&(i&&0===i.computeProgram.usedTimes&&this._releaseProgram(i.computeProgram),a=new Gy(n.computeShader,"compute",e.name,n.transforms,n.nodeAttributes),this.programs.compute.set(n.computeShader,a),r.createProgram(a),this.info.createProgram(a));const o=this._getComputeCacheKey(e,a);let u=this.caches.get(o);void 0===u&&(i&&0===i.usedTimes&&this._releasePipeline(i),u=this._getComputePipeline(e,a,o,t)),u.usedTimes++,a.usedTimes++,s.version=e.version,s.pipeline=u}return s.pipeline}getForRender(e,t=null){const{backend:r}=this,s=this.get(e);if(this._needsRenderUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.vertexProgram.usedTimes--,i.fragmentProgram.usedTimes--);const n=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(n.vertexShader);void 0===o&&(i&&0===i.vertexProgram.usedTimes&&this._releaseProgram(i.vertexProgram),o=new Gy(n.vertexShader,"vertex",a),this.programs.vertex.set(n.vertexShader,o),r.createProgram(o),this.info.createProgram(o));let u=this.programs.fragment.get(n.fragmentShader);void 0===u&&(i&&0===i.fragmentProgram.usedTimes&&this._releaseProgram(i.fragmentProgram),u=new Gy(n.fragmentShader,"fragment",a),this.programs.fragment.set(n.fragmentShader,u),r.createProgram(u),this.info.createProgram(u));const l=this._getRenderCacheKey(e,o,u);let d=this.caches.get(l);void 0===d?(i&&0===i.usedTimes&&this._releasePipeline(i),d=this._getRenderPipeline(e,o,u,l,t)):e.pipeline=d,d.usedTimes++,o.usedTimes++,u.usedTimes++,s.pipeline=d}return s.pipeline}isReady(e){const t=this.get(e).pipeline;if(void 0===t)return!1;const r=this.backend.get(t);return void 0!==r.pipeline&&null!==r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,s){r=r||this._getComputeCacheKey(e,t);let i=this.caches.get(r);return void 0===i&&(i=new Vy(r,t),this.caches.set(r,i),this.backend.createComputePipeline(i,s)),i}_getRenderPipeline(e,t,r,s,i){s=s||this._getRenderCacheKey(e,t,r);let n=this.caches.get(s);return void 0===n&&(n=new Oy(s,t,r),this.caches.set(s,n),e.pipeline=n,this.backend.createRenderPipeline(e,i)),n}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,r){return t.id+","+r.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,r=e.stage;this.programs[r].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){const t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class $y extends Ry{constructor(e,t,r,s,i,n){super(),this.backend=e,this.textures=r,this.pipelines=i,this.attributes=s,this.nodes=t,this.info=n,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}deleteForRender(e){const t=e.getBindings();for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const e=t.attribute,r=e.isIndirectStorageBufferAttribute?Cy:wy;this.attributes.update(e,r)}}_update(e,t){const{backend:r}=this;let s=!1,i=!0,n=0,a=0;for(const t of e.bindings){if(!1!==this.nodes.updateGroup(t)){if(t.isStorageBuffer){const e=t.attribute,i=e.isIndirectStorageBufferAttribute?Cy:wy,n=r.get(t);this.attributes.update(e,i),n.attribute!==e&&(n.attribute=e,s=!0)}if(t.isUniformBuffer){t.update()&&r.updateBinding(t)}else if(t.isSampledTexture){const o=t.update(),u=t.texture,l=this.textures.get(u);o&&(this.textures.updateTexture(u),t.generation!==l.generation&&(t.generation=l.generation,s=!0),l.bindGroups.add(e));if(void 0!==r.get(u).externalTexture||l.isDefaultTexture?i=!1:(n=10*n+u.id,a+=u.version),!0===u.isStorageTexture&&!0===u.mipmapsAutoUpdate){const e=this.get(u);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(u)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(u),e.needsMipmap=!1)}}else if(t.isSampler){if(t.update()){const e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,s=!0)}}t.isBuffer&&t.updateRanges.length>0&&t.clearUpdateRanges()}}!0===s&&this.backend.updateBindings(e,t,i?n:0,a)}}function Wy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function Hy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function qy(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&e.side===P&&!1===e.forceSinglePass}class jy{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,r),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,s,i,n,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:s,renderOrder:e.renderOrder,z:i,group:n,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=s,o.renderOrder=e.renderOrder,o.z=i,o.group=n,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Wy),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Hy),this.transparent.length>1&&this.transparent.sort(t||Hy)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,u=a.height>>t;let l=e.depthTexture||i[t];const d=!0===e.depthBuffer||!0===e.stencilBuffer;let c=!1;void 0===l&&d&&(l=new Z,l.format=e.stencilBuffer?qe:He,l.type=e.stencilBuffer?Ze:S,l.image.width=o,l.image.height=u,l.image.depth=a.depth,l.renderTarget=e,l.isArrayTexture=!0===e.multiview&&a.depth>1,i[t]=l),r.width===a.width&&a.height===r.height||(c=!0,l&&(l.needsUpdate=!0,l.image.width=o,l.image.height=u,l.image.depth=l.isArrayTexture?l.image.depth:1)),r.width=a.width,r.height=a.height,r.textures=n,r.depthTexture=l||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==s&&(c=!0,l&&(l.needsUpdate=!0),r.sampleCount=s);const h={sampleCount:s};if(!0!==e.isXRRenderTarget){for(let e=0;e{this._destroyRenderTarget(e)},e.addEventListener("dispose",r.onDispose))}updateTexture(e,t={}){const r=this.get(e);if(!0===r.initialized&&r.version===e.version)return;const s=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,i=this.backend;if(s&&!0===r.initialized&&i.destroyTexture(e),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:Ve}if(e.isHTMLTexture&&e.image){const t=this.renderer.domElement;"requestPaint"in t&&(t.hasAttribute("layoutsubtree")||t.setAttribute("layoutsubtree","true"),e.image.parentNode!==t&&t.appendChild(e.image))}const{width:n,height:a,depth:o}=this.getSize(e);if(t.width=n,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,n,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,s||!0===e.isStorageTexture||!0===e.isExternalTexture)i.createTexture(e,t),r.generation=e.version;else if(e.version>0){const s=e.image;if(void 0===s)d("Renderer: Texture marked for update but image is undefined.");else if(!1===s.complete)d("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const r=[];for(const t of e.images)r.push(t);t.images=r}else t.image=s;void 0!==r.isDefaultTexture&&!0!==r.isDefaultTexture||(i.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),!0===e.source.dataReady&&i.updateTexture(e,t);const n=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!n&&i.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else i.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;!0!==r.initialized&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&!0===p.enabled&&p.getTransfer(e.colorSpace)!==g&&d("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=eb){let r=e.images?e.images[0]:e.image;return r?(void 0!==r.image&&(r=r.image),e.isHTMLTexture?(t.width=r.offsetWidth||1,t.height=r.offsetHeight||1,t.depth=1):"undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):"undefined"!=typeof VideoFrame&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){let s;return s=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,r)))+1,s}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){const t=this.get(e),r=t.textures,s=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e=2)for(let r=0;r{if(this._currentNode=t,!t.isVarNode||!t.isIntent(e)||!0===t.isAssign(e))if("setup"===s)t.build(e);else if("analyze"===s)t.build(e,this);else if("generate"===s){const r=e.getDataFromNode(t,"any").stages,s=r&&r[e.shaderStage];if(t.isVarNode&&s&&1===s.length&&s[0]&&s[0].isStackNode)return;t.build(e,"void")}},n=[...this.nodes];for(const e of n)i(e);this._currentNode=null;const a=this.nodes.filter(e=>-1===n.indexOf(e));for(const e of a)i(e);let o;return o=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),hn(r),e.removeActiveStack(this),o}}const nb=an(ib).setParameterLength(0,1);class ab extends ci{static get type(){return"StructTypeNode"}constructor(e,t=null){var r;super("struct"),this.membersLayout=(r=e,Object.entries(r).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,r=0;for(const s of this.membersLayout){const i=s.type,n=js(i),a=Xs(i)/e;t=Math.max(t,a);const o=r%t%a;0!==o&&(r+=a-o),r+=n}return Math.ceil(r/t)*t}getMemberType(e,t){const r=this.membersLayout.find(e=>e.name===t);return r?r.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class ob extends ci{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),r=t.type,s=e.getPropertyName(t);return e.addLineFlowCode(`${s} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class ub extends ci{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(void 0===t.membersLayout){const r=this.members,s=[];for(let t=0;tnew fb(e,"uint","float"),xb={};class Tb extends no{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,r){"int"===r?t.assign(yb(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return xn;case"int":return bn;case"uvec2":return Nn;case"uvec3":return An;case"uvec4":return Bn;case"ivec2":return vn;case"ivec3":return En;case"ivec4":return Mn}}_createTrailingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t);const i=yn(s.bitAnd(zo(s))),n=bb(i).shiftRight(23).sub(127);return r(n)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{gn(e.equal(xn(0)),()=>xn(32));const s=xn(0),i=xn(0);return this._resolveElementType(e,s,t),gn(s.shiftRight(16).equal(0),()=>{i.addAssign(16),s.shiftLeftAssign(16)}),gn(s.shiftRight(24).equal(0),()=>{i.addAssign(8),s.shiftLeftAssign(8)}),gn(s.shiftRight(28).equal(0),()=>{i.addAssign(4),s.shiftLeftAssign(4)}),gn(s.shiftRight(30).equal(0),()=>{i.addAssign(2),s.shiftLeftAssign(2)}),gn(s.shiftRight(31).equal(0),()=>{i.addAssign(1)}),r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t),s.assign(s.sub(s.shiftRight(xn(1)).bitAnd(xn(1431655765)))),s.assign(s.bitAnd(xn(858993459)).add(s.shiftRight(xn(2)).bitAnd(xn(858993459))));const i=s.add(s.shiftRight(xn(4))).bitAnd(xn(252645135)).mul(xn(16843009)).shiftRight(xn(24));return r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,r,s){const i=this._returnDataNode(t);return cn(([e])=>{if(1===r)return i(s(e));{const t=i(0),n=["x","y","z","w"];for(let i=0;id(r))()}}Tb.COUNT_TRAILING_ZEROS="countTrailingZeros",Tb.COUNT_LEADING_ZEROS="countLeadingZeros",Tb.COUNT_ONE_BITS="countOneBits";const _b=un(Tb,Tb.COUNT_TRAILING_ZEROS).setParameterLength(1),vb=un(Tb,Tb.COUNT_LEADING_ZEROS).setParameterLength(1),Nb=un(Tb,Tb.COUNT_ONE_BITS).setParameterLength(1),Sb=cn(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return r.shiftRight(22).bitXor(r).toFloat().mul(1/2**32)}),Rb=(e,t)=>ou(Da(4,e.mul(Pa(1,e))),t);class Eb extends gi{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const Ab=un(Eb,"snorm").setParameterLength(1),wb=un(Eb,"unorm").setParameterLength(1),Cb=un(Eb,"float16").setParameterLength(1);class Mb extends gi{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const Bb=un(Mb,"snorm").setParameterLength(1),Lb=un(Mb,"unorm").setParameterLength(1),Fb=un(Mb,"float16").setParameterLength(1),Pb=cn(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Db=cn(([e])=>Rn(Pb(e.z.add(Pb(e.y.mul(1)))),Pb(e.z.add(Pb(e.x.mul(1)))),Pb(e.y.add(Pb(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ub=cn(([e,t,r])=>{const s=Rn(e).toVar(),i=yn(1.4).toVar(),n=yn(0).toVar(),a=Rn(s).toVar();return Bp({start:yn(0),end:yn(3),type:"float",condition:"<="},()=>{const e=Rn(Db(a.mul(2))).toVar();s.addAssign(e.add(r.mul(yn(.1).mul(t)))),a.mulAssign(1.8),i.mulAssign(1.5),s.mulAssign(1.2);const o=yn(Pb(s.z.add(Pb(s.x.add(Pb(s.y)))))).toVar();n.addAssign(o.div(i)),a.addAssign(.14)}),n}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Ib extends ci{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let r=this._candidateFn;if(null===r){let s=null,i=-1;for(const r of this.functionNodes){const n=r.shaderNode.layout;if(null===n)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=n.inputs;if(t.length===a.length){let n=0;for(let r=0;ri&&(s=r,i=n)}}this._candidateFn=r=s}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const Ob=an(Ib),Vb=e=>(...t)=>Ob(e,...t),kb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.time),Gb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.deltaTime),zb=Sa(0,"uint").setGroup(_a).onRenderUpdate(e=>e.frameId);const $b=cn(([e,t,r=_n(.5)])=>iy(e.sub(r),t).add(r)),Wb=cn(([e,t,r=_n(.5)])=>{const s=e.sub(r),i=s.dot(s),n=i.mul(i).mul(t);return e.add(s.mul(n))}),Hb=cn(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let s;null!==e?(s=Qd.toVar(),s[3][0]=e.x,s[3][1]=e.y,s[3][2]=e.z):s=Qd;const i=Dd.mul(s);return Zi(t)&&(i[0][0]=Qd[0].length(),i[0][1]=0,i[0][2]=0),Zi(r)&&(i[1][0]=0,i[1][1]=Qd[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,Fd.mul(i).mul(lc)}),qb=cn(([e=null])=>{const t=og();return og(Yp(e)).sub(t).lessThan(0).select(ud,e)}),jb=cn(([e,t=kl(),r=yn(0)])=>{const s=e.x,i=e.y,n=r.mod(s.mul(i)).floor(),a=n.mod(s),o=i.sub(n.add(1).div(s).ceil()),u=e.reciprocal(),l=_n(a,o);return t.add(l).mul(u)}),Xb=cn(([e,t=null,r=null,s=yn(1),i=lc,n=Tc])=>{let a=n.abs().normalize();a=a.div(a.dot(Rn(1)));const o=i.yz.mul(s),u=i.zx.mul(s),l=i.xy.mul(s),d=e.value,c=null!==t?t.value:d,h=null!==r?r.value:d,p=Kl(d,o).mul(a.x),g=Kl(c,u).mul(a.y),m=Kl(h,l).mul(a.z);return Fa(p,g,m)}),Kb=new ut,Qb=new r,Yb=new r,Zb=new r,Jb=new a,ex=new r(0,0,-1),tx=new s,rx=new r,sx=new r,ix=new s,nx=new t,ax=new ne,ox=ud.flipX();ax.depthTexture=new Z(1,1);let ux=!1;class lx extends jl{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||ax.texture,ox),this._reflectorBaseNode=e.reflector||new dx(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new lx({defaultTexture:ax.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class dx extends ci{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:r=new at,resolutionScale:s=1,generateMipmaps:i=!1,bounces:n=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=s,void 0!==t.resolution&&(v('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=n,this.depth=a,this.samples=o,this.updateBeforeType=n?ri.RENDER:ri.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const r=this.resolutionScale;t.getDrawingBufferSize(nx),e.setSize(Math.round(nx.width*r),Math.round(nx.height*r))}setup(e){return this._updateResolution(ax,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new ne(0,0,{type:Te,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=ot,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new Z),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&ux)return!1;ux=!0;const{scene:t,camera:r,renderer:s,material:i}=e,{target:n}=this,a=this.getVirtualCamera(r),o=this.getRenderTarget(a);s.getDrawingBufferSize(nx),this._updateResolution(o,s),Yb.setFromMatrixPosition(n.matrixWorld),Zb.setFromMatrixPosition(r.matrixWorld),Jb.extractRotation(n.matrixWorld),Qb.set(0,0,1),Qb.applyMatrix4(Jb),rx.subVectors(Yb,Zb);let u=!1;if(!0===rx.dot(Qb)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(ux=!1);u=!0}rx.reflect(Qb).negate(),rx.add(Yb),Jb.extractRotation(r.matrixWorld),ex.set(0,0,-1),ex.applyMatrix4(Jb),ex.add(Zb),sx.subVectors(Yb,ex),sx.reflect(Qb).negate(),sx.add(Yb),a.coordinateSystem=r.coordinateSystem,a.position.copy(rx),a.up.set(0,1,0),a.up.applyMatrix4(Jb),a.up.reflect(Qb),a.lookAt(sx),a.near=r.near,a.far=r.far,a.updateMatrixWorld(),a.projectionMatrix.copy(r.projectionMatrix),Kb.setFromNormalAndCoplanarPoint(Qb,Yb),Kb.applyMatrix4(a.matrixWorldInverse),tx.set(Kb.normal.x,Kb.normal.y,Kb.normal.z,Kb.constant);const l=a.projectionMatrix;ix.x=(Math.sign(tx.x)+l.elements[8])/l.elements[0],ix.y=(Math.sign(tx.y)+l.elements[9])/l.elements[5],ix.z=-1,ix.w=(1+l.elements[10])/l.elements[14],tx.multiplyScalar(1/tx.dot(ix));l.elements[2]=tx.x,l.elements[6]=tx.y,l.elements[10]=s.coordinateSystem===h?tx.z-0:tx.z+1-0,l.elements[14]=tx.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),i.visible=!1;const d=s.getRenderTarget(),c=s.getMRT(),p=s.autoClear;s.setMRT(null),s.setRenderTarget(o),s.autoClear=!0;const g=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(s.clear(),this.hasOutput=!1):(s.render(t,a),this.hasOutput=!0),t.name=g,s.setMRT(c),s.setRenderTarget(d),s.autoClear=p,i.visible=!0,ux=!1,this.forceUpdate=!1}get resolution(){return v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const cx=new Ne(-1,1,1,-1,0,1);class hx extends ve{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new lt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lt(t,2))}}const px=new hx;class gx extends oe{constructor(e=null){super(px,e),this.camera=cx,this.isQuadMesh=!0}async renderAsync(e){v('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,cx)}render(e){e.render(this,cx)}}const mx=new t;class fx extends jl{static get type(){return"RTTNode"}constructor(e,t=null,r=null,s={type:Te}){const i=new ne(t,r,s);super(i.texture,kl()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new gx(new vg),this.updateBeforeType=ri.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const r=e*this.pixelRatio,s=t*this.pixelRatio;this.renderTarget.setSize(r,s),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),r=e.getSize(mx),s=Math.floor(r.width*t),i=Math.floor(r.height*t);s===this.renderTarget.width&&i===this.renderTarget.height||(this.renderTarget.setSize(s,i),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(r)}clone(){const e=new jl(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yx=(e,...t)=>new fx(tn(e),...t),bx=cn(([e,t,r],s)=>{let i;s.renderer.coordinateSystem===h?(e=_n(e.x,e.y.oneMinus()).mul(2).sub(1),i=Cn(Rn(e,t),1)):i=Cn(Rn(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const n=Cn(r.mul(i));return n.xyz.div(n.w)}),xx=cn(([e,t])=>{const r=t.mul(Cn(e,1)),s=r.xy.div(r.w).mul(.5).add(.5).toVar();return _n(s.x,s.y.oneMinus())}),Tx=cn(([e,t,r])=>{const s=zl(Ql(t)),i=vn(e.mul(s)).toVar(),n=Ql(t,i).toVar(),a=Ql(t,i.sub(vn(2,0))).toVar(),o=Ql(t,i.sub(vn(1,0))).toVar(),u=Ql(t,i.add(vn(1,0))).toVar(),l=Ql(t,i.add(vn(2,0))).toVar(),d=Ql(t,i.add(vn(0,2))).toVar(),c=Ql(t,i.add(vn(0,1))).toVar(),h=Ql(t,i.sub(vn(0,1))).toVar(),p=Ql(t,i.sub(vn(0,2))).toVar(),g=Vo(Pa(yn(2).mul(o).sub(a),n)).toVar(),m=Vo(Pa(yn(2).mul(u).sub(l),n)).toVar(),f=Vo(Pa(yn(2).mul(c).sub(d),n)).toVar(),y=Vo(Pa(yn(2).mul(h).sub(p),n)).toVar(),b=bx(e,n,r).toVar(),x=g.lessThan(m).select(b.sub(bx(e.sub(_n(yn(1).div(s.x),0)),o,r)),b.negate().add(bx(e.add(_n(yn(1).div(s.x),0)),u,r))),T=f.lessThan(y).select(b.sub(bx(e.add(_n(0,yn(1).div(s.y))),c,r)),b.negate().add(bx(e.sub(_n(0,yn(1).div(s.y))),h,r)));return Ro(au(x,T))}),_x=cn(([e])=>Eo(yn(52.9829189).mul(Eo(nu(e,_n(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),vx=cn(([e,t,r])=>{const s=yn(2.399963229728653),i=_o(yn(e).add(.5).div(yn(t))),n=yn(e).mul(s).add(r);return _n(Co(n),Ao(n)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class Nx extends ci{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(kl())}sample(e){return this.callback(e)}}class Sx extends ci{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Sx.OBJECT?this.updateType=ri.OBJECT:e===Sx.MATERIAL?this.updateType=ri.RENDER:e===Sx.BEFORE_OBJECT?this.updateBeforeType=ri.OBJECT:e===Sx.BEFORE_MATERIAL&&(this.updateBeforeType=ri.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Sx.OBJECT="object",Sx.MATERIAL="material",Sx.BEFORE_OBJECT="beforeObject",Sx.BEFORE_MATERIAL="beforeMaterial";const Rx=(e,t)=>new Sx(e,t).toStack();class Ex extends q{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class Ax extends we{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageBufferAttribute=!0}}class wx extends ci{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Cx=on(wx),Mx=new a,Bx=Sa(0).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Lx=Sa(1).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Fx=Sa(new a).setGroup(_a).onRenderUpdate(({scene:e})=>{const t=e.background;return null!==t&&t.isTexture&&t.mapping!==dt?Mx.makeRotationFromEuler(e.backgroundRotation).transpose():Mx.identity(),Mx});class Px extends jl{static get type(){return"StorageTextureNode"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=ii.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return null!==this.storeNode?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;return e.generateStorageTextureLoad(l,t,r,s,n,u)}toReadWrite(){return this.setAccess(ii.READ_WRITE)}toReadOnly(){return this.setAccess(ii.READ_ONLY)}toWriteOnly(){return this.setAccess(ii.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:r,storeNode:s,depthNode:i}=t,n=super.generate(e,"property"),a=r.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=s.build(e,"vec4"),u=i?i.build(e,"int"):null,l=e.generateTextureStore(this.value,n,a,u,o);e.addLineFlowCode(l,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const Dx=an(Px).setParameterLength(1,3),Ux=cn(({texture:e,uv:t})=>{const r=1e-4,s=Rn().toVar();return gn(t.x.lessThan(r),()=>{s.assign(Rn(1,0,0))}).ElseIf(t.y.lessThan(r),()=>{s.assign(Rn(0,1,0))}).ElseIf(t.z.lessThan(r),()=>{s.assign(Rn(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{s.assign(Rn(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{s.assign(Rn(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{s.assign(Rn(0,0,-1))}).Else(()=>{const r=.01,i=e.sample(t.add(Rn(-.01,0,0))).r.sub(e.sample(t.add(Rn(r,0,0))).r),n=e.sample(t.add(Rn(0,-.01,0))).r.sub(e.sample(t.add(Rn(0,r,0))).r),a=e.sample(t.add(Rn(0,0,-.01))).r.sub(e.sample(t.add(Rn(0,0,r))).r);s.assign(Rn(i,n,a))}),s.normalize()});class Ix extends jl{static get type(){return"Texture3DNode"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Rn(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Ux({texture:this,uv:e})}}const Ox=an(Ix).setParameterLength(1,3);class Vx extends Hc{static get type(){return"UserDataNode"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const kx=new WeakMap;class Gx extends gi{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=ri.OBJECT,this.updateAfterType=ri.OBJECT,this.previousModelWorldMatrix=Sa(new a),this.previousProjectionMatrix=Sa(new a).setGroup(_a),this.previousCameraViewMatrix=Sa(new a)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){const s=$x(r);this.previousModelWorldMatrix.value.copy(s);const i=zx(t);i.frameId!==e&&(i.frameId=e,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new a,i.previousCameraViewMatrix=new a,i.currentProjectionMatrix=new a,i.currentCameraViewMatrix=new a,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){$x(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?Fd:Sa(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(sc).mul(lc),s=this.previousProjectionMatrix.mul(t).mul(dc),i=r.xy.div(r.w),n=s.xy.div(s.w);return Pa(i,n)}}function zx(e){let t=kx.get(e);return void 0===t&&(t={},kx.set(e,t)),t}function $x(e,t=0){const r=zx(e);let s=r[t];return void 0===s&&(r[t]=s=new a,r[t].copy(e.matrixWorld)),s}const Wx=on(Gx),Hx=cn(([e])=>Kx(e.rgb)),qx=cn(([e,t=yn(1)])=>t.mix(Kx(e.rgb),e.rgb)),jx=cn(([e,t=yn(1)])=>{const r=Fa(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return gu(e.rgb,s,i)}),Xx=cn(([e,t=yn(1)])=>{const r=Rn(.57735,.57735,.57735),s=t.cos();return Rn(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(nu(r,e.rgb).mul(s.oneMinus())))))}),Kx=(e,t=Rn(p.getLuminanceCoefficients(new r)))=>nu(e,t),Qx=cn(([e,t=Rn(1),s=Rn(0),i=Rn(1),n=yn(1),a=Rn(p.getLuminanceCoefficients(new r,Re))])=>{const o=e.rgb.dot(Rn(a)),u=eu(e.rgb.mul(t).add(s),0).toVar(),l=u.pow(i).toVar();return gn(u.r.greaterThan(0),()=>{u.r.assign(l.r)}),gn(u.g.greaterThan(0),()=>{u.g.assign(l.g)}),gn(u.b.greaterThan(0),()=>{u.b.assign(l.b)}),u.assign(o.add(u.sub(o).mul(n))),Cn(u.rgb,e.a)}),Yx=cn(([e,t])=>e.mul(t).floor().div(t));let Zx=null;class Jx extends Wp{static get type(){return"ViewportSharedTextureNode"}constructor(e=ud,t=null){null===Zx&&(Zx=new Q),super(e,t,Zx)}getTextureForReference(){return Zx}updateReference(){return this}}const eT=an(Jx).setParameterLength(0,2),tT=new t;class rT extends jl{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){return e.getNodeProperties(this).passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class sT extends rT{static get type(){return"PassMultipleTextureNode"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class iT extends gi{static get type(){return"PassNode"}constructor(e,t,r,s={}){super("vec4"),this.scope=e,this.scene=t,this.camera=r,this.options=s,this._pixelRatio=1,this._width=1,this._height=1;const i=new Z;i.isRenderTargetTexture=!0,i.name="depth";const n=new ne(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Te,...s});n.texture.name="output",n.depthTexture=i,this.renderTarget=n,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:n.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Sa(0),this._cameraFar=Sa(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=ri.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return d("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return d("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const r=this._textures[e],s=this.renderTarget.textures.indexOf(r);this.renderTarget.textures[s]=t,this._textures[e]=t,this._previousTextures[e]=r,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(t=new sT(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=new sT(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar;this._viewZNodes[e]=t=sg(this.getTextureNode(e),r,s)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=Jp(i,r,s)}return t}async compileAsync(e){const t=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(r)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),!0===e.reversedDepthBuffer&&(this.renderTarget.depthTexture.type=K),this.scope===iT.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:r}=this;let s,i;const n=t.getOutputRenderTarget();n&&!0===n.isXRRenderTarget?(i=1,s=t.xr.getCamera(),t.xr.updateCamera(s),tT.set(n.width,n.height)):(s=this.camera,i=t.getPixelRatio(),t.getSize(tT)),this._pixelRatio=i,this.setSize(tT.width,tT.height);const a=t.getRenderTarget(),o=t.getMRT(),u=t.autoClear,l=t.transparent,d=t.opaque,c=s.layers.mask,h=t.contextNode,p=r.overrideMaterial;this._cameraNear.value=s.near,this._cameraFar.value=s.far,null!==this._layers&&(s.layers.mask=this._layers.mask);for(const e in this._previousTextures)this.toggleTexture(e);null!==this.overrideMaterial&&(r.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,null!==this.contextNode&&(null!==this._contextNodeCache&&this._contextNodeCache.version===this.version||(this._contextNodeCache={version:this.version,context:Cu({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const g=r.name;r.name=this.name?this.name:r.name,t.render(r,s),r.name=g,r.overrideMaterial=p,t.setRenderTarget(a),t.setMRT(o),t.autoClear=u,t.transparent=l,t.opaque=d,t.contextNode=h,s.layers.mask=c}setSize(e,t){this._width=e,this._height=t;const r=Math.floor(this._width*this._pixelRatio*this._resolutionScale),s=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(r,s),null!==this._scissor?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._pixelRatio*this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._pixelRatio*this._resolutionScale).floor()}setScissor(e,t,r,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new s),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,r,i))}setViewport(e,t,r,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new s),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,r,i))}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}iT.COLOR="color",iT.DEPTH="depth";class nT extends iT{static get type(){return"ToonOutlinePassNode"}constructor(e,t,r,s,i){super(iT.COLOR,e,t),this.colorNode=r,this.thicknessNode=s,this.alphaNode=i,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((e,r,s,i,n,a,o,u)=>{if((n.isMeshToonMaterial||n.isMeshToonNodeMaterial)&&!1===n.wireframe){const l=this._getOutlineMaterial(n);t.renderObject(e,r,s,i,l,a,o,u)}t.renderObject(e,r,s,i,n,a,o,u)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){const e=new vg;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=F;const t=Tc.negate(),r=Fd.mul(sc),s=yn(1),i=r.mul(Cn(lc,1)),n=r.mul(Cn(lc.add(t),1)),a=Ro(i.sub(n));return e.vertexNode=i.add(a.mul(this.thicknessNode).mul(i.w).mul(s)),e.colorNode=Cn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const aT=cn(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),oT=cn(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),uT=cn(([e,t])=>{const r=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),s=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lT=cn(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),dT=cn(([e,t])=>{const r=Pn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=Pn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=r.mul(e),e=lT(e),(e=s.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cT=Pn(Rn(1.6605,-.1246,-.0182),Rn(-.5876,1.1329,-.1006),Rn(-.0728,-.0083,1.1187)),hT=Pn(Rn(.6274,.0691,.0164),Rn(.3293,.9195,.088),Rn(.0433,.0113,.8956)),pT=cn(([e])=>{const t=Rn(e).toVar(),r=Rn(t.mul(t)).toVar(),s=Rn(r.mul(r)).toVar();return yn(15.5).mul(s.mul(r)).sub(Da(40.14,s.mul(t))).add(Da(31.96,s).sub(Da(6.868,r.mul(t))).add(Da(.4298,r).add(Da(.1191,t).sub(.00232))))}),gT=cn(([e,t])=>{const r=Rn(e).toVar(),s=Pn(Rn(.856627153315983,.137318972929847,.11189821299995),Rn(.0951212405381588,.761241990602591,.0767994186031903),Rn(.0482516061458583,.101439036467562,.811302368396859)),i=Pn(Rn(1.1271005818144368,-.1413297634984383,-.14132976349843826),Rn(-.11060664309660323,1.157823702216272,-.11060664309660294),Rn(-.016493938717834573,-.016493938717834257,1.2519364065950405)),n=yn(-12.47393),a=yn(4.026069);return r.mulAssign(t),r.assign(hT.mul(r)),r.assign(s.mul(r)),r.assign(eu(r,1e-10)),r.assign(To(r)),r.assign(r.sub(n).div(a.sub(n))),r.assign(mu(r,0,1)),r.assign(pT(r)),r.assign(i.mul(r)),r.assign(ou(eu(Rn(0),r),Rn(2.2))),r.assign(cT.mul(r)),r.assign(mu(r,0,1)),r}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),mT=cn(([e,t])=>{const r=yn(.76),s=yn(.15);e=e.mul(t);const i=Jo(e.r,Jo(e.g,e.b)),n=Au(i.lessThan(.08),i.sub(Da(6.25,i.mul(i))),.04);e.subAssign(n);const a=eu(e.r,eu(e.g,e.b));gn(a.lessThan(r),()=>e);const o=Pa(1,r),u=Pa(1,o.mul(o).div(a.add(o.sub(r))));e.mulAssign(u.div(a));const l=Pa(1,Ua(1,s.mul(a.sub(u)).add(1)));return gu(e,Rn(u),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class fT extends ci{static get type(){return"CodeNode"}constructor(e="",t=[],r=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const yT=an(fT).setParameterLength(1,3);class bT extends fT{static get type(){return"FunctionNode"}constructor(e="",t=[],r=""){super(e,t,r)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let r=t.nodeFunction;return void 0===r&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}generate(e,t){super.generate(e);const r=this.getNodeFunction(e),s=r.name,i=r.type,n=e.getCodeFromNode(this,i);""!==s&&(n.name=s);const a=e.getPropertyName(n),o=this.getNodeFunction(e).getCode(a);return n.code=o+"\n","property"===t?a:e.format(`${a}()`,i,t)}}const xT=(e,t=[],r="")=>{for(let e=0;es.call(...e);return i.functionNode=s,i};function TT(e){let t;const r=e.context.getViewZ;return void 0!==r&&(t=r(this)),(t||pc.z).negate()}const _T=cn(([e,t],r)=>{const s=TT(r);return bu(e,t,s)}),vT=cn(([e],t)=>{const r=TT(t);return e.mul(e,r,r).negate().exp().oneMinus()}),NT=cn(([e,t],r)=>{const s=TT(r),i=t.sub(cc.y).max(0).toConst().mul(s).toConst();return e.mul(e,i,i).negate().exp().oneMinus()}),ST=cn(([e,t])=>Cn(t.toFloat().mix(oa.rgb,e.toVec3()),oa.a));let RT=null,ET=null;class AT extends ci{static get type(){return"RangeNode"}constructor(e=yn(),t=yn()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),s=e.getTypeLength(Ks(t.value)),i=e.getTypeLength(Ks(r.value));return s>i?s:i}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new Hl('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let r=null;if(t.count>1){const i=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),a=i.value,o=n.value,u=e.getTypeLength(Ks(a)),d=e.getTypeLength(Ks(o));RT=RT||new s,ET=ET||new s,RT.setScalar(0),ET.setScalar(0),1===u?RT.setScalar(a):a.isColor?RT.set(a.r,a.g,a.b,1):RT.set(a.x,a.y,a.z||0,a.w||0),1===d?ET.setScalar(o):o.isColor?ET.set(o.r,o.g,o.b,1):ET.set(o.x,o.y,o.z||0,o.w||0);const c=4,h=c*t.count,p=new Float32Array(h);for(let e=0;enew CT(e,t),BT=MT("numWorkgroups","uvec3"),LT=MT("workgroupId","uvec3"),FT=MT("globalId","uvec3"),PT=MT("localId","uvec3"),DT=MT("subgroupSize","uint");class UT extends ci{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){const{scope:t}=this,{renderer:r}=e;!0===r.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}}const IT=an(UT);class OT extends hi{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r;const s=e.context.assign;if(r=super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}class VT extends ci{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new OT(this,e)}generate(e){const t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class kT extends ci{static get type(){return"AtomicFunctionNode"}constructor(e,t,r){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),r=t.parents,s=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.pointerNode,o=this.valueNode,u=[];u.push(`&${a.build(e,n)}`),null!==o&&u.push(o.build(e,n));const l=`${e.getMethod(s,i)}( ${u.join(", ")} )`;if(!(!!r&&(1===r.length&&!0===r[0].isStackNode)))return void 0===t.constNode&&(t.constNode=Cl(l,i).toConst()),t.constNode.build(e);e.addLineFlowCode(l,this)}}kT.ATOMIC_LOAD="atomicLoad",kT.ATOMIC_STORE="atomicStore",kT.ATOMIC_ADD="atomicAdd",kT.ATOMIC_SUB="atomicSub",kT.ATOMIC_MAX="atomicMax",kT.ATOMIC_MIN="atomicMin",kT.ATOMIC_AND="atomicAnd",kT.ATOMIC_OR="atomicOr",kT.ATOMIC_XOR="atomicXor";const GT=an(kT),zT=(e,t,r)=>GT(e,t,r).toStack();class $T extends gi{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=r}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,r=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(r)?0:e.getTypeLength(r))?t:r}generateNodeType(e){const t=this.method;return t===$T.SUBGROUP_ELECT?"bool":t===$T.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const r=this.method,s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=[];if(r===$T.SUBGROUP_BROADCAST||r===$T.SUBGROUP_SHUFFLE||r===$T.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(n.build(e,s),a.build(e,"float"===t?"int":s))}else r===$T.SUBGROUP_SHUFFLE_XOR||r===$T.SUBGROUP_SHUFFLE_DOWN||r===$T.SUBGROUP_SHUFFLE_UP?o.push(n.build(e,s),a.build(e,"uint")):(null!==n&&o.push(n.build(e,i)),null!==a&&o.push(a.build(e,i)));const u=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(r,s)}${u}`,s,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}$T.SUBGROUP_ELECT="subgroupElect",$T.SUBGROUP_BALLOT="subgroupBallot",$T.SUBGROUP_ADD="subgroupAdd",$T.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",$T.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",$T.SUBGROUP_MUL="subgroupMul",$T.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",$T.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",$T.SUBGROUP_AND="subgroupAnd",$T.SUBGROUP_OR="subgroupOr",$T.SUBGROUP_XOR="subgroupXor",$T.SUBGROUP_MIN="subgroupMin",$T.SUBGROUP_MAX="subgroupMax",$T.SUBGROUP_ALL="subgroupAll",$T.SUBGROUP_ANY="subgroupAny",$T.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",$T.QUAD_SWAP_X="quadSwapX",$T.QUAD_SWAP_Y="quadSwapY",$T.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",$T.SUBGROUP_BROADCAST="subgroupBroadcast",$T.SUBGROUP_SHUFFLE="subgroupShuffle",$T.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",$T.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",$T.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",$T.QUAD_BROADCAST="quadBroadcast";const WT=un($T,$T.SUBGROUP_ELECT).setParameterLength(0),HT=un($T,$T.SUBGROUP_BALLOT).setParameterLength(1),qT=un($T,$T.SUBGROUP_ADD).setParameterLength(1),jT=un($T,$T.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),XT=un($T,$T.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),KT=un($T,$T.SUBGROUP_MUL).setParameterLength(1),QT=un($T,$T.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),YT=un($T,$T.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ZT=un($T,$T.SUBGROUP_AND).setParameterLength(1),JT=un($T,$T.SUBGROUP_OR).setParameterLength(1),e_=un($T,$T.SUBGROUP_XOR).setParameterLength(1),t_=un($T,$T.SUBGROUP_MIN).setParameterLength(1),r_=un($T,$T.SUBGROUP_MAX).setParameterLength(1),s_=un($T,$T.SUBGROUP_ALL).setParameterLength(0),i_=un($T,$T.SUBGROUP_ANY).setParameterLength(0),n_=un($T,$T.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),a_=un($T,$T.QUAD_SWAP_X).setParameterLength(1),o_=un($T,$T.QUAD_SWAP_Y).setParameterLength(1),u_=un($T,$T.QUAD_SWAP_DIAGONAL).setParameterLength(1),l_=un($T,$T.SUBGROUP_BROADCAST).setParameterLength(2),d_=un($T,$T.SUBGROUP_SHUFFLE).setParameterLength(2),c_=un($T,$T.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),h_=un($T,$T.SUBGROUP_SHUFFLE_UP).setParameterLength(2),p_=un($T,$T.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),g_=un($T,$T.QUAD_BROADCAST).setParameterLength(1);let m_;function f_(e){m_=m_||new WeakMap;let t=m_.get(e);return void 0===t&&m_.set(e,t={}),t}function y_(e){const t=f_(e);return t.shadowMatrix||(t.shadowMatrix=Sa("mat4").setGroup(_a).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function b_(e,t=cc){const r=y_(e).mul(t);return r.xyz.div(r.w)}function x_(e){const t=f_(e);return t.position||(t.position=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.matrixWorld)))}function T_(e){const t=f_(e);return t.targetPosition||(t.targetPosition=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.target.matrixWorld)))}function __(e){const t=f_(e);return t.viewPosition||(t.viewPosition=Sa(new r).setGroup(_a).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new r,s.value.setFromMatrixPosition(e.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const v_=e=>Dd.transformDirection(x_(e).sub(T_(e))),N_=(e,t)=>{for(const r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},S_=new WeakMap,R_=[];class E_ extends ci{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Vn("vec3","totalDiffuse"),this.totalSpecularNode=Vn("vec3","totalSpecular"),this.outgoingLightNode=Vn("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let t=0;te.sort((e,t)=>e.id-t.id))(this._lights),i=e.renderer.library;for(const e of s)if(e.isNode)t.push(tn(e));else{let s=null;if(null!==r&&(s=N_(e.id,r)),null===s){const t=i.getLightNodeClass(e.constructor);if(null===t){d(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}!1===S_.has(e)&&S_.set(e,new t(e)),s=S_.get(e)}t.push(s)}this._lightNodes=t}setupDirectLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.direct({...r,lightNode:t,reflectedLight:i},e)}setupDirectRectAreaLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.directRectArea({...r,lightNode:t,reflectedLight:i},e)}setupLights(e,t){for(const r of t)r.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode;const s=e.context,i=s.lightingModel,n=e.getNodeProperties(this);if(i){const{totalDiffuseNode:t,totalSpecularNode:a}=this;s.outgoingLight=r;const o=e.addStack();n.nodes=o.nodes,i.start(e);const{backdrop:u,backdropAlpha:l}=s,{directDiffuse:d,directSpecular:c,indirectDiffuse:h,indirectSpecular:p}=s.reflectedLight;let g=d.add(h);null!==u&&(g=Rn(null!==l?l.mix(g,u):u)),t.assign(g),a.assign(c.add(p)),r.assign(t.add(a)),i.finish(e),r=r.bypass(e.removeStack())}else n.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class A_ extends ci{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=ri.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){w_.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||cc)}}const w_=Vn("vec3","shadowPositionWorld");function C_(t,r={}){return r.toneMapping=t.toneMapping,r.toneMappingExposure=t.toneMappingExposure,r.outputColorSpace=t.outputColorSpace,r.renderTarget=t.getRenderTarget(),r.activeCubeFace=t.getActiveCubeFace(),r.activeMipmapLevel=t.getActiveMipmapLevel(),r.renderObjectFunction=t.getRenderObjectFunction(),r.pixelRatio=t.getPixelRatio(),r.mrt=t.getMRT(),r.clearColor=t.getClearColor(r.clearColor||new e),r.clearAlpha=t.getClearAlpha(),r.autoClear=t.autoClear,r.scissorTest=t.getScissorTest(),r}function M_(e,t){return t=C_(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function B_(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function L_(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function F_(e,t){return t=L_(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function P_(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function D_(e,t,r){return r=F_(t,r=M_(e,r))}function U_(e,t,r){B_(e,r),P_(t,r)}var I_=Object.freeze({__proto__:null,resetRendererAndSceneState:D_,resetRendererState:M_,resetSceneState:F_,restoreRendererAndSceneState:U_,restoreRendererState:B_,restoreSceneState:P_,saveRendererAndSceneState:function(e,t,r={}){return r=L_(t,r=C_(e,r))},saveRendererState:C_,saveSceneState:L_});const O_=new WeakMap,V_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let s=Kl(e,t.xy).setName("t_basic");return e.isArrayTexture&&(s=s.depth(r)),s.compare(t.z)}),k_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=qc("radius","float",r).setGroup(_a),o=_n(1).div(n),u=a.mul(o.x),l=_x(dd.xy).mul(6.28318530718);return Fa(i(t.xy.add(vx(0,5,l).mul(u)),t.z),i(t.xy.add(vx(1,5,l).mul(u)),t.z),i(t.xy.add(vx(2,5,l).mul(u)),t.z),i(t.xy.add(vx(3,5,l).mul(u)),t.z),i(t.xy.add(vx(4,5,l).mul(u)),t.z)).mul(.2)}),G_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=_n(1).div(n),o=a.x,u=a.y,l=t.xy,d=Eo(l.mul(n).add(.5));return l.subAssign(d.mul(a)),Fa(i(l,t.z),i(l.add(_n(o,0)),t.z),i(l.add(_n(0,u)),t.z),i(l.add(a),t.z),gu(i(l.add(_n(o.negate(),0)),t.z),i(l.add(_n(o.mul(2),0)),t.z),d.x),gu(i(l.add(_n(o.negate(),u)),t.z),i(l.add(_n(o.mul(2),u)),t.z),d.x),gu(i(l.add(_n(0,u.negate())),t.z),i(l.add(_n(0,u.mul(2))),t.z),d.y),gu(i(l.add(_n(o,u.negate())),t.z),i(l.add(_n(o,u.mul(2))),t.z),d.y),gu(gu(i(l.add(_n(o.negate(),u.negate())),t.z),i(l.add(_n(o.mul(2),u.negate())),t.z),d.x),gu(i(l.add(_n(o.negate(),u.mul(2))),t.z),i(l.add(_n(o.mul(2),u.mul(2))),t.z),d.x),d.y)).mul(1/9)}),z_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r},s)=>{let i=Kl(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(r)),i=i.rg;const n=i.x,a=eu(1e-7,i.y.mul(i.y)),o=s.renderer.reversedDepthBuffer?tu(n,t.z):tu(t.z,n),u=yn(1).toVar();return gn(o.notEqual(1),()=>{const e=t.z.sub(n);let r=a.div(a.add(e.mul(e)));r=mu(Pa(r,.3).div(.65)),u.assign(eu(o,r))}),u}),$_=e=>{let t=O_.get(e);return void 0===t&&(t=new vg,t.colorNode=Cn(0,0,0,1),t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.blending=re,t.fog=!1,O_.set(e,t)),t},W_=e=>{const t=O_.get(e);void 0!==t&&(t.dispose(),O_.delete(e))},H_=new Ty,q_=[],j_=(e,t,r,s)=>{q_[0]=e,q_[1]=t;let i=H_.get(q_);return void 0!==i&&i.shadowType===r&&i.useVelocity===s||(i=(i,n,a,o,u,l,...d)=>{(!0===i.castShadow||i.receiveShadow&&r===pt)&&(s&&(Ys(i).useVelocity=!0),i.onBeforeShadow(e,i,a,t.camera,o,n.overrideMaterial,l),e.renderObject(i,n,a,o,u,l,...d),i.onAfterShadow(e,i,a,t.camera,o,n.overrideMaterial,l))},i.shadowType=r,i.useVelocity=s,H_.set(q_,i)),q_[0]=null,q_[1]=null,i},X_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanVertical"),a=yn(0).toVar("squareMeanVertical"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(Fa(dd.xy,_n(0,l).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),d=d.x,n.addAssign(d),a.addAssign(d.mul(d))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),K_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanHorizontal"),a=yn(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(Fa(dd.xy,_n(l,0).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),n.addAssign(d.x),a.addAssign(Fa(d.y.mul(d.y),d.x.mul(d.x)))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),Q_=[V_,k_,G_,z_];let Y_;const Z_=new gx;class J_ extends A_{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n}){const a=s.x.greaterThanEqual(0).and(s.x.lessThanEqual(1)).and(s.y.greaterThanEqual(0)).and(s.y.lessThanEqual(1)).and(s.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n});return a.select(o,yn(1))}setupShadowCoord(e,t){const{shadow:r}=this,{renderer:s}=e,i=r.biasNode||qc("bias","float",r).setGroup(_a);let n,a=t;if(r.camera.isOrthographicCamera||!0!==s.logarithmicDepthBuffer)a=a.xyz.div(a.w),n=a.z;else{const e=a.w;a=a.xy.div(e);const t=qc("near","float",r.camera).setGroup(_a),s=qc("far","float",r.camera).setGroup(_a);n=ig(e.negate(),t,s)}return a=Rn(a.x,a.y.oneMinus(),s.reversedDepthBuffer?n.sub(i):n.add(i)),a}getShadowFilterFn(e){return Q_[e]}setupRenderTarget(e,t){const r=new Z(e.mapSize.width,e.mapSize.height);r.name="ShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return s.texture.name="ShadowMap",s.texture.type=e.mapType,s.depthTexture=r,{shadowMap:s,depthTexture:r}}setupShadow(e){const{renderer:t,camera:r}=e,{light:s,shadow:i}=this,{depthTexture:n,shadowMap:a}=this.setupRenderTarget(i,e),o=t.shadowMap.type,u=t.hasCompatibility(E.TEXTURE_COMPARE);if(o!==ct&&o!==ht||!u?(n.minFilter=B,n.magFilter=B):(n.minFilter=le,n.magFilter=le),i.camera.coordinateSystem=r.coordinateSystem,i.camera.updateProjectionMatrix(),o===pt&&!0!==i.isPointLightShadow){n.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}));let t=Kl(n);n.isArrayTexture&&(t=t.depth(this.depthLayer));let r=Kl(this.vsmShadowMapVertical.texture);n.isArrayTexture&&(r=r.depth(this.depthLayer));const s=qc("blurSamples","float",i).setGroup(_a),o=qc("radius","float",i).setGroup(_a),u=qc("mapSize","vec2",i).setGroup(_a);let l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new vg);l.fragmentNode=X_({samples:s,radius:o,size:u,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMVertical",l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new vg),l.fragmentNode=K_({samples:s,radius:o,size:u,shadowPass:r,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMHorizontal"}const l=qc("intensity","float",i).setGroup(_a),d=qc("normalBias","float",i).setGroup(_a),c=y_(s),h=Rc.mul(d);let p;if(!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld)p=c.mul(w_.add(h));else{p=Sa("mat4").onObjectUpdate(({object:e},t)=>t.value.multiplyMatrices(c.value,e.matrixWorld)).mul(lc).add(c.mul(Cn(h,0)))}const g=this.setupShadowCoord(e,p),m=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===m)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const f=o===pt&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:n,y=this.setupShadowFilter(e,{filterFn:m,shadowTexture:a.texture,depthTexture:f,shadowCoord:g,shadow:i,depthLayer:this.depthLayer});let b,x;!0===t.shadowMap.transmitted&&(a.texture.isCubeTexture?b=$c(a.texture,g.xyz):(b=Kl(a.texture,g),n.isArrayTexture&&(b=b.depth(this.depthLayer)))),x=b?gu(1,y.rgb.mix(b,1),l.mul(b.a)).toVar():gu(1,y,l).toVar(),this.shadowMap=a,this.shadow.map=a;const T=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return b&&x.toInspector(`${T} / Color`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture):Kl(this.shadowMap.texture)),x.toInspector(`${T} / Depth`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture).r.oneMinus():Ql(this.shadowMap.depthTexture,kl().mul(zl(Kl(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return cn(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),null===r&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e;t.updateMatrices(s),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);const a=n.name;n.name=`Shadow Map [ ${s.name||"ID: "+s.id} ]`,i.render(n,t.camera),n.name=a}updateShadow(e){const{shadowMap:t,light:r,shadow:s}=this,{renderer:i,scene:n,camera:a}=e,o=i.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u;const l=s.camera.layers.mask;4294967294&s.camera.layers.mask||(s.camera.layers.mask=a.layers.mask);const d=i.getRenderObjectFunction(),c=i.getMRT(),h=!!c&&c.has("velocity");Y_=D_(i,n,Y_),n.overrideMaterial=$_(r),i.setRenderObjectFunction(j_(i,s,o,h)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(d),o===pt&&!0!==s.isPointLightShadow&&this.vsmPass(i),s.camera.layers.mask=l,U_(i,n,Y_)}vsmPass(e){const{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),Z_.material=this.vsmMaterialVertical,Z_.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Z_.material=this.vsmMaterialHorizontal,Z_.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,W_(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const ev=(e,t)=>new J_(e,t),tv=new e,rv=new a,sv=new r,iv=new r,nv=[new r(1,0,0),new r(-1,0,0),new r(0,-1,0),new r(0,1,0),new r(0,0,1),new r(0,0,-1)],av=[new r(0,-1,0),new r(0,-1,0),new r(0,0,-1),new r(0,0,1),new r(0,-1,0),new r(0,-1,0)],ov=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],uv=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],lv=cn(({depthTexture:e,bd3D:t,dp:r})=>$c(e,t).compare(r)),dv=cn(({depthTexture:e,bd3D:t,dp:r,shadow:s})=>{const i=qc("radius","float",s).setGroup(_a),n=qc("mapSize","vec2",s).setGroup(_a),a=i.div(n.x),o=Vo(t),u=Ro(au(t,o.x.greaterThan(o.z).select(Rn(0,1,0),Rn(1,0,0)))),l=au(t,u),d=_x(dd.xy).mul(6.28318530718),c=vx(0,5,d),h=vx(1,5,d),p=vx(2,5,d),g=vx(3,5,d),m=vx(4,5,d);return $c(e,t.add(u.mul(c.x).add(l.mul(c.y)).mul(a))).compare(r).add($c(e,t.add(u.mul(h.x).add(l.mul(h.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(p.x).add(l.mul(p.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(g.x).add(l.mul(g.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(m.x).add(l.mul(m.y)).mul(a))).compare(r)).mul(.2)}),cv=cn(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:s},i)=>{const n=r.xyz.toConst(),a=n.abs().toConst(),o=a.x.max(a.y).max(a.z),u=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.near),l=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.far),d=qc("bias","float",s).setGroup(_a),c=yn(1).toVar();return gn(o.sub(l).lessThanEqual(0).and(o.sub(u).greaterThanEqual(0)),()=>{let r;i.renderer.reversedDepthBuffer?(r=rg(o.negate(),u,l),r.subAssign(d)):(r=tg(o.negate(),u,l),r.addAssign(d));const a=n.normalize();c.assign(e({depthTexture:t,bd3D:a,dp:r,shadow:s}))}),c});class hv extends J_{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===gt?lv:dv}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i}){return cv({filterFn:t,depthTexture:r,shadowCoord:s,shadow:i})}setupRenderTarget(e,t){const r=new mt(e.mapSize.width);r.name="PointShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createCubeRenderTarget(e.mapSize.width);return s.texture.name="PointShadowMap",s.depthTexture=r,{shadowMap:s,depthTexture:r}}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e,a=t.camera,o=t.matrix,u=i.coordinateSystem===h,l=u?nv:ov,d=u?av:uv;r.setSize(t.mapSize.width,t.mapSize.width);const c=i.autoClear,p=i.getClearColor(tv),g=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){i.setRenderTarget(r,e),i.clear();const u=s.distance||a.far;u!==a.far&&(a.far=u,a.updateProjectionMatrix()),sv.setFromMatrixPosition(s.matrixWorld),a.position.copy(sv),iv.copy(a.position),iv.add(l[e]),a.up.copy(d[e]),a.lookAt(iv),a.updateMatrixWorld(),o.makeTranslation(-sv.x,-sv.y,-sv.z),rv.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(rv,a.coordinateSystem,a.reversedDepth);const c=n.name;n.name=`Point Light Shadow [ ${s.name||"ID: "+s.id} ] - Face ${e+1}`,i.render(n,a),n.name=c}i.autoClear=c,i.setClearColor(p,g)}}const pv=(e,t)=>new hv(e,t);class gv extends Op{static get type(){return"AnalyticLightNode"}constructor(t=null){super(),this.light=t,this.color=new e,this.colorNode=t&&t.colorNode||Sa(this.color).setGroup(_a),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=ri.FRAME,t&&t.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},t.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,null!==this.baseColorNode&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return __(this.light).sub(e.context.positionView||pc)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return ev(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let r=this.shadowColorNode;if(null===r){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?tn(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=r=this.colorNode.mul(t),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const mv=cn(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{const s=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(s.mul(e.div(t).pow4().oneMinus().clamp().pow2()),s)}),fv=({color:e,lightVector:t,cutoffDistance:r,decayExponent:s})=>{const i=t.normalize(),n=t.length(),a=mv({lightDistance:n,cutoffDistance:r,decayExponent:s});return{lightDirection:i,lightColor:e.mul(a)}};class yv extends gv{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(2).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return pv(this.light)}setupDirect(e){return fv({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const bv=cn(([e=kl()])=>{const t=e.mul(2),r=t.x.floor(),s=t.y.floor();return r.add(s).mod(2).sign()}),xv=cn(([e=kl()],{renderer:t,material:r})=>{const s=pu(e.mul(2).sub(1));let i;if(r.alphaToCoverage&&t.currentSamples>0){const e=yn(s.fwidth()).toVar();i=bu(e.oneMinus(),e.add(1),s).oneMinus()}else i=Au(s.greaterThan(1),0,1);return i}),Tv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=Tn(e).toVar();return Au(n,i,s)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),_v=cn(([e,t])=>{const r=Tn(t).toVar(),s=yn(e).toVar();return Au(r,s.negate(),s)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),vv=cn(([e])=>{const t=yn(e).toVar();return bn(No(t))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Nv=cn(([e,t])=>{const r=yn(e).toVar();return t.assign(vv(r)),r.sub(yn(t))}),Sv=Vb([cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=yn(s).toVar(),l=yn(r).toVar(),d=yn(t).toVar(),c=yn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=Rn(s).toVar(),l=Rn(r).toVar(),d=Rn(t).toVar(),c=Rn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),Rv=Vb([cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=yn(o).toVar(),m=yn(a).toVar(),f=yn(n).toVar(),y=yn(i).toVar(),b=yn(s).toVar(),x=yn(r).toVar(),T=yn(t).toVar(),_=yn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=Rn(o).toVar(),m=Rn(a).toVar(),f=Rn(n).toVar(),y=Rn(i).toVar(),b=Rn(s).toVar(),x=Rn(r).toVar(),T=Rn(t).toVar(),_=Rn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),Ev=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=xn(e).toVar(),a=xn(n.bitAnd(xn(7))).toVar(),o=yn(Tv(a.lessThan(xn(4)),i,s)).toVar(),u=yn(Da(2,Tv(a.lessThan(xn(4)),s,i))).toVar();return _v(o,Tn(a.bitAnd(xn(1)))).add(_v(u,Tn(a.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Av=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=xn(e).toVar(),u=xn(o.bitAnd(xn(15))).toVar(),l=yn(Tv(u.lessThan(xn(8)),a,n)).toVar(),d=yn(Tv(u.lessThan(xn(4)),n,Tv(u.equal(xn(12)).or(u.equal(xn(14))),a,i))).toVar();return _v(l,Tn(u.bitAnd(xn(1)))).add(_v(d,Tn(u.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),wv=Vb([Ev,Av]),Cv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=An(e).toVar();return Rn(wv(n.x,i,s),wv(n.y,i,s),wv(n.z,i,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Mv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=An(e).toVar();return Rn(wv(o.x,a,n,i),wv(o.y,a,n,i),wv(o.z,a,n,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Bv=Vb([Cv,Mv]),Lv=cn(([e])=>{const t=yn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Fv=cn(([e])=>{const t=yn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Pv=Vb([Lv,cn(([e])=>{const t=Rn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Dv=Vb([Fv,cn(([e])=>{const t=Rn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Uv=cn(([e,t])=>{const r=bn(t).toVar(),s=xn(e).toVar();return s.shiftLeft(r).bitOr(s.shiftRight(bn(32).sub(r)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Iv=cn(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(Uv(r,bn(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(Uv(r,bn(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(4))),t.addAssign(e)}),Ov=cn(([e,t,r])=>{const s=xn(r).toVar(),i=xn(t).toVar(),n=xn(e).toVar();return s.bitXorAssign(i),s.subAssign(Uv(i,bn(14))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(11))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(25))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(16))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(4))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(14))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Vv=cn(([e])=>{const t=xn(e).toVar();return yn(t).div(yn(xn(bn(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),kv=cn(([e])=>{const t=yn(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Gv=Vb([cn(([e])=>{const t=bn(e).toVar(),r=xn(xn(1)).toVar(),s=xn(xn(bn(3735928559)).add(r.shiftLeft(xn(2))).add(xn(13))).toVar();return Ov(s.add(xn(t)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(xn(2)).toVar(),n=xn().toVar(),a=xn().toVar(),o=xn().toVar();return n.assign(a.assign(o.assign(xn(bn(3735928559)).add(i.shiftLeft(xn(2))).add(xn(13))))),n.addAssign(xn(s)),a.addAssign(xn(r)),Ov(n,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(xn(3)).toVar(),o=xn().toVar(),u=xn().toVar(),l=xn().toVar();return o.assign(u.assign(l.assign(xn(bn(3735928559)).add(a.shiftLeft(xn(2))).add(xn(13))))),o.addAssign(xn(n)),u.addAssign(xn(i)),l.addAssign(xn(s)),Ov(o,u,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cn(([e,t,r,s])=>{const i=bn(s).toVar(),n=bn(r).toVar(),a=bn(t).toVar(),o=bn(e).toVar(),u=xn(xn(4)).toVar(),l=xn().toVar(),d=xn().toVar(),c=xn().toVar();return l.assign(d.assign(c.assign(xn(bn(3735928559)).add(u.shiftLeft(xn(2))).add(xn(13))))),l.addAssign(xn(o)),d.addAssign(xn(a)),c.addAssign(xn(n)),Iv(l,d,c),l.addAssign(xn(i)),Ov(l,d,c)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),cn(([e,t,r,s,i])=>{const n=bn(i).toVar(),a=bn(s).toVar(),o=bn(r).toVar(),u=bn(t).toVar(),l=bn(e).toVar(),d=xn(xn(5)).toVar(),c=xn().toVar(),h=xn().toVar(),p=xn().toVar();return c.assign(h.assign(p.assign(xn(bn(3735928559)).add(d.shiftLeft(xn(2))).add(xn(13))))),c.addAssign(xn(l)),h.addAssign(xn(u)),p.addAssign(xn(o)),Iv(c,h,p),c.addAssign(xn(a)),h.addAssign(xn(n)),Ov(c,h,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),zv=Vb([cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(Gv(s,r)).toVar(),n=An().toVar();return n.x.assign(i.bitAnd(bn(255))),n.y.assign(i.shiftRight(bn(8)).bitAnd(bn(255))),n.z.assign(i.shiftRight(bn(16)).bitAnd(bn(255))),n}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(Gv(n,i,s)).toVar(),o=An().toVar();return o.x.assign(a.bitAnd(bn(255))),o.y.assign(a.shiftRight(bn(8)).bitAnd(bn(255))),o.z.assign(a.shiftRight(bn(16)).bitAnd(bn(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),$v=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=yn(Sv(wv(Gv(r,s),i,n),wv(Gv(r.add(bn(1)),s),i.sub(1),n),wv(Gv(r,s.add(bn(1))),i,n.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=yn(Rv(wv(Gv(r,s,i),n,a,o),wv(Gv(r.add(bn(1)),s,i),n.sub(1),a,o),wv(Gv(r,s.add(bn(1)),i),n,a.sub(1),o),wv(Gv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),wv(Gv(r,s,i.add(bn(1))),n,a,o.sub(1)),wv(Gv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),wv(Gv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),Wv=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=Rn(Sv(Bv(zv(r,s),i,n),Bv(zv(r.add(bn(1)),s),i.sub(1),n),Bv(zv(r,s.add(bn(1))),i,n.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=Rn(Rv(Bv(zv(r,s,i),n,a,o),Bv(zv(r.add(bn(1)),s,i),n.sub(1),a,o),Bv(zv(r,s.add(bn(1)),i),n,a.sub(1),o),Bv(zv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),Bv(zv(r,s,i.add(bn(1))),n,a,o.sub(1)),Bv(zv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),Bv(zv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),Hv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Vv(Gv(r))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Vv(Gv(r,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Vv(Gv(r,s,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Vv(Gv(r,s,i,n))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),qv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Rn(Vv(Gv(r,bn(0))),Vv(Gv(r,bn(1))),Vv(Gv(r,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Rn(Vv(Gv(r,s,bn(0))),Vv(Gv(r,s,bn(1))),Vv(Gv(r,s,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Rn(Vv(Gv(r,s,i,bn(0))),Vv(Gv(r,s,i,bn(1))),Vv(Gv(r,s,i,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Rn(Vv(Gv(r,s,i,n,bn(0))),Vv(Gv(r,s,i,n,bn(1))),Vv(Gv(r,s,i,n,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),jv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=yn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul($v(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Xv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul(Wv(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Kv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar();return _n(jv(o,a,n,i),jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Qv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(Xv(o,a,n,i)).toVar(),l=yn(jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i)).toVar();return Cn(u,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Yv=Vb([cn(([e,t,r,s,i,n,a])=>{const o=bn(a).toVar(),u=yn(n).toVar(),l=bn(i).toVar(),d=bn(s).toVar(),c=bn(r).toVar(),h=bn(t).toVar(),p=_n(e).toVar(),g=Rn(qv(_n(h.add(d),c.add(l)))).toVar(),m=_n(g.x,g.y).toVar();m.subAssign(.5),m.mulAssign(u),m.addAssign(.5);const f=_n(_n(yn(h),yn(c)).add(m)).toVar(),y=_n(f.sub(p)).toVar();return gn(o.equal(bn(2)),()=>Vo(y.x).add(Vo(y.y))),gn(o.equal(bn(3)),()=>eu(Vo(y.x),Vo(y.y))),nu(y,y)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cn(([e,t,r,s,i,n,a,o,u])=>{const l=bn(u).toVar(),d=yn(o).toVar(),c=bn(a).toVar(),h=bn(n).toVar(),p=bn(i).toVar(),g=bn(s).toVar(),m=bn(r).toVar(),f=bn(t).toVar(),y=Rn(e).toVar(),b=Rn(qv(Rn(f.add(p),m.add(h),g.add(c)))).toVar();b.subAssign(.5),b.mulAssign(d),b.addAssign(.5);const x=Rn(Rn(yn(f),yn(m),yn(g)).add(b)).toVar(),T=Rn(x.sub(y)).toVar();return gn(l.equal(bn(2)),()=>Vo(T.x).add(Vo(T.y)).add(Vo(T.z))),gn(l.equal(bn(3)),()=>eu(Vo(T.x),Vo(T.y),Vo(T.z))),nu(T,T)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),Zv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();l.assign(Jo(l,r))})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Jv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.y.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),eN=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(r)}).ElseIf(r.lessThan(l.z),()=>{l.z.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tN=Vb([Zv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();d.assign(Jo(d,n))})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),rN=Vb([Jv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.y.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),sN=Vb([eN,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(n)}).ElseIf(n.lessThan(d.z),()=>{d.z.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),iN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=_n(t).toVar(),p=_n(r).toVar(),g=_n(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(Rn(v,0),x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=Rn(t).toVar(),p=Rn(r).toVar(),g=Rn(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(v,x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aN=cn(([e])=>{const t=e.y,r=e.z,s=Rn().toVar();return gn(t.lessThan(1e-4),()=>{s.assign(Rn(r,r,r))}).Else(()=>{let i=e.x;i=i.sub(No(i)).mul(6).toVar();const n=bn(Xo(i)),a=i.sub(yn(n)),o=r.mul(t.oneMinus()),u=r.mul(t.mul(a).oneMinus()),l=r.mul(t.mul(a.oneMinus()).oneMinus());gn(n.equal(bn(0)),()=>{s.assign(Rn(r,l,o))}).ElseIf(n.equal(bn(1)),()=>{s.assign(Rn(u,r,o))}).ElseIf(n.equal(bn(2)),()=>{s.assign(Rn(o,r,l))}).ElseIf(n.equal(bn(3)),()=>{s.assign(Rn(o,u,r))}).ElseIf(n.equal(bn(4)),()=>{s.assign(Rn(l,o,r))}).Else(()=>{s.assign(Rn(r,o,u))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),oN=cn(([e])=>{const t=Rn(e).toVar(),r=yn(t.x).toVar(),s=yn(t.y).toVar(),i=yn(t.z).toVar(),n=yn(Jo(r,Jo(s,i))).toVar(),a=yn(eu(r,eu(s,i))).toVar(),o=yn(a.sub(n)).toVar(),u=yn().toVar(),l=yn().toVar(),d=yn().toVar();return d.assign(a),gn(a.greaterThan(0),()=>{l.assign(o.div(a))}).Else(()=>{l.assign(0)}),gn(l.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{gn(r.greaterThanEqual(a),()=>{u.assign(s.sub(i).div(o))}).ElseIf(s.greaterThanEqual(a),()=>{u.assign(Fa(2,i.sub(r).div(o)))}).Else(()=>{u.assign(Fa(4,r.sub(s).div(o)))}),u.mulAssign(1/6),gn(u.lessThan(0),()=>{u.addAssign(1)})}),Rn(u,l,d)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),uN=cn(([e])=>{const t=Rn(e).toVar(),r=wn(Ga(t,Rn(.04045))).toVar(),s=Rn(t.div(12.92)).toVar(),i=Rn(ou(eu(t.add(Rn(.055)),Rn(0)).div(1.055),Rn(2.4))).toVar();return gu(s,i,r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),lN=(e,t)=>{e=yn(e),t=yn(t);const r=_n(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return bu(e.sub(r),e.add(r),t)},dN=(e,t,r,s)=>gu(e,t,r[s].clamp()),cN=(e,t,r,s,i)=>gu(e,t,lN(r,s[i])),hN=cn(([e,t,r])=>{const s=Ro(e).toVar(),i=Pa(yn(.5).mul(t.sub(r)),cc).div(s).toVar(),n=Pa(yn(-.5).mul(t.sub(r)),cc).div(s).toVar(),a=Rn().toVar();a.x=s.x.greaterThan(yn(0)).select(i.x,n.x),a.y=s.y.greaterThan(yn(0)).select(i.y,n.y),a.z=s.z.greaterThan(yn(0)).select(i.z,n.z);const o=Jo(a.x,a.y,a.z).toVar();return cc.add(s.mul(o)).toVar().sub(r)}),pN=cn(([e,t])=>{const r=e.x,s=e.y,i=e.z;let n=t.element(0).mul(.886227);return n=n.add(t.element(1).mul(1.023328).mul(s)),n=n.add(t.element(2).mul(1.023328).mul(i)),n=n.add(t.element(3).mul(1.023328).mul(r)),n=n.add(t.element(4).mul(.858086).mul(r).mul(s)),n=n.add(t.element(5).mul(.858086).mul(s).mul(i)),n=n.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),n=n.add(t.element(7).mul(.858086).mul(r).mul(i)),n=n.add(t.element(8).mul(.429043).mul(Da(r,r).sub(Da(s,s)))),n});var gN=Object.freeze({__proto__:null,BRDF_GGX:am,BRDF_Lambert:Hg,BasicPointShadowFilter:lv,BasicShadowFilter:V_,Break:Lp,Const:Ou,Continue:()=>Cl("continue").toStack(),DFGLUT:lm,D_GGX:sm,Discard:Ml,EPSILON:ao,F_Schlick:Wg,Fn:cn,HALF_PI:ho,INFINITY:oo,If:gn,Loop:Bp,NodeAccess:ii,NodeShaderStage:ti,NodeType:si,NodeUpdateType:ri,OnBeforeMaterialUpdate:e=>Rx(Sx.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>Rx(Sx.BEFORE_OBJECT,e),OnMaterialUpdate:e=>Rx(Sx.MATERIAL,e),OnObjectUpdate:e=>Rx(Sx.OBJECT,e),PCFShadowFilter:k_,PCFSoftShadowFilter:G_,PI:uo,PI2:lo,PointShadowFilter:dv,Return:()=>Cl("return").toStack(),Schlick_to_F0:hm,ShaderNode:en,Stack:mn,Switch:(...e)=>Si.Switch(...e),TBNViewMatrix:xh,TWO_PI:co,VSMShadowFilter:z_,V_GGX_SmithCorrelated:tm,Var:Iu,VarIntent:Vu,abs:Vo,acesFilmicToneMapping:dT,acos:Do,acosh:Uo,add:Fa,addMethodChaining:Ei,addNodeElement:function(e){d("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:gT,all:po,alphaT:Jn,and:Wa,anisotropy:ea,anisotropyB:ra,anisotropyT:ta,any:go,append:e=>(d("TSL: append() has been renamed to Stack().",new Is),mn(e)),array:Ea,arrayBuffer:e=>new vi(e,"ArrayBuffer"),asin:Fo,asinh:Po,assign:wa,atan:Io,atanh:Oo,atomicAdd:(e,t)=>zT(kT.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>zT(kT.ATOMIC_AND,e,t),atomicFunc:zT,atomicLoad:e=>zT(kT.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>zT(kT.ATOMIC_MAX,e,t),atomicMin:(e,t)=>zT(kT.ATOMIC_MIN,e,t),atomicOr:(e,t)=>zT(kT.ATOMIC_OR,e,t),atomicStore:(e,t)=>zT(kT.ATOMIC_STORE,e,t),atomicSub:(e,t)=>zT(kT.ATOMIC_SUB,e,t),atomicXor:(e,t)=>zT(kT.ATOMIC_XOR,e,t),attenuationColor:ma,attenuationDistance:ga,attribute:Vl,attributeArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ax(e,r,s);return Tp(i,t,e)},backgroundBlurriness:Bx,backgroundIntensity:Lx,backgroundRotation:Fx,batch:Ep,bentNormalView:_h,billboarding:Hb,bitAnd:Xa,bitNot:Ka,bitOr:Qa,bitXor:Ya,bitangentGeometry:mh,bitangentLocal:fh,bitangentView:yh,bitangentWorld:bh,bitcast:yb,blendBurn:mg,blendColor:xg,blendDodge:fg,blendOverlay:bg,blendScreen:yg,blur:pf,bool:Tn,buffer:Zl,bufferAttribute:ul,builtin:sd,builtinAOContext:Fu,builtinShadowContext:Lu,bumpMap:Ch,bvec2:Sn,bvec3:wn,bvec4:Ln,bypass:Rl,cache:Nl,call:Ma,cameraFar:Ld,cameraIndex:Md,cameraNear:Bd,cameraNormalMatrix:Id,cameraPosition:Od,cameraProjectionMatrix:Fd,cameraProjectionMatrixInverse:Pd,cameraViewMatrix:Dd,cameraViewport:Vd,cameraWorldMatrix:Ud,cbrt:hu,cdl:Qx,ceil:So,checker:bv,cineonToneMapping:uT,clamp:mu,clearcoat:qn,clearcoatNormalView:Ec,clearcoatRoughness:jn,clipSpace:oc,code:yT,color:fn,colorSpaceToWorking:Qu,colorToDirection:e=>tn(e).mul(2).sub(1),compute:Tl,computeKernel:xl,computeSkinning:(e,t=null)=>{const r=new wp(e);return r.positionNode=Tp(new q(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinIndexNode=Tp(new q(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinWeightNode=Tp(new q(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.bindMatrixNode=Sa(e.bindMatrix,"mat4"),r.bindMatrixInverseNode=Sa(e.bindMatrixInverse,"mat4"),r.boneMatricesNode=Zl(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),r.toPositionNode=t,tn(r)},context:Cu,convert:In,convertColorSpace:(e,t,r)=>new Xu(tn(e),t,r),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():yx(e,...t),cos:Co,cosh:Mo,countLeadingZeros:vb,countOneBits:Nb,countTrailingZeros:_b,cross:au,cubeTexture:$c,cubeTextureBase:zc,dFdx:Wo,dFdy:Ho,dashSize:ua,debug:Pl,decrement:so,decrementBefore:to,defaultBuildStages:ai,defaultShaderStages:ni,defined:Zi,degrees:fo,deltaTime:Gb,densityFogFactor:vT,depth:ag,depthPass:(e,t,r)=>new iT(iT.DEPTH,e,t,r),determinant:Yo,difference:iu,diffuseColor:Gn,diffuseContribution:zn,directPointLight:fv,directionToColor:vh,directionToFaceDirection:bc,dispersion:fa,disposeShadowMaterial:W_,distance:su,div:Ua,dot:nu,drawIndex:yl,dynamicBufferAttribute:(e,t=null,r=0,s=0)=>ol(e,t,r,s,x),element:Un,emissive:$n,equal:Oa,equirectUV:Bg,exp:yo,exp2:bo,exponentialHeightFogFactor:NT,expression:Cl,faceDirection:yc,faceForward:xu,faceforward:Su,float:yn,floatBitsToInt:e=>new fb(e,"int","float"),floatBitsToUint:bb,floor:No,fog:ST,fract:Eo,frameGroup:Ta,frameId:zb,frontFacing:fc,fwidth:Ko,gain:(e,t)=>e.lessThan(.5)?Rb(e.mul(2),t).div(2):Pa(1,Rb(Da(Pa(1,e),2),t).div(2)),gapSize:la,getConstNodeType:Ji,getCurrentStack:pn,getDirection:lf,getDistanceAttenuation:mv,getGeometryRoughness:Jg,getNormalFromDepth:Tx,getParallaxCorrectNormal:hN,getRoughness:em,getScreenPosition:xx,getShIrradianceAt:pN,getShadowMaterial:$_,getShadowRenderObjectFunction:j_,getTextureIndex:pb,getViewPosition:bx,ggxConvolution:yf,globalId:FT,glsl:(e,t)=>yT(e,t,"glsl"),glslFn:(e,t)=>xT(e,t,"glsl"),grayscale:Hx,greaterThan:Ga,greaterThanEqual:$a,hash:Sb,highpModelNormalViewMatrix:ac,highpModelViewMatrix:nc,hue:Xx,increment:ro,incrementBefore:eo,inspector:Il,instance:vp,instanceIndex:pl,instancedArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ex(e,r,s);return Tp(i,t,i.count)},instancedBufferAttribute:ll,instancedDynamicBufferAttribute:dl,instancedMesh:Sp,int:bn,intBitsToFloat:e=>new fb(e,"float","int"),interleavedGradientNoise:_x,inverse:Zo,inverseSqrt:vo,inversesqrt:Ru,invocationLocalIndex:fl,invocationSubgroupIndex:ml,ior:ca,iridescence:Qn,iridescenceIOR:Yn,iridescenceThickness:Zn,isolate:vl,ivec2:vn,ivec3:En,ivec4:Mn,js:(e,t)=>yT(e,t,"js"),label:Pu,length:Go,lengthSq:pu,lessThan:ka,lessThanEqual:za,lightPosition:x_,lightProjectionUV:b_,lightShadowMatrix:y_,lightTargetDirection:v_,lightTargetPosition:T_,lightViewPosition:__,lightingContext:Gp,lights:(e=[])=>(new E_).setLights(e),linearDepth:og,linearToneMapping:aT,localId:PT,log:xo,log2:To,logarithmicDepthToViewZ:(e,t,r)=>{const s=e.mul(xo(r.div(t)));return yn(Math.E).pow(s).mul(t).negate()},luminance:Kx,mat2:Fn,mat3:Pn,mat4:Dn,matcapUV:ey,materialAO:gp,materialAlphaTest:Lh,materialAnisotropy:Yh,materialAnisotropyVector:mp,materialAttenuationColor:np,materialAttenuationDistance:ip,materialClearcoat:Hh,materialClearcoatNormal:jh,materialClearcoatRoughness:qh,materialColor:Fh,materialDispersion:hp,materialEmissive:Dh,materialEnvIntensity:Pc,materialEnvRotation:Dc,materialIOR:sp,materialIridescence:Zh,materialIridescenceIOR:Jh,materialIridescenceThickness:ep,materialLightMap:pp,materialLineDashOffset:dp,materialLineDashSize:op,materialLineGapSize:up,materialLineScale:ap,materialLineWidth:lp,materialMetalness:$h,materialNormal:Wh,materialOpacity:Uh,materialPointSize:cp,materialReference:Kc,materialReflectivity:Gh,materialRefractionRatio:Fc,materialRotation:Xh,materialRoughness:zh,materialSheen:Kh,materialSheenRoughness:Qh,materialShininess:Ph,materialSpecular:Ih,materialSpecularColor:Vh,materialSpecularIntensity:Oh,materialSpecularStrength:kh,materialThickness:rp,materialTransmission:tp,max:eu,maxMipLevel:Wl,mediumpModelViewMatrix:ic,metalness:Hn,min:Jo,mix:gu,mixElement:_u,mod:Ia,modInt:io,modelDirection:Kd,modelNormalMatrix:tc,modelPosition:Yd,modelRadius:ec,modelScale:Zd,modelViewMatrix:sc,modelViewPosition:Jd,modelViewProjection:fp,modelWorldMatrix:Qd,modelWorldMatrixInverse:rc,morphReference:Ip,mrt:mb,mul:Da,mx_aastep:lN,mx_add:(e,t=yn(0))=>Fa(e,t),mx_atan2:(e=yn(0),t=yn(1))=>Io(e,t),mx_cell_noise_float:(e=kl())=>Hv(e.convert("vec2|vec3")),mx_contrast:(e,t=1,r=.5)=>yn(e).sub(r).mul(t).add(r),mx_divide:(e,t=yn(1))=>Ua(e,t),mx_fractal_noise_float:(e=kl(),t=3,r=2,s=.5,i=1)=>jv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec2:(e=kl(),t=3,r=2,s=.5,i=1)=>Kv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec3:(e=kl(),t=3,r=2,s=.5,i=1)=>Xv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec4:(e=kl(),t=3,r=2,s=.5,i=1)=>Qv(e,bn(t),r,s).mul(i),mx_frame:()=>zb,mx_heighttonormal:(e,t)=>(e=Rn(e),t=yn(t),Ch(e,t)),mx_hsvtorgb:aN,mx_ifequal:(e,t,r,s)=>e.equal(t).mix(r,s),mx_ifgreater:(e,t,r,s)=>e.greaterThan(t).mix(r,s),mx_ifgreatereq:(e,t,r,s)=>e.greaterThanEqual(t).mix(r,s),mx_invert:(e,t=yn(1))=>Pa(t,e),mx_modulo:(e,t=yn(1))=>Ia(e,t),mx_multiply:(e,t=yn(1))=>Da(e,t),mx_noise_float:(e=kl(),t=1,r=0)=>$v(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec3:(e=kl(),t=1,r=0)=>Wv(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec4:(e=kl(),t=1,r=0)=>{e=e.convert("vec2|vec3");return Cn(Wv(e),$v(e.add(_n(19,73)))).mul(t).add(r)},mx_place2d:(e,t=_n(.5,.5),r=_n(1,1),s=yn(0),i=_n(0,0))=>{let n=e;if(t&&(n=n.sub(t)),r&&(n=n.mul(r)),s){const e=s.mul(Math.PI/180),t=e.cos(),r=e.sin();n=_n(n.x.mul(t).sub(n.y.mul(r)),n.x.mul(r).add(n.y.mul(t)))}return t&&(n=n.add(t)),i&&(n=n.add(i)),n},mx_power:(e,t=yn(1))=>ou(e,t),mx_ramp4:(e,t,r,s,i=kl())=>{const n=i.x.clamp(),a=i.y.clamp(),o=gu(e,t,n),u=gu(r,s,n);return gu(o,u,a)},mx_ramplr:(e,t,r=kl())=>dN(e,t,r,"x"),mx_ramptb:(e,t,r=kl())=>dN(e,t,r,"y"),mx_rgbtohsv:oN,mx_rotate2d:(e,t)=>{e=_n(e);const r=(t=yn(t)).mul(Math.PI/180);return iy(e,r)},mx_rotate3d:(e,t,r)=>{e=Rn(e),t=yn(t),r=Rn(r);const s=t.mul(Math.PI/180),i=r.normalize(),n=s.cos(),a=s.sin(),o=yn(1).sub(n);return e.mul(n).add(i.cross(e).mul(a)).add(i.mul(i.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=yn(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},s=t.replace(/^out/,"").toLowerCase();if(void 0!==r[s])return e.element(r[s])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==r[t])return e.element(r[t])}return e},mx_splitlr:(e,t,r,s=kl())=>cN(e,t,r,s,"x"),mx_splittb:(e,t,r,s=kl())=>cN(e,t,r,s,"y"),mx_srgb_texture_to_lin_rec709:uN,mx_subtract:(e,t=yn(0))=>Pa(e,t),mx_timer:()=>kb,mx_transform_uv:(e=1,t=0,r=kl())=>r.mul(e).add(t),mx_unifiednoise2d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>iN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_unifiednoise3d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>nN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_worley_noise_float:(e=kl(),t=1)=>tN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec2:(e=kl(),t=1)=>rN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec3:(e=kl(),t=1)=>sN(e.convert("vec2|vec3"),t,bn(1)),negate:zo,neutralToneMapping:mT,nodeArray:nn,nodeImmutable:on,nodeObject:tn,nodeObjectIntent:rn,nodeObjects:sn,nodeProxy:an,nodeProxyIntent:un,normalFlat:_c,normalGeometry:xc,normalLocal:Tc,normalMap:Rh,normalView:Sc,normalViewGeometry:vc,normalWorld:Rc,normalWorldGeometry:Nc,normalize:Ro,not:qa,notEqual:Va,numWorkgroups:BT,objectDirection:zd,objectGroup:va,objectPosition:Wd,objectRadius:jd,objectScale:Hd,objectViewPosition:qd,objectWorldMatrix:$d,oneMinus:$o,or:Ha,orthographicDepthToViewZ:eg,oscSawtooth:(e=kb)=>e.fract(),oscSine:(e=kb)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=kb)=>e.fract().round(),oscTriangle:(e=kb)=>e.add(.5).fract().mul(2).sub(1).abs(),output:oa,outputStruct:lb,overloadingFn:Vb,packHalf2x16:Cb,packSnorm2x16:Ab,packUnorm2x16:wb,parabola:Rb,parallaxDirection:Th,parallaxUV:(e,t)=>e.sub(Th.mul(t)),parameter:(e,t)=>new sb(e,t),pass:(e,t,r)=>new iT(iT.COLOR,e,t,r),passTexture:(e,t)=>new rT(e,t),pcurve:(e,t,r)=>ou(Ua(ou(e,t),Fa(ou(e,t),ou(Pa(1,e),r))),1/t),perspectiveDepthToViewZ:sg,pmremTexture:Vf,pointShadow:pv,pointUV:Cx,pointWidth:da,positionGeometry:uc,positionLocal:lc,positionPrevious:dc,positionView:pc,positionViewDirection:gc,positionWorld:cc,positionWorldDirection:hc,posterize:Yx,pow:ou,pow2:uu,pow3:lu,pow4:du,premultiplyAlpha:Tg,property:Vn,quadBroadcast:g_,quadSwapDiagonal:u_,quadSwapX:a_,quadSwapY:o_,radians:mo,rand:Tu,range:wT,rangeFogFactor:_T,reciprocal:jo,reference:qc,referenceBuffer:jc,reflect:ru,reflectVector:Oc,reflectView:Uc,reflector:e=>new lx(e),refract:yu,refractVector:Vc,refractView:Ic,reinhardToneMapping:oT,remap:El,remapClamp:Al,renderGroup:_a,renderOutput:Ll,rendererReference:el,replaceDefaultUV:function(e,t=null){return Cu(t,{getUV:"function"==typeof e?e:()=>e})},rotate:iy,rotateUV:$b,roughness:Wn,round:qo,rtt:yx,sRGBTransferEOTF:Hu,sRGBTransferOETF:qu,sample:(e,t=null)=>new Nx(e,tn(t)),sampler:e=>(!0===e.isNode?e:Kl(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:Kl(e)).convert("samplerComparison"),saturate:fu,saturation:qx,screenCoordinate:dd,screenDPR:od,screenSize:ld,screenUV:ud,select:Au,setCurrentStack:hn,setName:Bu,shaderStages:oi,shadow:ev,shadowPositionWorld:w_,shapeCircle:xv,sharedUniformGroup:xa,sheen:Xn,sheenRoughness:Kn,shiftLeft:Za,shiftRight:Ja,shininess:aa,sign:ko,sin:Ao,sinc:(e,t)=>Ao(uo.mul(t.mul(e).sub(1))).div(uo.mul(t.mul(e).sub(1))),sinh:wo,skinning:Cp,smoothstep:bu,smoothstepElement:vu,specularColor:sa,specularColorBlended:ia,specularF90:na,spherizeUV:Wb,split:(e,t)=>new yi(tn(e),t),spritesheetUV:jb,sqrt:_o,stack:nb,step:tu,stepElement:Nu,storage:Tp,storageBarrier:()=>IT("storage").toStack(),storageTexture:Dx,string:(e="")=>new vi(e,"string"),struct:(e,t=null)=>{const r=new ab(e,t),s=(...t)=>{let s=null;if(t.length>0)if(t[0].isNode){s={};const r=Object.keys(e);for(let e=0;eOx(e,t).level(r),texture3DLoad:(...e)=>Ox(...e).setSampler(!1),textureBarrier:()=>IT("texture").toStack(),textureBicubic:Lm,textureBicubicLevel:Bm,textureCubeUV:df,textureLevel:(e,t,r)=>Kl(e,t).level(r),textureLoad:Ql,textureSize:zl,textureStore:(e,t,r)=>{let s;return!0===e.isStorageTextureNode?(s=e.clone(),s.uvNode=t,s.storeNode=r):s=Dx(e,t,r),null!==r&&s.toStack(),s},thickness:pa,time:kb,toneMapping:rl,toneMappingExposure:sl,toonOutlinePass:(t,r,s=new e(0,0,0),i=.003,n=1)=>new nT(t,r,tn(s),tn(i),tn(n)),transformDirection:cu,transformNormal:Ac,transformNormalToView:wc,transformedClearcoatNormalView:Bc,transformedNormalView:Cc,transformedNormalWorld:Mc,transmission:ha,transpose:Qo,triNoise3D:Ub,triplanarTexture:(...e)=>Xb(...e),triplanarTextures:Xb,trunc:Xo,uint:xn,uintBitsToFloat:e=>new fb(e,"float","uint"),uniform:Sa,uniformArray:td,uniformCubeTexture:(e=kc)=>zc(e),uniformFlow:Mu,uniformGroup:ba,uniformTexture:(e=ql)=>Kl(e),unpackHalf2x16:Fb,unpackNormal:Nh,unpackSnorm2x16:Bb,unpackUnorm2x16:Lb,unpremultiplyAlpha:_g,userData:(e,t,r)=>new Vx(e,t,r),uv:kl,uvec2:Nn,uvec3:An,uvec4:Bn,varying:$u,varyingProperty:kn,vec2:_n,vec3:Rn,vec4:Cn,vectorComponents:ui,velocity:Wx,vertexColor:gg,vertexIndex:hl,vertexStage:Wu,vibrance:jx,viewZToLogarithmicDepth:ig,viewZToOrthographicDepth:Jp,viewZToPerspectiveDepth:tg,viewZToReversedOrthographicDepth:(e,t,r)=>e.add(r).div(r.sub(t)),viewZToReversedPerspectiveDepth:rg,viewport:cd,viewportCoordinate:pd,viewportDepthTexture:Yp,viewportLinearDepth:ug,viewportMipTexture:qp,viewportOpaqueMipTexture:Xp,viewportResolution:md,viewportSafeUV:qb,viewportSharedTexture:eT,viewportSize:hd,viewportTexture:Hp,viewportUV:gd,vogelDiskSample:vx,wgsl:(e,t)=>yT(e,t,"wgsl"),wgslFn:(e,t)=>xT(e,t,"wgsl"),workgroupArray:(e,t)=>new VT("Workgroup",e,t),workgroupBarrier:()=>IT("workgroup").toStack(),workgroupId:LT,workingToColorSpace:Ku,xor:ja});const mN=new rb;class fN extends Ry{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,r){const s=this.renderer,i=this.nodes.getBackgroundNode(e)||e.background;let n=!1;if(null===i)s._clearColor.getRGB(mN),mN.a=s._clearColor.a;else if(!0===i.isColor)i.getRGB(mN),mN.a=1,n=!0;else if(!0===i.isNode){const u=this.get(e),l=i;mN.copy(s._clearColor);let d=u.backgroundMesh;if(void 0===d){const h=Cn(l).mul(Lx).context({getUV:()=>Fx.mul(Nc),getTextureLevel:()=>Bx}),p=Fd.element(3).element(3).equal(1),g=Ua(1,Fd.element(1).element(1)).mul(3),m=p.select(lc.mul(g),lc),f=sc.mul(Cn(m,0));let y=Fd.mul(Cn(f.xyz,1));y=y.setZ(y.w);const b=new vg;function x(){i.removeEventListener("dispose",x),d.material.dispose(),d.geometry.dispose()}b.name="Background.material",b.side=F,b.depthTest=!1,b.depthWrite=!1,b.allowOverride=!1,b.fog=!1,b.lights=!1,b.vertexNode=y,b.colorNode=h,u.backgroundMeshNode=h,u.backgroundMesh=d=new oe(new ft(1,32,32),b),d.frustumCulled=!1,d.name="Background.mesh",i.addEventListener("dispose",x)}const c=l.getCacheKey();u.backgroundCacheKey!==c&&(u.backgroundMeshNode.node=Cn(l).mul(Lx),u.backgroundMeshNode.needsUpdate=!0,d.material.needsUpdate=!0,u.backgroundCacheKey=c),t.unshift(d,d.geometry,d.material,0,0,null,null)}else o("Renderer: Unsupported background configuration.",i);const a=s.xr.getEnvironmentBlendMode();if("additive"===a?mN.set(0,0,0,1):"alpha-blend"===a&&mN.set(0,0,0,0),!0===s.autoClear||!0===n){const T=r.clearColorValue;T.r=mN.r,T.g=mN.g,T.b=mN.b,T.a=mN.a,!0!==s.backend.isWebGLBackend&&!0!==s.alpha||(T.r*=T.a,T.g*=T.a,T.b*=T.a),r.depthClearValue=s.getClearDepth(),r.stencilClearValue=s.getClearStencil(),r.clearColor=!0===s.autoClearColor,r.clearDepth=!0===s.autoClearDepth,r.clearStencil=!0===s.autoClearStencil}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}}let yN=0;class bN{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=yN++}}class xN{constructor(e,t,r,s,i,n,a,o,u,l=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=l,this.nodeAttributes=s,this.bindings=i,this.updateNodes=n,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=u,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const r=new bN(t.name,[]);e.push(r);for(const e of t.bindings)r.bindings.push(e.clone())}else e.push(t)}return e}}class TN{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}}class _N{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class vN{constructor(e,t,r=!1,s=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=s}}class NN extends vN{constructor(e,t,r=null,s=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=s}}class SN{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}let RN=0;class EN{constructor(e=null){this.id=RN++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class AN{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class wN{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class CN extends wN{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class MN extends wN{constructor(e,r=new t){super(e,r),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class BN extends wN{constructor(e,t=new r){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class LN extends wN{constructor(e,t=new s){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class FN extends wN{constructor(t,r=new e){super(t,r),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class PN extends wN{constructor(e,t=new i){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class DN extends wN{constructor(e,t=new n){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class UN extends wN{constructor(e,t=new a){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class IN extends CN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class ON extends MN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class VN extends BN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kN extends LN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class GN extends FN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zN extends PN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class $N extends DN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class WN extends UN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let HN=0;const qN=new WeakMap,jN=new WeakMap,XN=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),KN=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class QN{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=nb(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new EN,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:HN++})}isFlatShading(){return!0===this.material.flatShading||!1===this.geometry.hasAttribute("normal")}isOpaque(){const e=this.material;return!1===e.transparent&&e.blending===tt&&!1===e.alphaToCoverage}createRenderTarget(e,t,r){return new ne(e,t,r)}createCubeRenderTarget(e,t){return new Lg(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const r=t[0].groupNode;let s,i=r.shared;if(i)for(let e=1;ee.nodeUniform.node.id-t.nodeUniform.node.id);for(const t of e.uniforms)r+=t.nodeUniform.node.id}else r+=e.nodeUniform.id;const i=this.renderer._currentRenderContext||this.renderer;let n=qN.get(i);void 0===n&&(n=new Map,qN.set(i,n));const a=Vs(r);s=n.get(a),void 0===s&&(s=new bN(e,t),n.set(a,s))}else s=new bN(e,t);return s}getBindGroupArray(e,t){const r=this.bindings[t];let s=r[e];return void 0===s&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=s=[]),s}getBindings(){let e=this.bindGroups;if(null===e){const t={},r=this.bindings;for(const e of oi)for(const s in r[e]){const i=r[e][s],n=t[s]||(t[s]=[]);for(const e of i)!1===n.includes(e)&&n.push(e)}e=[];for(const r in t){const s=t[r],i=this._getBindGroup(r,s);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(n)}u`:"0u";if("bool"===i)return n?"true":"false";if("color"===i)return`${this.getType("vec3")}( ${KN(n.r)}, ${KN(n.g)}, ${KN(n.b)} )`;const a=this.getTypeLength(i),o=this.getComponentType(i),u=e=>this.generateConst(o,e);if(2===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)} )`;if(3===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)} )`;if(4===a&&"mat2"!==i)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)}, ${u(n.w)} )`;if(a>=4&&n&&(n.isMatrix2||n.isMatrix3||n.isMatrix4))return`${this.getType(i)}( ${n.elements.map(u).join(", ")} )`;if(a>4)return`${this.getType(i)}()`;throw new Error(`NodeBuilder: Type '${i}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const r=this.attributes;for(const t of r)if(t.name===e)return t;const s=new TN(e,t);return this.registerDeclaration(s),r.push(s),s}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===R)return"int";if(t===S)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let r=Ws(e);const s="float"===t?"":t[0];return!0===/mat2/.test(t)&&(r=r.replace("vec","mat")),s+r}getTypeFromArray(e){return XN.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const r=t.array,s=e.itemSize,i=e.normalized;let n;return e instanceof xt||!0===i||(n=this.getTypeFromArray(r)),this.getTypeFromLength(s,n)}getTypeLength(e){const t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]!==e)throw new Error("NodeBuilder: Invalid active stack removal.");this.activeStacks.pop()}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=nb(this.stack);const e=pn();return this.stacks.push(e),hn(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){this.getDataFromNode(t).stack=e}return this.stack=e.parent,hn(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){let s=(r=null===r?e.isGlobal(this)?this.globalCache:this.cache:r).getData(e);void 0===s&&(s={},r.setData(e,s)),void 0===s[t]&&(s[t]={});let i=s[t];const n=s.any?s.any.subBuilds:null,a=this.getClosestSubBuild(n);return a&&(void 0===i.subBuildsCache&&(i.subBuildsCache={}),i=i.subBuildsCache[a]||(i.subBuildsCache[a]={}),i.subBuilds=n),i}getNodeProperties(e,t="any"){const r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const r=this.getDataFromNode(e,"vertex");let s=r.bufferAttribute;if(void 0===s){const i=this.uniforms.index++;s=new TN("nodeAttribute"+i,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,s=this.shaderStage){const i=this.getDataFromNode(e,s,this.globalCache);let n=i.structType;if(void 0===n){const a=this.structs.index++;null===r&&(r="StructType"+a),n=new AN(r,t),this.structs[s].push(n),this.types[s][r]=e,i.structType=n}return n}getOutputStructTypeFromNode(e,t){const r=this.getStructTypeFromNode(e,t,"OutputType","fragment");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,s=null){const i=this.getDataFromNode(e,r,this.globalCache);let n=i.uniform;if(void 0===n){const a=this.uniforms.index++;n=new _N(s||"nodeUniform"+a,t,e),this.uniforms[r].push(n),this.registerDeclaration(n),i.uniform=n}return n}getVarFromNode(e,t=null,r=e.getNodeType(this),s=this.shaderStage,i=!1){const n=this.getDataFromNode(e,s),a=this.getSubBuildProperty("variable",n.subBuilds);let o=n[a];if(void 0===o){const u=i?"_const":"_var",l=this.vars[s]||(this.vars[s]=[]),d=this.vars[u]||(this.vars[u]=0);null===t&&(t=(i?"nodeConst":"nodeVar")+d,this.vars[u]++),"variable"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds));const c=e.getArrayCount(this);o=new vN(t,r,i,c),i||l.push(o),this.registerDeclaration(o),n[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,r=e.getNodeType(this),s=null,i=null){const n=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",n.subBuilds);let o=n[a];if(void 0===o){const e=this.varyings,u=e.length;null===t&&(t="nodeVarying"+u),"varying"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds)),o=new NN(t,r,s,i),e.push(o),this.registerDeclaration(o),n[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),s=this.getPropertyName(e);let i=1,n=s;for(;void 0!==r[n];)n=s+"_"+i++;i>1&&(e.name=n,d(`TSL: Declaration name '${s}' of '${e.type}' already in use. Renamed to '${n}'.`)),r[n]=e}getCodeFromNode(e,t,r=this.shaderStage){const s=this.getDataFromNode(e);let i=s.code;if(void 0===i){const e=this.codes[r]||(this.codes[r]=[]),n=e.length;i=new SN("nodeCode"+n,t),e.push(i),s.code=i}return i}addFlowCodeHierarchy(e,t){const{flowCodes:r,flowCodeBlock:s}=this.getDataFromNode(e);let i=!0,n=t;for(;n;){if(!0===s.get(n)){i=!1;break}n=this.getDataFromNode(n).parentNodeBlock}if(i)for(const e of r)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,r){const s=this.getDataFromNode(e),i=s.flowCodes||(s.flowCodes=[]),n=s.flowCodeBlock||(s.flowCodeBlock=new WeakMap);i.push(t),n.set(r,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new bT,r=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=r,t}flowShaderNode(e){const t=e.layout,r={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const e of t.inputs)r[e.name]=new sb(e.type,e.name);e.layout=null;const s=e.call(r),i=this.flowStagesNode(s,t.type);return e.layout=t,i}flowBuildStage(e,t,r=null){const s=this.getBuildStage();this.setBuildStage(t);const i=e.build(this,r);return this.setBuildStage(s),i}flowStagesNode(e,t=null){const r=this.flow,s=this.vars,i=this.declarations,n=this.cache,a=this.buildStage,o=this.stack,u={code:""};this.flow=u,this.vars={},this.declarations={},this.cache=new EN,this.stack=nb();for(const r of ai)this.setBuildStage(r),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=s,this.declarations=i,this.cache=n,this.stack=o,this.setBuildStage(a),u}getFunctionOperator(){return null}buildFunctionCode(){d("Abstract function.")}flowChildNode(e,t=null){const r=this.flow,s={code:""};return this.flow=s,s.result=e.build(this,t),this.flow=r,s}flowNodeFromShaderStage(e,t,r=null,s=null){const i=this.tab,n=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const u={...this.context};delete u.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=u;let l=null;if("generate"===this.buildStage){const i=this.flowChildNode(t,r);null!==s&&(i.code+=`${this.tab+s} = ${i.result};\n`),this.flowCode[e]=this.flowCode[e]+i.code,l=i}else l=t.build(this);return this.setShaderStage(a),this.cache=n,this.tab=i,this.context=o,l}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){d("Abstract function.")}getVaryings(){d("Abstract function.")}getVar(e,t,r=null){return`${null!==r?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e,t=!1){const r=[],s=this.vars[e];if(void 0!==s)for(const e of s)r.push(`${this.getVar(e.type,e.name,e.count)};`);return r.join(t?"\n":"\n\t")}getUniforms(){d("Abstract function.")}getCodes(e){const t=this.codes[e];let r="";if(void 0!==t)for(const e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){d("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const r=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){const s=t[e];if(r.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let r,s;return r=null!==t?this.getClosestSubBuild(t):this.subBuildFn,s=r?e?r+"_"+e:r:e,s}prebuild(){const{object:e,renderer:t,material:r}=this;if(!0===t.contextNode.isContextNode?this.context={...this.context,...t.contextNode.getFlowContextData()}:o('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),r&&r.contextNode&&(!0===r.contextNode.isContextNode?this.context={...this.context,...r.contextNode.getFlowContextData()}:o('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),null!==r){let e=t.library.fromMaterial(r);null===e&&(o(`NodeBuilder: Material "${r.type}" is not compatible.`),e=new vg),e.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this);await Tt()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=jN.get(e);return void 0===t&&(t={}),t}getNodeUniform(e,t){const r=this.getSharedDataFromNode(e);let s=r.cache;if(void 0===s){if("float"===t||"int"===t||"uint"===t)s=new IN(e);else if("vec2"===t||"ivec2"===t||"uvec2"===t)s=new ON(e);else if("vec3"===t||"ivec3"===t||"uvec3"===t)s=new VN(e);else if("vec4"===t||"ivec4"===t||"uvec4"===t)s=new kN(e);else if("color"===t)s=new GN(e);else if("mat2"===t)s=new zN(e);else if("mat3"===t)s=new $N(e);else{if("mat4"!==t)throw new Error(`Uniform "${t}" not implemented.`);s=new WN(e)}r.cache=s}return s}format(e,t,r){if((t=this.getVectorType(t))===(r=this.getVectorType(r))||null===r||this.isReference(r))return e;const s=this.getTypeLength(t),i=this.getTypeLength(r);return 16===s&&9===i?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===s&&4===i?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:s>4||i>4||0===i?e:s===i?`${this.getType(r)}( ${e} )`:s>i?(e="bool"===r?`all( ${e} )`:`${e}.${"xyz".slice(0,i)}`,this.format(e,this.getTypeFromLength(i,this.getComponentType(t)),r)):4===i&&s>1?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===s?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===s&&i>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r${_t} - Node System\n`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||!0===Ys(this.object).useVelocity}}class YN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return void 0===r&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){const t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateBeforeMap,r);if(t.frameId!==this.frameId){const r=t.frameId;t.frameId=this.frameId,!1===e.updateBefore(this)&&(t.frameId=r)}}else if(t===ri.RENDER){const t=this._getMaps(this.updateBeforeMap,r);if(t.renderId!==this.renderId){const r=t.renderId;t.renderId=this.renderId,!1===e.updateBefore(this)&&(t.renderId=r)}}else t===ri.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateAfterMap,r);t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateAfterMap,r);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateMap,r);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateMap,r);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class ZN{constructor(e,t,r=null,s="",i=!1){this.type=e,this.name=t,this.count=r,this.qualifier=s,this.isConst=i}}ZN.isNodeFunctionInput=!0;class JN extends gv{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class eS extends gv{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:v_(this.light),lightColor:e}}}class tS extends gv{static get type(){return"HemisphereLightNode"}constructor(t=null){super(t),this.lightPositionNode=x_(t),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Sa(new e).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:r,lightDirectionNode:s}=this,i=Rc.dot(s).mul(.5).add(.5),n=gu(r,t,i);e.context.irradiance.addAssign(n)}}class rS extends gv{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Sa(0).setGroup(_a),this.penumbraCosNode=Sa(0).setGroup(_a),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(0).setGroup(_a),this.colorNode=Sa(this.color).setGroup(_a)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:r,penumbraCosNode:s}=this;return bu(r,s,t)}getLightCoord(e){const t=e.getNodeProperties(this);let r=t.projectionUV;return void 0===r&&(r=b_(this.light,e.context.positionWorld),t.projectionUV=r),r}setupDirect(e){const{colorNode:t,cutoffDistanceNode:r,decayExponentNode:s,light:i}=this,n=this.getLightVector(e),a=n.normalize(),o=a.dot(v_(i)),u=this.getSpotAttenuation(e,o),l=n.length(),d=mv({lightDistance:l,cutoffDistance:r,decayExponent:s});let c,h,p=t.mul(u).mul(d);if(i.colorNode?(h=this.getLightCoord(e),c=i.colorNode(h)):i.map&&(h=this.getLightCoord(e),c=Kl(i.map,h.xy).onRenderUpdate(()=>i.map)),c){p=h.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(c),p)}return{lightColor:p,lightDirection:a}}}class sS extends rS{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const r=this.light.iesMap;let s=null;if(r&&!0===r.isTexture){const e=t.acos().mul(1/Math.PI);s=Kl(r,_n(e,0),0).r}else s=super.getSpotAttenuation(t);return s}}class iS extends gv{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new r);this.lightProbe=td(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=pN(Rc,this.lightProbe);e.context.irradiance.addAssign(t)}}const nS=cn(([e,t])=>{const r=e.abs().sub(t);return Go(eu(r,0)).add(Jo(eu(r.x,r.y),0))});class aS extends rS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=yn(0),r=this.penumbraCosNode,s=y_(this.light).mul(e.context.positionWorld||cc);return gn(s.w.greaterThan(0),()=>{const e=s.xyz.div(s.w),i=nS(e.xy.sub(_n(.5)),_n(.5)),n=Ua(-1,Pa(1,Do(r)).sub(1));t.assign(fu(i.mul(-2).mul(n)))}),t}}const oS=new a,uS=new a;let lS=null;class dS extends gv{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Sa(new r).setGroup(_a),this.halfWidth=Sa(new r).setGroup(_a),this.updateType=ri.RENDER}update(e){super.update(e);const{light:t}=this,r=e.camera.matrixWorldInverse;uS.identity(),oS.copy(t.matrixWorld),oS.premultiply(r),uS.extractRotation(oS),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(uS),this.halfHeight.value.applyMatrix4(uS)}setupDirectRectArea(e){let t,r;e.isAvailable("float32Filterable")?(t=Kl(lS.LTC_FLOAT_1),r=Kl(lS.LTC_FLOAT_2)):(t=Kl(lS.LTC_HALF_1),r=Kl(lS.LTC_HALF_2));const{colorNode:s,light:i}=this;return{lightColor:s,lightPosition:__(i),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){lS=e}}class cS{parseFunction(){d("Abstract function.")}}class hS{constructor(e,t,r="",s=""){this.type=e,this.inputs=t,this.name=r,this.precision=s}getCode(){d("Abstract function.")}}hS.isNodeFunction=!0;const pS=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,gS=/[a-z_0-9]+/gi,mS="#pragma main";class fS extends hS{constructor(e){const{type:t,inputs:r,name:s,precision:i,inputsCode:n,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(mS),r=-1!==t?e.slice(t+12):e,s=r.match(pS);if(null!==s&&5===s.length){const i=s[4],n=[];let a=null;for(;null!==(a=gS.exec(i));)n.push(a);const o=[];let u=0;for(;u{let r=this._createNodeBuilder(e,e.material);try{t?await r.buildAsync():r.build()}catch(s){r=this._createNodeBuilder(e,new vg),t?await r.buildAsync():r.build(),o("TSL: "+s)}return r})().then(e=>(s=this._createNodeBuilderState(e),i.set(n,s),s.usedTimes++,r.nodeBuilderState=s,s));{let t=this._createNodeBuilder(e,e.material);try{t.build()}catch(r){t=this._createNodeBuilder(e,new vg),t.build();let s=r.stackTrace;!s&&r.stack&&(s=new Is(r.stack)),o("TSL: "+r,s)}s=this._createNodeBuilderState(t),i.set(n,s)}}s.usedTimes++,r.nodeBuilderState=s}return s}getForRenderAsync(e){const t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){const t=this.get(e);if(void 0!==t.nodeBuilderState)return t.nodeBuilderState;const r=this.getForRenderCacheKey(e),s=this.nodeBuilderCache.get(r);return void 0!==s?(s.usedTimes++,t.nodeBuilderState=s,s):(!0!==t.pendingBuild&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||0===this._buildQueue.length)return;this._buildInProgress=!0;this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;void 0!==t&&(t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){const t=this.get(e);let r=t.nodeBuilderState;if(void 0===r){const s=this.backend.createNodeBuilder(e,this.renderer);s.build(),r=this._createNodeBuilderState(s),t.nodeBuilderState=r}return r}_createNodeBuilderState(e){return new xN(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){bS[0]=e,bS[1]=t;const r=this.renderer.info.calls,s=this.callHashCache.get(bS)||{};if(s.callId!==r){const i=this.getEnvironmentNode(e),n=this.getFogNode(e);t&&xS.push(t.getCacheKey(!0)),i&&xS.push(i.getCacheKey()),n&&xS.push(n.getCacheKey()),xS.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),xS.push(this.renderer.shadowMap.enabled?1:0),xS.push(this.renderer.shadowMap.type),s.callId=r,s.cacheKey=ks(xS),this.callHashCache.set(bS,s),xS.length=0}return bS[0]=null,bS[1]=null,s.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),r=e.background;if(r){const s=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==r||s){const i=this.getCacheNode("background",r,()=>{if(!0===r.isCubeTexture||r.mapping===ce||r.mapping===he||r.mapping===Ae){if(e.backgroundBlurriness>0||r.mapping===Ae)return Vf(r);{let e;return e=!0===r.isCubeTexture?$c(r):Kl(r),Ig(e)}}if(!0===r.isTexture)return Kl(r,ud.flipY()).setUpdateMatrix(!0);!0!==r.isColor&&o("WebGPUNodes: Unsupported background configuration.",r)},s);t.backgroundNode=i,t.background=r,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,s=!1){const i=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let n=i.get(t);return(void 0===n||s)&&(n=r(),i.set(t,n)),n}updateFog(e){const t=this.get(e),r=e.fog;if(r){if(t.fog!==r){const e=this.getCacheNode("fog",r,()=>{if(r.isFogExp2){const e=qc("color","color",r).setGroup(_a),t=qc("density","float",r).setGroup(_a);return ST(e,vT(t))}if(r.isFog){const e=qc("color","color",r).setGroup(_a),t=qc("near","float",r).setGroup(_a),s=qc("far","float",r).setGroup(_a);return ST(e,_T(t,s))}o("Renderer: Unsupported fog configuration.",r)});t.fogNode=e,t.fog=r}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),r=e.environment;if(r){if(t.environment!==r){const e=this.getCacheNode("environment",r,()=>!0===r.isCubeTexture?$c(r):!0===r.isTexture?Kl(r):void o("Nodes: Unsupported environment configuration.",r));t.environmentNode=e,t.environment=r}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,s=null,i=null){const n=this.nodeFrame;return n.renderer=e,n.scene=t,n.object=r,n.camera=s,n.material=i,n}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){const t=this.renderer;return e.isArrayTexture?Kl(e,ud).depth(sd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):Kl(e,ud).renderOutput(t.toneMapping,t.currentColorSpace)}updateBefore(e){const t=e.getNodeBuilderState();for(const r of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(r)}updateAfter(e){const t=e.getNodeBuilderState();for(const r of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(r)}updateForCompute(e){const t=this.getNodeFrame(),r=this.getForCompute(e);for(const e of r.updateNodes)t.updateNode(e)}updateForRender(e){const t=this.getNodeFrameForRender(e),r=e.getNodeBuilderState();for(const e of r.updateNodes)t.updateNode(e)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new YN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const _S=new ut;class vS{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new n,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,r){const s=e.length;for(let i=0;iLl(e,i.toneMapping,i.outputColorSpace)}),FS.set(r,n))}else n=r;i.contextNode=n,i.setRenderTarget(t.renderTarget),t.rendercall(),i.contextNode=r}i.setRenderTarget(o),i._setXRLayerSize(a.x,a.y),this.isPresenting=n}getSession(){return this._session}async setSession(e){const t=this._renderer,r=t.backend;this._gl=t.getContext();const s=this._gl,i=s.getContextAttributes();if(this._session=e,null!==e){if(!0===r.isWebGPUBackend)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await r.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),!0===this._supportsLayers){let r=null,n=null,a=null;t.depth&&(a=t.stencil?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24,r=t.stencil?qe:He,n=t.stencil?Ze:S);const o={colorFormat:s.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const u=this._glBinding.createProjectionLayer(o),l=[u];this._glProjLayer=u,t.setPixelRatio(1),t._setXRLayerSize(u.textureWidth,u.textureHeight);const d=this._useMultiview?2:1,c=new Z(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,r,d);if(this._xrRenderTarget=new MS(u.textureWidth,u.textureHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,depthTexture:c,stencilBuffer:t.stencil,samples:i.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const e of this._layers)e.plane.material=new fe({color:16777215,side:"cylinder"===e.type?F:St}),e.plane.material.blending=Rt,e.plane.material.blendEquation=it,e.plane.material.blendSrc=Et,e.plane.material.blendDst=Et,e.xrlayer=this._createXRLayer(e),l.unshift(e.xrlayer);e.updateRenderState({layers:l})}else{const r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},i=new XRWebGLLayer(e,s,r);this._glBaseLayer=i,e.updateRenderState({baseLayer:i}),t.setPixelRatio(1),t._setXRLayerSize(i.framebufferWidth,i.framebufferHeight),this._xrRenderTarget=new MS(i.framebufferWidth,i.framebufferHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===i.ignoreDepthValues,resolveStencilBuffer:!1===i.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(null===t)return;const r=e.near,s=e.far,i=this._cameraXR,n=this._cameraL,a=this._cameraR;i.near=a.near=n.near=r,i.far=a.far=n.far=s,i.isMultiViewCamera=this._useMultiview,this._currentDepthNear===i.near&&this._currentDepthFar===i.far||(t.updateRenderState({depthNear:i.near,depthFar:i.far}),this._currentDepthNear=i.near,this._currentDepthFar=i.far),i.layers.mask=6|e.layers.mask,n.layers.mask=-5&i.layers.mask,a.layers.mask=-3&i.layers.mask;const o=e.parent,u=i.cameras;DS(i,o);for(let e=0;e=0&&(r[n]=null,t[n].disconnect(i))}for(let s=0;s=r.length){r.push(i),n=e;break}if(null===r[e]){r[e]=i,n=e;break}}if(-1===n)break}const a=t[n];a&&a.connect(i)}}function VS(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function kS(e,t){if(void 0===t)return;const r=this._cameraXR,i=this._renderer,n=i.backend,a=this._glBaseLayer,o=this.getReferenceSpace(),u=t.getViewerPose(o);if(this._xrFrame=t,null!==u){const e=u.views;null!==this._glBaseLayer&&n.setXRTarget(a.framebuffer);let t=!1;e.length!==r.cameras.length&&(r.cameras.length=0,t=!0);for(let i=0;i{await this.compileAsync(e,t);const s=this._renderLists.get(e,t),i=this._renderContexts.get(this._renderTarget,this._mrt),n=e.overrideMaterial||r.material,a=this._objects.get(r,n,e,t,s.lightsNode,i,i.clippingContext),{fragmentShader:o,vertexShader:u}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:u}}}}async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=r=this._getFallback(e),await r.init(this)}catch(e){return void t(e)}}this._nodes=new TS(this,r),this._animation=new xy(this,this._nodes,this.info),this._attributes=new By(r,this.info),this._background=new fN(this,this._nodes),this._geometries=new Dy(this._attributes,this.info),this._textures=new tb(this,r,this.info),this._pipelines=new zy(r,this._nodes,this.info),this._bindings=new $y(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new Sy(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Ky(this.lighting),this._bundles=new RS,this._renderContexts=new Jy(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const s=this._nodes.nodeFrame,i=s.renderId,n=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._handleObjectFunction,u=this._compilationPromises;null===r&&(r=e);const l=!0===e.isScene?e:!0===r.isScene?r:$S,d=this.needsFrameBufferTarget&&null===this._renderTarget?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,c=this._renderContexts.get(d,this._mrt),h=this._activeMipmapLevel,p=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,s.renderId++,s.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new vS),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,d);const g=this._renderLists.get(l,t);if(g.begin(),this._projectObject(e,t,0,g,c.clippingContext),r!==e&&r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&g.pushLight(e)}),g.finish(),null!==d){this._textures.updateRenderTarget(d,h);const e=this._textures.get(d);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;r!==e?this._background.update(r,g,c):this._background.update(l,g,c);const m=g.opaque,f=g.transparent,y=g.transparentDoublePass,b=g.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,l,b),!0===this.transparent&&f.length>0&&this._renderTransparents(f,y,t,l,b),s.renderId=i,this._currentRenderContext=n,this._currentRenderObjectFunction=a,this._handleObjectFunction=o,this._compilationPromises=u;for(const e of p){const t=this._objects.get(e.object,e.material,e.scene,e.camera,e.lightsNode,e.renderContext,e.clippingContext,e.passId);t.drawRange=e.object.geometry.drawRange,t.group=e.group,this._geometries.updateForRender(t),await this._nodes.getForRenderAsync(t),this._nodes.updateBefore(t),this._nodes.updateForRender(t),this._bindings.updateForRender(t);const r=[];this._pipelines.getForRender(t,r),r.length>0&&await Promise.all(r),this._nodes.updateAfter(t),await Tt()}}async renderAsync(e,t){v('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){o("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;!0===e?(t.modelViewMatrix=nc,t.modelNormalViewMatrix=ac):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===nc&&e.modelNormalViewMatrix===ac}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return v('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),o(t),this._isDeviceLost=!0}_renderBundle(e,t,r){const{bundleGroup:s,camera:i,renderList:n}=e,a=this._currentRenderContext,o=this._bundles.get(s,i,a),u=this.backend.get(o),l=s.version!==u.version;if(l||void 0===u.bundleGPU){this.backend.beginBundle(a),(void 0===u.renderObjects||l)&&(u.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:d,opaque:c}=n;!0===this.opaque&&c.length>0&&this._renderObjects(c,i,t,r),!0===this.transparent&&d.length>0&&this._renderTransparents(d,e,i,t,r),this._currentRenderBundle=null,this.backend.finishBundle(a,o),u.version=s.version}else{const{renderObjects:e}=u;for(let t=0,r=e.length;t{u.removeEventListener("dispose",e),l.dispose(),this._frameBufferTargets.delete(u)};u.addEventListener("dispose",e),this._frameBufferTargets.set(u,l)}const d=this.getOutputRenderTarget();l.depthBuffer=a,l.stencilBuffer=o,null!==d?l.setSize(d.width,d.height,d.depth):l.setSize(i,n,1);const c=this._outputRenderTarget?this._outputRenderTarget.viewport:u._viewport,h=this._outputRenderTarget?this._outputRenderTarget.scissor:u._scissor,g=this._outputRenderTarget?1:u._pixelRatio,f=this._outputRenderTarget?this._outputRenderTarget.scissorTest:u._scissorTest;return l.viewport.copy(c),l.scissor.copy(h),l.viewport.multiplyScalar(g),l.scissor.multiplyScalar(g),l.scissorTest=f,l.multiview=null!==d&&d.multiview,l.resolveDepthBuffer=null===d||d.resolveDepthBuffer,l._autoAllocateDepthBuffer=null!==d&&d._autoAllocateDepthBuffer,l}_renderScene(e,t,r=!0){if(!0===this._isDeviceLost)return;const s=r?this._getFrameBufferTarget():null,i=this._nodes.nodeFrame,n=i.renderId,a=this._currentRenderContext,o=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;const l=!0===e.isScene?e:$S,d=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,h=this._activeMipmapLevel;let p;if(null!==s?(p=s,this.setRenderTarget(p)):p=d,null!==p&&!0===p.depthBuffer){const e=this._textures.get(p);!0!==e.depthInitialized&&((!1===this.autoClear||!0===this.autoClear&&!1===this.autoClearDepth)&&this.clearDepth(),e.depthInitialized=!0)}const g=this._renderContexts.get(p,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,i.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,p);const m=this.xr;if(!1===m.isPresenting){let e=!1;if(!0===this.reversedDepthBuffer&&!0!==t.reversedDepth){if(t._reversedDepth=!0,t.isArrayCamera)for(const e of t.cameras)e._reversedDepth=!0;e=!0}const r=this.coordinateSystem;if(t.coordinateSystem!==r){if(t.coordinateSystem=r,t.isArrayCamera)for(const e of t.cameras)e.coordinateSystem=r;e=!0}if(!0===e&&(t.updateProjectionMatrix(),t.isArrayCamera))for(const e of t.cameras)e.updateProjectionMatrix()}!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===m.enabled&&!0===m.isPresenting&&(!0===m.cameraAutoUpdate&&m.updateCamera(t),t=m.getCamera());const f=this._canvasTarget;let y=f._viewport,b=f._scissor,x=f._pixelRatio;null!==p&&(y=p.viewport,b=p.scissor,x=1),this.getDrawingBufferSize(WS),HS.set(0,0,WS.width,WS.height);const T=void 0===y.minDepth?0:y.minDepth,_=void 0===y.maxDepth?1:y.maxDepth;g.viewportValue.copy(y).multiplyScalar(x).floor(),g.viewportValue.width>>=h,g.viewportValue.height>>=h,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=_,g.viewport=!1===g.viewportValue.equals(HS),g.scissorValue.copy(b).multiplyScalar(x).floor(),g.scissor=f._scissorTest&&!1===g.scissorValue.equals(HS),g.scissorValue.width>>=h,g.scissorValue.height>>=h,g.clippingContext||(g.clippingContext=new vS),g.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,p);const v=t.isArrayCamera?jS:qS;t.isArrayCamera||(XS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),v.setFromProjectionMatrix(XS,t.coordinateSystem,t.reversedDepth));const N=this._renderLists.get(e,t);if(N.begin(),this._projectObject(e,t,0,N,g.clippingContext),N.finish(),!0===this.sortObjects&&N.sort(this._opaqueSort,this._transparentSort),null!==p){this._textures.updateRenderTarget(p,h);const e=this._textures.get(p);g.textures=e.textures,g.depthTexture=e.depthTexture,g.width=e.width,g.height=e.height,g.renderTarget=p,g.depth=p.depthBuffer,g.stencil=p.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=WS.width,g.height=WS.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=h,g.height>>=h,g.activeCubeFace=c,g.activeMipmapLevel=h,g.occlusionQueryCount=N.occlusionQueryCount,g.scissorValue.max(KS.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(l,N,g),g.camera=t,this.backend.beginRender(g);const{bundles:S,lightsNode:R,transparentDoublePass:E,transparent:A,opaque:w}=N;return S.length>0&&this._renderBundles(S,l,R),!0===this.opaque&&w.length>0&&this._renderObjects(w,t,l,R),!0===this.transparent&&A.length>0&&this._renderTransparents(A,E,t,l,R),this.backend.finishRender(g),i.renderId=n,this._currentRenderContext=a,this._currentRenderObjectFunction=o,this._handleObjectFunction=u,this._callDepth--,null!==s&&(this.setRenderTarget(d,c,h),this._renderOutput(p)),l.onAfterRender(this,e,t,p),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._nodes.getOutputCacheKey();let r,s=this._quadCache.get(e.texture);if(void 0===s){r=new gx(new vg),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),s={quad:r,cacheKey:t},this._quadCache.set(e.texture,s);const i=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",i)};e.texture.addEventListener("dispose",i)}else r=s.quad,s.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,s.cacheKey=t);const i=this.autoClear,n=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(r,r.camera,!1),this.autoClear=i,this.xr.enabled=n}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){let t=e;if(!0!==t.isReadbackBuffer){const r=e,s=this.backend.get(r);if(t=s.readbackBuffer,void 0===t){t=new zS(r);const e=()=>{r.removeEventListener("dispose",e),t.dispose(),delete s.readbackBuffer};r.addEventListener("dispose",e),s.readbackBuffer=t}}if(!1===this.info.memoryMap.has(t)){this.info.createReadbackBuffer(t);const e=()=>{t.removeEventListener("dispose",e),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",e)}return t.release(),await this.backend.getArrayBufferAsync(t)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,s){this._canvasTarget.setScissor(e,t,r,s)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,s,i=0,n=1){this._canvasTarget.setViewport(e,t,r,s,i,n)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return!0===this.reversedDepthBuffer?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(!1===this._initialized)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const s=this._renderTarget||this._getFrameBufferTarget();let i=null;if(null!==s){this._textures.updateRenderTarget(s);const e=this._textures.get(s);i=this._renderContexts.get(s,null,-1),i.textures=e.textures,i.depthTexture=e.depthTexture,i.width=e.width,i.height=e.height,i.renderTarget=s,i.depth=s.depthBuffer,i.stencil=s.stencilBuffer;const t=this.backend.getClearColor();i.clearColorValue.r=t.r,i.clearColorValue.g=t.g,i.clearColorValue.b=t.b,i.clearColorValue.a=t.a,i.clearDepthValue=this.getClearDepth(),i.clearStencilValue=this.getClearStencil(),i.activeCubeFace=this.getActiveCubeFace(),i.activeMipmapLevel=this.getActiveMipmapLevel(),!0===s.depthBuffer&&(e.depthInitialized=!0)}this.backend.clear(e,t,r,i),null!==s&&null===this._renderTarget&&this._renderOutput(s)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){v('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){v('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){v('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){v('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==m,t=this.currentColorSpace!==p.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:m}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:p.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){if(!0===this._initialized){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(const e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(const e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return d("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const r=this._nodes.nodeFrame,s=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const i=this.backend,n=this._pipelines,a=this._bindings,o=this._nodes,u=Array.isArray(e)?e:[e];if(void 0===u[0]||!0!==u[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");i.beginCompute(e);for(const r of u){if(!1===n.has(r)){const e=()=>{r.removeEventListener("dispose",e),n.delete(r),a.deleteForCompute(r),o.delete(r)};r.addEventListener("dispose",e);const t=r.onInitFunction;null!==t&&t.call(r,{renderer:this})}o.updateForCompute(r),a.updateForCompute(r);const s=a.getForCompute(r),u=n.getForCompute(r,s);i.compute(e,r,s,u,t)}i.finishCompute(e),r.renderId=s,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return v('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){v('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(!1===this._initialized)throw new Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=KS.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void o("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=KS.copy(t).floor()}else t=KS.set(0,0,e.image.width,e.image.height);let r,s=this._currentRenderContext;null!==s?r=s.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),null!==r&&(this._textures.updateRenderTarget(r),s=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,s,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,s=null,i=0,n=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,s,i,n),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,s,i,n=0,a=0){return this.backend.copyTextureToBuffer(e.textures[n],t,r,s,i,a)}_projectObject(e,t,r,s,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(i=i.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)s.pushLight(e);else if(e.isSprite){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsSprite(e,t)){!0===this.sortObjects&&KS.setFromMatrixPosition(e.matrixWorld).applyMatrix4(XS);const{geometry:t,material:n}=e;n.visible&&s.push(e,t,n,r,KS.z,null,i)}}else if(e.isLineLoop)o("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsObject(e,t)){const{geometry:t,material:n}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),KS.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(XS)),Array.isArray(n)){const a=t.groups;for(let o=0,u=a.length;o0){for(const{material:e}of t)e.side=F;this._renderObjects(t,r,s,i,"backSide");for(const{material:e}of t)e.side=St;this._renderObjects(e,r,s,i);for(const{material:e}of t)e.side=P}else this._renderObjects(e,r,s,i)}_renderObjects(e,t,r,s,i=null){for(let n=0,a=e.length;n(t.not().discard(),e))(u)}}e.depthNode&&e.depthNode.isNode&&(l=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:u,depthNode:l,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}renderObject(e,t,r,s,i,n,a,o=null,u=null){let l,d,c,h,p=!1;if(e.onBeforeRender(this,t,r,s,i,n),!0===i.allowOverride&&null!==t.overrideMaterial){const e=t.overrideMaterial;if(p=!0,l=e.isNodeMaterial?e.colorNode:null,d=e.isNodeMaterial?e.depthNode:null,c=e.isNodeMaterial?e.positionNode:null,h=t.overrideMaterial.side,i.positionNode&&i.positionNode.isNode&&(e.positionNode=i.positionNode),e.alphaTest=i.alphaTest,e.alphaMap=i.alphaMap,e.transparent=i.transparent||i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode||i.backdropNode&&i.backdropNode.isNode,e.isShadowPassMaterial){const{colorNode:t,depthNode:r,positionNode:s}=this._getShadowNodes(i);this.shadowMap.type===pt?e.side=null!==i.shadowSide?i.shadowSide:i.side:e.side=null!==i.shadowSide?i.shadowSide:QS[i.side],null!==t&&(e.colorNode=t),null!==r&&(e.depthNode=r),null!==s&&(e.positionNode=s)}i=e}!0===i.transparent&&i.side===P&&!1===i.forceSinglePass?(i.side=F,this._handleObjectFunction(e,i,t,r,a,n,o,"backSide"),i.side=St,this._handleObjectFunction(e,i,t,r,a,n,o,u),i.side=P):this._handleObjectFunction(e,i,t,r,a,n,o,u),p&&(t.overrideMaterial.colorNode=l,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=h),e.onAfterRender(this,t,r,s,i,n)}hasCompatibility(e){if(!1===this._initialized)throw new Error('Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,s,i,n,a,o){const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);if(u.drawRange=e.geometry.drawRange,u.group=n,null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(u),u.bundle=this._currentRenderBundle.bundleGroup}const l=this._nodes.needsRefresh(u);l&&(this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u)),this._pipelines.updateForRender(u),this._pipelines.isReady(u)&&(this.backend.draw(u,this.info),l&&this._nodes.updateAfter(u))}_createObjectPipeline(e,t,r,s,i,n,a,o){if(null!==this._compilationPromises)return void this._compilationPromises.push({object:e,material:t,scene:r,camera:s,lightsNode:i,group:n,clippingContext:a,passId:o,renderContext:this._currentRenderContext});const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);u.drawRange=e.geometry.drawRange,u.group=n,this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u),this._pipelines.getForRender(u,this._compilationPromises),this._nodes.updateAfter(u)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class ZS{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}class JS extends ZS{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return(e=this._buffer.byteLength)+(My-e%My)%My;var e}get buffer(){return this._buffer}update(){return!0}}class eR extends JS{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let tR=0;class rR extends eR{constructor(e,t){super("UniformBuffer_"+tR++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class sR extends eR{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){const t=e.index;if(!0!==this._updateRangeCache.has(t)){const r=this.updateRanges,s={start:e.offset,count:e.itemSize};r.push(s),this._updateRangeCache.set(t,s)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let r=0,s=this.uniforms.length;r{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let oR=0;class uR extends aR{constructor(e,t){super(e,t),this.id=oR++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class lR extends uR{constructor(e,t,r,s=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=s}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class dR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledCubeTexture=!0}}class cR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledTexture3D=!0}}const hR={bitcast_int_uint:new fT("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new fT("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},pR={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},gR={low:"lowp",medium:"mediump",high:"highp"},mR={swizzleAssign:!0,storageBuffer:!1},fR={perspective:"smooth",linear:"noperspective"},yR={centroid:"centroid"},bR="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision highp sampler2DShadow;\nprecision highp sampler2DArrayShadow;\nprecision highp samplerCubeShadow;\n";class xR extends QN{constructor(e,t){super(e,t,new yS),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==T}_include(e){const t=hR[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==hR[e]&&this._include(e),pR[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {\n\n\t${r.vars}\n\n${r.code}\n\treturn ${r.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,r=t.count*t.itemSize,{itemSize:s}=t,i=t.array.constructor.name.toLowerCase().includes("int");let n=i?We:$e;2===s?n=i?je:$:3===s?n=i?Ke:Xe:4===s&&(n=i?Ft:Ee);const a={Float32Array:K,Uint8Array:Ve,Uint16Array:Ge,Uint32Array:S,Int8Array:Oe,Int16Array:ke,Int32Array:R,Uint8ClampedArray:Ve},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let u=Math.ceil(r/s/o);o*u*s0?i:"";t=`${r.name} {\n\t${s} ${e.name}[${n}];\n};\n`}else{const t=e.groupNode.name;if(void 0===s[t]){const e=this.uniformGroups[t];if(void 0!==e){const r=[];for(const t of e.uniforms){const e=t.getType(),s=this.getVectorType(e),i=t.nodeUniform.node.precision;let n=`${s} ${t.name};`;null!==i&&(n=gR[i]+" "+n),r.push("\t"+n)}s[t]=r}}i=!0}if(!i){const s=e.node.precision;null!==s&&(t=gR[s]+" "+t),t="uniform "+t,r.push(t)}}let i="";for(const e in s){const t=s[e];i+=this._getGLSLUniformStruct(e,t.join("\n"))+"\n"}return i+=r.join("\n"),i}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==R){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);const s=r.array;!1==(s instanceof Uint32Array||s instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let r=0;for(const s of e)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};\n`}return t}getStructMembers(e){const t=[];for(const r of e.members)t.push(`\t${r.type} ${r.name};`);return t.join("\n")}getStructs(e){const t=[],r=this.structs[e],s=[];for(const e of r)if(e.output)for(const t of e.members)s.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let r="struct "+e.name+" {\n";r+=this.getStructMembers(e),r+="\n};\n",t.push(r)}return 0===s.length&&s.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+s.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const r=this.varyings;if("vertex"===e||"compute"===e)for(const s of r){"compute"===e&&(s.needsInterpolation=!0);const r=this.getType(s.type);if(s.needsInterpolation)if(s.interpolationType){t+=`${fR[s.interpolationType]||s.interpolationType} ${yR[s.interpolationSampling]||""} out ${r} ${s.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}out ${r} ${s.name};\n`}else t+=`${r} ${s.name};\n`}else if("fragment"===e)for(const e of r)if(e.needsInterpolation){const r=this.getType(e.type);if(e.interpolationType){t+=`${fR[e.interpolationType]||e.interpolationType} ${yR[e.interpolationSampling]||""} in ${r} ${e.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}in ${r} ${e.name};\n`}}for(const r of this.builtins[e])t+=`${r};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,r=this.shaderStage){const s=this.extensions[r]||(this.extensions[r]=new Map);!1===s.has(e)&&s.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const r=this.extensions[e];if(void 0!==r)for(const{name:e,behavior:s}of r.values())t.push(`#extension ${e} : ${s}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=mR[e];if(void 0===t){let r;switch(t=!1,e){case"float32Filterable":r="OES_texture_float_linear";break;case"clipDistance":r="WEBGL_clip_cull_distance"}if(void 0!==r){const e=this.renderer.backend.extensions;e.has(r)&&(e.get(r),t=!0)}mR[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let r=0;r0&&(r+="\n"),r+=`\t// flow -> ${n}\n\t`),r+=`${s.code}\n\t`,e===i&&"compute"!==t&&(r+="// result\n\t","vertex"===t?(r+="gl_Position = ",r+=`${s.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(r+="fragColor = ",r+=`${s.result};`)))}const n=e[t];if(n.extensions=this.getExtensions(t),n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.vars=this.getVars(t,!0),n.structs=this.getStructs(t),n.codes=this.getCodes(t),n.transforms=this.getTransforms(t),n.flow=r,"vertex"===t){const e=this.renderer.backend.extensions;this.object.isBatchedMesh&&!1===e.has("WEBGL_multi_draw")&&(n.uniforms+="\nuniform uint nodeUniformDrawId;\n")}}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);let a=n.uniformGPU;if(void 0===a){const s=e.groupNode,o=s.name,u=this.getBindGroupArray(o,r);if("texture"===t)a=new lR(i.name,i.node,s),u.push(a);else if("cubeTexture"===t||"cubeDepthTexture"===t)a=new dR(i.name,i.node,s),u.push(a);else if("texture3D"===t)a=new cR(i.name,i.node,s),u.push(a);else if("buffer"===t){i.name=`buffer${e.id}`;const t=this.getSharedDataFromNode(e);let r=t.buffer;void 0===r&&(e.name=`NodeBuffer_${e.id}`,r=new rR(e,s),r.name=e.name,t.buffer=r),u.push(r),a=r}else{let e=this.uniformGroups[o];void 0===e?(e=new nR(o,s),this.uniformGroups[o]=e,u.push(e)):-1===u.indexOf(e)&&u.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}}let TR=null,_R=null;class vR{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Pt.RENDER]:null,[Pt.COMPUTE]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),r=this.renderer.info.frame;let s;s=!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls,t.timestampUID=s+":"+e.id+":f"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?Pt.COMPUTE:Pt.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void v("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return;const r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return TR=TR||new t,this.renderer.getDrawingBufferSize(TR)}setScissorTest(){}getClearColor(){const e=this.renderer;return _R=_R||new rb,e.getClearColor(_R),_R.getRGB(_R),_R}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Dt(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${_t} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let NR,SR,RR=0;class ER{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class AR{constructor(e){this.backend=e}createAttribute(e,t){const r=this.backend,{gl:s}=r,i=e.array,n=e.usage||s.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=r.get(a);let u,l=o.bufferGPU;if(void 0===l&&(l=this._createBuffer(s,t,i,n),o.bufferGPU=l,o.bufferType=t,o.version=a.version),i instanceof Float32Array)u=s.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)u=s.HALF_FLOAT;else if(i instanceof Uint16Array)u=e.isFloat16BufferAttribute?s.HALF_FLOAT:s.UNSIGNED_SHORT;else if(i instanceof Int16Array)u=s.SHORT;else if(i instanceof Uint32Array)u=s.UNSIGNED_INT;else if(i instanceof Int32Array)u=s.INT;else if(i instanceof Int8Array)u=s.BYTE;else if(i instanceof Uint8Array)u=s.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+i);u=s.UNSIGNED_BYTE}let d={bufferGPU:l,bufferType:t,type:u,byteLength:i.byteLength,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===s.INT||u===s.UNSIGNED_INT||e.gpuType===R,id:RR++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(s,t,i,n);d=new ER(d,e)}r.set(e,d)}updateAttribute(e){const t=this.backend,{gl:r}=t,s=e.array,i=e.isInterleavedBufferAttribute?e.data:e,n=t.get(i),a=n.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(a,n.bufferGPU),0===o.length)r.bufferSubData(a,0,s);else{for(let e=0,t=o.length;e{r.deleteBuffer(l),t.delete(e),e.removeEventListener("dispose",s)};e.addEventListener("dispose",s),u.writeBuffer=l}else r.bindBuffer(r.COPY_WRITE_BUFFER,l);r.copyBufferSubData(r.COPY_READ_BUFFER,r.COPY_WRITE_BUFFER,0,0,o),await t.utils._clientWaitAsync();const d=new s.array.constructor(a.length);return r.bindBuffer(r.COPY_WRITE_BUFFER,l),r.getBufferSubData(r.COPY_WRITE_BUFFER,0,d),r.bindBuffer(r.COPY_READ_BUFFER,null),r.bindBuffer(r.COPY_WRITE_BUFFER,null),d}_createBuffer(e,t,r,s){const i=e.createBuffer();return e.bindBuffer(t,i),e.bufferData(t,r,s),e.bindBuffer(t,null),i}}class wR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;NR={[it]:e.FUNC_ADD,[It]:e.FUNC_SUBTRACT,[Ut]:e.FUNC_REVERSE_SUBTRACT},SR={[Et]:e.ZERO,[Ht]:e.ONE,[Wt]:e.SRC_COLOR,[rt]:e.SRC_ALPHA,[$t]:e.SRC_ALPHA_SATURATE,[zt]:e.DST_COLOR,[Gt]:e.DST_ALPHA,[kt]:e.ONE_MINUS_SRC_COLOR,[st]:e.ONE_MINUS_SRC_ALPHA,[Vt]:e.ONE_MINUS_DST_COLOR,[Ot]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=(new s).fromArray(t),this.currentViewport=(new s).fromArray(r),this._tempVec4=new s}enable(e){const{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==qt?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===jt?t.cullFace(t.BACK):e===Xt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){const s=this.gl,i=this.backend.drawBuffersIndexedExt;if(i)for(let n=0;n0?this.enable(s.SAMPLE_ALPHA_TO_COVERAGE):this.disable(s.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r){const e=12288;for(let t=0;t<8;t++)t{!function i(){const n=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(n===e.WAIT_FAILED)return e.deleteSync(t),void s();n!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),r()):requestAnimationFrame(i)}()})}}let MR,BR,LR,FR=!1;class PR{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===FR&&(this._init(),FR=!0)}_init(){const e=this.gl;MR={[kr]:e.REPEAT,[_e]:e.CLAMP_TO_EDGE,[Vr]:e.MIRRORED_REPEAT},BR={[B]:e.NEAREST,[Gr]:e.NEAREST_MIPMAP_NEAREST,[bt]:e.NEAREST_MIPMAP_LINEAR,[le]:e.LINEAR,[yt]:e.LINEAR_MIPMAP_NEAREST,[Y]:e.LINEAR_MIPMAP_LINEAR},LR={[Hr]:e.NEVER,[Wr]:e.ALWAYS,[A]:e.LESS,[w]:e.LEQUAL,[$r]:e.EQUAL,[M]:e.GEQUAL,[C]:e.GREATER,[zr]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let r;return r=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,r}getInternalFormat(e,t,r,s,i,n=!1){const{gl:a,extensions:o}=this;if(null!==e){if(void 0!==a[e])return a[e];d("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=null;s&&(u=o.get("EXT_texture_norm16"),u||d("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let l=t;if(t===a.RED&&(r===a.FLOAT&&(l=a.R32F),r===a.HALF_FLOAT&&(l=a.R16F),r===a.UNSIGNED_BYTE&&(l=a.R8),r===a.BYTE&&(l=a.R8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.R16_EXT),r===a.SHORT&&u&&(l=u.R16_SNORM_EXT)),t===a.RED_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.R8UI),r===a.UNSIGNED_SHORT&&(l=a.R16UI),r===a.UNSIGNED_INT&&(l=a.R32UI),r===a.BYTE&&(l=a.R8I),r===a.SHORT&&(l=a.R16I),r===a.INT&&(l=a.R32I)),t===a.RG&&(r===a.FLOAT&&(l=a.RG32F),r===a.HALF_FLOAT&&(l=a.RG16F),r===a.UNSIGNED_BYTE&&(l=a.RG8),r===a.BYTE&&(l=a.RG8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RG16_EXT),r===a.SHORT&&u&&(l=u.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RG8UI),r===a.UNSIGNED_SHORT&&(l=a.RG16UI),r===a.UNSIGNED_INT&&(l=a.RG32UI),r===a.BYTE&&(l=a.RG8I),r===a.SHORT&&(l=a.RG16I),r===a.INT&&(l=a.RG32I)),t===a.RGB){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGB32F),r===a.HALF_FLOAT&&(l=a.RGB16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8:a.RGB8),r===a.BYTE&&(l=a.RGB8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGB16_EXT),r===a.SHORT&&u&&(l=u.RGB16_SNORM_EXT),r===a.UNSIGNED_SHORT_5_6_5&&(l=a.RGB565),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGB4),r===a.UNSIGNED_INT_5_9_9_9_REV&&(l=a.RGB9_E5),r===a.UNSIGNED_INT_10F_11F_11F_REV&&(l=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGB8UI),r===a.UNSIGNED_SHORT&&(l=a.RGB16UI),r===a.UNSIGNED_INT&&(l=a.RGB32UI),r===a.BYTE&&(l=a.RGB8I),r===a.SHORT&&(l=a.RGB16I),r===a.INT&&(l=a.RGB32I)),t===a.RGBA){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGBA32F),r===a.HALF_FLOAT&&(l=a.RGBA16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8_ALPHA8:a.RGBA8),r===a.BYTE&&(l=a.RGBA8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGBA16_EXT),r===a.SHORT&&u&&(l=u.RGBA16_SNORM_EXT),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGBA4),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGBA8UI),r===a.UNSIGNED_SHORT&&(l=a.RGBA16UI),r===a.UNSIGNED_INT&&(l=a.RGBA32UI),r===a.BYTE&&(l=a.RGBA8I),r===a.SHORT&&(l=a.RGBA16I),r===a.INT&&(l=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(r===a.UNSIGNED_SHORT&&(l=a.DEPTH_COMPONENT16),r===a.UNSIGNED_INT&&(l=a.DEPTH_COMPONENT24),r===a.FLOAT&&(l=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&r===a.UNSIGNED_INT_24_8&&(l=a.DEPTH24_STENCIL8),l!==a.R16F&&l!==a.R32F&&l!==a.RG16F&&l!==a.RG32F&&l!==a.RGBA16F&&l!==a.RGBA32F||o.get("EXT_color_buffer_float"),l}setTextureParameters(e,t){const{gl:r,extensions:s,backend:i}=this,{state:n}=this.backend,a=p.getPrimaries(p.workingColorSpace),o=t.colorSpace===T?null:p.getPrimaries(t.colorSpace),u=t.colorSpace===T||a===o?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,u),r.texParameteri(e,r.TEXTURE_WRAP_S,MR[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,MR[t.wrapT]),e!==r.TEXTURE_3D&&e!==r.TEXTURE_2D_ARRAY||t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,MR[t.wrapR]),r.texParameteri(e,r.TEXTURE_MAG_FILTER,BR[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,d=t.minFilter===le&&l?Y:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,BR[d]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,LR[t.compareFunction])),!0===s.has("EXT_texture_filter_anisotropic")){if(t.magFilter===B)return;if(t.minFilter!==bt&&t.minFilter!==Y)return;if(t.type===K&&!1===s.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const n=s.get("EXT_texture_filter_anisotropic");r.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:r,defaultTextures:s}=this,i=this.getGLTextureType(e);let n=s[i];void 0===n&&(n=t.createTexture(),r.state.bindTexture(i,n),t.texParameteri(i,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(i,t.TEXTURE_MAG_FILTER,t.NEAREST),s[i]=n),r.set(e,{textureGPU:n,glTextureType:i})}createTexture(e,t){const{gl:r,backend:s}=this,{levels:i,width:n,height:a,depth:o}=t,u=s.utils.convert(e.format,e.colorSpace),l=s.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,u,l,e.normalized,e.colorSpace,e.isVideoTexture),c=r.createTexture(),h=this.getGLTextureType(e);s.state.bindTexture(h,c),this.setTextureParameters(h,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,i,d,n,a,o):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,i,d,n,a,o):e.isVideoTexture||r.texStorage2D(h,i,d,n,a),s.set(e,{textureGPU:c,glTextureType:h,glFormat:u,glType:l,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:r,backend:s}=this,{state:i}=s,{textureGPU:n,glTextureType:a,glFormat:o,glType:u}=s.get(t),{width:l,height:d}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),s.state.bindTexture(a,n),i.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(a,0,0,0,l,d,o,u,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),s.state.unbindTexture()}updateTexture(e,t){const{gl:r}=this,{width:s,height:i}=t,{textureGPU:n,glTextureType:a,glFormat:o,glType:u,glInternalFormat:l}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==n)if(this.backend.state.bindTexture(a,n),this.setTextureParameters(a,e),e.isCompressedTexture){const s=e.mipmaps,i=t.image;for(let t=0;t0){const t=jr(s.width,s.height,e.format,e.type);for(const i of e.layerUpdates){const e=s.data.subarray(i*t/s.data.BYTES_PER_ELEMENT,(i+1)*t/s.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,i,s.width,s.height,1,o,u,e)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,s.width,s.height,s.depth,o,u,s.data)}else if(e.isData3DTexture){const e=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,u,e.data)}else if(e.isVideoTexture)e.update(),r.texImage2D(a,0,l,o,u,t.image);else{const n=e.mipmaps;if(n.length>0)for(let e=0,t=n.length;e0,c=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(d){const r=0!==a||0!==o;let d,h;if(!0===e.isDepthTexture?(d=s.DEPTH_BUFFER_BIT,h=s.DEPTH_ATTACHMENT,t.stencil&&(d|=s.STENCIL_BUFFER_BIT)):(d=s.COLOR_BUFFER_BIT,h=s.COLOR_ATTACHMENT0),r){const e=this.backend.get(t.renderTarget),r=e.framebuffers[t.getCacheKey()],h=e.msaaFrameBuffer;i.bindFramebuffer(s.DRAW_FRAMEBUFFER,r),i.bindFramebuffer(s.READ_FRAMEBUFFER,h);const p=c-o-l;s.blitFramebuffer(a,p,a+u,p+l,a,p,a+u,p+l,d,s.NEAREST),i.bindFramebuffer(s.READ_FRAMEBUFFER,r),i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,p,u,l),i.unbindTexture()}else{const e=s.createFramebuffer();i.bindFramebuffer(s.DRAW_FRAMEBUFFER,e),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,h,s.TEXTURE_2D,n,0),s.blitFramebuffer(0,0,u,l,0,0,u,l,d,s.NEAREST),s.deleteFramebuffer(e)}}else i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,c-l-o,u,l),i.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,s=!1){const{gl:i}=this,n=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:u,width:l,height:d}=n;if(i.bindRenderbuffer(i.RENDERBUFFER,e),o&&!u){let t=i.DEPTH_COMPONENT24;if(!0===s){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(i.RENDERBUFFER,n.samples,t,l,d)}else r>0?(a&&a.isDepthTexture&&a.type===i.FLOAT&&(t=i.DEPTH_COMPONENT32F),i.renderbufferStorageMultisample(i.RENDERBUFFER,r,t,l,d)):i.renderbufferStorage(i.RENDERBUFFER,t,l,d);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e)}else o&&u&&(r>0?i.renderbufferStorageMultisample(i.RENDERBUFFER,r,i.DEPTH24_STENCIL8,l,d):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,l,d),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e));i.bindRenderbuffer(i.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,s,i,n){const{backend:a,gl:o}=this,{textureGPU:u,glFormat:l,glType:d}=this.backend.get(e),c=o.createFramebuffer();a.state.bindFramebuffer(o.READ_FRAMEBUFFER,c);const h=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+n:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,u,0);const p=this._getTypedArrayType(d),g=s*i*this._getBytesPerTexel(d,l),m=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.bufferData(o.PIXEL_PACK_BUFFER,g,o.STREAM_READ),o.readPixels(t,r,s,i,l,d,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const f=new p(g/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,f),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(c),f}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:r}=this;let s=0;return e===r.UNSIGNED_BYTE&&(s=1),e!==r.UNSIGNED_SHORT_4_4_4_4&&e!==r.UNSIGNED_SHORT_5_5_5_1&&e!==r.UNSIGNED_SHORT_5_6_5&&e!==r.UNSIGNED_SHORT&&e!==r.HALF_FLOAT||(s=2),e!==r.UNSIGNED_INT&&e!==r.FLOAT||(s=4),t===r.RGBA?4*s:t===r.RGB?3*s:t===r.ALPHA?s:void 0}dispose(){const{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function DR(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class UR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class IR{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(null!==this.maxUniformBlockSize)return this.maxUniformBlockSize;const e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}}const OR={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class VR{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:r,mode:s,object:i,type:n,info:a,index:o}=this;0!==o?r.drawElements(s,t,n,e):r.drawArrays(s,e,t),a.update(i,t,1)}renderInstances(e,t,r){const{gl:s,mode:i,type:n,index:a,object:o,info:u}=this;0!==r&&(0!==a?s.drawElementsInstanced(i,t,n,e,r):s.drawArraysInstanced(i,e,t,r),u.update(o,t,r))}renderMultiDraw(e,t,r){const{extensions:s,mode:i,object:n,info:a}=this;if(0===r)return;const o=s.get("WEBGL_multi_draw");if(null===o)for(let s=0;sthis.maxQueries)return v(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null==t)return;if(null!==this.activeQuery)return;const r=this.queries[t];if(r)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){o("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){o("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[t,r]of this.queryOffsets){if("ended"===this.queryStates.get(r)){const s=this.queries[r];e.set(t,this.resolveQuery(s))}}if(0===e.size)return this.lastValue;const t={},r=[];for(const[s,i]of e){const e=s.match(/^(.*):f(\d+)$/),n=parseInt(e[2]);!1===r.includes(n)&&r.push(n),void 0===t[n]&&(t[n]=0);const a=await i;this.timestamps.set(s,a),t[n]+=a}const s=t[r[r.length-1]];return this.lastValue=s,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,s}catch(e){return o("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let r,s=!1;const i=e=>{s||(s=!0,r&&(clearTimeout(r),r=null),t(e))},n=()=>{if(this.isDisposed)i(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void i(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(r=setTimeout(n,1));const s=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(s)/1e6)}catch(e){o("Error checking query:",e),t(this.lastValue)}};n()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class zR extends vR{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},s=void 0!==t.context?t.context:e.domElement.getContext("webgl2",r);function i(t){t.preventDefault();const r={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(r)}this._onContextLost=i,e.domElement.addEventListener("webglcontextlost",i,!1),this.gl=s,this.extensions=new UR(this),this.capabilities=new IR(this),this.attributeUtils=new AR(this),this.textureUtils=new PR(this),this.bufferRenderer=new VR(this),this.state=new wR(this),this.utils=new CR(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(d("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return c}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){const s=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:s.RGBA8}),null!==r){const t=e.stencilBuffer?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&d("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new GR(this.gl,e,2048));const r=this.timestampQueryPool[e];null!==r.allocateQueriesForContext(t)&&r.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.viewport(0,0,e,r)}if(e.scissor)this.updateScissor(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.scissor(0,0,e,r)}this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const s=e.occlusionQueryCount;s>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=new Array(s),r.occlusionQueryObjects=new Array(s),r.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:r}=this,s=this.get(e),i=s.previousContext;r.resetVertexState();const n=e.occlusionQueryCount;n>0&&(n>s.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let e=0;e{let a=0;for(let t=0;t1?t.renderInstances(r,s,i):t.render(r,s)}draw(e){const{object:t,pipeline:r,material:s,context:i,hardwareClippingPlanes:n}=e,{programGPU:a}=this.get(r),{gl:o,state:u}=this,l=this.get(i),d=e.getDrawParameters();if(null===d)return;this._bindUniforms(e.getBindings());const c=t.isMesh&&t.matrixWorld.determinant()<0;u.setMaterial(s,c,n),null!==i.mrt&&null!==i.textures&&u.setMRTBlending(i.textures,i.mrt,s),u.useProgram(a);const h=e.getAttributes(),p=this.get(h);let g=p.vaoGPU;if(void 0===g){const e=this._getVaoKey(h);g=this.vaoCache[e],void 0===g&&(g=this._createVao(h),this.vaoCache[e]=g,p.vaoGPU=g)}const m=e.getIndex(),f=null!==m?this.get(m).bufferGPU:null;u.setVertexState(g,f);const y=l.lastOcclusionObject;if(y!==t&&void 0!==y){if(null!==y&&!0===y.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),l.occlusionQueryIndex++),!0===t.occlusionTest){const e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),l.occlusionQueries[l.occlusionQueryIndex]=e,l.occlusionQueryObjects[l.occlusionQueryIndex]=t}l.lastOcclusionObject=t}const b=this.bufferRenderer;t.isPoints?b.mode=o.POINTS:t.isLineSegments?b.mode=o.LINES:t.isLine?b.mode=o.LINE_STRIP:t.isLineLoop?b.mode=o.LINE_LOOP:!0===s.wireframe?(u.setLineWidth(s.wireframeLinewidth*this.renderer.getPixelRatio()),b.mode=o.LINES):b.mode=o.TRIANGLES;const{vertexCount:x,instanceCount:T}=d;let{firstVertex:_}=d;if(b.object=t,null!==m){_*=m.array.BYTES_PER_ELEMENT;const e=this.get(m);b.index=m.count,b.type=e.type}else b.index=0;if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const r=this.get(e.camera),s=e.camera.cameras,i=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===r.indexesGPU||r.indexesGPU.length!==s.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let r=0,i=s.length;r{const i=this.parallel,n=()=>{r.getProgramParameter(a,i.COMPLETION_STATUS_KHR)?(this._completeCompile(e,s),t()):requestAnimationFrame(n)};n()});return void t.push(i)}this._completeCompile(e,s)}_handleSource(e,t){const r=e.split("\n"),s=[],i=Math.max(t-6,0),n=Math.min(t+6,r.length);for(let e=i;e":" "} ${i}: ${r[e]}`)}return s.join("\n")}_getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(s&&""===i)return"";const n=/ERROR: 0:(\d+)/.exec(i);if(n){const s=parseInt(n[1]);return r.toUpperCase()+"\n\n"+i+"\n\n"+this._handleSource(e.getShaderSource(t),s)}return i}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){const s=this.gl,i=(s.getProgramInfoLog(e)||"").trim();if(!1===s.getProgramParameter(e,s.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(s,e,r,t);else{const n=this._getShaderErrors(s,r,"vertex"),a=this._getShaderErrors(s,t,"fragment");o("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(e,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+n+"\n"+a)}else""!==i&&d("WebGLProgram: Program Info Log:",i)}}_completeCompile(e,t){const{state:r,gl:s}=this,i=this.get(t),{programGPU:n,fragmentShader:a,vertexShader:o}=i;!1===s.getProgramParameter(n,s.LINK_STATUS)&&this._logProgramError(n,a,o),r.useProgram(n);const u=e.getBindings();this._setupBindings(u,n),this.set(t,{programGPU:n,pipeline:n})}createComputePipeline(e,t){const{state:r,gl:s}=this,i={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(i);const{computeProgram:n}=e,a=s.createProgram(),o=this.get(i).shaderGPU,u=this.get(n).shaderGPU,l=n.transforms,d=[],c=[];for(let e=0;eOR[t]===e),r=this.extensions;for(let e=0;e1,h=!0===i.isXRRenderTarget,p=!0===h&&!0===i._hasExternalTextures;let g=n.msaaFrameBuffer,m=n.depthRenderbuffer;const f=this.extensions.get("WEBGL_multisampled_render_to_texture"),y=this.extensions.get("OVR_multiview2"),b=this._useMultisampledExtension(i),x=Zy(e);let T;if(l?(n.cubeFramebuffers||(n.cubeFramebuffers={}),T=n.cubeFramebuffers[x]):h&&!1===p?T=this._xrFramebuffer:(n.framebuffers||(n.framebuffers={}),T=n.framebuffers[x]),void 0===T){T=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,T);const s=e.textures,o=[];if(l){n.cubeFramebuffers[x]=T;const{textureGPU:e}=this.get(s[0]),r=this.renderer._activeCubeFace,i=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,i)}else{n.framebuffers[x]=T;for(let r=0;r0&&!1===b&&!i.multiview){if(void 0===g){const s=[];g=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,g);const i=[],l=e.textures;for(let r=0;r0&&!1===this._useMultisampledExtension(s)){const n=i.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;s.resolveDepthBuffer&&(s.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),s.stencilBuffer&&s.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=i.msaaFrameBuffer,u=i.msaaRenderbuffers,l=e.textures,d=l.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,n),d)for(let e=0;e0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const $R="point-list",WR="line-list",HR="line-strip",qR="triangle-list",jR="undefined"!=typeof self&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},XR="never",KR="less",QR="equal",YR="less-equal",ZR="greater",JR="not-equal",eE="greater-equal",tE="always",rE="store",sE="load",iE="clear",nE="ccw",aE="cw",oE="none",uE="back",lE="uint16",dE="uint32",cE="r8unorm",hE="r8snorm",pE="r8uint",gE="r8sint",mE="r16uint",fE="r16sint",yE="r16float",bE="rg8unorm",xE="rg8snorm",TE="rg8uint",_E="rg8sint",vE="r16unorm",NE="r16snorm",SE="r32uint",RE="r32sint",EE="r32float",AE="rg16uint",wE="rg16sint",CE="rg16float",ME="rgba8unorm",BE="rgba8unorm-srgb",LE="rgba8snorm",FE="rgba8uint",PE="rgba8sint",DE="bgra8unorm",UE="bgra8unorm-srgb",IE="rg16unorm",OE="rg16snorm",VE="rgb9e5ufloat",kE="rgb10a2unorm",GE="rg11b10ufloat",zE="rg32uint",$E="rg32sint",WE="rg32float",HE="rgba16uint",qE="rgba16sint",jE="rgba16float",XE="rgba16unorm",KE="rgba16snorm",QE="rgba32uint",YE="rgba32sint",ZE="rgba32float",JE="depth16unorm",eA="depth24plus",tA="depth24plus-stencil8",rA="depth32float",sA="depth32float-stencil8",iA="bc1-rgba-unorm",nA="bc1-rgba-unorm-srgb",aA="bc2-rgba-unorm",oA="bc2-rgba-unorm-srgb",uA="bc3-rgba-unorm",lA="bc3-rgba-unorm-srgb",dA="bc4-r-unorm",cA="bc4-r-snorm",hA="bc5-rg-unorm",pA="bc5-rg-snorm",gA="bc6h-rgb-ufloat",mA="bc6h-rgb-float",fA="bc7-rgba-unorm",yA="bc7-rgba-unorm-srgb",bA="etc2-rgb8unorm",xA="etc2-rgb8unorm-srgb",TA="etc2-rgb8a1unorm",_A="etc2-rgb8a1unorm-srgb",vA="etc2-rgba8unorm",NA="etc2-rgba8unorm-srgb",SA="eac-r11unorm",RA="eac-r11snorm",EA="eac-rg11unorm",AA="eac-rg11snorm",wA="astc-4x4-unorm",CA="astc-4x4-unorm-srgb",MA="astc-5x4-unorm",BA="astc-5x4-unorm-srgb",LA="astc-5x5-unorm",FA="astc-5x5-unorm-srgb",PA="astc-6x5-unorm",DA="astc-6x5-unorm-srgb",UA="astc-6x6-unorm",IA="astc-6x6-unorm-srgb",OA="astc-8x5-unorm",VA="astc-8x5-unorm-srgb",kA="astc-8x6-unorm",GA="astc-8x6-unorm-srgb",zA="astc-8x8-unorm",$A="astc-8x8-unorm-srgb",WA="astc-10x5-unorm",HA="astc-10x5-unorm-srgb",qA="astc-10x6-unorm",jA="astc-10x6-unorm-srgb",XA="astc-10x8-unorm",KA="astc-10x8-unorm-srgb",QA="astc-10x10-unorm",YA="astc-10x10-unorm-srgb",ZA="astc-12x10-unorm",JA="astc-12x10-unorm-srgb",ew="astc-12x12-unorm",tw="astc-12x12-unorm-srgb",rw="clamp-to-edge",sw="repeat",iw="mirror-repeat",nw="linear",aw="nearest",ow="zero",uw="one",lw="src",dw="one-minus-src",cw="src-alpha",hw="one-minus-src-alpha",pw="dst",gw="one-minus-dst",mw="dst-alpha",fw="one-minus-dst-alpha",yw="src-alpha-saturated",bw="constant",xw="one-minus-constant",Tw="add",_w="subtract",vw="reverse-subtract",Nw="min",Sw="max",Rw=0,Ew=15,Aw="keep",ww="zero",Cw="replace",Mw="invert",Bw="increment-clamp",Lw="decrement-clamp",Fw="increment-wrap",Pw="decrement-wrap",Dw="storage",Uw="read-only-storage",Iw="write-only",Ow="read-only",Vw="read-write",kw="non-filtering",Gw="comparison",zw="float",$w="unfilterable-float",Ww="depth",Hw="sint",qw="uint",jw="2d",Xw="3d",Kw="2d",Qw="2d-array",Yw="cube",Zw="3d",Jw="all",eC="vertex",tC="instance",rC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},sC={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class iC extends aR{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class nC extends JS{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let aC=0;class oC extends nC{constructor(e,t){super("StorageBuffer_"+aC++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:ii.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class uC extends Ry{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:nw}),this.flipYSampler=e.createSampler({minFilter:aw}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4f,\n\t@location( 0 ) vTex : vec2f,\n\t@location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32,\n};\n\n@group( 0 ) @binding ( 2 )\nvar flipY: u32;\n\n@vertex\nfn mainVS(\n\t\t@builtin( vertex_index ) vertexIndex : u32,\n\t\t@builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array(\n\t\tvec2f( -1, -1 ),\n\t\tvec2f( -1, 3 ),\n\t\tvec2f( 3, -1 ),\n\t);\n\n\tlet p = pos[ vertexIndex ];\n\tlet mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 );\n\tVarys.vTex = p * mult + vec2f( 0.5 );\n\tVarys.Position = vec4f( p, 0, 1 );\n\tVarys.vBaseArrayLayer = instanceIndex;\n\n\treturn Varys;\n\n}\n\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img2d : texture_2d;\n\n@fragment\nfn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2d, imgSampler, Varys.vTex );\n\n}\n\n@group( 0 ) @binding( 1 )\nvar img2dArray : texture_2d_array;\n\n@fragment\nfn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer );\n\n}\n\nconst faceMat = array(\n mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x\n mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x\n mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y\n mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y\n mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z\n mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z\n);\n\n@group( 0 ) @binding( 1 )\nvar imgCube : texture_cube;\n\n@fragment\nfn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );\n\n}\n"})}getTransferPipeline(e,t){const r=`${e}-${t=t||"2d-array"}`;let s=this.transferPipelines[r];return void 0===s&&(s=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[r]=s),s}flipY(e,t,r=0){const s=t.format,{width:i,height:n}=t.size,a=this.device.createTexture({size:{width:i,height:n},format:s,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),o=this.getTransferPipeline(s,e.textureBindingViewDimension),u=this.getTransferPipeline(s,a.textureBindingViewDimension),l=this.device.createCommandEncoder({}),d=(e,t,r,s,i,n)=>{const a=e.getBindGroupLayout(0),o=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t.createView({dimension:t.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:n?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),u=l.beginRenderPass({colorAttachments:[{view:s.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1}),loadOp:iE,storeOp:rE}]});u.setPipeline(e),u.setBindGroup(0,o),u.draw(3,1,0,r),u.end()};d(o,e,r,a,0,!1),d(u,a,0,e,r,!0),this.device.queue.submit([l.finish()]),a.destroy()}generateMipmaps(e,t=null){const r=this.get(e),s=r.layers||this._mipmapCreateBundles(e),i=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(i,s),null===t&&this.device.queue.submit([i.finish()]),r.layers=s}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",r=this.getTransferPipeline(e.format,t),s=r.getBindGroupLayout(0),i=[];for(let n=1;n0)for(let t=0,n=s.length;t0){for(const s of e.layerUpdates)this._copyBufferToTexture(t.image,r.texture,i,s,e.flipY,s);e.clearLayerUpdates()}else for(let s=0;s0)for(let t=0,n=s.length;t{const t=e.changedElements;for(const e of r)t.includes(e.image)&&(e.needsUpdate=!0)}}dispose(){this._samplerCache.clear(),this._htmlTextures.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(void 0===t){const r=new N;r.minFilter=B,r.magFilter=B,this.createTexture(r,{width:1,height:1,format:e}),this.defaultTexture[e]=t=r}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(void 0===t){const r=new D;r.minFilter=B,r.magFilter=B,this.createTexture(r,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=r}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,r){const s=e.images,i=e.mipmaps;for(let n=0;n<6;n++){const a=s[n],o=!0===e.flipY?dC[n]:n;a.isDataTexture?this._copyBufferToTexture(a.image,t,r,o,e.flipY):this._copyImageToTexture(a,t,r,o,e.flipY,e.premultiplyAlpha);for(let s=0;s0?e.width:r.size.width,l=a>0?e.height:r.size.height;try{o.queue.copyExternalImageToTexture({source:e,flipY:i},{texture:t,mipLevel:a,origin:{x:0,y:0,z:s},premultipliedAlpha:n},{width:u,height:l,depthOrArrayLayers:1})}catch(e){}}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new uC(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,s,i,n=0,a=0){const o=this.backend.device,u=e.data,l=this._getBytesPerTexel(r.format),d=e.width*l;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:s}},u,{offset:e.width*e.height*l*n,bytesPerRow:d},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===i&&this._flipY(t,r,s)}_copyCompressedBufferToTexture(e,t,r){const s=this.backend.device,i=this._getBlockData(r.format),n=r.size.depthOrArrayLayers>1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,gC=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,mC={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class fC extends hS{constructor(e){const{type:t,inputs:r,name:s,inputsCode:i,blockCode:n,outputType:a}=(e=>{const t=(e=e.trim()).match(pC);if(null!==t&&4===t.length){const r=t[2],s=[];let i=null;for(;null!==(i=gC.exec(r));)s.push({name:i[1],type:i[2]});const n=[];for(let e=0;e "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class yC extends cS{parseFunction(e){return new fC(e)}}const bC={[ii.READ_ONLY]:"read",[ii.WRITE_ONLY]:"write",[ii.READ_WRITE]:"read_write"},xC={[kr]:"repeat",[_e]:"clamp",[Vr]:"mirror"},TC={vertex:jR.VERTEX,fragment:jR.FRAGMENT,compute:jR.COMPUTE},_C={instance:!0,swizzleAssign:!1,storageBuffer:!0},vC={"^^":"tsl_xor"},NC={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},SC={},RC={tsl_xor:new fT("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new fT("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new fT("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new fT("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new fT("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new fT("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new fT("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new fT("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new fT("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new fT("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new fT("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new fT("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new fT("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n"),biquadraticTextureArray:new fT("\nfn tsl_biquadraticTexture_array( map : texture_2d_array, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},EC={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let AC="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(AC+="diagnostic( off, derivative_uniformity );\n");class wC extends QN{constructor(e,t){super(e,t,new yC),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,r,s,i,n=this.shaderStage){return"fragment"===n?s?i?`textureSample( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${s} )`:i?`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`:this.generateTextureSampleLevel(e,t,r,"0",s)}generateTextureSampleLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateWrapFunction(e){const t=`tsl_coord_${xC[e.wrapS]}S_${xC[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let r=SC[t];if(void 0===r){const s=[],i=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let n=`fn ${t}( coord : ${i} ) -> ${i} {\n\n\treturn ${i}(\n`;const a=(e,t)=>{e===kr?(s.push(RC.repeatWrapping_float),n+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===_e?(s.push(RC.clampWrapping_float),n+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===Vr?(s.push(RC.mirrorWrapping_float),n+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):(n+=`\t\tcoord.${t}`,d(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};a(e.wrapS,"x"),n+=",\n",a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(n+=",\n",a(e.wrapR,"z")),n+="\n\t);\n\n}\n",SC[t]=r=new fT(n,s)}return r.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){const s=this.getDataFromNode(e,this.shaderStage,this.cache);void 0===s.dimensionsSnippet&&(s.dimensionsSnippet={});let i=s.dimensionsSnippet[r];if(void 0===s.dimensionsSnippet[r]){let n,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),u=o>1;a=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",n=u||e.isStorageTexture?t:`${t}${r?`, u32( ${r} )`:""}`,i=new Du(new wl(`textureDimensions( ${n} )`,a)),s.dimensionsSnippet[r]=i,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(s.arrayLayerCount=new Du(new wl(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(s.cubeFaceCount=new Du(new wl("6u","u32")))}return i.build(this)}generateFilteredTexture(e,t,r,s,i="0u",n){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,i);return s&&(r=`${r} + vec2(${s}) / ${o}`),n?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${r} ), ${o}, u32( ${n} ), u32( ${i} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${r} ), ${o}, u32( ${i} ) )`)}generateTextureLod(e,t,r,s,i,n="0u"){if(!0===e.isCubeTexture){i&&(r=`${r} + vec3(${i})`);return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${e.isDepthTexture?"u32":"f32"}( ${n} ) )`}const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,n),u=e.is3DTexture||e.isData3DTexture?"vec3":"vec2";i&&(r=`${r} + ${u}(${i}) / ${u}( ${o} )`);return r=`${u}( clamp( floor( ${a}( ${r} ) * ${u}( ${o} ) ), ${`${u}( 0 )`}, ${`${u}( ${o} - ${"vec3"===u?"vec3( 1, 1, 1 )":"vec2( 1, 1 )"} )`} ) )`,this.generateTextureLoad(e,t,r,n,s,null)}generateStorageTextureLoad(e,t,r,s,i,n){let a;return n&&(r=`${r} + ${n}`),a=i?`textureLoad( ${t}, ${r}, ${i} )`:`textureLoad( ${t}, ${r} )`,a}generateTextureLoad(e,t,r,s,i,n){let a;return null===s&&(s="0u"),n&&(r=`${r} + ${n}`),i?a=`textureLoad( ${t}, ${r}, ${i}, u32( ${s} ) )`:(a=`textureLoad( ${t}, ${r}, u32( ${s} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,r,s,i){let n;return n=s?`textureStore( ${t}, ${r}, ${s}, ${i} )`:`textureStore( ${t}, ${r}, ${i} )`,n}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction&&this.renderer.hasCompatibility(E.TEXTURE_COMPARE)}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&e.type===K||!1===this.isSampleCompare(e)&&e.minFilter===B&&e.magFilter===B||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,s,i,n=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,r,s,i,"0",n):this._generateTextureSample(e,t,r,s,i,n),a}generateTextureGrad(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]} )`:n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]} )`;o(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateTextureBias(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,r=e.type;return"texture"===r||"cubeTexture"===r||"cubeDepthTexture"===r||"storageTexture"===r||"texture3D"===r?t:"buffer"===r||"storageBuffer"===r||"indirectStorageBuffer"===r?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=vC[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(d("WebGPURenderer: Atomic operations are only supported in compute shaders."),ii.READ_WRITE):ii.READ_ONLY:e.access}getStorageAccess(e,t){return bC[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);if(void 0===n.uniformGPU){let a;const o=e.groupNode,u=o.name,l=this.getBindGroupArray(u,r);if("texture"===t||"cubeTexture"===t||"cubeDepthTexture"===t||"storageTexture"===t||"texture3D"===t){let s=null;const n=this.getNodeAccess(e,r);"texture"===t||"storageTexture"===t?s=!0===e.value.is3DTexture?new cR(i.name,i.node,o,n):new lR(i.name,i.node,o,n):"cubeTexture"===t||"cubeDepthTexture"===t?s=new dR(i.name,i.node,o,n):"texture3D"===t&&(s=new cR(i.name,i.node,o,n)),s.store=!0===e.isStorageTextureNode,s.mipLevel=s.store?e.mipLevel:0,s.setVisibility(TC[r]);if(!0===e.value.isCubeTexture||!1===this.isUnfilterable(e.value)&&!1===s.store){const e=new iC(`${i.name}_sampler`,i.node,o);e.setVisibility(TC[r]),l.push(e,s),a=[e,s]}else l.push(s),a=[s]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const n=this.getSharedDataFromNode(e);let u=n.buffer;if(void 0===u){u=new("buffer"===t?rR:oC)(e,o),n.buffer=u}u.setVisibility(u.getVisibility()|TC[r]),l.push(u),a=u,i.name=s||"NodeBuffer_"+i.id}else{let e=this.uniformGroups[u];void 0===e&&(e=new nR(u,o),e.setVisibility(jR.VERTEX|jR.FRAGMENT|jR.COMPUTE),this.uniformGroups[u]=e),-1===l.indexOf(e)&&l.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}getBuiltin(e,t,r,s=this.shaderStage){const i=this.builtins[s]||(this.builtins[s]=new Map);return!1===i.has(e)&&i.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(e.name+" : "+this.getType(e.type));let i=`fn ${t.name}( ${s.join(", ")} ) -> ${this.getType(t.type)} {\n${r.vars}\n${r.code}\n`;return r.result&&(i+=`\treturn ${r.result};\n`),i+="\n}\n",i}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],r=this.directives[e];if(void 0!==r)for(const e of r)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],r=this.builtins[e];if(void 0!==r)for(const{name:e,property:s,type:i}of r.values())t.push(`@builtin( ${e} ) ${s} : ${i}`);return t.join(",\n\t")}getScopedArray(e,t,r,s){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:s}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:e,scope:r,bufferType:s,bufferCount:i}of this.scopedArrays.values()){const n=this.getType(s);t.push(`var<${r}> ${e}: array< ${n}, ${i} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const r=this.getAttributesArray();for(let e=0,s=r.length;e"),t.push(`\t${s+r.name} : ${i}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const r=this.structs[e];if(r.length>0){const e=[];for(const t of r){let r=`struct ${t.name} {\n`;r+=this.getStructMembers(t),r+="\n};",e.push(r)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,r=null,s=""){let i=`var${s} ${t} : `;return i+=null!==r?this.generateArrayDeclaration(e,r):this.getType(e),i}getVars(e,t=!1){let r="";t&&(r="");const s=[],i=this.vars[e];if(void 0!==i)for(const e of i)s.push(`${this.getVar(e.type,e.name,e.count,r)};`);return t?s.join("\n"):`\n\t${s.join("\n\t")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","builtinClipSpace","vec4","vertex"),"vertex"===e||"fragment"===e){const r=this.varyings,s=this.vars[e];let i=0;for(let n=0;nr.value.itemSize;return s&&!i}getUniforms(e){const t=this.renderer.backend,r=this.uniforms[e],s=[],i=[],n=[],a={};for(const n of r){const r=n.groupNode.name,o=this.bindingsIndexes[r];if("texture"===n.type||"cubeTexture"===n.type||"cubeDepthTexture"===n.type||"storageTexture"===n.type||"texture3D"===n.type){const r=n.node.value;let i;(!0===r.isCubeTexture||!1===this.isUnfilterable(r)&&!0!==n.node.isStorageTextureNode)&&(this.isSampleCompare(r)?s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler_comparison;`):s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler;`));let a="";const{primarySamples:u}=t.utils.getTextureSampleData(r);if(u>1&&(a="_multisampled"),!0===r.isCubeTexture&&!0===r.isDepthTexture)i="texture_depth_cube";else if(!0===r.isCubeTexture)i="texture_cube";else if(!0===r.isDepthTexture)i=t.compatibilityMode&&null===r.compareFunction?`texture${a}_2d`:`texture_depth${a}_2d${!0===r.isArrayTexture?"_array":""}`;else if(!0===n.node.isStorageTextureNode){const s=hC(r,t.device),a=this.getStorageAccess(n.node,e),o=n.node.value.is3DTexture,u=n.node.value.isArrayTexture;i=`texture_storage_${o?"3d":"2d"+(u?"_array":"")}<${s}, ${a}>`}else if(!0===r.isArrayTexture||!0===r.isDataArrayTexture||!0===r.isCompressedArrayTexture)i="texture_2d_array";else if(!0===r.is3DTexture||!0===r.isData3DTexture)i="texture_3d";else{i=`texture${a}_2d<${this.getComponentTypeFromTexture(r).charAt(0)}32>`}s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name} : ${i};`)}else if("buffer"===n.type||"storageBuffer"===n.type||"indirectStorageBuffer"===n.type){const t=n.node,r=this.getType(t.getNodeType(this)),s=t.bufferCount,a=s>0&&"buffer"===n.type?", "+s:"",u=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(n))i.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var<${u}> ${n.name} : ${r};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${r}>`:`${r}`}${a} >`;i.push(this._getWGSLStructBinding(n.name,e,u,o.binding++,o.group))}}else{const e=n.groupNode.name;if(void 0===a[e]){const t=this.uniformGroups[e];if(void 0!==t){const r=[];for(const e of t.uniforms){const t=e.getType(),s=this.getType(this.getVectorType(t));r.push(`\t${e.name} : ${s}`)}let s=this.uniformGroupsBindings[e];void 0===s&&(s={index:o.binding++,id:o.group},this.uniformGroupsBindings[e]=s),a[e]={index:s.index,id:s.id,snippets:r}}}}}for(const e in a){const t=a[e];n.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}return[...s,...i,...n].join("\n")}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const r=this.allowGlobalVariables,s=e[t];s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.structs=this.getStructs(t),s.vars=this.getVars(t,r),s.codes=this.getCodes(t),s.directives=this.getDirectives(t),s.scopedArrays=this.getScopedArrays(t);let i="// code\n\n";i+=this.flowCode[t];const n=this.flowNodes[t],a=n[n.length-1],o=a.outputNode,u=void 0!==o&&!0===o.isOutputStructNode;for(const e of n){const r=this.getFlowData(e),n=e.name;if(n&&(i.length>0&&(i+="\n"),i+=`\t// flow -> ${n}\n`),i+=`${r.code}\n\t`,e===a&&"compute"!==t)if(i+="// result\n\n\t","vertex"===t)i+=`varyings.builtinClipSpace = ${r.result};`;else if("fragment"===t)if(u)s.returnType=o.getNodeType(this),s.structs+="var output : "+s.returnType+";",i+=`return ${r.result};`;else{let e="\t@location( 0 ) color: vec4";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),s.returnType="OutputStruct",s.structs+=this._getWGSLStruct("OutputStruct",e),s.structs+="\nvar output : OutputStruct;",i+=`output.color = ${r.result};\n\n\treturn output;`}}s.flow=i}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return null!==t&&(r=this._getWGSLMethod(e+"_"+t)),void 0===r&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return NC[e]||e}isAvailable(e){let t=_C[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),_C[e]=t),t}_getWGSLMethod(e){return void 0!==RC[e]&&this._include(e),EC[e]}_include(e){const t=RC[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar varyings : VaryingsStruct;\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${AC}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[r,s,i]=t;return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${this.allowGlobalVariables?e.vars:""}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${r}, ${s}, ${i} )\nfn main( ${e.attributes} ) {\n\n\t// local vars\n\t${this.allowGlobalVariables?"":e.vars}\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${r} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${r} * numWorkgroups.x ) * ( ${s} * numWorkgroups.y );\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,r,s=0,i=0){const n=e+"Struct";return`${this._getWGSLStruct(n,t)}\n@binding( ${s} ) @group( ${i} )\nvar<${r}> ${e} : ${n};`}}class CC{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(t=null!==e.depthTexture?this.getTextureFormatGPU(e.depthTexture):e.stencil?!0===this.backend.renderer.reversedDepthBuffer?sA:tA:!0===this.backend.renderer.reversedDepthBuffer?rA:eA),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const e=this.backend.renderer,r=e.getRenderTarget();t=r?r.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const r=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:r?1:t,isMSAA:r}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?$R:e.isLineSegments||e.isMesh&&!0===t.wireframe?WR:e.isLine?HR:e.isMesh?qR:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===Ve)return DE;if(e===Te)return jE;throw new Error("Unsupported output buffer type.")}}const MC=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&MC.set(Float16Array,["float16"]);const BC=new Map([[xt,["float16"]]]),LC=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class FC{constructor(e){this.backend=e}createAttribute(e,t){const r=this._getBufferAttribute(e),s=this.backend,i=s.get(r);let n=i.buffer;if(void 0===n){const a=s.device;let o=r.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e{o.unmap()},u=()=>{o.destroy(),t.delete(e),e.removeEventListener("release",i),e.removeEventListener("dispose",u)};e.addEventListener("release",i),e.addEventListener("dispose",u),a.readBufferGPU=o}const u=r.createCommandEncoder({label:`readback_encoder_${s.name}`});u.copyBufferToBuffer(i,0,o,0,n);const l=u.finish();r.queue.submit([l]),await o.mapAsync(GPUMapMode.READ);return o.getMappedRange()}_getVertexFormat(e){const{itemSize:t,normalized:r}=e,s=e.array.constructor,i=e.constructor;let n;if(1===t)n=LC.get(s);else{const e=(BC.get(i)||MC.get(s))[r?1:0];if(e){const r=s.BYTES_PER_ELEMENT*t,i=4*Math.floor((r+3)/4)/s.BYTES_PER_ELEMENT;if(i%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");n=`${e}x${i}`}}return n||o("WebGPUAttributeUtils: Vertex format not supported yet."),n}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class PC{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class DC{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,r=t.device,s=t.get(e);if(s.layout)return s.layout.layoutGPU;const i=this._createLayoutEntries(e),n=Vs(JSON.stringify(i));let a=this._bindGroupLayoutCache.get(n);return void 0===a&&(a=new PC(r.createBindGroupLayout({entries:i})),this._bindGroupLayoutCache.set(n,a)),a.usedTimes++,s.layout=a,s.layoutKey=n,a.layoutGPU}createBindings(e,t,r,s=0){const{backend:i}=this,n=i.get(e),a=this.createBindingsLayout(e);let o;r>0&&(void 0===n.groups&&(n.groups=[],n.versions=[]),n.versions[r]===s&&(o=n.groups[r])),void 0===o&&(o=this.createBindGroup(e,a),r>0&&(n.groups[r]=o,n.versions[r]=s)),n.group=o}updateBinding(e){const t=this.backend,r=t.device,s=e.buffer,i=t.get(e).buffer,n=e.updateRanges;if(0===n.length)r.queue.writeBuffer(i,0,s,0);else{const e=Xr(s),t=e?1:s.BYTES_PER_ELEMENT;for(let a=0,o=n.length;a1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${r}-${s}`,a=e[i],void 0===a){const n=Jw;let o;o=t.isSampledCubeTexture?Yw:t.isSampledTexture3D?Zw:t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?Qw:Kw,a=e[i]=e.texture.createView({aspect:n,dimension:o,mipLevelCount:r,baseMipLevel:s})}}n.push({binding:i,resource:a})}else if(t.isSampler){const e=r.get(t.texture);n.push({binding:i,resource:e.sampler})}i++}return s.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:n})}_createLayoutEntries(e){const t=[];let r=0;for(const s of e.bindings){const e=this.backend,i={binding:r,visibility:s.visibility};if(s.isUniformBuffer||s.isStorageBuffer){const e={};s.isStorageBuffer&&(s.visibility&jR.COMPUTE&&(s.access===ii.READ_WRITE||s.access===ii.WRITE_ONLY)?e.type=Dw:e.type=Uw),i.buffer=e}else if(s.isSampledTexture&&s.store){const e={};e.format=this.backend.get(s.texture).texture.format;const t=s.access;e.access=t===ii.READ_WRITE?Vw:t===ii.WRITE_ONLY?Iw:Ow,s.texture.isArrayTexture?e.viewDimension=Qw:s.texture.is3DTexture&&(e.viewDimension=Zw),i.storageTexture=e}else if(s.isSampledTexture){const t={},{primarySamples:r}=e.utils.getTextureSampleData(s.texture);if(r>1&&(t.multisampled=!0,s.texture.isDepthTexture||(t.sampleType=$w)),s.texture.isDepthTexture)e.compatibilityMode&&null===s.texture.compareFunction?t.sampleType=$w:t.sampleType=Ww;else if(s.texture.isDataTexture||s.texture.isDataArrayTexture||s.texture.isData3DTexture||s.texture.isStorageTexture){const e=s.texture.type;e===R?t.sampleType=Hw:e===S?t.sampleType=qw:e===K&&(this.backend.hasFeature("float32-filterable")?t.sampleType=zw:t.sampleType=$w)}s.isSampledCubeTexture?t.viewDimension=Yw:s.texture.isArrayTexture||s.texture.isDataArrayTexture||s.texture.isCompressedArrayTexture?t.viewDimension=Qw:s.isSampledTexture3D&&(t.viewDimension=Zw),i.texture=t}else if(s.isSampler){const t={};s.texture.isDepthTexture&&(null!==s.texture.compareFunction&&e.hasCompatibility(E.TEXTURE_COMPARE)?t.type=Gw:t.type=kw),i.sampler=t}else o(`WebGPUBindingUtils: Unsupported binding "${s}".`);t.push(i),r++}return t}deleteBindGroupData(e){const{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,0===r.layout.usedTimes&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class UC{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}}class IC{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:r,material:s,geometry:i,pipeline:n}=e,{vertexProgram:a,fragmentProgram:u}=n,l=this.backend,d=l.device,c=l.utils,h=l.get(n),p=[];for(const t of e.getBindings()){const e=l.get(t),{layoutGPU:r}=e.layout;p.push(r)}const g=l.attributeUtils.createShaderVertexBuffers(e);let m;s.blending===re||s.blending===tt&&!1===s.transparent||(m=this._getBlending(s));let f={};!0===s.stencilWrite&&(f={compare:this._getStencilCompare(s),failOp:this._getStencilOperation(s.stencilFail),depthFailOp:this._getStencilOperation(s.stencilZFail),passOp:this._getStencilOperation(s.stencilZPass)});const y=this._getColorWriteMask(s),b=[];if(null!==e.context.textures){const t=e.context.textures,r=e.context.mrt;for(let e=0;e1},layout:d.createPipelineLayout({bindGroupLayouts:p})},A={},w=e.context.depth,C=e.context.stencil;if(!0!==w&&!0!==C||(!0===w&&(A.format=S,A.depthWriteEnabled=s.depthWrite,A.depthCompare=N),!0===C&&(A.stencilFront=f,A.stencilBack=f,A.stencilReadMask=s.stencilFuncMask,A.stencilWriteMask=s.stencilWriteMask),!0===s.polygonOffset&&(A.depthBias=s.polygonOffsetUnits,A.depthBiasSlopeScale=s.polygonOffsetFactor,A.depthBiasClamp=0),E.depthStencil=A),d.pushErrorScope("validation"),null===t)h.pipeline=d.createRenderPipeline(E),d.popErrorScope().then(e=>{null!==e&&(h.error=!0,o(e.message))});else{const e=new Promise(async e=>{try{h.pipeline=await d.createRenderPipelineAsync(E)}catch(e){}const t=await d.popErrorScope();null!==t&&(h.error=!0,o(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const r=this.backend,{utils:s,device:i}=r,n=s.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:s.getCurrentColorFormats(e),depthStencilFormat:n,sampleCount:this._getSampleCount(e)};return i.createRenderBundleEncoder(a)}createComputePipeline(e,t){const r=this.backend,s=r.device,i=r.get(e.computeProgram).module,n=r.get(e),a=[];for(const e of t){const t=r.get(e),{layoutGPU:s}=t.layout;a.push(s)}n.pipeline=s.createComputePipeline({compute:i,layout:s.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,r;const s=e.blending,i=e.blendSrc,n=e.blendDst,a=e.blendEquation;if(s===Rt){const s=null!==e.blendSrcAlpha?e.blendSrcAlpha:i,o=null!==e.blendDstAlpha?e.blendDstAlpha:n,u=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(n),operation:this._getBlendOperation(a)},r={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(u)}}else{const i=(e,s,i,n)=>{t={srcFactor:e,dstFactor:s,operation:Tw},r={srcFactor:i,dstFactor:n,operation:Tw}};if(e.premultipliedAlpha)switch(s){case tt:i(uw,hw,uw,hw);break;case Yt:i(uw,uw,uw,uw);break;case Qt:i(ow,dw,ow,uw);break;case Kt:i(pw,hw,ow,uw)}else switch(s){case tt:i(cw,hw,uw,hw);break;case Yt:i(cw,uw,uw,uw);break;case Qt:o(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Kt:o(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`)}}if(void 0!==t&&void 0!==r)return{color:t,alpha:r};o("WebGPURenderer: Invalid blending: ",s)}_getBlendFactor(e){let t;switch(e){case Et:t=ow;break;case Ht:t=uw;break;case Wt:t=lw;break;case kt:t=dw;break;case rt:t=cw;break;case st:t=hw;break;case zt:t=pw;break;case Vt:t=gw;break;case Gt:t=mw;break;case Ot:t=fw;break;case $t:t=yw;break;case 211:t=bw;break;case 212:t=xw;break;default:o("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const r=e.stencilFunc;switch(r){case rs:t=XR;break;case ts:t=tE;break;case es:t=KR;break;case Jr:t=YR;break;case Zr:t=QR;break;case Yr:t=eE;break;case Qr:t=ZR;break;case Kr:t=JR;break;default:o("WebGPURenderer: Invalid stencil function.",r)}return t}_getStencilOperation(e){let t;switch(e){case ds:t=Aw;break;case ls:t=ww;break;case us:t=Cw;break;case os:t=Mw;break;case as:t=Bw;break;case ns:t=Lw;break;case is:t=Fw;break;case ss:t=Pw;break;default:o("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case it:t=Tw;break;case It:t=_w;break;case Ut:t=vw;break;case hs:t=Nw;break;case cs:t=Sw;break;default:o("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,r){const s={},i=this.backend.utils;s.topology=i.getPrimitiveTopology(e,r),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(s.stripIndexFormat=t.index.array instanceof Uint16Array?lE:dE);let n=r.side===F;return e.isMesh&&e.matrixWorld.determinant()<0&&(n=!n),s.frontFace=!0===n?aE:nE,s.cullMode=r.side===P?oE:uE,s}_getColorWriteMask(e){return!0===e.colorWrite?Ew:Rw}_getDepthCompare(e){let t;if(!1===e.depthTest)t=tE;else{const r=this.backend.parameters.reversedDepthBuffer?ar[e.depthFunc]:e.depthFunc;switch(r){case nr:t=XR;break;case ir:t=tE;break;case sr:t=KR;break;case rr:t=YR;break;case tr:t=QR;break;case er:t=eE;break;case Jt:t=ZR;break;case Zt:t=JR;break;default:o("WebGPUPipelineUtils: Invalid depth function.",r)}}return t}}class OC extends kR{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const s=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return v(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const s=this.device.createCommandEncoder();s.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),s.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);const i=s.finish();if(this.device.queue.submit([i]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const n=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),a={},o=[];for(const[t,r]of e){const e=t.match(/^(.*):f(\d+)$/),s=parseInt(e[2]);!1===o.includes(s)&&o.push(s),void 0===a[s]&&(a[s]=0);const i=n[r],u=n[r+1],l=Number(u-i)/1e6;this.timestamps.set(t,l),a[s]+=l}const u=a[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=u,this.frames=o,u}catch(e){return o("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){o("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){o("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}const VC={r:0,g:0,b:0,a:1};class kC extends vR{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new CC(this),this.attributeUtils=new FC(this),this.bindingUtils=new DC(this),this.capabilities=new UC(this),this.pipelineUtils=new IC(this),this.textureUtils=new cC(this),this.occludedResolveCache=new Map;const t="undefined"==typeof navigator||!1===/Android/.test(navigator.userAgent);this._compatibility={[E.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let r;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:"compatibility"},s="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===s)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const i=Object.values(rC),n=[];for(const e of i)s.features.has(e)&&n.push(e);const a={requiredFeatures:n,requiredLimits:t.requiredLimits};r=await s.requestDevice(a)}else r=t.device;this.compatibilityMode=!r.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),r.lost.then(t=>{if("destroyed"===t.reason)return;const r={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(r)}),this.device=r,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(rC.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let r=t.context;if(void 0===r){const s=this.parameters;r=!0===e.isDefaultCanvasTarget&&void 0!==s.context?s.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${_t} webgpu`);const i=s.alpha?"premultiplied":"opaque",n=s.outputType===Te?"extended":"standard";r.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:i,toneMapping:{mode:n}}),t.context=r}return r}get coordinateSystem(){return h}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),s=e.currentSamples;let i=r.descriptor;if(void 0===i||r.samples!==s){i={colorAttachments:[{view:null}]},!0!==e.depth&&!0!==e.stencil||(i.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const t=i.colorAttachments[0];s>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,r.descriptor=i,r.samples=s}const n=i.colorAttachments[0];return s>0?n.resolveTarget=this.context.getCurrentTexture().createView():n.view=this.context.getCurrentTexture().createView(),i}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const r=e.renderTarget,s=this.get(r);let i=s.descriptors;void 0!==i&&s.width===r.width&&s.height===r.height&&s.samples===r.samples||(i={},s.descriptors=i);const n=e.getCacheKey();let a=i[n];if(void 0===a){const t=e.textures,o=[];let u;const l=this._isRenderCameraDepthArray(e);for(let s=0;s1)if(!0===l){const t=e.camera.cameras;for(let e=0;e0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,i=r.createQuerySet({type:"occlusion",count:s,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=i,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(s),t.lastOcclusionObject=null),n=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:sE}),this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e),n),n.occlusionQuerySet=i;const a=n.depthStencilAttachment;if(null!==e.textures){const t=n.colorAttachments;for(let r=0;r0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const s=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const r=[];for(let e=0;e0){const s=8*r;let i=this.occludedResolveCache.get(s);void 0===i&&(i=this.device.createBuffer({size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(s,i));const n=this.device.createBuffer({size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,i,0),t.encoder.copyBufferToBuffer(i,0,n,0,s),t.occlusionQueryBuffer=n,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;eo&&(i[0]=Math.min(a,o),i[1]=Math.ceil(a/o)),n.dispatchSize=i}i=n.dispatchSize}a.dispatchWorkgroups(i[0],i[1]||1,i[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}_draw(e,t,r,s,i,n,a,o,u){const{object:l,material:d,context:c}=e,h=e.getIndex(),p=null!==h;this.pipelineUtils.setPipeline(o,s),u.pipeline=s;const g=u.bindingGroups;for(let e=0,t=i.length;e65535?4:2);for(let n=0;n0){const i=this.get(e.camera),a=e.camera.cameras,c=e.getBindingGroup("cameraIndex");if(void 0===i.indexesGPU||i.indexesGPU.length!==a.length){const e=this.get(c),t=[],r=new Uint32Array([0,0,0,0]);for(let s=0,i=a.length;s(d("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new zR(e)));super(new t(e),e),this.library=new $C,this.isWebGPURenderer=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class HC extends Es{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}}class qC{constructor(e,t=Cn(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const r=new vg;r.name="RenderPipeline",this._quadMesh=new gx(r),this._quadMesh.name="Render Pipeline",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){const e=this.renderer;this._update(),null!==this._context.onBeforeRenderPipeline&&this._context.onBeforeRenderPipeline();const t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=m,e.outputColorSpace=p.workingColorSpace;const s=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=s,e.toneMapping=t,e.outputColorSpace=r,null!==this._context.onAfterRenderPipeline&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),!0===this.needsUpdate){const e=this._toneMapping,t=this._outputColorSpace,r={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null};let s=this.outputNode;!0===this.outputColorTransform?(s=s.context(r),s=Ll(s,e,t)):(r.toneMapping=e,r.outputColorSpace=t,s=s.context(r)),this._context=r,this._quadMesh.material.fragmentNode=s,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){v('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class jC extends qC{constructor(e,t){v('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your code to use "THREE.RenderPipeline" instead.'),super(e,t)}}class XC extends N{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){this.image.width===e&&this.image.height===t||(this.image.width=e,this.image.height=t,this.dispose())}}class KC extends N{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!1,this.image={width:e,height:t,depth:r},this.magFilter=le,this.minFilter=le,this.wrapR=_e,this.isStorageTexture=!0,this.is3DTexture=!0}setSize(e,t,r){this.image.width===e&&this.image.height===t&&this.image.depth===r||(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class QC extends N{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!0,this.image={width:e,height:t,depth:r},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0}setSize(e,t,r){this.image.width===e&&this.image.height===t&&this.image.depth===r||(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class YC extends Ax{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class ZC extends As{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,r,s){const i=new ws(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,r=>{try{t(this.parse(JSON.parse(r)))}catch(t){s?s(t):o(t),this.manager.itemError(e)}},r,s)}parseNodes(e){const t={};if(void 0!==e){for(const r of e){const{uuid:e,type:s}=r;t[e]=this.createNodeFromType(s),t[e].uuid=e}const r={nodes:t,textures:this.textures};for(const s of e){s.meta=r;t[s.uuid].deserialize(s),delete s.meta}}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const r={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(o("NodeLoader: Node type not found:",e),yn()):new this.nodes[e]}}class JC extends Cs{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),r=this.nodes,s=e.inputNodes;for(const e in s){const i=s[e];t[e]=r[i]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class eM extends Ms{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){const r=new ZC;return r.setNodes(this.nodes),r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){const r={};if(void 0!==e){const s=this.parseNodes(this._nodesJSON,t),i=new JC;i.setTextures(t),i.setNodes(s),i.setNodeMaterials(this.nodeMaterials);for(let t=0,s=e.length;t} + */ + this._htmlTextures = new Set(); + } /** @@ -73216,6 +73253,8 @@ class WebGPUTextureUtils { if ( textureData.msaaTexture !== undefined ) textureData.msaaTexture.destroy(); + this._htmlTextures.delete( texture ); + backend.delete( texture ); } @@ -73425,6 +73464,41 @@ class WebGPUTextureUtils { this._copyCubeMapToTexture( texture, textureData.texture, textureDescriptorGPU ); + } else if ( texture.isHTMLTexture ) { + + const device = this.backend.device; + const canvas = this.backend.renderer.domElement; + const image = texture.image; + + if ( typeof device.queue.copyElementImageToTexture !== 'function' ) return; + + // Set up paint callback if not already done. + if ( ! textureData.hasPaintCallback ) { + + textureData.hasPaintCallback = true; + + this._addHTMLTexture( texture ); + + // Wait for the browser to paint the element before uploading. + canvas.requestPaint(); + return; + + } + + const width = textureDescriptorGPU.size.width; + const height = textureDescriptorGPU.size.height; + + device.queue.copyElementImageToTexture( + image, width, height, + { texture: textureData.texture } + ); + + if ( texture.flipY ) { + + this._flipY( textureData.texture, textureDescriptorGPU ); + + } + } else { if ( mipmaps.length > 0 ) { @@ -73513,12 +73587,46 @@ class WebGPUTextureUtils { } + /** + * Registers an HTMLTexture for paint updates. + * Sets up a single shared `onpaint` handler on the canvas + * that notifies all registered HTMLTextures. + * + * @private + * @param {HTMLTexture} texture - The HTMLTexture to register. + */ + _addHTMLTexture( texture ) { + + this._htmlTextures.add( texture ); + + const canvas = this.backend.renderer.domElement; + const htmlTextures = this._htmlTextures; + + canvas.onpaint = ( event ) => { + + const changed = event.changedElements; + + for ( const t of htmlTextures ) { + + if ( changed.includes( t.image ) ) { + + t.needsUpdate = true; + + } + + } + + }; + + } + /** * Frees all internal resources. */ dispose() { this._samplerCache.clear(); + this._htmlTextures.clear(); } diff --git a/build/three.webgpu.nodes.min.js b/build/three.webgpu.nodes.min.js index ec5c718c098e7a..fedd349c8e8eb8 100644 --- a/build/three.webgpu.nodes.min.js +++ b/build/three.webgpu.nodes.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -import{Color as e,Vector2 as t,Vector3 as r,Vector4 as s,Matrix2 as i,Matrix3 as n,Matrix4 as a,error as o,EventDispatcher as u,MathUtils as l,warn as d,WebGLCoordinateSystem as c,WebGPUCoordinateSystem as h,ColorManagement as p,SRGBTransfer as g,NoToneMapping as m,StaticDrawUsage as f,InterleavedBufferAttribute as y,InterleavedBuffer as b,DynamicDrawUsage as x,NoColorSpace as T,log as _,warnOnce as v,Texture as N,UnsignedIntType as S,IntType as R,Compatibility as A,LessCompare as E,LessEqualCompare as w,GreaterCompare as C,GreaterEqualCompare as M,NearestFilter as B,Sphere as F,BackSide as L,DoubleSide as P,CubeTexture as D,CubeReflectionMapping as U,CubeRefractionMapping as I,TangentSpaceNormalMap as O,NoNormalPacking as V,NormalRGPacking as k,NormalGAPacking as G,ObjectSpaceNormalMap as z,RGFormat as $,RED_GREEN_RGTC2_Format as W,RG11_EAC_Format as H,InstancedBufferAttribute as q,InstancedInterleavedBuffer as j,DataArrayTexture as X,FloatType as K,FramebufferTexture as Q,LinearMipmapLinearFilter as Y,DepthTexture as Z,Material as J,LineBasicMaterial as ee,LineDashedMaterial as te,NoBlending as re,MeshNormalMaterial as se,SRGBColorSpace as ie,RenderTarget as ne,BoxGeometry as ae,Mesh as oe,Scene as ue,LinearFilter as le,CubeCamera as de,EquirectangularReflectionMapping as ce,EquirectangularRefractionMapping as he,AddOperation as pe,MixOperation as ge,MultiplyOperation as me,MeshBasicMaterial as fe,MeshLambertMaterial as ye,MeshPhongMaterial as be,DataTexture as xe,HalfFloatType as Te,ClampToEdgeWrapping as _e,BufferGeometry as ve,OrthographicCamera as Ne,PerspectiveCamera as Se,LinearSRGBColorSpace as Re,RGBAFormat as Ae,CubeUVReflectionMapping as Ee,BufferAttribute as we,MeshStandardMaterial as Ce,MeshPhysicalMaterial as Me,MeshToonMaterial as Be,MeshMatcapMaterial as Fe,SpriteMaterial as Le,PointsMaterial as Pe,ShadowMaterial as De,Uint32BufferAttribute as Ue,Uint16BufferAttribute as Ie,ByteType as Oe,UnsignedByteType as Ve,ShortType as ke,UnsignedShortType as Ge,AlphaFormat as ze,RedFormat as $e,RedIntegerFormat as We,DepthFormat as He,DepthStencilFormat as qe,RGIntegerFormat as je,RGBFormat as Xe,RGBIntegerFormat as Ke,UnsignedShort4444Type as Qe,UnsignedShort5551Type as Ye,UnsignedInt248Type as Ze,UnsignedInt5999Type as Je,UnsignedInt101111Type as et,NormalBlending as tt,SrcAlphaFactor as rt,OneMinusSrcAlphaFactor as st,AddEquation as it,MaterialBlending as nt,Object3D as at,LinearMipMapLinearFilter as ot,Plane as ut,Float32BufferAttribute as lt,UVMapping as dt,PCFShadowMap as ct,PCFSoftShadowMap as ht,VSMShadowMap as pt,BasicShadowMap as gt,CubeDepthTexture as mt,SphereGeometry as ft,LinearMipmapNearestFilter as yt,NearestMipmapLinearFilter as bt,Float16BufferAttribute as xt,yieldToMain as Tt,REVISION as _t,ArrayCamera as vt,PlaneGeometry as Nt,FrontSide as St,CustomBlending as Rt,ZeroFactor as At,CylinderGeometry as Et,Quaternion as wt,WebXRController as Ct,RAD2DEG as Mt,FrustumArray as Bt,Frustum as Ft,RGBAIntegerFormat as Lt,TimestampQuery as Pt,createCanvasElement as Dt,ReverseSubtractEquation as Ut,SubtractEquation as It,OneMinusDstAlphaFactor as Ot,OneMinusDstColorFactor as Vt,OneMinusSrcColorFactor as kt,DstAlphaFactor as Gt,DstColorFactor as zt,SrcAlphaSaturateFactor as $t,SrcColorFactor as Wt,OneFactor as Ht,CullFaceNone as qt,CullFaceBack as jt,CullFaceFront as Xt,MultiplyBlending as Kt,SubtractiveBlending as Qt,AdditiveBlending as Yt,NotEqualDepth as Zt,GreaterDepth as Jt,GreaterEqualDepth as er,EqualDepth as tr,LessEqualDepth as rr,LessDepth as sr,AlwaysDepth as ir,NeverDepth as nr,ReversedDepthFuncs as ar,RGB_S3TC_DXT1_Format as or,RGBA_S3TC_DXT1_Format as ur,RGBA_S3TC_DXT3_Format as lr,RGBA_S3TC_DXT5_Format as dr,RGB_PVRTC_4BPPV1_Format as cr,RGB_PVRTC_2BPPV1_Format as hr,RGBA_PVRTC_4BPPV1_Format as pr,RGBA_PVRTC_2BPPV1_Format as gr,RGB_ETC1_Format as mr,RGB_ETC2_Format as fr,RGBA_ETC2_EAC_Format as yr,R11_EAC_Format as br,SIGNED_R11_EAC_Format as xr,SIGNED_RG11_EAC_Format as Tr,RGBA_ASTC_4x4_Format as _r,RGBA_ASTC_5x4_Format as vr,RGBA_ASTC_5x5_Format as Nr,RGBA_ASTC_6x5_Format as Sr,RGBA_ASTC_6x6_Format as Rr,RGBA_ASTC_8x5_Format as Ar,RGBA_ASTC_8x6_Format as Er,RGBA_ASTC_8x8_Format as wr,RGBA_ASTC_10x5_Format as Cr,RGBA_ASTC_10x6_Format as Mr,RGBA_ASTC_10x8_Format as Br,RGBA_ASTC_10x10_Format as Fr,RGBA_ASTC_12x10_Format as Lr,RGBA_ASTC_12x12_Format as Pr,RGBA_BPTC_Format as Dr,RED_RGTC1_Format as Ur,SIGNED_RED_RGTC1_Format as Ir,SIGNED_RED_GREEN_RGTC2_Format as Or,MirroredRepeatWrapping as Vr,RepeatWrapping as kr,NearestMipmapNearestFilter as Gr,NotEqualCompare as zr,EqualCompare as $r,AlwaysCompare as Wr,NeverCompare as Hr,LinearTransfer as qr,getByteLength as jr,isTypedArray as Xr,NotEqualStencilFunc as Kr,GreaterStencilFunc as Qr,GreaterEqualStencilFunc as Yr,EqualStencilFunc as Zr,LessEqualStencilFunc as Jr,LessStencilFunc as es,AlwaysStencilFunc as ts,NeverStencilFunc as rs,DecrementWrapStencilOp as ss,IncrementWrapStencilOp as is,DecrementStencilOp as ns,IncrementStencilOp as as,InvertStencilOp as os,ReplaceStencilOp as us,ZeroStencilOp as ls,KeepStencilOp as ds,MaxEquation as cs,MinEquation as hs,SpotLight as ps,PointLight as gs,DirectionalLight as ms,RectAreaLight as fs,AmbientLight as ys,HemisphereLight as bs,LightProbe as xs,LinearToneMapping as Ts,ReinhardToneMapping as _s,CineonToneMapping as vs,ACESFilmicToneMapping as Ns,AgXToneMapping as Ss,NeutralToneMapping as Rs,Group as As,Loader as Es,FileLoader as ws,MaterialLoader as Cs,ObjectLoader as Ms}from"./three.core.min.js";export{AdditiveAnimationBlendMode,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BasicDepthPacking,BatchedMesh,BezierInterpolant,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxHelper,BufferGeometryLoader,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CircleGeometry,Clock,ColorKeyframeTrack,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,Controls,CubeTextureLoader,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceFrontBack,Curve,CurvePath,CustomToneMapping,Cylindrical,Data3DTexture,DataTextureLoader,DataUtils,DefaultLoadingManager,DetachedBindMode,DirectionalLightHelper,DiscreteInterpolant,DodecahedronGeometry,DynamicCopyUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,Euler,ExternalTexture,ExtrudeGeometry,Fog,FogExp2,GLBufferAttribute,GLSL1,GLSL3,GridHelper,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,InstancedBufferGeometry,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,Interpolant,InterpolateBezier,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InterpolationSamplingMode,InterpolationSamplingType,KeyframeTrack,LOD,LatheGeometry,Layers,Light,Line,Line3,LineCurve,LineCurve3,LineLoop,LineSegments,LinearInterpolant,LinearMipMapNearestFilter,LoaderUtils,LoadingManager,LoopOnce,LoopPingPong,LoopRepeat,MOUSE,MeshDepthMaterial,MeshDistanceMaterial,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NormalAnimationBlendMode,NumberKeyframeTrack,OctahedronGeometry,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,Path,PlaneHelper,PointLightHelper,Points,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RGBADepthPacking,RGBDepthPacking,RGB_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGDepthPacking,RawShaderMaterial,Ray,Raycaster,RenderTarget3D,RingGeometry,ShaderMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,Skeleton,SkeletonHelper,SkinnedMesh,Source,Spherical,SphericalHarmonics3,SplineCurve,SpotLightHelper,Sprite,StaticCopyUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,TOUCH,TetrahedronGeometry,TextureLoader,TextureUtils,Timer,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,VectorKeyframeTrack,VideoFrameTexture,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLRenderTarget,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroSlopeEnding,getConsoleFunction,setConsoleFunction}from"./three.core.min.js";const Bs=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Fs=new WeakMap,Ls=new WeakMap,Ps=new WeakMap;class Ds{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=!0===e.object.isSkinnedMesh,this.refreshUniforms=Bs,this.renderId=0}firstInitialization(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}needsVelocity(e){const t=e.getMRT();return null!==t&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(void 0===t){const{geometry:r,object:s}=e;if(t={geometryId:r.id,worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),e.material.transmission>0){const{width:r,height:s}=e.context;t.bufferWidth=r,t.bufferHeight=s}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const r in e){const s=e[r];t[r]={id:s.id,version:s.version}}return t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Ps.get(e);return void 0===t&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Ps.set(e,t)),t}getMaterialData(e){let t=Ls.get(e);if(void 0===t){t={_renderId:-1,_equal:!1};for(const r of this.refreshUniforms){const s=e[r];null!=s&&("object"==typeof s&&void 0!==s.clone?!0===s.isTexture?t[r]={id:s.id,version:s.version}:t[r]=s.clone():t[r]=s)}Ls.set(e,t)}return t}equals(e,t,r){const{object:s,material:i,geometry:n}=e,a=this.getRenderObjectData(e);if(!0!==a.worldMatrix.equals(s.matrixWorld))return a.worldMatrix.copy(s.matrixWorld),!1;const o=this.getMaterialData(e.material);if(o._renderId!==r){o._renderId=r;for(const e in o){const t=o[e],r=i[e];if("_renderId"!==e&&"_equal"!==e)if(void 0!==t.equals){if(!1===t.equals(r))return t.copy(r),o._equal=!1,!1}else if(!0===r.isTexture){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,o._equal=!1,!1}else if(t!==r)return o[e]=r,o._equal=!1,!1}if(o.transmission>0){const{width:t,height:r}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==r)return a.bufferWidth=t,a.bufferHeight=r,o._equal=!1,!1}o._equal=!0}else if(!1===o._equal)return!1;if(a.geometryId!==n.id)return a.geometryId=n.id,!1;const u=this.getGeometryData(e.geometry);if(u._renderId!==r){u._renderId=r;const e=n.attributes,t=u.attributes;let s=0,i=0;for(const t in e)s++;for(const r in t){i++;const s=t[r],n=e[r];if(void 0===n)return delete t[r],u._equal=!1,!1;if(s.id!==n.id||s.version!==n.version)return s.id=n.id,s.version=n.version,u._equal=!1,!1}if(i!==s)return u.attributes=this.getAttributesData(e),u._equal=!1,!1;const a=n.index,o=u.indexId,l=u.indexVersion,d=a?a.id:null,c=a?a.version:null;if(o!==d||l!==c)return u.indexId=d,u.indexVersion=c,u._equal=!1,!1;if(u.drawRange.start!==n.drawRange.start||u.drawRange.count!==n.drawRange.count)return u.drawRange.start=n.drawRange.start,u.drawRange.count=n.drawRange.count,u._equal=!1,!1;u._equal=!0}else if(!1===u._equal)return!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t{const r=e.match(t);if(!r)return null;const s=r[1]||r[2]||"",i=r[3].split("?")[0],n=parseInt(r[4],10),a=parseInt(r[5],10);return{fn:s,file:i.split("/").pop(),line:n,column:a}}).filter(e=>e&&!Us.some(t=>t.test(e.file)))}(e||(new Error).stack)}getLocation(){if(0===this.stack.length)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(0===this.stack.length)return e;return`${e}\n${this.stack.map(e=>{const t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join("\n")}`}}function Os(e,t=0){let r=3735928559^t,s=1103547991^t;if(Array.isArray(e))for(let t,i=0;i>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const Vs=e=>Os(e),ks=e=>Os(e),Gs=(...e)=>Os(e),zs=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),$s=new WeakMap;function Ws(e){return zs.get(e)}function Hs(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function qs(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function js(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Xs(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)||/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Ks(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Qs(o,...u){const l=o?o.slice(-4):void 0;return 1===u.length&&("vec2"===l?u=[u[0],u[0]]:"vec3"===l?u=[u[0],u[0],u[0]]:"vec4"===l&&(u=[u[0],u[0],u[0],u[0]])),"color"===o?new e(...u):"vec2"===l?new t(...u):"vec3"===l?new r(...u):"vec4"===l?new s(...u):"mat2"===l?new i(...u):"mat3"===l?new n(...u):"mat4"===l?new a(...u):"bool"===o?u[0]||!1:"float"===o||"int"===o||"uint"===o?u[0]||0:"string"===o?u[0]||"":"ArrayBuffer"===o?Js(u[0]):null}function Ys(e){let t=$s.get(e);return void 0===t&&(t={},$s.set(e,t)),t}function Zs(e){let t="";const r=new Uint8Array(e);for(let e=0;ee.charCodeAt(0)).buffer}var ei=Object.freeze({__proto__:null,arrayBufferToBase64:Zs,base64ToArrayBuffer:Js,getAlignmentFromType:Xs,getDataFromObject:Ys,getLengthFromType:qs,getMemoryLengthFromType:js,getTypeFromLength:Ws,getTypedArrayFromType:Hs,getValueFromType:Qs,getValueType:Ks,hash:Gs,hashArray:ks,hashString:Vs});const ti={VERTEX:"vertex",FRAGMENT:"fragment"},ri={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},si={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},ii={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},ni=["fragment","vertex"],ai=["setup","analyze","generate"],oi=[...ni,"compute"],ui=["x","y","z","w"],li={analyze:"setup",generate:"analyze"};let di=0;class ci extends u{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=ri.NONE,this.updateBeforeType=ri.NONE,this.updateAfterType=ri.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=di++,this.stackTrace=null,!0===ci.captureStackTrace&&(this.stackTrace=new Is)}set needsUpdate(e){!0===e&&this.version++}get uuid(){return null===this._uuid&&(this._uuid=l.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,ri.FRAME)}onRenderUpdate(e){return this.onUpdate(e,ri.RENDER)}onObjectUpdate(e){return this.onUpdate(e,ri.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const r of Object.getOwnPropertyNames(this)){const s=this[r];if(!0!==r.startsWith("_")&&!e.has(s))if(!0===Array.isArray(s))for(let e=0;e0&&(e.inputNodes=r)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){const s=[];for(const i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if("object"==typeof e.inputNodes[r]){const s={};for(const i in e.inputNodes[r]){const n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{const s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){const{uuid:t,type:r}=this,s=void 0===e||"string"==typeof e;s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];function n(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(void 0===i&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==s&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),s){const t=n(e.textures),r=n(e.images),s=n(e.nodes);t.length>0&&(i.textures=t),r.length>0&&(i.images=r),s.length>0&&(i.nodes=s)}return i}}ci.captureStackTrace=!1;class hi extends ci{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class pi extends ci{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){const t=this.node.getNodeType(e);let r=null;for(const s of this.convertTo.split("|"))null!==r&&e.getTypeLength(t)!==e.getTypeLength(s)||(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}}class gi extends ci{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(void 0!==s.propertyName)return e.format(s.propertyName,r,t);if("void"!==r&&"void"!==t&&this.hasDependencies(e)){const i=super.build(e,r),n=e.getVarFromNode(this,null,r),a=e.getPropertyName(n);return e.addLineFlowCode(`${a} = ${i}`,this),s.snippet=i,s.propertyName=a,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class mi extends gi{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){const r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[];let u=0;for(const t of i){if(u>=s){o(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let i,l=t.getNodeType(e),d=e.getTypeLength(l);u+d>s&&(o(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=s-u,l=e.getTypeFromLength(d)),u+=d,i=t.build(e,l);if(e.getComponentType(l)!==n){const t=e.getTypeFromLength(d,n);i=e.format(i,l,t)}a.push(i)}const l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}}const fi=ui.join("");class yi extends ci{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ui.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const r=this.node,s=e.getTypeLength(r.getNodeType(e));let i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=r.build(e,n);i=this.components.length===s&&this.components===fi.slice(0,this.components.length)?e.format(a,n,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class bi extends gi{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),u=t.build(e,i),l=e.getTypeLength(i),d=[];for(let e=0;e(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");ci.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==Si?Si.assign(this,...e):o("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Is),this;{const t=Ri.get("assign");return this.addToStack(t(...e))}},ci.prototype.toVarIntent=function(){return this},ci.prototype.get=function(e){return new Ni(this,e)};const wi={};function Ci(e,t,r){wi[e]=wi[t]=wi[r]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new yi(this,e),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};const s=e.toUpperCase(),i=t.toUpperCase(),n=r.toUpperCase();ci.prototype["set"+s]=ci.prototype["set"+i]=ci.prototype["set"+n]=function(t){const r=Ei(e);return new bi(this,r,tn(t))},ci.prototype["flip"+s]=ci.prototype["flip"+i]=ci.prototype["flip"+n]=function(){const t=Ei(e);return new xi(this,t)}}const Mi=["x","y","z","w"],Bi=["r","g","b","a"],Fi=["s","t","p","q"];for(let e=0;e<4;e++){let t=Mi[e],r=Bi[e],s=Fi[e];Ci(t,r,s);for(let i=0;i<4;i++){t=Mi[e]+Mi[i],r=Bi[e]+Bi[i],s=Fi[e]+Fi[i],Ci(t,r,s);for(let n=0;n<4;n++){t=Mi[e]+Mi[i]+Mi[n],r=Bi[e]+Bi[i]+Bi[n],s=Fi[e]+Fi[i]+Fi[n],Ci(t,r,s);for(let a=0;a<4;a++)t=Mi[e]+Mi[i]+Mi[n]+Mi[a],r=Bi[e]+Bi[i]+Bi[n]+Bi[a],s=Fi[e]+Fi[i]+Fi[n]+Fi[a],Ci(t,r,s)}}}for(let e=0;e<32;e++)wi[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new hi(this,new vi(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};Object.defineProperties(ci.prototype,wi);const Li=new WeakMap,Pi=function(e,t=null){for(const r in e)e[r]=tn(e[r],t);return e},Di=function(e,t=null){const r=e.length;for(let s=0;su?(o(`TSL: "${r}" parameter length exceeds limit.`,new Is),t.slice(0,u)):t}return null===t?n=(...t)=>i(new e(...nn(d(t)))):null!==r?(r=tn(r),n=(...s)=>i(new e(t,...nn(d(s)),r))):n=(...r)=>i(new e(t,...nn(d(r)))),n.setParameterLength=(...e)=>(1===e.length?a=u=e[0]:2===e.length&&([a,u]=e),n),n.setName=e=>(l=e,n),n},Ii=function(e,...t){return new e(...nn(t))};class Oi extends ci{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:r}=this,s=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||"",n=i||"default";if(s[n])return s[n];const a=e.subBuildFn,o=e.fnCall;e.subBuildFn=i,e.fnCall=this;let u=null;if(t.layout){let s=Li.get(e.constructor);void 0===s&&(s=new WeakMap,Li.set(e.constructor,s));let i=s.get(t);void 0===i&&(i=tn(e.buildFunctionNode(t)),s.set(t,i)),e.addInclude(i);const n=r?function(e){let t;sn(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(r):null;u=tn(i.call(n))}else{const s=new Proxy(e,{get:(e,t,r)=>{let s;return s=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,r),s}}),i=r?function(e){let t=0;return sn(e),new Proxy(e,{get:(r,s,i)=>{let n;if("length"===s)return n=e.length,n;if(Symbol.iterator===s)n=function*(){for(const t of e)yield tn(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const r=e[0];n=void 0===r[s]?r[t++]:Reflect.get(r,s,i)}else e[0]instanceof ci&&(n=void 0===e[s]?e[t++]:Reflect.get(e,s,i));else n=Reflect.get(r,s,i);n=tn(n)}return n}})}(r):null,n=Array.isArray(r)?r.length>0:null!==r,a=t.jsFunc,o=n||a.length>1?a(i,s):a(s);u=tn(o)}return e.subBuildFn=a,e.fnCall=o,t.once&&(s[n]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null;const s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getSubBuildOutput(this),a=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===s){const t=e.getSubBuildProperty("initialized",this);if(!0!==i[t]&&(i[t]=!0,i[n]=this.getOutputNode(e),i[n].build(e),this.shaderNode.subBuilds))for(const t of e.chaining){const r=e.getDataFromNode(t,"any");r.subBuilds=r.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)r.subBuilds.add(e)}r=i[n]}else"analyze"===s?a.build(e,t):"generate"===s&&(r=a.build(e,t)||"");return e.fnCall=o,r}}class Vi extends ci{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Oi(this,e)}setup(){return this.call()}}const ki=[!1,!0],Gi=[0,1,2,3],zi=[-1,-2],$i=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Wi=new Map;for(const e of ki)Wi.set(e,new vi(e));const Hi=new Map;for(const e of Gi)Hi.set(e,new vi(e,"uint"));const qi=new Map([...Hi].map(e=>new vi(e.value,"int")));for(const e of zi)qi.set(e,new vi(e,"int"));const ji=new Map([...qi].map(e=>new vi(e.value)));for(const e of $i)ji.set(e,new vi(e));for(const e of $i)ji.set(-e,new vi(-e));const Xi={bool:Wi,uint:Hi,ints:qi,float:ji},Ki=new Map([...Wi,...ji]),Qi=(e,t)=>Ki.has(e)?Ki.get(e):!0===e.isNode?e:new vi(e,t),Yi=function(e,t=null){return(...r)=>{for(const t of r)if(void 0===t)return o(`TSL: Invalid parameter for the type "${e}".`,new Is),new vi(0,e);if((0===r.length||!["bool","float","int","uint"].includes(e)&&r.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(r=[Qs(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return rn(t.get(r[0]));if(1===r.length){const t=Qi(r[0],e);return t.nodeType===e?rn(t):rn(new pi(t,e))}const s=r.map(e=>Qi(e));return rn(new mi(s,e))}};function Zi(e){return e&&e.isNode&&e.traverse(t=>{t.isConstNode&&(e=t.value)}),Boolean(e)}const Ji=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function en(e,t){return new Vi(e,t)}const tn=(e,t=null)=>function(e,t=null){const r=Ks(e);return"node"===r?e:null===t&&("float"===r||"boolean"===r)||r&&"shader"!==r&&"string"!==r?tn(Qi(e,t)):"shader"===r?e.isFn?e:cn(e):e}(e,t),rn=(e,t=null)=>tn(e,t).toVarIntent(),sn=(e,t=null)=>new Pi(e,t),nn=(e,t=null)=>new Di(e,t),an=(e,t=null,r=null,s=null)=>new Ui(e,t,r,s),on=(e,...t)=>new Ii(e,...t),un=(e,t=null,r=null,s={})=>new Ui(e,t,r,{...s,intent:!0});let ln=0;class dn extends ci{constructor(e,t=null){super();let r=null;null!==t&&("object"==typeof t?r=t.return:("string"==typeof t?r=t:o("TSL: Invalid layout type.",new Is),t=null)),this.shaderNode=new en(e,r),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const r={name:"fn"+ln++,type:t,inputs:[]};for(const t in e)"return"!==t&&r.inputs.push({name:t,type:e[t]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return o('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function cn(e,t=null){const r=new dn(e,t);return new Proxy(()=>{},{apply:(e,t,s)=>r.call(...s),get:(e,t,s)=>Reflect.get(r,t,s),set:(e,t,s,i)=>Reflect.set(r,t,s,i)})}const hn=e=>{Si=e},pn=()=>Si,gn=(...e)=>Si.If(...e);function mn(e){return Si&&Si.addToStack(e),e}Ai("toStack",mn);const fn=new Yi("color"),yn=new Yi("float",Xi.float),bn=new Yi("int",Xi.ints),xn=new Yi("uint",Xi.uint),Tn=new Yi("bool",Xi.bool),_n=new Yi("vec2"),vn=new Yi("ivec2"),Nn=new Yi("uvec2"),Sn=new Yi("bvec2"),Rn=new Yi("vec3"),An=new Yi("ivec3"),En=new Yi("uvec3"),wn=new Yi("bvec3"),Cn=new Yi("vec4"),Mn=new Yi("ivec4"),Bn=new Yi("uvec4"),Fn=new Yi("bvec4"),Ln=new Yi("mat2"),Pn=new Yi("mat3"),Dn=new Yi("mat4");Ai("toColor",fn),Ai("toFloat",yn),Ai("toInt",bn),Ai("toUint",xn),Ai("toBool",Tn),Ai("toVec2",_n),Ai("toIVec2",vn),Ai("toUVec2",Nn),Ai("toBVec2",Sn),Ai("toVec3",Rn),Ai("toIVec3",An),Ai("toUVec3",En),Ai("toBVec3",wn),Ai("toVec4",Cn),Ai("toIVec4",Mn),Ai("toUVec4",Bn),Ai("toBVec4",Fn),Ai("toMat2",Ln),Ai("toMat3",Pn),Ai("toMat4",Dn);const Un=an(hi).setParameterLength(2),In=(e,t)=>new pi(tn(e),t);Ai("element",Un),Ai("convert",In);Ai("append",e=>(d("TSL: .append() has been renamed to .toStack().",new Is),mn(e)));class On extends ci{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return Vs(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Vn=(e,t)=>new On(e,t),kn=(e,t)=>new On(e,t,!0),Gn=on(On,"vec4","DiffuseColor"),zn=on(On,"vec3","DiffuseContribution"),$n=on(On,"vec3","EmissiveColor"),Wn=on(On,"float","Roughness"),Hn=on(On,"float","Metalness"),qn=on(On,"float","Clearcoat"),jn=on(On,"float","ClearcoatRoughness"),Xn=on(On,"vec3","Sheen"),Kn=on(On,"float","SheenRoughness"),Qn=on(On,"float","Iridescence"),Yn=on(On,"float","IridescenceIOR"),Zn=on(On,"float","IridescenceThickness"),Jn=on(On,"float","AlphaT"),ea=on(On,"float","Anisotropy"),ta=on(On,"vec3","AnisotropyT"),ra=on(On,"vec3","AnisotropyB"),sa=on(On,"color","SpecularColor"),ia=on(On,"color","SpecularColorBlended"),na=on(On,"float","SpecularF90"),aa=on(On,"float","Shininess"),oa=on(On,"vec4","Output"),ua=on(On,"float","dashSize"),la=on(On,"float","gapSize"),da=on(On,"float","pointWidth"),ca=on(On,"float","IOR"),ha=on(On,"float","Transmission"),pa=on(On,"float","Thickness"),ga=on(On,"float","AttenuationDistance"),ma=on(On,"color","AttenuationColor"),fa=on(On,"float","Dispersion");class ya extends ci{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1,s=null){super("string"),this.name=e,this.shared=t,this.order=r,this.updateType=s,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const ba=(e,t=1,r=null)=>new ya(e,!1,t,r),xa=(e,t=0,r=null)=>new ya(e,!0,t,r),Ta=xa("frame",0,ri.FRAME),_a=xa("render",0,ri.RENDER),va=ba("object",1,ri.OBJECT);class Na extends Ti{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=va}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const r=e(t,this);void 0!==r&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const r=this.getNodeType(e),s=this.getUniformHash(e);let i=e.getNodeFromHash(s);void 0===i&&(e.setHashNode(this,s),i=this);const n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let u=o;if("bool"===r){const t=e.getDataFromNode(this);let s=t.propertyName;if(void 0===s){const i=e.getVarFromNode(this,null,"bool");s=e.getPropertyName(i),t.propertyName=s,u=e.format(o,n,r),e.addLineFlowCode(`${s} = ${u}`,this)}u=s}return e.format(u,r,t)}}const Sa=(e,t)=>{const r=Ji(t||e);if(r===e&&(e=Qs(r)),e&&!0===e.isNode){let t=e.value;e.traverse(e=>{!0===e.isConstNode&&(t=e.value)}),e=t}return new Na(e,r)};class Ra extends gi{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return null===this.nodeType?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return null===this.nodeType?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const Aa=(...e)=>{let t;if(1===e.length){const r=e[0];t=new Ra(null,r.length,r)}else{const r=e[0],s=e[1];t=new Ra(r,s)}return tn(t)};Ai("toArray",(e,t)=>Aa(Array(t).fill(e)));class Ea extends gi{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const r=e.getTypeLength(t.node.getNodeType(e));return ui.join("").slice(0,r)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:r}=this,s=t.getScope();e.getDataFromNode(s).assign=!0;const i=e.getNodeProperties(this);i.sourceNode=r,i.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.build(e),a=r.getNodeType(e),o=s.build(e,a),u=s.getNodeType(e),l=e.getDataFromNode(this);let d;if(!0===l.initialized)"void"!==t&&(d=n);else if(i){const s=e.getVarFromNode(this,null,a),i=e.getPropertyName(s);e.addLineFlowCode(`${i} = ${o}`,this);const u=r.node,l=u.node.context({assign:!0}).build(e);for(let t=0;t{const s=r.type;let i;return i="pointer"===s?"&"+t.build(e):t.build(e,s),i};if(Array.isArray(i)){if(i.length>s.length)o("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length(t=t.length>1||t[0]&&!0===t[0].isNode?nn(t):sn(t[0]),new Ca(tn(e),t));Ai("call",Ma);const Ba={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Fa extends gi{static get type(){return"OperatorNode"}constructor(e,t,r,...s){if(super(),s.length>0){let i=new Fa(e,t,r);for(let t=0;t>"===r||"<<"===r)return e.getIntegerType(n);if("!"===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r){const t=Math.max(e.getTypeLength(n),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(n)){if("float"===a)return n;if(e.isVector(a))return e.getVectorFromMatrix(n);if(e.isMatrix(a))return n}else if(e.isMatrix(a)){if("float"===n)return a;if(e.isVector(n))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(n)?a:n}generate(e,t){const r=this.op,{aNode:s,bNode:i}=this,n=this.getNodeType(e,t);let a=null,o=null;"void"!==n?(a=s.getNodeType(e),o=i?i.getNodeType(e):null,"<"===r||">"===r||"<="===r||">="===r||"=="===r||"!="===r?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===r||"<<"===r?(a=n,o=e.changeComponentType(o,"uint")):"%"===r?(a=n,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=n):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=n:o=n):a=o=n;const u=s.build(e,a),l=i?i.build(e,o):null,d=e.getFunctionOperator(r);if("void"!==t){const s=e.renderer.coordinateSystem===c;if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r)return s&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${u}, ${l} )`,n,t):e.format(`( ${u} ${r} ${l} )`,n,t);if("%"===r)return e.isInteger(o)?e.format(`( ${u} % ${l} )`,n,t):e.format(`${this.getOperatorMethod(e,n)}( ${u}, ${l} )`,n,t);if("!"===r||"~"===r)return e.format(`(${r}${u})`,a,t);if(d)return e.format(`${d}( ${u}, ${l} )`,n,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${l} ${r} ${u} )`,n,t);if("float"===a&&e.isMatrix(o))return e.format(`${u} ${r} ${l}`,n,t);{let i=`( ${u} ${r} ${l} )`;return!s&&"bool"===n&&e.isVector(a)&&e.isVector(o)&&(i=`all${i}`),e.format(i,n,t)}}if("void"!==a)return d?e.format(`${d}( ${u}, ${l} )`,n,t):e.isMatrix(a)&&"float"===o?e.format(`${l} ${r} ${u}`,n,t):e.format(`${u} ${r} ${l}`,n,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const La=un(Fa,"+").setParameterLength(2,1/0).setName("add"),Pa=un(Fa,"-").setParameterLength(2,1/0).setName("sub"),Da=un(Fa,"*").setParameterLength(2,1/0).setName("mul"),Ua=un(Fa,"/").setParameterLength(2,1/0).setName("div"),Ia=un(Fa,"%").setParameterLength(2).setName("mod"),Oa=un(Fa,"==").setParameterLength(2).setName("equal"),Va=un(Fa,"!=").setParameterLength(2).setName("notEqual"),ka=un(Fa,"<").setParameterLength(2).setName("lessThan"),Ga=un(Fa,">").setParameterLength(2).setName("greaterThan"),za=un(Fa,"<=").setParameterLength(2).setName("lessThanEqual"),$a=un(Fa,">=").setParameterLength(2).setName("greaterThanEqual"),Wa=un(Fa,"&&").setParameterLength(2,1/0).setName("and"),Ha=un(Fa,"||").setParameterLength(2,1/0).setName("or"),qa=un(Fa,"!").setParameterLength(1).setName("not"),ja=un(Fa,"^^").setParameterLength(2).setName("xor"),Xa=un(Fa,"&").setParameterLength(2).setName("bitAnd"),Ka=un(Fa,"~").setParameterLength(1).setName("bitNot"),Qa=un(Fa,"|").setParameterLength(2).setName("bitOr"),Ya=un(Fa,"^").setParameterLength(2).setName("bitXor"),Za=un(Fa,"<<").setParameterLength(2).setName("shiftLeft"),Ja=un(Fa,">>").setParameterLength(2).setName("shiftRight"),eo=cn(([e])=>(e.addAssign(1),e)),to=cn(([e])=>(e.subAssign(1),e)),ro=cn(([e])=>{const t=bn(e).toConst();return e.addAssign(1),t}),so=cn(([e])=>{const t=bn(e).toConst();return e.subAssign(1),t});Ai("add",La),Ai("sub",Pa),Ai("mul",Da),Ai("div",Ua),Ai("mod",Ia),Ai("equal",Oa),Ai("notEqual",Va),Ai("lessThan",ka),Ai("greaterThan",Ga),Ai("lessThanEqual",za),Ai("greaterThanEqual",$a),Ai("and",Wa),Ai("or",Ha),Ai("not",qa),Ai("xor",ja),Ai("bitAnd",Xa),Ai("bitNot",Ka),Ai("bitOr",Qa),Ai("bitXor",Ya),Ai("shiftLeft",Za),Ai("shiftRight",Ja),Ai("incrementBefore",eo),Ai("decrementBefore",to),Ai("increment",ro),Ai("decrement",so);const io=(e,t)=>(d('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new Is),Ia(bn(e),bn(t)));Ai("modInt",io);class no extends gi{static get type(){return"MathNode"}constructor(e,t,r=null,s=null){if(super(),(e===no.MAX||e===no.MIN)&&arguments.length>3){let i=new no(e,t,r);for(let t=2;tn&&i>a?t:n>a?r:a>i?s:t}generateNodeType(e){const t=this.method;return t===no.LENGTH||t===no.DISTANCE||t===no.DOT?"float":t===no.CROSS?"vec3":t===no.ALL||t===no.ANY?"bool":t===no.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:r,method:s}=this;let i=null;if(s===no.ONE_MINUS)i=Pa(1,t);else if(s===no.RECIPROCAL)i=Ua(1,t);else if(s===no.DIFFERENCE)i=Vo(Pa(t,r));else if(s===no.TRANSFORM_DIRECTION){let s=t,n=r;e.isMatrix(s.getNodeType(e))?n=Cn(Rn(n),0):s=Cn(Rn(s),0);const a=Da(s,n).xyz;i=Ro(a)}return null!==i?i:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method;const s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=this.cNode,u=e.renderer.coordinateSystem;if(r===no.NEGATE)return e.format("( - "+n.build(e,i)+" )",s,t);{const l=[];return r===no.CROSS?l.push(n.build(e,s),a.build(e,s)):u===c&&r===no.STEP?l.push(n.build(e,1===e.getTypeLength(n.getNodeType(e))?"float":i),a.build(e,i)):u!==c||r!==no.MIN&&r!==no.MAX?r===no.REFRACT?l.push(n.build(e,i),a.build(e,i),o.build(e,"float")):r===no.MIX?l.push(n.build(e,i),a.build(e,i),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":i)):(u===h&&r===no.ATAN&&null!==a&&(r="atan2"),"fragment"===e.shaderStage||r!==no.DFDX&&r!==no.DFDY||(d(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),l.push(n.build(e,i)),null!==a&&l.push(a.build(e,i)),null!==o&&l.push(o.build(e,i))):l.push(n.build(e,i),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":i)),e.format(`${e.getMethod(r,s)}( ${l.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}no.ALL="all",no.ANY="any",no.RADIANS="radians",no.DEGREES="degrees",no.EXP="exp",no.EXP2="exp2",no.LOG="log",no.LOG2="log2",no.SQRT="sqrt",no.INVERSE_SQRT="inversesqrt",no.FLOOR="floor",no.CEIL="ceil",no.NORMALIZE="normalize",no.FRACT="fract",no.SIN="sin",no.SINH="sinh",no.COS="cos",no.COSH="cosh",no.TAN="tan",no.TANH="tanh",no.ASIN="asin",no.ASINH="asinh",no.ACOS="acos",no.ACOSH="acosh",no.ATAN="atan",no.ATANH="atanh",no.ABS="abs",no.SIGN="sign",no.LENGTH="length",no.NEGATE="negate",no.ONE_MINUS="oneMinus",no.DFDX="dFdx",no.DFDY="dFdy",no.ROUND="round",no.RECIPROCAL="reciprocal",no.TRUNC="trunc",no.FWIDTH="fwidth",no.TRANSPOSE="transpose",no.DETERMINANT="determinant",no.INVERSE="inverse",no.EQUALS="equals",no.MIN="min",no.MAX="max",no.STEP="step",no.REFLECT="reflect",no.DISTANCE="distance",no.DIFFERENCE="difference",no.DOT="dot",no.CROSS="cross",no.POW="pow",no.TRANSFORM_DIRECTION="transformDirection",no.MIX="mix",no.CLAMP="clamp",no.REFRACT="refract",no.SMOOTHSTEP="smoothstep",no.FACEFORWARD="faceforward";const ao=yn(1e-6),oo=yn(1e6),uo=yn(Math.PI),lo=yn(2*Math.PI),co=yn(2*Math.PI),ho=yn(.5*Math.PI),po=un(no,no.ALL).setParameterLength(1),go=un(no,no.ANY).setParameterLength(1),mo=un(no,no.RADIANS).setParameterLength(1),fo=un(no,no.DEGREES).setParameterLength(1),yo=un(no,no.EXP).setParameterLength(1),bo=un(no,no.EXP2).setParameterLength(1),xo=un(no,no.LOG).setParameterLength(1),To=un(no,no.LOG2).setParameterLength(1),_o=un(no,no.SQRT).setParameterLength(1),vo=un(no,no.INVERSE_SQRT).setParameterLength(1),No=un(no,no.FLOOR).setParameterLength(1),So=un(no,no.CEIL).setParameterLength(1),Ro=un(no,no.NORMALIZE).setParameterLength(1),Ao=un(no,no.FRACT).setParameterLength(1),Eo=un(no,no.SIN).setParameterLength(1),wo=un(no,no.SINH).setParameterLength(1),Co=un(no,no.COS).setParameterLength(1),Mo=un(no,no.COSH).setParameterLength(1),Bo=un(no,no.TAN).setParameterLength(1),Fo=un(no,no.TANH).setParameterLength(1),Lo=un(no,no.ASIN).setParameterLength(1),Po=un(no,no.ASINH).setParameterLength(1),Do=un(no,no.ACOS).setParameterLength(1),Uo=un(no,no.ACOSH).setParameterLength(1),Io=un(no,no.ATAN).setParameterLength(1,2),Oo=un(no,no.ATANH).setParameterLength(1),Vo=un(no,no.ABS).setParameterLength(1),ko=un(no,no.SIGN).setParameterLength(1),Go=un(no,no.LENGTH).setParameterLength(1),zo=un(no,no.NEGATE).setParameterLength(1),$o=un(no,no.ONE_MINUS).setParameterLength(1),Wo=un(no,no.DFDX).setParameterLength(1),Ho=un(no,no.DFDY).setParameterLength(1),qo=un(no,no.ROUND).setParameterLength(1),jo=un(no,no.RECIPROCAL).setParameterLength(1),Xo=un(no,no.TRUNC).setParameterLength(1),Ko=un(no,no.FWIDTH).setParameterLength(1),Qo=un(no,no.TRANSPOSE).setParameterLength(1),Yo=un(no,no.DETERMINANT).setParameterLength(1),Zo=un(no,no.INVERSE).setParameterLength(1),Jo=un(no,no.MIN).setParameterLength(2,1/0),eu=un(no,no.MAX).setParameterLength(2,1/0),tu=un(no,no.STEP).setParameterLength(2),ru=un(no,no.REFLECT).setParameterLength(2),su=un(no,no.DISTANCE).setParameterLength(2),iu=un(no,no.DIFFERENCE).setParameterLength(2),nu=un(no,no.DOT).setParameterLength(2),au=un(no,no.CROSS).setParameterLength(2),ou=un(no,no.POW).setParameterLength(2),uu=e=>Da(e,e),lu=e=>Da(e,e,e),du=e=>Da(e,e,e,e),cu=un(no,no.TRANSFORM_DIRECTION).setParameterLength(2),hu=e=>Da(ko(e),ou(Vo(e),1/3)),pu=e=>nu(e,e),gu=un(no,no.MIX).setParameterLength(3),mu=(e,t=0,r=1)=>new no(no.CLAMP,tn(e),tn(t),tn(r)),fu=e=>mu(e),yu=un(no,no.REFRACT).setParameterLength(3),bu=un(no,no.SMOOTHSTEP).setParameterLength(3),xu=un(no,no.FACEFORWARD).setParameterLength(3),Tu=cn(([e])=>{const t=nu(e.xy,_n(12.9898,78.233)),r=Ia(t,uo);return Ao(Eo(r).mul(43758.5453))}),_u=(e,t,r)=>gu(t,r,e),vu=(e,t,r)=>bu(t,r,e),Nu=(e,t)=>tu(t,e),Su=xu,Ru=vo;Ai("all",po),Ai("any",go),Ai("radians",mo),Ai("degrees",fo),Ai("exp",yo),Ai("exp2",bo),Ai("log",xo),Ai("log2",To),Ai("sqrt",_o),Ai("inverseSqrt",vo),Ai("floor",No),Ai("ceil",So),Ai("normalize",Ro),Ai("fract",Ao),Ai("sin",Eo),Ai("sinh",wo),Ai("cos",Co),Ai("cosh",Mo),Ai("tan",Bo),Ai("tanh",Fo),Ai("asin",Lo),Ai("asinh",Po),Ai("acos",Do),Ai("acosh",Uo),Ai("atan",Io),Ai("atanh",Oo),Ai("abs",Vo),Ai("sign",ko),Ai("length",Go),Ai("lengthSq",pu),Ai("negate",zo),Ai("oneMinus",$o),Ai("dFdx",Wo),Ai("dFdy",Ho),Ai("round",qo),Ai("reciprocal",jo),Ai("trunc",Xo),Ai("fwidth",Ko),Ai("min",Jo),Ai("max",eu),Ai("step",Nu),Ai("reflect",ru),Ai("distance",su),Ai("dot",nu),Ai("cross",au),Ai("pow",ou),Ai("pow2",uu),Ai("pow3",lu),Ai("pow4",du),Ai("transformDirection",cu),Ai("mix",_u),Ai("clamp",mu),Ai("refract",yu),Ai("smoothstep",vu),Ai("faceForward",xu),Ai("difference",iu),Ai("saturate",fu),Ai("cbrt",hu),Ai("transpose",Qo),Ai("determinant",Yo),Ai("inverse",Zo),Ai("rand",Tu);class Au extends ci{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}generateNodeType(e){const{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const s=t.getNodeType(e);if(null!==r){const t=r.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(s))return t}return s}setup(e){const t=this.condNode,r=this.ifNode.isolate(),s=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,null!==s&&(e.getDataFromNode(s).parentNodeBlock=i);const n=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n?r:r.context({nodeBlock:r}),a.elseNode=s?n?s:s.context({nodeBlock:s}):null}generate(e,t){const r=this.getNodeType(e),s=e.getDataFromNode(this);if(void 0!==s.nodeProperty)return s.nodeProperty;const{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,u="void"!==t,l=u?Vn(r).build(e):"";s.nodeProperty=l;const c=i.build(e,"bool");if(e.context.uniformFlow&&null!==a){const s=n.build(e,r),i=a.build(e,r),o=e.getTernary(c,s,i);return e.format(o,r,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=n.build(e,r);if(h&&(u?h=l+" = "+h+";":(h="return "+h+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,r);t&&(u?t=l+" = "+t+";":(t="return "+t+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,r,t)}}const Eu=an(Au).setParameterLength(2,3);Ai("select",Eu);class wu extends ci{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{!0===t.isContextNode&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const r=e.addContext(this.value),s=this.node.build(e,t);return e.setContext(r),s}}const Cu=(e=null,t={})=>{let r=e;return null!==r&&!0===r.isNode||(t=r||t,r=null),new wu(r,t)},Mu=e=>Cu(e,{uniformFlow:!0}),Bu=(e,t)=>Cu(e,{nodeName:t});function Fu(e,t,r=null){return Cu(r,{getShadow:({light:r,shadowColorNode:s})=>t===r?s.mul(e):s})}function Lu(e,t=null){return Cu(t,{getAO:(t,{material:r})=>!0===r.transparent?t:null!==t?t.mul(e):e})}function Pu(e,t){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),Bu(e,t)}Ai("context",Cu),Ai("label",Pu),Ai("uniformFlow",Mu),Ai("setName",Bu),Ai("builtinShadowContext",(e,t,r)=>Fu(t,r,e)),Ai("builtinAOContext",(e,t)=>Lu(t,e));class Du extends ci{static get type(){return"VarNode"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return!0!==e.getDataFromNode(this).forceDeclaration&&this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;if(this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&t.fnCall&&t.fnCall.shaderNode){if(t.getDataFromNode(this.node.shaderNode).hasLoop){t.getDataFromNode(this).forceDeclaration=!0,e=!0}}const r=t.getBaseStack();e?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:r,readOnly:s}=this,{renderer:i}=e,n=!0===i.backend.isWebGPUBackend;let a=!1,u=!1;s&&(a=e.isDeterministic(t),u=n?s:a);const l=this.getNodeType(e);if("void"==l){!0!==this.isIntent(e)&&o('TSL: ".toVar()" can not be used with void type.',this.stackTrace);return t.build(e)}const d=e.getVectorType(l),c=t.build(e,d),h=e.getVarFromNode(this,r,d,void 0,u),p=e.getPropertyName(h);let g=p;if(u)if(n)g=a?`const ${p}`:`let ${p}`;else{const r=t.getArrayCount(e);g=`const ${e.getVar(h.type,p,r)}`}return e.addLineFlowCode(`${g} = ${c}`,this),p}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}const Uu=an(Du),Iu=(e,t=null)=>Uu(e,t).toStack(),Ou=(e,t=null)=>Uu(e,t,!0).toStack(),Vu=e=>Uu(e).setIntent(!0).toStack();Ai("toVar",Iu),Ai("toConst",Ou),Ai("toVarIntent",Vu);class ku extends ci{static get type(){return"SubBuild"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const r=this.node.build(e,...t);return e.removeSubBuild(),r}}const Gu=(e,t,r=null)=>new ku(tn(e),t,r);class zu extends ci{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Gu(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let r=t.varying;if(void 0===r){const s=this.name,i=this.getNodeType(e),n=this.interpolationType,a=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,s,i,n,a),t.node=Gu(this.node,"VERTEX")}return r.needsInterpolation||(r.needsInterpolation="fragment"===e.shaderStage),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),r=e.getNodeProperties(this),s=this.setupVarying(e);if(void 0===r[t]){const i=this.getNodeType(e),n=e.getPropertyName(s,ti.VERTEX);e.flowNodeFromShaderStage(ti.VERTEX,r.node,i,n),r[t]=n}return e.getPropertyName(s)}}const $u=an(zu).setParameterLength(1,2),Wu=e=>$u(e);Ai("toVarying",$u),Ai("toVertexStage",Wu);const Hu=cn(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),r=e.mul(.0773993808),s=e.lessThanEqual(.04045);return gu(t,r,s)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qu=cn(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),s=e.lessThanEqual(.0031308);return gu(t,r,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),ju="WorkingColorSpace";class Xu extends gi{static get type(){return"ColorSpaceNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===ju?p.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),s=this.resolveColorSpace(e,this.target);let i=t;return!1!==p.enabled&&r!==s&&r&&s?(p.getTransfer(r)===g&&(i=Cn(Hu(i.rgb),i.a)),p.getPrimaries(r)!==p.getPrimaries(s)&&(i=Cn(Pn(p._getMatrix(new n,r,s)).mul(i.rgb),i.a)),p.getTransfer(s)===g&&(i=Cn(qu(i.rgb),i.a)),i):i}}const Ku=(e,t)=>new Xu(tn(e),ju,t),Qu=(e,t)=>new Xu(tn(e),t,ju);Ai("workingToColorSpace",Ku),Ai("colorSpaceToWorking",Qu);let Yu=class extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(),s=this.getNodeType();return e.format(t,r,s)}};class Zu extends ci{static get type(){return"ReferenceBaseNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.updateType=ri.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Yu(this,tn(e))}setNodeType(e){const t=Sa(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Ju(e,t,r);class tl extends gi{static get type(){return"ToneMappingNode"}constructor(e,t=sl,r=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return Gs(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,r=this._toneMapping;if(r===m)return t;let s=null;const i=e.renderer.library.getToneMappingFunction(r);return null!==i?s=Cn(i(t.rgb,this.exposureNode),t.a):(o("ToneMappingNode: Unsupported Tone Mapping configuration.",r),s=t),s}}const rl=(e,t,r)=>new tl(e,tn(t),tn(r)),sl=el("toneMappingExposure","float");Ai("toneMapping",(e,t,r)=>rl(t,r,e));const il=new WeakMap;function nl(e,t){let r=il.get(e);return void 0===r&&(r=new b(e,t),il.set(e,r)),r}class al extends Ti{static get type(){return"BufferAttributeNode"}constructor(e,t=null,r=0,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=s,this.usage=f,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(0===this.bufferStride&&0===this.bufferOffset){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}generateNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),r=e.getTypeLength(t),s=this.value,i=this.bufferStride||r,n=this.bufferOffset;let a;a=!0===s.isInterleavedBuffer?s:!0===s.isBufferAttribute?nl(s.array,i):nl(s,i);const o=new y(a,r,n);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),r=e.getBufferAttributeFromNode(this,t),s=e.getPropertyName(r);let i=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=s,i=s;else{i=$u(this).build(e,t)}return i}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function ol(e,t=null,r=0,s=0,i=f,n=!1){return"mat3"===t||null===t&&9===e.itemSize?Pn(new al(e,"vec3",9,0).setUsage(i).setInstanced(n),new al(e,"vec3",9,3).setUsage(i).setInstanced(n),new al(e,"vec3",9,6).setUsage(i).setInstanced(n)):"mat4"===t||null===t&&16===e.itemSize?Dn(new al(e,"vec4",16,0).setUsage(i).setInstanced(n),new al(e,"vec4",16,4).setUsage(i).setInstanced(n),new al(e,"vec4",16,8).setUsage(i).setInstanced(n),new al(e,"vec4",16,12).setUsage(i).setInstanced(n)):new al(e,t,r,s).setUsage(i)}const ul=(e,t=null,r=0,s=0)=>ol(e,t,r,s),ll=(e,t=null,r=0,s=0)=>ol(e,t,r,s,f,!0),dl=(e,t=null,r=0,s=0)=>ol(e,t,r,s,x,!0);Ai("toAttribute",e=>ul(e.value));class cl extends ci{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),r=this.scope;let s,i;if(r===cl.VERTEX)s=e.getVertexIndex();else if(r===cl.INSTANCE)s=e.getInstanceIndex();else if(r===cl.DRAW)s=e.getDrawIndex();else if(r===cl.INVOCATION_LOCAL)s=e.getInvocationLocalIndex();else if(r===cl.INVOCATION_SUBGROUP)s=e.getInvocationSubgroupIndex();else{if(r!==cl.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+r);s=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)i=s;else{i=$u(this).build(e,t)}return i}}cl.VERTEX="vertex",cl.INSTANCE="instance",cl.SUBGROUP="subgroup",cl.INVOCATION_LOCAL="invocationLocal",cl.INVOCATION_SUBGROUP="invocationSubgroup",cl.DRAW="draw";const hl=on(cl,cl.VERTEX),pl=on(cl,cl.INSTANCE),gl=on(cl,cl.SUBGROUP),ml=on(cl,cl.INVOCATION_SUBGROUP),fl=on(cl,cl.INVOCATION_LOCAL),yl=on(cl,cl.DRAW);class bl extends ci{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=ri.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){null!==this.count&&null===this.countNode&&(this.countNode=Sa(this.count,"uint").onObjectUpdate(()=>this.count));const t=this.computeNode.build(e);if(t){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:r}=e;if("compute"===r){const t=this.computeNode.build(e,"void");if(""!==t&&e.addLineFlowCode(t,this),null!==this.count&&!0===e.allowEarlyReturns){const t=this.countNode.build(e,"uint"),r=pl.build(e,"uint");e.flow.code=`${e.tab}if ( ${r} >= ${t} ) { return; }\n\n${e.flow.code}`}}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const xl=(e,t=[64])=>{(0===t.length||t.length>3)&&o("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Is);for(let e=0;e{const s=xl(e,r);return"number"==typeof t?s.count=t:s.dispatchSize=t,s};Ai("compute",Tl),Ai("computeKernel",xl);class _l extends ci{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){const t=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.getNodeType(e);return e.setCache(t),s}build(e,...t){const r=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const i=this.node.build(e,...t);return e.setCache(r),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const vl=e=>new _l(tn(e));function Nl(e,t=!0){return d('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),vl(e).setParent(t)}Ai("cache",Nl),Ai("isolate",vl);class Sl extends ci{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Rl=an(Sl).setParameterLength(2);Ai("bypass",Rl);const Al=cn(([e,t,r,s=yn(0),i=yn(1),n=Tn(!1)])=>{let a=e.sub(t).div(r.sub(t));return Zi(n)&&(a=a.clamp()),a.mul(i.sub(s)).add(s)});function El(e,t,r,s=yn(0),i=yn(1)){return Al(e,t,r,s,i,!0)}Ai("remap",Al),Ai("remapClamp",El);class wl extends ci{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const r=this.getNodeType(e),s=this.snippet;if("void"!==r)return e.format(s,r,t);e.addLineFlowCode(s,this)}}const Cl=an(wl).setParameterLength(1,2),Ml=e=>(e?Eu(e,Cl("discard")):Cl("discard")).toStack();Ai("discard",Ml);class Bl extends gi{static get type(){return"RenderOutputNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const r=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||m,s=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||T;return r!==m&&(t=t.toneMapping(r)),s!==T&&s!==p.workingColorSpace&&(t=t.workingToColorSpace(s)),t}}const Fl=(e,t=null,r=null)=>new Bl(tn(e),t,r);Ai("renderOutput",Fl);class Ll extends gi{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,r=this.node.build(e);if(null!==t)t(e,r);else{const t="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(t.length);let i="";i+="// #"+t+"#\n",i+=e.flow.code.replace(/^\t/gm,"")+"\n",i+="/* ... */ "+r+" /* ... */\n",i+="// #"+s+"#\n",_(i)}return r}}const Pl=(e,t=null)=>new Ll(tn(e),t).toStack();Ai("debug",Pl);class Dl extends u{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class Ul extends ci{static get type(){return"InspectorNode"}constructor(e,t="",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=ri.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==Dl&&v('TSL: ".toInspector()" is only available with WebGPU.'),t}}function Il(e,t="",r=null){return(e=tn(e)).before(new Ul(e,t,r))}Ai("toInspector",Il);class Ol extends ci{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(null===t){const r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){const s=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(s)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),r=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const s=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(s),n=e.getAttribute(t,i);if("vertex"===e.shaderStage)return e.format(n.name,i,r);return $u(this).build(e,r)}return d(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(r)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Vl=(e,t=null)=>new Ol(e,t),kl=(e=0)=>Vl("uv"+(e>0?e:""),"vec2");class Gl extends ci{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const r=this.textureNode.build(e,"property"),s=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${r}, ${s} )`,this.getNodeType(e),t)}}const zl=an(Gl).setParameterLength(1,2);class $l extends Na{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=ri.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&void 0!==r.width){const{width:e,height:t}=r;this.value=Math.log2(Math.max(e,t))}}}const Wl=an($l).setParameterLength(1);class Hl extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const ql=new N;class jl extends Na{static get type(){return"TextureNode"}constructor(e=ql,t=null,r=null,s=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=s,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=ri.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===S?"uvec4":this.value.type===R?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return kl(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=Sa(this.value.matrix)),this._matrixUniform.mul(Rn(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=Sa(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(bn(zl(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const r=this.value;if(!r||!0!==r.isTexture)throw new Hl("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const s=cn(()=>{let t=this.uvNode;return null!==t&&!0!==e.context.forceUVContext||!e.context.getUV||(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?ri.OBJECT:ri.NONE,t})();let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this));let n=null,a=null;if(null!==this.compareNode)if(e.renderer.hasCompatibility(A.TEXTURE_COMPARE))n=this.compareNode;else{const e=r.compareFunction;null===e||e===E||e===w||e===C||e===M?a=this.compareNode:(n=this.compareNode,v('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=s,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=n,t.compareStepNode=a,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;let d;return d=i?e.generateTextureBias(l,t,r,i,n,u):o?e.generateTextureGrad(l,t,r,o,n,u):a?e.generateTextureCompare(l,t,r,a,n,u):!1===this.sampler?e.generateTextureLoad(l,t,r,s,n,u):s?e.generateTextureLevel(l,t,r,s,n,u):e.generateTexture(l,t,r,n,u),d}generate(e,t){const r=this.value,s=e.getNodeProperties(this),i=super.generate(e,"property");if(/^sampler/.test(t))return i+"_sampler";if(e.isReference(t))return i;{const n=e.getDataFromNode(this),a=this.getNodeType(e);let o=n.propertyName;if(void 0===o){const{uvNode:t,levelNode:u,biasNode:l,compareNode:d,compareStepNode:c,depthNode:h,gradNode:p,offsetNode:g}=s,m=this.generateUV(e,t),f=u?u.build(e,"float"):null,y=l?l.build(e,"float"):null,b=h?h.build(e,"int"):null,x=d?d.build(e,"float"):null,T=c?c.build(e,"float"):null,_=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,v=g?this.generateOffset(e,g):null;let N=b;null===N&&r.isArrayTexture&&!0!==this.isTexture3DNode&&(N="0");const S=e.getVarFromNode(this);o=e.getPropertyName(S);let R=this.generateSnippet(e,i,m,f,y,N,x,_,v);if(null!==T){const t=r.compareFunction;R=t===C||t===M?tu(Cl(R,a),Cl(T,"float")).build(e,a):tu(Cl(T,"float"),Cl(R,a)).build(e,a)}e.addLineFlowCode(`${o} = ${R}`,this),n.snippet=R,n.propertyName=o}let u=o;return e.needsToWorkingColorSpace(r)&&(u=Qu(Cl(u,a),r.colorSpace).setup(e).build(e,a)),e.format(u,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=tn(e),t.referenceNode=this.getBase(),tn(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=tn(e).mul(Wl(t)),t.referenceNode=this.getBase();const r=t.value;return!1===t.generateMipmaps&&(r&&!1===r.generateMipmaps||r.minFilter===B||r.magFilter===B)&&(d("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),tn(t)}level(e){const t=this.clone();return t.levelNode=tn(e),t.referenceNode=this.getBase(),tn(t)}size(e){return zl(this,e)}bias(e){const t=this.clone();return t.biasNode=tn(e),t.referenceNode=this.getBase(),tn(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=tn(e),t.referenceNode=this.getBase(),tn(t)}grad(e,t){const r=this.clone();return r.gradNode=[tn(e),tn(t)],r.referenceNode=this.getBase(),tn(r)}depth(e){const t=this.clone();return t.depthNode=tn(e),t.referenceNode=this.getBase(),tn(t)}offset(e){const t=this.clone();return t.offsetNode=tn(e),t.referenceNode=this.getBase(),tn(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();const r=this._flipYUniform;null!==r&&(r.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const Xl=an(jl).setParameterLength(1,4).setName("texture"),Kl=(e=ql,t=null,r=null,s=null)=>{let i;return e&&!0===e.isTextureNode?(i=tn(e.clone()),i.referenceNode=e.getBase(),null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=Xl(e,t,r,s),i},Ql=(...e)=>Kl(...e).setSampler(!1);class Yl extends Na{static get type(){return"BufferNode"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Zl=(e,t,r)=>new Yl(e,t,r);class Jl extends hi{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),r=this.getNodeType(e),s=this.node.getPaddedType();return e.format(t,s,r)}}class ed extends Yl{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?Ks(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=ri.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,r=this.elementType;if("float"===r||"int"===r||"uint"===r)for(let r=0;rnew ed(e,t);class rd extends ci{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const sd=an(rd).setParameterLength(1);let id,nd;class ad extends ci{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===ad.DPR?"float":this.scope===ad.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=ri.NONE;return this.scope!==ad.SIZE&&this.scope!==ad.VIEWPORT&&this.scope!==ad.DPR||(e=ri.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ad.VIEWPORT?null!==t?nd.copy(t.viewport):(e.getViewport(nd),nd.multiplyScalar(e.getPixelRatio())):this.scope===ad.DPR?this._output.value=e.getPixelRatio():null!==t?(id.width=t.width,id.height=t.height):e.getDrawingBufferSize(id)}setup(){const e=this.scope;let r=null;return r=e===ad.SIZE?Sa(id||(id=new t)):e===ad.VIEWPORT?Sa(nd||(nd=new s)):e===ad.DPR?Sa(1):_n(dd.div(ld)),this._output=r,r}generate(e){if(this.scope===ad.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const r=e.getNodeProperties(ld).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${r}.y - ${t}.y )`}return t}return super.generate(e)}}ad.COORDINATE="coordinate",ad.VIEWPORT="viewport",ad.SIZE="size",ad.UV="uv",ad.DPR="dpr";const od=on(ad,ad.DPR),ud=on(ad,ad.UV),ld=on(ad,ad.SIZE),dd=on(ad,ad.COORDINATE),cd=on(ad,ad.VIEWPORT),hd=cd.zw,pd=dd.sub(cd.xy),gd=pd.div(hd),md=cn(()=>(d('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Is),ld),"vec2").once()();let fd=null,yd=null,bd=null,xd=null,Td=null,_d=null,vd=null,Nd=null,Sd=null,Rd=null,Ad=null,Ed=null,wd=null,Cd=null;const Md=Sa(0,"uint").setName("u_cameraIndex").setGroup(xa("cameraIndex")).toVarying("v_cameraIndex"),Bd=Sa("float").setName("cameraNear").setGroup(_a).onRenderUpdate(({camera:e})=>e.near),Fd=Sa("float").setName("cameraFar").setGroup(_a).onRenderUpdate(({camera:e})=>e.far),Ld=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrix);null===yd?yd=td(r).setGroup(_a).setName("cameraProjectionMatrices"):yd.array=r,t=yd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrix")}else null===fd&&(fd=Sa(e.projectionMatrix).setName("cameraProjectionMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=fd;return t}).once()(),Pd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrixInverse);null===xd?xd=td(r).setGroup(_a).setName("cameraProjectionMatricesInverse"):xd.array=r,t=xd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrixInverse")}else null===bd&&(bd=Sa(e.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=bd;return t}).once()(),Dd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorldInverse);null===_d?_d=td(r).setGroup(_a).setName("cameraViewMatrices"):_d.array=r,t=_d.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraViewMatrix")}else null===Td&&(Td=Sa(e.matrixWorldInverse).setName("cameraViewMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=Td;return t}).once()(),Ud=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorld);null===Nd?Nd=td(r).setGroup(_a).setName("cameraWorldMatrices"):Nd.array=r,t=Nd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraWorldMatrix")}else null===vd&&(vd=Sa(e.matrixWorld).setName("cameraWorldMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=vd;return t}).once()(),Id=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.normalMatrix);null===Rd?Rd=td(r).setGroup(_a).setName("cameraNormalMatrices"):Rd.array=r,t=Rd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraNormalMatrix")}else null===Sd&&(Sd=Sa(e.normalMatrix).setName("cameraNormalMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=Sd;return t}).once()(),Od=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const s=[];for(let t=0,i=e.cameras.length;t{const r=e.cameras,s=t.array;for(let e=0,t=r.length;et.value.setFromMatrixPosition(e.matrixWorld))),t=Ad;return t}).once()(),Vd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.viewport);null===Cd?Cd=td(r,"vec4").setGroup(_a).setName("cameraViewports"):Cd.array=r,t=Cd.element(Md).toConst("cameraViewport")}else null===wd&&(wd=Cn(0,0,ld.x,ld.y).toConst("cameraViewport")),t=wd;return t}).once()(),kd=new F;class Gd extends ci{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=ri.OBJECT,this.uniformNode=new Na(null)}generateNodeType(){const e=this.scope;return e===Gd.WORLD_MATRIX?"mat4":e===Gd.POSITION||e===Gd.VIEW_POSITION||e===Gd.DIRECTION||e===Gd.SCALE?"vec3":e===Gd.RADIUS?"float":void 0}update(e){const t=this.object3d,s=this.uniformNode,i=this.scope;if(i===Gd.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===Gd.POSITION)s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===Gd.SCALE)s.value=s.value||new r,s.value.setFromMatrixScale(t.matrixWorld);else if(i===Gd.DIRECTION)s.value=s.value||new r,t.getWorldDirection(s.value);else if(i===Gd.VIEW_POSITION){const i=e.camera;s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(i.matrixWorldInverse)}else if(i===Gd.RADIUS){const r=e.object.geometry;null===r.boundingSphere&&r.computeBoundingSphere(),kd.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),s.value=kd.radius}}generate(e){const t=this.scope;return t===Gd.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===Gd.POSITION||t===Gd.VIEW_POSITION||t===Gd.DIRECTION||t===Gd.SCALE?this.uniformNode.nodeType="vec3":t===Gd.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Gd.WORLD_MATRIX="worldMatrix",Gd.POSITION="position",Gd.SCALE="scale",Gd.VIEW_POSITION="viewPosition",Gd.DIRECTION="direction",Gd.RADIUS="radius";const zd=an(Gd,Gd.DIRECTION).setParameterLength(1),$d=an(Gd,Gd.WORLD_MATRIX).setParameterLength(1),Wd=an(Gd,Gd.POSITION).setParameterLength(1),Hd=an(Gd,Gd.SCALE).setParameterLength(1),qd=an(Gd,Gd.VIEW_POSITION).setParameterLength(1),jd=an(Gd,Gd.RADIUS).setParameterLength(1);class Xd extends Gd{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const Kd=on(Xd,Xd.DIRECTION),Qd=on(Xd,Xd.WORLD_MATRIX),Yd=on(Xd,Xd.POSITION),Zd=on(Xd,Xd.SCALE),Jd=on(Xd,Xd.VIEW_POSITION),ec=on(Xd,Xd.RADIUS),tc=Sa(new n).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),rc=Sa(new a).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),sc=cn(e=>e.context.modelViewMatrix||ic).once()().toVar("modelViewMatrix"),ic=Dd.mul(Qd),nc=cn(e=>(e.context.isHighPrecisionModelViewMatrix=!0,Sa("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),ac=cn(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return Sa("mat3").onObjectUpdate(({object:e,camera:r})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),oc=cn(e=>"fragment"!==e.shaderStage?(v("TSL: `clipSpace` is only available in fragment stage."),Cn()):e.context.clipSpace.toVarying("v_clipSpace")).once()(),uc=Vl("position","vec3"),lc=uc.toVarying("positionLocal"),dc=uc.toVarying("positionPrevious"),cc=cn(e=>Qd.mul(lc).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),hc=cn(()=>lc.transformDirection(Qd).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),pc=cn(e=>{if("fragment"===e.shaderStage&&e.material.vertexNode){const e=Pd.mul(oc);return e.xyz.div(e.w).toVar("positionView")}return e.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),gc=cn(e=>{let t;return t=e.camera.isOrthographicCamera?Rn(0,0,1):pc.negate().toVarying("v_positionViewDirection").normalize(),t.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class mc extends ci{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return t.side===L?"false":e.getFrontFacing()}}const fc=on(mc),yc=yn(fc).mul(2).sub(1),bc=cn(([e],{material:t})=>{const r=t.side;return r===L?e=e.mul(-1):r===P&&(e=e.mul(yc)),e}),xc=Vl("normal","vec3"),Tc=cn(e=>!1===e.geometry.hasAttribute("normal")?(d('TSL: Vertex attribute "normal" not found on geometry.'),Rn(0,1,0)):xc,"vec3").once()().toVar("normalLocal"),_c=pc.dFdx().cross(pc.dFdy()).normalize().toVar("normalFlat"),vc=cn(e=>{let t;return t=e.isFlatShading()?_c:wc(Tc).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),Nc=cn(e=>{let t=vc.transformDirection(Dd);return!0!==e.isFlatShading()&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),Sc=cn(e=>{let t;return"NORMAL"===e.subBuildFn||"VERTEX"===e.subBuildFn?(t=vc,!0!==e.isFlatShading()&&(t=bc(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Rc=Sc.transformDirection(Dd).toVar("normalWorld"),Ac=cn(({subBuildFn:e,context:t})=>{let r;return r="NORMAL"===e||"VERTEX"===e?Sc:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),r},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Ec=cn(([e,t=Qd])=>{const r=Pn(t),s=e.div(Rn(r[0].dot(r[0]),r[1].dot(r[1]),r[2].dot(r[2])));return r.mul(s).xyz}),wc=cn(([e],t)=>{const r=t.context.modelNormalViewMatrix;if(r)return r.transformDirection(e);const s=tc.mul(e);return Dd.transformDirection(s)}),Cc=cn(()=>(d('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),Sc)).once(["NORMAL","VERTEX"])(),Mc=cn(()=>(d('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Rc)).once(["NORMAL","VERTEX"])(),Bc=cn(()=>(d('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Ac)).once(["NORMAL","VERTEX"])(),Fc=new a,Lc=Sa(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),Pc=Sa(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),Dc=Sa(new a).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const r=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return r?Fc.makeRotationFromEuler(r).transpose():Fc.identity(),Fc}),Uc=gc.negate().reflect(Sc),Ic=gc.negate().refract(Sc,Lc),Oc=Uc.transformDirection(Dd).toVar("reflectVector"),Vc=Ic.transformDirection(Dd).toVar("reflectVector"),kc=new D;class Gc extends jl{static get type(){return"CubeTextureNode"}constructor(e,t=null,r=null,s=null){super(e,t,r,s),this.isCubeTextureNode=!0}getInputType(){return!0===this.value.isDepthTexture?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===U?Oc:e.mapping===I?Vc:(o('CubeTextureNode: Mapping "%s" not supported.',e.mapping),Rn(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const r=this.value;return!0===r.isDepthTexture?e.renderer.coordinateSystem===h?Rn(t.x,t.y.negate(),t.z):t:(t=Dc.mul(t),e.renderer.coordinateSystem!==h&&r.isRenderTargetTexture||(t=Rn(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}const zc=an(Gc).setParameterLength(1,4).setName("cubeTexture"),$c=(e=kc,t=null,r=null,s=null)=>{let i;return e&&!0===e.isCubeTextureNode?(i=tn(e.clone()),i.referenceNode=e,null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=zc(e,t,r,s),i};class Wc extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(e),s=this.getNodeType(e);return e.format(t,r,s)}}class Hc extends ci{static get type(){return"ReferenceNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=ri.OBJECT}element(e){return new Wc(this,tn(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?Zl(null,e,this.count):Array.isArray(this.getValueFromReference())?td(null,e):"texture"===e?Kl(null):"cubeTexture"===e?$c(null):Sa(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Hc(e,t,r),jc=(e,t,r,s)=>new Hc(e,t,s,r);class Xc extends Hc{static get type(){return"MaterialReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const Kc=(e,t,r=null)=>new Xc(e,t,r),Qc=kl(),Yc=pc.dFdx(),Zc=pc.dFdy(),Jc=Qc.dFdx(),eh=Qc.dFdy(),th=Sc,rh=Zc.cross(th),sh=th.cross(Yc),ih=rh.mul(Jc.x).add(sh.mul(eh.x)),nh=rh.mul(Jc.y).add(sh.mul(eh.y)),ah=ih.dot(ih).max(nh.dot(nh)),oh=ah.equal(0).select(0,ah.inverseSqrt()),uh=ih.mul(oh).toVar("tangentViewFrame"),lh=nh.mul(oh).toVar("bitangentViewFrame"),dh=Vl("tangent","vec4"),ch=dh.xyz.toVar("tangentLocal"),hh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?sc.mul(Cn(ch,0)).xyz.toVarying("v_tangentView").normalize():uh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),ph=hh.transformDirection(Dd).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),gh=cn(([e,t],r)=>{let s=e.mul(dh.w).xyz;return"NORMAL"===r.subBuildFn&&!0!==r.isFlatShading()&&(s=s.toVarying(t)),s}).once(["NORMAL"]),mh=gh(xc.cross(dh),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),fh=gh(Tc.cross(ch),"v_bitangentLocal").normalize().toVar("bitangentLocal"),yh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?gh(Sc.cross(hh),"v_bitangentView").normalize():lh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),bh=gh(Rc.cross(ph),"v_bitangentWorld").normalize().toVar("bitangentWorld"),xh=Pn(hh,yh,Sc).toVar("TBNViewMatrix"),Th=gc.mul(xh),_h=cn(()=>{let e=ra.cross(gc);return e=e.cross(ra).normalize(),e=gu(e,Sc,ea.mul(Wn.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),vh=e=>tn(e).mul(.5).add(.5),Nh=e=>Rn(e,_o(fu(yn(1).sub(nu(e,e)))));class Sh extends gi{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=O,this.unpackNormalMode=V}setup(e){const{normalMapType:t,scaleNode:r,unpackNormalMode:s}=this;let i=this.node.mul(2).sub(1);if(t===O?s===k?i=Nh(i.xy):s===G?i=Nh(i.yw):s!==V&&o(`THREE.NodeMaterial: Unexpected unpack normal mode: ${s}`):s!==V&&o(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${s}'`),null!==r){let t=r;!0===e.isFlatShading()&&(t=bc(t)),i=Rn(i.xy.mul(t),i.z)}let n=null;return t===z?n=wc(i):t===O?n=xh.mul(i).normalize():(o(`NodeMaterial: Unsupported normal map type: ${t}`),n=Sc),n}}const Rh=an(Sh).setParameterLength(1,2),Ah=cn(({textureNode:e,bumpScale:t})=>{const r=t=>e.isolate().context({getUV:e=>t(e.uvNode||kl()),forceUVContext:!0}),s=yn(r(e=>e));return _n(yn(r(e=>e.add(e.dFdx()))).sub(s),yn(r(e=>e.add(e.dFdy()))).sub(s)).mul(t)}),Eh=cn(e=>{const{surf_pos:t,surf_norm:r,dHdxy:s}=e,i=t.dFdx().normalize(),n=r,a=t.dFdy().normalize().cross(n),o=n.cross(i),u=i.dot(a).mul(yc),l=u.sign().mul(s.x.mul(a).add(s.y.mul(o)));return u.abs().mul(r).sub(l).normalize()});class wh extends gi{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=Ah({textureNode:this.textureNode,bumpScale:e});return Eh({surf_pos:pc,surf_norm:Sc,dHdxy:t})}}const Ch=an(wh).setParameterLength(1,2),Mh=new Map;class Bh extends ci{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let r=Mh.get(e);return void 0===r&&(r=Kc(e,t),Mh.set(e,r)),r}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,r=this.scope;let s=null;if(r===Bh.COLOR){const e=void 0!==t.color?this.getColor(r):Rn();s=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(r===Bh.OPACITY){const e=this.getFloat(r);s=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(r===Bh.SPECULAR_STRENGTH)s=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:yn(1);else if(r===Bh.SPECULAR_INTENSITY){const e=this.getFloat(r);s=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(r).a):e}else if(r===Bh.SPECULAR_COLOR){const e=this.getColor(r);s=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(r).rgb):e}else if(r===Bh.ROUGHNESS){const e=this.getFloat(r);s=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(r).g):e}else if(r===Bh.METALNESS){const e=this.getFloat(r);s=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(r).b):e}else if(r===Bh.EMISSIVE){const e=this.getFloat("emissiveIntensity"),i=this.getColor(r).mul(e);s=t.emissiveMap&&!0===t.emissiveMap.isTexture?i.mul(this.getTexture(r)):i}else if(r===Bh.NORMAL)t.normalMap?(s=Rh(this.getTexture("normal"),this.getCache("normalScale","vec2")),s.normalMapType=t.normalMapType,t.normalMap.format!=$&&t.normalMap.format!=W&&t.normalMap.format!=H||(s.unpackNormalMode=k)):s=t.bumpMap?Ch(this.getTexture("bump").r,this.getFloat("bumpScale")):Sc;else if(r===Bh.CLEARCOAT){const e=this.getFloat(r);s=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_ROUGHNESS){const e=this.getFloat(r);s=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_NORMAL)s=t.clearcoatNormalMap?Rh(this.getTexture(r),this.getCache(r+"Scale","vec2")):Sc;else if(r===Bh.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));s=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(r===Bh.SHEEN_ROUGHNESS){const e=this.getFloat(r);s=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(r).a):e,s=s.clamp(1e-4,1)}else if(r===Bh.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(r);s=Ln(mp.x,mp.y,mp.y.negate(),mp.x).mul(e.rg.mul(2).sub(_n(1)).normalize().mul(e.b))}else s=mp;else if(r===Bh.IRIDESCENCE_THICKNESS){const e=qc("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=qc("0","float",t.iridescenceThicknessRange);s=e.sub(i).mul(this.getTexture(r).g).add(i)}else s=e}else if(r===Bh.TRANSMISSION){const e=this.getFloat(r);s=t.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===Bh.THICKNESS){const e=this.getFloat(r);s=t.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===Bh.IOR)s=this.getFloat(r);else if(r===Bh.LIGHT_MAP)s=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===Bh.AO)s=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(r===Bh.LINE_DASH_OFFSET)s=t.dashOffset?this.getFloat(r):yn(0);else{const t=this.getNodeType(e);s=this.getCache(r,t)}return s}}Bh.ALPHA_TEST="alphaTest",Bh.COLOR="color",Bh.OPACITY="opacity",Bh.SHININESS="shininess",Bh.SPECULAR="specular",Bh.SPECULAR_STRENGTH="specularStrength",Bh.SPECULAR_INTENSITY="specularIntensity",Bh.SPECULAR_COLOR="specularColor",Bh.REFLECTIVITY="reflectivity",Bh.ROUGHNESS="roughness",Bh.METALNESS="metalness",Bh.NORMAL="normal",Bh.CLEARCOAT="clearcoat",Bh.CLEARCOAT_ROUGHNESS="clearcoatRoughness",Bh.CLEARCOAT_NORMAL="clearcoatNormal",Bh.EMISSIVE="emissive",Bh.ROTATION="rotation",Bh.SHEEN="sheen",Bh.SHEEN_ROUGHNESS="sheenRoughness",Bh.ANISOTROPY="anisotropy",Bh.IRIDESCENCE="iridescence",Bh.IRIDESCENCE_IOR="iridescenceIOR",Bh.IRIDESCENCE_THICKNESS="iridescenceThickness",Bh.IOR="ior",Bh.TRANSMISSION="transmission",Bh.THICKNESS="thickness",Bh.ATTENUATION_DISTANCE="attenuationDistance",Bh.ATTENUATION_COLOR="attenuationColor",Bh.LINE_SCALE="scale",Bh.LINE_DASH_SIZE="dashSize",Bh.LINE_GAP_SIZE="gapSize",Bh.LINE_WIDTH="linewidth",Bh.LINE_DASH_OFFSET="dashOffset",Bh.POINT_SIZE="size",Bh.DISPERSION="dispersion",Bh.LIGHT_MAP="light",Bh.AO="ao";const Fh=on(Bh,Bh.ALPHA_TEST),Lh=on(Bh,Bh.COLOR),Ph=on(Bh,Bh.SHININESS),Dh=on(Bh,Bh.EMISSIVE),Uh=on(Bh,Bh.OPACITY),Ih=on(Bh,Bh.SPECULAR),Oh=on(Bh,Bh.SPECULAR_INTENSITY),Vh=on(Bh,Bh.SPECULAR_COLOR),kh=on(Bh,Bh.SPECULAR_STRENGTH),Gh=on(Bh,Bh.REFLECTIVITY),zh=on(Bh,Bh.ROUGHNESS),$h=on(Bh,Bh.METALNESS),Wh=on(Bh,Bh.NORMAL),Hh=on(Bh,Bh.CLEARCOAT),qh=on(Bh,Bh.CLEARCOAT_ROUGHNESS),jh=on(Bh,Bh.CLEARCOAT_NORMAL),Xh=on(Bh,Bh.ROTATION),Kh=on(Bh,Bh.SHEEN),Qh=on(Bh,Bh.SHEEN_ROUGHNESS),Yh=on(Bh,Bh.ANISOTROPY),Zh=on(Bh,Bh.IRIDESCENCE),Jh=on(Bh,Bh.IRIDESCENCE_IOR),ep=on(Bh,Bh.IRIDESCENCE_THICKNESS),tp=on(Bh,Bh.TRANSMISSION),rp=on(Bh,Bh.THICKNESS),sp=on(Bh,Bh.IOR),ip=on(Bh,Bh.ATTENUATION_DISTANCE),np=on(Bh,Bh.ATTENUATION_COLOR),ap=on(Bh,Bh.LINE_SCALE),op=on(Bh,Bh.LINE_DASH_SIZE),up=on(Bh,Bh.LINE_GAP_SIZE),lp=on(Bh,Bh.LINE_WIDTH),dp=on(Bh,Bh.LINE_DASH_OFFSET),cp=on(Bh,Bh.POINT_SIZE),hp=on(Bh,Bh.DISPERSION),pp=on(Bh,Bh.LIGHT_MAP),gp=on(Bh,Bh.AO),mp=Sa(new t).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),fp=cn(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class yp extends hi{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r;const s=e.context.assign;if(r=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===s||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}const bp=an(yp).setParameterLength(2);class xp extends Yl{static get type(){return"StorageBufferNode"}constructor(e,t=null,r=0){let s,i=null;t&&t.isStruct?(s="struct",i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(s=Ws(e.itemSize),r=e.count):s=t,super(e,s,r),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=ii.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(0===this.bufferCount){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return bp(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(ii.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=ul(this.value),this._varying=$u(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:r}=this.getAttributeData(),s=r.build(e);return e.registerTransform(s,t),s}}const Tp=(e,t=null,r=0)=>new xp(e,t,r);class _p extends ci{static get type(){return"InstanceNode"}constructor(e,t,r=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=r,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=ri.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}get isStorageColor(){const{instanceColor:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}setup(e){let{instanceMatrixNode:t,instanceColorNode:r}=this;null===t&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);const{instanceColor:s,isStorageColor:i}=this;if(s&&null===r){if(i)r=Tp(s,"vec3",Math.max(s.count,1)).element(pl);else{const e=new q(s.array,3),t=s.usage===x?dl:ll;this.bufferColor=e,r=Rn(t(e,"vec3",3,0))}this.instanceColorNode=r}const n=t.mul(lc).xyz;if(lc.assign(n),e.needsPreviousData()&&dc.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){const e=Ec(Tc,t);Tc.assign(e)}null!==this.instanceColorNode&&kn("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){null!==this.buffer&&!0!==this.isStorageMatrix&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&!0!==this.isStorageColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),null!==this.previousInstanceMatrixNode&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){const t=e.object;return null===this.previousInstanceMatrixNode&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(dc).xyz}_createInstanceMatrixNode(e,t){let r;const{instanceMatrix:s}=this,{count:i}=s;if(this.isStorageMatrix)r=Tp(s,"mat4",Math.max(i,1)).element(pl);else{if(16*i*4<=t.getUniformBufferLimit())r=Zl(s.array,"mat4",Math.max(i,1)).element(pl);else{const t=new j(s.array,16,1);!0===e&&(this.buffer=t);const i=s.usage===x?dl:ll,n=[i(t,"vec4",16,0),i(t,"vec4",16,4),i(t,"vec4",16,8),i(t,"vec4",16,12)];r=Dn(...n)}}return r}}const vp=an(_p).setParameterLength(2,3);class Np extends _p{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:r,instanceColor:s}=e;super(t,r,s),this.instancedMesh=e}}const Sp=an(Np).setParameterLength(1);class Rp extends ci{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=pl:this.batchingIdNode=yl);const t=cn(([e])=>{const t=bn(zl(Ql(this.batchMesh._indirectTexture),0).x).toConst(),r=bn(e).mod(t).toConst(),s=bn(e).div(t).toConst();return Ql(this.batchMesh._indirectTexture,vn(r,s)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),r=t(bn(this.batchingIdNode)),s=this.batchMesh._matricesTexture,i=bn(zl(Ql(s),0).x).toConst(),n=yn(r).mul(4).toInt().toConst(),a=n.mod(i).toConst(),o=n.div(i).toConst(),u=Dn(Ql(s,vn(a,o)),Ql(s,vn(a.add(1),o)),Ql(s,vn(a.add(2),o)),Ql(s,vn(a.add(3),o))),l=this.batchMesh._colorsTexture;if(null!==l){const e=cn(([e])=>{const t=bn(zl(Ql(l),0).x).toConst(),r=e,s=r.mod(t).toConst(),i=r.div(t).toConst();return Ql(l,vn(s,i)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),t=e(r);kn("vec3","vBatchColor").assign(t)}const d=Pn(u);lc.assign(u.mul(lc));const c=Tc.div(Rn(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),h=d.mul(c).xyz;Tc.assign(h),e.hasGeometryAttribute("tangent")&&ch.mulAssign(d)}}const Ap=an(Rp).setParameterLength(1),Ep=new WeakMap;class wp extends ci{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=ri.OBJECT,this.skinIndexNode=Vl("skinIndex","uvec4"),this.skinWeightNode=Vl("skinWeight","vec4"),this.bindMatrixNode=qc("bindMatrix","mat4"),this.bindMatrixInverseNode=qc("bindMatrixInverse","mat4"),this.boneMatricesNode=jc("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=lc,this.toPositionNode=lc,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:r,skinWeightNode:s,bindMatrixNode:i,bindMatrixInverseNode:n}=this,a=e.element(r.x),o=e.element(r.y),u=e.element(r.z),l=e.element(r.w),d=i.mul(t),c=La(a.mul(s.x).mul(d),o.mul(s.y).mul(d),u.mul(s.z).mul(d),l.mul(s.w).mul(d));return n.mul(c).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=Tc,r=ch){const{skinIndexNode:s,skinWeightNode:i,bindMatrixNode:n,bindMatrixInverseNode:a}=this,o=e.element(s.x),u=e.element(s.y),l=e.element(s.z),d=e.element(s.w);let c=La(i.x.mul(o),i.y.mul(u),i.z.mul(l),i.w.mul(d));c=a.mul(c).mul(n);return{skinNormal:c.transformDirection(t).xyz,skinTangent:c.transformDirection(r).xyz}}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=jc("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,dc)}setup(e){e.needsPreviousData()&&dc.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const{skinNormal:t,skinTangent:r}=this.getSkinnedNormalAndTangent();Tc.assign(t),e.hasGeometryAttribute("tangent")&&ch.assign(r)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;Ep.get(t)!==e.frameId&&(Ep.set(t,e.frameId),null!==this.previousBoneMatricesNode&&(null===t.previousBoneMatrices&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const Cp=e=>new wp(e);class Mp extends ci{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const r={};for(let e=0,t=this.params.length-1;eNumber(l)?">=":"<")),a)n=`while ( ${l} )`;else{const r={start:u,end:l},s=r.start,i=r.end;let a;const g=()=>h.includes("<")?"+=":"-=";if(null!=p)switch(typeof p){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=d+" "+g()+" "+e.generateConst(c,p);break;case"string":a=d+" "+p;break;default:p.isNode?a=d+" "+g()+" "+p.build(e):(o("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),a="break /* invalid update */")}else p="int"===c||"uint"===c?h.includes("<")?"++":"--":g()+" 1.",a=d+" "+p;n=`for ( ${e.getVar(c,d)+" = "+s}; ${d+" "+h+" "+i}; ${a} )`}e.addFlowCode((0===s?"\n":"")+e.tab+n+" {\n\n").addFlowTab()}const i=s.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+i);for(let t=0,r=this.params.length-1;tnew Mp(nn(e,"int")).toStack(),Fp=()=>Cl("break").toStack(),Lp=new WeakMap,Pp=new s,Dp=cn(({bufferMap:e,influence:t,stride:r,width:s,depth:i,offset:n})=>{const a=bn(hl).mul(r).add(n),o=a.div(s),u=a.sub(o.mul(s));return Ql(e,vn(u,o)).depth(i).xyz.mul(t)});class Up extends ci{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Sa(1),this.updateType=ri.OBJECT}setup(e){const{geometry:r}=e,s=void 0!==r.morphAttributes.position,i=r.hasAttribute("normal")&&void 0!==r.morphAttributes.normal,n=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,a=void 0!==n?n.length:0,{texture:o,stride:u,size:l}=function(e){const r=void 0!==e.morphAttributes.position,s=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,n=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=void 0!==n?n.length:0;let o=Lp.get(e);if(void 0===o||o.count!==a){void 0!==o&&o.texture.dispose();const u=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],d=e.morphAttributes.color||[];let c=0;!0===r&&(c=1),!0===s&&(c=2),!0===i&&(c=3);let h=e.attributes.position.count*c,p=1;const g=4096;h>g&&(p=Math.ceil(h/g),h=g);const m=new Float32Array(h*p*4*a),f=new X(m,h,p,a);f.type=K,f.needsUpdate=!0;const y=4*c;for(let x=0;x{const t=yn(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(Ql(this.mesh.morphTexture,vn(bn(e).add(1),bn(pl))).r):t.assign(qc("morphTargetInfluences","float").element(e).toVar()),gn(t.notEqual(0),()=>{!0===s&&lc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(0)})),!0===i&&Tc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const Ip=an(Up).setParameterLength(1);class Op extends ci{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Vp extends Op{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class kp extends wu{static get type(){return"LightingContextNode"}constructor(e,t=null,r=null,s=null){super(e),this.lightingModel=t,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,r={directDiffuse:Rn().toVar("directDiffuse"),directSpecular:Rn().toVar("directSpecular"),indirectDiffuse:Rn().toVar("indirectDiffuse"),indirectSpecular:Rn().toVar("indirectSpecular")};return{radiance:Rn().toVar("radiance"),irradiance:Rn().toVar("irradiance"),iblIrradiance:Rn().toVar("iblIrradiance"),ambientOcclusion:yn(1).toVar("ambientOcclusion"),reflectedLight:r,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Gp=an(kp);class zp extends Op{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const $p=new t;class Wp extends jl{static get type(){return"ViewportTextureNode"}constructor(e=ud,t=null,r=null){let s=null;null===r?(s=new Q,s.minFilter=Y,r=s):s=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=s,this.isOutputTextureNode=!0,this.updateBeforeType=ri.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),null===e)return t;if(!1===r.has(e)){const s=t.clone();r.set(e,s)}return r.get(e)}updateReference(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;return this.value=this.getTextureForReference(i),this.value}updateBefore(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;null===i?t.getDrawingBufferSize($p):i.getDrawingBufferSize?i.getDrawingBufferSize($p):$p.set(i.width,i.height);const n=this.getTextureForReference(i);n.image.width===$p.width&&n.image.height===$p.height||(n.image.width=$p.width,n.image.height=$p.height,n.needsUpdate=!0);const a=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=a}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Hp=an(Wp).setParameterLength(0,3),qp=an(Wp,null,null,{generateMipmaps:!0}).setParameterLength(0,3),jp=qp(),Xp=(e=ud,t=null)=>jp.sample(e,t);let Kp=null;class Qp extends Wp{static get type(){return"ViewportDepthTextureNode"}constructor(e=ud,t=null,r=null){null===r&&(null===Kp&&(Kp=new Z),r=Kp),super(e,t,r)}}const Yp=an(Qp).setParameterLength(0,3);class Zp extends ci{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Zp.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,r=this.valueNode;let s=null;if(t===Zp.DEPTH_BASE)null!==r&&(s=ng().assign(r));else if(t===Zp.DEPTH)s=e.isPerspectiveCamera?tg(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd);else if(t===Zp.LINEAR_DEPTH)if(null!==r)if(e.isPerspectiveCamera){const e=sg(r,Bd,Fd);s=Jp(e,Bd,Fd)}else s=r;else s=Jp(pc.z,Bd,Fd);return s}}Zp.DEPTH_BASE="depthBase",Zp.DEPTH="depth",Zp.LINEAR_DEPTH="linearDepth";const Jp=(e,t,r)=>e.add(t).div(t.sub(r)),eg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),tg=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),rg=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),sg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),ig=(e,t,r)=>{t=t.max(1e-6).toVar();const s=To(e.negate().div(t)),i=To(r.div(t));return s.div(i)},ng=an(Zp,Zp.DEPTH_BASE),ag=on(Zp,Zp.DEPTH),og=an(Zp,Zp.LINEAR_DEPTH).setParameterLength(0,1),ug=og(Yp());ag.assign=e=>ng(e);class lg extends ci{static get type(){return"ClippingNode"}constructor(e=lg.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:r,unionPlanes:s}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===lg.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(r,s):this.scope===lg.HARDWARE?this.setupHardwareClipping(s,e):this.setupDefault(r,s)}setupAlphaToCoverage(e,t){return cn(()=>{const r=yn().toVar("distanceToPlane"),s=yn().toVar("distanceToGradient"),i=yn(1).toVar("clipOpacity"),n=t.length;if(!1===this.hardwareClipping&&n>0){const e=td(t).setGroup(_a);Bp(n,({i:t})=>{const n=e.element(t);r.assign(pc.dot(n.xyz).negate().add(n.w)),s.assign(r.fwidth().div(2)),i.mulAssign(bu(s.negate(),s,r))})}const a=e.length;if(a>0){const t=td(e).setGroup(_a),n=yn(1).toVar("intersectionClipOpacity");Bp(a,({i:e})=>{const i=t.element(e);r.assign(pc.dot(i.xyz).negate().add(i.w)),s.assign(r.fwidth().div(2)),n.mulAssign(bu(s.negate(),s,r).oneMinus())}),i.mulAssign(n.oneMinus())}Gn.a.mulAssign(i),Gn.a.equal(0).discard()})()}setupDefault(e,t){return cn(()=>{const r=t.length;if(!1===this.hardwareClipping&&r>0){const e=td(t).setGroup(_a);Bp(r,({i:t})=>{const r=e.element(t);pc.dot(r.xyz).greaterThan(r.w).discard()})}const s=e.length;if(s>0){const t=td(e).setGroup(_a),r=Tn(!0).toVar("clipped");Bp(s,({i:e})=>{const s=t.element(e);r.assign(pc.dot(s.xyz).greaterThan(s.w).and(r))}),r.discard()}})()}setupHardwareClipping(e,t){const r=e.length;return t.enableHardwareClipping(r),cn(()=>{const s=td(e).setGroup(_a),i=sd(t.getClipDistance());Bp(r,({i:e})=>{const t=s.element(e),r=pc.dot(t.xyz).sub(t.w).negate();i.element(e).assign(r)})})()}}lg.ALPHA_TO_COVERAGE="alphaToCoverage",lg.DEFAULT="default",lg.HARDWARE="hardware";const dg=cn(([e])=>Ao(Da(1e4,Eo(Da(17,e.x).add(Da(.1,e.y)))).mul(La(.1,Vo(Eo(Da(13,e.y).add(e.x))))))),cg=cn(([e])=>dg(_n(dg(e.xy),e.z))),hg=cn(([e])=>{const t=eu(Go(Wo(e.xyz)),Go(Ho(e.xyz))),r=yn(1).div(yn(.05).mul(t)).toVar("pixScale"),s=_n(bo(No(To(r))),bo(So(To(r)))),i=_n(cg(No(s.x.mul(e.xyz))),cg(No(s.y.mul(e.xyz)))),n=Ao(To(r)),a=La(Da(n.oneMinus(),i.x),Da(n,i.y)),o=Jo(n,n.oneMinus()),u=Rn(a.mul(a).div(Da(2,o).mul(Pa(1,o))),a.sub(Da(.5,o)).div(Pa(1,o)),Pa(1,Pa(1,a).mul(Pa(1,a)).div(Da(2,o).mul(Pa(1,o))))),l=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(u.x,u.y),u.z);return mu(l,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class pg extends Ol{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let r;return r=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new s(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const gg=(e=0)=>new pg(e),mg=cn(([e,t])=>Jo(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fg=cn(([e,t])=>Jo(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yg=cn(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bg=cn(([e,t])=>gu(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),tu(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xg=cn(([e,t])=>{const r=t.a.add(e.a.mul(t.a.oneMinus()));return Cn(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Tg=cn(([e])=>Cn(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),_g=cn(([e])=>(gn(e.a.equal(0),()=>Cn(0)),Cn(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class vg extends J{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;const r=this[t];r&&!0===r.isNode&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:r}of this._getNodeChildren())e.push(Vs(t.slice(0,-4)),r.getCacheKey());return this.type+ks(e)}build(e){this.setup(e)}setupObserver(e){return new Ds(e)}setup(e){e.context.setupNormal=()=>Gu(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,r=t.getRenderTarget();e.addStack();const s=this.setupVertex(e),i=Gu(this.vertexNode||s,"VERTEX");let n;e.context.clipSpace=i,e.stack.outputNode=i,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==r?!0===r.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const s=this.setupLighting(e);null!==a&&e.stack.addToStack(a);const i=Cn(s,Gn.a).max(0);n=this.setupOutput(e,i),oa.assign(n);const o=null!==this.outputNode;if(o&&(n=this.outputNode),e.context.getOutput&&(n=e.context.getOutput(n,e)),null!==r){const e=t.getMRT(),r=this.mrtNode;null!==e?(o&&oa.assign(n),n=e,null!==r&&(n=e.merge(r))):null!==r&&(n=r)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Cn(t)),n=this.setupOutput(e,t)}e.stack.outputNode=n,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:r}=e.clippingContext;let s=null;if(t.length>0||r.length>0){const t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?s=new lg(lg.ALPHA_TO_COVERAGE):e.stack.addToStack(new lg)}return s}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(new lg(lg.HARDWARE)),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:r}=e;let s=this.depthNode;if(null===s){const e=t.getMRT();e&&e.has("depth")?s=e.get("depth"):!0===t.logarithmicDepthBuffer&&(s=r.isPerspectiveCamera?ig(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd))}null!==s&&ag.assign(s).toStack()}setupPositionView(){return sc.mul(lc).xyz}setupModelViewProjection(){return Ld.mul(pc)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),fp}setupPosition(e){const{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&Ip(t).toStack(),!0===t.isSkinnedMesh&&Cp(t).toStack(),this.displacementMap){const e=Kc("displacementMap","texture"),t=Kc("displacementScale","float"),r=Kc("displacementBias","float");lc.addAssign(Tc.normalize().mul(e.x.mul(t).add(r)))}return t.isBatchedMesh&&Ap(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&Sp(t).toStack(),null!==this.positionNode&&lc.assign(Gu(this.positionNode,"POSITION","vec3")),lc}setupDiffuseColor(e){const{object:t,geometry:r}=e;null!==this.maskNode&&Tn(this.maskNode).not().discard();let s=this.colorNode?Cn(this.colorNode):Lh;if(!0===this.vertexColors&&r.hasAttribute("color")&&(s=s.mul(gg())),t.instanceColor){s=kn("vec3","vInstanceColor").mul(s)}if(t.isBatchedMesh&&t._colorsTexture){s=kn("vec3","vBatchColor").mul(s)}Gn.assign(s);const i=this.opacityNode?yn(this.opacityNode):Uh;Gn.a.assign(Gn.a.mul(i));let n=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(n=null!==this.alphaTestNode?yn(this.alphaTestNode):Fh,!0===this.alphaToCoverage?(Gn.a=bu(n,n.add(Ko(Gn.a)),Gn.a),Gn.a.lessThanEqual(0).discard()):Gn.a.lessThanEqual(n).discard()),!0===this.alphaHash&&Gn.a.lessThan(hg(lc)).discard(),e.isOpaque()&&Gn.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?Rn(0):Gn.rgb}setupNormal(){return this.normalNode?Rn(this.normalNode):Wh}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Kc("envMap","cubeTexture"):Kc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new zp(pp)),t}setupLights(e){const t=[],r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);const s=this.setupLightMap(e);s&&s.isLightingNode&&t.push(s);let i=this.aoNode;null===i&&e.material.aoMap&&(i=gp),e.context.getAO&&(i=e.context.getAO(i,e)),i&&t.push(new Vp(i));let n=this.lightsNode||e.lightsNode;return t.length>0&&(n=e.renderer.lighting.createNode([...n.getLights(),...t])),n}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:r,backdropAlphaNode:s,emissiveNode:i}=this,n=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(n&&n.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=Gp(n,t,r,s)}else null!==r&&(a=Rn(null!==s?gu(a,r,s):r));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&($n.assign(Rn(i||Dh)),a=a.add($n)),a}setupFog(e,t){const r=e.fogNode;return r&&(oa.assign(t),t=Cn(r.toVar())),t}setupPremultipliedAlpha(e,t){return Tg(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const t in e){const r=e[t];void 0===this[t]&&(this[t]=r,r&&r.clone&&(this[t]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const r=J.prototype.toJSON.call(this,e);r.inputNodes={};for(const{property:t,childNode:s}of this._getNodeChildren())r.inputNodes[t]=s.toJSON(e).uuid;function s(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(t){const t=s(e.textures),i=s(e.images),n=s(e.nodes);t.length>0&&(r.textures=t),i.length>0&&(r.images=i),n.length>0&&(r.nodes=n)}return r}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const Ng=new ee;class Sg extends vg{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Ng),this.setValues(e)}}const Rg=new te;class Ag extends vg{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Rg),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?yn(this.offsetNode):dp,t=this.dashScaleNode?yn(this.dashScaleNode):ap,r=this.dashSizeNode?yn(this.dashSizeNode):op,s=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(r),la.assign(s);const i=$u(Vl("lineDistance").mul(t));(e?i.add(e):i).mod(ua.add(la)).greaterThan(ua).discard()}}const Eg=new te;class wg extends vg{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(Eg),this.vertexColors=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=re,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,r=this._useAlphaToCoverage,s=this.vertexColors,i=this._useDash,n=this._useWorldUnits,a=cn(({start:e,end:t})=>{const r=Ld.element(2).element(2),s=Ld.element(3).element(2).mul(-.5).div(r).sub(e.z).div(t.z.sub(e.z));return Cn(gu(e.xyz,t.xyz,s),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=cn(()=>{const e=Vl("instanceStart"),t=Vl("instanceEnd"),r=Cn(sc.mul(Cn(e,1))).toVar("start"),s=Cn(sc.mul(Cn(t,1))).toVar("end");if(i){const e=this.dashScaleNode?yn(this.dashScaleNode):ap,t=this.offsetNode?yn(this.offsetNode):dp,r=Vl("instanceDistanceStart"),s=Vl("instanceDistanceEnd");let i=uc.y.lessThan(.5).select(e.mul(r),e.mul(s));i=i.add(t),kn("float","lineDistance").assign(i)}n&&(kn("vec3","worldStart").assign(r.xyz),kn("vec3","worldEnd").assign(s.xyz));const o=cd.z.div(cd.w),u=Ld.element(2).element(3).equal(-1);gn(u,()=>{gn(r.z.lessThan(0).and(s.z.greaterThan(0)),()=>{s.assign(a({start:r,end:s}))}).ElseIf(s.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{r.assign(a({start:s,end:r}))})});const l=Ld.mul(r),d=Ld.mul(s),c=l.xyz.div(l.w),h=d.xyz.div(d.w),p=h.xy.sub(c.xy).toVar();p.x.assign(p.x.mul(o)),p.assign(p.normalize());const g=Cn().toVar();if(n){const e=s.xyz.sub(r.xyz).normalize(),t=gu(r.xyz,s.xyz,.5).normalize(),n=e.cross(t).normalize(),a=e.cross(n),o=kn("vec4","worldPos");o.assign(uc.y.lessThan(.5).select(r,s));const u=lp.mul(.5);o.addAssign(Cn(uc.x.lessThan(0).select(n.mul(u),n.mul(u).negate()),0)),i||(o.addAssign(Cn(uc.y.lessThan(.5).select(e.mul(u).negate(),e.mul(u)),0)),o.addAssign(Cn(a.mul(u),0)),gn(uc.y.greaterThan(1).or(uc.y.lessThan(0)),()=>{o.subAssign(Cn(a.mul(2).mul(u),0))})),g.assign(Ld.mul(o));const l=Rn().toVar();l.assign(uc.y.lessThan(.5).select(c,h)),g.z.assign(l.z.mul(g.w))}else{const e=_n(p.y,p.x.negate()).toVar("offset");p.x.assign(p.x.div(o)),e.x.assign(e.x.div(o)),e.assign(uc.x.lessThan(0).select(e.negate(),e)),gn(uc.y.lessThan(0),()=>{e.assign(e.sub(p))}).ElseIf(uc.y.greaterThan(1),()=>{e.assign(e.add(p))}),e.assign(e.mul(lp)),e.assign(e.div(cd.w.div(od))),g.assign(uc.y.lessThan(.5).select(l,d)),e.assign(e.mul(g.w)),g.assign(g.add(Cn(e,0,0)))}return g})();const o=cn(({p1:e,p2:t,p3:r,p4:s})=>{const i=e.sub(r),n=s.sub(r),a=t.sub(e),o=i.dot(n),u=n.dot(a),l=i.dot(a),d=n.dot(n),c=a.dot(a).mul(d).sub(u.mul(u)),h=o.mul(u).sub(l.mul(d)).div(c).clamp(),p=o.add(u.mul(h)).div(d).clamp();return _n(h,p)});if(this.colorNode=cn(()=>{const e=kl();if(i){const t=this.dashSizeNode?yn(this.dashSizeNode):op,r=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(t),la.assign(r);const s=kn("float","lineDistance");e.y.lessThan(-1).or(e.y.greaterThan(1)).discard(),s.mod(ua.add(la)).greaterThan(ua).discard()}const a=yn(1).toVar("alpha");if(n){const e=kn("vec3","worldStart"),s=kn("vec3","worldEnd"),n=kn("vec4","worldPos").xyz.normalize().mul(1e5),u=s.sub(e),l=o({p1:e,p2:s,p3:Rn(0,0,0),p4:n}),d=e.add(u.mul(l.x)),c=n.mul(l.y),h=d.sub(c).length().div(lp);if(!i)if(r&&t.currentSamples>0){const e=h.fwidth();a.assign(bu(e.negate().add(.5),e.add(.5),h).oneMinus())}else h.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1)),s=t.mul(t).add(r.mul(r)),i=yn(s.fwidth()).toVar("dlen");gn(e.y.abs().greaterThan(1),()=>{a.assign(bu(i.oneMinus(),i.add(1),s).oneMinus())})}else gn(e.y.abs().greaterThan(1),()=>{const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1));t.mul(t).add(r.mul(r)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(s){const e=Vl("instanceColorStart"),t=Vl("instanceColorEnd");u=uc.y.lessThan(.5).select(e,t).mul(Lh)}else u=Lh;return Cn(u,a)})(),this.transparent){const e=this.opacityNode?yn(this.opacityNode):Uh;this.outputNode=Cn(this.colorNode.rgb.mul(e).add(Xp().rgb.mul(e.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}copy(e){return super.copy(e),this.vertexColors=e.vertexColors,this.dashOffset=e.dashOffset,this.lineColorNode=e.lineColorNode,this.offsetNode=e.offsetNode,this.dashScaleNode=e.dashScaleNode,this.dashSizeNode=e.dashSizeNode,this.gapSizeNode=e.gapSizeNode,this._useDash=e._useDash,this._useAlphaToCoverage=e._useAlphaToCoverage,this._useWorldUnits=e._useWorldUnits,this}}const Cg=new se;class Mg extends vg{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Cg),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?yn(this.opacityNode):Uh;Gn.assign(Qu(Cn(vh(Sc),e),ie))}}const Bg=cn(([e=hc])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),r=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return _n(t,r)});class Fg extends ne{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new D(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const r=t.minFilter,s=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i=new ae(5,5,5),n=Bg(hc),a=new vg;a.colorNode=Kl(t,n,0),a.side=L,a.blending=re;const o=new oe(i,a),u=new ue;u.add(o),t.minFilter===Y&&(t.minFilter=le);const l=new de(1,10,this),d=e.getMRT();return e.setMRT(null),l.update(e,u),e.setMRT(d),t.minFilter=r,t.generateMipmaps=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,s=!0){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,r,s);e.setRenderTarget(i)}}const Lg=new WeakMap;class Pg extends gi{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=$c(null);const t=new D;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=ri.RENDER}updateBefore(e){const{renderer:t,material:r}=e,s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const e=s.isTextureNode?s.value:r[s.property];if(e&&e.isTexture){const r=e.mapping;if(r===ce||r===he){if(Lg.has(e)){const t=Lg.get(e);Ug(t,e.mapping),this._cubeTexture=t}else{const r=e.image;if(function(e){return null!=e&&e.height>0}(r)){const s=new Fg(r.height);s.fromEquirectangularTexture(t,e),Ug(s.texture,e.mapping),this._cubeTexture=s.texture,Lg.set(e,s.texture),e.addEventListener("dispose",Dg)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function Dg(e){const t=e.target;t.removeEventListener("dispose",Dg);const r=Lg.get(t);void 0!==r&&(Lg.delete(t),r.dispose())}function Ug(e,t){t===ce?e.mapping=U:t===he&&(e.mapping=I)}const Ig=an(Pg).setParameterLength(1);class Og extends Op{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Ig(this.envNode)}}class Vg extends Op{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=yn(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class kg{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Gg extends kg{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,r=e.reflectedLight,s=e.irradianceLightMap;r.indirectDiffuse.assign(Cn(0)),s?r.indirectDiffuse.addAssign(s):r.indirectDiffuse.addAssign(Cn(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(Gn.rgb)}finish(e){const{material:t,context:r}=e,s=r.outgoingLight,i=e.context.environment;if(i)switch(t.combine){case me:s.rgb.assign(gu(s.rgb,s.rgb.mul(i.rgb),kh.mul(Gh)));break;case ge:s.rgb.assign(gu(s.rgb,i.rgb,kh.mul(Gh)));break;case pe:s.rgb.addAssign(i.rgb.mul(kh.mul(Gh)));break;default:d("BasicLightingModel: Unsupported .combine value:",t.combine)}}}const zg=new fe;class $g extends vg{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(zg),this.setValues(e)}setupNormal(){return bc(vc)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Vg(pp)),t}setupOutgoingLight(){return Gn.rgb}setupLightingModel(){return new Gg}}const Wg=cn(({f0:e,f90:t,dotVH:r})=>{const s=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(s.oneMinus()).add(t.mul(s))}),Hg=cn(e=>e.diffuseColor.mul(1/Math.PI)),qg=cn(({dotNH:e})=>aa.mul(yn(.5)).add(1).mul(yn(1/Math.PI)).mul(e.pow(aa))),jg=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(t).clamp(),s=gc.dot(t).clamp(),i=Wg({f0:sa,f90:1,dotVH:s}),n=yn(.25),a=qg({dotNH:r});return i.mul(n).mul(a)});class Xg extends Gg{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t);r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:Gn.rgb}))),!0===this.specular&&r.directSpecular.addAssign(s.mul(jg({lightDirection:e})).mul(kh))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Kg=new ye;class Qg extends vg{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Kg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg(!1)}}const Yg=new be;class Zg extends vg{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Yg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg}setupVariants(){const e=(this.shininessNode?yn(this.shininessNode):Ph).max(1e-4);aa.assign(e);const t=this.specularNode||Ih;sa.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const Jg=cn(e=>{if(!1===e.geometry.hasAttribute("normal"))return yn(0);const t=vc.dFdx().abs().max(vc.dFdy().abs());return t.x.max(t.y).max(t.z)}),em=cn(e=>{const{roughness:t}=e,r=Jg();let s=t.max(.0525);return s=s.add(r),s=s.min(1),s}),tm=cn(({alpha:e,dotNL:t,dotNV:r})=>{const s=e.pow2(),i=t.mul(s.add(s.oneMinus().mul(r.pow2())).sqrt()),n=r.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt());return Ua(.5,i.add(n).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),rm=cn(({alphaT:e,alphaB:t,dotTV:r,dotBV:s,dotTL:i,dotBL:n,dotNV:a,dotNL:o})=>{const u=o.mul(Rn(e.mul(r),t.mul(s),a).length()),l=a.mul(Rn(e.mul(i),t.mul(n),o).length());return Ua(.5,u.add(l).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),sm=cn(({alpha:e,dotNH:t})=>{const r=e.pow2(),s=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),im=yn(1/Math.PI),nm=cn(({alphaT:e,alphaB:t,dotNH:r,dotTH:s,dotBH:i})=>{const n=e.mul(t),a=Rn(t.mul(s),e.mul(i),n.mul(r)),o=a.dot(a),u=n.div(o);return im.mul(n.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),am=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,normalView:n=Sc,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const u=s.pow2(),l=e.add(gc).normalize(),d=n.dot(e).clamp(),c=n.dot(gc).clamp(),h=n.dot(l).clamp(),p=gc.dot(l).clamp();let g,m,f=Wg({f0:t,f90:r,dotVH:p});if(Zi(a)&&(f=Qn.mix(f,i)),Zi(o)){const t=ta.dot(e),r=ta.dot(gc),s=ta.dot(l),i=ra.dot(e),n=ra.dot(gc),a=ra.dot(l);g=rm({alphaT:Jn,alphaB:u,dotTV:r,dotBV:n,dotTL:t,dotBL:i,dotNV:c,dotNL:d}),m=nm({alphaT:Jn,alphaB:u,dotNH:h,dotTH:s,dotBH:a})}else g=tm({alpha:u,dotNL:d,dotNV:c}),m=sm({alpha:u,dotNH:h});return f.mul(g).mul(m)}),om=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let um=null;const lm=cn(({roughness:e,dotNV:t})=>{null===um&&(um=new xe(om,16,16,$,Te),um.name="DFG_LUT",um.minFilter=le,um.magFilter=le,um.wrapS=_e,um.wrapT=_e,um.generateMipmaps=!1,um.needsUpdate=!0);const r=_n(e,t);return Kl(um,r).rg}),dm=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a})=>{const o=am({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a}),u=Sc.dot(e).clamp(),l=Sc.dot(gc).clamp(),d=lm({roughness:s,dotNV:l}),c=lm({roughness:s,dotNV:u}),h=t.mul(d.x).add(r.mul(d.y)),p=t.mul(c.x).add(r.mul(c.y)),g=d.x.add(d.y),m=c.x.add(c.y),f=yn(1).sub(g),y=yn(1).sub(m),b=t.add(t.oneMinus().mul(.047619)),x=h.mul(p).mul(b).div(yn(1).sub(f.mul(y).mul(b).mul(b)).add(ao)),T=f.mul(y),_=x.mul(T);return o.add(_)}),cm=cn(e=>{const{dotNV:t,specularColor:r,specularF90:s,roughness:i}=e,n=lm({dotNV:t,roughness:i});return r.mul(n.x).add(s.mul(n.y))}),hm=cn(({f:e,f90:t,dotVH:r})=>{const s=r.oneMinus().saturate(),i=s.mul(s),n=s.mul(i,i).clamp(0,.9999);return e.sub(Rn(t).mul(n)).div(n.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pm=cn(({roughness:e,dotNH:t})=>{const r=e.pow2(),s=yn(1).div(r),i=t.pow2().oneMinus().max(.0078125);return yn(2).add(s).mul(i.pow(s.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),gm=cn(({dotNV:e,dotNL:t})=>yn(1).div(yn(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),mm=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(e).clamp(),s=Sc.dot(gc).clamp(),i=Sc.dot(t).clamp(),n=pm({roughness:Kn,dotNH:i}),a=gm({dotNV:s,dotNL:r});return Xn.mul(n).mul(a)}),fm=cn(({N:e,V:t,roughness:r})=>{const s=e.dot(t).saturate(),i=_n(r,s.oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),ym=cn(({f:e})=>{const t=e.length();return eu(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),bm=cn(({v1:e,v2:t})=>{const r=e.dot(t),s=r.abs().toVar(),i=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),n=s.add(4.1616724).mul(s).add(3.417594).toVar(),a=i.div(n),o=r.greaterThan(0).select(a,eu(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),xm=cn(({N:e,V:t,P:r,mInv:s,p0:i,p1:n,p2:a,p3:o})=>{const u=n.sub(i).toVar(),l=o.sub(i).toVar(),d=u.cross(l),c=Rn().toVar();return gn(d.dot(r.sub(i)).greaterThanEqual(0),()=>{const u=t.sub(e.mul(t.dot(e))).normalize(),l=e.cross(u).negate(),d=s.mul(Pn(u,l,e).transpose()).toVar(),h=d.mul(i.sub(r)).normalize().toVar(),p=d.mul(n.sub(r)).normalize().toVar(),g=d.mul(a.sub(r)).normalize().toVar(),m=d.mul(o.sub(r)).normalize().toVar(),f=Rn(0).toVar();f.addAssign(bm({v1:h,v2:p})),f.addAssign(bm({v1:p,v2:g})),f.addAssign(bm({v1:g,v2:m})),f.addAssign(bm({v1:m,v2:h})),c.assign(Rn(ym({f:f})))}),c}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Tm=cn(({P:e,p0:t,p1:r,p2:s,p3:i})=>{const n=r.sub(t).toVar(),a=i.sub(t).toVar(),o=n.cross(a),u=Rn().toVar();return gn(o.dot(e.sub(t)).greaterThanEqual(0),()=>{const n=t.sub(e).normalize().toVar(),a=r.sub(e).normalize().toVar(),o=s.sub(e).normalize().toVar(),l=i.sub(e).normalize().toVar(),d=Rn(0).toVar();d.addAssign(bm({v1:n,v2:a})),d.addAssign(bm({v1:a,v2:o})),d.addAssign(bm({v1:o,v2:l})),d.addAssign(bm({v1:l,v2:n})),u.assign(Rn(ym({f:d.abs()})))}),u}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),_m=1/6,vm=e=>Da(_m,Da(e,Da(e,e.negate().add(3)).sub(3)).add(1)),Nm=e=>Da(_m,Da(e,Da(e,Da(3,e).sub(6))).add(4)),Sm=e=>Da(_m,Da(e,Da(e,Da(-3,e).add(3)).add(3)).add(1)),Rm=e=>Da(_m,ou(e,3)),Am=e=>vm(e).add(Nm(e)),Em=e=>Sm(e).add(Rm(e)),wm=e=>La(-1,Nm(e).div(vm(e).add(Nm(e)))),Cm=e=>La(1,Rm(e).div(Sm(e).add(Rm(e)))),Mm=(e,t,r)=>{const s=e.uvNode,i=Da(s,t.zw).add(.5),n=No(i),a=Ao(i),o=Am(a.x),u=Em(a.x),l=wm(a.x),d=Cm(a.x),c=wm(a.y),h=Cm(a.y),p=_n(n.x.add(l),n.y.add(c)).sub(.5).mul(t.xy),g=_n(n.x.add(d),n.y.add(c)).sub(.5).mul(t.xy),m=_n(n.x.add(l),n.y.add(h)).sub(.5).mul(t.xy),f=_n(n.x.add(d),n.y.add(h)).sub(.5).mul(t.xy),y=Am(a.y).mul(La(o.mul(e.sample(p).level(r)),u.mul(e.sample(g).level(r)))),b=Em(a.y).mul(La(o.mul(e.sample(m).level(r)),u.mul(e.sample(f).level(r))));return y.add(b)},Bm=cn(([e,t])=>{const r=_n(e.size(bn(t))),s=_n(e.size(bn(t.add(1)))),i=Ua(1,r),n=Ua(1,s),a=Mm(e,Cn(i,r),No(t)),o=Mm(e,Cn(n,s),So(t));return Ao(t).mix(a,o)}),Fm=cn(([e,t])=>{const r=t.mul(Wl(e));return Bm(e,r)}),Lm=cn(([e,t,r,s,i])=>{const n=Rn(yu(t.negate(),Ro(e),Ua(1,s))),a=Rn(Go(i[0].xyz),Go(i[1].xyz),Go(i[2].xyz));return Ro(n).mul(r.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Pm=cn(([e,t])=>e.mul(mu(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Dm=qp(),Um=Xp(),Im=cn(([e,t,r],{material:s})=>{const i=(s.side===L?Dm:Um).sample(e),n=To(ld.x).mul(Pm(t,r));return Bm(i,n)}),Om=cn(([e,t,r])=>(gn(r.notEqual(0),()=>{const s=xo(t).negate().div(r);return yo(s.negate().mul(e))}),Rn(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Vm=cn(([e,t,r,s,i,n,a,o,u,l,d,c,h,p,g])=>{let m,f;if(g){m=Cn().toVar(),f=Rn().toVar();const i=d.sub(1).mul(g.mul(.025)),n=Rn(d.sub(i),d,d.add(i));Bp({start:0,end:3},({i:i})=>{const d=n.element(i),g=Lm(e,t,c,d,o),y=a.add(g),b=l.mul(u.mul(Cn(y,1))),x=_n(b.xy.div(b.w)).toVar();x.addAssign(1),x.divAssign(2),x.assign(_n(x.x,x.y.oneMinus()));const T=Im(x,r,d);m.element(i).assign(T.element(i)),m.a.addAssign(T.a),f.element(i).assign(s.element(i).mul(Om(Go(g),h,p).element(i)))}),m.a.divAssign(3)}else{const i=Lm(e,t,c,d,o),n=a.add(i),g=l.mul(u.mul(Cn(n,1))),y=_n(g.xy.div(g.w)).toVar();y.addAssign(1),y.divAssign(2),y.assign(_n(y.x,y.y.oneMinus())),m=Im(y,r,d),f=s.mul(Om(Go(i),h,p))}const y=f.rgb.mul(m.rgb),b=e.dot(t).clamp(),x=Rn(cm({dotNV:b,specularColor:i,specularF90:n,roughness:r})),T=f.r.add(f.g,f.b).div(3);return Cn(x.oneMinus().mul(y),m.a.oneMinus().mul(T).oneMinus())}),km=Pn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Gm=(e,t)=>e.sub(t).div(e.add(t)).pow2(),zm=cn(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:s,baseF0:i})=>{const n=gu(e,t,bu(0,.03,s)),a=e.div(n).pow2().mul(r.pow2().oneMinus()).oneMinus();gn(a.lessThan(0),()=>Rn(1));const o=a.sqrt(),u=Gm(n,e),l=Wg({f0:u,f90:1,dotVH:r}),d=l.oneMinus(),c=n.lessThan(e).select(Math.PI,0),h=yn(Math.PI).sub(c),p=(e=>{const t=e.sqrt();return Rn(1).add(t).div(Rn(1).sub(t))})(i.clamp(0,.9999)),g=Gm(p,n.toVec3()),m=Wg({f0:g,f90:1,dotVH:o}),f=Rn(p.x.lessThan(n).select(Math.PI,0),p.y.lessThan(n).select(Math.PI,0),p.z.lessThan(n).select(Math.PI,0)),y=n.mul(s,o,2),b=Rn(h).add(f),x=l.mul(m).clamp(1e-5,.9999),T=x.sqrt(),_=d.pow2().mul(m).div(Rn(1).sub(x)),v=l.add(_).toVar(),N=_.sub(d).toVar();return Bp({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{N.mulAssign(T);const t=((e,t)=>{const r=e.mul(2*Math.PI*1e-9),s=Rn(54856e-17,44201e-17,52481e-17),i=Rn(1681e3,1795300,2208400),n=Rn(43278e5,93046e5,66121e5),a=yn(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(r.mul(2239900).add(t.x).cos()).mul(r.pow2().mul(-45282e5).exp());let o=s.mul(n.mul(2*Math.PI).sqrt()).mul(i.mul(r).add(t).cos()).mul(r.pow2().negate().mul(n).exp());return o=Rn(o.x.add(a),o.y,o.z).div(1.0685e-7),km.mul(o)})(yn(e).mul(y),yn(e).mul(b)).mul(2);v.addAssign(N.mul(t))}),v.max(Rn(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),$m=cn(({normal:e,viewDir:t,roughness:r})=>{const s=e.dot(t).saturate(),i=r.mul(r),n=r.add(.1).reciprocal(),a=yn(-1.9362).add(r.mul(1.0678)).add(i.mul(.4573)).sub(n.mul(.8469)),o=yn(-.6014).add(r.mul(.5538)).sub(i.mul(.467)).sub(n.mul(.1255));return a.mul(s).add(o).exp().saturate()}),Wm=Rn(.04),Hm=yn(1);class qm extends kg{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=s,this.transmission=i,this.dispersion=n,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=Rn().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Rn().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Rn().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=Rn().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Rn().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=Sc.dot(gc).clamp(),t=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:sa}),r=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:Gn.rgb});this.iridescenceFresnel=gu(t,r,Hn),this.iridescenceF0Dielectric=hm({f:t,f90:1,dotVH:e}),this.iridescenceF0Metallic=hm({f:r,f90:1,dotVH:e}),this.iridescenceF0=gu(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hn)}if(!0===this.transmission){const t=cc,r=Od.sub(cc).normalize(),s=Rc,i=e.context;i.backdrop=Vm(s,r,Wn,zn,ia,na,t,Qd,Dd,Ld,ca,pa,ma,ga,this.dispersion?fa:null),i.backdropAlpha=ha,Gn.a.mulAssign(gu(1,i.backdrop.a,ha))}super.start(e)}computeMultiscattering(e,t,r,s,i=null){const n=Sc.dot(gc).clamp(),a=lm({roughness:Wn,dotNV:n}),o=i?Qn.mix(s,i):s,u=o.mul(a.x).add(r.mul(a.y)),l=a.x.add(a.y).oneMinus(),d=o.add(o.oneMinus().mul(.047619)),c=u.mul(d).div(l.mul(d).oneMinus());e.addAssign(u),t.addAssign(c.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t).toVar();if(!0===this.sheen){this.sheenSpecularDirect.addAssign(s.mul(mm({lightDirection:e})));const t=$m({normal:Sc,viewDir:gc,roughness:Kn}),r=$m({normal:Sc,viewDir:e,roughness:Kn}),i=Xn.r.max(Xn.g).max(Xn.b).mul(t.max(r)).oneMinus();s.mulAssign(i)}if(!0===this.clearcoat){const r=Ac.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(r.mul(am({lightDirection:e,f0:Wm,f90:Hm,roughness:jn,normalView:Ac})))}r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:zn}))),r.directSpecular.addAssign(s.mul(dm({lightDirection:e,f0:ia,f90:1,roughness:Wn,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s,reflectedLight:i,ltc_1:n,ltc_2:a}){const o=t.add(r).sub(s),u=t.sub(r).sub(s),l=t.sub(r).add(s),d=t.add(r).add(s),c=Sc,h=gc,p=pc.toVar(),g=fm({N:c,V:h,roughness:Wn}),m=n.sample(g).toVar(),f=a.sample(g).toVar(),y=Pn(Rn(m.x,0,m.y),Rn(0,1,0),Rn(m.z,0,m.w)).toVar(),b=ia.mul(f.x).add(na.sub(ia).mul(f.y)).toVar();if(i.directSpecular.addAssign(e.mul(b).mul(xm({N:c,V:h,P:p,mInv:y,p0:o,p1:u,p2:l,p3:d}))),i.directDiffuse.addAssign(e.mul(zn).mul(xm({N:c,V:h,P:p,mInv:Pn(1,0,0,0,1,0,0,0,1),p0:o,p1:u,p2:l,p3:d}))),!0===this.clearcoat){const t=Ac,r=fm({N:t,V:h,roughness:jn}),s=n.sample(r),i=a.sample(r),c=Pn(Rn(s.x,0,s.y),Rn(0,1,0),Rn(s.z,0,s.w)),g=Wm.mul(i.x).add(Hm.sub(Wm).mul(i.y));this.clearcoatSpecularDirect.addAssign(e.mul(g).mul(xm({N:t,V:h,P:p,mInv:c,p0:o,p1:u,p2:l,p3:d})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:r}=e.context,s=t.mul(Hg({diffuseColor:zn})).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();s.mulAssign(t)}r.indirectDiffuse.addAssign(s)}indirectSpecular(e){const{radiance:t,iblIrradiance:r,reflectedLight:s}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(r.mul(Xn,$m({normal:Sc,viewDir:gc,roughness:Kn}))),!0===this.clearcoat){const e=Ac.dot(gc).clamp(),t=cm({dotNV:e,specularColor:Wm,specularF90:Hm,roughness:jn});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=Rn().toVar("singleScatteringDielectric"),n=Rn().toVar("multiScatteringDielectric"),a=Rn().toVar("singleScatteringMetallic"),o=Rn().toVar("multiScatteringMetallic");this.computeMultiscattering(i,n,na,sa,this.iridescenceF0Dielectric),this.computeMultiscattering(a,o,na,Gn.rgb,this.iridescenceF0Metallic);const u=gu(i,a,Hn),l=gu(n,o,Hn),d=i.add(n),c=zn.mul(d.oneMinus()),h=r.mul(1/Math.PI),p=t.mul(u).add(l.mul(h)).toVar(),g=c.mul(h).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();p.mulAssign(t),g.mulAssign(t)}s.indirectSpecular.addAssign(p),s.indirectDiffuse.addAssign(g)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:r}=e.context,s=Sc.dot(gc).clamp().add(t),i=Wn.mul(-16).oneMinus().negate().exp2(),n=t.sub(s.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(n)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=Ac.dot(gc).clamp(),r=Wg({dotVH:e,f0:Wm,f90:Hm}),s=t.mul(qn.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(qn));t.assign(s)}if(!0===this.sheen){const e=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(e)}}}const jm=yn(1),Xm=yn(-2),Km=yn(.8),Qm=yn(-1),Ym=yn(.4),Zm=yn(2),Jm=yn(.305),ef=yn(3),tf=yn(.21),rf=yn(4),sf=yn(4),nf=yn(16),af=cn(([e])=>{const t=Rn(Vo(e)).toVar(),r=yn(-1).toVar();return gn(t.x.greaterThan(t.z),()=>{gn(t.x.greaterThan(t.y),()=>{r.assign(Eu(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(Eu(e.y.greaterThan(0),1,4))})}).Else(()=>{gn(t.z.greaterThan(t.y),()=>{r.assign(Eu(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(Eu(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),of=cn(([e,t])=>{const r=_n().toVar();return gn(t.equal(0),()=>{r.assign(_n(e.z,e.y).div(Vo(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(_n(e.x.negate(),e.z.negate()).div(Vo(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(_n(e.x.negate(),e.y).div(Vo(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(_n(e.z.negate(),e.y).div(Vo(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(_n(e.x.negate(),e.z).div(Vo(e.y)))}).Else(()=>{r.assign(_n(e.x,e.y).div(Vo(e.z)))}),Da(.5,r.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),uf=cn(([e])=>{const t=yn(0).toVar();return gn(e.greaterThanEqual(Km),()=>{t.assign(jm.sub(e).mul(Qm.sub(Xm)).div(jm.sub(Km)).add(Xm))}).ElseIf(e.greaterThanEqual(Ym),()=>{t.assign(Km.sub(e).mul(Zm.sub(Qm)).div(Km.sub(Ym)).add(Qm))}).ElseIf(e.greaterThanEqual(Jm),()=>{t.assign(Ym.sub(e).mul(ef.sub(Zm)).div(Ym.sub(Jm)).add(Zm))}).ElseIf(e.greaterThanEqual(tf),()=>{t.assign(Jm.sub(e).mul(rf.sub(ef)).div(Jm.sub(tf)).add(ef))}).Else(()=>{t.assign(yn(-2).mul(To(Da(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),lf=cn(([e,t])=>{const r=e.toVar();r.assign(Da(2,r).sub(1));const s=Rn(r,1).toVar();return gn(t.equal(0),()=>{s.assign(s.zyx)}).ElseIf(t.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),df=cn(([e,t,r,s,i,n])=>{const a=yn(r),o=Rn(t),u=mu(uf(a),Xm,n),l=Ao(u),d=No(u),c=Rn(cf(e,o,d,s,i,n)).toVar();return gn(l.notEqual(0),()=>{const t=Rn(cf(e,o,d.add(1),s,i,n)).toVar();c.assign(gu(c,t,l))}),c}),cf=cn(([e,t,r,s,i,n])=>{const a=yn(r).toVar(),o=Rn(t),u=yn(af(o)).toVar(),l=yn(eu(sf.sub(a),0)).toVar();a.assign(eu(a,sf));const d=yn(bo(a)).toVar(),c=_n(of(o,u).mul(d.sub(2)).add(1)).toVar();return gn(u.greaterThan(2),()=>{c.y.addAssign(d),u.subAssign(3)}),c.x.addAssign(u.mul(d)),c.x.addAssign(l.mul(Da(3,nf))),c.y.addAssign(Da(4,bo(n).sub(d))),c.x.mulAssign(s),c.y.mulAssign(i),e.sample(c).grad(_n(),_n())}),hf=cn(({envMap:e,mipInt:t,outputDirection:r,theta:s,axis:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Co(s),l=r.mul(u).add(i.cross(r).mul(Eo(s))).add(i.mul(i.dot(r).mul(u.oneMinus())));return cf(e,l,t,n,a,o)}),pf=cn(({n:e,latitudinal:t,poleAxis:r,outputDirection:s,weights:i,samples:n,dTheta:a,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})=>{const h=Rn(Eu(t,r,au(r,s))).toVar();gn(h.equal(Rn(0)),()=>{h.assign(Rn(s.z,0,s.x.negate()))}),h.assign(Ro(h));const p=Rn().toVar();return p.addAssign(i.element(0).mul(hf({theta:0,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),Bp({start:bn(1),end:e},({i:e})=>{gn(e.greaterThanEqual(n),()=>{Fp()});const t=yn(a.mul(yn(e))).toVar();p.addAssign(i.element(e).mul(hf({theta:t.mul(-1),axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),p.addAssign(i.element(e).mul(hf({theta:t,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})))}),Cn(p,1)}),gf=cn(([e])=>{const t=xn(e).toVar();return t.assign(t.shiftLeft(xn(16)).bitOr(t.shiftRight(xn(16)))),t.assign(t.bitAnd(xn(1431655765)).shiftLeft(xn(1)).bitOr(t.bitAnd(xn(2863311530)).shiftRight(xn(1)))),t.assign(t.bitAnd(xn(858993459)).shiftLeft(xn(2)).bitOr(t.bitAnd(xn(3435973836)).shiftRight(xn(2)))),t.assign(t.bitAnd(xn(252645135)).shiftLeft(xn(4)).bitOr(t.bitAnd(xn(4042322160)).shiftRight(xn(4)))),t.assign(t.bitAnd(xn(16711935)).shiftLeft(xn(8)).bitOr(t.bitAnd(xn(4278255360)).shiftRight(xn(8)))),yn(t).mul(2.3283064365386963e-10)}),mf=cn(([e,t])=>_n(yn(e).div(yn(t)),gf(e))),ff=cn(([e,t,r])=>{const s=r.mul(r).toConst(),i=Rn(1,0,0).toConst(),n=au(t,i).toConst(),a=_o(e.x).toConst(),o=Da(2,3.14159265359).mul(e.y).toConst(),u=a.mul(Co(o)).toConst(),l=a.mul(Eo(o)).toVar(),d=Da(.5,t.z.add(1)).toConst();l.assign(d.oneMinus().mul(_o(u.mul(u).oneMinus())).add(d.mul(l)));const c=i.mul(u).add(n.mul(l)).add(t.mul(_o(eu(0,u.mul(u).add(l.mul(l)).oneMinus()))));return Ro(Rn(s.mul(c.x),s.mul(c.y),eu(0,c.z)))}),yf=cn(({roughness:e,mipInt:t,envMap:r,N_immutable:s,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Rn(s).toVar(),l=Rn(0).toVar(),d=yn(0).toVar();return gn(e.lessThan(.001),()=>{l.assign(cf(r,u,t,n,a,o))}).Else(()=>{const s=Eu(Vo(u.z).lessThan(.999),Rn(0,0,1),Rn(1,0,0)),c=Ro(au(s,u)).toVar(),h=au(u,c).toVar();Bp({start:xn(0),end:i},({i:s})=>{const p=mf(s,i),g=ff(p,Rn(0,0,1),e),m=Ro(c.mul(g.x).add(h.mul(g.y)).add(u.mul(g.z))),f=Ro(m.mul(nu(u,m).mul(2)).sub(u)),y=eu(nu(u,f),0);gn(y.greaterThan(0),()=>{const e=cf(r,f,t,n,a,o);l.addAssign(e.mul(y)),d.addAssign(y)})}),gn(d.greaterThan(0),()=>{l.assign(l.div(d))})}),Cn(l,1)}),bf=[.125,.215,.35,.446,.526,.582],xf=20,Tf=new Ne(-1,1,1,-1,0,1),_f=new Se(90,1),vf=new e;let Nf=null,Sf=0,Rf=0;const Af=new r,Ef=new WeakMap,wf=[3,1,5,0,4,2],Cf=lf(kl(),Vl("faceIndex")).normalize(),Mf=Rn(Cf.x,Cf.y,Cf.z);class Bf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,s=100,i={}){const{size:n=256,position:a=Af,renderTarget:o=null}=i;if(this._setSize(n),!1===this._hasInitialized){d('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const n=o||this._allocateTarget();return i.renderTarget=n,this.fromSceneAsync(e,t,r,s,i),n}Nf=this._renderer.getRenderTarget(),Sf=this._renderer.getActiveCubeFace(),Rf=this._renderer.getActiveMipmapLevel();const u=o||this._allocateTarget();return u.depthBuffer=!0,this._init(u),this._sceneToCubeUV(e,r,s,u,a),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}async fromSceneAsync(e,t=0,r=.1,s=100,i={}){return v('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,r,s,i)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){d('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromEquirectangularAsync(e,r),r}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return v('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){d("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromCubemapAsync(e,t),r}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return v('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Df(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===U||e.mapping===I?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=bf[a-e+4-1]:0===a&&(o=0),r.push(o);const u=1/(n-2),l=-u,d=1+u,c=[l,l,d,l,d,d,l,l,d,d,l,d],h=6,p=6,g=3,m=2,f=1,y=new Float32Array(g*p*h),b=new Float32Array(m*p*h),x=new Float32Array(f*p*h);for(let e=0;e2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0],i=wf[e];y.set(s,g*p*i),b.set(c,m*p*i);const n=[i,i,i,i,i,i];x.set(n,f*p*i)}const T=new ve;T.setAttribute("position",new we(y,g)),T.setAttribute("uv",new we(b,m)),T.setAttribute("faceIndex",new we(x,f)),s.push(new oe(T,null)),i>4&&i--}return{lodMeshes:s,sizeLods:t,sigmas:r}}(t)),this._blurMaterial=function(e,t,s){const i=td(new Array(xf).fill(0)),n=Sa(new r(0,1,0)),a=Sa(0),o=yn(xf),u=Sa(0),l=Sa(1),d=Kl(),c=Sa(0),h=yn(1/t),p=yn(1/s),g=yn(e),m={n:o,latitudinal:u,weights:i,poleAxis:n,outputDirection:Mf,dTheta:a,samples:l,envMap:d,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g},f=Lf("blur");return f.fragmentNode=pf({...m,latitudinal:u.equal(1)}),Ef.set(f,m),f}(t,e.width,e.height),this._ggxMaterial=function(e,t,r){const s=Kl(),i=Sa(0),n=Sa(0),a=yn(1/t),o=yn(1/r),u=yn(e),l={envMap:s,roughness:i,mipInt:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u},d=Lf("ggx");return d.fragmentNode=yf({...l,N_immutable:Mf,GGX_SAMPLES:xn(512)}),Ef.set(d,l),d}(t,e.width,e.height)}}async _compileMaterial(e){const t=new oe(new ve,e);await this._renderer.compile(t,Tf)}_sceneToCubeUV(e,t,r,s,i){const n=_f;n.near=t,n.far=r;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],u=this._renderer,l=u.autoClear;u.getClearColor(vf),u.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new oe(new ae,new fe({name:"PMREM.Background",side:L,depthWrite:!1,depthTest:!1})));const d=this._backgroundBox,c=d.material;let h=!1;const p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,h=!0):(c.color.copy(vf),h=!0),u.setRenderTarget(s),u.clear(),h&&u.render(d,n);for(let t=0;t<6;t++){const r=t%3;0===r?(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x+o[t],i.y,i.z)):1===r?(n.up.set(0,0,a[t]),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y+o[t],i.z)):(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y,i.z+o[t]));const l=this._cubeSize;this._setViewport(s,r*l,t>2?l:0,l,l),u.render(e,n)}u.autoClear=l,e.background=p}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===U||e.mapping===I;s?null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(e)):null===this._equirectMaterial&&(this._equirectMaterial=Df(e));const i=s?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;const n=this._lodMeshes[0];n.material=i;const a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),r.setRenderTarget(t),r.render(n,Tf)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let t=1;tc-4?r-c+4:0),g=4*(this._cubeSize-h);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=d,o.mipInt.value=c-t,this._setViewport(i,p,g,3*h,2*h),s.setRenderTarget(i),s.render(a,Tf),i.texture.frame=(i.texture.frame||0)+1,o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=c-r,this._setViewport(e,p,g,3*h,2*h),s.setRenderTarget(e),s.render(a,Tf)}_blur(e,t,r,s,i){const n=this._pingPongRenderTarget;this._halfBlur(e,n,t,r,s,"latitudinal",i),this._halfBlur(n,e,r,r,s,"longitudinal",i)}_halfBlur(e,t,r,s,i,n,a){const u=this._renderer,l=this._blurMaterial;"latitudinal"!==n&&"longitudinal"!==n&&o("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[s];c.material=l;const h=Ef.get(l),p=this._sizeLods[r]-1,g=isFinite(i)?Math.PI/(2*p):2*Math.PI/39,m=i/g,f=isFinite(i)?1+Math.floor(3*m):xf;f>xf&&d(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const y=[];let b=0;for(let e=0;ex-4?s-x+4:0),v=4*(this._cubeSize-T);this._setViewport(t,_,v,3*T,2*T),u.setRenderTarget(t),u.render(c,Tf)}_setViewport(e,t,r,s,i){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-i-r,s,i),e.scissor.set(t,e.height-i-r,s,i)):(e.viewport.set(t,r,s,i),e.scissor.set(t,r,s,i))}}function Ff(e,t){const r=new ne(e,t,{magFilter:le,minFilter:le,generateMipmaps:!1,type:Te,format:Ae,colorSpace:Re});return r.texture.mapping=Ee,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function Lf(e){const t=new vg;return t.depthTest=!1,t.depthWrite=!1,t.blending=re,t.name=`PMREM_${e}`,t}function Pf(e){const t=Lf("cubemap");return t.fragmentNode=$c(e,Mf),t}function Df(e){const t=Lf("equirect");return t.fragmentNode=Kl(e,Bg(Mf),0),t}const Uf=new WeakMap;function If(e,t,r){const s=function(e){let t=Uf.get(e);void 0===t&&(t=new WeakMap,Uf.set(e,t));return t}(t);let i=s.get(e);if((void 0!==i?i.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const r=6;for(let s=0;s0}(t))return null;i=r.fromEquirectangular(e,i)}i.pmremVersion=e.pmremVersion,s.set(e,i)}return i.texture}class Of extends gi{static get type(){return"PMREMNode"}constructor(e,t=null,r=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;const s=new N;s.isRenderTargetTexture=!0,this._texture=Kl(s),this._width=Sa(0),this._height=Sa(0),this._maxMip=Sa(0),this.updateBeforeType=ri.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const r=t?t.pmremVersion:-1,s=this._value;r!==s.pmremVersion&&(t=!0===s.isPMREMTexture?s:If(s,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new Bf(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this,e)),t=Dc.mul(Rn(t.x,t.y.negate(),t.z));let r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),df(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const Vf=an(Of).setParameterLength(1,3),kf=new WeakMap;class Gf extends Op{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:t[r.property],i=this._getPMREMNodeCache(e.renderer);let n=i.get(s);void 0===n&&(n=Vf(s),i.set(s,n)),r=n}const s=!0===t.useAnisotropy||t.anisotropy>0?_h:Sc,i=r.context(zf(Wn,s)).mul(Pc),n=r.context($f(Rc)).mul(Math.PI).mul(Pc),a=vl(i),o=vl(n);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const u=e.context.lightingModel.clearcoatRadiance;if(u){const e=r.context(zf(jn,Ac)).mul(Pc),t=vl(e);u.addAssign(t)}}_getPMREMNodeCache(e){let t=kf.get(e);return void 0===t&&(t=new WeakMap,kf.set(e,t)),t}}const zf=(e,t)=>{let r=null;return{getUV:()=>(null===r&&(r=gc.negate().reflect(t),r=du(e).mix(r,t).normalize(),r=r.transformDirection(Dd)),r),getTextureLevel:()=>e}},$f=e=>({getUV:()=>e,getTextureLevel:()=>yn(1)}),Wf=new Ce;class Hf extends vg{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Wf),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new Gf(t):null}setupLightingModel(){return new qm}setupSpecular(){const e=gu(Rn(.04),Gn.rgb,Hn);sa.assign(Rn(.04)),ia.assign(e),na.assign(1)}setupVariants(){const e=this.metalnessNode?yn(this.metalnessNode):$h;Hn.assign(e);let t=this.roughnessNode?yn(this.roughnessNode):zh;t=em({roughness:t}),Wn.assign(t),this.setupSpecular(),zn.assign(Gn.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qf=new Me;class jf extends Hf{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qf),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?yn(this.iorNode):sp;ca.assign(e),sa.assign(Jo(uu(ca.sub(1).div(ca.add(1))).mul(Vh),Rn(1)).mul(Oh)),ia.assign(gu(sa,Gn.rgb,Hn)),na.assign(gu(Oh,1,Hn))}setupLightingModel(){return new qm(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?yn(this.clearcoatNode):Hh,t=this.clearcoatRoughnessNode?yn(this.clearcoatRoughnessNode):qh;qn.assign(e),jn.assign(em({roughness:t}))}if(this.useSheen){const e=this.sheenNode?Rn(this.sheenNode):Kh,t=this.sheenRoughnessNode?yn(this.sheenRoughnessNode):Qh;Xn.assign(e),Kn.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?yn(this.iridescenceNode):Zh,t=this.iridescenceIORNode?yn(this.iridescenceIORNode):Jh,r=this.iridescenceThicknessNode?yn(this.iridescenceThicknessNode):ep;Qn.assign(e),Yn.assign(t),Zn.assign(r)}if(this.useAnisotropy){const e=(this.anisotropyNode?_n(this.anisotropyNode):Yh).toVar();ea.assign(e.length()),gn(ea.equal(0),()=>{e.assign(_n(1,0))}).Else(()=>{e.divAssign(_n(ea)),ea.assign(ea.saturate())}),Jn.assign(ea.pow2().mix(Wn.pow2(),1)),ta.assign(xh[0].mul(e.x).add(xh[1].mul(e.y))),ra.assign(xh[1].mul(e.x).sub(xh[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?yn(this.transmissionNode):tp,t=this.thicknessNode?yn(this.thicknessNode):rp,r=this.attenuationDistanceNode?yn(this.attenuationDistanceNode):ip,s=this.attenuationColorNode?Rn(this.attenuationColorNode):np;if(ha.assign(e),pa.assign(t),ga.assign(r),ma.assign(s),this.useDispersion){const e=this.dispersionNode?yn(this.dispersionNode):hp;fa.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Rn(this.clearcoatNormalNode):jh}setup(e){e.context.setupClearcoatNormal=()=>Gu(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class Xf extends qm{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1,a=!1){super(e,t,r,s,i,n),this.useSSS=a}direct({lightDirection:e,lightColor:t,reflectedLight:r},s){if(!0===this.useSSS){const i=s.material,{thicknessColorNode:n,thicknessDistortionNode:a,thicknessAmbientNode:o,thicknessAttenuationNode:u,thicknessPowerNode:l,thicknessScaleNode:d}=i,c=e.add(Sc.mul(a)).normalize(),h=yn(gc.dot(c.negate()).saturate().pow(l).mul(d)),p=Rn(h.add(o).mul(n));r.directDiffuse.addAssign(p.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:r},s)}}class Kf extends jf{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=yn(.1),this.thicknessAmbientNode=yn(0),this.thicknessAttenuationNode=yn(.1),this.thicknessPowerNode=yn(2),this.thicknessScaleNode=yn(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new Xf(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const Qf=cn(({normal:e,lightDirection:t,builder:r})=>{const s=e.dot(t),i=_n(s.mul(.5).add(.5),0);if(r.material.gradientMap){const e=Kc("gradientMap","texture").context({getUV:()=>i});return Rn(e.r)}{const e=i.fwidth().mul(.5);return gu(Rn(.7),Rn(1),bu(yn(.7).sub(e.x),yn(.7).add(e.x),i.x))}});class Yf extends kg{direct({lightDirection:e,lightColor:t,reflectedLight:r},s){const i=Qf({normal:xc,lightDirection:e,builder:s}).mul(t);r.directDiffuse.addAssign(i.mul(Hg({diffuseColor:Gn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Zf=new Be;class Jf extends vg{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Zf),this.setValues(e)}setupLightingModel(){return new Yf}}const ey=cn(()=>{const e=Rn(gc.z,0,gc.x.negate()).normalize(),t=gc.cross(e);return _n(e.dot(Sc),t.dot(Sc)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),ty=new Fe;class ry extends vg{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(ty),this.setValues(e)}setupVariants(e){const t=ey;let r;r=e.material.matcap?Kc("matcap","texture").context({getUV:()=>t}):Rn(gu(.2,.8,t.y)),Gn.rgb.mulAssign(r.rgb)}}class sy extends gi{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:r}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),s=t.sin();return Ln(e,s,s.negate(),e).mul(r)}{const e=t,s=Dn(Cn(1,0,0,0),Cn(0,Co(e.x),Eo(e.x).negate(),0),Cn(0,Eo(e.x),Co(e.x),0),Cn(0,0,0,1)),i=Dn(Cn(Co(e.y),0,Eo(e.y),0),Cn(0,1,0,0),Cn(Eo(e.y).negate(),0,Co(e.y),0),Cn(0,0,0,1)),n=Dn(Cn(Co(e.z),Eo(e.z).negate(),0,0),Cn(Eo(e.z),Co(e.z),0,0),Cn(0,0,1,0),Cn(0,0,0,1));return s.mul(i).mul(n).mul(Cn(r,1)).xyz}}}const iy=an(sy).setParameterLength(2),ny=new Le;class ay extends vg{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(ny),this.setValues(e)}setupPositionView(e){const{object:t,camera:r}=e,{positionNode:s,rotationNode:i,scaleNode:n,sizeAttenuation:a}=this,o=sc.mul(Rn(s||0));let u=_n(Qd[0].xyz.length(),Qd[1].xyz.length());null!==n&&(u=u.mul(_n(n))),r.isPerspectiveCamera&&!1===a&&(u=u.mul(o.z.negate()));let l=uc.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,r)=>new Zu(e,t,r))("center","vec2",t);l=l.sub(e.sub(.5))}l=l.mul(u);const d=yn(i||Xh),c=iy(l,d);return Cn(o.xy.add(c),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const oy=new Pe,uy=new t;class ly extends ay{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(oy),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return sc.mul(Rn(e||lc)).xyz}setupVertexSprite(e){const{material:t,camera:r}=e,{rotationNode:s,scaleNode:i,sizeNode:n,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let u=null!==n?_n(n):cp;u=u.mul(od),r.isPerspectiveCamera&&!0===a&&(u=u.mul(dy.div(pc.z.negate()))),i&&i.isNode&&(u=u.mul(_n(i)));let l=uc.xy;if(s&&s.isNode){const e=yn(s);l=iy(l,e)}return l=l.mul(u),l=l.div(hd.div(2)),l=l.mul(o.w),o=o.add(Cn(l,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const dy=Sa(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(uy);this.value=.5*t.y});class cy extends kg{constructor(){super(),this.shadowNode=yn(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Gn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Gn.rgb)}}const hy=new De;class py extends vg{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(hy),this.setValues(e)}setupLightingModel(){return new cy}}const gy=Vn("vec3"),my=Vn("vec3"),fy=Vn("vec3");class yy extends kg{constructor(){super()}start(e){const{material:t}=e,r=Vn("vec3"),s=Vn("vec3");gn(Od.sub(cc).length().greaterThan(ec.mul(2)),()=>{r.assign(Od),s.assign(cc)}).Else(()=>{r.assign(cc),s.assign(Od)});const i=s.sub(r),n=Sa("int").onRenderUpdate(({material:e})=>e.steps),a=i.length().div(n).toVar(),o=i.normalize().toVar(),u=yn(0).toVar(),l=Rn(1).toVar();t.offsetNode&&u.addAssign(t.offsetNode.mul(a)),Bp(n,()=>{const s=r.add(o.mul(u)),i=Dd.mul(Cn(s,1)).xyz;let n;null!==t.depthNode&&(my.assign(og(tg(i.z,Bd,Fd))),e.context.sceneDepthNode=og(t.depthNode).toVar()),e.context.positionWorld=s,e.context.shadowPositionWorld=s,e.context.positionView=i,gy.assign(0),t.scatteringNode&&(n=t.scatteringNode({positionRay:s})),super.start(e),n&&gy.mulAssign(n);const d=gy.mul(.01).negate().mul(a).exp();l.mulAssign(d),u.addAssign(a)}),fy.addAssign(l.saturate().oneMinus())}scatteringLight(e,t){const r=t.context.sceneDepthNode;r?gn(r.greaterThanEqual(my),()=>{gy.addAssign(e)}):gy.addAssign(e)}direct({lightNode:e,lightColor:t},r){if(void 0===e.light.distance)return;const s=t.xyz.toVar();s.mulAssign(e.shadowNode),this.scatteringLight(s,r)}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s},i){const n=t.add(r).sub(s),a=t.sub(r).sub(s),o=t.sub(r).add(s),u=t.add(r).add(s),l=i.context.positionView,d=e.xyz.mul(Tm({P:l,p0:n,p1:a,p2:o,p3:u})).pow(1.5);this.scatteringLight(d,i)}finish(e){e.context.outgoingLight.assign(fy)}}class by extends vg{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=L,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new yy}}class xy{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){null!==this._context&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Ty{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let r=this.weakMaps[t];return void 0===r&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],s=new Set,i={};for(const n of e){let e;if(n.node&&n.node.attribute?e=n.node.attribute:(e=t.getAttribute(n.name),i[n.name]=e.id),void 0===e)continue;r.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;s.add(a)}return this.attributes=r,this.attributesId=i,this.vertexBuffers=Array.from(s.values()),r}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:r,group:s,drawRange:i}=this,n=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let u=1;if(!0===r.isInstancedBufferGeometry?u=r.instanceCount:void 0!==e.count&&(u=Math.max(0,e.count)),0===u)return null;if(n.instanceCount=u,!0===e.isBatchedMesh)return n;let l=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(l=2);let d=i.start*l,c=(i.start+i.count)*l;null!==s&&(d=Math.max(d,s.start*l),c=Math.min(c,(s.start+s.count)*l));const h=r.attributes.position;let p=1/0;o?p=a.count:null!=h&&(p=h.count),d=Math.max(d,0),c=Math.min(c,p);const g=c-d;return g<0||g===1/0?null:(n.vertexCount=g,n.firstVertex=d,n)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const r of Object.keys(e.attributes).sort()){const s=e.attributes[r];t+=r+",",s.data&&(t+=s.data.stride+","),s.offset&&(t+=s.offset+","),s.itemSize&&(t+=s.itemSize+","),s.normalized&&(t+="n,")}for(const r of Object.keys(e.morphAttributes).sort()){const s=e.morphAttributes[r];t+="morph-"+r+",";for(let e=0,r=s.length;e1||Array.isArray(e.morphTargetInfluences))&&(s+=e.uuid+","),s+=this.context.id+",",s+=e.receiveShadow+",",Vs(s)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const r=this.geometry.getAttribute(t);if(void 0===r||e[t]!==r.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Gs(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Gs(e,1)),e=Gs(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const Ny=[];class Sy{constructor(e,t,r,s,i,n){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=s,this.bindings=i,this.info=n,this.chainMaps={}}get(e,t,r,s,i,n,a,o){const u=this.getChainMap(o);Ny[0]=e,Ny[1]=t,Ny[2]=n,Ny[3]=i;let l=u.get(Ny);return void 0===l?(l=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,s,i,n,a,o),u.set(Ny,l)):(l.camera=s,l.updateClipping(a),l.needsGeometryUpdate&&l.setGeometry(e.geometry),(l.version!==t.version||l.needsUpdate)&&(l.initialCacheKey!==l.getCacheKey()?(l.dispose(),l=this.get(e,t,r,s,i,n,a,o)):l.version=t.version)),Ny[0]=null,Ny[1]=null,Ny[2]=null,Ny[3]=null,l}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ty)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,s,i,n,a,o,u,l,d){const c=this.getChainMap(d),h=new vy(e,t,r,s,i,n,a,o,u,l);return h.onDispose=()=>{this.pipelines.delete(h),this.bindings.deleteForRender(h),this.nodes.delete(h),c.delete(h.getChainArray())},h}}class Ry{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const Ay=1,Ey=2,wy=3,Cy=4,My=16;class By extends Ry{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){const t=super.delete(e);return null!==t&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){const r=this.get(e);if(void 0===r.version)t===Ay?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Ey?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===wy?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Cy&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),r.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(r.version=65535?Ue:Ie)(t,1);return i.version=Fy(e),i.__id=Ly(e),i}class Dy extends Ry{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;const r=()=>{this.info.memory.geometries--;const s=t.index,i=e.getAttributes();null!==s&&this.attributes.delete(s);for(const e of i)this.attributes.delete(e);const n=this.wireframes.get(t);void 0!==n&&this.attributes.delete(n),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){const t=e.getAttributes();for(const e of t)e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute?this.updateAttribute(e,wy):this.updateAttribute(e,Ay);const r=this.getIndex(e);null!==r&&this.updateAttribute(r,Ey);const s=e.geometry.indirect;null!==s&&this.updateAttribute(s,Cy)}updateAttribute(e,t){const r=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:r}=e;let s=t.index;if(!0===r.wireframe){const e=this.wireframes;let r=e.get(t);void 0===r?(r=Py(t),e.set(t,r)):r.version===Fy(t)&&r.__id===Ly(t)||(this.attributes.delete(r),r=Py(t),e.set(t,r)),s=r}return s}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class Uy{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0,attributes:0,indexAttributes:0,storageAttributes:0,indirectStorageAttributes:0,readbackBuffers:0,programs:0,renderTargets:0,total:0,texturesSize:0,attributesSize:0,indexAttributesSize:0,storageAttributesSize:0,indirectStorageAttributesSize:0,readbackBuffersSize:0,programsSize:0},this.memoryMap=new Map}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=r*(t/3):e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=r*(t/2):e.isLine?this.render.lines+=r*(t-1):o("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(const e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){const t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){const r=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:r,type:t}),this.memory[t]++,this.memory.total+=r,this.memory[t+"Size"]+=r}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){const t=this._getAttributeMemorySize(e.attribute);this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){this.destroyAttribute(e)}createProgram(e){const t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oe||e.type===Ve?t=1:e.type===ke||e.type===Ge||e.type===Te?t=2:e.type!==R&&e.type!==S&&e.type!==K||(t=4);let r=4;e.format===ze||e.format===$e||e.format===We||e.format===He||e.format===qe?r=1:e.format===$||e.format===je?r=2:e.format!==Xe&&e.format!==Ke||(r=3);let s=t*r;e.type===Qe||e.type===Ye?s=2:e.type!==Ze&&e.type!==Je&&e.type!==et||(s=4);const i=e.width||1,n=e.height||1,a=e.isCubeTexture?6:e.depth||1;let o=i*n*a*s;const u=e.mipmaps;if(u&&u.length>0){let e=0;for(let t=0;t>t))*(r.height||Math.max(1,n>>t))*a*s}}o+=e}else e.generateMipmaps&&(o*=1.333);return Math.round(o)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}}class Iy{constructor(e){this.cacheKey=e,this.usedTimes=0}}class Oy extends Iy{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}}class Vy extends Iy{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let ky=0;class Gy{constructor(e,t,r,s=null,i=null){this.id=ky++,this.code=e,this.stage=t,this.name=r,this.transforms=s,this.attributes=i,this.usedTimes=0}}class zy extends Ry{constructor(e,t,r){super(),this.backend=e,this.nodes=t,this.info=r,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:r}=this,s=this.get(e);if(this._needsComputeUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.computeProgram.usedTimes--);const n=this.nodes.getForCompute(e);let a=this.programs.compute.get(n.computeShader);void 0===a&&(i&&0===i.computeProgram.usedTimes&&this._releaseProgram(i.computeProgram),a=new Gy(n.computeShader,"compute",e.name,n.transforms,n.nodeAttributes),this.programs.compute.set(n.computeShader,a),r.createProgram(a),this.info.createProgram(a));const o=this._getComputeCacheKey(e,a);let u=this.caches.get(o);void 0===u&&(i&&0===i.usedTimes&&this._releasePipeline(i),u=this._getComputePipeline(e,a,o,t)),u.usedTimes++,a.usedTimes++,s.version=e.version,s.pipeline=u}return s.pipeline}getForRender(e,t=null){const{backend:r}=this,s=this.get(e);if(this._needsRenderUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.vertexProgram.usedTimes--,i.fragmentProgram.usedTimes--);const n=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(n.vertexShader);void 0===o&&(i&&0===i.vertexProgram.usedTimes&&this._releaseProgram(i.vertexProgram),o=new Gy(n.vertexShader,"vertex",a),this.programs.vertex.set(n.vertexShader,o),r.createProgram(o),this.info.createProgram(o));let u=this.programs.fragment.get(n.fragmentShader);void 0===u&&(i&&0===i.fragmentProgram.usedTimes&&this._releaseProgram(i.fragmentProgram),u=new Gy(n.fragmentShader,"fragment",a),this.programs.fragment.set(n.fragmentShader,u),r.createProgram(u),this.info.createProgram(u));const l=this._getRenderCacheKey(e,o,u);let d=this.caches.get(l);void 0===d?(i&&0===i.usedTimes&&this._releasePipeline(i),d=this._getRenderPipeline(e,o,u,l,t)):e.pipeline=d,d.usedTimes++,o.usedTimes++,u.usedTimes++,s.pipeline=d}return s.pipeline}isReady(e){const t=this.get(e).pipeline;if(void 0===t)return!1;const r=this.backend.get(t);return void 0!==r.pipeline&&null!==r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,s){r=r||this._getComputeCacheKey(e,t);let i=this.caches.get(r);return void 0===i&&(i=new Vy(r,t),this.caches.set(r,i),this.backend.createComputePipeline(i,s)),i}_getRenderPipeline(e,t,r,s,i){s=s||this._getRenderCacheKey(e,t,r);let n=this.caches.get(s);return void 0===n&&(n=new Oy(s,t,r),this.caches.set(s,n),e.pipeline=n,this.backend.createRenderPipeline(e,i)),n}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,r){return t.id+","+r.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,r=e.stage;this.programs[r].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){const t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class $y extends Ry{constructor(e,t,r,s,i,n){super(),this.backend=e,this.textures=r,this.pipelines=i,this.attributes=s,this.nodes=t,this.info=n,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}deleteForRender(e){const t=e.getBindings();for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const e=t.attribute,r=e.isIndirectStorageBufferAttribute?Cy:wy;this.attributes.update(e,r)}}_update(e,t){const{backend:r}=this;let s=!1,i=!0,n=0,a=0;for(const t of e.bindings){if(!1!==this.nodes.updateGroup(t)){if(t.isStorageBuffer){const e=t.attribute,i=e.isIndirectStorageBufferAttribute?Cy:wy,n=r.get(t);this.attributes.update(e,i),n.attribute!==e&&(n.attribute=e,s=!0)}if(t.isUniformBuffer){t.update()&&r.updateBinding(t)}else if(t.isSampledTexture){const o=t.update(),u=t.texture,l=this.textures.get(u);o&&(this.textures.updateTexture(u),t.generation!==l.generation&&(t.generation=l.generation,s=!0),l.bindGroups.add(e));if(void 0!==r.get(u).externalTexture||l.isDefaultTexture?i=!1:(n=10*n+u.id,a+=u.version),!0===u.isStorageTexture&&!0===u.mipmapsAutoUpdate){const e=this.get(u);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(u)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(u),e.needsMipmap=!1)}}else if(t.isSampler){if(t.update()){const e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,s=!0)}}t.isBuffer&&t.updateRanges.length>0&&t.clearUpdateRanges()}}!0===s&&this.backend.updateBindings(e,t,i?n:0,a)}}function Wy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function Hy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function qy(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&e.side===P&&!1===e.forceSinglePass}class jy{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,r),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,s,i,n,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:s,renderOrder:e.renderOrder,z:i,group:n,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=s,o.renderOrder=e.renderOrder,o.z=i,o.group=n,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Wy),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Hy),this.transparent.length>1&&this.transparent.sort(t||Hy)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,u=a.height>>t;let l=e.depthTexture||i[t];const d=!0===e.depthBuffer||!0===e.stencilBuffer;let c=!1;void 0===l&&d&&(l=new Z,l.format=e.stencilBuffer?qe:He,l.type=e.stencilBuffer?Ze:S,l.image.width=o,l.image.height=u,l.image.depth=a.depth,l.renderTarget=e,l.isArrayTexture=!0===e.multiview&&a.depth>1,i[t]=l),r.width===a.width&&a.height===r.height||(c=!0,l&&(l.needsUpdate=!0,l.image.width=o,l.image.height=u,l.image.depth=l.isArrayTexture?l.image.depth:1)),r.width=a.width,r.height=a.height,r.textures=n,r.depthTexture=l||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==s&&(c=!0,l&&(l.needsUpdate=!0),r.sampleCount=s);const h={sampleCount:s};if(!0!==e.isXRRenderTarget){for(let e=0;e{this._destroyRenderTarget(e)},e.addEventListener("dispose",r.onDispose))}updateTexture(e,t={}){const r=this.get(e);if(!0===r.initialized&&r.version===e.version)return;const s=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,i=this.backend;if(s&&!0===r.initialized&&i.destroyTexture(e),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:Ve}const{width:n,height:a,depth:o}=this.getSize(e);if(t.width=n,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,n,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,s||!0===e.isStorageTexture||!0===e.isExternalTexture)i.createTexture(e,t),r.generation=e.version;else if(e.version>0){const s=e.image;if(void 0===s)d("Renderer: Texture marked for update but image is undefined.");else if(!1===s.complete)d("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const r=[];for(const t of e.images)r.push(t);t.images=r}else t.image=s;void 0!==r.isDefaultTexture&&!0!==r.isDefaultTexture||(i.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),!0===e.source.dataReady&&i.updateTexture(e,t);const n=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!n&&i.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else i.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;!0!==r.initialized&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&!0===p.enabled&&p.getTransfer(e.colorSpace)!==g&&d("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=eb){let r=e.images?e.images[0]:e.image;return r?(void 0!==r.image&&(r=r.image),"undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):"undefined"!=typeof VideoFrame&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){let s;return s=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,r)))+1,s}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){const t=this.get(e),r=t.textures,s=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e=2)for(let r=0;r{if(this._currentNode=t,!t.isVarNode||!t.isIntent(e)||!0===t.isAssign(e))if("setup"===s)t.build(e);else if("analyze"===s)t.build(e,this);else if("generate"===s){const r=e.getDataFromNode(t,"any").stages,s=r&&r[e.shaderStage];if(t.isVarNode&&s&&1===s.length&&s[0]&&s[0].isStackNode)return;t.build(e,"void")}},n=[...this.nodes];for(const e of n)i(e);this._currentNode=null;const a=this.nodes.filter(e=>-1===n.indexOf(e));for(const e of a)i(e);let o;return o=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),hn(r),e.removeActiveStack(this),o}}const nb=an(ib).setParameterLength(0,1);class ab extends ci{static get type(){return"StructTypeNode"}constructor(e,t=null){var r;super("struct"),this.membersLayout=(r=e,Object.entries(r).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,r=0;for(const s of this.membersLayout){const i=s.type,n=js(i),a=Xs(i)/e;t=Math.max(t,a);const o=r%t%a;0!==o&&(r+=a-o),r+=n}return Math.ceil(r/t)*t}getMemberType(e,t){const r=this.membersLayout.find(e=>e.name===t);return r?r.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class ob extends ci{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),r=t.type,s=e.getPropertyName(t);return e.addLineFlowCode(`${s} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class ub extends ci{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(void 0===t.membersLayout){const r=this.members,s=[];for(let t=0;tnew fb(e,"uint","float"),xb={};class Tb extends no{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,r){"int"===r?t.assign(yb(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return xn;case"int":return bn;case"uvec2":return Nn;case"uvec3":return En;case"uvec4":return Bn;case"ivec2":return vn;case"ivec3":return An;case"ivec4":return Mn}}_createTrailingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t);const i=yn(s.bitAnd(zo(s))),n=bb(i).shiftRight(23).sub(127);return r(n)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{gn(e.equal(xn(0)),()=>xn(32));const s=xn(0),i=xn(0);return this._resolveElementType(e,s,t),gn(s.shiftRight(16).equal(0),()=>{i.addAssign(16),s.shiftLeftAssign(16)}),gn(s.shiftRight(24).equal(0),()=>{i.addAssign(8),s.shiftLeftAssign(8)}),gn(s.shiftRight(28).equal(0),()=>{i.addAssign(4),s.shiftLeftAssign(4)}),gn(s.shiftRight(30).equal(0),()=>{i.addAssign(2),s.shiftLeftAssign(2)}),gn(s.shiftRight(31).equal(0),()=>{i.addAssign(1)}),r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t),s.assign(s.sub(s.shiftRight(xn(1)).bitAnd(xn(1431655765)))),s.assign(s.bitAnd(xn(858993459)).add(s.shiftRight(xn(2)).bitAnd(xn(858993459))));const i=s.add(s.shiftRight(xn(4))).bitAnd(xn(252645135)).mul(xn(16843009)).shiftRight(xn(24));return r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,r,s){const i=this._returnDataNode(t);return cn(([e])=>{if(1===r)return i(s(e));{const t=i(0),n=["x","y","z","w"];for(let i=0;id(r))()}}Tb.COUNT_TRAILING_ZEROS="countTrailingZeros",Tb.COUNT_LEADING_ZEROS="countLeadingZeros",Tb.COUNT_ONE_BITS="countOneBits";const _b=un(Tb,Tb.COUNT_TRAILING_ZEROS).setParameterLength(1),vb=un(Tb,Tb.COUNT_LEADING_ZEROS).setParameterLength(1),Nb=un(Tb,Tb.COUNT_ONE_BITS).setParameterLength(1),Sb=cn(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return r.shiftRight(22).bitXor(r).toFloat().mul(1/2**32)}),Rb=(e,t)=>ou(Da(4,e.mul(Pa(1,e))),t);class Ab extends gi{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const Eb=un(Ab,"snorm").setParameterLength(1),wb=un(Ab,"unorm").setParameterLength(1),Cb=un(Ab,"float16").setParameterLength(1);class Mb extends gi{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const Bb=un(Mb,"snorm").setParameterLength(1),Fb=un(Mb,"unorm").setParameterLength(1),Lb=un(Mb,"float16").setParameterLength(1),Pb=cn(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Db=cn(([e])=>Rn(Pb(e.z.add(Pb(e.y.mul(1)))),Pb(e.z.add(Pb(e.x.mul(1)))),Pb(e.y.add(Pb(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ub=cn(([e,t,r])=>{const s=Rn(e).toVar(),i=yn(1.4).toVar(),n=yn(0).toVar(),a=Rn(s).toVar();return Bp({start:yn(0),end:yn(3),type:"float",condition:"<="},()=>{const e=Rn(Db(a.mul(2))).toVar();s.addAssign(e.add(r.mul(yn(.1).mul(t)))),a.mulAssign(1.8),i.mulAssign(1.5),s.mulAssign(1.2);const o=yn(Pb(s.z.add(Pb(s.x.add(Pb(s.y)))))).toVar();n.addAssign(o.div(i)),a.addAssign(.14)}),n}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Ib extends ci{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let r=this._candidateFn;if(null===r){let s=null,i=-1;for(const r of this.functionNodes){const n=r.shaderNode.layout;if(null===n)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=n.inputs;if(t.length===a.length){let n=0;for(let r=0;ri&&(s=r,i=n)}}this._candidateFn=r=s}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const Ob=an(Ib),Vb=e=>(...t)=>Ob(e,...t),kb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.time),Gb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.deltaTime),zb=Sa(0,"uint").setGroup(_a).onRenderUpdate(e=>e.frameId);const $b=cn(([e,t,r=_n(.5)])=>iy(e.sub(r),t).add(r)),Wb=cn(([e,t,r=_n(.5)])=>{const s=e.sub(r),i=s.dot(s),n=i.mul(i).mul(t);return e.add(s.mul(n))}),Hb=cn(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let s;null!==e?(s=Qd.toVar(),s[3][0]=e.x,s[3][1]=e.y,s[3][2]=e.z):s=Qd;const i=Dd.mul(s);return Zi(t)&&(i[0][0]=Qd[0].length(),i[0][1]=0,i[0][2]=0),Zi(r)&&(i[1][0]=0,i[1][1]=Qd[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,Ld.mul(i).mul(lc)}),qb=cn(([e=null])=>{const t=og();return og(Yp(e)).sub(t).lessThan(0).select(ud,e)}),jb=cn(([e,t=kl(),r=yn(0)])=>{const s=e.x,i=e.y,n=r.mod(s.mul(i)).floor(),a=n.mod(s),o=i.sub(n.add(1).div(s).ceil()),u=e.reciprocal(),l=_n(a,o);return t.add(l).mul(u)}),Xb=cn(([e,t=null,r=null,s=yn(1),i=lc,n=Tc])=>{let a=n.abs().normalize();a=a.div(a.dot(Rn(1)));const o=i.yz.mul(s),u=i.zx.mul(s),l=i.xy.mul(s),d=e.value,c=null!==t?t.value:d,h=null!==r?r.value:d,p=Kl(d,o).mul(a.x),g=Kl(c,u).mul(a.y),m=Kl(h,l).mul(a.z);return La(p,g,m)}),Kb=new ut,Qb=new r,Yb=new r,Zb=new r,Jb=new a,ex=new r(0,0,-1),tx=new s,rx=new r,sx=new r,ix=new s,nx=new t,ax=new ne,ox=ud.flipX();ax.depthTexture=new Z(1,1);let ux=!1;class lx extends jl{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||ax.texture,ox),this._reflectorBaseNode=e.reflector||new dx(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new lx({defaultTexture:ax.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class dx extends ci{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:r=new at,resolutionScale:s=1,generateMipmaps:i=!1,bounces:n=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=s,void 0!==t.resolution&&(v('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=n,this.depth=a,this.samples=o,this.updateBeforeType=n?ri.RENDER:ri.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const r=this.resolutionScale;t.getDrawingBufferSize(nx),e.setSize(Math.round(nx.width*r),Math.round(nx.height*r))}setup(e){return this._updateResolution(ax,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new ne(0,0,{type:Te,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=ot,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new Z),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&ux)return!1;ux=!0;const{scene:t,camera:r,renderer:s,material:i}=e,{target:n}=this,a=this.getVirtualCamera(r),o=this.getRenderTarget(a);s.getDrawingBufferSize(nx),this._updateResolution(o,s),Yb.setFromMatrixPosition(n.matrixWorld),Zb.setFromMatrixPosition(r.matrixWorld),Jb.extractRotation(n.matrixWorld),Qb.set(0,0,1),Qb.applyMatrix4(Jb),rx.subVectors(Yb,Zb);let u=!1;if(!0===rx.dot(Qb)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(ux=!1);u=!0}rx.reflect(Qb).negate(),rx.add(Yb),Jb.extractRotation(r.matrixWorld),ex.set(0,0,-1),ex.applyMatrix4(Jb),ex.add(Zb),sx.subVectors(Yb,ex),sx.reflect(Qb).negate(),sx.add(Yb),a.coordinateSystem=r.coordinateSystem,a.position.copy(rx),a.up.set(0,1,0),a.up.applyMatrix4(Jb),a.up.reflect(Qb),a.lookAt(sx),a.near=r.near,a.far=r.far,a.updateMatrixWorld(),a.projectionMatrix.copy(r.projectionMatrix),Kb.setFromNormalAndCoplanarPoint(Qb,Yb),Kb.applyMatrix4(a.matrixWorldInverse),tx.set(Kb.normal.x,Kb.normal.y,Kb.normal.z,Kb.constant);const l=a.projectionMatrix;ix.x=(Math.sign(tx.x)+l.elements[8])/l.elements[0],ix.y=(Math.sign(tx.y)+l.elements[9])/l.elements[5],ix.z=-1,ix.w=(1+l.elements[10])/l.elements[14],tx.multiplyScalar(1/tx.dot(ix));l.elements[2]=tx.x,l.elements[6]=tx.y,l.elements[10]=s.coordinateSystem===h?tx.z-0:tx.z+1-0,l.elements[14]=tx.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),i.visible=!1;const d=s.getRenderTarget(),c=s.getMRT(),p=s.autoClear;s.setMRT(null),s.setRenderTarget(o),s.autoClear=!0;const g=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(s.clear(),this.hasOutput=!1):(s.render(t,a),this.hasOutput=!0),t.name=g,s.setMRT(c),s.setRenderTarget(d),s.autoClear=p,i.visible=!0,ux=!1,this.forceUpdate=!1}get resolution(){return v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const cx=new Ne(-1,1,1,-1,0,1);class hx extends ve{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new lt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lt(t,2))}}const px=new hx;class gx extends oe{constructor(e=null){super(px,e),this.camera=cx,this.isQuadMesh=!0}async renderAsync(e){v('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,cx)}render(e){e.render(this,cx)}}const mx=new t;class fx extends jl{static get type(){return"RTTNode"}constructor(e,t=null,r=null,s={type:Te}){const i=new ne(t,r,s);super(i.texture,kl()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new gx(new vg),this.updateBeforeType=ri.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const r=e*this.pixelRatio,s=t*this.pixelRatio;this.renderTarget.setSize(r,s),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),r=e.getSize(mx),s=Math.floor(r.width*t),i=Math.floor(r.height*t);s===this.renderTarget.width&&i===this.renderTarget.height||(this.renderTarget.setSize(s,i),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(r)}clone(){const e=new jl(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yx=(e,...t)=>new fx(tn(e),...t),bx=cn(([e,t,r],s)=>{let i;s.renderer.coordinateSystem===h?(e=_n(e.x,e.y.oneMinus()).mul(2).sub(1),i=Cn(Rn(e,t),1)):i=Cn(Rn(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const n=Cn(r.mul(i));return n.xyz.div(n.w)}),xx=cn(([e,t])=>{const r=t.mul(Cn(e,1)),s=r.xy.div(r.w).mul(.5).add(.5).toVar();return _n(s.x,s.y.oneMinus())}),Tx=cn(([e,t,r])=>{const s=zl(Ql(t)),i=vn(e.mul(s)).toVar(),n=Ql(t,i).toVar(),a=Ql(t,i.sub(vn(2,0))).toVar(),o=Ql(t,i.sub(vn(1,0))).toVar(),u=Ql(t,i.add(vn(1,0))).toVar(),l=Ql(t,i.add(vn(2,0))).toVar(),d=Ql(t,i.add(vn(0,2))).toVar(),c=Ql(t,i.add(vn(0,1))).toVar(),h=Ql(t,i.sub(vn(0,1))).toVar(),p=Ql(t,i.sub(vn(0,2))).toVar(),g=Vo(Pa(yn(2).mul(o).sub(a),n)).toVar(),m=Vo(Pa(yn(2).mul(u).sub(l),n)).toVar(),f=Vo(Pa(yn(2).mul(c).sub(d),n)).toVar(),y=Vo(Pa(yn(2).mul(h).sub(p),n)).toVar(),b=bx(e,n,r).toVar(),x=g.lessThan(m).select(b.sub(bx(e.sub(_n(yn(1).div(s.x),0)),o,r)),b.negate().add(bx(e.add(_n(yn(1).div(s.x),0)),u,r))),T=f.lessThan(y).select(b.sub(bx(e.add(_n(0,yn(1).div(s.y))),c,r)),b.negate().add(bx(e.sub(_n(0,yn(1).div(s.y))),h,r)));return Ro(au(x,T))}),_x=cn(([e])=>Ao(yn(52.9829189).mul(Ao(nu(e,_n(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),vx=cn(([e,t,r])=>{const s=yn(2.399963229728653),i=_o(yn(e).add(.5).div(yn(t))),n=yn(e).mul(s).add(r);return _n(Co(n),Eo(n)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class Nx extends ci{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(kl())}sample(e){return this.callback(e)}}class Sx extends ci{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Sx.OBJECT?this.updateType=ri.OBJECT:e===Sx.MATERIAL?this.updateType=ri.RENDER:e===Sx.BEFORE_OBJECT?this.updateBeforeType=ri.OBJECT:e===Sx.BEFORE_MATERIAL&&(this.updateBeforeType=ri.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Sx.OBJECT="object",Sx.MATERIAL="material",Sx.BEFORE_OBJECT="beforeObject",Sx.BEFORE_MATERIAL="beforeMaterial";const Rx=(e,t)=>new Sx(e,t).toStack();class Ax extends q{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class Ex extends we{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageBufferAttribute=!0}}class wx extends ci{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Cx=on(wx),Mx=new a,Bx=Sa(0).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Fx=Sa(1).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Lx=Sa(new a).setGroup(_a).onRenderUpdate(({scene:e})=>{const t=e.background;return null!==t&&t.isTexture&&t.mapping!==dt?Mx.makeRotationFromEuler(e.backgroundRotation).transpose():Mx.identity(),Mx});class Px extends jl{static get type(){return"StorageTextureNode"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=ii.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return null!==this.storeNode?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;return e.generateStorageTextureLoad(l,t,r,s,n,u)}toReadWrite(){return this.setAccess(ii.READ_WRITE)}toReadOnly(){return this.setAccess(ii.READ_ONLY)}toWriteOnly(){return this.setAccess(ii.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:r,storeNode:s,depthNode:i}=t,n=super.generate(e,"property"),a=r.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=s.build(e,"vec4"),u=i?i.build(e,"int"):null,l=e.generateTextureStore(this.value,n,a,u,o);e.addLineFlowCode(l,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const Dx=an(Px).setParameterLength(1,3),Ux=cn(({texture:e,uv:t})=>{const r=1e-4,s=Rn().toVar();return gn(t.x.lessThan(r),()=>{s.assign(Rn(1,0,0))}).ElseIf(t.y.lessThan(r),()=>{s.assign(Rn(0,1,0))}).ElseIf(t.z.lessThan(r),()=>{s.assign(Rn(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{s.assign(Rn(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{s.assign(Rn(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{s.assign(Rn(0,0,-1))}).Else(()=>{const r=.01,i=e.sample(t.add(Rn(-.01,0,0))).r.sub(e.sample(t.add(Rn(r,0,0))).r),n=e.sample(t.add(Rn(0,-.01,0))).r.sub(e.sample(t.add(Rn(0,r,0))).r),a=e.sample(t.add(Rn(0,0,-.01))).r.sub(e.sample(t.add(Rn(0,0,r))).r);s.assign(Rn(i,n,a))}),s.normalize()});class Ix extends jl{static get type(){return"Texture3DNode"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Rn(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Ux({texture:this,uv:e})}}const Ox=an(Ix).setParameterLength(1,3);class Vx extends Hc{static get type(){return"UserDataNode"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const kx=new WeakMap;class Gx extends gi{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=ri.OBJECT,this.updateAfterType=ri.OBJECT,this.previousModelWorldMatrix=Sa(new a),this.previousProjectionMatrix=Sa(new a).setGroup(_a),this.previousCameraViewMatrix=Sa(new a)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){const s=$x(r);this.previousModelWorldMatrix.value.copy(s);const i=zx(t);i.frameId!==e&&(i.frameId=e,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new a,i.previousCameraViewMatrix=new a,i.currentProjectionMatrix=new a,i.currentCameraViewMatrix=new a,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){$x(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?Ld:Sa(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(sc).mul(lc),s=this.previousProjectionMatrix.mul(t).mul(dc),i=r.xy.div(r.w),n=s.xy.div(s.w);return Pa(i,n)}}function zx(e){let t=kx.get(e);return void 0===t&&(t={},kx.set(e,t)),t}function $x(e,t=0){const r=zx(e);let s=r[t];return void 0===s&&(r[t]=s=new a,r[t].copy(e.matrixWorld)),s}const Wx=on(Gx),Hx=cn(([e])=>Kx(e.rgb)),qx=cn(([e,t=yn(1)])=>t.mix(Kx(e.rgb),e.rgb)),jx=cn(([e,t=yn(1)])=>{const r=La(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return gu(e.rgb,s,i)}),Xx=cn(([e,t=yn(1)])=>{const r=Rn(.57735,.57735,.57735),s=t.cos();return Rn(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(nu(r,e.rgb).mul(s.oneMinus())))))}),Kx=(e,t=Rn(p.getLuminanceCoefficients(new r)))=>nu(e,t),Qx=cn(([e,t=Rn(1),s=Rn(0),i=Rn(1),n=yn(1),a=Rn(p.getLuminanceCoefficients(new r,Re))])=>{const o=e.rgb.dot(Rn(a)),u=eu(e.rgb.mul(t).add(s),0).toVar(),l=u.pow(i).toVar();return gn(u.r.greaterThan(0),()=>{u.r.assign(l.r)}),gn(u.g.greaterThan(0),()=>{u.g.assign(l.g)}),gn(u.b.greaterThan(0),()=>{u.b.assign(l.b)}),u.assign(o.add(u.sub(o).mul(n))),Cn(u.rgb,e.a)}),Yx=cn(([e,t])=>e.mul(t).floor().div(t));let Zx=null;class Jx extends Wp{static get type(){return"ViewportSharedTextureNode"}constructor(e=ud,t=null){null===Zx&&(Zx=new Q),super(e,t,Zx)}getTextureForReference(){return Zx}updateReference(){return this}}const eT=an(Jx).setParameterLength(0,2),tT=new t;class rT extends jl{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){return e.getNodeProperties(this).passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class sT extends rT{static get type(){return"PassMultipleTextureNode"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class iT extends gi{static get type(){return"PassNode"}constructor(e,t,r,s={}){super("vec4"),this.scope=e,this.scene=t,this.camera=r,this.options=s,this._pixelRatio=1,this._width=1,this._height=1;const i=new Z;i.isRenderTargetTexture=!0,i.name="depth";const n=new ne(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Te,...s});n.texture.name="output",n.depthTexture=i,this.renderTarget=n,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:n.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Sa(0),this._cameraFar=Sa(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=ri.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return d("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return d("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const r=this._textures[e],s=this.renderTarget.textures.indexOf(r);this.renderTarget.textures[s]=t,this._textures[e]=t,this._previousTextures[e]=r,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(t=new sT(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=new sT(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar;this._viewZNodes[e]=t=sg(this.getTextureNode(e),r,s)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=Jp(i,r,s)}return t}async compileAsync(e){const t=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(r)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),!0===e.reversedDepthBuffer&&(this.renderTarget.depthTexture.type=K),this.scope===iT.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:r}=this;let s,i;const n=t.getOutputRenderTarget();n&&!0===n.isXRRenderTarget?(i=1,s=t.xr.getCamera(),t.xr.updateCamera(s),tT.set(n.width,n.height)):(s=this.camera,i=t.getPixelRatio(),t.getSize(tT)),this._pixelRatio=i,this.setSize(tT.width,tT.height);const a=t.getRenderTarget(),o=t.getMRT(),u=t.autoClear,l=t.transparent,d=t.opaque,c=s.layers.mask,h=t.contextNode,p=r.overrideMaterial;this._cameraNear.value=s.near,this._cameraFar.value=s.far,null!==this._layers&&(s.layers.mask=this._layers.mask);for(const e in this._previousTextures)this.toggleTexture(e);null!==this.overrideMaterial&&(r.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,null!==this.contextNode&&(null!==this._contextNodeCache&&this._contextNodeCache.version===this.version||(this._contextNodeCache={version:this.version,context:Cu({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const g=r.name;r.name=this.name?this.name:r.name,t.render(r,s),r.name=g,r.overrideMaterial=p,t.setRenderTarget(a),t.setMRT(o),t.autoClear=u,t.transparent=l,t.opaque=d,t.contextNode=h,s.layers.mask=c}setSize(e,t){this._width=e,this._height=t;const r=Math.floor(this._width*this._pixelRatio*this._resolutionScale),s=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(r,s),null!==this._scissor?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._pixelRatio*this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._pixelRatio*this._resolutionScale).floor()}setScissor(e,t,r,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new s),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,r,i))}setViewport(e,t,r,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new s),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,r,i))}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}iT.COLOR="color",iT.DEPTH="depth";class nT extends iT{static get type(){return"ToonOutlinePassNode"}constructor(e,t,r,s,i){super(iT.COLOR,e,t),this.colorNode=r,this.thicknessNode=s,this.alphaNode=i,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((e,r,s,i,n,a,o,u)=>{if((n.isMeshToonMaterial||n.isMeshToonNodeMaterial)&&!1===n.wireframe){const l=this._getOutlineMaterial(n);t.renderObject(e,r,s,i,l,a,o,u)}t.renderObject(e,r,s,i,n,a,o,u)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){const e=new vg;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=L;const t=Tc.negate(),r=Ld.mul(sc),s=yn(1),i=r.mul(Cn(lc,1)),n=r.mul(Cn(lc.add(t),1)),a=Ro(i.sub(n));return e.vertexNode=i.add(a.mul(this.thicknessNode).mul(i.w).mul(s)),e.colorNode=Cn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const aT=cn(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),oT=cn(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),uT=cn(([e,t])=>{const r=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),s=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lT=cn(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),dT=cn(([e,t])=>{const r=Pn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=Pn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=r.mul(e),e=lT(e),(e=s.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cT=Pn(Rn(1.6605,-.1246,-.0182),Rn(-.5876,1.1329,-.1006),Rn(-.0728,-.0083,1.1187)),hT=Pn(Rn(.6274,.0691,.0164),Rn(.3293,.9195,.088),Rn(.0433,.0113,.8956)),pT=cn(([e])=>{const t=Rn(e).toVar(),r=Rn(t.mul(t)).toVar(),s=Rn(r.mul(r)).toVar();return yn(15.5).mul(s.mul(r)).sub(Da(40.14,s.mul(t))).add(Da(31.96,s).sub(Da(6.868,r.mul(t))).add(Da(.4298,r).add(Da(.1191,t).sub(.00232))))}),gT=cn(([e,t])=>{const r=Rn(e).toVar(),s=Pn(Rn(.856627153315983,.137318972929847,.11189821299995),Rn(.0951212405381588,.761241990602591,.0767994186031903),Rn(.0482516061458583,.101439036467562,.811302368396859)),i=Pn(Rn(1.1271005818144368,-.1413297634984383,-.14132976349843826),Rn(-.11060664309660323,1.157823702216272,-.11060664309660294),Rn(-.016493938717834573,-.016493938717834257,1.2519364065950405)),n=yn(-12.47393),a=yn(4.026069);return r.mulAssign(t),r.assign(hT.mul(r)),r.assign(s.mul(r)),r.assign(eu(r,1e-10)),r.assign(To(r)),r.assign(r.sub(n).div(a.sub(n))),r.assign(mu(r,0,1)),r.assign(pT(r)),r.assign(i.mul(r)),r.assign(ou(eu(Rn(0),r),Rn(2.2))),r.assign(cT.mul(r)),r.assign(mu(r,0,1)),r}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),mT=cn(([e,t])=>{const r=yn(.76),s=yn(.15);e=e.mul(t);const i=Jo(e.r,Jo(e.g,e.b)),n=Eu(i.lessThan(.08),i.sub(Da(6.25,i.mul(i))),.04);e.subAssign(n);const a=eu(e.r,eu(e.g,e.b));gn(a.lessThan(r),()=>e);const o=Pa(1,r),u=Pa(1,o.mul(o).div(a.add(o.sub(r))));e.mulAssign(u.div(a));const l=Pa(1,Ua(1,s.mul(a.sub(u)).add(1)));return gu(e,Rn(u),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class fT extends ci{static get type(){return"CodeNode"}constructor(e="",t=[],r=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const yT=an(fT).setParameterLength(1,3);class bT extends fT{static get type(){return"FunctionNode"}constructor(e="",t=[],r=""){super(e,t,r)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let r=t.nodeFunction;return void 0===r&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}generate(e,t){super.generate(e);const r=this.getNodeFunction(e),s=r.name,i=r.type,n=e.getCodeFromNode(this,i);""!==s&&(n.name=s);const a=e.getPropertyName(n),o=this.getNodeFunction(e).getCode(a);return n.code=o+"\n","property"===t?a:e.format(`${a}()`,i,t)}}const xT=(e,t=[],r="")=>{for(let e=0;es.call(...e);return i.functionNode=s,i};function TT(e){let t;const r=e.context.getViewZ;return void 0!==r&&(t=r(this)),(t||pc.z).negate()}const _T=cn(([e,t],r)=>{const s=TT(r);return bu(e,t,s)}),vT=cn(([e],t)=>{const r=TT(t);return e.mul(e,r,r).negate().exp().oneMinus()}),NT=cn(([e,t],r)=>{const s=TT(r),i=t.sub(cc.y).max(0).toConst().mul(s).toConst();return e.mul(e,i,i).negate().exp().oneMinus()}),ST=cn(([e,t])=>Cn(t.toFloat().mix(oa.rgb,e.toVec3()),oa.a));let RT=null,AT=null;class ET extends ci{static get type(){return"RangeNode"}constructor(e=yn(),t=yn()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),s=e.getTypeLength(Ks(t.value)),i=e.getTypeLength(Ks(r.value));return s>i?s:i}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new Hl('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let r=null;if(t.count>1){const i=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),a=i.value,o=n.value,u=e.getTypeLength(Ks(a)),d=e.getTypeLength(Ks(o));RT=RT||new s,AT=AT||new s,RT.setScalar(0),AT.setScalar(0),1===u?RT.setScalar(a):a.isColor?RT.set(a.r,a.g,a.b,1):RT.set(a.x,a.y,a.z||0,a.w||0),1===d?AT.setScalar(o):o.isColor?AT.set(o.r,o.g,o.b,1):AT.set(o.x,o.y,o.z||0,o.w||0);const c=4,h=c*t.count,p=new Float32Array(h);for(let e=0;enew CT(e,t),BT=MT("numWorkgroups","uvec3"),FT=MT("workgroupId","uvec3"),LT=MT("globalId","uvec3"),PT=MT("localId","uvec3"),DT=MT("subgroupSize","uint");class UT extends ci{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){const{scope:t}=this,{renderer:r}=e;!0===r.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}}const IT=an(UT);class OT extends hi{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r;const s=e.context.assign;if(r=super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}class VT extends ci{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new OT(this,e)}generate(e){const t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class kT extends ci{static get type(){return"AtomicFunctionNode"}constructor(e,t,r){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),r=t.parents,s=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.pointerNode,o=this.valueNode,u=[];u.push(`&${a.build(e,n)}`),null!==o&&u.push(o.build(e,n));const l=`${e.getMethod(s,i)}( ${u.join(", ")} )`;if(!(!!r&&(1===r.length&&!0===r[0].isStackNode)))return void 0===t.constNode&&(t.constNode=Cl(l,i).toConst()),t.constNode.build(e);e.addLineFlowCode(l,this)}}kT.ATOMIC_LOAD="atomicLoad",kT.ATOMIC_STORE="atomicStore",kT.ATOMIC_ADD="atomicAdd",kT.ATOMIC_SUB="atomicSub",kT.ATOMIC_MAX="atomicMax",kT.ATOMIC_MIN="atomicMin",kT.ATOMIC_AND="atomicAnd",kT.ATOMIC_OR="atomicOr",kT.ATOMIC_XOR="atomicXor";const GT=an(kT),zT=(e,t,r)=>GT(e,t,r).toStack();class $T extends gi{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=r}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,r=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(r)?0:e.getTypeLength(r))?t:r}generateNodeType(e){const t=this.method;return t===$T.SUBGROUP_ELECT?"bool":t===$T.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const r=this.method,s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=[];if(r===$T.SUBGROUP_BROADCAST||r===$T.SUBGROUP_SHUFFLE||r===$T.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(n.build(e,s),a.build(e,"float"===t?"int":s))}else r===$T.SUBGROUP_SHUFFLE_XOR||r===$T.SUBGROUP_SHUFFLE_DOWN||r===$T.SUBGROUP_SHUFFLE_UP?o.push(n.build(e,s),a.build(e,"uint")):(null!==n&&o.push(n.build(e,i)),null!==a&&o.push(a.build(e,i)));const u=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(r,s)}${u}`,s,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}$T.SUBGROUP_ELECT="subgroupElect",$T.SUBGROUP_BALLOT="subgroupBallot",$T.SUBGROUP_ADD="subgroupAdd",$T.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",$T.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",$T.SUBGROUP_MUL="subgroupMul",$T.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",$T.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",$T.SUBGROUP_AND="subgroupAnd",$T.SUBGROUP_OR="subgroupOr",$T.SUBGROUP_XOR="subgroupXor",$T.SUBGROUP_MIN="subgroupMin",$T.SUBGROUP_MAX="subgroupMax",$T.SUBGROUP_ALL="subgroupAll",$T.SUBGROUP_ANY="subgroupAny",$T.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",$T.QUAD_SWAP_X="quadSwapX",$T.QUAD_SWAP_Y="quadSwapY",$T.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",$T.SUBGROUP_BROADCAST="subgroupBroadcast",$T.SUBGROUP_SHUFFLE="subgroupShuffle",$T.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",$T.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",$T.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",$T.QUAD_BROADCAST="quadBroadcast";const WT=un($T,$T.SUBGROUP_ELECT).setParameterLength(0),HT=un($T,$T.SUBGROUP_BALLOT).setParameterLength(1),qT=un($T,$T.SUBGROUP_ADD).setParameterLength(1),jT=un($T,$T.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),XT=un($T,$T.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),KT=un($T,$T.SUBGROUP_MUL).setParameterLength(1),QT=un($T,$T.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),YT=un($T,$T.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ZT=un($T,$T.SUBGROUP_AND).setParameterLength(1),JT=un($T,$T.SUBGROUP_OR).setParameterLength(1),e_=un($T,$T.SUBGROUP_XOR).setParameterLength(1),t_=un($T,$T.SUBGROUP_MIN).setParameterLength(1),r_=un($T,$T.SUBGROUP_MAX).setParameterLength(1),s_=un($T,$T.SUBGROUP_ALL).setParameterLength(0),i_=un($T,$T.SUBGROUP_ANY).setParameterLength(0),n_=un($T,$T.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),a_=un($T,$T.QUAD_SWAP_X).setParameterLength(1),o_=un($T,$T.QUAD_SWAP_Y).setParameterLength(1),u_=un($T,$T.QUAD_SWAP_DIAGONAL).setParameterLength(1),l_=un($T,$T.SUBGROUP_BROADCAST).setParameterLength(2),d_=un($T,$T.SUBGROUP_SHUFFLE).setParameterLength(2),c_=un($T,$T.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),h_=un($T,$T.SUBGROUP_SHUFFLE_UP).setParameterLength(2),p_=un($T,$T.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),g_=un($T,$T.QUAD_BROADCAST).setParameterLength(1);let m_;function f_(e){m_=m_||new WeakMap;let t=m_.get(e);return void 0===t&&m_.set(e,t={}),t}function y_(e){const t=f_(e);return t.shadowMatrix||(t.shadowMatrix=Sa("mat4").setGroup(_a).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function b_(e,t=cc){const r=y_(e).mul(t);return r.xyz.div(r.w)}function x_(e){const t=f_(e);return t.position||(t.position=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.matrixWorld)))}function T_(e){const t=f_(e);return t.targetPosition||(t.targetPosition=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.target.matrixWorld)))}function __(e){const t=f_(e);return t.viewPosition||(t.viewPosition=Sa(new r).setGroup(_a).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new r,s.value.setFromMatrixPosition(e.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const v_=e=>Dd.transformDirection(x_(e).sub(T_(e))),N_=(e,t)=>{for(const r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},S_=new WeakMap,R_=[];class A_ extends ci{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Vn("vec3","totalDiffuse"),this.totalSpecularNode=Vn("vec3","totalSpecular"),this.outgoingLightNode=Vn("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let t=0;te.sort((e,t)=>e.id-t.id))(this._lights),i=e.renderer.library;for(const e of s)if(e.isNode)t.push(tn(e));else{let s=null;if(null!==r&&(s=N_(e.id,r)),null===s){const t=i.getLightNodeClass(e.constructor);if(null===t){d(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}!1===S_.has(e)&&S_.set(e,new t(e)),s=S_.get(e)}t.push(s)}this._lightNodes=t}setupDirectLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.direct({...r,lightNode:t,reflectedLight:i},e)}setupDirectRectAreaLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.directRectArea({...r,lightNode:t,reflectedLight:i},e)}setupLights(e,t){for(const r of t)r.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode;const s=e.context,i=s.lightingModel,n=e.getNodeProperties(this);if(i){const{totalDiffuseNode:t,totalSpecularNode:a}=this;s.outgoingLight=r;const o=e.addStack();n.nodes=o.nodes,i.start(e);const{backdrop:u,backdropAlpha:l}=s,{directDiffuse:d,directSpecular:c,indirectDiffuse:h,indirectSpecular:p}=s.reflectedLight;let g=d.add(h);null!==u&&(g=Rn(null!==l?l.mix(g,u):u)),t.assign(g),a.assign(c.add(p)),r.assign(t.add(a)),i.finish(e),r=r.bypass(e.removeStack())}else n.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class E_ extends ci{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=ri.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){w_.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||cc)}}const w_=Vn("vec3","shadowPositionWorld");function C_(t,r={}){return r.toneMapping=t.toneMapping,r.toneMappingExposure=t.toneMappingExposure,r.outputColorSpace=t.outputColorSpace,r.renderTarget=t.getRenderTarget(),r.activeCubeFace=t.getActiveCubeFace(),r.activeMipmapLevel=t.getActiveMipmapLevel(),r.renderObjectFunction=t.getRenderObjectFunction(),r.pixelRatio=t.getPixelRatio(),r.mrt=t.getMRT(),r.clearColor=t.getClearColor(r.clearColor||new e),r.clearAlpha=t.getClearAlpha(),r.autoClear=t.autoClear,r.scissorTest=t.getScissorTest(),r}function M_(e,t){return t=C_(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function B_(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function F_(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function L_(e,t){return t=F_(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function P_(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function D_(e,t,r){return r=L_(t,r=M_(e,r))}function U_(e,t,r){B_(e,r),P_(t,r)}var I_=Object.freeze({__proto__:null,resetRendererAndSceneState:D_,resetRendererState:M_,resetSceneState:L_,restoreRendererAndSceneState:U_,restoreRendererState:B_,restoreSceneState:P_,saveRendererAndSceneState:function(e,t,r={}){return r=F_(t,r=C_(e,r))},saveRendererState:C_,saveSceneState:F_});const O_=new WeakMap,V_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let s=Kl(e,t.xy).setName("t_basic");return e.isArrayTexture&&(s=s.depth(r)),s.compare(t.z)}),k_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=qc("radius","float",r).setGroup(_a),o=_n(1).div(n),u=a.mul(o.x),l=_x(dd.xy).mul(6.28318530718);return La(i(t.xy.add(vx(0,5,l).mul(u)),t.z),i(t.xy.add(vx(1,5,l).mul(u)),t.z),i(t.xy.add(vx(2,5,l).mul(u)),t.z),i(t.xy.add(vx(3,5,l).mul(u)),t.z),i(t.xy.add(vx(4,5,l).mul(u)),t.z)).mul(.2)}),G_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=_n(1).div(n),o=a.x,u=a.y,l=t.xy,d=Ao(l.mul(n).add(.5));return l.subAssign(d.mul(a)),La(i(l,t.z),i(l.add(_n(o,0)),t.z),i(l.add(_n(0,u)),t.z),i(l.add(a),t.z),gu(i(l.add(_n(o.negate(),0)),t.z),i(l.add(_n(o.mul(2),0)),t.z),d.x),gu(i(l.add(_n(o.negate(),u)),t.z),i(l.add(_n(o.mul(2),u)),t.z),d.x),gu(i(l.add(_n(0,u.negate())),t.z),i(l.add(_n(0,u.mul(2))),t.z),d.y),gu(i(l.add(_n(o,u.negate())),t.z),i(l.add(_n(o,u.mul(2))),t.z),d.y),gu(gu(i(l.add(_n(o.negate(),u.negate())),t.z),i(l.add(_n(o.mul(2),u.negate())),t.z),d.x),gu(i(l.add(_n(o.negate(),u.mul(2))),t.z),i(l.add(_n(o.mul(2),u.mul(2))),t.z),d.x),d.y)).mul(1/9)}),z_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r},s)=>{let i=Kl(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(r)),i=i.rg;const n=i.x,a=eu(1e-7,i.y.mul(i.y)),o=s.renderer.reversedDepthBuffer?tu(n,t.z):tu(t.z,n),u=yn(1).toVar();return gn(o.notEqual(1),()=>{const e=t.z.sub(n);let r=a.div(a.add(e.mul(e)));r=mu(Pa(r,.3).div(.65)),u.assign(eu(o,r))}),u}),$_=e=>{let t=O_.get(e);return void 0===t&&(t=new vg,t.colorNode=Cn(0,0,0,1),t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.blending=re,t.fog=!1,O_.set(e,t)),t},W_=e=>{const t=O_.get(e);void 0!==t&&(t.dispose(),O_.delete(e))},H_=new Ty,q_=[],j_=(e,t,r,s)=>{q_[0]=e,q_[1]=t;let i=H_.get(q_);return void 0!==i&&i.shadowType===r&&i.useVelocity===s||(i=(i,n,a,o,u,l,...d)=>{(!0===i.castShadow||i.receiveShadow&&r===pt)&&(s&&(Ys(i).useVelocity=!0),i.onBeforeShadow(e,i,a,t.camera,o,n.overrideMaterial,l),e.renderObject(i,n,a,o,u,l,...d),i.onAfterShadow(e,i,a,t.camera,o,n.overrideMaterial,l))},i.shadowType=r,i.useVelocity=s,H_.set(q_,i)),q_[0]=null,q_[1]=null,i},X_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanVertical"),a=yn(0).toVar("squareMeanVertical"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(0,l).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),d=d.x,n.addAssign(d),a.addAssign(d.mul(d))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),K_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanHorizontal"),a=yn(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(l,0).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),n.addAssign(d.x),a.addAssign(La(d.y.mul(d.y),d.x.mul(d.x)))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),Q_=[V_,k_,G_,z_];let Y_;const Z_=new gx;class J_ extends E_{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n}){const a=s.x.greaterThanEqual(0).and(s.x.lessThanEqual(1)).and(s.y.greaterThanEqual(0)).and(s.y.lessThanEqual(1)).and(s.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n});return a.select(o,yn(1))}setupShadowCoord(e,t){const{shadow:r}=this,{renderer:s}=e,i=r.biasNode||qc("bias","float",r).setGroup(_a);let n,a=t;if(r.camera.isOrthographicCamera||!0!==s.logarithmicDepthBuffer)a=a.xyz.div(a.w),n=a.z;else{const e=a.w;a=a.xy.div(e);const t=qc("near","float",r.camera).setGroup(_a),s=qc("far","float",r.camera).setGroup(_a);n=ig(e.negate(),t,s)}return a=Rn(a.x,a.y.oneMinus(),s.reversedDepthBuffer?n.sub(i):n.add(i)),a}getShadowFilterFn(e){return Q_[e]}setupRenderTarget(e,t){const r=new Z(e.mapSize.width,e.mapSize.height);r.name="ShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return s.texture.name="ShadowMap",s.texture.type=e.mapType,s.depthTexture=r,{shadowMap:s,depthTexture:r}}setupShadow(e){const{renderer:t,camera:r}=e,{light:s,shadow:i}=this,{depthTexture:n,shadowMap:a}=this.setupRenderTarget(i,e),o=t.shadowMap.type,u=t.hasCompatibility(A.TEXTURE_COMPARE);if(o!==ct&&o!==ht||!u?(n.minFilter=B,n.magFilter=B):(n.minFilter=le,n.magFilter=le),i.camera.coordinateSystem=r.coordinateSystem,i.camera.updateProjectionMatrix(),o===pt&&!0!==i.isPointLightShadow){n.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}));let t=Kl(n);n.isArrayTexture&&(t=t.depth(this.depthLayer));let r=Kl(this.vsmShadowMapVertical.texture);n.isArrayTexture&&(r=r.depth(this.depthLayer));const s=qc("blurSamples","float",i).setGroup(_a),o=qc("radius","float",i).setGroup(_a),u=qc("mapSize","vec2",i).setGroup(_a);let l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new vg);l.fragmentNode=X_({samples:s,radius:o,size:u,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMVertical",l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new vg),l.fragmentNode=K_({samples:s,radius:o,size:u,shadowPass:r,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMHorizontal"}const l=qc("intensity","float",i).setGroup(_a),d=qc("normalBias","float",i).setGroup(_a),c=y_(s),h=Rc.mul(d);let p;if(!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld)p=c.mul(w_.add(h));else{p=Sa("mat4").onObjectUpdate(({object:e},t)=>t.value.multiplyMatrices(c.value,e.matrixWorld)).mul(lc).add(c.mul(Cn(h,0)))}const g=this.setupShadowCoord(e,p),m=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===m)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const f=o===pt&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:n,y=this.setupShadowFilter(e,{filterFn:m,shadowTexture:a.texture,depthTexture:f,shadowCoord:g,shadow:i,depthLayer:this.depthLayer});let b,x;!0===t.shadowMap.transmitted&&(a.texture.isCubeTexture?b=$c(a.texture,g.xyz):(b=Kl(a.texture,g),n.isArrayTexture&&(b=b.depth(this.depthLayer)))),x=b?gu(1,y.rgb.mix(b,1),l.mul(b.a)).toVar():gu(1,y,l).toVar(),this.shadowMap=a,this.shadow.map=a;const T=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return b&&x.toInspector(`${T} / Color`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture):Kl(this.shadowMap.texture)),x.toInspector(`${T} / Depth`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture).r.oneMinus():Ql(this.shadowMap.depthTexture,kl().mul(zl(Kl(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return cn(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),null===r&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e;t.updateMatrices(s),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);const a=n.name;n.name=`Shadow Map [ ${s.name||"ID: "+s.id} ]`,i.render(n,t.camera),n.name=a}updateShadow(e){const{shadowMap:t,light:r,shadow:s}=this,{renderer:i,scene:n,camera:a}=e,o=i.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u;const l=s.camera.layers.mask;4294967294&s.camera.layers.mask||(s.camera.layers.mask=a.layers.mask);const d=i.getRenderObjectFunction(),c=i.getMRT(),h=!!c&&c.has("velocity");Y_=D_(i,n,Y_),n.overrideMaterial=$_(r),i.setRenderObjectFunction(j_(i,s,o,h)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(d),o===pt&&!0!==s.isPointLightShadow&&this.vsmPass(i),s.camera.layers.mask=l,U_(i,n,Y_)}vsmPass(e){const{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),Z_.material=this.vsmMaterialVertical,Z_.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Z_.material=this.vsmMaterialHorizontal,Z_.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,W_(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const ev=(e,t)=>new J_(e,t),tv=new e,rv=new a,sv=new r,iv=new r,nv=[new r(1,0,0),new r(-1,0,0),new r(0,-1,0),new r(0,1,0),new r(0,0,1),new r(0,0,-1)],av=[new r(0,-1,0),new r(0,-1,0),new r(0,0,-1),new r(0,0,1),new r(0,-1,0),new r(0,-1,0)],ov=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],uv=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],lv=cn(({depthTexture:e,bd3D:t,dp:r})=>$c(e,t).compare(r)),dv=cn(({depthTexture:e,bd3D:t,dp:r,shadow:s})=>{const i=qc("radius","float",s).setGroup(_a),n=qc("mapSize","vec2",s).setGroup(_a),a=i.div(n.x),o=Vo(t),u=Ro(au(t,o.x.greaterThan(o.z).select(Rn(0,1,0),Rn(1,0,0)))),l=au(t,u),d=_x(dd.xy).mul(6.28318530718),c=vx(0,5,d),h=vx(1,5,d),p=vx(2,5,d),g=vx(3,5,d),m=vx(4,5,d);return $c(e,t.add(u.mul(c.x).add(l.mul(c.y)).mul(a))).compare(r).add($c(e,t.add(u.mul(h.x).add(l.mul(h.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(p.x).add(l.mul(p.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(g.x).add(l.mul(g.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(m.x).add(l.mul(m.y)).mul(a))).compare(r)).mul(.2)}),cv=cn(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:s},i)=>{const n=r.xyz.toConst(),a=n.abs().toConst(),o=a.x.max(a.y).max(a.z),u=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.near),l=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.far),d=qc("bias","float",s).setGroup(_a),c=yn(1).toVar();return gn(o.sub(l).lessThanEqual(0).and(o.sub(u).greaterThanEqual(0)),()=>{let r;i.renderer.reversedDepthBuffer?(r=rg(o.negate(),u,l),r.subAssign(d)):(r=tg(o.negate(),u,l),r.addAssign(d));const a=n.normalize();c.assign(e({depthTexture:t,bd3D:a,dp:r,shadow:s}))}),c});class hv extends J_{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===gt?lv:dv}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i}){return cv({filterFn:t,depthTexture:r,shadowCoord:s,shadow:i})}setupRenderTarget(e,t){const r=new mt(e.mapSize.width);r.name="PointShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createCubeRenderTarget(e.mapSize.width);return s.texture.name="PointShadowMap",s.depthTexture=r,{shadowMap:s,depthTexture:r}}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e,a=t.camera,o=t.matrix,u=i.coordinateSystem===h,l=u?nv:ov,d=u?av:uv;r.setSize(t.mapSize.width,t.mapSize.width);const c=i.autoClear,p=i.getClearColor(tv),g=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){i.setRenderTarget(r,e),i.clear();const u=s.distance||a.far;u!==a.far&&(a.far=u,a.updateProjectionMatrix()),sv.setFromMatrixPosition(s.matrixWorld),a.position.copy(sv),iv.copy(a.position),iv.add(l[e]),a.up.copy(d[e]),a.lookAt(iv),a.updateMatrixWorld(),o.makeTranslation(-sv.x,-sv.y,-sv.z),rv.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(rv,a.coordinateSystem,a.reversedDepth);const c=n.name;n.name=`Point Light Shadow [ ${s.name||"ID: "+s.id} ] - Face ${e+1}`,i.render(n,a),n.name=c}i.autoClear=c,i.setClearColor(p,g)}}const pv=(e,t)=>new hv(e,t);class gv extends Op{static get type(){return"AnalyticLightNode"}constructor(t=null){super(),this.light=t,this.color=new e,this.colorNode=t&&t.colorNode||Sa(this.color).setGroup(_a),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=ri.FRAME,t&&t.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},t.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,null!==this.baseColorNode&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return __(this.light).sub(e.context.positionView||pc)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return ev(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let r=this.shadowColorNode;if(null===r){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?tn(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=r=this.colorNode.mul(t),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const mv=cn(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{const s=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(s.mul(e.div(t).pow4().oneMinus().clamp().pow2()),s)}),fv=({color:e,lightVector:t,cutoffDistance:r,decayExponent:s})=>{const i=t.normalize(),n=t.length(),a=mv({lightDistance:n,cutoffDistance:r,decayExponent:s});return{lightDirection:i,lightColor:e.mul(a)}};class yv extends gv{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(2).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return pv(this.light)}setupDirect(e){return fv({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const bv=cn(([e=kl()])=>{const t=e.mul(2),r=t.x.floor(),s=t.y.floor();return r.add(s).mod(2).sign()}),xv=cn(([e=kl()],{renderer:t,material:r})=>{const s=pu(e.mul(2).sub(1));let i;if(r.alphaToCoverage&&t.currentSamples>0){const e=yn(s.fwidth()).toVar();i=bu(e.oneMinus(),e.add(1),s).oneMinus()}else i=Eu(s.greaterThan(1),0,1);return i}),Tv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=Tn(e).toVar();return Eu(n,i,s)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),_v=cn(([e,t])=>{const r=Tn(t).toVar(),s=yn(e).toVar();return Eu(r,s.negate(),s)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),vv=cn(([e])=>{const t=yn(e).toVar();return bn(No(t))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Nv=cn(([e,t])=>{const r=yn(e).toVar();return t.assign(vv(r)),r.sub(yn(t))}),Sv=Vb([cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=yn(s).toVar(),l=yn(r).toVar(),d=yn(t).toVar(),c=yn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=Rn(s).toVar(),l=Rn(r).toVar(),d=Rn(t).toVar(),c=Rn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),Rv=Vb([cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=yn(o).toVar(),m=yn(a).toVar(),f=yn(n).toVar(),y=yn(i).toVar(),b=yn(s).toVar(),x=yn(r).toVar(),T=yn(t).toVar(),_=yn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=Rn(o).toVar(),m=Rn(a).toVar(),f=Rn(n).toVar(),y=Rn(i).toVar(),b=Rn(s).toVar(),x=Rn(r).toVar(),T=Rn(t).toVar(),_=Rn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),Av=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=xn(e).toVar(),a=xn(n.bitAnd(xn(7))).toVar(),o=yn(Tv(a.lessThan(xn(4)),i,s)).toVar(),u=yn(Da(2,Tv(a.lessThan(xn(4)),s,i))).toVar();return _v(o,Tn(a.bitAnd(xn(1)))).add(_v(u,Tn(a.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Ev=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=xn(e).toVar(),u=xn(o.bitAnd(xn(15))).toVar(),l=yn(Tv(u.lessThan(xn(8)),a,n)).toVar(),d=yn(Tv(u.lessThan(xn(4)),n,Tv(u.equal(xn(12)).or(u.equal(xn(14))),a,i))).toVar();return _v(l,Tn(u.bitAnd(xn(1)))).add(_v(d,Tn(u.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),wv=Vb([Av,Ev]),Cv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=En(e).toVar();return Rn(wv(n.x,i,s),wv(n.y,i,s),wv(n.z,i,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Mv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=En(e).toVar();return Rn(wv(o.x,a,n,i),wv(o.y,a,n,i),wv(o.z,a,n,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Bv=Vb([Cv,Mv]),Fv=cn(([e])=>{const t=yn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Lv=cn(([e])=>{const t=yn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Pv=Vb([Fv,cn(([e])=>{const t=Rn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Dv=Vb([Lv,cn(([e])=>{const t=Rn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Uv=cn(([e,t])=>{const r=bn(t).toVar(),s=xn(e).toVar();return s.shiftLeft(r).bitOr(s.shiftRight(bn(32).sub(r)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Iv=cn(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(Uv(r,bn(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(Uv(r,bn(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(4))),t.addAssign(e)}),Ov=cn(([e,t,r])=>{const s=xn(r).toVar(),i=xn(t).toVar(),n=xn(e).toVar();return s.bitXorAssign(i),s.subAssign(Uv(i,bn(14))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(11))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(25))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(16))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(4))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(14))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Vv=cn(([e])=>{const t=xn(e).toVar();return yn(t).div(yn(xn(bn(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),kv=cn(([e])=>{const t=yn(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Gv=Vb([cn(([e])=>{const t=bn(e).toVar(),r=xn(xn(1)).toVar(),s=xn(xn(bn(3735928559)).add(r.shiftLeft(xn(2))).add(xn(13))).toVar();return Ov(s.add(xn(t)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(xn(2)).toVar(),n=xn().toVar(),a=xn().toVar(),o=xn().toVar();return n.assign(a.assign(o.assign(xn(bn(3735928559)).add(i.shiftLeft(xn(2))).add(xn(13))))),n.addAssign(xn(s)),a.addAssign(xn(r)),Ov(n,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(xn(3)).toVar(),o=xn().toVar(),u=xn().toVar(),l=xn().toVar();return o.assign(u.assign(l.assign(xn(bn(3735928559)).add(a.shiftLeft(xn(2))).add(xn(13))))),o.addAssign(xn(n)),u.addAssign(xn(i)),l.addAssign(xn(s)),Ov(o,u,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cn(([e,t,r,s])=>{const i=bn(s).toVar(),n=bn(r).toVar(),a=bn(t).toVar(),o=bn(e).toVar(),u=xn(xn(4)).toVar(),l=xn().toVar(),d=xn().toVar(),c=xn().toVar();return l.assign(d.assign(c.assign(xn(bn(3735928559)).add(u.shiftLeft(xn(2))).add(xn(13))))),l.addAssign(xn(o)),d.addAssign(xn(a)),c.addAssign(xn(n)),Iv(l,d,c),l.addAssign(xn(i)),Ov(l,d,c)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),cn(([e,t,r,s,i])=>{const n=bn(i).toVar(),a=bn(s).toVar(),o=bn(r).toVar(),u=bn(t).toVar(),l=bn(e).toVar(),d=xn(xn(5)).toVar(),c=xn().toVar(),h=xn().toVar(),p=xn().toVar();return c.assign(h.assign(p.assign(xn(bn(3735928559)).add(d.shiftLeft(xn(2))).add(xn(13))))),c.addAssign(xn(l)),h.addAssign(xn(u)),p.addAssign(xn(o)),Iv(c,h,p),c.addAssign(xn(a)),h.addAssign(xn(n)),Ov(c,h,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),zv=Vb([cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(Gv(s,r)).toVar(),n=En().toVar();return n.x.assign(i.bitAnd(bn(255))),n.y.assign(i.shiftRight(bn(8)).bitAnd(bn(255))),n.z.assign(i.shiftRight(bn(16)).bitAnd(bn(255))),n}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(Gv(n,i,s)).toVar(),o=En().toVar();return o.x.assign(a.bitAnd(bn(255))),o.y.assign(a.shiftRight(bn(8)).bitAnd(bn(255))),o.z.assign(a.shiftRight(bn(16)).bitAnd(bn(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),$v=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=yn(Sv(wv(Gv(r,s),i,n),wv(Gv(r.add(bn(1)),s),i.sub(1),n),wv(Gv(r,s.add(bn(1))),i,n.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=yn(Rv(wv(Gv(r,s,i),n,a,o),wv(Gv(r.add(bn(1)),s,i),n.sub(1),a,o),wv(Gv(r,s.add(bn(1)),i),n,a.sub(1),o),wv(Gv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),wv(Gv(r,s,i.add(bn(1))),n,a,o.sub(1)),wv(Gv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),wv(Gv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),Wv=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=Rn(Sv(Bv(zv(r,s),i,n),Bv(zv(r.add(bn(1)),s),i.sub(1),n),Bv(zv(r,s.add(bn(1))),i,n.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=Rn(Rv(Bv(zv(r,s,i),n,a,o),Bv(zv(r.add(bn(1)),s,i),n.sub(1),a,o),Bv(zv(r,s.add(bn(1)),i),n,a.sub(1),o),Bv(zv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),Bv(zv(r,s,i.add(bn(1))),n,a,o.sub(1)),Bv(zv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),Bv(zv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),Hv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Vv(Gv(r))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Vv(Gv(r,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Vv(Gv(r,s,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Vv(Gv(r,s,i,n))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),qv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Rn(Vv(Gv(r,bn(0))),Vv(Gv(r,bn(1))),Vv(Gv(r,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Rn(Vv(Gv(r,s,bn(0))),Vv(Gv(r,s,bn(1))),Vv(Gv(r,s,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Rn(Vv(Gv(r,s,i,bn(0))),Vv(Gv(r,s,i,bn(1))),Vv(Gv(r,s,i,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Rn(Vv(Gv(r,s,i,n,bn(0))),Vv(Gv(r,s,i,n,bn(1))),Vv(Gv(r,s,i,n,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),jv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=yn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul($v(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Xv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul(Wv(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Kv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar();return _n(jv(o,a,n,i),jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Qv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(Xv(o,a,n,i)).toVar(),l=yn(jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i)).toVar();return Cn(u,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Yv=Vb([cn(([e,t,r,s,i,n,a])=>{const o=bn(a).toVar(),u=yn(n).toVar(),l=bn(i).toVar(),d=bn(s).toVar(),c=bn(r).toVar(),h=bn(t).toVar(),p=_n(e).toVar(),g=Rn(qv(_n(h.add(d),c.add(l)))).toVar(),m=_n(g.x,g.y).toVar();m.subAssign(.5),m.mulAssign(u),m.addAssign(.5);const f=_n(_n(yn(h),yn(c)).add(m)).toVar(),y=_n(f.sub(p)).toVar();return gn(o.equal(bn(2)),()=>Vo(y.x).add(Vo(y.y))),gn(o.equal(bn(3)),()=>eu(Vo(y.x),Vo(y.y))),nu(y,y)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cn(([e,t,r,s,i,n,a,o,u])=>{const l=bn(u).toVar(),d=yn(o).toVar(),c=bn(a).toVar(),h=bn(n).toVar(),p=bn(i).toVar(),g=bn(s).toVar(),m=bn(r).toVar(),f=bn(t).toVar(),y=Rn(e).toVar(),b=Rn(qv(Rn(f.add(p),m.add(h),g.add(c)))).toVar();b.subAssign(.5),b.mulAssign(d),b.addAssign(.5);const x=Rn(Rn(yn(f),yn(m),yn(g)).add(b)).toVar(),T=Rn(x.sub(y)).toVar();return gn(l.equal(bn(2)),()=>Vo(T.x).add(Vo(T.y)).add(Vo(T.z))),gn(l.equal(bn(3)),()=>eu(Vo(T.x),Vo(T.y),Vo(T.z))),nu(T,T)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),Zv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();l.assign(Jo(l,r))})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Jv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.y.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),eN=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(r)}).ElseIf(r.lessThan(l.z),()=>{l.z.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tN=Vb([Zv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();d.assign(Jo(d,n))})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),rN=Vb([Jv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.y.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),sN=Vb([eN,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(n)}).ElseIf(n.lessThan(d.z),()=>{d.z.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),iN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=_n(t).toVar(),p=_n(r).toVar(),g=_n(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(Rn(v,0),x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=Rn(t).toVar(),p=Rn(r).toVar(),g=Rn(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(v,x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aN=cn(([e])=>{const t=e.y,r=e.z,s=Rn().toVar();return gn(t.lessThan(1e-4),()=>{s.assign(Rn(r,r,r))}).Else(()=>{let i=e.x;i=i.sub(No(i)).mul(6).toVar();const n=bn(Xo(i)),a=i.sub(yn(n)),o=r.mul(t.oneMinus()),u=r.mul(t.mul(a).oneMinus()),l=r.mul(t.mul(a.oneMinus()).oneMinus());gn(n.equal(bn(0)),()=>{s.assign(Rn(r,l,o))}).ElseIf(n.equal(bn(1)),()=>{s.assign(Rn(u,r,o))}).ElseIf(n.equal(bn(2)),()=>{s.assign(Rn(o,r,l))}).ElseIf(n.equal(bn(3)),()=>{s.assign(Rn(o,u,r))}).ElseIf(n.equal(bn(4)),()=>{s.assign(Rn(l,o,r))}).Else(()=>{s.assign(Rn(r,o,u))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),oN=cn(([e])=>{const t=Rn(e).toVar(),r=yn(t.x).toVar(),s=yn(t.y).toVar(),i=yn(t.z).toVar(),n=yn(Jo(r,Jo(s,i))).toVar(),a=yn(eu(r,eu(s,i))).toVar(),o=yn(a.sub(n)).toVar(),u=yn().toVar(),l=yn().toVar(),d=yn().toVar();return d.assign(a),gn(a.greaterThan(0),()=>{l.assign(o.div(a))}).Else(()=>{l.assign(0)}),gn(l.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{gn(r.greaterThanEqual(a),()=>{u.assign(s.sub(i).div(o))}).ElseIf(s.greaterThanEqual(a),()=>{u.assign(La(2,i.sub(r).div(o)))}).Else(()=>{u.assign(La(4,r.sub(s).div(o)))}),u.mulAssign(1/6),gn(u.lessThan(0),()=>{u.addAssign(1)})}),Rn(u,l,d)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),uN=cn(([e])=>{const t=Rn(e).toVar(),r=wn(Ga(t,Rn(.04045))).toVar(),s=Rn(t.div(12.92)).toVar(),i=Rn(ou(eu(t.add(Rn(.055)),Rn(0)).div(1.055),Rn(2.4))).toVar();return gu(s,i,r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),lN=(e,t)=>{e=yn(e),t=yn(t);const r=_n(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return bu(e.sub(r),e.add(r),t)},dN=(e,t,r,s)=>gu(e,t,r[s].clamp()),cN=(e,t,r,s,i)=>gu(e,t,lN(r,s[i])),hN=cn(([e,t,r])=>{const s=Ro(e).toVar(),i=Pa(yn(.5).mul(t.sub(r)),cc).div(s).toVar(),n=Pa(yn(-.5).mul(t.sub(r)),cc).div(s).toVar(),a=Rn().toVar();a.x=s.x.greaterThan(yn(0)).select(i.x,n.x),a.y=s.y.greaterThan(yn(0)).select(i.y,n.y),a.z=s.z.greaterThan(yn(0)).select(i.z,n.z);const o=Jo(a.x,a.y,a.z).toVar();return cc.add(s.mul(o)).toVar().sub(r)}),pN=cn(([e,t])=>{const r=e.x,s=e.y,i=e.z;let n=t.element(0).mul(.886227);return n=n.add(t.element(1).mul(1.023328).mul(s)),n=n.add(t.element(2).mul(1.023328).mul(i)),n=n.add(t.element(3).mul(1.023328).mul(r)),n=n.add(t.element(4).mul(.858086).mul(r).mul(s)),n=n.add(t.element(5).mul(.858086).mul(s).mul(i)),n=n.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),n=n.add(t.element(7).mul(.858086).mul(r).mul(i)),n=n.add(t.element(8).mul(.429043).mul(Da(r,r).sub(Da(s,s)))),n});var gN=Object.freeze({__proto__:null,BRDF_GGX:am,BRDF_Lambert:Hg,BasicPointShadowFilter:lv,BasicShadowFilter:V_,Break:Fp,Const:Ou,Continue:()=>Cl("continue").toStack(),DFGLUT:lm,D_GGX:sm,Discard:Ml,EPSILON:ao,F_Schlick:Wg,Fn:cn,HALF_PI:ho,INFINITY:oo,If:gn,Loop:Bp,NodeAccess:ii,NodeShaderStage:ti,NodeType:si,NodeUpdateType:ri,OnBeforeMaterialUpdate:e=>Rx(Sx.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>Rx(Sx.BEFORE_OBJECT,e),OnMaterialUpdate:e=>Rx(Sx.MATERIAL,e),OnObjectUpdate:e=>Rx(Sx.OBJECT,e),PCFShadowFilter:k_,PCFSoftShadowFilter:G_,PI:uo,PI2:lo,PointShadowFilter:dv,Return:()=>Cl("return").toStack(),Schlick_to_F0:hm,ShaderNode:en,Stack:mn,Switch:(...e)=>Si.Switch(...e),TBNViewMatrix:xh,TWO_PI:co,VSMShadowFilter:z_,V_GGX_SmithCorrelated:tm,Var:Iu,VarIntent:Vu,abs:Vo,acesFilmicToneMapping:dT,acos:Do,acosh:Uo,add:La,addMethodChaining:Ai,addNodeElement:function(e){d("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:gT,all:po,alphaT:Jn,and:Wa,anisotropy:ea,anisotropyB:ra,anisotropyT:ta,any:go,append:e=>(d("TSL: append() has been renamed to Stack().",new Is),mn(e)),array:Aa,arrayBuffer:e=>new vi(e,"ArrayBuffer"),asin:Lo,asinh:Po,assign:wa,atan:Io,atanh:Oo,atomicAdd:(e,t)=>zT(kT.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>zT(kT.ATOMIC_AND,e,t),atomicFunc:zT,atomicLoad:e=>zT(kT.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>zT(kT.ATOMIC_MAX,e,t),atomicMin:(e,t)=>zT(kT.ATOMIC_MIN,e,t),atomicOr:(e,t)=>zT(kT.ATOMIC_OR,e,t),atomicStore:(e,t)=>zT(kT.ATOMIC_STORE,e,t),atomicSub:(e,t)=>zT(kT.ATOMIC_SUB,e,t),atomicXor:(e,t)=>zT(kT.ATOMIC_XOR,e,t),attenuationColor:ma,attenuationDistance:ga,attribute:Vl,attributeArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ex(e,r,s);return Tp(i,t,e)},backgroundBlurriness:Bx,backgroundIntensity:Fx,backgroundRotation:Lx,batch:Ap,bentNormalView:_h,billboarding:Hb,bitAnd:Xa,bitNot:Ka,bitOr:Qa,bitXor:Ya,bitangentGeometry:mh,bitangentLocal:fh,bitangentView:yh,bitangentWorld:bh,bitcast:yb,blendBurn:mg,blendColor:xg,blendDodge:fg,blendOverlay:bg,blendScreen:yg,blur:pf,bool:Tn,buffer:Zl,bufferAttribute:ul,builtin:sd,builtinAOContext:Lu,builtinShadowContext:Fu,bumpMap:Ch,bvec2:Sn,bvec3:wn,bvec4:Fn,bypass:Rl,cache:Nl,call:Ma,cameraFar:Fd,cameraIndex:Md,cameraNear:Bd,cameraNormalMatrix:Id,cameraPosition:Od,cameraProjectionMatrix:Ld,cameraProjectionMatrixInverse:Pd,cameraViewMatrix:Dd,cameraViewport:Vd,cameraWorldMatrix:Ud,cbrt:hu,cdl:Qx,ceil:So,checker:bv,cineonToneMapping:uT,clamp:mu,clearcoat:qn,clearcoatNormalView:Ac,clearcoatRoughness:jn,clipSpace:oc,code:yT,color:fn,colorSpaceToWorking:Qu,colorToDirection:e=>tn(e).mul(2).sub(1),compute:Tl,computeKernel:xl,computeSkinning:(e,t=null)=>{const r=new wp(e);return r.positionNode=Tp(new q(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinIndexNode=Tp(new q(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinWeightNode=Tp(new q(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.bindMatrixNode=Sa(e.bindMatrix,"mat4"),r.bindMatrixInverseNode=Sa(e.bindMatrixInverse,"mat4"),r.boneMatricesNode=Zl(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),r.toPositionNode=t,tn(r)},context:Cu,convert:In,convertColorSpace:(e,t,r)=>new Xu(tn(e),t,r),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():yx(e,...t),cos:Co,cosh:Mo,countLeadingZeros:vb,countOneBits:Nb,countTrailingZeros:_b,cross:au,cubeTexture:$c,cubeTextureBase:zc,dFdx:Wo,dFdy:Ho,dashSize:ua,debug:Pl,decrement:so,decrementBefore:to,defaultBuildStages:ai,defaultShaderStages:ni,defined:Zi,degrees:fo,deltaTime:Gb,densityFogFactor:vT,depth:ag,depthPass:(e,t,r)=>new iT(iT.DEPTH,e,t,r),determinant:Yo,difference:iu,diffuseColor:Gn,diffuseContribution:zn,directPointLight:fv,directionToColor:vh,directionToFaceDirection:bc,dispersion:fa,disposeShadowMaterial:W_,distance:su,div:Ua,dot:nu,drawIndex:yl,dynamicBufferAttribute:(e,t=null,r=0,s=0)=>ol(e,t,r,s,x),element:Un,emissive:$n,equal:Oa,equirectUV:Bg,exp:yo,exp2:bo,exponentialHeightFogFactor:NT,expression:Cl,faceDirection:yc,faceForward:xu,faceforward:Su,float:yn,floatBitsToInt:e=>new fb(e,"int","float"),floatBitsToUint:bb,floor:No,fog:ST,fract:Ao,frameGroup:Ta,frameId:zb,frontFacing:fc,fwidth:Ko,gain:(e,t)=>e.lessThan(.5)?Rb(e.mul(2),t).div(2):Pa(1,Rb(Da(Pa(1,e),2),t).div(2)),gapSize:la,getConstNodeType:Ji,getCurrentStack:pn,getDirection:lf,getDistanceAttenuation:mv,getGeometryRoughness:Jg,getNormalFromDepth:Tx,getParallaxCorrectNormal:hN,getRoughness:em,getScreenPosition:xx,getShIrradianceAt:pN,getShadowMaterial:$_,getShadowRenderObjectFunction:j_,getTextureIndex:pb,getViewPosition:bx,ggxConvolution:yf,globalId:LT,glsl:(e,t)=>yT(e,t,"glsl"),glslFn:(e,t)=>xT(e,t,"glsl"),grayscale:Hx,greaterThan:Ga,greaterThanEqual:$a,hash:Sb,highpModelNormalViewMatrix:ac,highpModelViewMatrix:nc,hue:Xx,increment:ro,incrementBefore:eo,inspector:Il,instance:vp,instanceIndex:pl,instancedArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ax(e,r,s);return Tp(i,t,i.count)},instancedBufferAttribute:ll,instancedDynamicBufferAttribute:dl,instancedMesh:Sp,int:bn,intBitsToFloat:e=>new fb(e,"float","int"),interleavedGradientNoise:_x,inverse:Zo,inverseSqrt:vo,inversesqrt:Ru,invocationLocalIndex:fl,invocationSubgroupIndex:ml,ior:ca,iridescence:Qn,iridescenceIOR:Yn,iridescenceThickness:Zn,isolate:vl,ivec2:vn,ivec3:An,ivec4:Mn,js:(e,t)=>yT(e,t,"js"),label:Pu,length:Go,lengthSq:pu,lessThan:ka,lessThanEqual:za,lightPosition:x_,lightProjectionUV:b_,lightShadowMatrix:y_,lightTargetDirection:v_,lightTargetPosition:T_,lightViewPosition:__,lightingContext:Gp,lights:(e=[])=>(new A_).setLights(e),linearDepth:og,linearToneMapping:aT,localId:PT,log:xo,log2:To,logarithmicDepthToViewZ:(e,t,r)=>{const s=e.mul(xo(r.div(t)));return yn(Math.E).pow(s).mul(t).negate()},luminance:Kx,mat2:Ln,mat3:Pn,mat4:Dn,matcapUV:ey,materialAO:gp,materialAlphaTest:Fh,materialAnisotropy:Yh,materialAnisotropyVector:mp,materialAttenuationColor:np,materialAttenuationDistance:ip,materialClearcoat:Hh,materialClearcoatNormal:jh,materialClearcoatRoughness:qh,materialColor:Lh,materialDispersion:hp,materialEmissive:Dh,materialEnvIntensity:Pc,materialEnvRotation:Dc,materialIOR:sp,materialIridescence:Zh,materialIridescenceIOR:Jh,materialIridescenceThickness:ep,materialLightMap:pp,materialLineDashOffset:dp,materialLineDashSize:op,materialLineGapSize:up,materialLineScale:ap,materialLineWidth:lp,materialMetalness:$h,materialNormal:Wh,materialOpacity:Uh,materialPointSize:cp,materialReference:Kc,materialReflectivity:Gh,materialRefractionRatio:Lc,materialRotation:Xh,materialRoughness:zh,materialSheen:Kh,materialSheenRoughness:Qh,materialShininess:Ph,materialSpecular:Ih,materialSpecularColor:Vh,materialSpecularIntensity:Oh,materialSpecularStrength:kh,materialThickness:rp,materialTransmission:tp,max:eu,maxMipLevel:Wl,mediumpModelViewMatrix:ic,metalness:Hn,min:Jo,mix:gu,mixElement:_u,mod:Ia,modInt:io,modelDirection:Kd,modelNormalMatrix:tc,modelPosition:Yd,modelRadius:ec,modelScale:Zd,modelViewMatrix:sc,modelViewPosition:Jd,modelViewProjection:fp,modelWorldMatrix:Qd,modelWorldMatrixInverse:rc,morphReference:Ip,mrt:mb,mul:Da,mx_aastep:lN,mx_add:(e,t=yn(0))=>La(e,t),mx_atan2:(e=yn(0),t=yn(1))=>Io(e,t),mx_cell_noise_float:(e=kl())=>Hv(e.convert("vec2|vec3")),mx_contrast:(e,t=1,r=.5)=>yn(e).sub(r).mul(t).add(r),mx_divide:(e,t=yn(1))=>Ua(e,t),mx_fractal_noise_float:(e=kl(),t=3,r=2,s=.5,i=1)=>jv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec2:(e=kl(),t=3,r=2,s=.5,i=1)=>Kv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec3:(e=kl(),t=3,r=2,s=.5,i=1)=>Xv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec4:(e=kl(),t=3,r=2,s=.5,i=1)=>Qv(e,bn(t),r,s).mul(i),mx_frame:()=>zb,mx_heighttonormal:(e,t)=>(e=Rn(e),t=yn(t),Ch(e,t)),mx_hsvtorgb:aN,mx_ifequal:(e,t,r,s)=>e.equal(t).mix(r,s),mx_ifgreater:(e,t,r,s)=>e.greaterThan(t).mix(r,s),mx_ifgreatereq:(e,t,r,s)=>e.greaterThanEqual(t).mix(r,s),mx_invert:(e,t=yn(1))=>Pa(t,e),mx_modulo:(e,t=yn(1))=>Ia(e,t),mx_multiply:(e,t=yn(1))=>Da(e,t),mx_noise_float:(e=kl(),t=1,r=0)=>$v(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec3:(e=kl(),t=1,r=0)=>Wv(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec4:(e=kl(),t=1,r=0)=>{e=e.convert("vec2|vec3");return Cn(Wv(e),$v(e.add(_n(19,73)))).mul(t).add(r)},mx_place2d:(e,t=_n(.5,.5),r=_n(1,1),s=yn(0),i=_n(0,0))=>{let n=e;if(t&&(n=n.sub(t)),r&&(n=n.mul(r)),s){const e=s.mul(Math.PI/180),t=e.cos(),r=e.sin();n=_n(n.x.mul(t).sub(n.y.mul(r)),n.x.mul(r).add(n.y.mul(t)))}return t&&(n=n.add(t)),i&&(n=n.add(i)),n},mx_power:(e,t=yn(1))=>ou(e,t),mx_ramp4:(e,t,r,s,i=kl())=>{const n=i.x.clamp(),a=i.y.clamp(),o=gu(e,t,n),u=gu(r,s,n);return gu(o,u,a)},mx_ramplr:(e,t,r=kl())=>dN(e,t,r,"x"),mx_ramptb:(e,t,r=kl())=>dN(e,t,r,"y"),mx_rgbtohsv:oN,mx_rotate2d:(e,t)=>{e=_n(e);const r=(t=yn(t)).mul(Math.PI/180);return iy(e,r)},mx_rotate3d:(e,t,r)=>{e=Rn(e),t=yn(t),r=Rn(r);const s=t.mul(Math.PI/180),i=r.normalize(),n=s.cos(),a=s.sin(),o=yn(1).sub(n);return e.mul(n).add(i.cross(e).mul(a)).add(i.mul(i.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=yn(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},s=t.replace(/^out/,"").toLowerCase();if(void 0!==r[s])return e.element(r[s])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==r[t])return e.element(r[t])}return e},mx_splitlr:(e,t,r,s=kl())=>cN(e,t,r,s,"x"),mx_splittb:(e,t,r,s=kl())=>cN(e,t,r,s,"y"),mx_srgb_texture_to_lin_rec709:uN,mx_subtract:(e,t=yn(0))=>Pa(e,t),mx_timer:()=>kb,mx_transform_uv:(e=1,t=0,r=kl())=>r.mul(e).add(t),mx_unifiednoise2d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>iN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_unifiednoise3d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>nN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_worley_noise_float:(e=kl(),t=1)=>tN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec2:(e=kl(),t=1)=>rN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec3:(e=kl(),t=1)=>sN(e.convert("vec2|vec3"),t,bn(1)),negate:zo,neutralToneMapping:mT,nodeArray:nn,nodeImmutable:on,nodeObject:tn,nodeObjectIntent:rn,nodeObjects:sn,nodeProxy:an,nodeProxyIntent:un,normalFlat:_c,normalGeometry:xc,normalLocal:Tc,normalMap:Rh,normalView:Sc,normalViewGeometry:vc,normalWorld:Rc,normalWorldGeometry:Nc,normalize:Ro,not:qa,notEqual:Va,numWorkgroups:BT,objectDirection:zd,objectGroup:va,objectPosition:Wd,objectRadius:jd,objectScale:Hd,objectViewPosition:qd,objectWorldMatrix:$d,oneMinus:$o,or:Ha,orthographicDepthToViewZ:eg,oscSawtooth:(e=kb)=>e.fract(),oscSine:(e=kb)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=kb)=>e.fract().round(),oscTriangle:(e=kb)=>e.add(.5).fract().mul(2).sub(1).abs(),output:oa,outputStruct:lb,overloadingFn:Vb,packHalf2x16:Cb,packSnorm2x16:Eb,packUnorm2x16:wb,parabola:Rb,parallaxDirection:Th,parallaxUV:(e,t)=>e.sub(Th.mul(t)),parameter:(e,t)=>new sb(e,t),pass:(e,t,r)=>new iT(iT.COLOR,e,t,r),passTexture:(e,t)=>new rT(e,t),pcurve:(e,t,r)=>ou(Ua(ou(e,t),La(ou(e,t),ou(Pa(1,e),r))),1/t),perspectiveDepthToViewZ:sg,pmremTexture:Vf,pointShadow:pv,pointUV:Cx,pointWidth:da,positionGeometry:uc,positionLocal:lc,positionPrevious:dc,positionView:pc,positionViewDirection:gc,positionWorld:cc,positionWorldDirection:hc,posterize:Yx,pow:ou,pow2:uu,pow3:lu,pow4:du,premultiplyAlpha:Tg,property:Vn,quadBroadcast:g_,quadSwapDiagonal:u_,quadSwapX:a_,quadSwapY:o_,radians:mo,rand:Tu,range:wT,rangeFogFactor:_T,reciprocal:jo,reference:qc,referenceBuffer:jc,reflect:ru,reflectVector:Oc,reflectView:Uc,reflector:e=>new lx(e),refract:yu,refractVector:Vc,refractView:Ic,reinhardToneMapping:oT,remap:Al,remapClamp:El,renderGroup:_a,renderOutput:Fl,rendererReference:el,replaceDefaultUV:function(e,t=null){return Cu(t,{getUV:"function"==typeof e?e:()=>e})},rotate:iy,rotateUV:$b,roughness:Wn,round:qo,rtt:yx,sRGBTransferEOTF:Hu,sRGBTransferOETF:qu,sample:(e,t=null)=>new Nx(e,tn(t)),sampler:e=>(!0===e.isNode?e:Kl(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:Kl(e)).convert("samplerComparison"),saturate:fu,saturation:qx,screenCoordinate:dd,screenDPR:od,screenSize:ld,screenUV:ud,select:Eu,setCurrentStack:hn,setName:Bu,shaderStages:oi,shadow:ev,shadowPositionWorld:w_,shapeCircle:xv,sharedUniformGroup:xa,sheen:Xn,sheenRoughness:Kn,shiftLeft:Za,shiftRight:Ja,shininess:aa,sign:ko,sin:Eo,sinc:(e,t)=>Eo(uo.mul(t.mul(e).sub(1))).div(uo.mul(t.mul(e).sub(1))),sinh:wo,skinning:Cp,smoothstep:bu,smoothstepElement:vu,specularColor:sa,specularColorBlended:ia,specularF90:na,spherizeUV:Wb,split:(e,t)=>new yi(tn(e),t),spritesheetUV:jb,sqrt:_o,stack:nb,step:tu,stepElement:Nu,storage:Tp,storageBarrier:()=>IT("storage").toStack(),storageTexture:Dx,string:(e="")=>new vi(e,"string"),struct:(e,t=null)=>{const r=new ab(e,t),s=(...t)=>{let s=null;if(t.length>0)if(t[0].isNode){s={};const r=Object.keys(e);for(let e=0;eOx(e,t).level(r),texture3DLoad:(...e)=>Ox(...e).setSampler(!1),textureBarrier:()=>IT("texture").toStack(),textureBicubic:Fm,textureBicubicLevel:Bm,textureCubeUV:df,textureLevel:(e,t,r)=>Kl(e,t).level(r),textureLoad:Ql,textureSize:zl,textureStore:(e,t,r)=>{let s;return!0===e.isStorageTextureNode?(s=e.clone(),s.uvNode=t,s.storeNode=r):s=Dx(e,t,r),null!==r&&s.toStack(),s},thickness:pa,time:kb,toneMapping:rl,toneMappingExposure:sl,toonOutlinePass:(t,r,s=new e(0,0,0),i=.003,n=1)=>new nT(t,r,tn(s),tn(i),tn(n)),transformDirection:cu,transformNormal:Ec,transformNormalToView:wc,transformedClearcoatNormalView:Bc,transformedNormalView:Cc,transformedNormalWorld:Mc,transmission:ha,transpose:Qo,triNoise3D:Ub,triplanarTexture:(...e)=>Xb(...e),triplanarTextures:Xb,trunc:Xo,uint:xn,uintBitsToFloat:e=>new fb(e,"float","uint"),uniform:Sa,uniformArray:td,uniformCubeTexture:(e=kc)=>zc(e),uniformFlow:Mu,uniformGroup:ba,uniformTexture:(e=ql)=>Kl(e),unpackHalf2x16:Lb,unpackNormal:Nh,unpackSnorm2x16:Bb,unpackUnorm2x16:Fb,unpremultiplyAlpha:_g,userData:(e,t,r)=>new Vx(e,t,r),uv:kl,uvec2:Nn,uvec3:En,uvec4:Bn,varying:$u,varyingProperty:kn,vec2:_n,vec3:Rn,vec4:Cn,vectorComponents:ui,velocity:Wx,vertexColor:gg,vertexIndex:hl,vertexStage:Wu,vibrance:jx,viewZToLogarithmicDepth:ig,viewZToOrthographicDepth:Jp,viewZToPerspectiveDepth:tg,viewZToReversedOrthographicDepth:(e,t,r)=>e.add(r).div(r.sub(t)),viewZToReversedPerspectiveDepth:rg,viewport:cd,viewportCoordinate:pd,viewportDepthTexture:Yp,viewportLinearDepth:ug,viewportMipTexture:qp,viewportOpaqueMipTexture:Xp,viewportResolution:md,viewportSafeUV:qb,viewportSharedTexture:eT,viewportSize:hd,viewportTexture:Hp,viewportUV:gd,vogelDiskSample:vx,wgsl:(e,t)=>yT(e,t,"wgsl"),wgslFn:(e,t)=>xT(e,t,"wgsl"),workgroupArray:(e,t)=>new VT("Workgroup",e,t),workgroupBarrier:()=>IT("workgroup").toStack(),workgroupId:FT,workingToColorSpace:Ku,xor:ja});const mN=new rb;class fN extends Ry{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,r){const s=this.renderer,i=this.nodes.getBackgroundNode(e)||e.background;let n=!1;if(null===i)s._clearColor.getRGB(mN),mN.a=s._clearColor.a;else if(!0===i.isColor)i.getRGB(mN),mN.a=1,n=!0;else if(!0===i.isNode){const u=this.get(e),l=i;mN.copy(s._clearColor);let d=u.backgroundMesh;if(void 0===d){const h=Cn(l).mul(Fx).context({getUV:()=>Lx.mul(Nc),getTextureLevel:()=>Bx}),p=Ld.element(3).element(3).equal(1),g=Ua(1,Ld.element(1).element(1)).mul(3),m=p.select(lc.mul(g),lc),f=sc.mul(Cn(m,0));let y=Ld.mul(Cn(f.xyz,1));y=y.setZ(y.w);const b=new vg;function x(){i.removeEventListener("dispose",x),d.material.dispose(),d.geometry.dispose()}b.name="Background.material",b.side=L,b.depthTest=!1,b.depthWrite=!1,b.allowOverride=!1,b.fog=!1,b.lights=!1,b.vertexNode=y,b.colorNode=h,u.backgroundMeshNode=h,u.backgroundMesh=d=new oe(new ft(1,32,32),b),d.frustumCulled=!1,d.name="Background.mesh",i.addEventListener("dispose",x)}const c=l.getCacheKey();u.backgroundCacheKey!==c&&(u.backgroundMeshNode.node=Cn(l).mul(Fx),u.backgroundMeshNode.needsUpdate=!0,d.material.needsUpdate=!0,u.backgroundCacheKey=c),t.unshift(d,d.geometry,d.material,0,0,null,null)}else o("Renderer: Unsupported background configuration.",i);const a=s.xr.getEnvironmentBlendMode();if("additive"===a?mN.set(0,0,0,1):"alpha-blend"===a&&mN.set(0,0,0,0),!0===s.autoClear||!0===n){const T=r.clearColorValue;T.r=mN.r,T.g=mN.g,T.b=mN.b,T.a=mN.a,!0!==s.backend.isWebGLBackend&&!0!==s.alpha||(T.r*=T.a,T.g*=T.a,T.b*=T.a),r.depthClearValue=s.getClearDepth(),r.stencilClearValue=s.getClearStencil(),r.clearColor=!0===s.autoClearColor,r.clearDepth=!0===s.autoClearDepth,r.clearStencil=!0===s.autoClearStencil}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}}let yN=0;class bN{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=yN++}}class xN{constructor(e,t,r,s,i,n,a,o,u,l=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=l,this.nodeAttributes=s,this.bindings=i,this.updateNodes=n,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=u,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const r=new bN(t.name,[]);e.push(r);for(const e of t.bindings)r.bindings.push(e.clone())}else e.push(t)}return e}}class TN{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}}class _N{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class vN{constructor(e,t,r=!1,s=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=s}}class NN extends vN{constructor(e,t,r=null,s=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=s}}class SN{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}let RN=0;class AN{constructor(e=null){this.id=RN++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class EN{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class wN{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class CN extends wN{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class MN extends wN{constructor(e,r=new t){super(e,r),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class BN extends wN{constructor(e,t=new r){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class FN extends wN{constructor(e,t=new s){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class LN extends wN{constructor(t,r=new e){super(t,r),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class PN extends wN{constructor(e,t=new i){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class DN extends wN{constructor(e,t=new n){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class UN extends wN{constructor(e,t=new a){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class IN extends CN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class ON extends MN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class VN extends BN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kN extends FN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class GN extends LN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zN extends PN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class $N extends DN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class WN extends UN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let HN=0;const qN=new WeakMap,jN=new WeakMap,XN=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),KN=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class QN{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=nb(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new AN,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:HN++})}isFlatShading(){return!0===this.material.flatShading||!1===this.geometry.hasAttribute("normal")}isOpaque(){const e=this.material;return!1===e.transparent&&e.blending===tt&&!1===e.alphaToCoverage}createRenderTarget(e,t,r){return new ne(e,t,r)}createCubeRenderTarget(e,t){return new Fg(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const r=t[0].groupNode;let s,i=r.shared;if(i)for(let e=1;ee.nodeUniform.node.id-t.nodeUniform.node.id);for(const t of e.uniforms)r+=t.nodeUniform.node.id}else r+=e.nodeUniform.id;const i=this.renderer._currentRenderContext||this.renderer;let n=qN.get(i);void 0===n&&(n=new Map,qN.set(i,n));const a=Vs(r);s=n.get(a),void 0===s&&(s=new bN(e,t),n.set(a,s))}else s=new bN(e,t);return s}getBindGroupArray(e,t){const r=this.bindings[t];let s=r[e];return void 0===s&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=s=[]),s}getBindings(){let e=this.bindGroups;if(null===e){const t={},r=this.bindings;for(const e of oi)for(const s in r[e]){const i=r[e][s],n=t[s]||(t[s]=[]);for(const e of i)!1===n.includes(e)&&n.push(e)}e=[];for(const r in t){const s=t[r],i=this._getBindGroup(r,s);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(n)}u`:"0u";if("bool"===i)return n?"true":"false";if("color"===i)return`${this.getType("vec3")}( ${KN(n.r)}, ${KN(n.g)}, ${KN(n.b)} )`;const a=this.getTypeLength(i),o=this.getComponentType(i),u=e=>this.generateConst(o,e);if(2===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)} )`;if(3===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)} )`;if(4===a&&"mat2"!==i)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)}, ${u(n.w)} )`;if(a>=4&&n&&(n.isMatrix2||n.isMatrix3||n.isMatrix4))return`${this.getType(i)}( ${n.elements.map(u).join(", ")} )`;if(a>4)return`${this.getType(i)}()`;throw new Error(`NodeBuilder: Type '${i}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const r=this.attributes;for(const t of r)if(t.name===e)return t;const s=new TN(e,t);return this.registerDeclaration(s),r.push(s),s}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===R)return"int";if(t===S)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let r=Ws(e);const s="float"===t?"":t[0];return!0===/mat2/.test(t)&&(r=r.replace("vec","mat")),s+r}getTypeFromArray(e){return XN.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const r=t.array,s=e.itemSize,i=e.normalized;let n;return e instanceof xt||!0===i||(n=this.getTypeFromArray(r)),this.getTypeFromLength(s,n)}getTypeLength(e){const t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]!==e)throw new Error("NodeBuilder: Invalid active stack removal.");this.activeStacks.pop()}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=nb(this.stack);const e=pn();return this.stacks.push(e),hn(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){this.getDataFromNode(t).stack=e}return this.stack=e.parent,hn(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){let s=(r=null===r?e.isGlobal(this)?this.globalCache:this.cache:r).getData(e);void 0===s&&(s={},r.setData(e,s)),void 0===s[t]&&(s[t]={});let i=s[t];const n=s.any?s.any.subBuilds:null,a=this.getClosestSubBuild(n);return a&&(void 0===i.subBuildsCache&&(i.subBuildsCache={}),i=i.subBuildsCache[a]||(i.subBuildsCache[a]={}),i.subBuilds=n),i}getNodeProperties(e,t="any"){const r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const r=this.getDataFromNode(e,"vertex");let s=r.bufferAttribute;if(void 0===s){const i=this.uniforms.index++;s=new TN("nodeAttribute"+i,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,s=this.shaderStage){const i=this.getDataFromNode(e,s,this.globalCache);let n=i.structType;if(void 0===n){const a=this.structs.index++;null===r&&(r="StructType"+a),n=new EN(r,t),this.structs[s].push(n),this.types[s][r]=e,i.structType=n}return n}getOutputStructTypeFromNode(e,t){const r=this.getStructTypeFromNode(e,t,"OutputType","fragment");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,s=null){const i=this.getDataFromNode(e,r,this.globalCache);let n=i.uniform;if(void 0===n){const a=this.uniforms.index++;n=new _N(s||"nodeUniform"+a,t,e),this.uniforms[r].push(n),this.registerDeclaration(n),i.uniform=n}return n}getVarFromNode(e,t=null,r=e.getNodeType(this),s=this.shaderStage,i=!1){const n=this.getDataFromNode(e,s),a=this.getSubBuildProperty("variable",n.subBuilds);let o=n[a];if(void 0===o){const u=i?"_const":"_var",l=this.vars[s]||(this.vars[s]=[]),d=this.vars[u]||(this.vars[u]=0);null===t&&(t=(i?"nodeConst":"nodeVar")+d,this.vars[u]++),"variable"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds));const c=e.getArrayCount(this);o=new vN(t,r,i,c),i||l.push(o),this.registerDeclaration(o),n[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,r=e.getNodeType(this),s=null,i=null){const n=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",n.subBuilds);let o=n[a];if(void 0===o){const e=this.varyings,u=e.length;null===t&&(t="nodeVarying"+u),"varying"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds)),o=new NN(t,r,s,i),e.push(o),this.registerDeclaration(o),n[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),s=this.getPropertyName(e);let i=1,n=s;for(;void 0!==r[n];)n=s+"_"+i++;i>1&&(e.name=n,d(`TSL: Declaration name '${s}' of '${e.type}' already in use. Renamed to '${n}'.`)),r[n]=e}getCodeFromNode(e,t,r=this.shaderStage){const s=this.getDataFromNode(e);let i=s.code;if(void 0===i){const e=this.codes[r]||(this.codes[r]=[]),n=e.length;i=new SN("nodeCode"+n,t),e.push(i),s.code=i}return i}addFlowCodeHierarchy(e,t){const{flowCodes:r,flowCodeBlock:s}=this.getDataFromNode(e);let i=!0,n=t;for(;n;){if(!0===s.get(n)){i=!1;break}n=this.getDataFromNode(n).parentNodeBlock}if(i)for(const e of r)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,r){const s=this.getDataFromNode(e),i=s.flowCodes||(s.flowCodes=[]),n=s.flowCodeBlock||(s.flowCodeBlock=new WeakMap);i.push(t),n.set(r,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new bT,r=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=r,t}flowShaderNode(e){const t=e.layout,r={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const e of t.inputs)r[e.name]=new sb(e.type,e.name);e.layout=null;const s=e.call(r),i=this.flowStagesNode(s,t.type);return e.layout=t,i}flowBuildStage(e,t,r=null){const s=this.getBuildStage();this.setBuildStage(t);const i=e.build(this,r);return this.setBuildStage(s),i}flowStagesNode(e,t=null){const r=this.flow,s=this.vars,i=this.declarations,n=this.cache,a=this.buildStage,o=this.stack,u={code:""};this.flow=u,this.vars={},this.declarations={},this.cache=new AN,this.stack=nb();for(const r of ai)this.setBuildStage(r),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=s,this.declarations=i,this.cache=n,this.stack=o,this.setBuildStage(a),u}getFunctionOperator(){return null}buildFunctionCode(){d("Abstract function.")}flowChildNode(e,t=null){const r=this.flow,s={code:""};return this.flow=s,s.result=e.build(this,t),this.flow=r,s}flowNodeFromShaderStage(e,t,r=null,s=null){const i=this.tab,n=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const u={...this.context};delete u.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=u;let l=null;if("generate"===this.buildStage){const i=this.flowChildNode(t,r);null!==s&&(i.code+=`${this.tab+s} = ${i.result};\n`),this.flowCode[e]=this.flowCode[e]+i.code,l=i}else l=t.build(this);return this.setShaderStage(a),this.cache=n,this.tab=i,this.context=o,l}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){d("Abstract function.")}getVaryings(){d("Abstract function.")}getVar(e,t,r=null){return`${null!==r?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e,t=!1){const r=[],s=this.vars[e];if(void 0!==s)for(const e of s)r.push(`${this.getVar(e.type,e.name,e.count)};`);return r.join(t?"\n":"\n\t")}getUniforms(){d("Abstract function.")}getCodes(e){const t=this.codes[e];let r="";if(void 0!==t)for(const e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){d("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const r=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){const s=t[e];if(r.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let r,s;return r=null!==t?this.getClosestSubBuild(t):this.subBuildFn,s=r?e?r+"_"+e:r:e,s}prebuild(){const{object:e,renderer:t,material:r}=this;if(!0===t.contextNode.isContextNode?this.context={...this.context,...t.contextNode.getFlowContextData()}:o('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),r&&r.contextNode&&(!0===r.contextNode.isContextNode?this.context={...this.context,...r.contextNode.getFlowContextData()}:o('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),null!==r){let e=t.library.fromMaterial(r);null===e&&(o(`NodeBuilder: Material "${r.type}" is not compatible.`),e=new vg),e.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this);await Tt()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=jN.get(e);return void 0===t&&(t={}),t}getNodeUniform(e,t){const r=this.getSharedDataFromNode(e);let s=r.cache;if(void 0===s){if("float"===t||"int"===t||"uint"===t)s=new IN(e);else if("vec2"===t||"ivec2"===t||"uvec2"===t)s=new ON(e);else if("vec3"===t||"ivec3"===t||"uvec3"===t)s=new VN(e);else if("vec4"===t||"ivec4"===t||"uvec4"===t)s=new kN(e);else if("color"===t)s=new GN(e);else if("mat2"===t)s=new zN(e);else if("mat3"===t)s=new $N(e);else{if("mat4"!==t)throw new Error(`Uniform "${t}" not implemented.`);s=new WN(e)}r.cache=s}return s}format(e,t,r){if((t=this.getVectorType(t))===(r=this.getVectorType(r))||null===r||this.isReference(r))return e;const s=this.getTypeLength(t),i=this.getTypeLength(r);return 16===s&&9===i?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===s&&4===i?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:s>4||i>4||0===i?e:s===i?`${this.getType(r)}( ${e} )`:s>i?(e="bool"===r?`all( ${e} )`:`${e}.${"xyz".slice(0,i)}`,this.format(e,this.getTypeFromLength(i,this.getComponentType(t)),r)):4===i&&s>1?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===s?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===s&&i>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r${_t} - Node System\n`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||!0===Ys(this.object).useVelocity}}class YN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return void 0===r&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){const t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateBeforeMap,r);if(t.frameId!==this.frameId){const r=t.frameId;t.frameId=this.frameId,!1===e.updateBefore(this)&&(t.frameId=r)}}else if(t===ri.RENDER){const t=this._getMaps(this.updateBeforeMap,r);if(t.renderId!==this.renderId){const r=t.renderId;t.renderId=this.renderId,!1===e.updateBefore(this)&&(t.renderId=r)}}else t===ri.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateAfterMap,r);t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateAfterMap,r);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateMap,r);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateMap,r);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class ZN{constructor(e,t,r=null,s="",i=!1){this.type=e,this.name=t,this.count=r,this.qualifier=s,this.isConst=i}}ZN.isNodeFunctionInput=!0;class JN extends gv{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class eS extends gv{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:v_(this.light),lightColor:e}}}class tS extends gv{static get type(){return"HemisphereLightNode"}constructor(t=null){super(t),this.lightPositionNode=x_(t),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Sa(new e).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:r,lightDirectionNode:s}=this,i=Rc.dot(s).mul(.5).add(.5),n=gu(r,t,i);e.context.irradiance.addAssign(n)}}class rS extends gv{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Sa(0).setGroup(_a),this.penumbraCosNode=Sa(0).setGroup(_a),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(0).setGroup(_a),this.colorNode=Sa(this.color).setGroup(_a)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:r,penumbraCosNode:s}=this;return bu(r,s,t)}getLightCoord(e){const t=e.getNodeProperties(this);let r=t.projectionUV;return void 0===r&&(r=b_(this.light,e.context.positionWorld),t.projectionUV=r),r}setupDirect(e){const{colorNode:t,cutoffDistanceNode:r,decayExponentNode:s,light:i}=this,n=this.getLightVector(e),a=n.normalize(),o=a.dot(v_(i)),u=this.getSpotAttenuation(e,o),l=n.length(),d=mv({lightDistance:l,cutoffDistance:r,decayExponent:s});let c,h,p=t.mul(u).mul(d);if(i.colorNode?(h=this.getLightCoord(e),c=i.colorNode(h)):i.map&&(h=this.getLightCoord(e),c=Kl(i.map,h.xy).onRenderUpdate(()=>i.map)),c){p=h.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(c),p)}return{lightColor:p,lightDirection:a}}}class sS extends rS{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const r=this.light.iesMap;let s=null;if(r&&!0===r.isTexture){const e=t.acos().mul(1/Math.PI);s=Kl(r,_n(e,0),0).r}else s=super.getSpotAttenuation(t);return s}}class iS extends gv{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new r);this.lightProbe=td(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=pN(Rc,this.lightProbe);e.context.irradiance.addAssign(t)}}const nS=cn(([e,t])=>{const r=e.abs().sub(t);return Go(eu(r,0)).add(Jo(eu(r.x,r.y),0))});class aS extends rS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=yn(0),r=this.penumbraCosNode,s=y_(this.light).mul(e.context.positionWorld||cc);return gn(s.w.greaterThan(0),()=>{const e=s.xyz.div(s.w),i=nS(e.xy.sub(_n(.5)),_n(.5)),n=Ua(-1,Pa(1,Do(r)).sub(1));t.assign(fu(i.mul(-2).mul(n)))}),t}}const oS=new a,uS=new a;let lS=null;class dS extends gv{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Sa(new r).setGroup(_a),this.halfWidth=Sa(new r).setGroup(_a),this.updateType=ri.RENDER}update(e){super.update(e);const{light:t}=this,r=e.camera.matrixWorldInverse;uS.identity(),oS.copy(t.matrixWorld),oS.premultiply(r),uS.extractRotation(oS),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(uS),this.halfHeight.value.applyMatrix4(uS)}setupDirectRectArea(e){let t,r;e.isAvailable("float32Filterable")?(t=Kl(lS.LTC_FLOAT_1),r=Kl(lS.LTC_FLOAT_2)):(t=Kl(lS.LTC_HALF_1),r=Kl(lS.LTC_HALF_2));const{colorNode:s,light:i}=this;return{lightColor:s,lightPosition:__(i),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){lS=e}}class cS{parseFunction(){d("Abstract function.")}}class hS{constructor(e,t,r="",s=""){this.type=e,this.inputs=t,this.name=r,this.precision=s}getCode(){d("Abstract function.")}}hS.isNodeFunction=!0;const pS=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,gS=/[a-z_0-9]+/gi,mS="#pragma main";class fS extends hS{constructor(e){const{type:t,inputs:r,name:s,precision:i,inputsCode:n,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(mS),r=-1!==t?e.slice(t+12):e,s=r.match(pS);if(null!==s&&5===s.length){const i=s[4],n=[];let a=null;for(;null!==(a=gS.exec(i));)n.push(a);const o=[];let u=0;for(;u{let r=this._createNodeBuilder(e,e.material);try{t?await r.buildAsync():r.build()}catch(s){r=this._createNodeBuilder(e,new vg),t?await r.buildAsync():r.build(),o("TSL: "+s)}return r})().then(e=>(s=this._createNodeBuilderState(e),i.set(n,s),s.usedTimes++,r.nodeBuilderState=s,s));{let t=this._createNodeBuilder(e,e.material);try{t.build()}catch(r){t=this._createNodeBuilder(e,new vg),t.build();let s=r.stackTrace;!s&&r.stack&&(s=new Is(r.stack)),o("TSL: "+r,s)}s=this._createNodeBuilderState(t),i.set(n,s)}}s.usedTimes++,r.nodeBuilderState=s}return s}getForRenderAsync(e){const t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){const t=this.get(e);if(void 0!==t.nodeBuilderState)return t.nodeBuilderState;const r=this.getForRenderCacheKey(e),s=this.nodeBuilderCache.get(r);return void 0!==s?(s.usedTimes++,t.nodeBuilderState=s,s):(!0!==t.pendingBuild&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||0===this._buildQueue.length)return;this._buildInProgress=!0;this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;void 0!==t&&(t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){const t=this.get(e);let r=t.nodeBuilderState;if(void 0===r){const s=this.backend.createNodeBuilder(e,this.renderer);s.build(),r=this._createNodeBuilderState(s),t.nodeBuilderState=r}return r}_createNodeBuilderState(e){return new xN(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){bS[0]=e,bS[1]=t;const r=this.renderer.info.calls,s=this.callHashCache.get(bS)||{};if(s.callId!==r){const i=this.getEnvironmentNode(e),n=this.getFogNode(e);t&&xS.push(t.getCacheKey(!0)),i&&xS.push(i.getCacheKey()),n&&xS.push(n.getCacheKey()),xS.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),xS.push(this.renderer.shadowMap.enabled?1:0),xS.push(this.renderer.shadowMap.type),s.callId=r,s.cacheKey=ks(xS),this.callHashCache.set(bS,s),xS.length=0}return bS[0]=null,bS[1]=null,s.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),r=e.background;if(r){const s=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==r||s){const i=this.getCacheNode("background",r,()=>{if(!0===r.isCubeTexture||r.mapping===ce||r.mapping===he||r.mapping===Ee){if(e.backgroundBlurriness>0||r.mapping===Ee)return Vf(r);{let e;return e=!0===r.isCubeTexture?$c(r):Kl(r),Ig(e)}}if(!0===r.isTexture)return Kl(r,ud.flipY()).setUpdateMatrix(!0);!0!==r.isColor&&o("WebGPUNodes: Unsupported background configuration.",r)},s);t.backgroundNode=i,t.background=r,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,s=!1){const i=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let n=i.get(t);return(void 0===n||s)&&(n=r(),i.set(t,n)),n}updateFog(e){const t=this.get(e),r=e.fog;if(r){if(t.fog!==r){const e=this.getCacheNode("fog",r,()=>{if(r.isFogExp2){const e=qc("color","color",r).setGroup(_a),t=qc("density","float",r).setGroup(_a);return ST(e,vT(t))}if(r.isFog){const e=qc("color","color",r).setGroup(_a),t=qc("near","float",r).setGroup(_a),s=qc("far","float",r).setGroup(_a);return ST(e,_T(t,s))}o("Renderer: Unsupported fog configuration.",r)});t.fogNode=e,t.fog=r}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),r=e.environment;if(r){if(t.environment!==r){const e=this.getCacheNode("environment",r,()=>!0===r.isCubeTexture?$c(r):!0===r.isTexture?Kl(r):void o("Nodes: Unsupported environment configuration.",r));t.environmentNode=e,t.environment=r}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,s=null,i=null){const n=this.nodeFrame;return n.renderer=e,n.scene=t,n.object=r,n.camera=s,n.material=i,n}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){const t=this.renderer;return e.isArrayTexture?Kl(e,ud).depth(sd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):Kl(e,ud).renderOutput(t.toneMapping,t.currentColorSpace)}updateBefore(e){const t=e.getNodeBuilderState();for(const r of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(r)}updateAfter(e){const t=e.getNodeBuilderState();for(const r of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(r)}updateForCompute(e){const t=this.getNodeFrame(),r=this.getForCompute(e);for(const e of r.updateNodes)t.updateNode(e)}updateForRender(e){const t=this.getNodeFrameForRender(e),r=e.getNodeBuilderState();for(const e of r.updateNodes)t.updateNode(e)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new YN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const _S=new ut;class vS{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new n,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,r){const s=e.length;for(let i=0;iFl(e,i.toneMapping,i.outputColorSpace)}),LS.set(r,n))}else n=r;i.contextNode=n,i.setRenderTarget(t.renderTarget),t.rendercall(),i.contextNode=r}i.setRenderTarget(o),i._setXRLayerSize(a.x,a.y),this.isPresenting=n}getSession(){return this._session}async setSession(e){const t=this._renderer,r=t.backend;this._gl=t.getContext();const s=this._gl,i=s.getContextAttributes();if(this._session=e,null!==e){if(!0===r.isWebGPUBackend)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await r.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),!0===this._supportsLayers){let r=null,n=null,a=null;t.depth&&(a=t.stencil?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24,r=t.stencil?qe:He,n=t.stencil?Ze:S);const o={colorFormat:s.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const u=this._glBinding.createProjectionLayer(o),l=[u];this._glProjLayer=u,t.setPixelRatio(1),t._setXRLayerSize(u.textureWidth,u.textureHeight);const d=this._useMultiview?2:1,c=new Z(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,r,d);if(this._xrRenderTarget=new MS(u.textureWidth,u.textureHeight,{format:Ae,type:Ve,colorSpace:t.outputColorSpace,depthTexture:c,stencilBuffer:t.stencil,samples:i.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const e of this._layers)e.plane.material=new fe({color:16777215,side:"cylinder"===e.type?L:St}),e.plane.material.blending=Rt,e.plane.material.blendEquation=it,e.plane.material.blendSrc=At,e.plane.material.blendDst=At,e.xrlayer=this._createXRLayer(e),l.unshift(e.xrlayer);e.updateRenderState({layers:l})}else{const r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},i=new XRWebGLLayer(e,s,r);this._glBaseLayer=i,e.updateRenderState({baseLayer:i}),t.setPixelRatio(1),t._setXRLayerSize(i.framebufferWidth,i.framebufferHeight),this._xrRenderTarget=new MS(i.framebufferWidth,i.framebufferHeight,{format:Ae,type:Ve,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===i.ignoreDepthValues,resolveStencilBuffer:!1===i.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(null===t)return;const r=e.near,s=e.far,i=this._cameraXR,n=this._cameraL,a=this._cameraR;i.near=a.near=n.near=r,i.far=a.far=n.far=s,i.isMultiViewCamera=this._useMultiview,this._currentDepthNear===i.near&&this._currentDepthFar===i.far||(t.updateRenderState({depthNear:i.near,depthFar:i.far}),this._currentDepthNear=i.near,this._currentDepthFar=i.far),i.layers.mask=6|e.layers.mask,n.layers.mask=-5&i.layers.mask,a.layers.mask=-3&i.layers.mask;const o=e.parent,u=i.cameras;DS(i,o);for(let e=0;e=0&&(r[n]=null,t[n].disconnect(i))}for(let s=0;s=r.length){r.push(i),n=e;break}if(null===r[e]){r[e]=i,n=e;break}}if(-1===n)break}const a=t[n];a&&a.connect(i)}}function VS(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function kS(e,t){if(void 0===t)return;const r=this._cameraXR,i=this._renderer,n=i.backend,a=this._glBaseLayer,o=this.getReferenceSpace(),u=t.getViewerPose(o);if(this._xrFrame=t,null!==u){const e=u.views;null!==this._glBaseLayer&&n.setXRTarget(a.framebuffer);let t=!1;e.length!==r.cameras.length&&(r.cameras.length=0,t=!0);for(let i=0;i{await this.compileAsync(e,t);const s=this._renderLists.get(e,t),i=this._renderContexts.get(this._renderTarget,this._mrt),n=e.overrideMaterial||r.material,a=this._objects.get(r,n,e,t,s.lightsNode,i,i.clippingContext),{fragmentShader:o,vertexShader:u}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:u}}}}async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=r=this._getFallback(e),await r.init(this)}catch(e){return void t(e)}}this._nodes=new TS(this,r),this._animation=new xy(this,this._nodes,this.info),this._attributes=new By(r,this.info),this._background=new fN(this,this._nodes),this._geometries=new Dy(this._attributes,this.info),this._textures=new tb(this,r,this.info),this._pipelines=new zy(r,this._nodes,this.info),this._bindings=new $y(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new Sy(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Ky(this.lighting),this._bundles=new RS,this._renderContexts=new Jy(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const s=this._nodes.nodeFrame,i=s.renderId,n=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._handleObjectFunction,u=this._compilationPromises;null===r&&(r=e);const l=!0===e.isScene?e:!0===r.isScene?r:$S,d=this.needsFrameBufferTarget&&null===this._renderTarget?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,c=this._renderContexts.get(d,this._mrt),h=this._activeMipmapLevel,p=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,s.renderId++,s.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new vS),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,d);const g=this._renderLists.get(l,t);if(g.begin(),this._projectObject(e,t,0,g,c.clippingContext),r!==e&&r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&g.pushLight(e)}),g.finish(),null!==d){this._textures.updateRenderTarget(d,h);const e=this._textures.get(d);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;r!==e?this._background.update(r,g,c):this._background.update(l,g,c);const m=g.opaque,f=g.transparent,y=g.transparentDoublePass,b=g.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,l,b),!0===this.transparent&&f.length>0&&this._renderTransparents(f,y,t,l,b),s.renderId=i,this._currentRenderContext=n,this._currentRenderObjectFunction=a,this._handleObjectFunction=o,this._compilationPromises=u;for(const e of p){const t=this._objects.get(e.object,e.material,e.scene,e.camera,e.lightsNode,e.renderContext,e.clippingContext,e.passId);t.drawRange=e.object.geometry.drawRange,t.group=e.group,this._geometries.updateForRender(t),await this._nodes.getForRenderAsync(t),this._nodes.updateBefore(t),this._nodes.updateForRender(t),this._bindings.updateForRender(t);const r=[];this._pipelines.getForRender(t,r),r.length>0&&await Promise.all(r),this._nodes.updateAfter(t),await Tt()}}async renderAsync(e,t){v('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){o("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;!0===e?(t.modelViewMatrix=nc,t.modelNormalViewMatrix=ac):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===nc&&e.modelNormalViewMatrix===ac}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return v('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),o(t),this._isDeviceLost=!0}_renderBundle(e,t,r){const{bundleGroup:s,camera:i,renderList:n}=e,a=this._currentRenderContext,o=this._bundles.get(s,i,a),u=this.backend.get(o),l=s.version!==u.version;if(l||void 0===u.bundleGPU){this.backend.beginBundle(a),(void 0===u.renderObjects||l)&&(u.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:d,opaque:c}=n;!0===this.opaque&&c.length>0&&this._renderObjects(c,i,t,r),!0===this.transparent&&d.length>0&&this._renderTransparents(d,e,i,t,r),this._currentRenderBundle=null,this.backend.finishBundle(a,o),u.version=s.version}else{const{renderObjects:e}=u;for(let t=0,r=e.length;t{u.removeEventListener("dispose",e),l.dispose(),this._frameBufferTargets.delete(u)};u.addEventListener("dispose",e),this._frameBufferTargets.set(u,l)}const d=this.getOutputRenderTarget();l.depthBuffer=a,l.stencilBuffer=o,null!==d?l.setSize(d.width,d.height,d.depth):l.setSize(i,n,1);const c=this._outputRenderTarget?this._outputRenderTarget.viewport:u._viewport,h=this._outputRenderTarget?this._outputRenderTarget.scissor:u._scissor,g=this._outputRenderTarget?1:u._pixelRatio,f=this._outputRenderTarget?this._outputRenderTarget.scissorTest:u._scissorTest;return l.viewport.copy(c),l.scissor.copy(h),l.viewport.multiplyScalar(g),l.scissor.multiplyScalar(g),l.scissorTest=f,l.multiview=null!==d&&d.multiview,l.resolveDepthBuffer=null===d||d.resolveDepthBuffer,l._autoAllocateDepthBuffer=null!==d&&d._autoAllocateDepthBuffer,l}_renderScene(e,t,r=!0){if(!0===this._isDeviceLost)return;const s=r?this._getFrameBufferTarget():null,i=this._nodes.nodeFrame,n=i.renderId,a=this._currentRenderContext,o=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;const l=!0===e.isScene?e:$S,d=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,h=this._activeMipmapLevel;let p;if(null!==s?(p=s,this.setRenderTarget(p)):p=d,null!==p&&!0===p.depthBuffer){const e=this._textures.get(p);!0!==e.depthInitialized&&((!1===this.autoClear||!0===this.autoClear&&!1===this.autoClearDepth)&&this.clearDepth(),e.depthInitialized=!0)}const g=this._renderContexts.get(p,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,i.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,p);const m=this.xr;if(!1===m.isPresenting){let e=!1;if(!0===this.reversedDepthBuffer&&!0!==t.reversedDepth){if(t._reversedDepth=!0,t.isArrayCamera)for(const e of t.cameras)e._reversedDepth=!0;e=!0}const r=this.coordinateSystem;if(t.coordinateSystem!==r){if(t.coordinateSystem=r,t.isArrayCamera)for(const e of t.cameras)e.coordinateSystem=r;e=!0}if(!0===e&&(t.updateProjectionMatrix(),t.isArrayCamera))for(const e of t.cameras)e.updateProjectionMatrix()}!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===m.enabled&&!0===m.isPresenting&&(!0===m.cameraAutoUpdate&&m.updateCamera(t),t=m.getCamera());const f=this._canvasTarget;let y=f._viewport,b=f._scissor,x=f._pixelRatio;null!==p&&(y=p.viewport,b=p.scissor,x=1),this.getDrawingBufferSize(WS),HS.set(0,0,WS.width,WS.height);const T=void 0===y.minDepth?0:y.minDepth,_=void 0===y.maxDepth?1:y.maxDepth;g.viewportValue.copy(y).multiplyScalar(x).floor(),g.viewportValue.width>>=h,g.viewportValue.height>>=h,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=_,g.viewport=!1===g.viewportValue.equals(HS),g.scissorValue.copy(b).multiplyScalar(x).floor(),g.scissor=f._scissorTest&&!1===g.scissorValue.equals(HS),g.scissorValue.width>>=h,g.scissorValue.height>>=h,g.clippingContext||(g.clippingContext=new vS),g.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,p);const v=t.isArrayCamera?jS:qS;t.isArrayCamera||(XS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),v.setFromProjectionMatrix(XS,t.coordinateSystem,t.reversedDepth));const N=this._renderLists.get(e,t);if(N.begin(),this._projectObject(e,t,0,N,g.clippingContext),N.finish(),!0===this.sortObjects&&N.sort(this._opaqueSort,this._transparentSort),null!==p){this._textures.updateRenderTarget(p,h);const e=this._textures.get(p);g.textures=e.textures,g.depthTexture=e.depthTexture,g.width=e.width,g.height=e.height,g.renderTarget=p,g.depth=p.depthBuffer,g.stencil=p.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=WS.width,g.height=WS.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=h,g.height>>=h,g.activeCubeFace=c,g.activeMipmapLevel=h,g.occlusionQueryCount=N.occlusionQueryCount,g.scissorValue.max(KS.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(l,N,g),g.camera=t,this.backend.beginRender(g);const{bundles:S,lightsNode:R,transparentDoublePass:A,transparent:E,opaque:w}=N;return S.length>0&&this._renderBundles(S,l,R),!0===this.opaque&&w.length>0&&this._renderObjects(w,t,l,R),!0===this.transparent&&E.length>0&&this._renderTransparents(E,A,t,l,R),this.backend.finishRender(g),i.renderId=n,this._currentRenderContext=a,this._currentRenderObjectFunction=o,this._handleObjectFunction=u,this._callDepth--,null!==s&&(this.setRenderTarget(d,c,h),this._renderOutput(p)),l.onAfterRender(this,e,t,p),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._nodes.getOutputCacheKey();let r,s=this._quadCache.get(e.texture);if(void 0===s){r=new gx(new vg),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),s={quad:r,cacheKey:t},this._quadCache.set(e.texture,s);const i=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",i)};e.texture.addEventListener("dispose",i)}else r=s.quad,s.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,s.cacheKey=t);const i=this.autoClear,n=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(r,r.camera,!1),this.autoClear=i,this.xr.enabled=n}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){let t=e;if(!0!==t.isReadbackBuffer){const r=e,s=this.backend.get(r);if(t=s.readbackBuffer,void 0===t){t=new zS(r);const e=()=>{r.removeEventListener("dispose",e),t.dispose(),delete s.readbackBuffer};r.addEventListener("dispose",e),s.readbackBuffer=t}}if(!1===this.info.memoryMap.has(t)){this.info.createReadbackBuffer(t);const e=()=>{t.removeEventListener("dispose",e),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",e)}return t.release(),await this.backend.getArrayBufferAsync(t)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,s){this._canvasTarget.setScissor(e,t,r,s)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,s,i=0,n=1){this._canvasTarget.setViewport(e,t,r,s,i,n)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return!0===this.reversedDepthBuffer?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(!1===this._initialized)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const s=this._renderTarget||this._getFrameBufferTarget();let i=null;if(null!==s){this._textures.updateRenderTarget(s);const e=this._textures.get(s);i=this._renderContexts.get(s,null,-1),i.textures=e.textures,i.depthTexture=e.depthTexture,i.width=e.width,i.height=e.height,i.renderTarget=s,i.depth=s.depthBuffer,i.stencil=s.stencilBuffer;const t=this.backend.getClearColor();i.clearColorValue.r=t.r,i.clearColorValue.g=t.g,i.clearColorValue.b=t.b,i.clearColorValue.a=t.a,i.clearDepthValue=this.getClearDepth(),i.clearStencilValue=this.getClearStencil(),i.activeCubeFace=this.getActiveCubeFace(),i.activeMipmapLevel=this.getActiveMipmapLevel(),!0===s.depthBuffer&&(e.depthInitialized=!0)}this.backend.clear(e,t,r,i),null!==s&&null===this._renderTarget&&this._renderOutput(s)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){v('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){v('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){v('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){v('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==m,t=this.currentColorSpace!==p.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:m}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:p.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){if(!0===this._initialized){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(const e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(const e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return d("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const r=this._nodes.nodeFrame,s=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const i=this.backend,n=this._pipelines,a=this._bindings,o=this._nodes,u=Array.isArray(e)?e:[e];if(void 0===u[0]||!0!==u[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");i.beginCompute(e);for(const r of u){if(!1===n.has(r)){const e=()=>{r.removeEventListener("dispose",e),n.delete(r),a.deleteForCompute(r),o.delete(r)};r.addEventListener("dispose",e);const t=r.onInitFunction;null!==t&&t.call(r,{renderer:this})}o.updateForCompute(r),a.updateForCompute(r);const s=a.getForCompute(r),u=n.getForCompute(r,s);i.compute(e,r,s,u,t)}i.finishCompute(e),r.renderId=s,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return v('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){v('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(!1===this._initialized)throw new Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=KS.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void o("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=KS.copy(t).floor()}else t=KS.set(0,0,e.image.width,e.image.height);let r,s=this._currentRenderContext;null!==s?r=s.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),null!==r&&(this._textures.updateRenderTarget(r),s=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,s,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,s=null,i=0,n=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,s,i,n),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,s,i,n=0,a=0){return this.backend.copyTextureToBuffer(e.textures[n],t,r,s,i,a)}_projectObject(e,t,r,s,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(i=i.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)s.pushLight(e);else if(e.isSprite){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsSprite(e,t)){!0===this.sortObjects&&KS.setFromMatrixPosition(e.matrixWorld).applyMatrix4(XS);const{geometry:t,material:n}=e;n.visible&&s.push(e,t,n,r,KS.z,null,i)}}else if(e.isLineLoop)o("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsObject(e,t)){const{geometry:t,material:n}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),KS.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(XS)),Array.isArray(n)){const a=t.groups;for(let o=0,u=a.length;o0){for(const{material:e}of t)e.side=L;this._renderObjects(t,r,s,i,"backSide");for(const{material:e}of t)e.side=St;this._renderObjects(e,r,s,i);for(const{material:e}of t)e.side=P}else this._renderObjects(e,r,s,i)}_renderObjects(e,t,r,s,i=null){for(let n=0,a=e.length;n(t.not().discard(),e))(u)}}e.depthNode&&e.depthNode.isNode&&(l=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:u,depthNode:l,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}renderObject(e,t,r,s,i,n,a,o=null,u=null){let l,d,c,h,p=!1;if(e.onBeforeRender(this,t,r,s,i,n),!0===i.allowOverride&&null!==t.overrideMaterial){const e=t.overrideMaterial;if(p=!0,l=e.isNodeMaterial?e.colorNode:null,d=e.isNodeMaterial?e.depthNode:null,c=e.isNodeMaterial?e.positionNode:null,h=t.overrideMaterial.side,i.positionNode&&i.positionNode.isNode&&(e.positionNode=i.positionNode),e.alphaTest=i.alphaTest,e.alphaMap=i.alphaMap,e.transparent=i.transparent||i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode||i.backdropNode&&i.backdropNode.isNode,e.isShadowPassMaterial){const{colorNode:t,depthNode:r,positionNode:s}=this._getShadowNodes(i);this.shadowMap.type===pt?e.side=null!==i.shadowSide?i.shadowSide:i.side:e.side=null!==i.shadowSide?i.shadowSide:QS[i.side],null!==t&&(e.colorNode=t),null!==r&&(e.depthNode=r),null!==s&&(e.positionNode=s)}i=e}!0===i.transparent&&i.side===P&&!1===i.forceSinglePass?(i.side=L,this._handleObjectFunction(e,i,t,r,a,n,o,"backSide"),i.side=St,this._handleObjectFunction(e,i,t,r,a,n,o,u),i.side=P):this._handleObjectFunction(e,i,t,r,a,n,o,u),p&&(t.overrideMaterial.colorNode=l,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=h),e.onAfterRender(this,t,r,s,i,n)}hasCompatibility(e){if(!1===this._initialized)throw new Error('Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,s,i,n,a,o){const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);if(u.drawRange=e.geometry.drawRange,u.group=n,null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(u),u.bundle=this._currentRenderBundle.bundleGroup}const l=this._nodes.needsRefresh(u);l&&(this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u)),this._pipelines.updateForRender(u),this._pipelines.isReady(u)&&(this.backend.draw(u,this.info),l&&this._nodes.updateAfter(u))}_createObjectPipeline(e,t,r,s,i,n,a,o){if(null!==this._compilationPromises)return void this._compilationPromises.push({object:e,material:t,scene:r,camera:s,lightsNode:i,group:n,clippingContext:a,passId:o,renderContext:this._currentRenderContext});const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);u.drawRange=e.geometry.drawRange,u.group=n,this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u),this._pipelines.getForRender(u,this._compilationPromises),this._nodes.updateAfter(u)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class ZS{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}class JS extends ZS{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return(e=this._buffer.byteLength)+(My-e%My)%My;var e}get buffer(){return this._buffer}update(){return!0}}class eR extends JS{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let tR=0;class rR extends eR{constructor(e,t){super("UniformBuffer_"+tR++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class sR extends eR{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){const t=e.index;if(!0!==this._updateRangeCache.has(t)){const r=this.updateRanges,s={start:e.offset,count:e.itemSize};r.push(s),this._updateRangeCache.set(t,s)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let r=0,s=this.uniforms.length;r{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let oR=0;class uR extends aR{constructor(e,t){super(e,t),this.id=oR++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class lR extends uR{constructor(e,t,r,s=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=s}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class dR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledCubeTexture=!0}}class cR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledTexture3D=!0}}const hR={bitcast_int_uint:new fT("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new fT("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},pR={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},gR={low:"lowp",medium:"mediump",high:"highp"},mR={swizzleAssign:!0,storageBuffer:!1},fR={perspective:"smooth",linear:"noperspective"},yR={centroid:"centroid"},bR="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision highp sampler2DShadow;\nprecision highp sampler2DArrayShadow;\nprecision highp samplerCubeShadow;\n";class xR extends QN{constructor(e,t){super(e,t,new yS),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==T}_include(e){const t=hR[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==hR[e]&&this._include(e),pR[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {\n\n\t${r.vars}\n\n${r.code}\n\treturn ${r.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,r=t.count*t.itemSize,{itemSize:s}=t,i=t.array.constructor.name.toLowerCase().includes("int");let n=i?We:$e;2===s?n=i?je:$:3===s?n=i?Ke:Xe:4===s&&(n=i?Lt:Ae);const a={Float32Array:K,Uint8Array:Ve,Uint16Array:Ge,Uint32Array:S,Int8Array:Oe,Int16Array:ke,Int32Array:R,Uint8ClampedArray:Ve},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let u=Math.ceil(r/s/o);o*u*s0?i:"";t=`${r.name} {\n\t${s} ${e.name}[${n}];\n};\n`}else{const t=e.groupNode.name;if(void 0===s[t]){const e=this.uniformGroups[t];if(void 0!==e){const r=[];for(const t of e.uniforms){const e=t.getType(),s=this.getVectorType(e),i=t.nodeUniform.node.precision;let n=`${s} ${t.name};`;null!==i&&(n=gR[i]+" "+n),r.push("\t"+n)}s[t]=r}}i=!0}if(!i){const s=e.node.precision;null!==s&&(t=gR[s]+" "+t),t="uniform "+t,r.push(t)}}let i="";for(const e in s){const t=s[e];i+=this._getGLSLUniformStruct(e,t.join("\n"))+"\n"}return i+=r.join("\n"),i}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==R){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);const s=r.array;!1==(s instanceof Uint32Array||s instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let r=0;for(const s of e)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};\n`}return t}getStructMembers(e){const t=[];for(const r of e.members)t.push(`\t${r.type} ${r.name};`);return t.join("\n")}getStructs(e){const t=[],r=this.structs[e],s=[];for(const e of r)if(e.output)for(const t of e.members)s.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let r="struct "+e.name+" {\n";r+=this.getStructMembers(e),r+="\n};\n",t.push(r)}return 0===s.length&&s.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+s.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const r=this.varyings;if("vertex"===e||"compute"===e)for(const s of r){"compute"===e&&(s.needsInterpolation=!0);const r=this.getType(s.type);if(s.needsInterpolation)if(s.interpolationType){t+=`${fR[s.interpolationType]||s.interpolationType} ${yR[s.interpolationSampling]||""} out ${r} ${s.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}out ${r} ${s.name};\n`}else t+=`${r} ${s.name};\n`}else if("fragment"===e)for(const e of r)if(e.needsInterpolation){const r=this.getType(e.type);if(e.interpolationType){t+=`${fR[e.interpolationType]||e.interpolationType} ${yR[e.interpolationSampling]||""} in ${r} ${e.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}in ${r} ${e.name};\n`}}for(const r of this.builtins[e])t+=`${r};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,r=this.shaderStage){const s=this.extensions[r]||(this.extensions[r]=new Map);!1===s.has(e)&&s.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const r=this.extensions[e];if(void 0!==r)for(const{name:e,behavior:s}of r.values())t.push(`#extension ${e} : ${s}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=mR[e];if(void 0===t){let r;switch(t=!1,e){case"float32Filterable":r="OES_texture_float_linear";break;case"clipDistance":r="WEBGL_clip_cull_distance"}if(void 0!==r){const e=this.renderer.backend.extensions;e.has(r)&&(e.get(r),t=!0)}mR[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let r=0;r0&&(r+="\n"),r+=`\t// flow -> ${n}\n\t`),r+=`${s.code}\n\t`,e===i&&"compute"!==t&&(r+="// result\n\t","vertex"===t?(r+="gl_Position = ",r+=`${s.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(r+="fragColor = ",r+=`${s.result};`)))}const n=e[t];if(n.extensions=this.getExtensions(t),n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.vars=this.getVars(t,!0),n.structs=this.getStructs(t),n.codes=this.getCodes(t),n.transforms=this.getTransforms(t),n.flow=r,"vertex"===t){const e=this.renderer.backend.extensions;this.object.isBatchedMesh&&!1===e.has("WEBGL_multi_draw")&&(n.uniforms+="\nuniform uint nodeUniformDrawId;\n")}}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);let a=n.uniformGPU;if(void 0===a){const s=e.groupNode,o=s.name,u=this.getBindGroupArray(o,r);if("texture"===t)a=new lR(i.name,i.node,s),u.push(a);else if("cubeTexture"===t||"cubeDepthTexture"===t)a=new dR(i.name,i.node,s),u.push(a);else if("texture3D"===t)a=new cR(i.name,i.node,s),u.push(a);else if("buffer"===t){i.name=`buffer${e.id}`;const t=this.getSharedDataFromNode(e);let r=t.buffer;void 0===r&&(e.name=`NodeBuffer_${e.id}`,r=new rR(e,s),r.name=e.name,t.buffer=r),u.push(r),a=r}else{let e=this.uniformGroups[o];void 0===e?(e=new nR(o,s),this.uniformGroups[o]=e,u.push(e)):-1===u.indexOf(e)&&u.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}}let TR=null,_R=null;class vR{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Pt.RENDER]:null,[Pt.COMPUTE]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),r=this.renderer.info.frame;let s;s=!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls,t.timestampUID=s+":"+e.id+":f"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?Pt.COMPUTE:Pt.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void v("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return;const r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return TR=TR||new t,this.renderer.getDrawingBufferSize(TR)}setScissorTest(){}getClearColor(){const e=this.renderer;return _R=_R||new rb,e.getClearColor(_R),_R.getRGB(_R),_R}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Dt(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${_t} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let NR,SR,RR=0;class AR{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class ER{constructor(e){this.backend=e}createAttribute(e,t){const r=this.backend,{gl:s}=r,i=e.array,n=e.usage||s.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=r.get(a);let u,l=o.bufferGPU;if(void 0===l&&(l=this._createBuffer(s,t,i,n),o.bufferGPU=l,o.bufferType=t,o.version=a.version),i instanceof Float32Array)u=s.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)u=s.HALF_FLOAT;else if(i instanceof Uint16Array)u=e.isFloat16BufferAttribute?s.HALF_FLOAT:s.UNSIGNED_SHORT;else if(i instanceof Int16Array)u=s.SHORT;else if(i instanceof Uint32Array)u=s.UNSIGNED_INT;else if(i instanceof Int32Array)u=s.INT;else if(i instanceof Int8Array)u=s.BYTE;else if(i instanceof Uint8Array)u=s.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+i);u=s.UNSIGNED_BYTE}let d={bufferGPU:l,bufferType:t,type:u,byteLength:i.byteLength,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===s.INT||u===s.UNSIGNED_INT||e.gpuType===R,id:RR++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(s,t,i,n);d=new AR(d,e)}r.set(e,d)}updateAttribute(e){const t=this.backend,{gl:r}=t,s=e.array,i=e.isInterleavedBufferAttribute?e.data:e,n=t.get(i),a=n.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(a,n.bufferGPU),0===o.length)r.bufferSubData(a,0,s);else{for(let e=0,t=o.length;e{r.deleteBuffer(l),t.delete(e),e.removeEventListener("dispose",s)};e.addEventListener("dispose",s),u.writeBuffer=l}else r.bindBuffer(r.COPY_WRITE_BUFFER,l);r.copyBufferSubData(r.COPY_READ_BUFFER,r.COPY_WRITE_BUFFER,0,0,o),await t.utils._clientWaitAsync();const d=new s.array.constructor(a.length);return r.bindBuffer(r.COPY_WRITE_BUFFER,l),r.getBufferSubData(r.COPY_WRITE_BUFFER,0,d),r.bindBuffer(r.COPY_READ_BUFFER,null),r.bindBuffer(r.COPY_WRITE_BUFFER,null),d}_createBuffer(e,t,r,s){const i=e.createBuffer();return e.bindBuffer(t,i),e.bufferData(t,r,s),e.bindBuffer(t,null),i}}class wR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;NR={[it]:e.FUNC_ADD,[It]:e.FUNC_SUBTRACT,[Ut]:e.FUNC_REVERSE_SUBTRACT},SR={[At]:e.ZERO,[Ht]:e.ONE,[Wt]:e.SRC_COLOR,[rt]:e.SRC_ALPHA,[$t]:e.SRC_ALPHA_SATURATE,[zt]:e.DST_COLOR,[Gt]:e.DST_ALPHA,[kt]:e.ONE_MINUS_SRC_COLOR,[st]:e.ONE_MINUS_SRC_ALPHA,[Vt]:e.ONE_MINUS_DST_COLOR,[Ot]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=(new s).fromArray(t),this.currentViewport=(new s).fromArray(r),this._tempVec4=new s}enable(e){const{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==qt?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===jt?t.cullFace(t.BACK):e===Xt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){const s=this.gl,i=this.backend.drawBuffersIndexedExt;if(i)for(let n=0;n0?this.enable(s.SAMPLE_ALPHA_TO_COVERAGE):this.disable(s.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r){const e=12288;for(let t=0;t<8;t++)t{!function i(){const n=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(n===e.WAIT_FAILED)return e.deleteSync(t),void s();n!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),r()):requestAnimationFrame(i)}()})}}let MR,BR,FR,LR=!1;class PR{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===LR&&(this._init(),LR=!0)}_init(){const e=this.gl;MR={[kr]:e.REPEAT,[_e]:e.CLAMP_TO_EDGE,[Vr]:e.MIRRORED_REPEAT},BR={[B]:e.NEAREST,[Gr]:e.NEAREST_MIPMAP_NEAREST,[bt]:e.NEAREST_MIPMAP_LINEAR,[le]:e.LINEAR,[yt]:e.LINEAR_MIPMAP_NEAREST,[Y]:e.LINEAR_MIPMAP_LINEAR},FR={[Hr]:e.NEVER,[Wr]:e.ALWAYS,[E]:e.LESS,[w]:e.LEQUAL,[$r]:e.EQUAL,[M]:e.GEQUAL,[C]:e.GREATER,[zr]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let r;return r=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,r}getInternalFormat(e,t,r,s,i,n=!1){const{gl:a,extensions:o}=this;if(null!==e){if(void 0!==a[e])return a[e];d("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=null;s&&(u=o.get("EXT_texture_norm16"),u||d("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let l=t;if(t===a.RED&&(r===a.FLOAT&&(l=a.R32F),r===a.HALF_FLOAT&&(l=a.R16F),r===a.UNSIGNED_BYTE&&(l=a.R8),r===a.BYTE&&(l=a.R8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.R16_EXT),r===a.SHORT&&u&&(l=u.R16_SNORM_EXT)),t===a.RED_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.R8UI),r===a.UNSIGNED_SHORT&&(l=a.R16UI),r===a.UNSIGNED_INT&&(l=a.R32UI),r===a.BYTE&&(l=a.R8I),r===a.SHORT&&(l=a.R16I),r===a.INT&&(l=a.R32I)),t===a.RG&&(r===a.FLOAT&&(l=a.RG32F),r===a.HALF_FLOAT&&(l=a.RG16F),r===a.UNSIGNED_BYTE&&(l=a.RG8),r===a.BYTE&&(l=a.RG8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RG16_EXT),r===a.SHORT&&u&&(l=u.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RG8UI),r===a.UNSIGNED_SHORT&&(l=a.RG16UI),r===a.UNSIGNED_INT&&(l=a.RG32UI),r===a.BYTE&&(l=a.RG8I),r===a.SHORT&&(l=a.RG16I),r===a.INT&&(l=a.RG32I)),t===a.RGB){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGB32F),r===a.HALF_FLOAT&&(l=a.RGB16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8:a.RGB8),r===a.BYTE&&(l=a.RGB8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGB16_EXT),r===a.SHORT&&u&&(l=u.RGB16_SNORM_EXT),r===a.UNSIGNED_SHORT_5_6_5&&(l=a.RGB565),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGB4),r===a.UNSIGNED_INT_5_9_9_9_REV&&(l=a.RGB9_E5),r===a.UNSIGNED_INT_10F_11F_11F_REV&&(l=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGB8UI),r===a.UNSIGNED_SHORT&&(l=a.RGB16UI),r===a.UNSIGNED_INT&&(l=a.RGB32UI),r===a.BYTE&&(l=a.RGB8I),r===a.SHORT&&(l=a.RGB16I),r===a.INT&&(l=a.RGB32I)),t===a.RGBA){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGBA32F),r===a.HALF_FLOAT&&(l=a.RGBA16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8_ALPHA8:a.RGBA8),r===a.BYTE&&(l=a.RGBA8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGBA16_EXT),r===a.SHORT&&u&&(l=u.RGBA16_SNORM_EXT),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGBA4),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGBA8UI),r===a.UNSIGNED_SHORT&&(l=a.RGBA16UI),r===a.UNSIGNED_INT&&(l=a.RGBA32UI),r===a.BYTE&&(l=a.RGBA8I),r===a.SHORT&&(l=a.RGBA16I),r===a.INT&&(l=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(r===a.UNSIGNED_SHORT&&(l=a.DEPTH_COMPONENT16),r===a.UNSIGNED_INT&&(l=a.DEPTH_COMPONENT24),r===a.FLOAT&&(l=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&r===a.UNSIGNED_INT_24_8&&(l=a.DEPTH24_STENCIL8),l!==a.R16F&&l!==a.R32F&&l!==a.RG16F&&l!==a.RG32F&&l!==a.RGBA16F&&l!==a.RGBA32F||o.get("EXT_color_buffer_float"),l}setTextureParameters(e,t){const{gl:r,extensions:s,backend:i}=this,{state:n}=this.backend,a=p.getPrimaries(p.workingColorSpace),o=t.colorSpace===T?null:p.getPrimaries(t.colorSpace),u=t.colorSpace===T||a===o?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,u),r.texParameteri(e,r.TEXTURE_WRAP_S,MR[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,MR[t.wrapT]),e!==r.TEXTURE_3D&&e!==r.TEXTURE_2D_ARRAY||t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,MR[t.wrapR]),r.texParameteri(e,r.TEXTURE_MAG_FILTER,BR[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,d=t.minFilter===le&&l?Y:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,BR[d]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,FR[t.compareFunction])),!0===s.has("EXT_texture_filter_anisotropic")){if(t.magFilter===B)return;if(t.minFilter!==bt&&t.minFilter!==Y)return;if(t.type===K&&!1===s.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const n=s.get("EXT_texture_filter_anisotropic");r.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:r,defaultTextures:s}=this,i=this.getGLTextureType(e);let n=s[i];void 0===n&&(n=t.createTexture(),r.state.bindTexture(i,n),t.texParameteri(i,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(i,t.TEXTURE_MAG_FILTER,t.NEAREST),s[i]=n),r.set(e,{textureGPU:n,glTextureType:i})}createTexture(e,t){const{gl:r,backend:s}=this,{levels:i,width:n,height:a,depth:o}=t,u=s.utils.convert(e.format,e.colorSpace),l=s.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,u,l,e.normalized,e.colorSpace,e.isVideoTexture),c=r.createTexture(),h=this.getGLTextureType(e);s.state.bindTexture(h,c),this.setTextureParameters(h,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,i,d,n,a,o):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,i,d,n,a,o):e.isVideoTexture||r.texStorage2D(h,i,d,n,a),s.set(e,{textureGPU:c,glTextureType:h,glFormat:u,glType:l,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:r,backend:s}=this,{state:i}=s,{textureGPU:n,glTextureType:a,glFormat:o,glType:u}=s.get(t),{width:l,height:d}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),s.state.bindTexture(a,n),i.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(a,0,0,0,l,d,o,u,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),s.state.unbindTexture()}updateTexture(e,t){const{gl:r}=this,{width:s,height:i}=t,{textureGPU:n,glTextureType:a,glFormat:o,glType:u,glInternalFormat:l}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==n)if(this.backend.state.bindTexture(a,n),this.setTextureParameters(a,e),e.isCompressedTexture){const s=e.mipmaps,i=t.image;for(let t=0;t0){const t=jr(s.width,s.height,e.format,e.type);for(const i of e.layerUpdates){const e=s.data.subarray(i*t/s.data.BYTES_PER_ELEMENT,(i+1)*t/s.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,i,s.width,s.height,1,o,u,e)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,s.width,s.height,s.depth,o,u,s.data)}else if(e.isData3DTexture){const e=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,u,e.data)}else if(e.isVideoTexture)e.update(),r.texImage2D(a,0,l,o,u,t.image);else{const n=e.mipmaps;if(n.length>0)for(let e=0,t=n.length;e0,c=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(d){const r=0!==a||0!==o;let d,h;if(!0===e.isDepthTexture?(d=s.DEPTH_BUFFER_BIT,h=s.DEPTH_ATTACHMENT,t.stencil&&(d|=s.STENCIL_BUFFER_BIT)):(d=s.COLOR_BUFFER_BIT,h=s.COLOR_ATTACHMENT0),r){const e=this.backend.get(t.renderTarget),r=e.framebuffers[t.getCacheKey()],h=e.msaaFrameBuffer;i.bindFramebuffer(s.DRAW_FRAMEBUFFER,r),i.bindFramebuffer(s.READ_FRAMEBUFFER,h);const p=c-o-l;s.blitFramebuffer(a,p,a+u,p+l,a,p,a+u,p+l,d,s.NEAREST),i.bindFramebuffer(s.READ_FRAMEBUFFER,r),i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,p,u,l),i.unbindTexture()}else{const e=s.createFramebuffer();i.bindFramebuffer(s.DRAW_FRAMEBUFFER,e),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,h,s.TEXTURE_2D,n,0),s.blitFramebuffer(0,0,u,l,0,0,u,l,d,s.NEAREST),s.deleteFramebuffer(e)}}else i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,c-l-o,u,l),i.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,s=!1){const{gl:i}=this,n=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:u,width:l,height:d}=n;if(i.bindRenderbuffer(i.RENDERBUFFER,e),o&&!u){let t=i.DEPTH_COMPONENT24;if(!0===s){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(i.RENDERBUFFER,n.samples,t,l,d)}else r>0?(a&&a.isDepthTexture&&a.type===i.FLOAT&&(t=i.DEPTH_COMPONENT32F),i.renderbufferStorageMultisample(i.RENDERBUFFER,r,t,l,d)):i.renderbufferStorage(i.RENDERBUFFER,t,l,d);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e)}else o&&u&&(r>0?i.renderbufferStorageMultisample(i.RENDERBUFFER,r,i.DEPTH24_STENCIL8,l,d):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,l,d),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e));i.bindRenderbuffer(i.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,s,i,n){const{backend:a,gl:o}=this,{textureGPU:u,glFormat:l,glType:d}=this.backend.get(e),c=o.createFramebuffer();a.state.bindFramebuffer(o.READ_FRAMEBUFFER,c);const h=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+n:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,u,0);const p=this._getTypedArrayType(d),g=s*i*this._getBytesPerTexel(d,l),m=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.bufferData(o.PIXEL_PACK_BUFFER,g,o.STREAM_READ),o.readPixels(t,r,s,i,l,d,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const f=new p(g/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,f),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(c),f}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:r}=this;let s=0;return e===r.UNSIGNED_BYTE&&(s=1),e!==r.UNSIGNED_SHORT_4_4_4_4&&e!==r.UNSIGNED_SHORT_5_5_5_1&&e!==r.UNSIGNED_SHORT_5_6_5&&e!==r.UNSIGNED_SHORT&&e!==r.HALF_FLOAT||(s=2),e!==r.UNSIGNED_INT&&e!==r.FLOAT||(s=4),t===r.RGBA?4*s:t===r.RGB?3*s:t===r.ALPHA?s:void 0}dispose(){const{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function DR(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class UR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class IR{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(null!==this.maxUniformBlockSize)return this.maxUniformBlockSize;const e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}}const OR={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class VR{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:r,mode:s,object:i,type:n,info:a,index:o}=this;0!==o?r.drawElements(s,t,n,e):r.drawArrays(s,e,t),a.update(i,t,1)}renderInstances(e,t,r){const{gl:s,mode:i,type:n,index:a,object:o,info:u}=this;0!==r&&(0!==a?s.drawElementsInstanced(i,t,n,e,r):s.drawArraysInstanced(i,e,t,r),u.update(o,t,r))}renderMultiDraw(e,t,r){const{extensions:s,mode:i,object:n,info:a}=this;if(0===r)return;const o=s.get("WEBGL_multi_draw");if(null===o)for(let s=0;sthis.maxQueries)return v(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null==t)return;if(null!==this.activeQuery)return;const r=this.queries[t];if(r)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){o("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){o("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[t,r]of this.queryOffsets){if("ended"===this.queryStates.get(r)){const s=this.queries[r];e.set(t,this.resolveQuery(s))}}if(0===e.size)return this.lastValue;const t={},r=[];for(const[s,i]of e){const e=s.match(/^(.*):f(\d+)$/),n=parseInt(e[2]);!1===r.includes(n)&&r.push(n),void 0===t[n]&&(t[n]=0);const a=await i;this.timestamps.set(s,a),t[n]+=a}const s=t[r[r.length-1]];return this.lastValue=s,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,s}catch(e){return o("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let r,s=!1;const i=e=>{s||(s=!0,r&&(clearTimeout(r),r=null),t(e))},n=()=>{if(this.isDisposed)i(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void i(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(r=setTimeout(n,1));const s=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(s)/1e6)}catch(e){o("Error checking query:",e),t(this.lastValue)}};n()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class zR extends vR{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},s=void 0!==t.context?t.context:e.domElement.getContext("webgl2",r);function i(t){t.preventDefault();const r={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(r)}this._onContextLost=i,e.domElement.addEventListener("webglcontextlost",i,!1),this.gl=s,this.extensions=new UR(this),this.capabilities=new IR(this),this.attributeUtils=new ER(this),this.textureUtils=new PR(this),this.bufferRenderer=new VR(this),this.state=new wR(this),this.utils=new CR(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(d("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return c}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){const s=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:s.RGBA8}),null!==r){const t=e.stencilBuffer?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&d("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new GR(this.gl,e,2048));const r=this.timestampQueryPool[e];null!==r.allocateQueriesForContext(t)&&r.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.viewport(0,0,e,r)}if(e.scissor)this.updateScissor(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.scissor(0,0,e,r)}this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const s=e.occlusionQueryCount;s>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=new Array(s),r.occlusionQueryObjects=new Array(s),r.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:r}=this,s=this.get(e),i=s.previousContext;r.resetVertexState();const n=e.occlusionQueryCount;n>0&&(n>s.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let e=0;e{let a=0;for(let t=0;t1?t.renderInstances(r,s,i):t.render(r,s)}draw(e){const{object:t,pipeline:r,material:s,context:i,hardwareClippingPlanes:n}=e,{programGPU:a}=this.get(r),{gl:o,state:u}=this,l=this.get(i),d=e.getDrawParameters();if(null===d)return;this._bindUniforms(e.getBindings());const c=t.isMesh&&t.matrixWorld.determinant()<0;u.setMaterial(s,c,n),null!==i.mrt&&null!==i.textures&&u.setMRTBlending(i.textures,i.mrt,s),u.useProgram(a);const h=e.getAttributes(),p=this.get(h);let g=p.vaoGPU;if(void 0===g){const e=this._getVaoKey(h);g=this.vaoCache[e],void 0===g&&(g=this._createVao(h),this.vaoCache[e]=g,p.vaoGPU=g)}const m=e.getIndex(),f=null!==m?this.get(m).bufferGPU:null;u.setVertexState(g,f);const y=l.lastOcclusionObject;if(y!==t&&void 0!==y){if(null!==y&&!0===y.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),l.occlusionQueryIndex++),!0===t.occlusionTest){const e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),l.occlusionQueries[l.occlusionQueryIndex]=e,l.occlusionQueryObjects[l.occlusionQueryIndex]=t}l.lastOcclusionObject=t}const b=this.bufferRenderer;t.isPoints?b.mode=o.POINTS:t.isLineSegments?b.mode=o.LINES:t.isLine?b.mode=o.LINE_STRIP:t.isLineLoop?b.mode=o.LINE_LOOP:!0===s.wireframe?(u.setLineWidth(s.wireframeLinewidth*this.renderer.getPixelRatio()),b.mode=o.LINES):b.mode=o.TRIANGLES;const{vertexCount:x,instanceCount:T}=d;let{firstVertex:_}=d;if(b.object=t,null!==m){_*=m.array.BYTES_PER_ELEMENT;const e=this.get(m);b.index=m.count,b.type=e.type}else b.index=0;if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const r=this.get(e.camera),s=e.camera.cameras,i=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===r.indexesGPU||r.indexesGPU.length!==s.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let r=0,i=s.length;r{const i=this.parallel,n=()=>{r.getProgramParameter(a,i.COMPLETION_STATUS_KHR)?(this._completeCompile(e,s),t()):requestAnimationFrame(n)};n()});return void t.push(i)}this._completeCompile(e,s)}_handleSource(e,t){const r=e.split("\n"),s=[],i=Math.max(t-6,0),n=Math.min(t+6,r.length);for(let e=i;e":" "} ${i}: ${r[e]}`)}return s.join("\n")}_getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(s&&""===i)return"";const n=/ERROR: 0:(\d+)/.exec(i);if(n){const s=parseInt(n[1]);return r.toUpperCase()+"\n\n"+i+"\n\n"+this._handleSource(e.getShaderSource(t),s)}return i}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){const s=this.gl,i=(s.getProgramInfoLog(e)||"").trim();if(!1===s.getProgramParameter(e,s.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(s,e,r,t);else{const n=this._getShaderErrors(s,r,"vertex"),a=this._getShaderErrors(s,t,"fragment");o("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(e,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+n+"\n"+a)}else""!==i&&d("WebGLProgram: Program Info Log:",i)}}_completeCompile(e,t){const{state:r,gl:s}=this,i=this.get(t),{programGPU:n,fragmentShader:a,vertexShader:o}=i;!1===s.getProgramParameter(n,s.LINK_STATUS)&&this._logProgramError(n,a,o),r.useProgram(n);const u=e.getBindings();this._setupBindings(u,n),this.set(t,{programGPU:n,pipeline:n})}createComputePipeline(e,t){const{state:r,gl:s}=this,i={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(i);const{computeProgram:n}=e,a=s.createProgram(),o=this.get(i).shaderGPU,u=this.get(n).shaderGPU,l=n.transforms,d=[],c=[];for(let e=0;eOR[t]===e),r=this.extensions;for(let e=0;e1,h=!0===i.isXRRenderTarget,p=!0===h&&!0===i._hasExternalTextures;let g=n.msaaFrameBuffer,m=n.depthRenderbuffer;const f=this.extensions.get("WEBGL_multisampled_render_to_texture"),y=this.extensions.get("OVR_multiview2"),b=this._useMultisampledExtension(i),x=Zy(e);let T;if(l?(n.cubeFramebuffers||(n.cubeFramebuffers={}),T=n.cubeFramebuffers[x]):h&&!1===p?T=this._xrFramebuffer:(n.framebuffers||(n.framebuffers={}),T=n.framebuffers[x]),void 0===T){T=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,T);const s=e.textures,o=[];if(l){n.cubeFramebuffers[x]=T;const{textureGPU:e}=this.get(s[0]),r=this.renderer._activeCubeFace,i=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,i)}else{n.framebuffers[x]=T;for(let r=0;r0&&!1===b&&!i.multiview){if(void 0===g){const s=[];g=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,g);const i=[],l=e.textures;for(let r=0;r0&&!1===this._useMultisampledExtension(s)){const n=i.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;s.resolveDepthBuffer&&(s.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),s.stencilBuffer&&s.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=i.msaaFrameBuffer,u=i.msaaRenderbuffers,l=e.textures,d=l.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,n),d)for(let e=0;e0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const $R="point-list",WR="line-list",HR="line-strip",qR="triangle-list",jR="undefined"!=typeof self&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},XR="never",KR="less",QR="equal",YR="less-equal",ZR="greater",JR="not-equal",eA="greater-equal",tA="always",rA="store",sA="load",iA="clear",nA="ccw",aA="cw",oA="none",uA="back",lA="uint16",dA="uint32",cA="r8unorm",hA="r8snorm",pA="r8uint",gA="r8sint",mA="r16uint",fA="r16sint",yA="r16float",bA="rg8unorm",xA="rg8snorm",TA="rg8uint",_A="rg8sint",vA="r16unorm",NA="r16snorm",SA="r32uint",RA="r32sint",AA="r32float",EA="rg16uint",wA="rg16sint",CA="rg16float",MA="rgba8unorm",BA="rgba8unorm-srgb",FA="rgba8snorm",LA="rgba8uint",PA="rgba8sint",DA="bgra8unorm",UA="bgra8unorm-srgb",IA="rg16unorm",OA="rg16snorm",VA="rgb9e5ufloat",kA="rgb10a2unorm",GA="rg11b10ufloat",zA="rg32uint",$A="rg32sint",WA="rg32float",HA="rgba16uint",qA="rgba16sint",jA="rgba16float",XA="rgba16unorm",KA="rgba16snorm",QA="rgba32uint",YA="rgba32sint",ZA="rgba32float",JA="depth16unorm",eE="depth24plus",tE="depth24plus-stencil8",rE="depth32float",sE="depth32float-stencil8",iE="bc1-rgba-unorm",nE="bc1-rgba-unorm-srgb",aE="bc2-rgba-unorm",oE="bc2-rgba-unorm-srgb",uE="bc3-rgba-unorm",lE="bc3-rgba-unorm-srgb",dE="bc4-r-unorm",cE="bc4-r-snorm",hE="bc5-rg-unorm",pE="bc5-rg-snorm",gE="bc6h-rgb-ufloat",mE="bc6h-rgb-float",fE="bc7-rgba-unorm",yE="bc7-rgba-unorm-srgb",bE="etc2-rgb8unorm",xE="etc2-rgb8unorm-srgb",TE="etc2-rgb8a1unorm",_E="etc2-rgb8a1unorm-srgb",vE="etc2-rgba8unorm",NE="etc2-rgba8unorm-srgb",SE="eac-r11unorm",RE="eac-r11snorm",AE="eac-rg11unorm",EE="eac-rg11snorm",wE="astc-4x4-unorm",CE="astc-4x4-unorm-srgb",ME="astc-5x4-unorm",BE="astc-5x4-unorm-srgb",FE="astc-5x5-unorm",LE="astc-5x5-unorm-srgb",PE="astc-6x5-unorm",DE="astc-6x5-unorm-srgb",UE="astc-6x6-unorm",IE="astc-6x6-unorm-srgb",OE="astc-8x5-unorm",VE="astc-8x5-unorm-srgb",kE="astc-8x6-unorm",GE="astc-8x6-unorm-srgb",zE="astc-8x8-unorm",$E="astc-8x8-unorm-srgb",WE="astc-10x5-unorm",HE="astc-10x5-unorm-srgb",qE="astc-10x6-unorm",jE="astc-10x6-unorm-srgb",XE="astc-10x8-unorm",KE="astc-10x8-unorm-srgb",QE="astc-10x10-unorm",YE="astc-10x10-unorm-srgb",ZE="astc-12x10-unorm",JE="astc-12x10-unorm-srgb",ew="astc-12x12-unorm",tw="astc-12x12-unorm-srgb",rw="clamp-to-edge",sw="repeat",iw="mirror-repeat",nw="linear",aw="nearest",ow="zero",uw="one",lw="src",dw="one-minus-src",cw="src-alpha",hw="one-minus-src-alpha",pw="dst",gw="one-minus-dst",mw="dst-alpha",fw="one-minus-dst-alpha",yw="src-alpha-saturated",bw="constant",xw="one-minus-constant",Tw="add",_w="subtract",vw="reverse-subtract",Nw="min",Sw="max",Rw=0,Aw=15,Ew="keep",ww="zero",Cw="replace",Mw="invert",Bw="increment-clamp",Fw="decrement-clamp",Lw="increment-wrap",Pw="decrement-wrap",Dw="storage",Uw="read-only-storage",Iw="write-only",Ow="read-only",Vw="read-write",kw="non-filtering",Gw="comparison",zw="float",$w="unfilterable-float",Ww="depth",Hw="sint",qw="uint",jw="2d",Xw="3d",Kw="2d",Qw="2d-array",Yw="cube",Zw="3d",Jw="all",eC="vertex",tC="instance",rC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},sC={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class iC extends aR{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class nC extends JS{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let aC=0;class oC extends nC{constructor(e,t){super("StorageBuffer_"+aC++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:ii.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class uC extends Ry{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:nw}),this.flipYSampler=e.createSampler({minFilter:aw}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4f,\n\t@location( 0 ) vTex : vec2f,\n\t@location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32,\n};\n\n@group( 0 ) @binding ( 2 )\nvar flipY: u32;\n\n@vertex\nfn mainVS(\n\t\t@builtin( vertex_index ) vertexIndex : u32,\n\t\t@builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array(\n\t\tvec2f( -1, -1 ),\n\t\tvec2f( -1, 3 ),\n\t\tvec2f( 3, -1 ),\n\t);\n\n\tlet p = pos[ vertexIndex ];\n\tlet mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 );\n\tVarys.vTex = p * mult + vec2f( 0.5 );\n\tVarys.Position = vec4f( p, 0, 1 );\n\tVarys.vBaseArrayLayer = instanceIndex;\n\n\treturn Varys;\n\n}\n\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img2d : texture_2d;\n\n@fragment\nfn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2d, imgSampler, Varys.vTex );\n\n}\n\n@group( 0 ) @binding( 1 )\nvar img2dArray : texture_2d_array;\n\n@fragment\nfn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer );\n\n}\n\nconst faceMat = array(\n mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x\n mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x\n mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y\n mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y\n mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z\n mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z\n);\n\n@group( 0 ) @binding( 1 )\nvar imgCube : texture_cube;\n\n@fragment\nfn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );\n\n}\n"})}getTransferPipeline(e,t){const r=`${e}-${t=t||"2d-array"}`;let s=this.transferPipelines[r];return void 0===s&&(s=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[r]=s),s}flipY(e,t,r=0){const s=t.format,{width:i,height:n}=t.size,a=this.device.createTexture({size:{width:i,height:n},format:s,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),o=this.getTransferPipeline(s,e.textureBindingViewDimension),u=this.getTransferPipeline(s,a.textureBindingViewDimension),l=this.device.createCommandEncoder({}),d=(e,t,r,s,i,n)=>{const a=e.getBindGroupLayout(0),o=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t.createView({dimension:t.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:n?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),u=l.beginRenderPass({colorAttachments:[{view:s.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1}),loadOp:iA,storeOp:rA}]});u.setPipeline(e),u.setBindGroup(0,o),u.draw(3,1,0,r),u.end()};d(o,e,r,a,0,!1),d(u,a,0,e,r,!0),this.device.queue.submit([l.finish()]),a.destroy()}generateMipmaps(e,t=null){const r=this.get(e),s=r.layers||this._mipmapCreateBundles(e),i=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(i,s),null===t&&this.device.queue.submit([i.finish()]),r.layers=s}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",r=this.getTransferPipeline(e.format,t),s=r.getBindGroupLayout(0),i=[];for(let n=1;n0)for(let t=0,n=s.length;t0){for(const s of e.layerUpdates)this._copyBufferToTexture(t.image,r.texture,i,s,e.flipY,s);e.clearLayerUpdates()}else for(let s=0;s0)for(let t=0,n=s.length;t0?e.width:r.size.width,l=a>0?e.height:r.size.height;try{o.queue.copyExternalImageToTexture({source:e,flipY:i},{texture:t,mipLevel:a,origin:{x:0,y:0,z:s},premultipliedAlpha:n},{width:u,height:l,depthOrArrayLayers:1})}catch(e){}}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new uC(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,s,i,n=0,a=0){const o=this.backend.device,u=e.data,l=this._getBytesPerTexel(r.format),d=e.width*l;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:s}},u,{offset:e.width*e.height*l*n,bytesPerRow:d},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===i&&this._flipY(t,r,s)}_copyCompressedBufferToTexture(e,t,r){const s=this.backend.device,i=this._getBlockData(r.format),n=r.size.depthOrArrayLayers>1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,gC=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,mC={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class fC extends hS{constructor(e){const{type:t,inputs:r,name:s,inputsCode:i,blockCode:n,outputType:a}=(e=>{const t=(e=e.trim()).match(pC);if(null!==t&&4===t.length){const r=t[2],s=[];let i=null;for(;null!==(i=gC.exec(r));)s.push({name:i[1],type:i[2]});const n=[];for(let e=0;e "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class yC extends cS{parseFunction(e){return new fC(e)}}const bC={[ii.READ_ONLY]:"read",[ii.WRITE_ONLY]:"write",[ii.READ_WRITE]:"read_write"},xC={[kr]:"repeat",[_e]:"clamp",[Vr]:"mirror"},TC={vertex:jR.VERTEX,fragment:jR.FRAGMENT,compute:jR.COMPUTE},_C={instance:!0,swizzleAssign:!1,storageBuffer:!0},vC={"^^":"tsl_xor"},NC={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},SC={},RC={tsl_xor:new fT("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new fT("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new fT("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new fT("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new fT("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new fT("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new fT("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new fT("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new fT("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new fT("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new fT("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new fT("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new fT("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n"),biquadraticTextureArray:new fT("\nfn tsl_biquadraticTexture_array( map : texture_2d_array, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},AC={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let EC="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(EC+="diagnostic( off, derivative_uniformity );\n");class wC extends QN{constructor(e,t){super(e,t,new yC),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,r,s,i,n=this.shaderStage){return"fragment"===n?s?i?`textureSample( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${s} )`:i?`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`:this.generateTextureSampleLevel(e,t,r,"0",s)}generateTextureSampleLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateWrapFunction(e){const t=`tsl_coord_${xC[e.wrapS]}S_${xC[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let r=SC[t];if(void 0===r){const s=[],i=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let n=`fn ${t}( coord : ${i} ) -> ${i} {\n\n\treturn ${i}(\n`;const a=(e,t)=>{e===kr?(s.push(RC.repeatWrapping_float),n+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===_e?(s.push(RC.clampWrapping_float),n+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===Vr?(s.push(RC.mirrorWrapping_float),n+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):(n+=`\t\tcoord.${t}`,d(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};a(e.wrapS,"x"),n+=",\n",a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(n+=",\n",a(e.wrapR,"z")),n+="\n\t);\n\n}\n",SC[t]=r=new fT(n,s)}return r.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){const s=this.getDataFromNode(e,this.shaderStage,this.cache);void 0===s.dimensionsSnippet&&(s.dimensionsSnippet={});let i=s.dimensionsSnippet[r];if(void 0===s.dimensionsSnippet[r]){let n,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),u=o>1;a=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",n=u||e.isStorageTexture?t:`${t}${r?`, u32( ${r} )`:""}`,i=new Du(new wl(`textureDimensions( ${n} )`,a)),s.dimensionsSnippet[r]=i,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(s.arrayLayerCount=new Du(new wl(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(s.cubeFaceCount=new Du(new wl("6u","u32")))}return i.build(this)}generateFilteredTexture(e,t,r,s,i="0u",n){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,i);return s&&(r=`${r} + vec2(${s}) / ${o}`),n?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${r} ), ${o}, u32( ${n} ), u32( ${i} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${r} ), ${o}, u32( ${i} ) )`)}generateTextureLod(e,t,r,s,i,n="0u"){if(!0===e.isCubeTexture){i&&(r=`${r} + vec3(${i})`);return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${e.isDepthTexture?"u32":"f32"}( ${n} ) )`}const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,n),u=e.is3DTexture||e.isData3DTexture?"vec3":"vec2";i&&(r=`${r} + ${u}(${i}) / ${u}( ${o} )`);return r=`${u}( clamp( floor( ${a}( ${r} ) * ${u}( ${o} ) ), ${`${u}( 0 )`}, ${`${u}( ${o} - ${"vec3"===u?"vec3( 1, 1, 1 )":"vec2( 1, 1 )"} )`} ) )`,this.generateTextureLoad(e,t,r,n,s,null)}generateStorageTextureLoad(e,t,r,s,i,n){let a;return n&&(r=`${r} + ${n}`),a=i?`textureLoad( ${t}, ${r}, ${i} )`:`textureLoad( ${t}, ${r} )`,a}generateTextureLoad(e,t,r,s,i,n){let a;return null===s&&(s="0u"),n&&(r=`${r} + ${n}`),i?a=`textureLoad( ${t}, ${r}, ${i}, u32( ${s} ) )`:(a=`textureLoad( ${t}, ${r}, u32( ${s} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,r,s,i){let n;return n=s?`textureStore( ${t}, ${r}, ${s}, ${i} )`:`textureStore( ${t}, ${r}, ${i} )`,n}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction&&this.renderer.hasCompatibility(A.TEXTURE_COMPARE)}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&e.type===K||!1===this.isSampleCompare(e)&&e.minFilter===B&&e.magFilter===B||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,s,i,n=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,r,s,i,"0",n):this._generateTextureSample(e,t,r,s,i,n),a}generateTextureGrad(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]} )`:n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]} )`;o(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateTextureBias(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,r=e.type;return"texture"===r||"cubeTexture"===r||"cubeDepthTexture"===r||"storageTexture"===r||"texture3D"===r?t:"buffer"===r||"storageBuffer"===r||"indirectStorageBuffer"===r?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=vC[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(d("WebGPURenderer: Atomic operations are only supported in compute shaders."),ii.READ_WRITE):ii.READ_ONLY:e.access}getStorageAccess(e,t){return bC[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);if(void 0===n.uniformGPU){let a;const o=e.groupNode,u=o.name,l=this.getBindGroupArray(u,r);if("texture"===t||"cubeTexture"===t||"cubeDepthTexture"===t||"storageTexture"===t||"texture3D"===t){let s=null;const n=this.getNodeAccess(e,r);"texture"===t||"storageTexture"===t?s=!0===e.value.is3DTexture?new cR(i.name,i.node,o,n):new lR(i.name,i.node,o,n):"cubeTexture"===t||"cubeDepthTexture"===t?s=new dR(i.name,i.node,o,n):"texture3D"===t&&(s=new cR(i.name,i.node,o,n)),s.store=!0===e.isStorageTextureNode,s.mipLevel=s.store?e.mipLevel:0,s.setVisibility(TC[r]);if(!0===e.value.isCubeTexture||!1===this.isUnfilterable(e.value)&&!1===s.store){const e=new iC(`${i.name}_sampler`,i.node,o);e.setVisibility(TC[r]),l.push(e,s),a=[e,s]}else l.push(s),a=[s]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const n=this.getSharedDataFromNode(e);let u=n.buffer;if(void 0===u){u=new("buffer"===t?rR:oC)(e,o),n.buffer=u}u.setVisibility(u.getVisibility()|TC[r]),l.push(u),a=u,i.name=s||"NodeBuffer_"+i.id}else{let e=this.uniformGroups[u];void 0===e&&(e=new nR(u,o),e.setVisibility(jR.VERTEX|jR.FRAGMENT|jR.COMPUTE),this.uniformGroups[u]=e),-1===l.indexOf(e)&&l.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}getBuiltin(e,t,r,s=this.shaderStage){const i=this.builtins[s]||(this.builtins[s]=new Map);return!1===i.has(e)&&i.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(e.name+" : "+this.getType(e.type));let i=`fn ${t.name}( ${s.join(", ")} ) -> ${this.getType(t.type)} {\n${r.vars}\n${r.code}\n`;return r.result&&(i+=`\treturn ${r.result};\n`),i+="\n}\n",i}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],r=this.directives[e];if(void 0!==r)for(const e of r)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],r=this.builtins[e];if(void 0!==r)for(const{name:e,property:s,type:i}of r.values())t.push(`@builtin( ${e} ) ${s} : ${i}`);return t.join(",\n\t")}getScopedArray(e,t,r,s){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:s}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:e,scope:r,bufferType:s,bufferCount:i}of this.scopedArrays.values()){const n=this.getType(s);t.push(`var<${r}> ${e}: array< ${n}, ${i} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const r=this.getAttributesArray();for(let e=0,s=r.length;e"),t.push(`\t${s+r.name} : ${i}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const r=this.structs[e];if(r.length>0){const e=[];for(const t of r){let r=`struct ${t.name} {\n`;r+=this.getStructMembers(t),r+="\n};",e.push(r)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,r=null,s=""){let i=`var${s} ${t} : `;return i+=null!==r?this.generateArrayDeclaration(e,r):this.getType(e),i}getVars(e,t=!1){let r="";t&&(r="");const s=[],i=this.vars[e];if(void 0!==i)for(const e of i)s.push(`${this.getVar(e.type,e.name,e.count,r)};`);return t?s.join("\n"):`\n\t${s.join("\n\t")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","builtinClipSpace","vec4","vertex"),"vertex"===e||"fragment"===e){const r=this.varyings,s=this.vars[e];let i=0;for(let n=0;nr.value.itemSize;return s&&!i}getUniforms(e){const t=this.renderer.backend,r=this.uniforms[e],s=[],i=[],n=[],a={};for(const n of r){const r=n.groupNode.name,o=this.bindingsIndexes[r];if("texture"===n.type||"cubeTexture"===n.type||"cubeDepthTexture"===n.type||"storageTexture"===n.type||"texture3D"===n.type){const r=n.node.value;let i;(!0===r.isCubeTexture||!1===this.isUnfilterable(r)&&!0!==n.node.isStorageTextureNode)&&(this.isSampleCompare(r)?s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler_comparison;`):s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler;`));let a="";const{primarySamples:u}=t.utils.getTextureSampleData(r);if(u>1&&(a="_multisampled"),!0===r.isCubeTexture&&!0===r.isDepthTexture)i="texture_depth_cube";else if(!0===r.isCubeTexture)i="texture_cube";else if(!0===r.isDepthTexture)i=t.compatibilityMode&&null===r.compareFunction?`texture${a}_2d`:`texture_depth${a}_2d${!0===r.isArrayTexture?"_array":""}`;else if(!0===n.node.isStorageTextureNode){const s=hC(r,t.device),a=this.getStorageAccess(n.node,e),o=n.node.value.is3DTexture,u=n.node.value.isArrayTexture;i=`texture_storage_${o?"3d":"2d"+(u?"_array":"")}<${s}, ${a}>`}else if(!0===r.isArrayTexture||!0===r.isDataArrayTexture||!0===r.isCompressedArrayTexture)i="texture_2d_array";else if(!0===r.is3DTexture||!0===r.isData3DTexture)i="texture_3d";else{i=`texture${a}_2d<${this.getComponentTypeFromTexture(r).charAt(0)}32>`}s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name} : ${i};`)}else if("buffer"===n.type||"storageBuffer"===n.type||"indirectStorageBuffer"===n.type){const t=n.node,r=this.getType(t.getNodeType(this)),s=t.bufferCount,a=s>0&&"buffer"===n.type?", "+s:"",u=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(n))i.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var<${u}> ${n.name} : ${r};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${r}>`:`${r}`}${a} >`;i.push(this._getWGSLStructBinding(n.name,e,u,o.binding++,o.group))}}else{const e=n.groupNode.name;if(void 0===a[e]){const t=this.uniformGroups[e];if(void 0!==t){const r=[];for(const e of t.uniforms){const t=e.getType(),s=this.getType(this.getVectorType(t));r.push(`\t${e.name} : ${s}`)}let s=this.uniformGroupsBindings[e];void 0===s&&(s={index:o.binding++,id:o.group},this.uniformGroupsBindings[e]=s),a[e]={index:s.index,id:s.id,snippets:r}}}}}for(const e in a){const t=a[e];n.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}return[...s,...i,...n].join("\n")}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const r=this.allowGlobalVariables,s=e[t];s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.structs=this.getStructs(t),s.vars=this.getVars(t,r),s.codes=this.getCodes(t),s.directives=this.getDirectives(t),s.scopedArrays=this.getScopedArrays(t);let i="// code\n\n";i+=this.flowCode[t];const n=this.flowNodes[t],a=n[n.length-1],o=a.outputNode,u=void 0!==o&&!0===o.isOutputStructNode;for(const e of n){const r=this.getFlowData(e),n=e.name;if(n&&(i.length>0&&(i+="\n"),i+=`\t// flow -> ${n}\n`),i+=`${r.code}\n\t`,e===a&&"compute"!==t)if(i+="// result\n\n\t","vertex"===t)i+=`varyings.builtinClipSpace = ${r.result};`;else if("fragment"===t)if(u)s.returnType=o.getNodeType(this),s.structs+="var output : "+s.returnType+";",i+=`return ${r.result};`;else{let e="\t@location( 0 ) color: vec4";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),s.returnType="OutputStruct",s.structs+=this._getWGSLStruct("OutputStruct",e),s.structs+="\nvar output : OutputStruct;",i+=`output.color = ${r.result};\n\n\treturn output;`}}s.flow=i}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return null!==t&&(r=this._getWGSLMethod(e+"_"+t)),void 0===r&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return NC[e]||e}isAvailable(e){let t=_C[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),_C[e]=t),t}_getWGSLMethod(e){return void 0!==RC[e]&&this._include(e),AC[e]}_include(e){const t=RC[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar varyings : VaryingsStruct;\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${EC}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[r,s,i]=t;return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${this.allowGlobalVariables?e.vars:""}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${r}, ${s}, ${i} )\nfn main( ${e.attributes} ) {\n\n\t// local vars\n\t${this.allowGlobalVariables?"":e.vars}\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${r} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${r} * numWorkgroups.x ) * ( ${s} * numWorkgroups.y );\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,r,s=0,i=0){const n=e+"Struct";return`${this._getWGSLStruct(n,t)}\n@binding( ${s} ) @group( ${i} )\nvar<${r}> ${e} : ${n};`}}class CC{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(t=null!==e.depthTexture?this.getTextureFormatGPU(e.depthTexture):e.stencil?!0===this.backend.renderer.reversedDepthBuffer?sE:tE:!0===this.backend.renderer.reversedDepthBuffer?rE:eE),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const e=this.backend.renderer,r=e.getRenderTarget();t=r?r.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const r=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:r?1:t,isMSAA:r}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?$R:e.isLineSegments||e.isMesh&&!0===t.wireframe?WR:e.isLine?HR:e.isMesh?qR:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===Ve)return DA;if(e===Te)return jA;throw new Error("Unsupported output buffer type.")}}const MC=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&MC.set(Float16Array,["float16"]);const BC=new Map([[xt,["float16"]]]),FC=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class LC{constructor(e){this.backend=e}createAttribute(e,t){const r=this._getBufferAttribute(e),s=this.backend,i=s.get(r);let n=i.buffer;if(void 0===n){const a=s.device;let o=r.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e{o.unmap()},u=()=>{o.destroy(),t.delete(e),e.removeEventListener("release",i),e.removeEventListener("dispose",u)};e.addEventListener("release",i),e.addEventListener("dispose",u),a.readBufferGPU=o}const u=r.createCommandEncoder({label:`readback_encoder_${s.name}`});u.copyBufferToBuffer(i,0,o,0,n);const l=u.finish();r.queue.submit([l]),await o.mapAsync(GPUMapMode.READ);return o.getMappedRange()}_getVertexFormat(e){const{itemSize:t,normalized:r}=e,s=e.array.constructor,i=e.constructor;let n;if(1===t)n=FC.get(s);else{const e=(BC.get(i)||MC.get(s))[r?1:0];if(e){const r=s.BYTES_PER_ELEMENT*t,i=4*Math.floor((r+3)/4)/s.BYTES_PER_ELEMENT;if(i%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");n=`${e}x${i}`}}return n||o("WebGPUAttributeUtils: Vertex format not supported yet."),n}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class PC{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class DC{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,r=t.device,s=t.get(e);if(s.layout)return s.layout.layoutGPU;const i=this._createLayoutEntries(e),n=Vs(JSON.stringify(i));let a=this._bindGroupLayoutCache.get(n);return void 0===a&&(a=new PC(r.createBindGroupLayout({entries:i})),this._bindGroupLayoutCache.set(n,a)),a.usedTimes++,s.layout=a,s.layoutKey=n,a.layoutGPU}createBindings(e,t,r,s=0){const{backend:i}=this,n=i.get(e),a=this.createBindingsLayout(e);let o;r>0&&(void 0===n.groups&&(n.groups=[],n.versions=[]),n.versions[r]===s&&(o=n.groups[r])),void 0===o&&(o=this.createBindGroup(e,a),r>0&&(n.groups[r]=o,n.versions[r]=s)),n.group=o}updateBinding(e){const t=this.backend,r=t.device,s=e.buffer,i=t.get(e).buffer,n=e.updateRanges;if(0===n.length)r.queue.writeBuffer(i,0,s,0);else{const e=Xr(s),t=e?1:s.BYTES_PER_ELEMENT;for(let a=0,o=n.length;a1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${r}-${s}`,a=e[i],void 0===a){const n=Jw;let o;o=t.isSampledCubeTexture?Yw:t.isSampledTexture3D?Zw:t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?Qw:Kw,a=e[i]=e.texture.createView({aspect:n,dimension:o,mipLevelCount:r,baseMipLevel:s})}}n.push({binding:i,resource:a})}else if(t.isSampler){const e=r.get(t.texture);n.push({binding:i,resource:e.sampler})}i++}return s.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:n})}_createLayoutEntries(e){const t=[];let r=0;for(const s of e.bindings){const e=this.backend,i={binding:r,visibility:s.visibility};if(s.isUniformBuffer||s.isStorageBuffer){const e={};s.isStorageBuffer&&(s.visibility&jR.COMPUTE&&(s.access===ii.READ_WRITE||s.access===ii.WRITE_ONLY)?e.type=Dw:e.type=Uw),i.buffer=e}else if(s.isSampledTexture&&s.store){const e={};e.format=this.backend.get(s.texture).texture.format;const t=s.access;e.access=t===ii.READ_WRITE?Vw:t===ii.WRITE_ONLY?Iw:Ow,s.texture.isArrayTexture?e.viewDimension=Qw:s.texture.is3DTexture&&(e.viewDimension=Zw),i.storageTexture=e}else if(s.isSampledTexture){const t={},{primarySamples:r}=e.utils.getTextureSampleData(s.texture);if(r>1&&(t.multisampled=!0,s.texture.isDepthTexture||(t.sampleType=$w)),s.texture.isDepthTexture)e.compatibilityMode&&null===s.texture.compareFunction?t.sampleType=$w:t.sampleType=Ww;else if(s.texture.isDataTexture||s.texture.isDataArrayTexture||s.texture.isData3DTexture||s.texture.isStorageTexture){const e=s.texture.type;e===R?t.sampleType=Hw:e===S?t.sampleType=qw:e===K&&(this.backend.hasFeature("float32-filterable")?t.sampleType=zw:t.sampleType=$w)}s.isSampledCubeTexture?t.viewDimension=Yw:s.texture.isArrayTexture||s.texture.isDataArrayTexture||s.texture.isCompressedArrayTexture?t.viewDimension=Qw:s.isSampledTexture3D&&(t.viewDimension=Zw),i.texture=t}else if(s.isSampler){const t={};s.texture.isDepthTexture&&(null!==s.texture.compareFunction&&e.hasCompatibility(A.TEXTURE_COMPARE)?t.type=Gw:t.type=kw),i.sampler=t}else o(`WebGPUBindingUtils: Unsupported binding "${s}".`);t.push(i),r++}return t}deleteBindGroupData(e){const{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,0===r.layout.usedTimes&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class UC{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}}class IC{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:r,material:s,geometry:i,pipeline:n}=e,{vertexProgram:a,fragmentProgram:u}=n,l=this.backend,d=l.device,c=l.utils,h=l.get(n),p=[];for(const t of e.getBindings()){const e=l.get(t),{layoutGPU:r}=e.layout;p.push(r)}const g=l.attributeUtils.createShaderVertexBuffers(e);let m;s.blending===re||s.blending===tt&&!1===s.transparent||(m=this._getBlending(s));let f={};!0===s.stencilWrite&&(f={compare:this._getStencilCompare(s),failOp:this._getStencilOperation(s.stencilFail),depthFailOp:this._getStencilOperation(s.stencilZFail),passOp:this._getStencilOperation(s.stencilZPass)});const y=this._getColorWriteMask(s),b=[];if(null!==e.context.textures){const t=e.context.textures,r=e.context.mrt;for(let e=0;e1},layout:d.createPipelineLayout({bindGroupLayouts:p})},E={},w=e.context.depth,C=e.context.stencil;if(!0!==w&&!0!==C||(!0===w&&(E.format=S,E.depthWriteEnabled=s.depthWrite,E.depthCompare=N),!0===C&&(E.stencilFront=f,E.stencilBack=f,E.stencilReadMask=s.stencilFuncMask,E.stencilWriteMask=s.stencilWriteMask),!0===s.polygonOffset&&(E.depthBias=s.polygonOffsetUnits,E.depthBiasSlopeScale=s.polygonOffsetFactor,E.depthBiasClamp=0),A.depthStencil=E),d.pushErrorScope("validation"),null===t)h.pipeline=d.createRenderPipeline(A),d.popErrorScope().then(e=>{null!==e&&(h.error=!0,o(e.message))});else{const e=new Promise(async e=>{try{h.pipeline=await d.createRenderPipelineAsync(A)}catch(e){}const t=await d.popErrorScope();null!==t&&(h.error=!0,o(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const r=this.backend,{utils:s,device:i}=r,n=s.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:s.getCurrentColorFormats(e),depthStencilFormat:n,sampleCount:this._getSampleCount(e)};return i.createRenderBundleEncoder(a)}createComputePipeline(e,t){const r=this.backend,s=r.device,i=r.get(e.computeProgram).module,n=r.get(e),a=[];for(const e of t){const t=r.get(e),{layoutGPU:s}=t.layout;a.push(s)}n.pipeline=s.createComputePipeline({compute:i,layout:s.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,r;const s=e.blending,i=e.blendSrc,n=e.blendDst,a=e.blendEquation;if(s===Rt){const s=null!==e.blendSrcAlpha?e.blendSrcAlpha:i,o=null!==e.blendDstAlpha?e.blendDstAlpha:n,u=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(n),operation:this._getBlendOperation(a)},r={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(u)}}else{const i=(e,s,i,n)=>{t={srcFactor:e,dstFactor:s,operation:Tw},r={srcFactor:i,dstFactor:n,operation:Tw}};if(e.premultipliedAlpha)switch(s){case tt:i(uw,hw,uw,hw);break;case Yt:i(uw,uw,uw,uw);break;case Qt:i(ow,dw,ow,uw);break;case Kt:i(pw,hw,ow,uw)}else switch(s){case tt:i(cw,hw,uw,hw);break;case Yt:i(cw,uw,uw,uw);break;case Qt:o(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Kt:o(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`)}}if(void 0!==t&&void 0!==r)return{color:t,alpha:r};o("WebGPURenderer: Invalid blending: ",s)}_getBlendFactor(e){let t;switch(e){case At:t=ow;break;case Ht:t=uw;break;case Wt:t=lw;break;case kt:t=dw;break;case rt:t=cw;break;case st:t=hw;break;case zt:t=pw;break;case Vt:t=gw;break;case Gt:t=mw;break;case Ot:t=fw;break;case $t:t=yw;break;case 211:t=bw;break;case 212:t=xw;break;default:o("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const r=e.stencilFunc;switch(r){case rs:t=XR;break;case ts:t=tA;break;case es:t=KR;break;case Jr:t=YR;break;case Zr:t=QR;break;case Yr:t=eA;break;case Qr:t=ZR;break;case Kr:t=JR;break;default:o("WebGPURenderer: Invalid stencil function.",r)}return t}_getStencilOperation(e){let t;switch(e){case ds:t=Ew;break;case ls:t=ww;break;case us:t=Cw;break;case os:t=Mw;break;case as:t=Bw;break;case ns:t=Fw;break;case is:t=Lw;break;case ss:t=Pw;break;default:o("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case it:t=Tw;break;case It:t=_w;break;case Ut:t=vw;break;case hs:t=Nw;break;case cs:t=Sw;break;default:o("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,r){const s={},i=this.backend.utils;s.topology=i.getPrimitiveTopology(e,r),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(s.stripIndexFormat=t.index.array instanceof Uint16Array?lA:dA);let n=r.side===L;return e.isMesh&&e.matrixWorld.determinant()<0&&(n=!n),s.frontFace=!0===n?aA:nA,s.cullMode=r.side===P?oA:uA,s}_getColorWriteMask(e){return!0===e.colorWrite?Aw:Rw}_getDepthCompare(e){let t;if(!1===e.depthTest)t=tA;else{const r=this.backend.parameters.reversedDepthBuffer?ar[e.depthFunc]:e.depthFunc;switch(r){case nr:t=XR;break;case ir:t=tA;break;case sr:t=KR;break;case rr:t=YR;break;case tr:t=QR;break;case er:t=eA;break;case Jt:t=ZR;break;case Zt:t=JR;break;default:o("WebGPUPipelineUtils: Invalid depth function.",r)}}return t}}class OC extends kR{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const s=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return v(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const s=this.device.createCommandEncoder();s.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),s.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);const i=s.finish();if(this.device.queue.submit([i]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const n=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),a={},o=[];for(const[t,r]of e){const e=t.match(/^(.*):f(\d+)$/),s=parseInt(e[2]);!1===o.includes(s)&&o.push(s),void 0===a[s]&&(a[s]=0);const i=n[r],u=n[r+1],l=Number(u-i)/1e6;this.timestamps.set(t,l),a[s]+=l}const u=a[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=u,this.frames=o,u}catch(e){return o("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){o("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){o("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}const VC={r:0,g:0,b:0,a:1};class kC extends vR{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new CC(this),this.attributeUtils=new LC(this),this.bindingUtils=new DC(this),this.capabilities=new UC(this),this.pipelineUtils=new IC(this),this.textureUtils=new cC(this),this.occludedResolveCache=new Map;const t="undefined"==typeof navigator||!1===/Android/.test(navigator.userAgent);this._compatibility={[A.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let r;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:"compatibility"},s="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===s)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const i=Object.values(rC),n=[];for(const e of i)s.features.has(e)&&n.push(e);const a={requiredFeatures:n,requiredLimits:t.requiredLimits};r=await s.requestDevice(a)}else r=t.device;this.compatibilityMode=!r.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),r.lost.then(t=>{if("destroyed"===t.reason)return;const r={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(r)}),this.device=r,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(rC.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let r=t.context;if(void 0===r){const s=this.parameters;r=!0===e.isDefaultCanvasTarget&&void 0!==s.context?s.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${_t} webgpu`);const i=s.alpha?"premultiplied":"opaque",n=s.outputType===Te?"extended":"standard";r.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:i,toneMapping:{mode:n}}),t.context=r}return r}get coordinateSystem(){return h}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),s=e.currentSamples;let i=r.descriptor;if(void 0===i||r.samples!==s){i={colorAttachments:[{view:null}]},!0!==e.depth&&!0!==e.stencil||(i.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const t=i.colorAttachments[0];s>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,r.descriptor=i,r.samples=s}const n=i.colorAttachments[0];return s>0?n.resolveTarget=this.context.getCurrentTexture().createView():n.view=this.context.getCurrentTexture().createView(),i}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const r=e.renderTarget,s=this.get(r);let i=s.descriptors;void 0!==i&&s.width===r.width&&s.height===r.height&&s.samples===r.samples||(i={},s.descriptors=i);const n=e.getCacheKey();let a=i[n];if(void 0===a){const t=e.textures,o=[];let u;const l=this._isRenderCameraDepthArray(e);for(let s=0;s1)if(!0===l){const t=e.camera.cameras;for(let e=0;e0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,i=r.createQuerySet({type:"occlusion",count:s,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=i,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(s),t.lastOcclusionObject=null),n=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:sA}),this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e),n),n.occlusionQuerySet=i;const a=n.depthStencilAttachment;if(null!==e.textures){const t=n.colorAttachments;for(let r=0;r0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const s=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const r=[];for(let e=0;e0){const s=8*r;let i=this.occludedResolveCache.get(s);void 0===i&&(i=this.device.createBuffer({size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(s,i));const n=this.device.createBuffer({size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,i,0),t.encoder.copyBufferToBuffer(i,0,n,0,s),t.occlusionQueryBuffer=n,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;eo&&(i[0]=Math.min(a,o),i[1]=Math.ceil(a/o)),n.dispatchSize=i}i=n.dispatchSize}a.dispatchWorkgroups(i[0],i[1]||1,i[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}_draw(e,t,r,s,i,n,a,o,u){const{object:l,material:d,context:c}=e,h=e.getIndex(),p=null!==h;this.pipelineUtils.setPipeline(o,s),u.pipeline=s;const g=u.bindingGroups;for(let e=0,t=i.length;e65535?4:2);for(let n=0;n0){const i=this.get(e.camera),a=e.camera.cameras,c=e.getBindingGroup("cameraIndex");if(void 0===i.indexesGPU||i.indexesGPU.length!==a.length){const e=this.get(c),t=[],r=new Uint32Array([0,0,0,0]);for(let s=0,i=a.length;s(d("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new zR(e)));super(new t(e),e),this.library=new $C,this.isWebGPURenderer=!0}}class HC extends As{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}}class qC{constructor(e,t=Cn(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const r=new vg;r.name="RenderPipeline",this._quadMesh=new gx(r),this._quadMesh.name="Render Pipeline",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){const e=this.renderer;this._update(),null!==this._context.onBeforeRenderPipeline&&this._context.onBeforeRenderPipeline();const t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=m,e.outputColorSpace=p.workingColorSpace;const s=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=s,e.toneMapping=t,e.outputColorSpace=r,null!==this._context.onAfterRenderPipeline&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),!0===this.needsUpdate){const e=this._toneMapping,t=this._outputColorSpace,r={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null};let s=this.outputNode;!0===this.outputColorTransform?(s=s.context(r),s=Fl(s,e,t)):(r.toneMapping=e,r.outputColorSpace=t,s=s.context(r)),this._context=r,this._quadMesh.material.fragmentNode=s,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){v('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class jC extends qC{constructor(e,t){v('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your code to use "THREE.RenderPipeline" instead.'),super(e,t)}}class XC extends N{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){this.image.width===e&&this.image.height===t||(this.image.width=e,this.image.height=t,this.dispose())}}class KC extends Ex{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class QC extends Es{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,r,s){const i=new ws(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,r=>{try{t(this.parse(JSON.parse(r)))}catch(t){s?s(t):o(t),this.manager.itemError(e)}},r,s)}parseNodes(e){const t={};if(void 0!==e){for(const r of e){const{uuid:e,type:s}=r;t[e]=this.createNodeFromType(s),t[e].uuid=e}const r={nodes:t,textures:this.textures};for(const s of e){s.meta=r;t[s.uuid].deserialize(s),delete s.meta}}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const r={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(o("NodeLoader: Node type not found:",e),yn()):new this.nodes[e]}}class YC extends Cs{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),r=this.nodes,s=e.inputNodes;for(const e in s){const i=s[e];t[e]=r[i]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class ZC extends Ms{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){const r=new QC;return r.setNodes(this.nodes),r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){const r={};if(void 0!==e){const s=this.parseNodes(this._nodesJSON,t),i=new YC;i.setTextures(t),i.setNodes(s),i.setNodeMaterials(this.nodeMaterials);for(let t=0,s=e.length;t0){const{width:r,height:s}=e.context;t.bufferWidth=r,t.bufferHeight=s}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const r in e){const s=e[r];t[r]={id:s.id,version:s.version}}return t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Ps.get(e);return void 0===t&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Ps.set(e,t)),t}getMaterialData(e){let t=Ls.get(e);if(void 0===t){t={_renderId:-1,_equal:!1};for(const r of this.refreshUniforms){const s=e[r];null!=s&&("object"==typeof s&&void 0!==s.clone?!0===s.isTexture?t[r]={id:s.id,version:s.version}:t[r]=s.clone():t[r]=s)}Ls.set(e,t)}return t}equals(e,t,r){const{object:s,material:i,geometry:n}=e,a=this.getRenderObjectData(e);if(!0!==a.worldMatrix.equals(s.matrixWorld))return a.worldMatrix.copy(s.matrixWorld),!1;const o=this.getMaterialData(e.material);if(o._renderId!==r){o._renderId=r;for(const e in o){const t=o[e],r=i[e];if("_renderId"!==e&&"_equal"!==e)if(void 0!==t.equals){if(!1===t.equals(r))return t.copy(r),o._equal=!1,!1}else if(!0===r.isTexture){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,o._equal=!1,!1}else if(t!==r)return o[e]=r,o._equal=!1,!1}if(o.transmission>0){const{width:t,height:r}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==r)return a.bufferWidth=t,a.bufferHeight=r,o._equal=!1,!1}o._equal=!0}else if(!1===o._equal)return!1;if(a.geometryId!==n.id)return a.geometryId=n.id,!1;const u=this.getGeometryData(e.geometry);if(u._renderId!==r){u._renderId=r;const e=n.attributes,t=u.attributes;let s=0,i=0;for(const t in e)s++;for(const r in t){i++;const s=t[r],n=e[r];if(void 0===n)return delete t[r],u._equal=!1,!1;if(s.id!==n.id||s.version!==n.version)return s.id=n.id,s.version=n.version,u._equal=!1,!1}if(i!==s)return u.attributes=this.getAttributesData(e),u._equal=!1,!1;const a=n.index,o=u.indexId,l=u.indexVersion,d=a?a.id:null,c=a?a.version:null;if(o!==d||l!==c)return u.indexId=d,u.indexVersion=c,u._equal=!1,!1;if(u.drawRange.start!==n.drawRange.start||u.drawRange.count!==n.drawRange.count)return u.drawRange.start=n.drawRange.start,u.drawRange.count=n.drawRange.count,u._equal=!1,!1;u._equal=!0}else if(!1===u._equal)return!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t{const r=e.match(t);if(!r)return null;const s=r[1]||r[2]||"",i=r[3].split("?")[0],n=parseInt(r[4],10),a=parseInt(r[5],10);return{fn:s,file:i.split("/").pop(),line:n,column:a}}).filter(e=>e&&!Us.some(t=>t.test(e.file)))}(e||(new Error).stack)}getLocation(){if(0===this.stack.length)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(0===this.stack.length)return e;return`${e}\n${this.stack.map(e=>{const t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join("\n")}`}}function Os(e,t=0){let r=3735928559^t,s=1103547991^t;if(Array.isArray(e))for(let t,i=0;i>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const Vs=e=>Os(e),ks=e=>Os(e),Gs=(...e)=>Os(e),zs=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),$s=new WeakMap;function Ws(e){return zs.get(e)}function Hs(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function qs(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function js(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Xs(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)||/mat4/.test(e)?16:void o(`TSL: Unsupported type: ${e}`,new Is)}function Ks(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Qs(o,...u){const l=o?o.slice(-4):void 0;return 1===u.length&&("vec2"===l?u=[u[0],u[0]]:"vec3"===l?u=[u[0],u[0],u[0]]:"vec4"===l&&(u=[u[0],u[0],u[0],u[0]])),"color"===o?new e(...u):"vec2"===l?new t(...u):"vec3"===l?new r(...u):"vec4"===l?new s(...u):"mat2"===l?new i(...u):"mat3"===l?new n(...u):"mat4"===l?new a(...u):"bool"===o?u[0]||!1:"float"===o||"int"===o||"uint"===o?u[0]||0:"string"===o?u[0]||"":"ArrayBuffer"===o?Js(u[0]):null}function Ys(e){let t=$s.get(e);return void 0===t&&(t={},$s.set(e,t)),t}function Zs(e){let t="";const r=new Uint8Array(e);for(let e=0;ee.charCodeAt(0)).buffer}var ei=Object.freeze({__proto__:null,arrayBufferToBase64:Zs,base64ToArrayBuffer:Js,getAlignmentFromType:Xs,getDataFromObject:Ys,getLengthFromType:qs,getMemoryLengthFromType:js,getTypeFromLength:Ws,getTypedArrayFromType:Hs,getValueFromType:Qs,getValueType:Ks,hash:Gs,hashArray:ks,hashString:Vs});const ti={VERTEX:"vertex",FRAGMENT:"fragment"},ri={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},si={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},ii={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},ni=["fragment","vertex"],ai=["setup","analyze","generate"],oi=[...ni,"compute"],ui=["x","y","z","w"],li={analyze:"setup",generate:"analyze"};let di=0;class ci extends u{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=ri.NONE,this.updateBeforeType=ri.NONE,this.updateAfterType=ri.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=di++,this.stackTrace=null,!0===ci.captureStackTrace&&(this.stackTrace=new Is)}set needsUpdate(e){!0===e&&this.version++}get uuid(){return null===this._uuid&&(this._uuid=l.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,ri.FRAME)}onRenderUpdate(e){return this.onUpdate(e,ri.RENDER)}onObjectUpdate(e){return this.onUpdate(e,ri.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const r of Object.getOwnPropertyNames(this)){const s=this[r];if(!0!==r.startsWith("_")&&!e.has(s))if(!0===Array.isArray(s))for(let e=0;e0&&(e.inputNodes=r)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){const s=[];for(const i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if("object"==typeof e.inputNodes[r]){const s={};for(const i in e.inputNodes[r]){const n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{const s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){const{uuid:t,type:r}=this,s=void 0===e||"string"==typeof e;s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];function n(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(void 0===i&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==s&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),s){const t=n(e.textures),r=n(e.images),s=n(e.nodes);t.length>0&&(i.textures=t),r.length>0&&(i.images=r),s.length>0&&(i.nodes=s)}return i}}ci.captureStackTrace=!1;class hi extends ci{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class pi extends ci{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){const t=this.node.getNodeType(e);let r=null;for(const s of this.convertTo.split("|"))null!==r&&e.getTypeLength(t)!==e.getTypeLength(s)||(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}}class gi extends ci{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(void 0!==s.propertyName)return e.format(s.propertyName,r,t);if("void"!==r&&"void"!==t&&this.hasDependencies(e)){const i=super.build(e,r),n=e.getVarFromNode(this,null,r),a=e.getPropertyName(n);return e.addLineFlowCode(`${a} = ${i}`,this),s.snippet=i,s.propertyName=a,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class mi extends gi{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){const r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[];let u=0;for(const t of i){if(u>=s){o(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let i,l=t.getNodeType(e),d=e.getTypeLength(l);u+d>s&&(o(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=s-u,l=e.getTypeFromLength(d)),u+=d,i=t.build(e,l);if(e.getComponentType(l)!==n){const t=e.getTypeFromLength(d,n);i=e.format(i,l,t)}a.push(i)}const l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}}const fi=ui.join("");class yi extends ci{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ui.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const r=this.node,s=e.getTypeLength(r.getNodeType(e));let i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=r.build(e,n);i=this.components.length===s&&this.components===fi.slice(0,this.components.length)?e.format(a,n,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class bi extends gi{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),u=t.build(e,i),l=e.getTypeLength(i),d=[];for(let e=0;e(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");ci.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==Si?Si.assign(this,...e):o("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Is),this;{const t=Ri.get("assign");return this.addToStack(t(...e))}},ci.prototype.toVarIntent=function(){return this},ci.prototype.get=function(e){return new Ni(this,e)};const wi={};function Ci(e,t,r){wi[e]=wi[t]=wi[r]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new yi(this,e),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};const s=e.toUpperCase(),i=t.toUpperCase(),n=r.toUpperCase();ci.prototype["set"+s]=ci.prototype["set"+i]=ci.prototype["set"+n]=function(t){const r=Ai(e);return new bi(this,r,tn(t))},ci.prototype["flip"+s]=ci.prototype["flip"+i]=ci.prototype["flip"+n]=function(){const t=Ai(e);return new xi(this,t)}}const Mi=["x","y","z","w"],Bi=["r","g","b","a"],Fi=["s","t","p","q"];for(let e=0;e<4;e++){let t=Mi[e],r=Bi[e],s=Fi[e];Ci(t,r,s);for(let i=0;i<4;i++){t=Mi[e]+Mi[i],r=Bi[e]+Bi[i],s=Fi[e]+Fi[i],Ci(t,r,s);for(let n=0;n<4;n++){t=Mi[e]+Mi[i]+Mi[n],r=Bi[e]+Bi[i]+Bi[n],s=Fi[e]+Fi[i]+Fi[n],Ci(t,r,s);for(let a=0;a<4;a++)t=Mi[e]+Mi[i]+Mi[n]+Mi[a],r=Bi[e]+Bi[i]+Bi[n]+Bi[a],s=Fi[e]+Fi[i]+Fi[n]+Fi[a],Ci(t,r,s)}}}for(let e=0;e<32;e++)wi[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new hi(this,new vi(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(tn(t))}};Object.defineProperties(ci.prototype,wi);const Li=new WeakMap,Pi=function(e,t=null){for(const r in e)e[r]=tn(e[r],t);return e},Di=function(e,t=null){const r=e.length;for(let s=0;su?(o(`TSL: "${r}" parameter length exceeds limit.`,new Is),t.slice(0,u)):t}return null===t?n=(...t)=>i(new e(...nn(d(t)))):null!==r?(r=tn(r),n=(...s)=>i(new e(t,...nn(d(s)),r))):n=(...r)=>i(new e(t,...nn(d(r)))),n.setParameterLength=(...e)=>(1===e.length?a=u=e[0]:2===e.length&&([a,u]=e),n),n.setName=e=>(l=e,n),n},Ii=function(e,...t){return new e(...nn(t))};class Oi extends ci{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:r}=this,s=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||"",n=i||"default";if(s[n])return s[n];const a=e.subBuildFn,o=e.fnCall;e.subBuildFn=i,e.fnCall=this;let u=null;if(t.layout){let s=Li.get(e.constructor);void 0===s&&(s=new WeakMap,Li.set(e.constructor,s));let i=s.get(t);void 0===i&&(i=tn(e.buildFunctionNode(t)),s.set(t,i)),e.addInclude(i);const n=r?function(e){let t;sn(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(r):null;u=tn(i.call(n))}else{const s=new Proxy(e,{get:(e,t,r)=>{let s;return s=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,r),s}}),i=r?function(e){let t=0;return sn(e),new Proxy(e,{get:(r,s,i)=>{let n;if("length"===s)return n=e.length,n;if(Symbol.iterator===s)n=function*(){for(const t of e)yield tn(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const r=e[0];n=void 0===r[s]?r[t++]:Reflect.get(r,s,i)}else e[0]instanceof ci&&(n=void 0===e[s]?e[t++]:Reflect.get(e,s,i));else n=Reflect.get(r,s,i);n=tn(n)}return n}})}(r):null,n=Array.isArray(r)?r.length>0:null!==r,a=t.jsFunc,o=n||a.length>1?a(i,s):a(s);u=tn(o)}return e.subBuildFn=a,e.fnCall=o,t.once&&(s[n]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null;const s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getSubBuildOutput(this),a=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===s){const t=e.getSubBuildProperty("initialized",this);if(!0!==i[t]&&(i[t]=!0,i[n]=this.getOutputNode(e),i[n].build(e),this.shaderNode.subBuilds))for(const t of e.chaining){const r=e.getDataFromNode(t,"any");r.subBuilds=r.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)r.subBuilds.add(e)}r=i[n]}else"analyze"===s?a.build(e,t):"generate"===s&&(r=a.build(e,t)||"");return e.fnCall=o,r}}class Vi extends ci{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Oi(this,e)}setup(){return this.call()}}const ki=[!1,!0],Gi=[0,1,2,3],zi=[-1,-2],$i=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Wi=new Map;for(const e of ki)Wi.set(e,new vi(e));const Hi=new Map;for(const e of Gi)Hi.set(e,new vi(e,"uint"));const qi=new Map([...Hi].map(e=>new vi(e.value,"int")));for(const e of zi)qi.set(e,new vi(e,"int"));const ji=new Map([...qi].map(e=>new vi(e.value)));for(const e of $i)ji.set(e,new vi(e));for(const e of $i)ji.set(-e,new vi(-e));const Xi={bool:Wi,uint:Hi,ints:qi,float:ji},Ki=new Map([...Wi,...ji]),Qi=(e,t)=>Ki.has(e)?Ki.get(e):!0===e.isNode?e:new vi(e,t),Yi=function(e,t=null){return(...r)=>{for(const t of r)if(void 0===t)return o(`TSL: Invalid parameter for the type "${e}".`,new Is),new vi(0,e);if((0===r.length||!["bool","float","int","uint"].includes(e)&&r.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(r=[Qs(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return rn(t.get(r[0]));if(1===r.length){const t=Qi(r[0],e);return t.nodeType===e?rn(t):rn(new pi(t,e))}const s=r.map(e=>Qi(e));return rn(new mi(s,e))}};function Zi(e){return e&&e.isNode&&e.traverse(t=>{t.isConstNode&&(e=t.value)}),Boolean(e)}const Ji=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function en(e,t){return new Vi(e,t)}const tn=(e,t=null)=>function(e,t=null){const r=Ks(e);return"node"===r?e:null===t&&("float"===r||"boolean"===r)||r&&"shader"!==r&&"string"!==r?tn(Qi(e,t)):"shader"===r?e.isFn?e:cn(e):e}(e,t),rn=(e,t=null)=>tn(e,t).toVarIntent(),sn=(e,t=null)=>new Pi(e,t),nn=(e,t=null)=>new Di(e,t),an=(e,t=null,r=null,s=null)=>new Ui(e,t,r,s),on=(e,...t)=>new Ii(e,...t),un=(e,t=null,r=null,s={})=>new Ui(e,t,r,{...s,intent:!0});let ln=0;class dn extends ci{constructor(e,t=null){super();let r=null;null!==t&&("object"==typeof t?r=t.return:("string"==typeof t?r=t:o("TSL: Invalid layout type.",new Is),t=null)),this.shaderNode=new en(e,r),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const r={name:"fn"+ln++,type:t,inputs:[]};for(const t in e)"return"!==t&&r.inputs.push({name:t,type:e[t]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return o('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function cn(e,t=null){const r=new dn(e,t);return new Proxy(()=>{},{apply:(e,t,s)=>r.call(...s),get:(e,t,s)=>Reflect.get(r,t,s),set:(e,t,s,i)=>Reflect.set(r,t,s,i)})}const hn=e=>{Si=e},pn=()=>Si,gn=(...e)=>Si.If(...e);function mn(e){return Si&&Si.addToStack(e),e}Ei("toStack",mn);const fn=new Yi("color"),yn=new Yi("float",Xi.float),bn=new Yi("int",Xi.ints),xn=new Yi("uint",Xi.uint),Tn=new Yi("bool",Xi.bool),_n=new Yi("vec2"),vn=new Yi("ivec2"),Nn=new Yi("uvec2"),Sn=new Yi("bvec2"),Rn=new Yi("vec3"),En=new Yi("ivec3"),An=new Yi("uvec3"),wn=new Yi("bvec3"),Cn=new Yi("vec4"),Mn=new Yi("ivec4"),Bn=new Yi("uvec4"),Fn=new Yi("bvec4"),Ln=new Yi("mat2"),Pn=new Yi("mat3"),Dn=new Yi("mat4");Ei("toColor",fn),Ei("toFloat",yn),Ei("toInt",bn),Ei("toUint",xn),Ei("toBool",Tn),Ei("toVec2",_n),Ei("toIVec2",vn),Ei("toUVec2",Nn),Ei("toBVec2",Sn),Ei("toVec3",Rn),Ei("toIVec3",En),Ei("toUVec3",An),Ei("toBVec3",wn),Ei("toVec4",Cn),Ei("toIVec4",Mn),Ei("toUVec4",Bn),Ei("toBVec4",Fn),Ei("toMat2",Ln),Ei("toMat3",Pn),Ei("toMat4",Dn);const Un=an(hi).setParameterLength(2),In=(e,t)=>new pi(tn(e),t);Ei("element",Un),Ei("convert",In);Ei("append",e=>(d("TSL: .append() has been renamed to .toStack().",new Is),mn(e)));class On extends ci{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return Vs(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Vn=(e,t)=>new On(e,t),kn=(e,t)=>new On(e,t,!0),Gn=on(On,"vec4","DiffuseColor"),zn=on(On,"vec3","DiffuseContribution"),$n=on(On,"vec3","EmissiveColor"),Wn=on(On,"float","Roughness"),Hn=on(On,"float","Metalness"),qn=on(On,"float","Clearcoat"),jn=on(On,"float","ClearcoatRoughness"),Xn=on(On,"vec3","Sheen"),Kn=on(On,"float","SheenRoughness"),Qn=on(On,"float","Iridescence"),Yn=on(On,"float","IridescenceIOR"),Zn=on(On,"float","IridescenceThickness"),Jn=on(On,"float","AlphaT"),ea=on(On,"float","Anisotropy"),ta=on(On,"vec3","AnisotropyT"),ra=on(On,"vec3","AnisotropyB"),sa=on(On,"color","SpecularColor"),ia=on(On,"color","SpecularColorBlended"),na=on(On,"float","SpecularF90"),aa=on(On,"float","Shininess"),oa=on(On,"vec4","Output"),ua=on(On,"float","dashSize"),la=on(On,"float","gapSize"),da=on(On,"float","pointWidth"),ca=on(On,"float","IOR"),ha=on(On,"float","Transmission"),pa=on(On,"float","Thickness"),ga=on(On,"float","AttenuationDistance"),ma=on(On,"color","AttenuationColor"),fa=on(On,"float","Dispersion");class ya extends ci{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1,s=null){super("string"),this.name=e,this.shared=t,this.order=r,this.updateType=s,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const ba=(e,t=1,r=null)=>new ya(e,!1,t,r),xa=(e,t=0,r=null)=>new ya(e,!0,t,r),Ta=xa("frame",0,ri.FRAME),_a=xa("render",0,ri.RENDER),va=ba("object",1,ri.OBJECT);class Na extends Ti{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=va}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const r=e(t,this);void 0!==r&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const r=this.getNodeType(e),s=this.getUniformHash(e);let i=e.getNodeFromHash(s);void 0===i&&(e.setHashNode(this,s),i=this);const n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let u=o;if("bool"===r){const t=e.getDataFromNode(this);let s=t.propertyName;if(void 0===s){const i=e.getVarFromNode(this,null,"bool");s=e.getPropertyName(i),t.propertyName=s,u=e.format(o,n,r),e.addLineFlowCode(`${s} = ${u}`,this)}u=s}return e.format(u,r,t)}}const Sa=(e,t)=>{const r=Ji(t||e);if(r===e&&(e=Qs(r)),e&&!0===e.isNode){let t=e.value;e.traverse(e=>{!0===e.isConstNode&&(t=e.value)}),e=t}return new Na(e,r)};class Ra extends gi{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return null===this.nodeType?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return null===this.nodeType?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const Ea=(...e)=>{let t;if(1===e.length){const r=e[0];t=new Ra(null,r.length,r)}else{const r=e[0],s=e[1];t=new Ra(r,s)}return tn(t)};Ei("toArray",(e,t)=>Ea(Array(t).fill(e)));class Aa extends gi{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const r=e.getTypeLength(t.node.getNodeType(e));return ui.join("").slice(0,r)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:r}=this,s=t.getScope();e.getDataFromNode(s).assign=!0;const i=e.getNodeProperties(this);i.sourceNode=r,i.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.build(e),a=r.getNodeType(e),o=s.build(e,a),u=s.getNodeType(e),l=e.getDataFromNode(this);let d;if(!0===l.initialized)"void"!==t&&(d=n);else if(i){const s=e.getVarFromNode(this,null,a),i=e.getPropertyName(s);e.addLineFlowCode(`${i} = ${o}`,this);const u=r.node,l=u.node.context({assign:!0}).build(e);for(let t=0;t{const s=r.type;let i;return i="pointer"===s?"&"+t.build(e):t.build(e,s),i};if(Array.isArray(i)){if(i.length>s.length)o("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length(t=t.length>1||t[0]&&!0===t[0].isNode?nn(t):sn(t[0]),new Ca(tn(e),t));Ei("call",Ma);const Ba={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Fa extends gi{static get type(){return"OperatorNode"}constructor(e,t,r,...s){if(super(),s.length>0){let i=new Fa(e,t,r);for(let t=0;t>"===r||"<<"===r)return e.getIntegerType(n);if("!"===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r){const t=Math.max(e.getTypeLength(n),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(n)){if("float"===a)return n;if(e.isVector(a))return e.getVectorFromMatrix(n);if(e.isMatrix(a))return n}else if(e.isMatrix(a)){if("float"===n)return a;if(e.isVector(n))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(n)?a:n}generate(e,t){const r=this.op,{aNode:s,bNode:i}=this,n=this.getNodeType(e,t);let a=null,o=null;"void"!==n?(a=s.getNodeType(e),o=i?i.getNodeType(e):null,"<"===r||">"===r||"<="===r||">="===r||"=="===r||"!="===r?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===r||"<<"===r?(a=n,o=e.changeComponentType(o,"uint")):"%"===r?(a=n,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=n):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=n:o=n):a=o=n;const u=s.build(e,a),l=i?i.build(e,o):null,d=e.getFunctionOperator(r);if("void"!==t){const s=e.renderer.coordinateSystem===c;if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r)return s&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${u}, ${l} )`,n,t):e.format(`( ${u} ${r} ${l} )`,n,t);if("%"===r)return e.isInteger(o)?e.format(`( ${u} % ${l} )`,n,t):e.format(`${this.getOperatorMethod(e,n)}( ${u}, ${l} )`,n,t);if("!"===r||"~"===r)return e.format(`(${r}${u})`,a,t);if(d)return e.format(`${d}( ${u}, ${l} )`,n,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${l} ${r} ${u} )`,n,t);if("float"===a&&e.isMatrix(o))return e.format(`${u} ${r} ${l}`,n,t);{let i=`( ${u} ${r} ${l} )`;return!s&&"bool"===n&&e.isVector(a)&&e.isVector(o)&&(i=`all${i}`),e.format(i,n,t)}}if("void"!==a)return d?e.format(`${d}( ${u}, ${l} )`,n,t):e.isMatrix(a)&&"float"===o?e.format(`${l} ${r} ${u}`,n,t):e.format(`${u} ${r} ${l}`,n,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const La=un(Fa,"+").setParameterLength(2,1/0).setName("add"),Pa=un(Fa,"-").setParameterLength(2,1/0).setName("sub"),Da=un(Fa,"*").setParameterLength(2,1/0).setName("mul"),Ua=un(Fa,"/").setParameterLength(2,1/0).setName("div"),Ia=un(Fa,"%").setParameterLength(2).setName("mod"),Oa=un(Fa,"==").setParameterLength(2).setName("equal"),Va=un(Fa,"!=").setParameterLength(2).setName("notEqual"),ka=un(Fa,"<").setParameterLength(2).setName("lessThan"),Ga=un(Fa,">").setParameterLength(2).setName("greaterThan"),za=un(Fa,"<=").setParameterLength(2).setName("lessThanEqual"),$a=un(Fa,">=").setParameterLength(2).setName("greaterThanEqual"),Wa=un(Fa,"&&").setParameterLength(2,1/0).setName("and"),Ha=un(Fa,"||").setParameterLength(2,1/0).setName("or"),qa=un(Fa,"!").setParameterLength(1).setName("not"),ja=un(Fa,"^^").setParameterLength(2).setName("xor"),Xa=un(Fa,"&").setParameterLength(2).setName("bitAnd"),Ka=un(Fa,"~").setParameterLength(1).setName("bitNot"),Qa=un(Fa,"|").setParameterLength(2).setName("bitOr"),Ya=un(Fa,"^").setParameterLength(2).setName("bitXor"),Za=un(Fa,"<<").setParameterLength(2).setName("shiftLeft"),Ja=un(Fa,">>").setParameterLength(2).setName("shiftRight"),eo=cn(([e])=>(e.addAssign(1),e)),to=cn(([e])=>(e.subAssign(1),e)),ro=cn(([e])=>{const t=bn(e).toConst();return e.addAssign(1),t}),so=cn(([e])=>{const t=bn(e).toConst();return e.subAssign(1),t});Ei("add",La),Ei("sub",Pa),Ei("mul",Da),Ei("div",Ua),Ei("mod",Ia),Ei("equal",Oa),Ei("notEqual",Va),Ei("lessThan",ka),Ei("greaterThan",Ga),Ei("lessThanEqual",za),Ei("greaterThanEqual",$a),Ei("and",Wa),Ei("or",Ha),Ei("not",qa),Ei("xor",ja),Ei("bitAnd",Xa),Ei("bitNot",Ka),Ei("bitOr",Qa),Ei("bitXor",Ya),Ei("shiftLeft",Za),Ei("shiftRight",Ja),Ei("incrementBefore",eo),Ei("decrementBefore",to),Ei("increment",ro),Ei("decrement",so);const io=(e,t)=>(d('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new Is),Ia(bn(e),bn(t)));Ei("modInt",io);class no extends gi{static get type(){return"MathNode"}constructor(e,t,r=null,s=null){if(super(),(e===no.MAX||e===no.MIN)&&arguments.length>3){let i=new no(e,t,r);for(let t=2;tn&&i>a?t:n>a?r:a>i?s:t}generateNodeType(e){const t=this.method;return t===no.LENGTH||t===no.DISTANCE||t===no.DOT?"float":t===no.CROSS?"vec3":t===no.ALL||t===no.ANY?"bool":t===no.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:r,method:s}=this;let i=null;if(s===no.ONE_MINUS)i=Pa(1,t);else if(s===no.RECIPROCAL)i=Ua(1,t);else if(s===no.DIFFERENCE)i=Vo(Pa(t,r));else if(s===no.TRANSFORM_DIRECTION){let s=t,n=r;e.isMatrix(s.getNodeType(e))?n=Cn(Rn(n),0):s=Cn(Rn(s),0);const a=Da(s,n).xyz;i=Ro(a)}return null!==i?i:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method;const s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=this.cNode,u=e.renderer.coordinateSystem;if(r===no.NEGATE)return e.format("( - "+n.build(e,i)+" )",s,t);{const l=[];return r===no.CROSS?l.push(n.build(e,s),a.build(e,s)):u===c&&r===no.STEP?l.push(n.build(e,1===e.getTypeLength(n.getNodeType(e))?"float":i),a.build(e,i)):u!==c||r!==no.MIN&&r!==no.MAX?r===no.REFRACT?l.push(n.build(e,i),a.build(e,i),o.build(e,"float")):r===no.MIX?l.push(n.build(e,i),a.build(e,i),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":i)):(u===h&&r===no.ATAN&&null!==a&&(r="atan2"),"fragment"===e.shaderStage||r!==no.DFDX&&r!==no.DFDY||(d(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),l.push(n.build(e,i)),null!==a&&l.push(a.build(e,i)),null!==o&&l.push(o.build(e,i))):l.push(n.build(e,i),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":i)),e.format(`${e.getMethod(r,s)}( ${l.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}no.ALL="all",no.ANY="any",no.RADIANS="radians",no.DEGREES="degrees",no.EXP="exp",no.EXP2="exp2",no.LOG="log",no.LOG2="log2",no.SQRT="sqrt",no.INVERSE_SQRT="inversesqrt",no.FLOOR="floor",no.CEIL="ceil",no.NORMALIZE="normalize",no.FRACT="fract",no.SIN="sin",no.SINH="sinh",no.COS="cos",no.COSH="cosh",no.TAN="tan",no.TANH="tanh",no.ASIN="asin",no.ASINH="asinh",no.ACOS="acos",no.ACOSH="acosh",no.ATAN="atan",no.ATANH="atanh",no.ABS="abs",no.SIGN="sign",no.LENGTH="length",no.NEGATE="negate",no.ONE_MINUS="oneMinus",no.DFDX="dFdx",no.DFDY="dFdy",no.ROUND="round",no.RECIPROCAL="reciprocal",no.TRUNC="trunc",no.FWIDTH="fwidth",no.TRANSPOSE="transpose",no.DETERMINANT="determinant",no.INVERSE="inverse",no.EQUALS="equals",no.MIN="min",no.MAX="max",no.STEP="step",no.REFLECT="reflect",no.DISTANCE="distance",no.DIFFERENCE="difference",no.DOT="dot",no.CROSS="cross",no.POW="pow",no.TRANSFORM_DIRECTION="transformDirection",no.MIX="mix",no.CLAMP="clamp",no.REFRACT="refract",no.SMOOTHSTEP="smoothstep",no.FACEFORWARD="faceforward";const ao=yn(1e-6),oo=yn(1e6),uo=yn(Math.PI),lo=yn(2*Math.PI),co=yn(2*Math.PI),ho=yn(.5*Math.PI),po=un(no,no.ALL).setParameterLength(1),go=un(no,no.ANY).setParameterLength(1),mo=un(no,no.RADIANS).setParameterLength(1),fo=un(no,no.DEGREES).setParameterLength(1),yo=un(no,no.EXP).setParameterLength(1),bo=un(no,no.EXP2).setParameterLength(1),xo=un(no,no.LOG).setParameterLength(1),To=un(no,no.LOG2).setParameterLength(1),_o=un(no,no.SQRT).setParameterLength(1),vo=un(no,no.INVERSE_SQRT).setParameterLength(1),No=un(no,no.FLOOR).setParameterLength(1),So=un(no,no.CEIL).setParameterLength(1),Ro=un(no,no.NORMALIZE).setParameterLength(1),Eo=un(no,no.FRACT).setParameterLength(1),Ao=un(no,no.SIN).setParameterLength(1),wo=un(no,no.SINH).setParameterLength(1),Co=un(no,no.COS).setParameterLength(1),Mo=un(no,no.COSH).setParameterLength(1),Bo=un(no,no.TAN).setParameterLength(1),Fo=un(no,no.TANH).setParameterLength(1),Lo=un(no,no.ASIN).setParameterLength(1),Po=un(no,no.ASINH).setParameterLength(1),Do=un(no,no.ACOS).setParameterLength(1),Uo=un(no,no.ACOSH).setParameterLength(1),Io=un(no,no.ATAN).setParameterLength(1,2),Oo=un(no,no.ATANH).setParameterLength(1),Vo=un(no,no.ABS).setParameterLength(1),ko=un(no,no.SIGN).setParameterLength(1),Go=un(no,no.LENGTH).setParameterLength(1),zo=un(no,no.NEGATE).setParameterLength(1),$o=un(no,no.ONE_MINUS).setParameterLength(1),Wo=un(no,no.DFDX).setParameterLength(1),Ho=un(no,no.DFDY).setParameterLength(1),qo=un(no,no.ROUND).setParameterLength(1),jo=un(no,no.RECIPROCAL).setParameterLength(1),Xo=un(no,no.TRUNC).setParameterLength(1),Ko=un(no,no.FWIDTH).setParameterLength(1),Qo=un(no,no.TRANSPOSE).setParameterLength(1),Yo=un(no,no.DETERMINANT).setParameterLength(1),Zo=un(no,no.INVERSE).setParameterLength(1),Jo=un(no,no.MIN).setParameterLength(2,1/0),eu=un(no,no.MAX).setParameterLength(2,1/0),tu=un(no,no.STEP).setParameterLength(2),ru=un(no,no.REFLECT).setParameterLength(2),su=un(no,no.DISTANCE).setParameterLength(2),iu=un(no,no.DIFFERENCE).setParameterLength(2),nu=un(no,no.DOT).setParameterLength(2),au=un(no,no.CROSS).setParameterLength(2),ou=un(no,no.POW).setParameterLength(2),uu=e=>Da(e,e),lu=e=>Da(e,e,e),du=e=>Da(e,e,e,e),cu=un(no,no.TRANSFORM_DIRECTION).setParameterLength(2),hu=e=>Da(ko(e),ou(Vo(e),1/3)),pu=e=>nu(e,e),gu=un(no,no.MIX).setParameterLength(3),mu=(e,t=0,r=1)=>new no(no.CLAMP,tn(e),tn(t),tn(r)),fu=e=>mu(e),yu=un(no,no.REFRACT).setParameterLength(3),bu=un(no,no.SMOOTHSTEP).setParameterLength(3),xu=un(no,no.FACEFORWARD).setParameterLength(3),Tu=cn(([e])=>{const t=nu(e.xy,_n(12.9898,78.233)),r=Ia(t,uo);return Eo(Ao(r).mul(43758.5453))}),_u=(e,t,r)=>gu(t,r,e),vu=(e,t,r)=>bu(t,r,e),Nu=(e,t)=>tu(t,e),Su=xu,Ru=vo;Ei("all",po),Ei("any",go),Ei("radians",mo),Ei("degrees",fo),Ei("exp",yo),Ei("exp2",bo),Ei("log",xo),Ei("log2",To),Ei("sqrt",_o),Ei("inverseSqrt",vo),Ei("floor",No),Ei("ceil",So),Ei("normalize",Ro),Ei("fract",Eo),Ei("sin",Ao),Ei("sinh",wo),Ei("cos",Co),Ei("cosh",Mo),Ei("tan",Bo),Ei("tanh",Fo),Ei("asin",Lo),Ei("asinh",Po),Ei("acos",Do),Ei("acosh",Uo),Ei("atan",Io),Ei("atanh",Oo),Ei("abs",Vo),Ei("sign",ko),Ei("length",Go),Ei("lengthSq",pu),Ei("negate",zo),Ei("oneMinus",$o),Ei("dFdx",Wo),Ei("dFdy",Ho),Ei("round",qo),Ei("reciprocal",jo),Ei("trunc",Xo),Ei("fwidth",Ko),Ei("min",Jo),Ei("max",eu),Ei("step",Nu),Ei("reflect",ru),Ei("distance",su),Ei("dot",nu),Ei("cross",au),Ei("pow",ou),Ei("pow2",uu),Ei("pow3",lu),Ei("pow4",du),Ei("transformDirection",cu),Ei("mix",_u),Ei("clamp",mu),Ei("refract",yu),Ei("smoothstep",vu),Ei("faceForward",xu),Ei("difference",iu),Ei("saturate",fu),Ei("cbrt",hu),Ei("transpose",Qo),Ei("determinant",Yo),Ei("inverse",Zo),Ei("rand",Tu);class Eu extends ci{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}generateNodeType(e){const{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const s=t.getNodeType(e);if(null!==r){const t=r.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(s))return t}return s}setup(e){const t=this.condNode,r=this.ifNode.isolate(),s=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,null!==s&&(e.getDataFromNode(s).parentNodeBlock=i);const n=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n?r:r.context({nodeBlock:r}),a.elseNode=s?n?s:s.context({nodeBlock:s}):null}generate(e,t){const r=this.getNodeType(e),s=e.getDataFromNode(this);if(void 0!==s.nodeProperty)return s.nodeProperty;const{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,u="void"!==t,l=u?Vn(r).build(e):"";s.nodeProperty=l;const c=i.build(e,"bool");if(e.context.uniformFlow&&null!==a){const s=n.build(e,r),i=a.build(e,r),o=e.getTernary(c,s,i);return e.format(o,r,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=n.build(e,r);if(h&&(u?h=l+" = "+h+";":(h="return "+h+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,r);t&&(u?t=l+" = "+t+";":(t="return "+t+";",null===o&&(d("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,r,t)}}const Au=an(Eu).setParameterLength(2,3);Ei("select",Au);class wu extends ci{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{!0===t.isContextNode&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const r=e.addContext(this.value),s=this.node.build(e,t);return e.setContext(r),s}}const Cu=(e=null,t={})=>{let r=e;return null!==r&&!0===r.isNode||(t=r||t,r=null),new wu(r,t)},Mu=e=>Cu(e,{uniformFlow:!0}),Bu=(e,t)=>Cu(e,{nodeName:t});function Fu(e,t,r=null){return Cu(r,{getShadow:({light:r,shadowColorNode:s})=>t===r?s.mul(e):s})}function Lu(e,t=null){return Cu(t,{getAO:(t,{material:r})=>!0===r.transparent?t:null!==t?t.mul(e):e})}function Pu(e,t){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),Bu(e,t)}Ei("context",Cu),Ei("label",Pu),Ei("uniformFlow",Mu),Ei("setName",Bu),Ei("builtinShadowContext",(e,t,r)=>Fu(t,r,e)),Ei("builtinAOContext",(e,t)=>Lu(t,e));class Du extends ci{static get type(){return"VarNode"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return!0!==e.getDataFromNode(this).forceDeclaration&&this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;if(this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&t.fnCall&&t.fnCall.shaderNode){if(t.getDataFromNode(this.node.shaderNode).hasLoop){t.getDataFromNode(this).forceDeclaration=!0,e=!0}}const r=t.getBaseStack();e?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:r,readOnly:s}=this,{renderer:i}=e,n=!0===i.backend.isWebGPUBackend;let a=!1,u=!1;s&&(a=e.isDeterministic(t),u=n?s:a);const l=this.getNodeType(e);if("void"==l){!0!==this.isIntent(e)&&o('TSL: ".toVar()" can not be used with void type.',this.stackTrace);return t.build(e)}const d=e.getVectorType(l),c=t.build(e,d),h=e.getVarFromNode(this,r,d,void 0,u),p=e.getPropertyName(h);let g=p;if(u)if(n)g=a?`const ${p}`:`let ${p}`;else{const r=t.getArrayCount(e);g=`const ${e.getVar(h.type,p,r)}`}return e.addLineFlowCode(`${g} = ${c}`,this),p}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}const Uu=an(Du),Iu=(e,t=null)=>Uu(e,t).toStack(),Ou=(e,t=null)=>Uu(e,t,!0).toStack(),Vu=e=>Uu(e).setIntent(!0).toStack();Ei("toVar",Iu),Ei("toConst",Ou),Ei("toVarIntent",Vu);class ku extends ci{static get type(){return"SubBuild"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const r=this.node.build(e,...t);return e.removeSubBuild(),r}}const Gu=(e,t,r=null)=>new ku(tn(e),t,r);class zu extends ci{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Gu(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let r=t.varying;if(void 0===r){const s=this.name,i=this.getNodeType(e),n=this.interpolationType,a=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,s,i,n,a),t.node=Gu(this.node,"VERTEX")}return r.needsInterpolation||(r.needsInterpolation="fragment"===e.shaderStage),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ti.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),r=e.getNodeProperties(this),s=this.setupVarying(e);if(void 0===r[t]){const i=this.getNodeType(e),n=e.getPropertyName(s,ti.VERTEX);e.flowNodeFromShaderStage(ti.VERTEX,r.node,i,n),r[t]=n}return e.getPropertyName(s)}}const $u=an(zu).setParameterLength(1,2),Wu=e=>$u(e);Ei("toVarying",$u),Ei("toVertexStage",Wu);const Hu=cn(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),r=e.mul(.0773993808),s=e.lessThanEqual(.04045);return gu(t,r,s)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qu=cn(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),s=e.lessThanEqual(.0031308);return gu(t,r,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),ju="WorkingColorSpace";class Xu extends gi{static get type(){return"ColorSpaceNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===ju?p.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),s=this.resolveColorSpace(e,this.target);let i=t;return!1!==p.enabled&&r!==s&&r&&s?(p.getTransfer(r)===g&&(i=Cn(Hu(i.rgb),i.a)),p.getPrimaries(r)!==p.getPrimaries(s)&&(i=Cn(Pn(p._getMatrix(new n,r,s)).mul(i.rgb),i.a)),p.getTransfer(s)===g&&(i=Cn(qu(i.rgb),i.a)),i):i}}const Ku=(e,t)=>new Xu(tn(e),ju,t),Qu=(e,t)=>new Xu(tn(e),t,ju);Ei("workingToColorSpace",Ku),Ei("colorSpaceToWorking",Qu);let Yu=class extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(),s=this.getNodeType();return e.format(t,r,s)}};class Zu extends ci{static get type(){return"ReferenceBaseNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.updateType=ri.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Yu(this,tn(e))}setNodeType(e){const t=Sa(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Ju(e,t,r);class tl extends gi{static get type(){return"ToneMappingNode"}constructor(e,t=sl,r=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return Gs(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,r=this._toneMapping;if(r===m)return t;let s=null;const i=e.renderer.library.getToneMappingFunction(r);return null!==i?s=Cn(i(t.rgb,this.exposureNode),t.a):(o("ToneMappingNode: Unsupported Tone Mapping configuration.",r),s=t),s}}const rl=(e,t,r)=>new tl(e,tn(t),tn(r)),sl=el("toneMappingExposure","float");Ei("toneMapping",(e,t,r)=>rl(t,r,e));const il=new WeakMap;function nl(e,t){let r=il.get(e);return void 0===r&&(r=new b(e,t),il.set(e,r)),r}class al extends Ti{static get type(){return"BufferAttributeNode"}constructor(e,t=null,r=0,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=s,this.usage=f,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(0===this.bufferStride&&0===this.bufferOffset){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}generateNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),r=e.getTypeLength(t),s=this.value,i=this.bufferStride||r,n=this.bufferOffset;let a;a=!0===s.isInterleavedBuffer?s:!0===s.isBufferAttribute?nl(s.array,i):nl(s,i);const o=new y(a,r,n);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),r=e.getBufferAttributeFromNode(this,t),s=e.getPropertyName(r);let i=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=s,i=s;else{i=$u(this).build(e,t)}return i}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function ol(e,t=null,r=0,s=0,i=f,n=!1){return"mat3"===t||null===t&&9===e.itemSize?Pn(new al(e,"vec3",9,0).setUsage(i).setInstanced(n),new al(e,"vec3",9,3).setUsage(i).setInstanced(n),new al(e,"vec3",9,6).setUsage(i).setInstanced(n)):"mat4"===t||null===t&&16===e.itemSize?Dn(new al(e,"vec4",16,0).setUsage(i).setInstanced(n),new al(e,"vec4",16,4).setUsage(i).setInstanced(n),new al(e,"vec4",16,8).setUsage(i).setInstanced(n),new al(e,"vec4",16,12).setUsage(i).setInstanced(n)):new al(e,t,r,s).setUsage(i)}const ul=(e,t=null,r=0,s=0)=>ol(e,t,r,s),ll=(e,t=null,r=0,s=0)=>ol(e,t,r,s,f,!0),dl=(e,t=null,r=0,s=0)=>ol(e,t,r,s,x,!0);Ei("toAttribute",e=>ul(e.value));class cl extends ci{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),r=this.scope;let s,i;if(r===cl.VERTEX)s=e.getVertexIndex();else if(r===cl.INSTANCE)s=e.getInstanceIndex();else if(r===cl.DRAW)s=e.getDrawIndex();else if(r===cl.INVOCATION_LOCAL)s=e.getInvocationLocalIndex();else if(r===cl.INVOCATION_SUBGROUP)s=e.getInvocationSubgroupIndex();else{if(r!==cl.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+r);s=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)i=s;else{i=$u(this).build(e,t)}return i}}cl.VERTEX="vertex",cl.INSTANCE="instance",cl.SUBGROUP="subgroup",cl.INVOCATION_LOCAL="invocationLocal",cl.INVOCATION_SUBGROUP="invocationSubgroup",cl.DRAW="draw";const hl=on(cl,cl.VERTEX),pl=on(cl,cl.INSTANCE),gl=on(cl,cl.SUBGROUP),ml=on(cl,cl.INVOCATION_SUBGROUP),fl=on(cl,cl.INVOCATION_LOCAL),yl=on(cl,cl.DRAW);class bl extends ci{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=ri.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){null!==this.count&&null===this.countNode&&(this.countNode=Sa(this.count,"uint").onObjectUpdate(()=>this.count));const t=this.computeNode.build(e);if(t){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:r}=e;if("compute"===r){const t=this.computeNode.build(e,"void");if(""!==t&&e.addLineFlowCode(t,this),null!==this.count&&!0===e.allowEarlyReturns){const t=this.countNode.build(e,"uint"),r=pl.build(e,"uint");e.flow.code=`${e.tab}if ( ${r} >= ${t} ) { return; }\n\n${e.flow.code}`}}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const xl=(e,t=[64])=>{(0===t.length||t.length>3)&&o("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Is);for(let e=0;e{const s=xl(e,r);return"number"==typeof t?s.count=t:s.dispatchSize=t,s};Ei("compute",Tl),Ei("computeKernel",xl);class _l extends ci{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){const t=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.getNodeType(e);return e.setCache(t),s}build(e,...t){const r=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const i=this.node.build(e,...t);return e.setCache(r),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const vl=e=>new _l(tn(e));function Nl(e,t=!0){return d('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),vl(e).setParent(t)}Ei("cache",Nl),Ei("isolate",vl);class Sl extends ci{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Rl=an(Sl).setParameterLength(2);Ei("bypass",Rl);const El=cn(([e,t,r,s=yn(0),i=yn(1),n=Tn(!1)])=>{let a=e.sub(t).div(r.sub(t));return Zi(n)&&(a=a.clamp()),a.mul(i.sub(s)).add(s)});function Al(e,t,r,s=yn(0),i=yn(1)){return El(e,t,r,s,i,!0)}Ei("remap",El),Ei("remapClamp",Al);class wl extends ci{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const r=this.getNodeType(e),s=this.snippet;if("void"!==r)return e.format(s,r,t);e.addLineFlowCode(s,this)}}const Cl=an(wl).setParameterLength(1,2),Ml=e=>(e?Au(e,Cl("discard")):Cl("discard")).toStack();Ei("discard",Ml);class Bl extends gi{static get type(){return"RenderOutputNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const r=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||m,s=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||T;return r!==m&&(t=t.toneMapping(r)),s!==T&&s!==p.workingColorSpace&&(t=t.workingToColorSpace(s)),t}}const Fl=(e,t=null,r=null)=>new Bl(tn(e),t,r);Ei("renderOutput",Fl);class Ll extends gi{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,r=this.node.build(e);if(null!==t)t(e,r);else{const t="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(t.length);let i="";i+="// #"+t+"#\n",i+=e.flow.code.replace(/^\t/gm,"")+"\n",i+="/* ... */ "+r+" /* ... */\n",i+="// #"+s+"#\n",_(i)}return r}}const Pl=(e,t=null)=>new Ll(tn(e),t).toStack();Ei("debug",Pl);class Dl extends u{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class Ul extends ci{static get type(){return"InspectorNode"}constructor(e,t="",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=ri.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==Dl&&v('TSL: ".toInspector()" is only available with WebGPU.'),t}}function Il(e,t="",r=null){return(e=tn(e)).before(new Ul(e,t,r))}Ei("toInspector",Il);class Ol extends ci{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(null===t){const r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){const s=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(s)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),r=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const s=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(s),n=e.getAttribute(t,i);if("vertex"===e.shaderStage)return e.format(n.name,i,r);return $u(this).build(e,r)}return d(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(r)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Vl=(e,t=null)=>new Ol(e,t),kl=(e=0)=>Vl("uv"+(e>0?e:""),"vec2");class Gl extends ci{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const r=this.textureNode.build(e,"property"),s=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${r}, ${s} )`,this.getNodeType(e),t)}}const zl=an(Gl).setParameterLength(1,2);class $l extends Na{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=ri.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&void 0!==r.width){const{width:e,height:t}=r;this.value=Math.log2(Math.max(e,t))}}}const Wl=an($l).setParameterLength(1);class Hl extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const ql=new N;class jl extends Na{static get type(){return"TextureNode"}constructor(e=ql,t=null,r=null,s=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=s,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=ri.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===S?"uvec4":this.value.type===R?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return kl(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=Sa(this.value.matrix)),this._matrixUniform.mul(Rn(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=Sa(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(bn(zl(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const r=this.value;if(!r||!0!==r.isTexture)throw new Hl("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const s=cn(()=>{let t=this.uvNode;return null!==t&&!0!==e.context.forceUVContext||!e.context.getUV||(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?ri.OBJECT:ri.NONE,t})();let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this));let n=null,a=null;if(null!==this.compareNode)if(e.renderer.hasCompatibility(E.TEXTURE_COMPARE))n=this.compareNode;else{const e=r.compareFunction;null===e||e===A||e===w||e===C||e===M?a=this.compareNode:(n=this.compareNode,v('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=s,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=n,t.compareStepNode=a,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;let d;return d=i?e.generateTextureBias(l,t,r,i,n,u):o?e.generateTextureGrad(l,t,r,o,n,u):a?e.generateTextureCompare(l,t,r,a,n,u):!1===this.sampler?e.generateTextureLoad(l,t,r,s,n,u):s?e.generateTextureLevel(l,t,r,s,n,u):e.generateTexture(l,t,r,n,u),d}generate(e,t){const r=this.value,s=e.getNodeProperties(this),i=super.generate(e,"property");if(/^sampler/.test(t))return i+"_sampler";if(e.isReference(t))return i;{const n=e.getDataFromNode(this),a=this.getNodeType(e);let o=n.propertyName;if(void 0===o){const{uvNode:t,levelNode:u,biasNode:l,compareNode:d,compareStepNode:c,depthNode:h,gradNode:p,offsetNode:g}=s,m=this.generateUV(e,t),f=u?u.build(e,"float"):null,y=l?l.build(e,"float"):null,b=h?h.build(e,"int"):null,x=d?d.build(e,"float"):null,T=c?c.build(e,"float"):null,_=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,v=g?this.generateOffset(e,g):null;let N=b;null===N&&r.isArrayTexture&&!0!==this.isTexture3DNode&&(N="0");const S=e.getVarFromNode(this);o=e.getPropertyName(S);let R=this.generateSnippet(e,i,m,f,y,N,x,_,v);if(null!==T){const t=r.compareFunction;R=t===C||t===M?tu(Cl(R,a),Cl(T,"float")).build(e,a):tu(Cl(T,"float"),Cl(R,a)).build(e,a)}e.addLineFlowCode(`${o} = ${R}`,this),n.snippet=R,n.propertyName=o}let u=o;return e.needsToWorkingColorSpace(r)&&(u=Qu(Cl(u,a),r.colorSpace).setup(e).build(e,a)),e.format(u,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=tn(e),t.referenceNode=this.getBase(),tn(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=tn(e).mul(Wl(t)),t.referenceNode=this.getBase();const r=t.value;return!1===t.generateMipmaps&&(r&&!1===r.generateMipmaps||r.minFilter===B||r.magFilter===B)&&(d("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),tn(t)}level(e){const t=this.clone();return t.levelNode=tn(e),t.referenceNode=this.getBase(),tn(t)}size(e){return zl(this,e)}bias(e){const t=this.clone();return t.biasNode=tn(e),t.referenceNode=this.getBase(),tn(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=tn(e),t.referenceNode=this.getBase(),tn(t)}grad(e,t){const r=this.clone();return r.gradNode=[tn(e),tn(t)],r.referenceNode=this.getBase(),tn(r)}depth(e){const t=this.clone();return t.depthNode=tn(e),t.referenceNode=this.getBase(),tn(t)}offset(e){const t=this.clone();return t.offsetNode=tn(e),t.referenceNode=this.getBase(),tn(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();const r=this._flipYUniform;null!==r&&(r.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const Xl=an(jl).setParameterLength(1,4).setName("texture"),Kl=(e=ql,t=null,r=null,s=null)=>{let i;return e&&!0===e.isTextureNode?(i=tn(e.clone()),i.referenceNode=e.getBase(),null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=Xl(e,t,r,s),i},Ql=(...e)=>Kl(...e).setSampler(!1);class Yl extends Na{static get type(){return"BufferNode"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Zl=(e,t,r)=>new Yl(e,t,r);class Jl extends hi{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),r=this.getNodeType(e),s=this.node.getPaddedType();return e.format(t,s,r)}}class ed extends Yl{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?Ks(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=ri.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,r=this.elementType;if("float"===r||"int"===r||"uint"===r)for(let r=0;rnew ed(e,t);class rd extends ci{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const sd=an(rd).setParameterLength(1);let id,nd;class ad extends ci{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===ad.DPR?"float":this.scope===ad.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=ri.NONE;return this.scope!==ad.SIZE&&this.scope!==ad.VIEWPORT&&this.scope!==ad.DPR||(e=ri.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ad.VIEWPORT?null!==t?nd.copy(t.viewport):(e.getViewport(nd),nd.multiplyScalar(e.getPixelRatio())):this.scope===ad.DPR?this._output.value=e.getPixelRatio():null!==t?(id.width=t.width,id.height=t.height):e.getDrawingBufferSize(id)}setup(){const e=this.scope;let r=null;return r=e===ad.SIZE?Sa(id||(id=new t)):e===ad.VIEWPORT?Sa(nd||(nd=new s)):e===ad.DPR?Sa(1):_n(dd.div(ld)),this._output=r,r}generate(e){if(this.scope===ad.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const r=e.getNodeProperties(ld).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${r}.y - ${t}.y )`}return t}return super.generate(e)}}ad.COORDINATE="coordinate",ad.VIEWPORT="viewport",ad.SIZE="size",ad.UV="uv",ad.DPR="dpr";const od=on(ad,ad.DPR),ud=on(ad,ad.UV),ld=on(ad,ad.SIZE),dd=on(ad,ad.COORDINATE),cd=on(ad,ad.VIEWPORT),hd=cd.zw,pd=dd.sub(cd.xy),gd=pd.div(hd),md=cn(()=>(d('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Is),ld),"vec2").once()();let fd=null,yd=null,bd=null,xd=null,Td=null,_d=null,vd=null,Nd=null,Sd=null,Rd=null,Ed=null,Ad=null,wd=null,Cd=null;const Md=Sa(0,"uint").setName("u_cameraIndex").setGroup(xa("cameraIndex")).toVarying("v_cameraIndex"),Bd=Sa("float").setName("cameraNear").setGroup(_a).onRenderUpdate(({camera:e})=>e.near),Fd=Sa("float").setName("cameraFar").setGroup(_a).onRenderUpdate(({camera:e})=>e.far),Ld=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrix);null===yd?yd=td(r).setGroup(_a).setName("cameraProjectionMatrices"):yd.array=r,t=yd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrix")}else null===fd&&(fd=Sa(e.projectionMatrix).setName("cameraProjectionMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=fd;return t}).once()(),Pd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.projectionMatrixInverse);null===xd?xd=td(r).setGroup(_a).setName("cameraProjectionMatricesInverse"):xd.array=r,t=xd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraProjectionMatrixInverse")}else null===bd&&(bd=Sa(e.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(_a).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=bd;return t}).once()(),Dd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorldInverse);null===_d?_d=td(r).setGroup(_a).setName("cameraViewMatrices"):_d.array=r,t=_d.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraViewMatrix")}else null===Td&&(Td=Sa(e.matrixWorldInverse).setName("cameraViewMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=Td;return t}).once()(),Ud=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.matrixWorld);null===Nd?Nd=td(r).setGroup(_a).setName("cameraWorldMatrices"):Nd.array=r,t=Nd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraWorldMatrix")}else null===vd&&(vd=Sa(e.matrixWorld).setName("cameraWorldMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=vd;return t}).once()(),Id=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.normalMatrix);null===Rd?Rd=td(r).setGroup(_a).setName("cameraNormalMatrices"):Rd.array=r,t=Rd.element(e.isMultiViewCamera?sd("gl_ViewID_OVR"):Md).toConst("cameraNormalMatrix")}else null===Sd&&(Sd=Sa(e.normalMatrix).setName("cameraNormalMatrix").setGroup(_a).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=Sd;return t}).once()(),Od=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const s=[];for(let t=0,i=e.cameras.length;t{const r=e.cameras,s=t.array;for(let e=0,t=r.length;et.value.setFromMatrixPosition(e.matrixWorld))),t=Ed;return t}).once()(),Vd=cn(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const r=[];for(const t of e.cameras)r.push(t.viewport);null===Cd?Cd=td(r,"vec4").setGroup(_a).setName("cameraViewports"):Cd.array=r,t=Cd.element(Md).toConst("cameraViewport")}else null===wd&&(wd=Cn(0,0,ld.x,ld.y).toConst("cameraViewport")),t=wd;return t}).once()(),kd=new F;class Gd extends ci{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=ri.OBJECT,this.uniformNode=new Na(null)}generateNodeType(){const e=this.scope;return e===Gd.WORLD_MATRIX?"mat4":e===Gd.POSITION||e===Gd.VIEW_POSITION||e===Gd.DIRECTION||e===Gd.SCALE?"vec3":e===Gd.RADIUS?"float":void 0}update(e){const t=this.object3d,s=this.uniformNode,i=this.scope;if(i===Gd.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===Gd.POSITION)s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===Gd.SCALE)s.value=s.value||new r,s.value.setFromMatrixScale(t.matrixWorld);else if(i===Gd.DIRECTION)s.value=s.value||new r,t.getWorldDirection(s.value);else if(i===Gd.VIEW_POSITION){const i=e.camera;s.value=s.value||new r,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(i.matrixWorldInverse)}else if(i===Gd.RADIUS){const r=e.object.geometry;null===r.boundingSphere&&r.computeBoundingSphere(),kd.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),s.value=kd.radius}}generate(e){const t=this.scope;return t===Gd.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===Gd.POSITION||t===Gd.VIEW_POSITION||t===Gd.DIRECTION||t===Gd.SCALE?this.uniformNode.nodeType="vec3":t===Gd.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Gd.WORLD_MATRIX="worldMatrix",Gd.POSITION="position",Gd.SCALE="scale",Gd.VIEW_POSITION="viewPosition",Gd.DIRECTION="direction",Gd.RADIUS="radius";const zd=an(Gd,Gd.DIRECTION).setParameterLength(1),$d=an(Gd,Gd.WORLD_MATRIX).setParameterLength(1),Wd=an(Gd,Gd.POSITION).setParameterLength(1),Hd=an(Gd,Gd.SCALE).setParameterLength(1),qd=an(Gd,Gd.VIEW_POSITION).setParameterLength(1),jd=an(Gd,Gd.RADIUS).setParameterLength(1);class Xd extends Gd{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const Kd=on(Xd,Xd.DIRECTION),Qd=on(Xd,Xd.WORLD_MATRIX),Yd=on(Xd,Xd.POSITION),Zd=on(Xd,Xd.SCALE),Jd=on(Xd,Xd.VIEW_POSITION),ec=on(Xd,Xd.RADIUS),tc=Sa(new n).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),rc=Sa(new a).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),sc=cn(e=>e.context.modelViewMatrix||ic).once()().toVar("modelViewMatrix"),ic=Dd.mul(Qd),nc=cn(e=>(e.context.isHighPrecisionModelViewMatrix=!0,Sa("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),ac=cn(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return Sa("mat3").onObjectUpdate(({object:e,camera:r})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),oc=cn(e=>"fragment"!==e.shaderStage?(v("TSL: `clipSpace` is only available in fragment stage."),Cn()):e.context.clipSpace.toVarying("v_clipSpace")).once()(),uc=Vl("position","vec3"),lc=uc.toVarying("positionLocal"),dc=uc.toVarying("positionPrevious"),cc=cn(e=>Qd.mul(lc).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),hc=cn(()=>lc.transformDirection(Qd).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),pc=cn(e=>{if("fragment"===e.shaderStage&&e.material.vertexNode){const e=Pd.mul(oc);return e.xyz.div(e.w).toVar("positionView")}return e.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),gc=cn(e=>{let t;return t=e.camera.isOrthographicCamera?Rn(0,0,1):pc.negate().toVarying("v_positionViewDirection").normalize(),t.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class mc extends ci{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return t.side===L?"false":e.getFrontFacing()}}const fc=on(mc),yc=yn(fc).mul(2).sub(1),bc=cn(([e],{material:t})=>{const r=t.side;return r===L?e=e.mul(-1):r===P&&(e=e.mul(yc)),e}),xc=Vl("normal","vec3"),Tc=cn(e=>!1===e.geometry.hasAttribute("normal")?(d('TSL: Vertex attribute "normal" not found on geometry.'),Rn(0,1,0)):xc,"vec3").once()().toVar("normalLocal"),_c=pc.dFdx().cross(pc.dFdy()).normalize().toVar("normalFlat"),vc=cn(e=>{let t;return t=e.isFlatShading()?_c:wc(Tc).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),Nc=cn(e=>{let t=vc.transformDirection(Dd);return!0!==e.isFlatShading()&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),Sc=cn(e=>{let t;return"NORMAL"===e.subBuildFn||"VERTEX"===e.subBuildFn?(t=vc,!0!==e.isFlatShading()&&(t=bc(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Rc=Sc.transformDirection(Dd).toVar("normalWorld"),Ec=cn(({subBuildFn:e,context:t})=>{let r;return r="NORMAL"===e||"VERTEX"===e?Sc:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),r},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Ac=cn(([e,t=Qd])=>{const r=Pn(t),s=e.div(Rn(r[0].dot(r[0]),r[1].dot(r[1]),r[2].dot(r[2])));return r.mul(s).xyz}),wc=cn(([e],t)=>{const r=t.context.modelNormalViewMatrix;if(r)return r.transformDirection(e);const s=tc.mul(e);return Dd.transformDirection(s)}),Cc=cn(()=>(d('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),Sc)).once(["NORMAL","VERTEX"])(),Mc=cn(()=>(d('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Rc)).once(["NORMAL","VERTEX"])(),Bc=cn(()=>(d('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Ec)).once(["NORMAL","VERTEX"])(),Fc=new a,Lc=Sa(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),Pc=Sa(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),Dc=Sa(new a).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const r=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return r?Fc.makeRotationFromEuler(r).transpose():Fc.identity(),Fc}),Uc=gc.negate().reflect(Sc),Ic=gc.negate().refract(Sc,Lc),Oc=Uc.transformDirection(Dd).toVar("reflectVector"),Vc=Ic.transformDirection(Dd).toVar("reflectVector"),kc=new D;class Gc extends jl{static get type(){return"CubeTextureNode"}constructor(e,t=null,r=null,s=null){super(e,t,r,s),this.isCubeTextureNode=!0}getInputType(){return!0===this.value.isDepthTexture?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===U?Oc:e.mapping===I?Vc:(o('CubeTextureNode: Mapping "%s" not supported.',e.mapping),Rn(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const r=this.value;return!0===r.isDepthTexture?e.renderer.coordinateSystem===h?Rn(t.x,t.y.negate(),t.z):t:(t=Dc.mul(t),e.renderer.coordinateSystem!==h&&r.isRenderTargetTexture||(t=Rn(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}const zc=an(Gc).setParameterLength(1,4).setName("cubeTexture"),$c=(e=kc,t=null,r=null,s=null)=>{let i;return e&&!0===e.isCubeTextureNode?(i=tn(e.clone()),i.referenceNode=e,null!==t&&(i.uvNode=tn(t)),null!==r&&(i.levelNode=tn(r)),null!==s&&(i.biasNode=tn(s))):i=zc(e,t,r,s),i};class Wc extends hi{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),r=this.referenceNode.getNodeType(e),s=this.getNodeType(e);return e.format(t,r,s)}}class Hc extends ci{static get type(){return"ReferenceNode"}constructor(e,t,r=null,s=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=s,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=ri.OBJECT}element(e){return new Wc(this,tn(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?Zl(null,e,this.count):Array.isArray(this.getValueFromReference())?td(null,e):"texture"===e?Kl(null):"cubeTexture"===e?$c(null):Sa(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}generateNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let r=e[t[0]];for(let e=1;enew Hc(e,t,r),jc=(e,t,r,s)=>new Hc(e,t,s,r);class Xc extends Hc{static get type(){return"MaterialReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const Kc=(e,t,r=null)=>new Xc(e,t,r),Qc=kl(),Yc=pc.dFdx(),Zc=pc.dFdy(),Jc=Qc.dFdx(),eh=Qc.dFdy(),th=Sc,rh=Zc.cross(th),sh=th.cross(Yc),ih=rh.mul(Jc.x).add(sh.mul(eh.x)),nh=rh.mul(Jc.y).add(sh.mul(eh.y)),ah=ih.dot(ih).max(nh.dot(nh)),oh=ah.equal(0).select(0,ah.inverseSqrt()),uh=ih.mul(oh).toVar("tangentViewFrame"),lh=nh.mul(oh).toVar("bitangentViewFrame"),dh=Vl("tangent","vec4"),ch=dh.xyz.toVar("tangentLocal"),hh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?sc.mul(Cn(ch,0)).xyz.toVarying("v_tangentView").normalize():uh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),ph=hh.transformDirection(Dd).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),gh=cn(([e,t],r)=>{let s=e.mul(dh.w).xyz;return"NORMAL"===r.subBuildFn&&!0!==r.isFlatShading()&&(s=s.toVarying(t)),s}).once(["NORMAL"]),mh=gh(xc.cross(dh),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),fh=gh(Tc.cross(ch),"v_bitangentLocal").normalize().toVar("bitangentLocal"),yh=cn(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?gh(Sc.cross(hh),"v_bitangentView").normalize():lh,!0!==e.isFlatShading()&&(t=bc(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),bh=gh(Rc.cross(ph),"v_bitangentWorld").normalize().toVar("bitangentWorld"),xh=Pn(hh,yh,Sc).toVar("TBNViewMatrix"),Th=gc.mul(xh),_h=cn(()=>{let e=ra.cross(gc);return e=e.cross(ra).normalize(),e=gu(e,Sc,ea.mul(Wn.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),vh=e=>tn(e).mul(.5).add(.5),Nh=e=>Rn(e,_o(fu(yn(1).sub(nu(e,e)))));class Sh extends gi{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=O,this.unpackNormalMode=V}setup(e){const{normalMapType:t,scaleNode:r,unpackNormalMode:s}=this;let i=this.node.mul(2).sub(1);if(t===O?s===k?i=Nh(i.xy):s===G?i=Nh(i.yw):s!==V&&o(`THREE.NodeMaterial: Unexpected unpack normal mode: ${s}`):s!==V&&o(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${s}'`),null!==r){let t=r;!0===e.isFlatShading()&&(t=bc(t)),i=Rn(i.xy.mul(t),i.z)}let n=null;return t===z?n=wc(i):t===O?n=xh.mul(i).normalize():(o(`NodeMaterial: Unsupported normal map type: ${t}`),n=Sc),n}}const Rh=an(Sh).setParameterLength(1,2),Eh=cn(({textureNode:e,bumpScale:t})=>{const r=t=>e.isolate().context({getUV:e=>t(e.uvNode||kl()),forceUVContext:!0}),s=yn(r(e=>e));return _n(yn(r(e=>e.add(e.dFdx()))).sub(s),yn(r(e=>e.add(e.dFdy()))).sub(s)).mul(t)}),Ah=cn(e=>{const{surf_pos:t,surf_norm:r,dHdxy:s}=e,i=t.dFdx().normalize(),n=r,a=t.dFdy().normalize().cross(n),o=n.cross(i),u=i.dot(a).mul(yc),l=u.sign().mul(s.x.mul(a).add(s.y.mul(o)));return u.abs().mul(r).sub(l).normalize()});class wh extends gi{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=Eh({textureNode:this.textureNode,bumpScale:e});return Ah({surf_pos:pc,surf_norm:Sc,dHdxy:t})}}const Ch=an(wh).setParameterLength(1,2),Mh=new Map;class Bh extends ci{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let r=Mh.get(e);return void 0===r&&(r=Kc(e,t),Mh.set(e,r)),r}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,r=this.scope;let s=null;if(r===Bh.COLOR){const e=void 0!==t.color?this.getColor(r):Rn();s=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(r===Bh.OPACITY){const e=this.getFloat(r);s=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(r===Bh.SPECULAR_STRENGTH)s=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:yn(1);else if(r===Bh.SPECULAR_INTENSITY){const e=this.getFloat(r);s=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(r).a):e}else if(r===Bh.SPECULAR_COLOR){const e=this.getColor(r);s=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(r).rgb):e}else if(r===Bh.ROUGHNESS){const e=this.getFloat(r);s=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(r).g):e}else if(r===Bh.METALNESS){const e=this.getFloat(r);s=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(r).b):e}else if(r===Bh.EMISSIVE){const e=this.getFloat("emissiveIntensity"),i=this.getColor(r).mul(e);s=t.emissiveMap&&!0===t.emissiveMap.isTexture?i.mul(this.getTexture(r)):i}else if(r===Bh.NORMAL)t.normalMap?(s=Rh(this.getTexture("normal"),this.getCache("normalScale","vec2")),s.normalMapType=t.normalMapType,t.normalMap.format!=$&&t.normalMap.format!=W&&t.normalMap.format!=H||(s.unpackNormalMode=k)):s=t.bumpMap?Ch(this.getTexture("bump").r,this.getFloat("bumpScale")):Sc;else if(r===Bh.CLEARCOAT){const e=this.getFloat(r);s=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_ROUGHNESS){const e=this.getFloat(r);s=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===Bh.CLEARCOAT_NORMAL)s=t.clearcoatNormalMap?Rh(this.getTexture(r),this.getCache(r+"Scale","vec2")):Sc;else if(r===Bh.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));s=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(r===Bh.SHEEN_ROUGHNESS){const e=this.getFloat(r);s=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(r).a):e,s=s.clamp(1e-4,1)}else if(r===Bh.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(r);s=Ln(mp.x,mp.y,mp.y.negate(),mp.x).mul(e.rg.mul(2).sub(_n(1)).normalize().mul(e.b))}else s=mp;else if(r===Bh.IRIDESCENCE_THICKNESS){const e=qc("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=qc("0","float",t.iridescenceThicknessRange);s=e.sub(i).mul(this.getTexture(r).g).add(i)}else s=e}else if(r===Bh.TRANSMISSION){const e=this.getFloat(r);s=t.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===Bh.THICKNESS){const e=this.getFloat(r);s=t.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===Bh.IOR)s=this.getFloat(r);else if(r===Bh.LIGHT_MAP)s=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===Bh.AO)s=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(r===Bh.LINE_DASH_OFFSET)s=t.dashOffset?this.getFloat(r):yn(0);else{const t=this.getNodeType(e);s=this.getCache(r,t)}return s}}Bh.ALPHA_TEST="alphaTest",Bh.COLOR="color",Bh.OPACITY="opacity",Bh.SHININESS="shininess",Bh.SPECULAR="specular",Bh.SPECULAR_STRENGTH="specularStrength",Bh.SPECULAR_INTENSITY="specularIntensity",Bh.SPECULAR_COLOR="specularColor",Bh.REFLECTIVITY="reflectivity",Bh.ROUGHNESS="roughness",Bh.METALNESS="metalness",Bh.NORMAL="normal",Bh.CLEARCOAT="clearcoat",Bh.CLEARCOAT_ROUGHNESS="clearcoatRoughness",Bh.CLEARCOAT_NORMAL="clearcoatNormal",Bh.EMISSIVE="emissive",Bh.ROTATION="rotation",Bh.SHEEN="sheen",Bh.SHEEN_ROUGHNESS="sheenRoughness",Bh.ANISOTROPY="anisotropy",Bh.IRIDESCENCE="iridescence",Bh.IRIDESCENCE_IOR="iridescenceIOR",Bh.IRIDESCENCE_THICKNESS="iridescenceThickness",Bh.IOR="ior",Bh.TRANSMISSION="transmission",Bh.THICKNESS="thickness",Bh.ATTENUATION_DISTANCE="attenuationDistance",Bh.ATTENUATION_COLOR="attenuationColor",Bh.LINE_SCALE="scale",Bh.LINE_DASH_SIZE="dashSize",Bh.LINE_GAP_SIZE="gapSize",Bh.LINE_WIDTH="linewidth",Bh.LINE_DASH_OFFSET="dashOffset",Bh.POINT_SIZE="size",Bh.DISPERSION="dispersion",Bh.LIGHT_MAP="light",Bh.AO="ao";const Fh=on(Bh,Bh.ALPHA_TEST),Lh=on(Bh,Bh.COLOR),Ph=on(Bh,Bh.SHININESS),Dh=on(Bh,Bh.EMISSIVE),Uh=on(Bh,Bh.OPACITY),Ih=on(Bh,Bh.SPECULAR),Oh=on(Bh,Bh.SPECULAR_INTENSITY),Vh=on(Bh,Bh.SPECULAR_COLOR),kh=on(Bh,Bh.SPECULAR_STRENGTH),Gh=on(Bh,Bh.REFLECTIVITY),zh=on(Bh,Bh.ROUGHNESS),$h=on(Bh,Bh.METALNESS),Wh=on(Bh,Bh.NORMAL),Hh=on(Bh,Bh.CLEARCOAT),qh=on(Bh,Bh.CLEARCOAT_ROUGHNESS),jh=on(Bh,Bh.CLEARCOAT_NORMAL),Xh=on(Bh,Bh.ROTATION),Kh=on(Bh,Bh.SHEEN),Qh=on(Bh,Bh.SHEEN_ROUGHNESS),Yh=on(Bh,Bh.ANISOTROPY),Zh=on(Bh,Bh.IRIDESCENCE),Jh=on(Bh,Bh.IRIDESCENCE_IOR),ep=on(Bh,Bh.IRIDESCENCE_THICKNESS),tp=on(Bh,Bh.TRANSMISSION),rp=on(Bh,Bh.THICKNESS),sp=on(Bh,Bh.IOR),ip=on(Bh,Bh.ATTENUATION_DISTANCE),np=on(Bh,Bh.ATTENUATION_COLOR),ap=on(Bh,Bh.LINE_SCALE),op=on(Bh,Bh.LINE_DASH_SIZE),up=on(Bh,Bh.LINE_GAP_SIZE),lp=on(Bh,Bh.LINE_WIDTH),dp=on(Bh,Bh.LINE_DASH_OFFSET),cp=on(Bh,Bh.POINT_SIZE),hp=on(Bh,Bh.DISPERSION),pp=on(Bh,Bh.LIGHT_MAP),gp=on(Bh,Bh.AO),mp=Sa(new t).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),fp=cn(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class yp extends hi{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r;const s=e.context.assign;if(r=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===s||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}const bp=an(yp).setParameterLength(2);class xp extends Yl{static get type(){return"StorageBufferNode"}constructor(e,t=null,r=0){let s,i=null;t&&t.isStruct?(s="struct",i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(s=Ws(e.itemSize),r=e.count):s=t,super(e,s,r),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=ii.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(0===this.bufferCount){let r=e.globalCache.getData(this.value);void 0===r&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return bp(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(ii.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=ul(this.value),this._varying=$u(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:r}=this.getAttributeData(),s=r.build(e);return e.registerTransform(s,t),s}}const Tp=(e,t=null,r=0)=>new xp(e,t,r);class _p extends ci{static get type(){return"InstanceNode"}constructor(e,t,r=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=r,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=ri.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}get isStorageColor(){const{instanceColor:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}setup(e){let{instanceMatrixNode:t,instanceColorNode:r}=this;null===t&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);const{instanceColor:s,isStorageColor:i}=this;if(s&&null===r){if(i)r=Tp(s,"vec3",Math.max(s.count,1)).element(pl);else{const e=new q(s.array,3),t=s.usage===x?dl:ll;this.bufferColor=e,r=Rn(t(e,"vec3",3,0))}this.instanceColorNode=r}const n=t.mul(lc).xyz;if(lc.assign(n),e.needsPreviousData()&&dc.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){const e=Ac(Tc,t);Tc.assign(e)}null!==this.instanceColorNode&&kn("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){null!==this.buffer&&!0!==this.isStorageMatrix&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&!0!==this.isStorageColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),null!==this.previousInstanceMatrixNode&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){const t=e.object;return null===this.previousInstanceMatrixNode&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(dc).xyz}_createInstanceMatrixNode(e,t){let r;const{instanceMatrix:s}=this,{count:i}=s;if(this.isStorageMatrix)r=Tp(s,"mat4",Math.max(i,1)).element(pl);else{if(16*i*4<=t.getUniformBufferLimit())r=Zl(s.array,"mat4",Math.max(i,1)).element(pl);else{const t=new j(s.array,16,1);!0===e&&(this.buffer=t);const i=s.usage===x?dl:ll,n=[i(t,"vec4",16,0),i(t,"vec4",16,4),i(t,"vec4",16,8),i(t,"vec4",16,12)];r=Dn(...n)}}return r}}const vp=an(_p).setParameterLength(2,3);class Np extends _p{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:r,instanceColor:s}=e;super(t,r,s),this.instancedMesh=e}}const Sp=an(Np).setParameterLength(1);class Rp extends ci{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=pl:this.batchingIdNode=yl);const t=cn(([e])=>{const t=bn(zl(Ql(this.batchMesh._indirectTexture),0).x).toConst(),r=bn(e).mod(t).toConst(),s=bn(e).div(t).toConst();return Ql(this.batchMesh._indirectTexture,vn(r,s)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),r=t(bn(this.batchingIdNode)),s=this.batchMesh._matricesTexture,i=bn(zl(Ql(s),0).x).toConst(),n=yn(r).mul(4).toInt().toConst(),a=n.mod(i).toConst(),o=n.div(i).toConst(),u=Dn(Ql(s,vn(a,o)),Ql(s,vn(a.add(1),o)),Ql(s,vn(a.add(2),o)),Ql(s,vn(a.add(3),o))),l=this.batchMesh._colorsTexture;if(null!==l){const e=cn(([e])=>{const t=bn(zl(Ql(l),0).x).toConst(),r=e,s=r.mod(t).toConst(),i=r.div(t).toConst();return Ql(l,vn(s,i)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),t=e(r);kn("vec3","vBatchColor").assign(t)}const d=Pn(u);lc.assign(u.mul(lc));const c=Tc.div(Rn(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),h=d.mul(c).xyz;Tc.assign(h),e.hasGeometryAttribute("tangent")&&ch.mulAssign(d)}}const Ep=an(Rp).setParameterLength(1),Ap=new WeakMap;class wp extends ci{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=ri.OBJECT,this.skinIndexNode=Vl("skinIndex","uvec4"),this.skinWeightNode=Vl("skinWeight","vec4"),this.bindMatrixNode=qc("bindMatrix","mat4"),this.bindMatrixInverseNode=qc("bindMatrixInverse","mat4"),this.boneMatricesNode=jc("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=lc,this.toPositionNode=lc,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:r,skinWeightNode:s,bindMatrixNode:i,bindMatrixInverseNode:n}=this,a=e.element(r.x),o=e.element(r.y),u=e.element(r.z),l=e.element(r.w),d=i.mul(t),c=La(a.mul(s.x).mul(d),o.mul(s.y).mul(d),u.mul(s.z).mul(d),l.mul(s.w).mul(d));return n.mul(c).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=Tc,r=ch){const{skinIndexNode:s,skinWeightNode:i,bindMatrixNode:n,bindMatrixInverseNode:a}=this,o=e.element(s.x),u=e.element(s.y),l=e.element(s.z),d=e.element(s.w);let c=La(i.x.mul(o),i.y.mul(u),i.z.mul(l),i.w.mul(d));c=a.mul(c).mul(n);return{skinNormal:c.transformDirection(t).xyz,skinTangent:c.transformDirection(r).xyz}}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=jc("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,dc)}setup(e){e.needsPreviousData()&&dc.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const{skinNormal:t,skinTangent:r}=this.getSkinnedNormalAndTangent();Tc.assign(t),e.hasGeometryAttribute("tangent")&&ch.assign(r)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;Ap.get(t)!==e.frameId&&(Ap.set(t,e.frameId),null!==this.previousBoneMatricesNode&&(null===t.previousBoneMatrices&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const Cp=e=>new wp(e);class Mp extends ci{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const r={};for(let e=0,t=this.params.length-1;eNumber(l)?">=":"<")),a)n=`while ( ${l} )`;else{const r={start:u,end:l},s=r.start,i=r.end;let a;const g=()=>h.includes("<")?"+=":"-=";if(null!=p)switch(typeof p){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=d+" "+g()+" "+e.generateConst(c,p);break;case"string":a=d+" "+p;break;default:p.isNode?a=d+" "+g()+" "+p.build(e):(o("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),a="break /* invalid update */")}else p="int"===c||"uint"===c?h.includes("<")?"++":"--":g()+" 1.",a=d+" "+p;n=`for ( ${e.getVar(c,d)+" = "+s}; ${d+" "+h+" "+i}; ${a} )`}e.addFlowCode((0===s?"\n":"")+e.tab+n+" {\n\n").addFlowTab()}const i=s.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+i);for(let t=0,r=this.params.length-1;tnew Mp(nn(e,"int")).toStack(),Fp=()=>Cl("break").toStack(),Lp=new WeakMap,Pp=new s,Dp=cn(({bufferMap:e,influence:t,stride:r,width:s,depth:i,offset:n})=>{const a=bn(hl).mul(r).add(n),o=a.div(s),u=a.sub(o.mul(s));return Ql(e,vn(u,o)).depth(i).xyz.mul(t)});class Up extends ci{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Sa(1),this.updateType=ri.OBJECT}setup(e){const{geometry:r}=e,s=void 0!==r.morphAttributes.position,i=r.hasAttribute("normal")&&void 0!==r.morphAttributes.normal,n=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,a=void 0!==n?n.length:0,{texture:o,stride:u,size:l}=function(e){const r=void 0!==e.morphAttributes.position,s=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,n=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=void 0!==n?n.length:0;let o=Lp.get(e);if(void 0===o||o.count!==a){void 0!==o&&o.texture.dispose();const u=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],d=e.morphAttributes.color||[];let c=0;!0===r&&(c=1),!0===s&&(c=2),!0===i&&(c=3);let h=e.attributes.position.count*c,p=1;const g=4096;h>g&&(p=Math.ceil(h/g),h=g);const m=new Float32Array(h*p*4*a),f=new X(m,h,p,a);f.type=K,f.needsUpdate=!0;const y=4*c;for(let x=0;x{const t=yn(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(Ql(this.mesh.morphTexture,vn(bn(e).add(1),bn(pl))).r):t.assign(qc("morphTargetInfluences","float").element(e).toVar()),gn(t.notEqual(0),()=>{!0===s&&lc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(0)})),!0===i&&Tc.addAssign(Dp({bufferMap:o,influence:t,stride:u,width:d,depth:e,offset:bn(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const Ip=an(Up).setParameterLength(1);class Op extends ci{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Vp extends Op{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class kp extends wu{static get type(){return"LightingContextNode"}constructor(e,t=null,r=null,s=null){super(e),this.lightingModel=t,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,r={directDiffuse:Rn().toVar("directDiffuse"),directSpecular:Rn().toVar("directSpecular"),indirectDiffuse:Rn().toVar("indirectDiffuse"),indirectSpecular:Rn().toVar("indirectSpecular")};return{radiance:Rn().toVar("radiance"),irradiance:Rn().toVar("irradiance"),iblIrradiance:Rn().toVar("iblIrradiance"),ambientOcclusion:yn(1).toVar("ambientOcclusion"),reflectedLight:r,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Gp=an(kp);class zp extends Op{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const $p=new t;class Wp extends jl{static get type(){return"ViewportTextureNode"}constructor(e=ud,t=null,r=null){let s=null;null===r?(s=new Q,s.minFilter=Y,r=s):s=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=s,this.isOutputTextureNode=!0,this.updateBeforeType=ri.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),null===e)return t;if(!1===r.has(e)){const s=t.clone();r.set(e,s)}return r.get(e)}updateReference(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;return this.value=this.getTextureForReference(i),this.value}updateBefore(e){const t=e.renderer,r=t.getRenderTarget(),s=t.getCanvasTarget(),i=r||s;null===i?t.getDrawingBufferSize($p):i.getDrawingBufferSize?i.getDrawingBufferSize($p):$p.set(i.width,i.height);const n=this.getTextureForReference(i);n.image.width===$p.width&&n.image.height===$p.height||(n.image.width=$p.width,n.image.height=$p.height,n.needsUpdate=!0);const a=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=a}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Hp=an(Wp).setParameterLength(0,3),qp=an(Wp,null,null,{generateMipmaps:!0}).setParameterLength(0,3),jp=qp(),Xp=(e=ud,t=null)=>jp.sample(e,t);let Kp=null;class Qp extends Wp{static get type(){return"ViewportDepthTextureNode"}constructor(e=ud,t=null,r=null){null===r&&(null===Kp&&(Kp=new Z),r=Kp),super(e,t,r)}}const Yp=an(Qp).setParameterLength(0,3);class Zp extends ci{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Zp.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,r=this.valueNode;let s=null;if(t===Zp.DEPTH_BASE)null!==r&&(s=ng().assign(r));else if(t===Zp.DEPTH)s=e.isPerspectiveCamera?tg(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd);else if(t===Zp.LINEAR_DEPTH)if(null!==r)if(e.isPerspectiveCamera){const e=sg(r,Bd,Fd);s=Jp(e,Bd,Fd)}else s=r;else s=Jp(pc.z,Bd,Fd);return s}}Zp.DEPTH_BASE="depthBase",Zp.DEPTH="depth",Zp.LINEAR_DEPTH="linearDepth";const Jp=(e,t,r)=>e.add(t).div(t.sub(r)),eg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),tg=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),rg=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),sg=cn(([e,t,r],s)=>!0===s.renderer.reversedDepthBuffer?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),ig=(e,t,r)=>{t=t.max(1e-6).toVar();const s=To(e.negate().div(t)),i=To(r.div(t));return s.div(i)},ng=an(Zp,Zp.DEPTH_BASE),ag=on(Zp,Zp.DEPTH),og=an(Zp,Zp.LINEAR_DEPTH).setParameterLength(0,1),ug=og(Yp());ag.assign=e=>ng(e);class lg extends ci{static get type(){return"ClippingNode"}constructor(e=lg.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:r,unionPlanes:s}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===lg.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(r,s):this.scope===lg.HARDWARE?this.setupHardwareClipping(s,e):this.setupDefault(r,s)}setupAlphaToCoverage(e,t){return cn(()=>{const r=yn().toVar("distanceToPlane"),s=yn().toVar("distanceToGradient"),i=yn(1).toVar("clipOpacity"),n=t.length;if(!1===this.hardwareClipping&&n>0){const e=td(t).setGroup(_a);Bp(n,({i:t})=>{const n=e.element(t);r.assign(pc.dot(n.xyz).negate().add(n.w)),s.assign(r.fwidth().div(2)),i.mulAssign(bu(s.negate(),s,r))})}const a=e.length;if(a>0){const t=td(e).setGroup(_a),n=yn(1).toVar("intersectionClipOpacity");Bp(a,({i:e})=>{const i=t.element(e);r.assign(pc.dot(i.xyz).negate().add(i.w)),s.assign(r.fwidth().div(2)),n.mulAssign(bu(s.negate(),s,r).oneMinus())}),i.mulAssign(n.oneMinus())}Gn.a.mulAssign(i),Gn.a.equal(0).discard()})()}setupDefault(e,t){return cn(()=>{const r=t.length;if(!1===this.hardwareClipping&&r>0){const e=td(t).setGroup(_a);Bp(r,({i:t})=>{const r=e.element(t);pc.dot(r.xyz).greaterThan(r.w).discard()})}const s=e.length;if(s>0){const t=td(e).setGroup(_a),r=Tn(!0).toVar("clipped");Bp(s,({i:e})=>{const s=t.element(e);r.assign(pc.dot(s.xyz).greaterThan(s.w).and(r))}),r.discard()}})()}setupHardwareClipping(e,t){const r=e.length;return t.enableHardwareClipping(r),cn(()=>{const s=td(e).setGroup(_a),i=sd(t.getClipDistance());Bp(r,({i:e})=>{const t=s.element(e),r=pc.dot(t.xyz).sub(t.w).negate();i.element(e).assign(r)})})()}}lg.ALPHA_TO_COVERAGE="alphaToCoverage",lg.DEFAULT="default",lg.HARDWARE="hardware";const dg=cn(([e])=>Eo(Da(1e4,Ao(Da(17,e.x).add(Da(.1,e.y)))).mul(La(.1,Vo(Ao(Da(13,e.y).add(e.x))))))),cg=cn(([e])=>dg(_n(dg(e.xy),e.z))),hg=cn(([e])=>{const t=eu(Go(Wo(e.xyz)),Go(Ho(e.xyz))),r=yn(1).div(yn(.05).mul(t)).toVar("pixScale"),s=_n(bo(No(To(r))),bo(So(To(r)))),i=_n(cg(No(s.x.mul(e.xyz))),cg(No(s.y.mul(e.xyz)))),n=Eo(To(r)),a=La(Da(n.oneMinus(),i.x),Da(n,i.y)),o=Jo(n,n.oneMinus()),u=Rn(a.mul(a).div(Da(2,o).mul(Pa(1,o))),a.sub(Da(.5,o)).div(Pa(1,o)),Pa(1,Pa(1,a).mul(Pa(1,a)).div(Da(2,o).mul(Pa(1,o))))),l=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(u.x,u.y),u.z);return mu(l,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class pg extends Ol{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let r;return r=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new s(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const gg=(e=0)=>new pg(e),mg=cn(([e,t])=>Jo(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fg=cn(([e,t])=>Jo(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yg=cn(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bg=cn(([e,t])=>gu(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),tu(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xg=cn(([e,t])=>{const r=t.a.add(e.a.mul(t.a.oneMinus()));return Cn(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Tg=cn(([e])=>Cn(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),_g=cn(([e])=>(gn(e.a.equal(0),()=>Cn(0)),Cn(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class vg extends J{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;const r=this[t];r&&!0===r.isNode&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:r}of this._getNodeChildren())e.push(Vs(t.slice(0,-4)),r.getCacheKey());return this.type+ks(e)}build(e){this.setup(e)}setupObserver(e){return new Ds(e)}setup(e){e.context.setupNormal=()=>Gu(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,r=t.getRenderTarget();e.addStack();const s=this.setupVertex(e),i=Gu(this.vertexNode||s,"VERTEX");let n;e.context.clipSpace=i,e.stack.outputNode=i,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==r?!0===r.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const s=this.setupLighting(e);null!==a&&e.stack.addToStack(a);const i=Cn(s,Gn.a).max(0);n=this.setupOutput(e,i),oa.assign(n);const o=null!==this.outputNode;if(o&&(n=this.outputNode),e.context.getOutput&&(n=e.context.getOutput(n,e)),null!==r){const e=t.getMRT(),r=this.mrtNode;null!==e?(o&&oa.assign(n),n=e,null!==r&&(n=e.merge(r))):null!==r&&(n=r)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Cn(t)),n=this.setupOutput(e,t)}e.stack.outputNode=n,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:r}=e.clippingContext;let s=null;if(t.length>0||r.length>0){const t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?s=new lg(lg.ALPHA_TO_COVERAGE):e.stack.addToStack(new lg)}return s}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(new lg(lg.HARDWARE)),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:r}=e;let s=this.depthNode;if(null===s){const e=t.getMRT();e&&e.has("depth")?s=e.get("depth"):!0===t.logarithmicDepthBuffer&&(s=r.isPerspectiveCamera?ig(pc.z,Bd,Fd):Jp(pc.z,Bd,Fd))}null!==s&&ag.assign(s).toStack()}setupPositionView(){return sc.mul(lc).xyz}setupModelViewProjection(){return Ld.mul(pc)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),fp}setupPosition(e){const{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&Ip(t).toStack(),!0===t.isSkinnedMesh&&Cp(t).toStack(),this.displacementMap){const e=Kc("displacementMap","texture"),t=Kc("displacementScale","float"),r=Kc("displacementBias","float");lc.addAssign(Tc.normalize().mul(e.x.mul(t).add(r)))}return t.isBatchedMesh&&Ep(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&Sp(t).toStack(),null!==this.positionNode&&lc.assign(Gu(this.positionNode,"POSITION","vec3")),lc}setupDiffuseColor(e){const{object:t,geometry:r}=e;null!==this.maskNode&&Tn(this.maskNode).not().discard();let s=this.colorNode?Cn(this.colorNode):Lh;if(!0===this.vertexColors&&r.hasAttribute("color")&&(s=s.mul(gg())),t.instanceColor){s=kn("vec3","vInstanceColor").mul(s)}if(t.isBatchedMesh&&t._colorsTexture){s=kn("vec3","vBatchColor").mul(s)}Gn.assign(s);const i=this.opacityNode?yn(this.opacityNode):Uh;Gn.a.assign(Gn.a.mul(i));let n=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(n=null!==this.alphaTestNode?yn(this.alphaTestNode):Fh,!0===this.alphaToCoverage?(Gn.a=bu(n,n.add(Ko(Gn.a)),Gn.a),Gn.a.lessThanEqual(0).discard()):Gn.a.lessThanEqual(n).discard()),!0===this.alphaHash&&Gn.a.lessThan(hg(lc)).discard(),e.isOpaque()&&Gn.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?Rn(0):Gn.rgb}setupNormal(){return this.normalNode?Rn(this.normalNode):Wh}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Kc("envMap","cubeTexture"):Kc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new zp(pp)),t}setupLights(e){const t=[],r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);const s=this.setupLightMap(e);s&&s.isLightingNode&&t.push(s);let i=this.aoNode;null===i&&e.material.aoMap&&(i=gp),e.context.getAO&&(i=e.context.getAO(i,e)),i&&t.push(new Vp(i));let n=this.lightsNode||e.lightsNode;return t.length>0&&(n=e.renderer.lighting.createNode([...n.getLights(),...t])),n}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:r,backdropAlphaNode:s,emissiveNode:i}=this,n=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(n&&n.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=Gp(n,t,r,s)}else null!==r&&(a=Rn(null!==s?gu(a,r,s):r));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&($n.assign(Rn(i||Dh)),a=a.add($n)),a}setupFog(e,t){const r=e.fogNode;return r&&(oa.assign(t),t=Cn(r.toVar())),t}setupPremultipliedAlpha(e,t){return Tg(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const t in e){const r=e[t];void 0===this[t]&&(this[t]=r,r&&r.clone&&(this[t]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const r=J.prototype.toJSON.call(this,e);r.inputNodes={};for(const{property:t,childNode:s}of this._getNodeChildren())r.inputNodes[t]=s.toJSON(e).uuid;function s(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(t){const t=s(e.textures),i=s(e.images),n=s(e.nodes);t.length>0&&(r.textures=t),i.length>0&&(r.images=i),n.length>0&&(r.nodes=n)}return r}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const Ng=new ee;class Sg extends vg{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Ng),this.setValues(e)}}const Rg=new te;class Eg extends vg{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Rg),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?yn(this.offsetNode):dp,t=this.dashScaleNode?yn(this.dashScaleNode):ap,r=this.dashSizeNode?yn(this.dashSizeNode):op,s=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(r),la.assign(s);const i=$u(Vl("lineDistance").mul(t));(e?i.add(e):i).mod(ua.add(la)).greaterThan(ua).discard()}}const Ag=new te;class wg extends vg{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(Ag),this.vertexColors=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=re,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,r=this._useAlphaToCoverage,s=this.vertexColors,i=this._useDash,n=this._useWorldUnits,a=cn(({start:e,end:t})=>{const r=Ld.element(2).element(2),s=Ld.element(3).element(2).mul(-.5).div(r).sub(e.z).div(t.z.sub(e.z));return Cn(gu(e.xyz,t.xyz,s),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=cn(()=>{const e=Vl("instanceStart"),t=Vl("instanceEnd"),r=Cn(sc.mul(Cn(e,1))).toVar("start"),s=Cn(sc.mul(Cn(t,1))).toVar("end");if(i){const e=this.dashScaleNode?yn(this.dashScaleNode):ap,t=this.offsetNode?yn(this.offsetNode):dp,r=Vl("instanceDistanceStart"),s=Vl("instanceDistanceEnd");let i=uc.y.lessThan(.5).select(e.mul(r),e.mul(s));i=i.add(t),kn("float","lineDistance").assign(i)}n&&(kn("vec3","worldStart").assign(r.xyz),kn("vec3","worldEnd").assign(s.xyz));const o=cd.z.div(cd.w),u=Ld.element(2).element(3).equal(-1);gn(u,()=>{gn(r.z.lessThan(0).and(s.z.greaterThan(0)),()=>{s.assign(a({start:r,end:s}))}).ElseIf(s.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{r.assign(a({start:s,end:r}))})});const l=Ld.mul(r),d=Ld.mul(s),c=l.xyz.div(l.w),h=d.xyz.div(d.w),p=h.xy.sub(c.xy).toVar();p.x.assign(p.x.mul(o)),p.assign(p.normalize());const g=Cn().toVar();if(n){const e=s.xyz.sub(r.xyz).normalize(),t=gu(r.xyz,s.xyz,.5).normalize(),n=e.cross(t).normalize(),a=e.cross(n),o=kn("vec4","worldPos");o.assign(uc.y.lessThan(.5).select(r,s));const u=lp.mul(.5);o.addAssign(Cn(uc.x.lessThan(0).select(n.mul(u),n.mul(u).negate()),0)),i||(o.addAssign(Cn(uc.y.lessThan(.5).select(e.mul(u).negate(),e.mul(u)),0)),o.addAssign(Cn(a.mul(u),0)),gn(uc.y.greaterThan(1).or(uc.y.lessThan(0)),()=>{o.subAssign(Cn(a.mul(2).mul(u),0))})),g.assign(Ld.mul(o));const l=Rn().toVar();l.assign(uc.y.lessThan(.5).select(c,h)),g.z.assign(l.z.mul(g.w))}else{const e=_n(p.y,p.x.negate()).toVar("offset");p.x.assign(p.x.div(o)),e.x.assign(e.x.div(o)),e.assign(uc.x.lessThan(0).select(e.negate(),e)),gn(uc.y.lessThan(0),()=>{e.assign(e.sub(p))}).ElseIf(uc.y.greaterThan(1),()=>{e.assign(e.add(p))}),e.assign(e.mul(lp)),e.assign(e.div(cd.w.div(od))),g.assign(uc.y.lessThan(.5).select(l,d)),e.assign(e.mul(g.w)),g.assign(g.add(Cn(e,0,0)))}return g})();const o=cn(({p1:e,p2:t,p3:r,p4:s})=>{const i=e.sub(r),n=s.sub(r),a=t.sub(e),o=i.dot(n),u=n.dot(a),l=i.dot(a),d=n.dot(n),c=a.dot(a).mul(d).sub(u.mul(u)),h=o.mul(u).sub(l.mul(d)).div(c).clamp(),p=o.add(u.mul(h)).div(d).clamp();return _n(h,p)});if(this.colorNode=cn(()=>{const e=kl();if(i){const t=this.dashSizeNode?yn(this.dashSizeNode):op,r=this.gapSizeNode?yn(this.gapSizeNode):up;ua.assign(t),la.assign(r);const s=kn("float","lineDistance");e.y.lessThan(-1).or(e.y.greaterThan(1)).discard(),s.mod(ua.add(la)).greaterThan(ua).discard()}const a=yn(1).toVar("alpha");if(n){const e=kn("vec3","worldStart"),s=kn("vec3","worldEnd"),n=kn("vec4","worldPos").xyz.normalize().mul(1e5),u=s.sub(e),l=o({p1:e,p2:s,p3:Rn(0,0,0),p4:n}),d=e.add(u.mul(l.x)),c=n.mul(l.y),h=d.sub(c).length().div(lp);if(!i)if(r&&t.currentSamples>0){const e=h.fwidth();a.assign(bu(e.negate().add(.5),e.add(.5),h).oneMinus())}else h.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1)),s=t.mul(t).add(r.mul(r)),i=yn(s.fwidth()).toVar("dlen");gn(e.y.abs().greaterThan(1),()=>{a.assign(bu(i.oneMinus(),i.add(1),s).oneMinus())})}else gn(e.y.abs().greaterThan(1),()=>{const t=e.x,r=e.y.greaterThan(0).select(e.y.sub(1),e.y.add(1));t.mul(t).add(r.mul(r)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(s){const e=Vl("instanceColorStart"),t=Vl("instanceColorEnd");u=uc.y.lessThan(.5).select(e,t).mul(Lh)}else u=Lh;return Cn(u,a)})(),this.transparent){const e=this.opacityNode?yn(this.opacityNode):Uh;this.outputNode=Cn(this.colorNode.rgb.mul(e).add(Xp().rgb.mul(e.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}copy(e){return super.copy(e),this.vertexColors=e.vertexColors,this.dashOffset=e.dashOffset,this.lineColorNode=e.lineColorNode,this.offsetNode=e.offsetNode,this.dashScaleNode=e.dashScaleNode,this.dashSizeNode=e.dashSizeNode,this.gapSizeNode=e.gapSizeNode,this._useDash=e._useDash,this._useAlphaToCoverage=e._useAlphaToCoverage,this._useWorldUnits=e._useWorldUnits,this}}const Cg=new se;class Mg extends vg{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Cg),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?yn(this.opacityNode):Uh;Gn.assign(Qu(Cn(vh(Sc),e),ie))}}const Bg=cn(([e=hc])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),r=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return _n(t,r)});class Fg extends ne{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new D(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const r=t.minFilter,s=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i=new ae(5,5,5),n=Bg(hc),a=new vg;a.colorNode=Kl(t,n,0),a.side=L,a.blending=re;const o=new oe(i,a),u=new ue;u.add(o),t.minFilter===Y&&(t.minFilter=le);const l=new de(1,10,this),d=e.getMRT();return e.setMRT(null),l.update(e,u),e.setMRT(d),t.minFilter=r,t.generateMipmaps=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,s=!0){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,r,s);e.setRenderTarget(i)}}const Lg=new WeakMap;class Pg extends gi{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=$c(null);const t=new D;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=ri.RENDER}updateBefore(e){const{renderer:t,material:r}=e,s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const e=s.isTextureNode?s.value:r[s.property];if(e&&e.isTexture){const r=e.mapping;if(r===ce||r===he){if(Lg.has(e)){const t=Lg.get(e);Ug(t,e.mapping),this._cubeTexture=t}else{const r=e.image;if(function(e){return null!=e&&e.height>0}(r)){const s=new Fg(r.height);s.fromEquirectangularTexture(t,e),Ug(s.texture,e.mapping),this._cubeTexture=s.texture,Lg.set(e,s.texture),e.addEventListener("dispose",Dg)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function Dg(e){const t=e.target;t.removeEventListener("dispose",Dg);const r=Lg.get(t);void 0!==r&&(Lg.delete(t),r.dispose())}function Ug(e,t){t===ce?e.mapping=U:t===he&&(e.mapping=I)}const Ig=an(Pg).setParameterLength(1);class Og extends Op{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Ig(this.envNode)}}class Vg extends Op{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=yn(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class kg{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Gg extends kg{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,r=e.reflectedLight,s=e.irradianceLightMap;r.indirectDiffuse.assign(Cn(0)),s?r.indirectDiffuse.addAssign(s):r.indirectDiffuse.addAssign(Cn(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(Gn.rgb)}finish(e){const{material:t,context:r}=e,s=r.outgoingLight,i=e.context.environment;if(i)switch(t.combine){case me:s.rgb.assign(gu(s.rgb,s.rgb.mul(i.rgb),kh.mul(Gh)));break;case ge:s.rgb.assign(gu(s.rgb,i.rgb,kh.mul(Gh)));break;case pe:s.rgb.addAssign(i.rgb.mul(kh.mul(Gh)));break;default:d("BasicLightingModel: Unsupported .combine value:",t.combine)}}}const zg=new fe;class $g extends vg{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(zg),this.setValues(e)}setupNormal(){return bc(vc)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Vg(pp)),t}setupOutgoingLight(){return Gn.rgb}setupLightingModel(){return new Gg}}const Wg=cn(({f0:e,f90:t,dotVH:r})=>{const s=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(s.oneMinus()).add(t.mul(s))}),Hg=cn(e=>e.diffuseColor.mul(1/Math.PI)),qg=cn(({dotNH:e})=>aa.mul(yn(.5)).add(1).mul(yn(1/Math.PI)).mul(e.pow(aa))),jg=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(t).clamp(),s=gc.dot(t).clamp(),i=Wg({f0:sa,f90:1,dotVH:s}),n=yn(.25),a=qg({dotNH:r});return i.mul(n).mul(a)});class Xg extends Gg{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t);r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:Gn.rgb}))),!0===this.specular&&r.directSpecular.addAssign(s.mul(jg({lightDirection:e})).mul(kh))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Kg=new ye;class Qg extends vg{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Kg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg(!1)}}const Yg=new be;class Zg extends vg{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Yg),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Og(t):null}setupLightingModel(){return new Xg}setupVariants(){const e=(this.shininessNode?yn(this.shininessNode):Ph).max(1e-4);aa.assign(e);const t=this.specularNode||Ih;sa.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const Jg=cn(e=>{if(!1===e.geometry.hasAttribute("normal"))return yn(0);const t=vc.dFdx().abs().max(vc.dFdy().abs());return t.x.max(t.y).max(t.z)}),em=cn(e=>{const{roughness:t}=e,r=Jg();let s=t.max(.0525);return s=s.add(r),s=s.min(1),s}),tm=cn(({alpha:e,dotNL:t,dotNV:r})=>{const s=e.pow2(),i=t.mul(s.add(s.oneMinus().mul(r.pow2())).sqrt()),n=r.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt());return Ua(.5,i.add(n).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),rm=cn(({alphaT:e,alphaB:t,dotTV:r,dotBV:s,dotTL:i,dotBL:n,dotNV:a,dotNL:o})=>{const u=o.mul(Rn(e.mul(r),t.mul(s),a).length()),l=a.mul(Rn(e.mul(i),t.mul(n),o).length());return Ua(.5,u.add(l).max(ao))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),sm=cn(({alpha:e,dotNH:t})=>{const r=e.pow2(),s=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),im=yn(1/Math.PI),nm=cn(({alphaT:e,alphaB:t,dotNH:r,dotTH:s,dotBH:i})=>{const n=e.mul(t),a=Rn(t.mul(s),e.mul(i),n.mul(r)),o=a.dot(a),u=n.div(o);return im.mul(n.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),am=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,normalView:n=Sc,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const u=s.pow2(),l=e.add(gc).normalize(),d=n.dot(e).clamp(),c=n.dot(gc).clamp(),h=n.dot(l).clamp(),p=gc.dot(l).clamp();let g,m,f=Wg({f0:t,f90:r,dotVH:p});if(Zi(a)&&(f=Qn.mix(f,i)),Zi(o)){const t=ta.dot(e),r=ta.dot(gc),s=ta.dot(l),i=ra.dot(e),n=ra.dot(gc),a=ra.dot(l);g=rm({alphaT:Jn,alphaB:u,dotTV:r,dotBV:n,dotTL:t,dotBL:i,dotNV:c,dotNL:d}),m=nm({alphaT:Jn,alphaB:u,dotNH:h,dotTH:s,dotBH:a})}else g=tm({alpha:u,dotNL:d,dotNV:c}),m=sm({alpha:u,dotNH:h});return f.mul(g).mul(m)}),om=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let um=null;const lm=cn(({roughness:e,dotNV:t})=>{null===um&&(um=new xe(om,16,16,$,Te),um.name="DFG_LUT",um.minFilter=le,um.magFilter=le,um.wrapS=_e,um.wrapT=_e,um.generateMipmaps=!1,um.needsUpdate=!0);const r=_n(e,t);return Kl(um,r).rg}),dm=cn(({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a})=>{const o=am({lightDirection:e,f0:t,f90:r,roughness:s,f:i,USE_IRIDESCENCE:n,USE_ANISOTROPY:a}),u=Sc.dot(e).clamp(),l=Sc.dot(gc).clamp(),d=lm({roughness:s,dotNV:l}),c=lm({roughness:s,dotNV:u}),h=t.mul(d.x).add(r.mul(d.y)),p=t.mul(c.x).add(r.mul(c.y)),g=d.x.add(d.y),m=c.x.add(c.y),f=yn(1).sub(g),y=yn(1).sub(m),b=t.add(t.oneMinus().mul(.047619)),x=h.mul(p).mul(b).div(yn(1).sub(f.mul(y).mul(b).mul(b)).add(ao)),T=f.mul(y),_=x.mul(T);return o.add(_)}),cm=cn(e=>{const{dotNV:t,specularColor:r,specularF90:s,roughness:i}=e,n=lm({dotNV:t,roughness:i});return r.mul(n.x).add(s.mul(n.y))}),hm=cn(({f:e,f90:t,dotVH:r})=>{const s=r.oneMinus().saturate(),i=s.mul(s),n=s.mul(i,i).clamp(0,.9999);return e.sub(Rn(t).mul(n)).div(n.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pm=cn(({roughness:e,dotNH:t})=>{const r=e.pow2(),s=yn(1).div(r),i=t.pow2().oneMinus().max(.0078125);return yn(2).add(s).mul(i.pow(s.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),gm=cn(({dotNV:e,dotNL:t})=>yn(1).div(yn(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),mm=cn(({lightDirection:e})=>{const t=e.add(gc).normalize(),r=Sc.dot(e).clamp(),s=Sc.dot(gc).clamp(),i=Sc.dot(t).clamp(),n=pm({roughness:Kn,dotNH:i}),a=gm({dotNV:s,dotNL:r});return Xn.mul(n).mul(a)}),fm=cn(({N:e,V:t,roughness:r})=>{const s=e.dot(t).saturate(),i=_n(r,s.oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),ym=cn(({f:e})=>{const t=e.length();return eu(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),bm=cn(({v1:e,v2:t})=>{const r=e.dot(t),s=r.abs().toVar(),i=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),n=s.add(4.1616724).mul(s).add(3.417594).toVar(),a=i.div(n),o=r.greaterThan(0).select(a,eu(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),xm=cn(({N:e,V:t,P:r,mInv:s,p0:i,p1:n,p2:a,p3:o})=>{const u=n.sub(i).toVar(),l=o.sub(i).toVar(),d=u.cross(l),c=Rn().toVar();return gn(d.dot(r.sub(i)).greaterThanEqual(0),()=>{const u=t.sub(e.mul(t.dot(e))).normalize(),l=e.cross(u).negate(),d=s.mul(Pn(u,l,e).transpose()).toVar(),h=d.mul(i.sub(r)).normalize().toVar(),p=d.mul(n.sub(r)).normalize().toVar(),g=d.mul(a.sub(r)).normalize().toVar(),m=d.mul(o.sub(r)).normalize().toVar(),f=Rn(0).toVar();f.addAssign(bm({v1:h,v2:p})),f.addAssign(bm({v1:p,v2:g})),f.addAssign(bm({v1:g,v2:m})),f.addAssign(bm({v1:m,v2:h})),c.assign(Rn(ym({f:f})))}),c}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Tm=cn(({P:e,p0:t,p1:r,p2:s,p3:i})=>{const n=r.sub(t).toVar(),a=i.sub(t).toVar(),o=n.cross(a),u=Rn().toVar();return gn(o.dot(e.sub(t)).greaterThanEqual(0),()=>{const n=t.sub(e).normalize().toVar(),a=r.sub(e).normalize().toVar(),o=s.sub(e).normalize().toVar(),l=i.sub(e).normalize().toVar(),d=Rn(0).toVar();d.addAssign(bm({v1:n,v2:a})),d.addAssign(bm({v1:a,v2:o})),d.addAssign(bm({v1:o,v2:l})),d.addAssign(bm({v1:l,v2:n})),u.assign(Rn(ym({f:d.abs()})))}),u}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),_m=1/6,vm=e=>Da(_m,Da(e,Da(e,e.negate().add(3)).sub(3)).add(1)),Nm=e=>Da(_m,Da(e,Da(e,Da(3,e).sub(6))).add(4)),Sm=e=>Da(_m,Da(e,Da(e,Da(-3,e).add(3)).add(3)).add(1)),Rm=e=>Da(_m,ou(e,3)),Em=e=>vm(e).add(Nm(e)),Am=e=>Sm(e).add(Rm(e)),wm=e=>La(-1,Nm(e).div(vm(e).add(Nm(e)))),Cm=e=>La(1,Rm(e).div(Sm(e).add(Rm(e)))),Mm=(e,t,r)=>{const s=e.uvNode,i=Da(s,t.zw).add(.5),n=No(i),a=Eo(i),o=Em(a.x),u=Am(a.x),l=wm(a.x),d=Cm(a.x),c=wm(a.y),h=Cm(a.y),p=_n(n.x.add(l),n.y.add(c)).sub(.5).mul(t.xy),g=_n(n.x.add(d),n.y.add(c)).sub(.5).mul(t.xy),m=_n(n.x.add(l),n.y.add(h)).sub(.5).mul(t.xy),f=_n(n.x.add(d),n.y.add(h)).sub(.5).mul(t.xy),y=Em(a.y).mul(La(o.mul(e.sample(p).level(r)),u.mul(e.sample(g).level(r)))),b=Am(a.y).mul(La(o.mul(e.sample(m).level(r)),u.mul(e.sample(f).level(r))));return y.add(b)},Bm=cn(([e,t])=>{const r=_n(e.size(bn(t))),s=_n(e.size(bn(t.add(1)))),i=Ua(1,r),n=Ua(1,s),a=Mm(e,Cn(i,r),No(t)),o=Mm(e,Cn(n,s),So(t));return Eo(t).mix(a,o)}),Fm=cn(([e,t])=>{const r=t.mul(Wl(e));return Bm(e,r)}),Lm=cn(([e,t,r,s,i])=>{const n=Rn(yu(t.negate(),Ro(e),Ua(1,s))),a=Rn(Go(i[0].xyz),Go(i[1].xyz),Go(i[2].xyz));return Ro(n).mul(r.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Pm=cn(([e,t])=>e.mul(mu(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Dm=qp(),Um=Xp(),Im=cn(([e,t,r],{material:s})=>{const i=(s.side===L?Dm:Um).sample(e),n=To(ld.x).mul(Pm(t,r));return Bm(i,n)}),Om=cn(([e,t,r])=>(gn(r.notEqual(0),()=>{const s=xo(t).negate().div(r);return yo(s.negate().mul(e))}),Rn(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Vm=cn(([e,t,r,s,i,n,a,o,u,l,d,c,h,p,g])=>{let m,f;if(g){m=Cn().toVar(),f=Rn().toVar();const i=d.sub(1).mul(g.mul(.025)),n=Rn(d.sub(i),d,d.add(i));Bp({start:0,end:3},({i:i})=>{const d=n.element(i),g=Lm(e,t,c,d,o),y=a.add(g),b=l.mul(u.mul(Cn(y,1))),x=_n(b.xy.div(b.w)).toVar();x.addAssign(1),x.divAssign(2),x.assign(_n(x.x,x.y.oneMinus()));const T=Im(x,r,d);m.element(i).assign(T.element(i)),m.a.addAssign(T.a),f.element(i).assign(s.element(i).mul(Om(Go(g),h,p).element(i)))}),m.a.divAssign(3)}else{const i=Lm(e,t,c,d,o),n=a.add(i),g=l.mul(u.mul(Cn(n,1))),y=_n(g.xy.div(g.w)).toVar();y.addAssign(1),y.divAssign(2),y.assign(_n(y.x,y.y.oneMinus())),m=Im(y,r,d),f=s.mul(Om(Go(i),h,p))}const y=f.rgb.mul(m.rgb),b=e.dot(t).clamp(),x=Rn(cm({dotNV:b,specularColor:i,specularF90:n,roughness:r})),T=f.r.add(f.g,f.b).div(3);return Cn(x.oneMinus().mul(y),m.a.oneMinus().mul(T).oneMinus())}),km=Pn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Gm=(e,t)=>e.sub(t).div(e.add(t)).pow2(),zm=cn(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:s,baseF0:i})=>{const n=gu(e,t,bu(0,.03,s)),a=e.div(n).pow2().mul(r.pow2().oneMinus()).oneMinus();gn(a.lessThan(0),()=>Rn(1));const o=a.sqrt(),u=Gm(n,e),l=Wg({f0:u,f90:1,dotVH:r}),d=l.oneMinus(),c=n.lessThan(e).select(Math.PI,0),h=yn(Math.PI).sub(c),p=(e=>{const t=e.sqrt();return Rn(1).add(t).div(Rn(1).sub(t))})(i.clamp(0,.9999)),g=Gm(p,n.toVec3()),m=Wg({f0:g,f90:1,dotVH:o}),f=Rn(p.x.lessThan(n).select(Math.PI,0),p.y.lessThan(n).select(Math.PI,0),p.z.lessThan(n).select(Math.PI,0)),y=n.mul(s,o,2),b=Rn(h).add(f),x=l.mul(m).clamp(1e-5,.9999),T=x.sqrt(),_=d.pow2().mul(m).div(Rn(1).sub(x)),v=l.add(_).toVar(),N=_.sub(d).toVar();return Bp({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{N.mulAssign(T);const t=((e,t)=>{const r=e.mul(2*Math.PI*1e-9),s=Rn(54856e-17,44201e-17,52481e-17),i=Rn(1681e3,1795300,2208400),n=Rn(43278e5,93046e5,66121e5),a=yn(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(r.mul(2239900).add(t.x).cos()).mul(r.pow2().mul(-45282e5).exp());let o=s.mul(n.mul(2*Math.PI).sqrt()).mul(i.mul(r).add(t).cos()).mul(r.pow2().negate().mul(n).exp());return o=Rn(o.x.add(a),o.y,o.z).div(1.0685e-7),km.mul(o)})(yn(e).mul(y),yn(e).mul(b)).mul(2);v.addAssign(N.mul(t))}),v.max(Rn(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),$m=cn(({normal:e,viewDir:t,roughness:r})=>{const s=e.dot(t).saturate(),i=r.mul(r),n=r.add(.1).reciprocal(),a=yn(-1.9362).add(r.mul(1.0678)).add(i.mul(.4573)).sub(n.mul(.8469)),o=yn(-.6014).add(r.mul(.5538)).sub(i.mul(.467)).sub(n.mul(.1255));return a.mul(s).add(o).exp().saturate()}),Wm=Rn(.04),Hm=yn(1);class qm extends kg{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=s,this.transmission=i,this.dispersion=n,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=Rn().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Rn().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Rn().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=Rn().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Rn().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=Sc.dot(gc).clamp(),t=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:sa}),r=zm({outsideIOR:yn(1),eta2:Yn,cosTheta1:e,thinFilmThickness:Zn,baseF0:Gn.rgb});this.iridescenceFresnel=gu(t,r,Hn),this.iridescenceF0Dielectric=hm({f:t,f90:1,dotVH:e}),this.iridescenceF0Metallic=hm({f:r,f90:1,dotVH:e}),this.iridescenceF0=gu(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Hn)}if(!0===this.transmission){const t=cc,r=Od.sub(cc).normalize(),s=Rc,i=e.context;i.backdrop=Vm(s,r,Wn,zn,ia,na,t,Qd,Dd,Ld,ca,pa,ma,ga,this.dispersion?fa:null),i.backdropAlpha=ha,Gn.a.mulAssign(gu(1,i.backdrop.a,ha))}super.start(e)}computeMultiscattering(e,t,r,s,i=null){const n=Sc.dot(gc).clamp(),a=lm({roughness:Wn,dotNV:n}),o=i?Qn.mix(s,i):s,u=o.mul(a.x).add(r.mul(a.y)),l=a.x.add(a.y).oneMinus(),d=o.add(o.oneMinus().mul(.047619)),c=u.mul(d).div(l.mul(d).oneMinus());e.addAssign(u),t.addAssign(c.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){const s=Sc.dot(e).clamp().mul(t).toVar();if(!0===this.sheen){this.sheenSpecularDirect.addAssign(s.mul(mm({lightDirection:e})));const t=$m({normal:Sc,viewDir:gc,roughness:Kn}),r=$m({normal:Sc,viewDir:e,roughness:Kn}),i=Xn.r.max(Xn.g).max(Xn.b).mul(t.max(r)).oneMinus();s.mulAssign(i)}if(!0===this.clearcoat){const r=Ec.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(r.mul(am({lightDirection:e,f0:Wm,f90:Hm,roughness:jn,normalView:Ec})))}r.directDiffuse.addAssign(s.mul(Hg({diffuseColor:zn}))),r.directSpecular.addAssign(s.mul(dm({lightDirection:e,f0:ia,f90:1,roughness:Wn,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s,reflectedLight:i,ltc_1:n,ltc_2:a}){const o=t.add(r).sub(s),u=t.sub(r).sub(s),l=t.sub(r).add(s),d=t.add(r).add(s),c=Sc,h=gc,p=pc.toVar(),g=fm({N:c,V:h,roughness:Wn}),m=n.sample(g).toVar(),f=a.sample(g).toVar(),y=Pn(Rn(m.x,0,m.y),Rn(0,1,0),Rn(m.z,0,m.w)).toVar(),b=ia.mul(f.x).add(na.sub(ia).mul(f.y)).toVar();if(i.directSpecular.addAssign(e.mul(b).mul(xm({N:c,V:h,P:p,mInv:y,p0:o,p1:u,p2:l,p3:d}))),i.directDiffuse.addAssign(e.mul(zn).mul(xm({N:c,V:h,P:p,mInv:Pn(1,0,0,0,1,0,0,0,1),p0:o,p1:u,p2:l,p3:d}))),!0===this.clearcoat){const t=Ec,r=fm({N:t,V:h,roughness:jn}),s=n.sample(r),i=a.sample(r),c=Pn(Rn(s.x,0,s.y),Rn(0,1,0),Rn(s.z,0,s.w)),g=Wm.mul(i.x).add(Hm.sub(Wm).mul(i.y));this.clearcoatSpecularDirect.addAssign(e.mul(g).mul(xm({N:t,V:h,P:p,mInv:c,p0:o,p1:u,p2:l,p3:d})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:r}=e.context,s=t.mul(Hg({diffuseColor:zn})).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();s.mulAssign(t)}r.indirectDiffuse.addAssign(s)}indirectSpecular(e){const{radiance:t,iblIrradiance:r,reflectedLight:s}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(r.mul(Xn,$m({normal:Sc,viewDir:gc,roughness:Kn}))),!0===this.clearcoat){const e=Ec.dot(gc).clamp(),t=cm({dotNV:e,specularColor:Wm,specularF90:Hm,roughness:jn});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=Rn().toVar("singleScatteringDielectric"),n=Rn().toVar("multiScatteringDielectric"),a=Rn().toVar("singleScatteringMetallic"),o=Rn().toVar("multiScatteringMetallic");this.computeMultiscattering(i,n,na,sa,this.iridescenceF0Dielectric),this.computeMultiscattering(a,o,na,Gn.rgb,this.iridescenceF0Metallic);const u=gu(i,a,Hn),l=gu(n,o,Hn),d=i.add(n),c=zn.mul(d.oneMinus()),h=r.mul(1/Math.PI),p=t.mul(u).add(l.mul(h)).toVar(),g=c.mul(h).toVar();if(!0===this.sheen){const e=$m({normal:Sc,viewDir:gc,roughness:Kn}),t=Xn.r.max(Xn.g).max(Xn.b).mul(e).oneMinus();p.mulAssign(t),g.mulAssign(t)}s.indirectSpecular.addAssign(p),s.indirectDiffuse.addAssign(g)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:r}=e.context,s=Sc.dot(gc).clamp().add(t),i=Wn.mul(-16).oneMinus().negate().exp2(),n=t.sub(s.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(n)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=Ec.dot(gc).clamp(),r=Wg({dotVH:e,f0:Wm,f90:Hm}),s=t.mul(qn.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(qn));t.assign(s)}if(!0===this.sheen){const e=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(e)}}}const jm=yn(1),Xm=yn(-2),Km=yn(.8),Qm=yn(-1),Ym=yn(.4),Zm=yn(2),Jm=yn(.305),ef=yn(3),tf=yn(.21),rf=yn(4),sf=yn(4),nf=yn(16),af=cn(([e])=>{const t=Rn(Vo(e)).toVar(),r=yn(-1).toVar();return gn(t.x.greaterThan(t.z),()=>{gn(t.x.greaterThan(t.y),()=>{r.assign(Au(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}).Else(()=>{gn(t.z.greaterThan(t.y),()=>{r.assign(Au(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(Au(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),of=cn(([e,t])=>{const r=_n().toVar();return gn(t.equal(0),()=>{r.assign(_n(e.z,e.y).div(Vo(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(_n(e.x.negate(),e.z.negate()).div(Vo(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(_n(e.x.negate(),e.y).div(Vo(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(_n(e.z.negate(),e.y).div(Vo(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(_n(e.x.negate(),e.z).div(Vo(e.y)))}).Else(()=>{r.assign(_n(e.x,e.y).div(Vo(e.z)))}),Da(.5,r.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),uf=cn(([e])=>{const t=yn(0).toVar();return gn(e.greaterThanEqual(Km),()=>{t.assign(jm.sub(e).mul(Qm.sub(Xm)).div(jm.sub(Km)).add(Xm))}).ElseIf(e.greaterThanEqual(Ym),()=>{t.assign(Km.sub(e).mul(Zm.sub(Qm)).div(Km.sub(Ym)).add(Qm))}).ElseIf(e.greaterThanEqual(Jm),()=>{t.assign(Ym.sub(e).mul(ef.sub(Zm)).div(Ym.sub(Jm)).add(Zm))}).ElseIf(e.greaterThanEqual(tf),()=>{t.assign(Jm.sub(e).mul(rf.sub(ef)).div(Jm.sub(tf)).add(ef))}).Else(()=>{t.assign(yn(-2).mul(To(Da(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),lf=cn(([e,t])=>{const r=e.toVar();r.assign(Da(2,r).sub(1));const s=Rn(r,1).toVar();return gn(t.equal(0),()=>{s.assign(s.zyx)}).ElseIf(t.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),df=cn(([e,t,r,s,i,n])=>{const a=yn(r),o=Rn(t),u=mu(uf(a),Xm,n),l=Eo(u),d=No(u),c=Rn(cf(e,o,d,s,i,n)).toVar();return gn(l.notEqual(0),()=>{const t=Rn(cf(e,o,d.add(1),s,i,n)).toVar();c.assign(gu(c,t,l))}),c}),cf=cn(([e,t,r,s,i,n])=>{const a=yn(r).toVar(),o=Rn(t),u=yn(af(o)).toVar(),l=yn(eu(sf.sub(a),0)).toVar();a.assign(eu(a,sf));const d=yn(bo(a)).toVar(),c=_n(of(o,u).mul(d.sub(2)).add(1)).toVar();return gn(u.greaterThan(2),()=>{c.y.addAssign(d),u.subAssign(3)}),c.x.addAssign(u.mul(d)),c.x.addAssign(l.mul(Da(3,nf))),c.y.addAssign(Da(4,bo(n).sub(d))),c.x.mulAssign(s),c.y.mulAssign(i),e.sample(c).grad(_n(),_n())}),hf=cn(({envMap:e,mipInt:t,outputDirection:r,theta:s,axis:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Co(s),l=r.mul(u).add(i.cross(r).mul(Ao(s))).add(i.mul(i.dot(r).mul(u.oneMinus())));return cf(e,l,t,n,a,o)}),pf=cn(({n:e,latitudinal:t,poleAxis:r,outputDirection:s,weights:i,samples:n,dTheta:a,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})=>{const h=Rn(Au(t,r,au(r,s))).toVar();gn(h.equal(Rn(0)),()=>{h.assign(Rn(s.z,0,s.x.negate()))}),h.assign(Ro(h));const p=Rn().toVar();return p.addAssign(i.element(0).mul(hf({theta:0,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),Bp({start:bn(1),end:e},({i:e})=>{gn(e.greaterThanEqual(n),()=>{Fp()});const t=yn(a.mul(yn(e))).toVar();p.addAssign(i.element(e).mul(hf({theta:t.mul(-1),axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c}))),p.addAssign(i.element(e).mul(hf({theta:t,axis:h,outputDirection:s,mipInt:o,envMap:u,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:c})))}),Cn(p,1)}),gf=cn(([e])=>{const t=xn(e).toVar();return t.assign(t.shiftLeft(xn(16)).bitOr(t.shiftRight(xn(16)))),t.assign(t.bitAnd(xn(1431655765)).shiftLeft(xn(1)).bitOr(t.bitAnd(xn(2863311530)).shiftRight(xn(1)))),t.assign(t.bitAnd(xn(858993459)).shiftLeft(xn(2)).bitOr(t.bitAnd(xn(3435973836)).shiftRight(xn(2)))),t.assign(t.bitAnd(xn(252645135)).shiftLeft(xn(4)).bitOr(t.bitAnd(xn(4042322160)).shiftRight(xn(4)))),t.assign(t.bitAnd(xn(16711935)).shiftLeft(xn(8)).bitOr(t.bitAnd(xn(4278255360)).shiftRight(xn(8)))),yn(t).mul(2.3283064365386963e-10)}),mf=cn(([e,t])=>_n(yn(e).div(yn(t)),gf(e))),ff=cn(([e,t,r])=>{const s=r.mul(r).toConst(),i=Rn(1,0,0).toConst(),n=au(t,i).toConst(),a=_o(e.x).toConst(),o=Da(2,3.14159265359).mul(e.y).toConst(),u=a.mul(Co(o)).toConst(),l=a.mul(Ao(o)).toVar(),d=Da(.5,t.z.add(1)).toConst();l.assign(d.oneMinus().mul(_o(u.mul(u).oneMinus())).add(d.mul(l)));const c=i.mul(u).add(n.mul(l)).add(t.mul(_o(eu(0,u.mul(u).add(l.mul(l)).oneMinus()))));return Ro(Rn(s.mul(c.x),s.mul(c.y),eu(0,c.z)))}),yf=cn(({roughness:e,mipInt:t,envMap:r,N_immutable:s,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const u=Rn(s).toVar(),l=Rn(0).toVar(),d=yn(0).toVar();return gn(e.lessThan(.001),()=>{l.assign(cf(r,u,t,n,a,o))}).Else(()=>{const s=Au(Vo(u.z).lessThan(.999),Rn(0,0,1),Rn(1,0,0)),c=Ro(au(s,u)).toVar(),h=au(u,c).toVar();Bp({start:xn(0),end:i},({i:s})=>{const p=mf(s,i),g=ff(p,Rn(0,0,1),e),m=Ro(c.mul(g.x).add(h.mul(g.y)).add(u.mul(g.z))),f=Ro(m.mul(nu(u,m).mul(2)).sub(u)),y=eu(nu(u,f),0);gn(y.greaterThan(0),()=>{const e=cf(r,f,t,n,a,o);l.addAssign(e.mul(y)),d.addAssign(y)})}),gn(d.greaterThan(0),()=>{l.assign(l.div(d))})}),Cn(l,1)}),bf=[.125,.215,.35,.446,.526,.582],xf=20,Tf=new Ne(-1,1,1,-1,0,1),_f=new Se(90,1),vf=new e;let Nf=null,Sf=0,Rf=0;const Ef=new r,Af=new WeakMap,wf=[3,1,5,0,4,2],Cf=lf(kl(),Vl("faceIndex")).normalize(),Mf=Rn(Cf.x,Cf.y,Cf.z);class Bf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,s=100,i={}){const{size:n=256,position:a=Ef,renderTarget:o=null}=i;if(this._setSize(n),!1===this._hasInitialized){d('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const n=o||this._allocateTarget();return i.renderTarget=n,this.fromSceneAsync(e,t,r,s,i),n}Nf=this._renderer.getRenderTarget(),Sf=this._renderer.getActiveCubeFace(),Rf=this._renderer.getActiveMipmapLevel();const u=o||this._allocateTarget();return u.depthBuffer=!0,this._init(u),this._sceneToCubeUV(e,r,s,u,a),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}async fromSceneAsync(e,t=0,r=.1,s=100,i={}){return v('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,r,s,i)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){d('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromEquirectangularAsync(e,r),r}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return v('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){d("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const r=t||this._allocateTarget();return this.fromCubemapAsync(e,t),r}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return v('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Df(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===U||e.mapping===I?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=bf[a-e+4-1]:0===a&&(o=0),r.push(o);const u=1/(n-2),l=-u,d=1+u,c=[l,l,d,l,d,d,l,l,d,d,l,d],h=6,p=6,g=3,m=2,f=1,y=new Float32Array(g*p*h),b=new Float32Array(m*p*h),x=new Float32Array(f*p*h);for(let e=0;e2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0],i=wf[e];y.set(s,g*p*i),b.set(c,m*p*i);const n=[i,i,i,i,i,i];x.set(n,f*p*i)}const T=new ve;T.setAttribute("position",new we(y,g)),T.setAttribute("uv",new we(b,m)),T.setAttribute("faceIndex",new we(x,f)),s.push(new oe(T,null)),i>4&&i--}return{lodMeshes:s,sizeLods:t,sigmas:r}}(t)),this._blurMaterial=function(e,t,s){const i=td(new Array(xf).fill(0)),n=Sa(new r(0,1,0)),a=Sa(0),o=yn(xf),u=Sa(0),l=Sa(1),d=Kl(),c=Sa(0),h=yn(1/t),p=yn(1/s),g=yn(e),m={n:o,latitudinal:u,weights:i,poleAxis:n,outputDirection:Mf,dTheta:a,samples:l,envMap:d,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g},f=Lf("blur");return f.fragmentNode=pf({...m,latitudinal:u.equal(1)}),Af.set(f,m),f}(t,e.width,e.height),this._ggxMaterial=function(e,t,r){const s=Kl(),i=Sa(0),n=Sa(0),a=yn(1/t),o=yn(1/r),u=yn(e),l={envMap:s,roughness:i,mipInt:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u},d=Lf("ggx");return d.fragmentNode=yf({...l,N_immutable:Mf,GGX_SAMPLES:xn(512)}),Af.set(d,l),d}(t,e.width,e.height)}}async _compileMaterial(e){const t=new oe(new ve,e);await this._renderer.compile(t,Tf)}_sceneToCubeUV(e,t,r,s,i){const n=_f;n.near=t,n.far=r;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],u=this._renderer,l=u.autoClear;u.getClearColor(vf),u.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new oe(new ae,new fe({name:"PMREM.Background",side:L,depthWrite:!1,depthTest:!1})));const d=this._backgroundBox,c=d.material;let h=!1;const p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,h=!0):(c.color.copy(vf),h=!0),u.setRenderTarget(s),u.clear(),h&&u.render(d,n);for(let t=0;t<6;t++){const r=t%3;0===r?(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x+o[t],i.y,i.z)):1===r?(n.up.set(0,0,a[t]),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y+o[t],i.z)):(n.up.set(0,a[t],0),n.position.set(i.x,i.y,i.z),n.lookAt(i.x,i.y,i.z+o[t]));const l=this._cubeSize;this._setViewport(s,r*l,t>2?l:0,l,l),u.render(e,n)}u.autoClear=l,e.background=p}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===U||e.mapping===I;s?null===this._cubemapMaterial&&(this._cubemapMaterial=Pf(e)):null===this._equirectMaterial&&(this._equirectMaterial=Df(e));const i=s?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;const n=this._lodMeshes[0];n.material=i;const a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),r.setRenderTarget(t),r.render(n,Tf)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let t=1;tc-4?r-c+4:0),g=4*(this._cubeSize-h);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=d,o.mipInt.value=c-t,this._setViewport(i,p,g,3*h,2*h),s.setRenderTarget(i),s.render(a,Tf),i.texture.frame=(i.texture.frame||0)+1,o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=c-r,this._setViewport(e,p,g,3*h,2*h),s.setRenderTarget(e),s.render(a,Tf)}_blur(e,t,r,s,i){const n=this._pingPongRenderTarget;this._halfBlur(e,n,t,r,s,"latitudinal",i),this._halfBlur(n,e,r,r,s,"longitudinal",i)}_halfBlur(e,t,r,s,i,n,a){const u=this._renderer,l=this._blurMaterial;"latitudinal"!==n&&"longitudinal"!==n&&o("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[s];c.material=l;const h=Af.get(l),p=this._sizeLods[r]-1,g=isFinite(i)?Math.PI/(2*p):2*Math.PI/39,m=i/g,f=isFinite(i)?1+Math.floor(3*m):xf;f>xf&&d(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const y=[];let b=0;for(let e=0;ex-4?s-x+4:0),v=4*(this._cubeSize-T);this._setViewport(t,_,v,3*T,2*T),u.setRenderTarget(t),u.render(c,Tf)}_setViewport(e,t,r,s,i){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-i-r,s,i),e.scissor.set(t,e.height-i-r,s,i)):(e.viewport.set(t,r,s,i),e.scissor.set(t,r,s,i))}}function Ff(e,t){const r=new ne(e,t,{magFilter:le,minFilter:le,generateMipmaps:!1,type:Te,format:Ee,colorSpace:Re});return r.texture.mapping=Ae,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function Lf(e){const t=new vg;return t.depthTest=!1,t.depthWrite=!1,t.blending=re,t.name=`PMREM_${e}`,t}function Pf(e){const t=Lf("cubemap");return t.fragmentNode=$c(e,Mf),t}function Df(e){const t=Lf("equirect");return t.fragmentNode=Kl(e,Bg(Mf),0),t}const Uf=new WeakMap;function If(e,t,r){const s=function(e){let t=Uf.get(e);void 0===t&&(t=new WeakMap,Uf.set(e,t));return t}(t);let i=s.get(e);if((void 0!==i?i.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const r=6;for(let s=0;s0}(t))return null;i=r.fromEquirectangular(e,i)}i.pmremVersion=e.pmremVersion,s.set(e,i)}return i.texture}class Of extends gi{static get type(){return"PMREMNode"}constructor(e,t=null,r=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;const s=new N;s.isRenderTargetTexture=!0,this._texture=Kl(s),this._width=Sa(0),this._height=Sa(0),this._maxMip=Sa(0),this.updateBeforeType=ri.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const r=t?t.pmremVersion:-1,s=this._value;r!==s.pmremVersion&&(t=!0===s.isPMREMTexture?s:If(s,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new Bf(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this,e)),t=Dc.mul(Rn(t.x,t.y.negate(),t.z));let r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),df(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const Vf=an(Of).setParameterLength(1,3),kf=new WeakMap;class Gf extends Op{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:t[r.property],i=this._getPMREMNodeCache(e.renderer);let n=i.get(s);void 0===n&&(n=Vf(s),i.set(s,n)),r=n}const s=!0===t.useAnisotropy||t.anisotropy>0?_h:Sc,i=r.context(zf(Wn,s)).mul(Pc),n=r.context($f(Rc)).mul(Math.PI).mul(Pc),a=vl(i),o=vl(n);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const u=e.context.lightingModel.clearcoatRadiance;if(u){const e=r.context(zf(jn,Ec)).mul(Pc),t=vl(e);u.addAssign(t)}}_getPMREMNodeCache(e){let t=kf.get(e);return void 0===t&&(t=new WeakMap,kf.set(e,t)),t}}const zf=(e,t)=>{let r=null;return{getUV:()=>(null===r&&(r=gc.negate().reflect(t),r=du(e).mix(r,t).normalize(),r=r.transformDirection(Dd)),r),getTextureLevel:()=>e}},$f=e=>({getUV:()=>e,getTextureLevel:()=>yn(1)}),Wf=new Ce;class Hf extends vg{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Wf),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new Gf(t):null}setupLightingModel(){return new qm}setupSpecular(){const e=gu(Rn(.04),Gn.rgb,Hn);sa.assign(Rn(.04)),ia.assign(e),na.assign(1)}setupVariants(){const e=this.metalnessNode?yn(this.metalnessNode):$h;Hn.assign(e);let t=this.roughnessNode?yn(this.roughnessNode):zh;t=em({roughness:t}),Wn.assign(t),this.setupSpecular(),zn.assign(Gn.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qf=new Me;class jf extends Hf{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qf),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?yn(this.iorNode):sp;ca.assign(e),sa.assign(Jo(uu(ca.sub(1).div(ca.add(1))).mul(Vh),Rn(1)).mul(Oh)),ia.assign(gu(sa,Gn.rgb,Hn)),na.assign(gu(Oh,1,Hn))}setupLightingModel(){return new qm(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?yn(this.clearcoatNode):Hh,t=this.clearcoatRoughnessNode?yn(this.clearcoatRoughnessNode):qh;qn.assign(e),jn.assign(em({roughness:t}))}if(this.useSheen){const e=this.sheenNode?Rn(this.sheenNode):Kh,t=this.sheenRoughnessNode?yn(this.sheenRoughnessNode):Qh;Xn.assign(e),Kn.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?yn(this.iridescenceNode):Zh,t=this.iridescenceIORNode?yn(this.iridescenceIORNode):Jh,r=this.iridescenceThicknessNode?yn(this.iridescenceThicknessNode):ep;Qn.assign(e),Yn.assign(t),Zn.assign(r)}if(this.useAnisotropy){const e=(this.anisotropyNode?_n(this.anisotropyNode):Yh).toVar();ea.assign(e.length()),gn(ea.equal(0),()=>{e.assign(_n(1,0))}).Else(()=>{e.divAssign(_n(ea)),ea.assign(ea.saturate())}),Jn.assign(ea.pow2().mix(Wn.pow2(),1)),ta.assign(xh[0].mul(e.x).add(xh[1].mul(e.y))),ra.assign(xh[1].mul(e.x).sub(xh[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?yn(this.transmissionNode):tp,t=this.thicknessNode?yn(this.thicknessNode):rp,r=this.attenuationDistanceNode?yn(this.attenuationDistanceNode):ip,s=this.attenuationColorNode?Rn(this.attenuationColorNode):np;if(ha.assign(e),pa.assign(t),ga.assign(r),ma.assign(s),this.useDispersion){const e=this.dispersionNode?yn(this.dispersionNode):hp;fa.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Rn(this.clearcoatNormalNode):jh}setup(e){e.context.setupClearcoatNormal=()=>Gu(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class Xf extends qm{constructor(e=!1,t=!1,r=!1,s=!1,i=!1,n=!1,a=!1){super(e,t,r,s,i,n),this.useSSS=a}direct({lightDirection:e,lightColor:t,reflectedLight:r},s){if(!0===this.useSSS){const i=s.material,{thicknessColorNode:n,thicknessDistortionNode:a,thicknessAmbientNode:o,thicknessAttenuationNode:u,thicknessPowerNode:l,thicknessScaleNode:d}=i,c=e.add(Sc.mul(a)).normalize(),h=yn(gc.dot(c.negate()).saturate().pow(l).mul(d)),p=Rn(h.add(o).mul(n));r.directDiffuse.addAssign(p.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:r},s)}}class Kf extends jf{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=yn(.1),this.thicknessAmbientNode=yn(0),this.thicknessAttenuationNode=yn(.1),this.thicknessPowerNode=yn(2),this.thicknessScaleNode=yn(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new Xf(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const Qf=cn(({normal:e,lightDirection:t,builder:r})=>{const s=e.dot(t),i=_n(s.mul(.5).add(.5),0);if(r.material.gradientMap){const e=Kc("gradientMap","texture").context({getUV:()=>i});return Rn(e.r)}{const e=i.fwidth().mul(.5);return gu(Rn(.7),Rn(1),bu(yn(.7).sub(e.x),yn(.7).add(e.x),i.x))}});class Yf extends kg{direct({lightDirection:e,lightColor:t,reflectedLight:r},s){const i=Qf({normal:xc,lightDirection:e,builder:s}).mul(t);r.directDiffuse.addAssign(i.mul(Hg({diffuseColor:Gn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:r,reflectedLight:s}=e.context;s.indirectDiffuse.addAssign(r.mul(Hg({diffuseColor:Gn}))),s.indirectDiffuse.mulAssign(t)}}const Zf=new Be;class Jf extends vg{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Zf),this.setValues(e)}setupLightingModel(){return new Yf}}const ey=cn(()=>{const e=Rn(gc.z,0,gc.x.negate()).normalize(),t=gc.cross(e);return _n(e.dot(Sc),t.dot(Sc)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),ty=new Fe;class ry extends vg{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(ty),this.setValues(e)}setupVariants(e){const t=ey;let r;r=e.material.matcap?Kc("matcap","texture").context({getUV:()=>t}):Rn(gu(.2,.8,t.y)),Gn.rgb.mulAssign(r.rgb)}}class sy extends gi{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:r}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),s=t.sin();return Ln(e,s,s.negate(),e).mul(r)}{const e=t,s=Dn(Cn(1,0,0,0),Cn(0,Co(e.x),Ao(e.x).negate(),0),Cn(0,Ao(e.x),Co(e.x),0),Cn(0,0,0,1)),i=Dn(Cn(Co(e.y),0,Ao(e.y),0),Cn(0,1,0,0),Cn(Ao(e.y).negate(),0,Co(e.y),0),Cn(0,0,0,1)),n=Dn(Cn(Co(e.z),Ao(e.z).negate(),0,0),Cn(Ao(e.z),Co(e.z),0,0),Cn(0,0,1,0),Cn(0,0,0,1));return s.mul(i).mul(n).mul(Cn(r,1)).xyz}}}const iy=an(sy).setParameterLength(2),ny=new Le;class ay extends vg{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(ny),this.setValues(e)}setupPositionView(e){const{object:t,camera:r}=e,{positionNode:s,rotationNode:i,scaleNode:n,sizeAttenuation:a}=this,o=sc.mul(Rn(s||0));let u=_n(Qd[0].xyz.length(),Qd[1].xyz.length());null!==n&&(u=u.mul(_n(n))),r.isPerspectiveCamera&&!1===a&&(u=u.mul(o.z.negate()));let l=uc.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,r)=>new Zu(e,t,r))("center","vec2",t);l=l.sub(e.sub(.5))}l=l.mul(u);const d=yn(i||Xh),c=iy(l,d);return Cn(o.xy.add(c),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const oy=new Pe,uy=new t;class ly extends ay{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(oy),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return sc.mul(Rn(e||lc)).xyz}setupVertexSprite(e){const{material:t,camera:r}=e,{rotationNode:s,scaleNode:i,sizeNode:n,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let u=null!==n?_n(n):cp;u=u.mul(od),r.isPerspectiveCamera&&!0===a&&(u=u.mul(dy.div(pc.z.negate()))),i&&i.isNode&&(u=u.mul(_n(i)));let l=uc.xy;if(s&&s.isNode){const e=yn(s);l=iy(l,e)}return l=l.mul(u),l=l.div(hd.div(2)),l=l.mul(o.w),o=o.add(Cn(l,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const dy=Sa(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(uy);this.value=.5*t.y});class cy extends kg{constructor(){super(),this.shadowNode=yn(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Gn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Gn.rgb)}}const hy=new De;class py extends vg{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(hy),this.setValues(e)}setupLightingModel(){return new cy}}const gy=Vn("vec3"),my=Vn("vec3"),fy=Vn("vec3");class yy extends kg{constructor(){super()}start(e){const{material:t}=e,r=Vn("vec3"),s=Vn("vec3");gn(Od.sub(cc).length().greaterThan(ec.mul(2)),()=>{r.assign(Od),s.assign(cc)}).Else(()=>{r.assign(cc),s.assign(Od)});const i=s.sub(r),n=Sa("int").onRenderUpdate(({material:e})=>e.steps),a=i.length().div(n).toVar(),o=i.normalize().toVar(),u=yn(0).toVar(),l=Rn(1).toVar();t.offsetNode&&u.addAssign(t.offsetNode.mul(a)),Bp(n,()=>{const s=r.add(o.mul(u)),i=Dd.mul(Cn(s,1)).xyz;let n;null!==t.depthNode&&(my.assign(og(tg(i.z,Bd,Fd))),e.context.sceneDepthNode=og(t.depthNode).toVar()),e.context.positionWorld=s,e.context.shadowPositionWorld=s,e.context.positionView=i,gy.assign(0),t.scatteringNode&&(n=t.scatteringNode({positionRay:s})),super.start(e),n&&gy.mulAssign(n);const d=gy.mul(.01).negate().mul(a).exp();l.mulAssign(d),u.addAssign(a)}),fy.addAssign(l.saturate().oneMinus())}scatteringLight(e,t){const r=t.context.sceneDepthNode;r?gn(r.greaterThanEqual(my),()=>{gy.addAssign(e)}):gy.addAssign(e)}direct({lightNode:e,lightColor:t},r){if(void 0===e.light.distance)return;const s=t.xyz.toVar();s.mulAssign(e.shadowNode),this.scatteringLight(s,r)}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:s},i){const n=t.add(r).sub(s),a=t.sub(r).sub(s),o=t.sub(r).add(s),u=t.add(r).add(s),l=i.context.positionView,d=e.xyz.mul(Tm({P:l,p0:n,p1:a,p2:o,p3:u})).pow(1.5);this.scatteringLight(d,i)}finish(e){e.context.outgoingLight.assign(fy)}}class by extends vg{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=L,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new yy}}class xy{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){null!==this._context&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Ty{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let r=this.weakMaps[t];return void 0===r&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],s=new Set,i={};for(const n of e){let e;if(n.node&&n.node.attribute?e=n.node.attribute:(e=t.getAttribute(n.name),i[n.name]=e.id),void 0===e)continue;r.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;s.add(a)}return this.attributes=r,this.attributesId=i,this.vertexBuffers=Array.from(s.values()),r}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:r,group:s,drawRange:i}=this,n=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let u=1;if(!0===r.isInstancedBufferGeometry?u=r.instanceCount:void 0!==e.count&&(u=Math.max(0,e.count)),0===u)return null;if(n.instanceCount=u,!0===e.isBatchedMesh)return n;let l=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(l=2);let d=i.start*l,c=(i.start+i.count)*l;null!==s&&(d=Math.max(d,s.start*l),c=Math.min(c,(s.start+s.count)*l));const h=r.attributes.position;let p=1/0;o?p=a.count:null!=h&&(p=h.count),d=Math.max(d,0),c=Math.min(c,p);const g=c-d;return g<0||g===1/0?null:(n.vertexCount=g,n.firstVertex=d,n)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const r of Object.keys(e.attributes).sort()){const s=e.attributes[r];t+=r+",",s.data&&(t+=s.data.stride+","),s.offset&&(t+=s.offset+","),s.itemSize&&(t+=s.itemSize+","),s.normalized&&(t+="n,")}for(const r of Object.keys(e.morphAttributes).sort()){const s=e.morphAttributes[r];t+="morph-"+r+",";for(let e=0,r=s.length;e1||Array.isArray(e.morphTargetInfluences))&&(s+=e.uuid+","),s+=this.context.id+",",s+=e.receiveShadow+",",Vs(s)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const r=this.geometry.getAttribute(t);if(void 0===r||e[t]!==r.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Gs(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Gs(e,1)),e=Gs(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const Ny=[];class Sy{constructor(e,t,r,s,i,n){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=s,this.bindings=i,this.info=n,this.chainMaps={}}get(e,t,r,s,i,n,a,o){const u=this.getChainMap(o);Ny[0]=e,Ny[1]=t,Ny[2]=n,Ny[3]=i;let l=u.get(Ny);return void 0===l?(l=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,s,i,n,a,o),u.set(Ny,l)):(l.camera=s,l.updateClipping(a),l.needsGeometryUpdate&&l.setGeometry(e.geometry),(l.version!==t.version||l.needsUpdate)&&(l.initialCacheKey!==l.getCacheKey()?(l.dispose(),l=this.get(e,t,r,s,i,n,a,o)):l.version=t.version)),Ny[0]=null,Ny[1]=null,Ny[2]=null,Ny[3]=null,l}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ty)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,s,i,n,a,o,u,l,d){const c=this.getChainMap(d),h=new vy(e,t,r,s,i,n,a,o,u,l);return h.onDispose=()=>{this.pipelines.delete(h),this.bindings.deleteForRender(h),this.nodes.delete(h),c.delete(h.getChainArray())},h}}class Ry{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const Ey=1,Ay=2,wy=3,Cy=4,My=16;class By extends Ry{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){const t=super.delete(e);return null!==t&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){const r=this.get(e);if(void 0===r.version)t===Ey?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Ay?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===wy?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Cy&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),r.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(r.version=65535?Ue:Ie)(t,1);return i.version=Fy(e),i.__id=Ly(e),i}class Dy extends Ry{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;const r=()=>{this.info.memory.geometries--;const s=t.index,i=e.getAttributes();null!==s&&this.attributes.delete(s);for(const e of i)this.attributes.delete(e);const n=this.wireframes.get(t);void 0!==n&&this.attributes.delete(n),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){const t=e.getAttributes();for(const e of t)e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute?this.updateAttribute(e,wy):this.updateAttribute(e,Ey);const r=this.getIndex(e);null!==r&&this.updateAttribute(r,Ay);const s=e.geometry.indirect;null!==s&&this.updateAttribute(s,Cy)}updateAttribute(e,t){const r=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:r}=e;let s=t.index;if(!0===r.wireframe){const e=this.wireframes;let r=e.get(t);void 0===r?(r=Py(t),e.set(t,r)):r.version===Fy(t)&&r.__id===Ly(t)||(this.attributes.delete(r),r=Py(t),e.set(t,r)),s=r}return s}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class Uy{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0,attributes:0,indexAttributes:0,storageAttributes:0,indirectStorageAttributes:0,readbackBuffers:0,programs:0,renderTargets:0,total:0,texturesSize:0,attributesSize:0,indexAttributesSize:0,storageAttributesSize:0,indirectStorageAttributesSize:0,readbackBuffersSize:0,programsSize:0},this.memoryMap=new Map}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=r*(t/3):e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=r*(t/2):e.isLine?this.render.lines+=r*(t-1):o("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(const e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){const t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){const r=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:r,type:t}),this.memory[t]++,this.memory.total+=r,this.memory[t+"Size"]+=r}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){const t=this._getAttributeMemorySize(e.attribute);this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){this.destroyAttribute(e)}createProgram(e){const t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oe||e.type===Ve?t=1:e.type===ke||e.type===Ge||e.type===Te?t=2:e.type!==R&&e.type!==S&&e.type!==K||(t=4);let r=4;e.format===ze||e.format===$e||e.format===We||e.format===He||e.format===qe?r=1:e.format===$||e.format===je?r=2:e.format!==Xe&&e.format!==Ke||(r=3);let s=t*r;e.type===Qe||e.type===Ye?s=2:e.type!==Ze&&e.type!==Je&&e.type!==et||(s=4);const i=e.width||1,n=e.height||1,a=e.isCubeTexture?6:e.depth||1;let o=i*n*a*s;const u=e.mipmaps;if(u&&u.length>0){let e=0;for(let t=0;t>t))*(r.height||Math.max(1,n>>t))*a*s}}o+=e}else e.generateMipmaps&&(o*=1.333);return Math.round(o)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}}class Iy{constructor(e){this.cacheKey=e,this.usedTimes=0}}class Oy extends Iy{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}}class Vy extends Iy{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let ky=0;class Gy{constructor(e,t,r,s=null,i=null){this.id=ky++,this.code=e,this.stage=t,this.name=r,this.transforms=s,this.attributes=i,this.usedTimes=0}}class zy extends Ry{constructor(e,t,r){super(),this.backend=e,this.nodes=t,this.info=r,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:r}=this,s=this.get(e);if(this._needsComputeUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.computeProgram.usedTimes--);const n=this.nodes.getForCompute(e);let a=this.programs.compute.get(n.computeShader);void 0===a&&(i&&0===i.computeProgram.usedTimes&&this._releaseProgram(i.computeProgram),a=new Gy(n.computeShader,"compute",e.name,n.transforms,n.nodeAttributes),this.programs.compute.set(n.computeShader,a),r.createProgram(a),this.info.createProgram(a));const o=this._getComputeCacheKey(e,a);let u=this.caches.get(o);void 0===u&&(i&&0===i.usedTimes&&this._releasePipeline(i),u=this._getComputePipeline(e,a,o,t)),u.usedTimes++,a.usedTimes++,s.version=e.version,s.pipeline=u}return s.pipeline}getForRender(e,t=null){const{backend:r}=this,s=this.get(e);if(this._needsRenderUpdate(e)){const i=s.pipeline;i&&(i.usedTimes--,i.vertexProgram.usedTimes--,i.fragmentProgram.usedTimes--);const n=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(n.vertexShader);void 0===o&&(i&&0===i.vertexProgram.usedTimes&&this._releaseProgram(i.vertexProgram),o=new Gy(n.vertexShader,"vertex",a),this.programs.vertex.set(n.vertexShader,o),r.createProgram(o),this.info.createProgram(o));let u=this.programs.fragment.get(n.fragmentShader);void 0===u&&(i&&0===i.fragmentProgram.usedTimes&&this._releaseProgram(i.fragmentProgram),u=new Gy(n.fragmentShader,"fragment",a),this.programs.fragment.set(n.fragmentShader,u),r.createProgram(u),this.info.createProgram(u));const l=this._getRenderCacheKey(e,o,u);let d=this.caches.get(l);void 0===d?(i&&0===i.usedTimes&&this._releasePipeline(i),d=this._getRenderPipeline(e,o,u,l,t)):e.pipeline=d,d.usedTimes++,o.usedTimes++,u.usedTimes++,s.pipeline=d}return s.pipeline}isReady(e){const t=this.get(e).pipeline;if(void 0===t)return!1;const r=this.backend.get(t);return void 0!==r.pipeline&&null!==r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,s){r=r||this._getComputeCacheKey(e,t);let i=this.caches.get(r);return void 0===i&&(i=new Vy(r,t),this.caches.set(r,i),this.backend.createComputePipeline(i,s)),i}_getRenderPipeline(e,t,r,s,i){s=s||this._getRenderCacheKey(e,t,r);let n=this.caches.get(s);return void 0===n&&(n=new Oy(s,t,r),this.caches.set(s,n),e.pipeline=n,this.backend.createRenderPipeline(e,i)),n}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,r){return t.id+","+r.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,r=e.stage;this.programs[r].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){const t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class $y extends Ry{constructor(e,t,r,s,i,n){super(),this.backend=e,this.textures=r,this.pipelines=i,this.attributes=s,this.nodes=t,this.info=n,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t){const r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}deleteForRender(e){const t=e.getBindings();for(const e of t)this.backend.deleteBindGroupData(e),this.delete(e)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const e=t.attribute,r=e.isIndirectStorageBufferAttribute?Cy:wy;this.attributes.update(e,r)}}_update(e,t){const{backend:r}=this;let s=!1,i=!0,n=0,a=0;for(const t of e.bindings){if(!1!==this.nodes.updateGroup(t)){if(t.isStorageBuffer){const e=t.attribute,i=e.isIndirectStorageBufferAttribute?Cy:wy,n=r.get(t);this.attributes.update(e,i),n.attribute!==e&&(n.attribute=e,s=!0)}if(t.isUniformBuffer){t.update()&&r.updateBinding(t)}else if(t.isSampledTexture){const o=t.update(),u=t.texture,l=this.textures.get(u);o&&(this.textures.updateTexture(u),t.generation!==l.generation&&(t.generation=l.generation,s=!0),l.bindGroups.add(e));if(void 0!==r.get(u).externalTexture||l.isDefaultTexture?i=!1:(n=10*n+u.id,a+=u.version),!0===u.isStorageTexture&&!0===u.mipmapsAutoUpdate){const e=this.get(u);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(u)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(u),e.needsMipmap=!1)}}else if(t.isSampler){if(t.update()){const e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,s=!0)}}t.isBuffer&&t.updateRanges.length>0&&t.clearUpdateRanges()}}!0===s&&this.backend.updateBindings(e,t,i?n:0,a)}}function Wy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function Hy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function qy(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&e.side===P&&!1===e.forceSinglePass}class jy{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,r),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,s,i,n,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:s,renderOrder:e.renderOrder,z:i,group:n,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=s,o.renderOrder=e.renderOrder,o.z=i,o.group=n,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,s,i,n,a){const o=this.getNextRenderItem(e,t,r,s,i,n,a);!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(qy(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Wy),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Hy),this.transparent.length>1&&this.transparent.sort(t||Hy)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,u=a.height>>t;let l=e.depthTexture||i[t];const d=!0===e.depthBuffer||!0===e.stencilBuffer;let c=!1;void 0===l&&d&&(l=new Z,l.format=e.stencilBuffer?qe:He,l.type=e.stencilBuffer?Ze:S,l.image.width=o,l.image.height=u,l.image.depth=a.depth,l.renderTarget=e,l.isArrayTexture=!0===e.multiview&&a.depth>1,i[t]=l),r.width===a.width&&a.height===r.height||(c=!0,l&&(l.needsUpdate=!0,l.image.width=o,l.image.height=u,l.image.depth=l.isArrayTexture?l.image.depth:1)),r.width=a.width,r.height=a.height,r.textures=n,r.depthTexture=l||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==s&&(c=!0,l&&(l.needsUpdate=!0),r.sampleCount=s);const h={sampleCount:s};if(!0!==e.isXRRenderTarget){for(let e=0;e{this._destroyRenderTarget(e)},e.addEventListener("dispose",r.onDispose))}updateTexture(e,t={}){const r=this.get(e);if(!0===r.initialized&&r.version===e.version)return;const s=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,i=this.backend;if(s&&!0===r.initialized&&i.destroyTexture(e),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:Ve}if(e.isHTMLTexture&&e.image){const t=this.renderer.domElement;"requestPaint"in t&&(t.hasAttribute("layoutsubtree")||t.setAttribute("layoutsubtree","true"),e.image.parentNode!==t&&t.appendChild(e.image))}const{width:n,height:a,depth:o}=this.getSize(e);if(t.width=n,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,n,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,s||!0===e.isStorageTexture||!0===e.isExternalTexture)i.createTexture(e,t),r.generation=e.version;else if(e.version>0){const s=e.image;if(void 0===s)d("Renderer: Texture marked for update but image is undefined.");else if(!1===s.complete)d("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const r=[];for(const t of e.images)r.push(t);t.images=r}else t.image=s;void 0!==r.isDefaultTexture&&!0!==r.isDefaultTexture||(i.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),!0===e.source.dataReady&&i.updateTexture(e,t);const n=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!n&&i.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else i.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;!0!==r.initialized&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&!0===p.enabled&&p.getTransfer(e.colorSpace)!==g&&d("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=eb){let r=e.images?e.images[0]:e.image;return r?(void 0!==r.image&&(r=r.image),e.isHTMLTexture?(t.width=r.offsetWidth||1,t.height=r.offsetHeight||1,t.depth=1):"undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):"undefined"!=typeof VideoFrame&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){let s;return s=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,r)))+1,s}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){const t=this.get(e),r=t.textures,s=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e=2)for(let r=0;r{if(this._currentNode=t,!t.isVarNode||!t.isIntent(e)||!0===t.isAssign(e))if("setup"===s)t.build(e);else if("analyze"===s)t.build(e,this);else if("generate"===s){const r=e.getDataFromNode(t,"any").stages,s=r&&r[e.shaderStage];if(t.isVarNode&&s&&1===s.length&&s[0]&&s[0].isStackNode)return;t.build(e,"void")}},n=[...this.nodes];for(const e of n)i(e);this._currentNode=null;const a=this.nodes.filter(e=>-1===n.indexOf(e));for(const e of a)i(e);let o;return o=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),hn(r),e.removeActiveStack(this),o}}const nb=an(ib).setParameterLength(0,1);class ab extends ci{static get type(){return"StructTypeNode"}constructor(e,t=null){var r;super("struct"),this.membersLayout=(r=e,Object.entries(r).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,r=0;for(const s of this.membersLayout){const i=s.type,n=js(i),a=Xs(i)/e;t=Math.max(t,a);const o=r%t%a;0!==o&&(r+=a-o),r+=n}return Math.ceil(r/t)*t}getMemberType(e,t){const r=this.membersLayout.find(e=>e.name===t);return r?r.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class ob extends ci{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),r=t.type,s=e.getPropertyName(t);return e.addLineFlowCode(`${s} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class ub extends ci{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(void 0===t.membersLayout){const r=this.members,s=[];for(let t=0;tnew fb(e,"uint","float"),xb={};class Tb extends no{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,r){"int"===r?t.assign(yb(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return xn;case"int":return bn;case"uvec2":return Nn;case"uvec3":return An;case"uvec4":return Bn;case"ivec2":return vn;case"ivec3":return En;case"ivec4":return Mn}}_createTrailingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t);const i=yn(s.bitAnd(zo(s))),n=bb(i).shiftRight(23).sub(127);return r(n)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{gn(e.equal(xn(0)),()=>xn(32));const s=xn(0),i=xn(0);return this._resolveElementType(e,s,t),gn(s.shiftRight(16).equal(0),()=>{i.addAssign(16),s.shiftLeftAssign(16)}),gn(s.shiftRight(24).equal(0),()=>{i.addAssign(8),s.shiftLeftAssign(8)}),gn(s.shiftRight(28).equal(0),()=>{i.addAssign(4),s.shiftLeftAssign(4)}),gn(s.shiftRight(30).equal(0),()=>{i.addAssign(2),s.shiftLeftAssign(2)}),gn(s.shiftRight(31).equal(0),()=>{i.addAssign(1)}),r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const r=this._returnDataNode(t);return cn(([e])=>{const s=xn(0);this._resolveElementType(e,s,t),s.assign(s.sub(s.shiftRight(xn(1)).bitAnd(xn(1431655765)))),s.assign(s.bitAnd(xn(858993459)).add(s.shiftRight(xn(2)).bitAnd(xn(858993459))));const i=s.add(s.shiftRight(xn(4))).bitAnd(xn(252645135)).mul(xn(16843009)).shiftRight(xn(24));return r(i)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,r,s){const i=this._returnDataNode(t);return cn(([e])=>{if(1===r)return i(s(e));{const t=i(0),n=["x","y","z","w"];for(let i=0;id(r))()}}Tb.COUNT_TRAILING_ZEROS="countTrailingZeros",Tb.COUNT_LEADING_ZEROS="countLeadingZeros",Tb.COUNT_ONE_BITS="countOneBits";const _b=un(Tb,Tb.COUNT_TRAILING_ZEROS).setParameterLength(1),vb=un(Tb,Tb.COUNT_LEADING_ZEROS).setParameterLength(1),Nb=un(Tb,Tb.COUNT_ONE_BITS).setParameterLength(1),Sb=cn(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return r.shiftRight(22).bitXor(r).toFloat().mul(1/2**32)}),Rb=(e,t)=>ou(Da(4,e.mul(Pa(1,e))),t);class Eb extends gi{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const Ab=un(Eb,"snorm").setParameterLength(1),wb=un(Eb,"unorm").setParameterLength(1),Cb=un(Eb,"float16").setParameterLength(1);class Mb extends gi{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const Bb=un(Mb,"snorm").setParameterLength(1),Fb=un(Mb,"unorm").setParameterLength(1),Lb=un(Mb,"float16").setParameterLength(1),Pb=cn(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Db=cn(([e])=>Rn(Pb(e.z.add(Pb(e.y.mul(1)))),Pb(e.z.add(Pb(e.x.mul(1)))),Pb(e.y.add(Pb(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ub=cn(([e,t,r])=>{const s=Rn(e).toVar(),i=yn(1.4).toVar(),n=yn(0).toVar(),a=Rn(s).toVar();return Bp({start:yn(0),end:yn(3),type:"float",condition:"<="},()=>{const e=Rn(Db(a.mul(2))).toVar();s.addAssign(e.add(r.mul(yn(.1).mul(t)))),a.mulAssign(1.8),i.mulAssign(1.5),s.mulAssign(1.2);const o=yn(Pb(s.z.add(Pb(s.x.add(Pb(s.y)))))).toVar();n.addAssign(o.div(i)),a.addAssign(.14)}),n}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Ib extends ci{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let r=this._candidateFn;if(null===r){let s=null,i=-1;for(const r of this.functionNodes){const n=r.shaderNode.layout;if(null===n)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=n.inputs;if(t.length===a.length){let n=0;for(let r=0;ri&&(s=r,i=n)}}this._candidateFn=r=s}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const Ob=an(Ib),Vb=e=>(...t)=>Ob(e,...t),kb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.time),Gb=Sa(0).setGroup(_a).onRenderUpdate(e=>e.deltaTime),zb=Sa(0,"uint").setGroup(_a).onRenderUpdate(e=>e.frameId);const $b=cn(([e,t,r=_n(.5)])=>iy(e.sub(r),t).add(r)),Wb=cn(([e,t,r=_n(.5)])=>{const s=e.sub(r),i=s.dot(s),n=i.mul(i).mul(t);return e.add(s.mul(n))}),Hb=cn(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let s;null!==e?(s=Qd.toVar(),s[3][0]=e.x,s[3][1]=e.y,s[3][2]=e.z):s=Qd;const i=Dd.mul(s);return Zi(t)&&(i[0][0]=Qd[0].length(),i[0][1]=0,i[0][2]=0),Zi(r)&&(i[1][0]=0,i[1][1]=Qd[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,Ld.mul(i).mul(lc)}),qb=cn(([e=null])=>{const t=og();return og(Yp(e)).sub(t).lessThan(0).select(ud,e)}),jb=cn(([e,t=kl(),r=yn(0)])=>{const s=e.x,i=e.y,n=r.mod(s.mul(i)).floor(),a=n.mod(s),o=i.sub(n.add(1).div(s).ceil()),u=e.reciprocal(),l=_n(a,o);return t.add(l).mul(u)}),Xb=cn(([e,t=null,r=null,s=yn(1),i=lc,n=Tc])=>{let a=n.abs().normalize();a=a.div(a.dot(Rn(1)));const o=i.yz.mul(s),u=i.zx.mul(s),l=i.xy.mul(s),d=e.value,c=null!==t?t.value:d,h=null!==r?r.value:d,p=Kl(d,o).mul(a.x),g=Kl(c,u).mul(a.y),m=Kl(h,l).mul(a.z);return La(p,g,m)}),Kb=new ut,Qb=new r,Yb=new r,Zb=new r,Jb=new a,ex=new r(0,0,-1),tx=new s,rx=new r,sx=new r,ix=new s,nx=new t,ax=new ne,ox=ud.flipX();ax.depthTexture=new Z(1,1);let ux=!1;class lx extends jl{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||ax.texture,ox),this._reflectorBaseNode=e.reflector||new dx(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new lx({defaultTexture:ax.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class dx extends ci{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:r=new at,resolutionScale:s=1,generateMipmaps:i=!1,bounces:n=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=s,void 0!==t.resolution&&(v('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=n,this.depth=a,this.samples=o,this.updateBeforeType=n?ri.RENDER:ri.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const r=this.resolutionScale;t.getDrawingBufferSize(nx),e.setSize(Math.round(nx.width*r),Math.round(nx.height*r))}setup(e){return this._updateResolution(ax,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new ne(0,0,{type:Te,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=ot,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new Z),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&ux)return!1;ux=!0;const{scene:t,camera:r,renderer:s,material:i}=e,{target:n}=this,a=this.getVirtualCamera(r),o=this.getRenderTarget(a);s.getDrawingBufferSize(nx),this._updateResolution(o,s),Yb.setFromMatrixPosition(n.matrixWorld),Zb.setFromMatrixPosition(r.matrixWorld),Jb.extractRotation(n.matrixWorld),Qb.set(0,0,1),Qb.applyMatrix4(Jb),rx.subVectors(Yb,Zb);let u=!1;if(!0===rx.dot(Qb)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(ux=!1);u=!0}rx.reflect(Qb).negate(),rx.add(Yb),Jb.extractRotation(r.matrixWorld),ex.set(0,0,-1),ex.applyMatrix4(Jb),ex.add(Zb),sx.subVectors(Yb,ex),sx.reflect(Qb).negate(),sx.add(Yb),a.coordinateSystem=r.coordinateSystem,a.position.copy(rx),a.up.set(0,1,0),a.up.applyMatrix4(Jb),a.up.reflect(Qb),a.lookAt(sx),a.near=r.near,a.far=r.far,a.updateMatrixWorld(),a.projectionMatrix.copy(r.projectionMatrix),Kb.setFromNormalAndCoplanarPoint(Qb,Yb),Kb.applyMatrix4(a.matrixWorldInverse),tx.set(Kb.normal.x,Kb.normal.y,Kb.normal.z,Kb.constant);const l=a.projectionMatrix;ix.x=(Math.sign(tx.x)+l.elements[8])/l.elements[0],ix.y=(Math.sign(tx.y)+l.elements[9])/l.elements[5],ix.z=-1,ix.w=(1+l.elements[10])/l.elements[14],tx.multiplyScalar(1/tx.dot(ix));l.elements[2]=tx.x,l.elements[6]=tx.y,l.elements[10]=s.coordinateSystem===h?tx.z-0:tx.z+1-0,l.elements[14]=tx.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),i.visible=!1;const d=s.getRenderTarget(),c=s.getMRT(),p=s.autoClear;s.setMRT(null),s.setRenderTarget(o),s.autoClear=!0;const g=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(s.clear(),this.hasOutput=!1):(s.render(t,a),this.hasOutput=!0),t.name=g,s.setMRT(c),s.setRenderTarget(d),s.autoClear=p,i.visible=!0,ux=!1,this.forceUpdate=!1}get resolution(){return v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){v('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const cx=new Ne(-1,1,1,-1,0,1);class hx extends ve{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new lt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lt(t,2))}}const px=new hx;class gx extends oe{constructor(e=null){super(px,e),this.camera=cx,this.isQuadMesh=!0}async renderAsync(e){v('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,cx)}render(e){e.render(this,cx)}}const mx=new t;class fx extends jl{static get type(){return"RTTNode"}constructor(e,t=null,r=null,s={type:Te}){const i=new ne(t,r,s);super(i.texture,kl()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new gx(new vg),this.updateBeforeType=ri.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const r=e*this.pixelRatio,s=t*this.pixelRatio;this.renderTarget.setSize(r,s),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),r=e.getSize(mx),s=Math.floor(r.width*t),i=Math.floor(r.height*t);s===this.renderTarget.width&&i===this.renderTarget.height||(this.renderTarget.setSize(s,i),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(r)}clone(){const e=new jl(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yx=(e,...t)=>new fx(tn(e),...t),bx=cn(([e,t,r],s)=>{let i;s.renderer.coordinateSystem===h?(e=_n(e.x,e.y.oneMinus()).mul(2).sub(1),i=Cn(Rn(e,t),1)):i=Cn(Rn(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const n=Cn(r.mul(i));return n.xyz.div(n.w)}),xx=cn(([e,t])=>{const r=t.mul(Cn(e,1)),s=r.xy.div(r.w).mul(.5).add(.5).toVar();return _n(s.x,s.y.oneMinus())}),Tx=cn(([e,t,r])=>{const s=zl(Ql(t)),i=vn(e.mul(s)).toVar(),n=Ql(t,i).toVar(),a=Ql(t,i.sub(vn(2,0))).toVar(),o=Ql(t,i.sub(vn(1,0))).toVar(),u=Ql(t,i.add(vn(1,0))).toVar(),l=Ql(t,i.add(vn(2,0))).toVar(),d=Ql(t,i.add(vn(0,2))).toVar(),c=Ql(t,i.add(vn(0,1))).toVar(),h=Ql(t,i.sub(vn(0,1))).toVar(),p=Ql(t,i.sub(vn(0,2))).toVar(),g=Vo(Pa(yn(2).mul(o).sub(a),n)).toVar(),m=Vo(Pa(yn(2).mul(u).sub(l),n)).toVar(),f=Vo(Pa(yn(2).mul(c).sub(d),n)).toVar(),y=Vo(Pa(yn(2).mul(h).sub(p),n)).toVar(),b=bx(e,n,r).toVar(),x=g.lessThan(m).select(b.sub(bx(e.sub(_n(yn(1).div(s.x),0)),o,r)),b.negate().add(bx(e.add(_n(yn(1).div(s.x),0)),u,r))),T=f.lessThan(y).select(b.sub(bx(e.add(_n(0,yn(1).div(s.y))),c,r)),b.negate().add(bx(e.sub(_n(0,yn(1).div(s.y))),h,r)));return Ro(au(x,T))}),_x=cn(([e])=>Eo(yn(52.9829189).mul(Eo(nu(e,_n(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),vx=cn(([e,t,r])=>{const s=yn(2.399963229728653),i=_o(yn(e).add(.5).div(yn(t))),n=yn(e).mul(s).add(r);return _n(Co(n),Ao(n)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class Nx extends ci{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(kl())}sample(e){return this.callback(e)}}class Sx extends ci{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Sx.OBJECT?this.updateType=ri.OBJECT:e===Sx.MATERIAL?this.updateType=ri.RENDER:e===Sx.BEFORE_OBJECT?this.updateBeforeType=ri.OBJECT:e===Sx.BEFORE_MATERIAL&&(this.updateBeforeType=ri.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Sx.OBJECT="object",Sx.MATERIAL="material",Sx.BEFORE_OBJECT="beforeObject",Sx.BEFORE_MATERIAL="beforeMaterial";const Rx=(e,t)=>new Sx(e,t).toStack();class Ex extends q{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class Ax extends we{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageBufferAttribute=!0}}class wx extends ci{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Cx=on(wx),Mx=new a,Bx=Sa(0).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Fx=Sa(1).setGroup(_a).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Lx=Sa(new a).setGroup(_a).onRenderUpdate(({scene:e})=>{const t=e.background;return null!==t&&t.isTexture&&t.mapping!==dt?Mx.makeRotationFromEuler(e.backgroundRotation).transpose():Mx.identity(),Mx});class Px extends jl{static get type(){return"StorageTextureNode"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=ii.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return null!==this.storeNode?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,r,s,i,n,a,o,u){const l=this.value;return e.generateStorageTextureLoad(l,t,r,s,n,u)}toReadWrite(){return this.setAccess(ii.READ_WRITE)}toReadOnly(){return this.setAccess(ii.READ_ONLY)}toWriteOnly(){return this.setAccess(ii.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:r,storeNode:s,depthNode:i}=t,n=super.generate(e,"property"),a=r.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=s.build(e,"vec4"),u=i?i.build(e,"int"):null,l=e.generateTextureStore(this.value,n,a,u,o);e.addLineFlowCode(l,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const Dx=an(Px).setParameterLength(1,3),Ux=cn(({texture:e,uv:t})=>{const r=1e-4,s=Rn().toVar();return gn(t.x.lessThan(r),()=>{s.assign(Rn(1,0,0))}).ElseIf(t.y.lessThan(r),()=>{s.assign(Rn(0,1,0))}).ElseIf(t.z.lessThan(r),()=>{s.assign(Rn(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{s.assign(Rn(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{s.assign(Rn(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{s.assign(Rn(0,0,-1))}).Else(()=>{const r=.01,i=e.sample(t.add(Rn(-.01,0,0))).r.sub(e.sample(t.add(Rn(r,0,0))).r),n=e.sample(t.add(Rn(0,-.01,0))).r.sub(e.sample(t.add(Rn(0,r,0))).r),a=e.sample(t.add(Rn(0,0,-.01))).r.sub(e.sample(t.add(Rn(0,0,r))).r);s.assign(Rn(i,n,a))}),s.normalize()});class Ix extends jl{static get type(){return"Texture3DNode"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Rn(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Ux({texture:this,uv:e})}}const Ox=an(Ix).setParameterLength(1,3);class Vx extends Hc{static get type(){return"UserDataNode"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const kx=new WeakMap;class Gx extends gi{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=ri.OBJECT,this.updateAfterType=ri.OBJECT,this.previousModelWorldMatrix=Sa(new a),this.previousProjectionMatrix=Sa(new a).setGroup(_a),this.previousCameraViewMatrix=Sa(new a)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){const s=$x(r);this.previousModelWorldMatrix.value.copy(s);const i=zx(t);i.frameId!==e&&(i.frameId=e,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new a,i.previousCameraViewMatrix=new a,i.currentProjectionMatrix=new a,i.currentCameraViewMatrix=new a,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){$x(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?Ld:Sa(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(sc).mul(lc),s=this.previousProjectionMatrix.mul(t).mul(dc),i=r.xy.div(r.w),n=s.xy.div(s.w);return Pa(i,n)}}function zx(e){let t=kx.get(e);return void 0===t&&(t={},kx.set(e,t)),t}function $x(e,t=0){const r=zx(e);let s=r[t];return void 0===s&&(r[t]=s=new a,r[t].copy(e.matrixWorld)),s}const Wx=on(Gx),Hx=cn(([e])=>Kx(e.rgb)),qx=cn(([e,t=yn(1)])=>t.mix(Kx(e.rgb),e.rgb)),jx=cn(([e,t=yn(1)])=>{const r=La(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return gu(e.rgb,s,i)}),Xx=cn(([e,t=yn(1)])=>{const r=Rn(.57735,.57735,.57735),s=t.cos();return Rn(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(nu(r,e.rgb).mul(s.oneMinus())))))}),Kx=(e,t=Rn(p.getLuminanceCoefficients(new r)))=>nu(e,t),Qx=cn(([e,t=Rn(1),s=Rn(0),i=Rn(1),n=yn(1),a=Rn(p.getLuminanceCoefficients(new r,Re))])=>{const o=e.rgb.dot(Rn(a)),u=eu(e.rgb.mul(t).add(s),0).toVar(),l=u.pow(i).toVar();return gn(u.r.greaterThan(0),()=>{u.r.assign(l.r)}),gn(u.g.greaterThan(0),()=>{u.g.assign(l.g)}),gn(u.b.greaterThan(0),()=>{u.b.assign(l.b)}),u.assign(o.add(u.sub(o).mul(n))),Cn(u.rgb,e.a)}),Yx=cn(([e,t])=>e.mul(t).floor().div(t));let Zx=null;class Jx extends Wp{static get type(){return"ViewportSharedTextureNode"}constructor(e=ud,t=null){null===Zx&&(Zx=new Q),super(e,t,Zx)}getTextureForReference(){return Zx}updateReference(){return this}}const eT=an(Jx).setParameterLength(0,2),tT=new t;class rT extends jl{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){return e.getNodeProperties(this).passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class sT extends rT{static get type(){return"PassMultipleTextureNode"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class iT extends gi{static get type(){return"PassNode"}constructor(e,t,r,s={}){super("vec4"),this.scope=e,this.scene=t,this.camera=r,this.options=s,this._pixelRatio=1,this._width=1,this._height=1;const i=new Z;i.isRenderTargetTexture=!0,i.name="depth";const n=new ne(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Te,...s});n.texture.name="output",n.depthTexture=i,this.renderTarget=n,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:n.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Sa(0),this._cameraFar=Sa(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=ri.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return d("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return d("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const r=this._textures[e],s=this.renderTarget.textures.indexOf(r);this.renderTarget.textures[s]=t,this._textures[e]=t,this._previousTextures[e]=r,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(t=new sT(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=new sT(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar;this._viewZNodes[e]=t=sg(this.getTextureNode(e),r,s)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const r=this._cameraNear,s=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=Jp(i,r,s)}return t}async compileAsync(e){const t=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(r)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),!0===e.reversedDepthBuffer&&(this.renderTarget.depthTexture.type=K),this.scope===iT.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:r}=this;let s,i;const n=t.getOutputRenderTarget();n&&!0===n.isXRRenderTarget?(i=1,s=t.xr.getCamera(),t.xr.updateCamera(s),tT.set(n.width,n.height)):(s=this.camera,i=t.getPixelRatio(),t.getSize(tT)),this._pixelRatio=i,this.setSize(tT.width,tT.height);const a=t.getRenderTarget(),o=t.getMRT(),u=t.autoClear,l=t.transparent,d=t.opaque,c=s.layers.mask,h=t.contextNode,p=r.overrideMaterial;this._cameraNear.value=s.near,this._cameraFar.value=s.far,null!==this._layers&&(s.layers.mask=this._layers.mask);for(const e in this._previousTextures)this.toggleTexture(e);null!==this.overrideMaterial&&(r.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,null!==this.contextNode&&(null!==this._contextNodeCache&&this._contextNodeCache.version===this.version||(this._contextNodeCache={version:this.version,context:Cu({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const g=r.name;r.name=this.name?this.name:r.name,t.render(r,s),r.name=g,r.overrideMaterial=p,t.setRenderTarget(a),t.setMRT(o),t.autoClear=u,t.transparent=l,t.opaque=d,t.contextNode=h,s.layers.mask=c}setSize(e,t){this._width=e,this._height=t;const r=Math.floor(this._width*this._pixelRatio*this._resolutionScale),s=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(r,s),null!==this._scissor?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._pixelRatio*this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._pixelRatio*this._resolutionScale).floor()}setScissor(e,t,r,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new s),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,r,i))}setViewport(e,t,r,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new s),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,r,i))}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}iT.COLOR="color",iT.DEPTH="depth";class nT extends iT{static get type(){return"ToonOutlinePassNode"}constructor(e,t,r,s,i){super(iT.COLOR,e,t),this.colorNode=r,this.thicknessNode=s,this.alphaNode=i,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((e,r,s,i,n,a,o,u)=>{if((n.isMeshToonMaterial||n.isMeshToonNodeMaterial)&&!1===n.wireframe){const l=this._getOutlineMaterial(n);t.renderObject(e,r,s,i,l,a,o,u)}t.renderObject(e,r,s,i,n,a,o,u)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){const e=new vg;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=L;const t=Tc.negate(),r=Ld.mul(sc),s=yn(1),i=r.mul(Cn(lc,1)),n=r.mul(Cn(lc.add(t),1)),a=Ro(i.sub(n));return e.vertexNode=i.add(a.mul(this.thicknessNode).mul(i.w).mul(s)),e.colorNode=Cn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const aT=cn(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),oT=cn(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),uT=cn(([e,t])=>{const r=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),s=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),lT=cn(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),dT=cn(([e,t])=>{const r=Pn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=Pn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=r.mul(e),e=lT(e),(e=s.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cT=Pn(Rn(1.6605,-.1246,-.0182),Rn(-.5876,1.1329,-.1006),Rn(-.0728,-.0083,1.1187)),hT=Pn(Rn(.6274,.0691,.0164),Rn(.3293,.9195,.088),Rn(.0433,.0113,.8956)),pT=cn(([e])=>{const t=Rn(e).toVar(),r=Rn(t.mul(t)).toVar(),s=Rn(r.mul(r)).toVar();return yn(15.5).mul(s.mul(r)).sub(Da(40.14,s.mul(t))).add(Da(31.96,s).sub(Da(6.868,r.mul(t))).add(Da(.4298,r).add(Da(.1191,t).sub(.00232))))}),gT=cn(([e,t])=>{const r=Rn(e).toVar(),s=Pn(Rn(.856627153315983,.137318972929847,.11189821299995),Rn(.0951212405381588,.761241990602591,.0767994186031903),Rn(.0482516061458583,.101439036467562,.811302368396859)),i=Pn(Rn(1.1271005818144368,-.1413297634984383,-.14132976349843826),Rn(-.11060664309660323,1.157823702216272,-.11060664309660294),Rn(-.016493938717834573,-.016493938717834257,1.2519364065950405)),n=yn(-12.47393),a=yn(4.026069);return r.mulAssign(t),r.assign(hT.mul(r)),r.assign(s.mul(r)),r.assign(eu(r,1e-10)),r.assign(To(r)),r.assign(r.sub(n).div(a.sub(n))),r.assign(mu(r,0,1)),r.assign(pT(r)),r.assign(i.mul(r)),r.assign(ou(eu(Rn(0),r),Rn(2.2))),r.assign(cT.mul(r)),r.assign(mu(r,0,1)),r}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),mT=cn(([e,t])=>{const r=yn(.76),s=yn(.15);e=e.mul(t);const i=Jo(e.r,Jo(e.g,e.b)),n=Au(i.lessThan(.08),i.sub(Da(6.25,i.mul(i))),.04);e.subAssign(n);const a=eu(e.r,eu(e.g,e.b));gn(a.lessThan(r),()=>e);const o=Pa(1,r),u=Pa(1,o.mul(o).div(a.add(o.sub(r))));e.mulAssign(u.div(a));const l=Pa(1,Ua(1,s.mul(a.sub(u)).add(1)));return gu(e,Rn(u),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class fT extends ci{static get type(){return"CodeNode"}constructor(e="",t=[],r=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const yT=an(fT).setParameterLength(1,3);class bT extends fT{static get type(){return"FunctionNode"}constructor(e="",t=[],r=""){super(e,t,r)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let r=t.nodeFunction;return void 0===r&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}generate(e,t){super.generate(e);const r=this.getNodeFunction(e),s=r.name,i=r.type,n=e.getCodeFromNode(this,i);""!==s&&(n.name=s);const a=e.getPropertyName(n),o=this.getNodeFunction(e).getCode(a);return n.code=o+"\n","property"===t?a:e.format(`${a}()`,i,t)}}const xT=(e,t=[],r="")=>{for(let e=0;es.call(...e);return i.functionNode=s,i};function TT(e){let t;const r=e.context.getViewZ;return void 0!==r&&(t=r(this)),(t||pc.z).negate()}const _T=cn(([e,t],r)=>{const s=TT(r);return bu(e,t,s)}),vT=cn(([e],t)=>{const r=TT(t);return e.mul(e,r,r).negate().exp().oneMinus()}),NT=cn(([e,t],r)=>{const s=TT(r),i=t.sub(cc.y).max(0).toConst().mul(s).toConst();return e.mul(e,i,i).negate().exp().oneMinus()}),ST=cn(([e,t])=>Cn(t.toFloat().mix(oa.rgb,e.toVec3()),oa.a));let RT=null,ET=null;class AT extends ci{static get type(){return"RangeNode"}constructor(e=yn(),t=yn()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),s=e.getTypeLength(Ks(t.value)),i=e.getTypeLength(Ks(r.value));return s>i?s:i}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new Hl('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let r=null;if(t.count>1){const i=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),a=i.value,o=n.value,u=e.getTypeLength(Ks(a)),d=e.getTypeLength(Ks(o));RT=RT||new s,ET=ET||new s,RT.setScalar(0),ET.setScalar(0),1===u?RT.setScalar(a):a.isColor?RT.set(a.r,a.g,a.b,1):RT.set(a.x,a.y,a.z||0,a.w||0),1===d?ET.setScalar(o):o.isColor?ET.set(o.r,o.g,o.b,1):ET.set(o.x,o.y,o.z||0,o.w||0);const c=4,h=c*t.count,p=new Float32Array(h);for(let e=0;enew CT(e,t),BT=MT("numWorkgroups","uvec3"),FT=MT("workgroupId","uvec3"),LT=MT("globalId","uvec3"),PT=MT("localId","uvec3"),DT=MT("subgroupSize","uint");class UT extends ci{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){const{scope:t}=this,{renderer:r}=e;!0===r.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}}const IT=an(UT);class OT extends hi{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r;const s=e.context.assign;if(r=super.generate(e),!0!==s){const s=this.getNodeType(e);r=e.format(r,s,t)}return r}}class VT extends ci{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return d('TSL: "label()" has been deprecated. Use "setName()" instead.',new Is),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new OT(this,e)}generate(e){const t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class kT extends ci{static get type(){return"AtomicFunctionNode"}constructor(e,t,r){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),r=t.parents,s=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.pointerNode,o=this.valueNode,u=[];u.push(`&${a.build(e,n)}`),null!==o&&u.push(o.build(e,n));const l=`${e.getMethod(s,i)}( ${u.join(", ")} )`;if(!(!!r&&(1===r.length&&!0===r[0].isStackNode)))return void 0===t.constNode&&(t.constNode=Cl(l,i).toConst()),t.constNode.build(e);e.addLineFlowCode(l,this)}}kT.ATOMIC_LOAD="atomicLoad",kT.ATOMIC_STORE="atomicStore",kT.ATOMIC_ADD="atomicAdd",kT.ATOMIC_SUB="atomicSub",kT.ATOMIC_MAX="atomicMax",kT.ATOMIC_MIN="atomicMin",kT.ATOMIC_AND="atomicAnd",kT.ATOMIC_OR="atomicOr",kT.ATOMIC_XOR="atomicXor";const GT=an(kT),zT=(e,t,r)=>GT(e,t,r).toStack();class $T extends gi{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=r}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,r=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(r)?0:e.getTypeLength(r))?t:r}generateNodeType(e){const t=this.method;return t===$T.SUBGROUP_ELECT?"bool":t===$T.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const r=this.method,s=this.getNodeType(e),i=this.getInputType(e),n=this.aNode,a=this.bNode,o=[];if(r===$T.SUBGROUP_BROADCAST||r===$T.SUBGROUP_SHUFFLE||r===$T.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(n.build(e,s),a.build(e,"float"===t?"int":s))}else r===$T.SUBGROUP_SHUFFLE_XOR||r===$T.SUBGROUP_SHUFFLE_DOWN||r===$T.SUBGROUP_SHUFFLE_UP?o.push(n.build(e,s),a.build(e,"uint")):(null!==n&&o.push(n.build(e,i)),null!==a&&o.push(a.build(e,i)));const u=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(r,s)}${u}`,s,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}$T.SUBGROUP_ELECT="subgroupElect",$T.SUBGROUP_BALLOT="subgroupBallot",$T.SUBGROUP_ADD="subgroupAdd",$T.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",$T.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",$T.SUBGROUP_MUL="subgroupMul",$T.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",$T.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",$T.SUBGROUP_AND="subgroupAnd",$T.SUBGROUP_OR="subgroupOr",$T.SUBGROUP_XOR="subgroupXor",$T.SUBGROUP_MIN="subgroupMin",$T.SUBGROUP_MAX="subgroupMax",$T.SUBGROUP_ALL="subgroupAll",$T.SUBGROUP_ANY="subgroupAny",$T.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",$T.QUAD_SWAP_X="quadSwapX",$T.QUAD_SWAP_Y="quadSwapY",$T.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",$T.SUBGROUP_BROADCAST="subgroupBroadcast",$T.SUBGROUP_SHUFFLE="subgroupShuffle",$T.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",$T.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",$T.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",$T.QUAD_BROADCAST="quadBroadcast";const WT=un($T,$T.SUBGROUP_ELECT).setParameterLength(0),HT=un($T,$T.SUBGROUP_BALLOT).setParameterLength(1),qT=un($T,$T.SUBGROUP_ADD).setParameterLength(1),jT=un($T,$T.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),XT=un($T,$T.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),KT=un($T,$T.SUBGROUP_MUL).setParameterLength(1),QT=un($T,$T.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),YT=un($T,$T.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ZT=un($T,$T.SUBGROUP_AND).setParameterLength(1),JT=un($T,$T.SUBGROUP_OR).setParameterLength(1),e_=un($T,$T.SUBGROUP_XOR).setParameterLength(1),t_=un($T,$T.SUBGROUP_MIN).setParameterLength(1),r_=un($T,$T.SUBGROUP_MAX).setParameterLength(1),s_=un($T,$T.SUBGROUP_ALL).setParameterLength(0),i_=un($T,$T.SUBGROUP_ANY).setParameterLength(0),n_=un($T,$T.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),a_=un($T,$T.QUAD_SWAP_X).setParameterLength(1),o_=un($T,$T.QUAD_SWAP_Y).setParameterLength(1),u_=un($T,$T.QUAD_SWAP_DIAGONAL).setParameterLength(1),l_=un($T,$T.SUBGROUP_BROADCAST).setParameterLength(2),d_=un($T,$T.SUBGROUP_SHUFFLE).setParameterLength(2),c_=un($T,$T.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),h_=un($T,$T.SUBGROUP_SHUFFLE_UP).setParameterLength(2),p_=un($T,$T.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),g_=un($T,$T.QUAD_BROADCAST).setParameterLength(1);let m_;function f_(e){m_=m_||new WeakMap;let t=m_.get(e);return void 0===t&&m_.set(e,t={}),t}function y_(e){const t=f_(e);return t.shadowMatrix||(t.shadowMatrix=Sa("mat4").setGroup(_a).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function b_(e,t=cc){const r=y_(e).mul(t);return r.xyz.div(r.w)}function x_(e){const t=f_(e);return t.position||(t.position=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.matrixWorld)))}function T_(e){const t=f_(e);return t.targetPosition||(t.targetPosition=Sa(new r).setGroup(_a).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.target.matrixWorld)))}function __(e){const t=f_(e);return t.viewPosition||(t.viewPosition=Sa(new r).setGroup(_a).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new r,s.value.setFromMatrixPosition(e.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const v_=e=>Dd.transformDirection(x_(e).sub(T_(e))),N_=(e,t)=>{for(const r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},S_=new WeakMap,R_=[];class E_ extends ci{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Vn("vec3","totalDiffuse"),this.totalSpecularNode=Vn("vec3","totalSpecular"),this.outgoingLightNode=Vn("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let t=0;te.sort((e,t)=>e.id-t.id))(this._lights),i=e.renderer.library;for(const e of s)if(e.isNode)t.push(tn(e));else{let s=null;if(null!==r&&(s=N_(e.id,r)),null===s){const t=i.getLightNodeClass(e.constructor);if(null===t){d(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}!1===S_.has(e)&&S_.set(e,new t(e)),s=S_.get(e)}t.push(s)}this._lightNodes=t}setupDirectLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.direct({...r,lightNode:t,reflectedLight:i},e)}setupDirectRectAreaLight(e,t,r){const{lightingModel:s,reflectedLight:i}=e.context;s.directRectArea({...r,lightNode:t,reflectedLight:i},e)}setupLights(e,t){for(const r of t)r.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode;const s=e.context,i=s.lightingModel,n=e.getNodeProperties(this);if(i){const{totalDiffuseNode:t,totalSpecularNode:a}=this;s.outgoingLight=r;const o=e.addStack();n.nodes=o.nodes,i.start(e);const{backdrop:u,backdropAlpha:l}=s,{directDiffuse:d,directSpecular:c,indirectDiffuse:h,indirectSpecular:p}=s.reflectedLight;let g=d.add(h);null!==u&&(g=Rn(null!==l?l.mix(g,u):u)),t.assign(g),a.assign(c.add(p)),r.assign(t.add(a)),i.finish(e),r=r.bypass(e.removeStack())}else n.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class A_ extends ci{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=ri.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){w_.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||cc)}}const w_=Vn("vec3","shadowPositionWorld");function C_(t,r={}){return r.toneMapping=t.toneMapping,r.toneMappingExposure=t.toneMappingExposure,r.outputColorSpace=t.outputColorSpace,r.renderTarget=t.getRenderTarget(),r.activeCubeFace=t.getActiveCubeFace(),r.activeMipmapLevel=t.getActiveMipmapLevel(),r.renderObjectFunction=t.getRenderObjectFunction(),r.pixelRatio=t.getPixelRatio(),r.mrt=t.getMRT(),r.clearColor=t.getClearColor(r.clearColor||new e),r.clearAlpha=t.getClearAlpha(),r.autoClear=t.autoClear,r.scissorTest=t.getScissorTest(),r}function M_(e,t){return t=C_(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function B_(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function F_(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function L_(e,t){return t=F_(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function P_(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function D_(e,t,r){return r=L_(t,r=M_(e,r))}function U_(e,t,r){B_(e,r),P_(t,r)}var I_=Object.freeze({__proto__:null,resetRendererAndSceneState:D_,resetRendererState:M_,resetSceneState:L_,restoreRendererAndSceneState:U_,restoreRendererState:B_,restoreSceneState:P_,saveRendererAndSceneState:function(e,t,r={}){return r=F_(t,r=C_(e,r))},saveRendererState:C_,saveSceneState:F_});const O_=new WeakMap,V_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let s=Kl(e,t.xy).setName("t_basic");return e.isArrayTexture&&(s=s.depth(r)),s.compare(t.z)}),k_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=qc("radius","float",r).setGroup(_a),o=_n(1).div(n),u=a.mul(o.x),l=_x(dd.xy).mul(6.28318530718);return La(i(t.xy.add(vx(0,5,l).mul(u)),t.z),i(t.xy.add(vx(1,5,l).mul(u)),t.z),i(t.xy.add(vx(2,5,l).mul(u)),t.z),i(t.xy.add(vx(3,5,l).mul(u)),t.z),i(t.xy.add(vx(4,5,l).mul(u)),t.z)).mul(.2)}),G_=cn(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:s})=>{const i=(t,r)=>{let i=Kl(e,t);return e.isArrayTexture&&(i=i.depth(s)),i.compare(r)},n=qc("mapSize","vec2",r).setGroup(_a),a=_n(1).div(n),o=a.x,u=a.y,l=t.xy,d=Eo(l.mul(n).add(.5));return l.subAssign(d.mul(a)),La(i(l,t.z),i(l.add(_n(o,0)),t.z),i(l.add(_n(0,u)),t.z),i(l.add(a),t.z),gu(i(l.add(_n(o.negate(),0)),t.z),i(l.add(_n(o.mul(2),0)),t.z),d.x),gu(i(l.add(_n(o.negate(),u)),t.z),i(l.add(_n(o.mul(2),u)),t.z),d.x),gu(i(l.add(_n(0,u.negate())),t.z),i(l.add(_n(0,u.mul(2))),t.z),d.y),gu(i(l.add(_n(o,u.negate())),t.z),i(l.add(_n(o,u.mul(2))),t.z),d.y),gu(gu(i(l.add(_n(o.negate(),u.negate())),t.z),i(l.add(_n(o.mul(2),u.negate())),t.z),d.x),gu(i(l.add(_n(o.negate(),u.mul(2))),t.z),i(l.add(_n(o.mul(2),u.mul(2))),t.z),d.x),d.y)).mul(1/9)}),z_=cn(({depthTexture:e,shadowCoord:t,depthLayer:r},s)=>{let i=Kl(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(r)),i=i.rg;const n=i.x,a=eu(1e-7,i.y.mul(i.y)),o=s.renderer.reversedDepthBuffer?tu(n,t.z):tu(t.z,n),u=yn(1).toVar();return gn(o.notEqual(1),()=>{const e=t.z.sub(n);let r=a.div(a.add(e.mul(e)));r=mu(Pa(r,.3).div(.65)),u.assign(eu(o,r))}),u}),$_=e=>{let t=O_.get(e);return void 0===t&&(t=new vg,t.colorNode=Cn(0,0,0,1),t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.blending=re,t.fog=!1,O_.set(e,t)),t},W_=e=>{const t=O_.get(e);void 0!==t&&(t.dispose(),O_.delete(e))},H_=new Ty,q_=[],j_=(e,t,r,s)=>{q_[0]=e,q_[1]=t;let i=H_.get(q_);return void 0!==i&&i.shadowType===r&&i.useVelocity===s||(i=(i,n,a,o,u,l,...d)=>{(!0===i.castShadow||i.receiveShadow&&r===pt)&&(s&&(Ys(i).useVelocity=!0),i.onBeforeShadow(e,i,a,t.camera,o,n.overrideMaterial,l),e.renderObject(i,n,a,o,u,l,...d),i.onAfterShadow(e,i,a,t.camera,o,n.overrideMaterial,l))},i.shadowType=r,i.useVelocity=s,H_.set(q_,i)),q_[0]=null,q_[1]=null,i},X_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanVertical"),a=yn(0).toVar("squareMeanVertical"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(0,l).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),d=d.x,n.addAssign(d),a.addAssign(d.mul(d))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),K_=cn(({samples:e,radius:t,size:r,shadowPass:s,depthLayer:i})=>{const n=yn(0).toVar("meanHorizontal"),a=yn(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(yn(1)).select(yn(0),yn(2).div(e.sub(1))),u=e.lessThanEqual(yn(1)).select(yn(0),yn(-1));Bp({start:bn(0),end:bn(e),type:"int",condition:"<"},({i:e})=>{const l=u.add(yn(e).mul(o));let d=s.sample(La(dd.xy,_n(l,0).mul(t)).div(r));s.value.isArrayTexture&&(d=d.depth(i)),n.addAssign(d.x),a.addAssign(La(d.y.mul(d.y),d.x.mul(d.x)))}),n.divAssign(e),a.divAssign(e);const l=_o(a.sub(n.mul(n)).max(0));return _n(n,l)}),Q_=[V_,k_,G_,z_];let Y_;const Z_=new gx;class J_ extends A_{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n}){const a=s.x.greaterThanEqual(0).and(s.x.lessThanEqual(1)).and(s.y.greaterThanEqual(0)).and(s.y.lessThanEqual(1)).and(s.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:s,shadow:i,depthLayer:n});return a.select(o,yn(1))}setupShadowCoord(e,t){const{shadow:r}=this,{renderer:s}=e,i=r.biasNode||qc("bias","float",r).setGroup(_a);let n,a=t;if(r.camera.isOrthographicCamera||!0!==s.logarithmicDepthBuffer)a=a.xyz.div(a.w),n=a.z;else{const e=a.w;a=a.xy.div(e);const t=qc("near","float",r.camera).setGroup(_a),s=qc("far","float",r.camera).setGroup(_a);n=ig(e.negate(),t,s)}return a=Rn(a.x,a.y.oneMinus(),s.reversedDepthBuffer?n.sub(i):n.add(i)),a}getShadowFilterFn(e){return Q_[e]}setupRenderTarget(e,t){const r=new Z(e.mapSize.width,e.mapSize.height);r.name="ShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return s.texture.name="ShadowMap",s.texture.type=e.mapType,s.depthTexture=r,{shadowMap:s,depthTexture:r}}setupShadow(e){const{renderer:t,camera:r}=e,{light:s,shadow:i}=this,{depthTexture:n,shadowMap:a}=this.setupRenderTarget(i,e),o=t.shadowMap.type,u=t.hasCompatibility(E.TEXTURE_COMPARE);if(o!==ct&&o!==ht||!u?(n.minFilter=B,n.magFilter=B):(n.minFilter=le,n.magFilter=le),i.camera.coordinateSystem=r.coordinateSystem,i.camera.updateProjectionMatrix(),o===pt&&!0!==i.isPointLightShadow){n.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:$,type:Te,depthBuffer:!1}));let t=Kl(n);n.isArrayTexture&&(t=t.depth(this.depthLayer));let r=Kl(this.vsmShadowMapVertical.texture);n.isArrayTexture&&(r=r.depth(this.depthLayer));const s=qc("blurSamples","float",i).setGroup(_a),o=qc("radius","float",i).setGroup(_a),u=qc("mapSize","vec2",i).setGroup(_a);let l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new vg);l.fragmentNode=X_({samples:s,radius:o,size:u,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMVertical",l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new vg),l.fragmentNode=K_({samples:s,radius:o,size:u,shadowPass:r,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name="VSMHorizontal"}const l=qc("intensity","float",i).setGroup(_a),d=qc("normalBias","float",i).setGroup(_a),c=y_(s),h=Rc.mul(d);let p;if(!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld)p=c.mul(w_.add(h));else{p=Sa("mat4").onObjectUpdate(({object:e},t)=>t.value.multiplyMatrices(c.value,e.matrixWorld)).mul(lc).add(c.mul(Cn(h,0)))}const g=this.setupShadowCoord(e,p),m=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===m)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const f=o===pt&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:n,y=this.setupShadowFilter(e,{filterFn:m,shadowTexture:a.texture,depthTexture:f,shadowCoord:g,shadow:i,depthLayer:this.depthLayer});let b,x;!0===t.shadowMap.transmitted&&(a.texture.isCubeTexture?b=$c(a.texture,g.xyz):(b=Kl(a.texture,g),n.isArrayTexture&&(b=b.depth(this.depthLayer)))),x=b?gu(1,y.rgb.mix(b,1),l.mul(b.a)).toVar():gu(1,y,l).toVar(),this.shadowMap=a,this.shadow.map=a;const T=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return b&&x.toInspector(`${T} / Color`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture):Kl(this.shadowMap.texture)),x.toInspector(`${T} / Depth`,()=>this.shadowMap.texture.isCubeTexture?$c(this.shadowMap.texture).r.oneMinus():Ql(this.shadowMap.depthTexture,kl().mul(zl(Kl(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return cn(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),null===r&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e;t.updateMatrices(s),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);const a=n.name;n.name=`Shadow Map [ ${s.name||"ID: "+s.id} ]`,i.render(n,t.camera),n.name=a}updateShadow(e){const{shadowMap:t,light:r,shadow:s}=this,{renderer:i,scene:n,camera:a}=e,o=i.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u;const l=s.camera.layers.mask;4294967294&s.camera.layers.mask||(s.camera.layers.mask=a.layers.mask);const d=i.getRenderObjectFunction(),c=i.getMRT(),h=!!c&&c.has("velocity");Y_=D_(i,n,Y_),n.overrideMaterial=$_(r),i.setRenderObjectFunction(j_(i,s,o,h)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(d),o===pt&&!0!==s.isPointLightShadow&&this.vsmPass(i),s.camera.layers.mask=l,U_(i,n,Y_)}vsmPass(e){const{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),Z_.material=this.vsmMaterialVertical,Z_.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Z_.material=this.vsmMaterialHorizontal,Z_.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,W_(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const ev=(e,t)=>new J_(e,t),tv=new e,rv=new a,sv=new r,iv=new r,nv=[new r(1,0,0),new r(-1,0,0),new r(0,-1,0),new r(0,1,0),new r(0,0,1),new r(0,0,-1)],av=[new r(0,-1,0),new r(0,-1,0),new r(0,0,-1),new r(0,0,1),new r(0,-1,0),new r(0,-1,0)],ov=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)],uv=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)],lv=cn(({depthTexture:e,bd3D:t,dp:r})=>$c(e,t).compare(r)),dv=cn(({depthTexture:e,bd3D:t,dp:r,shadow:s})=>{const i=qc("radius","float",s).setGroup(_a),n=qc("mapSize","vec2",s).setGroup(_a),a=i.div(n.x),o=Vo(t),u=Ro(au(t,o.x.greaterThan(o.z).select(Rn(0,1,0),Rn(1,0,0)))),l=au(t,u),d=_x(dd.xy).mul(6.28318530718),c=vx(0,5,d),h=vx(1,5,d),p=vx(2,5,d),g=vx(3,5,d),m=vx(4,5,d);return $c(e,t.add(u.mul(c.x).add(l.mul(c.y)).mul(a))).compare(r).add($c(e,t.add(u.mul(h.x).add(l.mul(h.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(p.x).add(l.mul(p.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(g.x).add(l.mul(g.y)).mul(a))).compare(r)).add($c(e,t.add(u.mul(m.x).add(l.mul(m.y)).mul(a))).compare(r)).mul(.2)}),cv=cn(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:s},i)=>{const n=r.xyz.toConst(),a=n.abs().toConst(),o=a.x.max(a.y).max(a.z),u=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.near),l=Sa("float").setGroup(_a).onRenderUpdate(()=>s.camera.far),d=qc("bias","float",s).setGroup(_a),c=yn(1).toVar();return gn(o.sub(l).lessThanEqual(0).and(o.sub(u).greaterThanEqual(0)),()=>{let r;i.renderer.reversedDepthBuffer?(r=rg(o.negate(),u,l),r.subAssign(d)):(r=tg(o.negate(),u,l),r.addAssign(d));const a=n.normalize();c.assign(e({depthTexture:t,bd3D:a,dp:r,shadow:s}))}),c});class hv extends J_{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===gt?lv:dv}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:s,shadow:i}){return cv({filterFn:t,depthTexture:r,shadowCoord:s,shadow:i})}setupRenderTarget(e,t){const r=new mt(e.mapSize.width);r.name="PointShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?M:w;const s=t.createCubeRenderTarget(e.mapSize.width);return s.texture.name="PointShadowMap",s.depthTexture=r,{shadowMap:s,depthTexture:r}}renderShadow(e){const{shadow:t,shadowMap:r,light:s}=this,{renderer:i,scene:n}=e,a=t.camera,o=t.matrix,u=i.coordinateSystem===h,l=u?nv:ov,d=u?av:uv;r.setSize(t.mapSize.width,t.mapSize.width);const c=i.autoClear,p=i.getClearColor(tv),g=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){i.setRenderTarget(r,e),i.clear();const u=s.distance||a.far;u!==a.far&&(a.far=u,a.updateProjectionMatrix()),sv.setFromMatrixPosition(s.matrixWorld),a.position.copy(sv),iv.copy(a.position),iv.add(l[e]),a.up.copy(d[e]),a.lookAt(iv),a.updateMatrixWorld(),o.makeTranslation(-sv.x,-sv.y,-sv.z),rv.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(rv,a.coordinateSystem,a.reversedDepth);const c=n.name;n.name=`Point Light Shadow [ ${s.name||"ID: "+s.id} ] - Face ${e+1}`,i.render(n,a),n.name=c}i.autoClear=c,i.setClearColor(p,g)}}const pv=(e,t)=>new hv(e,t);class gv extends Op{static get type(){return"AnalyticLightNode"}constructor(t=null){super(),this.light=t,this.color=new e,this.colorNode=t&&t.colorNode||Sa(this.color).setGroup(_a),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=ri.FRAME,t&&t.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},t.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,null!==this.baseColorNode&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return __(this.light).sub(e.context.positionView||pc)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return ev(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let r=this.shadowColorNode;if(null===r){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?tn(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=r=this.colorNode.mul(t),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const mv=cn(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{const s=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(s.mul(e.div(t).pow4().oneMinus().clamp().pow2()),s)}),fv=({color:e,lightVector:t,cutoffDistance:r,decayExponent:s})=>{const i=t.normalize(),n=t.length(),a=mv({lightDistance:n,cutoffDistance:r,decayExponent:s});return{lightDirection:i,lightColor:e.mul(a)}};class yv extends gv{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(2).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return pv(this.light)}setupDirect(e){return fv({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const bv=cn(([e=kl()])=>{const t=e.mul(2),r=t.x.floor(),s=t.y.floor();return r.add(s).mod(2).sign()}),xv=cn(([e=kl()],{renderer:t,material:r})=>{const s=pu(e.mul(2).sub(1));let i;if(r.alphaToCoverage&&t.currentSamples>0){const e=yn(s.fwidth()).toVar();i=bu(e.oneMinus(),e.add(1),s).oneMinus()}else i=Au(s.greaterThan(1),0,1);return i}),Tv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=Tn(e).toVar();return Au(n,i,s)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),_v=cn(([e,t])=>{const r=Tn(t).toVar(),s=yn(e).toVar();return Au(r,s.negate(),s)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),vv=cn(([e])=>{const t=yn(e).toVar();return bn(No(t))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Nv=cn(([e,t])=>{const r=yn(e).toVar();return t.assign(vv(r)),r.sub(yn(t))}),Sv=Vb([cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=yn(s).toVar(),l=yn(r).toVar(),d=yn(t).toVar(),c=yn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),cn(([e,t,r,s,i,n])=>{const a=yn(n).toVar(),o=yn(i).toVar(),u=Rn(s).toVar(),l=Rn(r).toVar(),d=Rn(t).toVar(),c=Rn(e).toVar(),h=yn(Pa(1,o)).toVar();return Pa(1,a).mul(c.mul(h).add(d.mul(o))).add(a.mul(l.mul(h).add(u.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),Rv=Vb([cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=yn(o).toVar(),m=yn(a).toVar(),f=yn(n).toVar(),y=yn(i).toVar(),b=yn(s).toVar(),x=yn(r).toVar(),T=yn(t).toVar(),_=yn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=yn(d).toVar(),h=yn(l).toVar(),p=yn(u).toVar(),g=Rn(o).toVar(),m=Rn(a).toVar(),f=Rn(n).toVar(),y=Rn(i).toVar(),b=Rn(s).toVar(),x=Rn(r).toVar(),T=Rn(t).toVar(),_=Rn(e).toVar(),v=yn(Pa(1,p)).toVar(),N=yn(Pa(1,h)).toVar();return yn(Pa(1,c)).toVar().mul(N.mul(_.mul(v).add(T.mul(p))).add(h.mul(x.mul(v).add(b.mul(p))))).add(c.mul(N.mul(y.mul(v).add(f.mul(p))).add(h.mul(m.mul(v).add(g.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),Ev=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=xn(e).toVar(),a=xn(n.bitAnd(xn(7))).toVar(),o=yn(Tv(a.lessThan(xn(4)),i,s)).toVar(),u=yn(Da(2,Tv(a.lessThan(xn(4)),s,i))).toVar();return _v(o,Tn(a.bitAnd(xn(1)))).add(_v(u,Tn(a.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Av=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=xn(e).toVar(),u=xn(o.bitAnd(xn(15))).toVar(),l=yn(Tv(u.lessThan(xn(8)),a,n)).toVar(),d=yn(Tv(u.lessThan(xn(4)),n,Tv(u.equal(xn(12)).or(u.equal(xn(14))),a,i))).toVar();return _v(l,Tn(u.bitAnd(xn(1)))).add(_v(d,Tn(u.bitAnd(xn(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),wv=Vb([Ev,Av]),Cv=cn(([e,t,r])=>{const s=yn(r).toVar(),i=yn(t).toVar(),n=An(e).toVar();return Rn(wv(n.x,i,s),wv(n.y,i,s),wv(n.z,i,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Mv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=yn(t).toVar(),o=An(e).toVar();return Rn(wv(o.x,a,n,i),wv(o.y,a,n,i),wv(o.z,a,n,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Bv=Vb([Cv,Mv]),Fv=cn(([e])=>{const t=yn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Lv=cn(([e])=>{const t=yn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Pv=Vb([Fv,cn(([e])=>{const t=Rn(e).toVar();return Da(.6616,t)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Dv=Vb([Lv,cn(([e])=>{const t=Rn(e).toVar();return Da(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Uv=cn(([e,t])=>{const r=bn(t).toVar(),s=xn(e).toVar();return s.shiftLeft(r).bitOr(s.shiftRight(bn(32).sub(r)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Iv=cn(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(Uv(r,bn(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(Uv(r,bn(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Uv(e,bn(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Uv(t,bn(4))),t.addAssign(e)}),Ov=cn(([e,t,r])=>{const s=xn(r).toVar(),i=xn(t).toVar(),n=xn(e).toVar();return s.bitXorAssign(i),s.subAssign(Uv(i,bn(14))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(11))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(25))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(16))),n.bitXorAssign(s),n.subAssign(Uv(s,bn(4))),i.bitXorAssign(n),i.subAssign(Uv(n,bn(14))),s.bitXorAssign(i),s.subAssign(Uv(i,bn(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Vv=cn(([e])=>{const t=xn(e).toVar();return yn(t).div(yn(xn(bn(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),kv=cn(([e])=>{const t=yn(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Gv=Vb([cn(([e])=>{const t=bn(e).toVar(),r=xn(xn(1)).toVar(),s=xn(xn(bn(3735928559)).add(r.shiftLeft(xn(2))).add(xn(13))).toVar();return Ov(s.add(xn(t)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(xn(2)).toVar(),n=xn().toVar(),a=xn().toVar(),o=xn().toVar();return n.assign(a.assign(o.assign(xn(bn(3735928559)).add(i.shiftLeft(xn(2))).add(xn(13))))),n.addAssign(xn(s)),a.addAssign(xn(r)),Ov(n,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(xn(3)).toVar(),o=xn().toVar(),u=xn().toVar(),l=xn().toVar();return o.assign(u.assign(l.assign(xn(bn(3735928559)).add(a.shiftLeft(xn(2))).add(xn(13))))),o.addAssign(xn(n)),u.addAssign(xn(i)),l.addAssign(xn(s)),Ov(o,u,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cn(([e,t,r,s])=>{const i=bn(s).toVar(),n=bn(r).toVar(),a=bn(t).toVar(),o=bn(e).toVar(),u=xn(xn(4)).toVar(),l=xn().toVar(),d=xn().toVar(),c=xn().toVar();return l.assign(d.assign(c.assign(xn(bn(3735928559)).add(u.shiftLeft(xn(2))).add(xn(13))))),l.addAssign(xn(o)),d.addAssign(xn(a)),c.addAssign(xn(n)),Iv(l,d,c),l.addAssign(xn(i)),Ov(l,d,c)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),cn(([e,t,r,s,i])=>{const n=bn(i).toVar(),a=bn(s).toVar(),o=bn(r).toVar(),u=bn(t).toVar(),l=bn(e).toVar(),d=xn(xn(5)).toVar(),c=xn().toVar(),h=xn().toVar(),p=xn().toVar();return c.assign(h.assign(p.assign(xn(bn(3735928559)).add(d.shiftLeft(xn(2))).add(xn(13))))),c.addAssign(xn(l)),h.addAssign(xn(u)),p.addAssign(xn(o)),Iv(c,h,p),c.addAssign(xn(a)),h.addAssign(xn(n)),Ov(c,h,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),zv=Vb([cn(([e,t])=>{const r=bn(t).toVar(),s=bn(e).toVar(),i=xn(Gv(s,r)).toVar(),n=An().toVar();return n.x.assign(i.bitAnd(bn(255))),n.y.assign(i.shiftRight(bn(8)).bitAnd(bn(255))),n.z.assign(i.shiftRight(bn(16)).bitAnd(bn(255))),n}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cn(([e,t,r])=>{const s=bn(r).toVar(),i=bn(t).toVar(),n=bn(e).toVar(),a=xn(Gv(n,i,s)).toVar(),o=An().toVar();return o.x.assign(a.bitAnd(bn(255))),o.y.assign(a.shiftRight(bn(8)).bitAnd(bn(255))),o.z.assign(a.shiftRight(bn(16)).bitAnd(bn(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),$v=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=yn(Sv(wv(Gv(r,s),i,n),wv(Gv(r.add(bn(1)),s),i.sub(1),n),wv(Gv(r,s.add(bn(1))),i,n.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=yn(Rv(wv(Gv(r,s,i),n,a,o),wv(Gv(r.add(bn(1)),s,i),n.sub(1),a,o),wv(Gv(r,s.add(bn(1)),i),n,a.sub(1),o),wv(Gv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),wv(Gv(r,s,i.add(bn(1))),n,a,o.sub(1)),wv(Gv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),wv(Gv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),wv(Gv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),Wv=Vb([cn(([e])=>{const t=_n(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=yn(Nv(t.x,r)).toVar(),n=yn(Nv(t.y,s)).toVar(),a=yn(kv(i)).toVar(),o=yn(kv(n)).toVar(),u=Rn(Sv(Bv(zv(r,s),i,n),Bv(zv(r.add(bn(1)),s),i.sub(1),n),Bv(zv(r,s.add(bn(1))),i,n.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1))),i.sub(1),n.sub(1)),a,o)).toVar();return Pv(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn().toVar(),s=bn().toVar(),i=bn().toVar(),n=yn(Nv(t.x,r)).toVar(),a=yn(Nv(t.y,s)).toVar(),o=yn(Nv(t.z,i)).toVar(),u=yn(kv(n)).toVar(),l=yn(kv(a)).toVar(),d=yn(kv(o)).toVar(),c=Rn(Rv(Bv(zv(r,s,i),n,a,o),Bv(zv(r.add(bn(1)),s,i),n.sub(1),a,o),Bv(zv(r,s.add(bn(1)),i),n,a.sub(1),o),Bv(zv(r.add(bn(1)),s.add(bn(1)),i),n.sub(1),a.sub(1),o),Bv(zv(r,s,i.add(bn(1))),n,a,o.sub(1)),Bv(zv(r.add(bn(1)),s,i.add(bn(1))),n.sub(1),a,o.sub(1)),Bv(zv(r,s.add(bn(1)),i.add(bn(1))),n,a.sub(1),o.sub(1)),Bv(zv(r.add(bn(1)),s.add(bn(1)),i.add(bn(1))),n.sub(1),a.sub(1),o.sub(1)),u,l,d)).toVar();return Dv(c)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),Hv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Vv(Gv(r))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Vv(Gv(r,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Vv(Gv(r,s,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Vv(Gv(r,s,i,n))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),qv=Vb([cn(([e])=>{const t=yn(e).toVar(),r=bn(vv(t)).toVar();return Rn(Vv(Gv(r,bn(0))),Vv(Gv(r,bn(1))),Vv(Gv(r,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),cn(([e])=>{const t=_n(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar();return Rn(Vv(Gv(r,s,bn(0))),Vv(Gv(r,s,bn(1))),Vv(Gv(r,s,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),cn(([e])=>{const t=Rn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar();return Rn(Vv(Gv(r,s,i,bn(0))),Vv(Gv(r,s,i,bn(1))),Vv(Gv(r,s,i,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),cn(([e])=>{const t=Cn(e).toVar(),r=bn(vv(t.x)).toVar(),s=bn(vv(t.y)).toVar(),i=bn(vv(t.z)).toVar(),n=bn(vv(t.w)).toVar();return Rn(Vv(Gv(r,s,i,n,bn(0))),Vv(Gv(r,s,i,n,bn(1))),Vv(Gv(r,s,i,n,bn(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),jv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=yn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul($v(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Xv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(0).toVar(),l=yn(1).toVar();return Bp(a,()=>{u.addAssign(l.mul(Wv(o))),l.mulAssign(i),o.mulAssign(n)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Kv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar();return _n(jv(o,a,n,i),jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Qv=cn(([e,t,r,s])=>{const i=yn(s).toVar(),n=yn(r).toVar(),a=bn(t).toVar(),o=Rn(e).toVar(),u=Rn(Xv(o,a,n,i)).toVar(),l=yn(jv(o.add(Rn(bn(19),bn(193),bn(17))),a,n,i)).toVar();return Cn(u,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Yv=Vb([cn(([e,t,r,s,i,n,a])=>{const o=bn(a).toVar(),u=yn(n).toVar(),l=bn(i).toVar(),d=bn(s).toVar(),c=bn(r).toVar(),h=bn(t).toVar(),p=_n(e).toVar(),g=Rn(qv(_n(h.add(d),c.add(l)))).toVar(),m=_n(g.x,g.y).toVar();m.subAssign(.5),m.mulAssign(u),m.addAssign(.5);const f=_n(_n(yn(h),yn(c)).add(m)).toVar(),y=_n(f.sub(p)).toVar();return gn(o.equal(bn(2)),()=>Vo(y.x).add(Vo(y.y))),gn(o.equal(bn(3)),()=>eu(Vo(y.x),Vo(y.y))),nu(y,y)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cn(([e,t,r,s,i,n,a,o,u])=>{const l=bn(u).toVar(),d=yn(o).toVar(),c=bn(a).toVar(),h=bn(n).toVar(),p=bn(i).toVar(),g=bn(s).toVar(),m=bn(r).toVar(),f=bn(t).toVar(),y=Rn(e).toVar(),b=Rn(qv(Rn(f.add(p),m.add(h),g.add(c)))).toVar();b.subAssign(.5),b.mulAssign(d),b.addAssign(.5);const x=Rn(Rn(yn(f),yn(m),yn(g)).add(b)).toVar(),T=Rn(x.sub(y)).toVar();return gn(l.equal(bn(2)),()=>Vo(T.x).add(Vo(T.y)).add(Vo(T.z))),gn(l.equal(bn(3)),()=>eu(Vo(T.x),Vo(T.y),Vo(T.z))),nu(T,T)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),Zv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();l.assign(Jo(l,r))})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Jv=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.y.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),eN=cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=_n(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=_n(Nv(n.x,a),Nv(n.y,o)).toVar(),l=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{const r=yn(Yv(u,e,t,a,o,i,s)).toVar();gn(r.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(r)}).ElseIf(r.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(r)}).ElseIf(r.lessThan(l.z),()=>{l.z.assign(r)})})}),gn(s.equal(bn(0)),()=>{l.assign(_o(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tN=Vb([Zv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=yn(1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();d.assign(Jo(d,n))})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),rN=Vb([Jv,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=_n(1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.y.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),sN=Vb([eN,cn(([e,t,r])=>{const s=bn(r).toVar(),i=yn(t).toVar(),n=Rn(e).toVar(),a=bn().toVar(),o=bn().toVar(),u=bn().toVar(),l=Rn(Nv(n.x,a),Nv(n.y,o),Nv(n.z,u)).toVar(),d=Rn(1e6,1e6,1e6).toVar();return Bp({start:-1,end:bn(1),name:"x",condition:"<="},({x:e})=>{Bp({start:-1,end:bn(1),name:"y",condition:"<="},({y:t})=>{Bp({start:-1,end:bn(1),name:"z",condition:"<="},({z:r})=>{const n=yn(Yv(l,e,t,r,a,o,u,i,s)).toVar();gn(n.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(n)}).ElseIf(n.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(n)}).ElseIf(n.lessThan(d.z),()=>{d.z.assign(n)})})})}),gn(s.equal(bn(0)),()=>{d.assign(_o(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),iN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=_n(t).toVar(),p=_n(r).toVar(),g=_n(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(Rn(v,0),x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nN=cn(([e,t,r,s,i,n,a,o,u,l,d])=>{const c=bn(e).toVar(),h=Rn(t).toVar(),p=Rn(r).toVar(),g=Rn(s).toVar(),m=yn(i).toVar(),f=yn(n).toVar(),y=yn(a).toVar(),b=Tn(o).toVar(),x=bn(u).toVar(),T=yn(l).toVar(),_=yn(d).toVar(),v=h.mul(p).add(g),N=yn(0).toVar();return gn(c.equal(bn(0)),()=>{N.assign(Wv(v))}),gn(c.equal(bn(1)),()=>{N.assign(qv(v))}),gn(c.equal(bn(2)),()=>{N.assign(sN(v,m,bn(0)))}),gn(c.equal(bn(3)),()=>{N.assign(Xv(v,x,T,_))}),N.assign(N.mul(y.sub(f)).add(f)),gn(b,()=>{N.assign(mu(N,f,y))}),N}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aN=cn(([e])=>{const t=e.y,r=e.z,s=Rn().toVar();return gn(t.lessThan(1e-4),()=>{s.assign(Rn(r,r,r))}).Else(()=>{let i=e.x;i=i.sub(No(i)).mul(6).toVar();const n=bn(Xo(i)),a=i.sub(yn(n)),o=r.mul(t.oneMinus()),u=r.mul(t.mul(a).oneMinus()),l=r.mul(t.mul(a.oneMinus()).oneMinus());gn(n.equal(bn(0)),()=>{s.assign(Rn(r,l,o))}).ElseIf(n.equal(bn(1)),()=>{s.assign(Rn(u,r,o))}).ElseIf(n.equal(bn(2)),()=>{s.assign(Rn(o,r,l))}).ElseIf(n.equal(bn(3)),()=>{s.assign(Rn(o,u,r))}).ElseIf(n.equal(bn(4)),()=>{s.assign(Rn(l,o,r))}).Else(()=>{s.assign(Rn(r,o,u))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),oN=cn(([e])=>{const t=Rn(e).toVar(),r=yn(t.x).toVar(),s=yn(t.y).toVar(),i=yn(t.z).toVar(),n=yn(Jo(r,Jo(s,i))).toVar(),a=yn(eu(r,eu(s,i))).toVar(),o=yn(a.sub(n)).toVar(),u=yn().toVar(),l=yn().toVar(),d=yn().toVar();return d.assign(a),gn(a.greaterThan(0),()=>{l.assign(o.div(a))}).Else(()=>{l.assign(0)}),gn(l.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{gn(r.greaterThanEqual(a),()=>{u.assign(s.sub(i).div(o))}).ElseIf(s.greaterThanEqual(a),()=>{u.assign(La(2,i.sub(r).div(o)))}).Else(()=>{u.assign(La(4,r.sub(s).div(o)))}),u.mulAssign(1/6),gn(u.lessThan(0),()=>{u.addAssign(1)})}),Rn(u,l,d)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),uN=cn(([e])=>{const t=Rn(e).toVar(),r=wn(Ga(t,Rn(.04045))).toVar(),s=Rn(t.div(12.92)).toVar(),i=Rn(ou(eu(t.add(Rn(.055)),Rn(0)).div(1.055),Rn(2.4))).toVar();return gu(s,i,r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),lN=(e,t)=>{e=yn(e),t=yn(t);const r=_n(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return bu(e.sub(r),e.add(r),t)},dN=(e,t,r,s)=>gu(e,t,r[s].clamp()),cN=(e,t,r,s,i)=>gu(e,t,lN(r,s[i])),hN=cn(([e,t,r])=>{const s=Ro(e).toVar(),i=Pa(yn(.5).mul(t.sub(r)),cc).div(s).toVar(),n=Pa(yn(-.5).mul(t.sub(r)),cc).div(s).toVar(),a=Rn().toVar();a.x=s.x.greaterThan(yn(0)).select(i.x,n.x),a.y=s.y.greaterThan(yn(0)).select(i.y,n.y),a.z=s.z.greaterThan(yn(0)).select(i.z,n.z);const o=Jo(a.x,a.y,a.z).toVar();return cc.add(s.mul(o)).toVar().sub(r)}),pN=cn(([e,t])=>{const r=e.x,s=e.y,i=e.z;let n=t.element(0).mul(.886227);return n=n.add(t.element(1).mul(1.023328).mul(s)),n=n.add(t.element(2).mul(1.023328).mul(i)),n=n.add(t.element(3).mul(1.023328).mul(r)),n=n.add(t.element(4).mul(.858086).mul(r).mul(s)),n=n.add(t.element(5).mul(.858086).mul(s).mul(i)),n=n.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),n=n.add(t.element(7).mul(.858086).mul(r).mul(i)),n=n.add(t.element(8).mul(.429043).mul(Da(r,r).sub(Da(s,s)))),n});var gN=Object.freeze({__proto__:null,BRDF_GGX:am,BRDF_Lambert:Hg,BasicPointShadowFilter:lv,BasicShadowFilter:V_,Break:Fp,Const:Ou,Continue:()=>Cl("continue").toStack(),DFGLUT:lm,D_GGX:sm,Discard:Ml,EPSILON:ao,F_Schlick:Wg,Fn:cn,HALF_PI:ho,INFINITY:oo,If:gn,Loop:Bp,NodeAccess:ii,NodeShaderStage:ti,NodeType:si,NodeUpdateType:ri,OnBeforeMaterialUpdate:e=>Rx(Sx.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>Rx(Sx.BEFORE_OBJECT,e),OnMaterialUpdate:e=>Rx(Sx.MATERIAL,e),OnObjectUpdate:e=>Rx(Sx.OBJECT,e),PCFShadowFilter:k_,PCFSoftShadowFilter:G_,PI:uo,PI2:lo,PointShadowFilter:dv,Return:()=>Cl("return").toStack(),Schlick_to_F0:hm,ShaderNode:en,Stack:mn,Switch:(...e)=>Si.Switch(...e),TBNViewMatrix:xh,TWO_PI:co,VSMShadowFilter:z_,V_GGX_SmithCorrelated:tm,Var:Iu,VarIntent:Vu,abs:Vo,acesFilmicToneMapping:dT,acos:Do,acosh:Uo,add:La,addMethodChaining:Ei,addNodeElement:function(e){d("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:gT,all:po,alphaT:Jn,and:Wa,anisotropy:ea,anisotropyB:ra,anisotropyT:ta,any:go,append:e=>(d("TSL: append() has been renamed to Stack().",new Is),mn(e)),array:Ea,arrayBuffer:e=>new vi(e,"ArrayBuffer"),asin:Lo,asinh:Po,assign:wa,atan:Io,atanh:Oo,atomicAdd:(e,t)=>zT(kT.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>zT(kT.ATOMIC_AND,e,t),atomicFunc:zT,atomicLoad:e=>zT(kT.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>zT(kT.ATOMIC_MAX,e,t),atomicMin:(e,t)=>zT(kT.ATOMIC_MIN,e,t),atomicOr:(e,t)=>zT(kT.ATOMIC_OR,e,t),atomicStore:(e,t)=>zT(kT.ATOMIC_STORE,e,t),atomicSub:(e,t)=>zT(kT.ATOMIC_SUB,e,t),atomicXor:(e,t)=>zT(kT.ATOMIC_XOR,e,t),attenuationColor:ma,attenuationDistance:ga,attribute:Vl,attributeArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ax(e,r,s);return Tp(i,t,e)},backgroundBlurriness:Bx,backgroundIntensity:Fx,backgroundRotation:Lx,batch:Ep,bentNormalView:_h,billboarding:Hb,bitAnd:Xa,bitNot:Ka,bitOr:Qa,bitXor:Ya,bitangentGeometry:mh,bitangentLocal:fh,bitangentView:yh,bitangentWorld:bh,bitcast:yb,blendBurn:mg,blendColor:xg,blendDodge:fg,blendOverlay:bg,blendScreen:yg,blur:pf,bool:Tn,buffer:Zl,bufferAttribute:ul,builtin:sd,builtinAOContext:Lu,builtinShadowContext:Fu,bumpMap:Ch,bvec2:Sn,bvec3:wn,bvec4:Fn,bypass:Rl,cache:Nl,call:Ma,cameraFar:Fd,cameraIndex:Md,cameraNear:Bd,cameraNormalMatrix:Id,cameraPosition:Od,cameraProjectionMatrix:Ld,cameraProjectionMatrixInverse:Pd,cameraViewMatrix:Dd,cameraViewport:Vd,cameraWorldMatrix:Ud,cbrt:hu,cdl:Qx,ceil:So,checker:bv,cineonToneMapping:uT,clamp:mu,clearcoat:qn,clearcoatNormalView:Ec,clearcoatRoughness:jn,clipSpace:oc,code:yT,color:fn,colorSpaceToWorking:Qu,colorToDirection:e=>tn(e).mul(2).sub(1),compute:Tl,computeKernel:xl,computeSkinning:(e,t=null)=>{const r=new wp(e);return r.positionNode=Tp(new q(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinIndexNode=Tp(new q(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.skinWeightNode=Tp(new q(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(pl).toVar(),r.bindMatrixNode=Sa(e.bindMatrix,"mat4"),r.bindMatrixInverseNode=Sa(e.bindMatrixInverse,"mat4"),r.boneMatricesNode=Zl(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),r.toPositionNode=t,tn(r)},context:Cu,convert:In,convertColorSpace:(e,t,r)=>new Xu(tn(e),t,r),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():yx(e,...t),cos:Co,cosh:Mo,countLeadingZeros:vb,countOneBits:Nb,countTrailingZeros:_b,cross:au,cubeTexture:$c,cubeTextureBase:zc,dFdx:Wo,dFdy:Ho,dashSize:ua,debug:Pl,decrement:so,decrementBefore:to,defaultBuildStages:ai,defaultShaderStages:ni,defined:Zi,degrees:fo,deltaTime:Gb,densityFogFactor:vT,depth:ag,depthPass:(e,t,r)=>new iT(iT.DEPTH,e,t,r),determinant:Yo,difference:iu,diffuseColor:Gn,diffuseContribution:zn,directPointLight:fv,directionToColor:vh,directionToFaceDirection:bc,dispersion:fa,disposeShadowMaterial:W_,distance:su,div:Ua,dot:nu,drawIndex:yl,dynamicBufferAttribute:(e,t=null,r=0,s=0)=>ol(e,t,r,s,x),element:Un,emissive:$n,equal:Oa,equirectUV:Bg,exp:yo,exp2:bo,exponentialHeightFogFactor:NT,expression:Cl,faceDirection:yc,faceForward:xu,faceforward:Su,float:yn,floatBitsToInt:e=>new fb(e,"int","float"),floatBitsToUint:bb,floor:No,fog:ST,fract:Eo,frameGroup:Ta,frameId:zb,frontFacing:fc,fwidth:Ko,gain:(e,t)=>e.lessThan(.5)?Rb(e.mul(2),t).div(2):Pa(1,Rb(Da(Pa(1,e),2),t).div(2)),gapSize:la,getConstNodeType:Ji,getCurrentStack:pn,getDirection:lf,getDistanceAttenuation:mv,getGeometryRoughness:Jg,getNormalFromDepth:Tx,getParallaxCorrectNormal:hN,getRoughness:em,getScreenPosition:xx,getShIrradianceAt:pN,getShadowMaterial:$_,getShadowRenderObjectFunction:j_,getTextureIndex:pb,getViewPosition:bx,ggxConvolution:yf,globalId:LT,glsl:(e,t)=>yT(e,t,"glsl"),glslFn:(e,t)=>xT(e,t,"glsl"),grayscale:Hx,greaterThan:Ga,greaterThanEqual:$a,hash:Sb,highpModelNormalViewMatrix:ac,highpModelViewMatrix:nc,hue:Xx,increment:ro,incrementBefore:eo,inspector:Il,instance:vp,instanceIndex:pl,instancedArray:(e,t="float")=>{let r,s;!0===t.isStruct?(r=t.layout.getLength(),s=Hs("float")):(r=qs(t),s=Hs(t));const i=new Ex(e,r,s);return Tp(i,t,i.count)},instancedBufferAttribute:ll,instancedDynamicBufferAttribute:dl,instancedMesh:Sp,int:bn,intBitsToFloat:e=>new fb(e,"float","int"),interleavedGradientNoise:_x,inverse:Zo,inverseSqrt:vo,inversesqrt:Ru,invocationLocalIndex:fl,invocationSubgroupIndex:ml,ior:ca,iridescence:Qn,iridescenceIOR:Yn,iridescenceThickness:Zn,isolate:vl,ivec2:vn,ivec3:En,ivec4:Mn,js:(e,t)=>yT(e,t,"js"),label:Pu,length:Go,lengthSq:pu,lessThan:ka,lessThanEqual:za,lightPosition:x_,lightProjectionUV:b_,lightShadowMatrix:y_,lightTargetDirection:v_,lightTargetPosition:T_,lightViewPosition:__,lightingContext:Gp,lights:(e=[])=>(new E_).setLights(e),linearDepth:og,linearToneMapping:aT,localId:PT,log:xo,log2:To,logarithmicDepthToViewZ:(e,t,r)=>{const s=e.mul(xo(r.div(t)));return yn(Math.E).pow(s).mul(t).negate()},luminance:Kx,mat2:Ln,mat3:Pn,mat4:Dn,matcapUV:ey,materialAO:gp,materialAlphaTest:Fh,materialAnisotropy:Yh,materialAnisotropyVector:mp,materialAttenuationColor:np,materialAttenuationDistance:ip,materialClearcoat:Hh,materialClearcoatNormal:jh,materialClearcoatRoughness:qh,materialColor:Lh,materialDispersion:hp,materialEmissive:Dh,materialEnvIntensity:Pc,materialEnvRotation:Dc,materialIOR:sp,materialIridescence:Zh,materialIridescenceIOR:Jh,materialIridescenceThickness:ep,materialLightMap:pp,materialLineDashOffset:dp,materialLineDashSize:op,materialLineGapSize:up,materialLineScale:ap,materialLineWidth:lp,materialMetalness:$h,materialNormal:Wh,materialOpacity:Uh,materialPointSize:cp,materialReference:Kc,materialReflectivity:Gh,materialRefractionRatio:Lc,materialRotation:Xh,materialRoughness:zh,materialSheen:Kh,materialSheenRoughness:Qh,materialShininess:Ph,materialSpecular:Ih,materialSpecularColor:Vh,materialSpecularIntensity:Oh,materialSpecularStrength:kh,materialThickness:rp,materialTransmission:tp,max:eu,maxMipLevel:Wl,mediumpModelViewMatrix:ic,metalness:Hn,min:Jo,mix:gu,mixElement:_u,mod:Ia,modInt:io,modelDirection:Kd,modelNormalMatrix:tc,modelPosition:Yd,modelRadius:ec,modelScale:Zd,modelViewMatrix:sc,modelViewPosition:Jd,modelViewProjection:fp,modelWorldMatrix:Qd,modelWorldMatrixInverse:rc,morphReference:Ip,mrt:mb,mul:Da,mx_aastep:lN,mx_add:(e,t=yn(0))=>La(e,t),mx_atan2:(e=yn(0),t=yn(1))=>Io(e,t),mx_cell_noise_float:(e=kl())=>Hv(e.convert("vec2|vec3")),mx_contrast:(e,t=1,r=.5)=>yn(e).sub(r).mul(t).add(r),mx_divide:(e,t=yn(1))=>Ua(e,t),mx_fractal_noise_float:(e=kl(),t=3,r=2,s=.5,i=1)=>jv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec2:(e=kl(),t=3,r=2,s=.5,i=1)=>Kv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec3:(e=kl(),t=3,r=2,s=.5,i=1)=>Xv(e,bn(t),r,s).mul(i),mx_fractal_noise_vec4:(e=kl(),t=3,r=2,s=.5,i=1)=>Qv(e,bn(t),r,s).mul(i),mx_frame:()=>zb,mx_heighttonormal:(e,t)=>(e=Rn(e),t=yn(t),Ch(e,t)),mx_hsvtorgb:aN,mx_ifequal:(e,t,r,s)=>e.equal(t).mix(r,s),mx_ifgreater:(e,t,r,s)=>e.greaterThan(t).mix(r,s),mx_ifgreatereq:(e,t,r,s)=>e.greaterThanEqual(t).mix(r,s),mx_invert:(e,t=yn(1))=>Pa(t,e),mx_modulo:(e,t=yn(1))=>Ia(e,t),mx_multiply:(e,t=yn(1))=>Da(e,t),mx_noise_float:(e=kl(),t=1,r=0)=>$v(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec3:(e=kl(),t=1,r=0)=>Wv(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec4:(e=kl(),t=1,r=0)=>{e=e.convert("vec2|vec3");return Cn(Wv(e),$v(e.add(_n(19,73)))).mul(t).add(r)},mx_place2d:(e,t=_n(.5,.5),r=_n(1,1),s=yn(0),i=_n(0,0))=>{let n=e;if(t&&(n=n.sub(t)),r&&(n=n.mul(r)),s){const e=s.mul(Math.PI/180),t=e.cos(),r=e.sin();n=_n(n.x.mul(t).sub(n.y.mul(r)),n.x.mul(r).add(n.y.mul(t)))}return t&&(n=n.add(t)),i&&(n=n.add(i)),n},mx_power:(e,t=yn(1))=>ou(e,t),mx_ramp4:(e,t,r,s,i=kl())=>{const n=i.x.clamp(),a=i.y.clamp(),o=gu(e,t,n),u=gu(r,s,n);return gu(o,u,a)},mx_ramplr:(e,t,r=kl())=>dN(e,t,r,"x"),mx_ramptb:(e,t,r=kl())=>dN(e,t,r,"y"),mx_rgbtohsv:oN,mx_rotate2d:(e,t)=>{e=_n(e);const r=(t=yn(t)).mul(Math.PI/180);return iy(e,r)},mx_rotate3d:(e,t,r)=>{e=Rn(e),t=yn(t),r=Rn(r);const s=t.mul(Math.PI/180),i=r.normalize(),n=s.cos(),a=s.sin(),o=yn(1).sub(n);return e.mul(n).add(i.cross(e).mul(a)).add(i.mul(i.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=yn(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},s=t.replace(/^out/,"").toLowerCase();if(void 0!==r[s])return e.element(r[s])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==r[t])return e.element(r[t])}return e},mx_splitlr:(e,t,r,s=kl())=>cN(e,t,r,s,"x"),mx_splittb:(e,t,r,s=kl())=>cN(e,t,r,s,"y"),mx_srgb_texture_to_lin_rec709:uN,mx_subtract:(e,t=yn(0))=>Pa(e,t),mx_timer:()=>kb,mx_transform_uv:(e=1,t=0,r=kl())=>r.mul(e).add(t),mx_unifiednoise2d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>iN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_unifiednoise3d:(e,t=kl(),r=_n(1,1),s=_n(0,0),i=1,n=0,a=1,o=!1,u=1,l=2,d=.5)=>nN(e,t.convert("vec2|vec3"),r,s,i,n,a,o,u,l,d),mx_worley_noise_float:(e=kl(),t=1)=>tN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec2:(e=kl(),t=1)=>rN(e.convert("vec2|vec3"),t,bn(1)),mx_worley_noise_vec3:(e=kl(),t=1)=>sN(e.convert("vec2|vec3"),t,bn(1)),negate:zo,neutralToneMapping:mT,nodeArray:nn,nodeImmutable:on,nodeObject:tn,nodeObjectIntent:rn,nodeObjects:sn,nodeProxy:an,nodeProxyIntent:un,normalFlat:_c,normalGeometry:xc,normalLocal:Tc,normalMap:Rh,normalView:Sc,normalViewGeometry:vc,normalWorld:Rc,normalWorldGeometry:Nc,normalize:Ro,not:qa,notEqual:Va,numWorkgroups:BT,objectDirection:zd,objectGroup:va,objectPosition:Wd,objectRadius:jd,objectScale:Hd,objectViewPosition:qd,objectWorldMatrix:$d,oneMinus:$o,or:Ha,orthographicDepthToViewZ:eg,oscSawtooth:(e=kb)=>e.fract(),oscSine:(e=kb)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=kb)=>e.fract().round(),oscTriangle:(e=kb)=>e.add(.5).fract().mul(2).sub(1).abs(),output:oa,outputStruct:lb,overloadingFn:Vb,packHalf2x16:Cb,packSnorm2x16:Ab,packUnorm2x16:wb,parabola:Rb,parallaxDirection:Th,parallaxUV:(e,t)=>e.sub(Th.mul(t)),parameter:(e,t)=>new sb(e,t),pass:(e,t,r)=>new iT(iT.COLOR,e,t,r),passTexture:(e,t)=>new rT(e,t),pcurve:(e,t,r)=>ou(Ua(ou(e,t),La(ou(e,t),ou(Pa(1,e),r))),1/t),perspectiveDepthToViewZ:sg,pmremTexture:Vf,pointShadow:pv,pointUV:Cx,pointWidth:da,positionGeometry:uc,positionLocal:lc,positionPrevious:dc,positionView:pc,positionViewDirection:gc,positionWorld:cc,positionWorldDirection:hc,posterize:Yx,pow:ou,pow2:uu,pow3:lu,pow4:du,premultiplyAlpha:Tg,property:Vn,quadBroadcast:g_,quadSwapDiagonal:u_,quadSwapX:a_,quadSwapY:o_,radians:mo,rand:Tu,range:wT,rangeFogFactor:_T,reciprocal:jo,reference:qc,referenceBuffer:jc,reflect:ru,reflectVector:Oc,reflectView:Uc,reflector:e=>new lx(e),refract:yu,refractVector:Vc,refractView:Ic,reinhardToneMapping:oT,remap:El,remapClamp:Al,renderGroup:_a,renderOutput:Fl,rendererReference:el,replaceDefaultUV:function(e,t=null){return Cu(t,{getUV:"function"==typeof e?e:()=>e})},rotate:iy,rotateUV:$b,roughness:Wn,round:qo,rtt:yx,sRGBTransferEOTF:Hu,sRGBTransferOETF:qu,sample:(e,t=null)=>new Nx(e,tn(t)),sampler:e=>(!0===e.isNode?e:Kl(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:Kl(e)).convert("samplerComparison"),saturate:fu,saturation:qx,screenCoordinate:dd,screenDPR:od,screenSize:ld,screenUV:ud,select:Au,setCurrentStack:hn,setName:Bu,shaderStages:oi,shadow:ev,shadowPositionWorld:w_,shapeCircle:xv,sharedUniformGroup:xa,sheen:Xn,sheenRoughness:Kn,shiftLeft:Za,shiftRight:Ja,shininess:aa,sign:ko,sin:Ao,sinc:(e,t)=>Ao(uo.mul(t.mul(e).sub(1))).div(uo.mul(t.mul(e).sub(1))),sinh:wo,skinning:Cp,smoothstep:bu,smoothstepElement:vu,specularColor:sa,specularColorBlended:ia,specularF90:na,spherizeUV:Wb,split:(e,t)=>new yi(tn(e),t),spritesheetUV:jb,sqrt:_o,stack:nb,step:tu,stepElement:Nu,storage:Tp,storageBarrier:()=>IT("storage").toStack(),storageTexture:Dx,string:(e="")=>new vi(e,"string"),struct:(e,t=null)=>{const r=new ab(e,t),s=(...t)=>{let s=null;if(t.length>0)if(t[0].isNode){s={};const r=Object.keys(e);for(let e=0;eOx(e,t).level(r),texture3DLoad:(...e)=>Ox(...e).setSampler(!1),textureBarrier:()=>IT("texture").toStack(),textureBicubic:Fm,textureBicubicLevel:Bm,textureCubeUV:df,textureLevel:(e,t,r)=>Kl(e,t).level(r),textureLoad:Ql,textureSize:zl,textureStore:(e,t,r)=>{let s;return!0===e.isStorageTextureNode?(s=e.clone(),s.uvNode=t,s.storeNode=r):s=Dx(e,t,r),null!==r&&s.toStack(),s},thickness:pa,time:kb,toneMapping:rl,toneMappingExposure:sl,toonOutlinePass:(t,r,s=new e(0,0,0),i=.003,n=1)=>new nT(t,r,tn(s),tn(i),tn(n)),transformDirection:cu,transformNormal:Ac,transformNormalToView:wc,transformedClearcoatNormalView:Bc,transformedNormalView:Cc,transformedNormalWorld:Mc,transmission:ha,transpose:Qo,triNoise3D:Ub,triplanarTexture:(...e)=>Xb(...e),triplanarTextures:Xb,trunc:Xo,uint:xn,uintBitsToFloat:e=>new fb(e,"float","uint"),uniform:Sa,uniformArray:td,uniformCubeTexture:(e=kc)=>zc(e),uniformFlow:Mu,uniformGroup:ba,uniformTexture:(e=ql)=>Kl(e),unpackHalf2x16:Lb,unpackNormal:Nh,unpackSnorm2x16:Bb,unpackUnorm2x16:Fb,unpremultiplyAlpha:_g,userData:(e,t,r)=>new Vx(e,t,r),uv:kl,uvec2:Nn,uvec3:An,uvec4:Bn,varying:$u,varyingProperty:kn,vec2:_n,vec3:Rn,vec4:Cn,vectorComponents:ui,velocity:Wx,vertexColor:gg,vertexIndex:hl,vertexStage:Wu,vibrance:jx,viewZToLogarithmicDepth:ig,viewZToOrthographicDepth:Jp,viewZToPerspectiveDepth:tg,viewZToReversedOrthographicDepth:(e,t,r)=>e.add(r).div(r.sub(t)),viewZToReversedPerspectiveDepth:rg,viewport:cd,viewportCoordinate:pd,viewportDepthTexture:Yp,viewportLinearDepth:ug,viewportMipTexture:qp,viewportOpaqueMipTexture:Xp,viewportResolution:md,viewportSafeUV:qb,viewportSharedTexture:eT,viewportSize:hd,viewportTexture:Hp,viewportUV:gd,vogelDiskSample:vx,wgsl:(e,t)=>yT(e,t,"wgsl"),wgslFn:(e,t)=>xT(e,t,"wgsl"),workgroupArray:(e,t)=>new VT("Workgroup",e,t),workgroupBarrier:()=>IT("workgroup").toStack(),workgroupId:FT,workingToColorSpace:Ku,xor:ja});const mN=new rb;class fN extends Ry{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,r){const s=this.renderer,i=this.nodes.getBackgroundNode(e)||e.background;let n=!1;if(null===i)s._clearColor.getRGB(mN),mN.a=s._clearColor.a;else if(!0===i.isColor)i.getRGB(mN),mN.a=1,n=!0;else if(!0===i.isNode){const u=this.get(e),l=i;mN.copy(s._clearColor);let d=u.backgroundMesh;if(void 0===d){const h=Cn(l).mul(Fx).context({getUV:()=>Lx.mul(Nc),getTextureLevel:()=>Bx}),p=Ld.element(3).element(3).equal(1),g=Ua(1,Ld.element(1).element(1)).mul(3),m=p.select(lc.mul(g),lc),f=sc.mul(Cn(m,0));let y=Ld.mul(Cn(f.xyz,1));y=y.setZ(y.w);const b=new vg;function x(){i.removeEventListener("dispose",x),d.material.dispose(),d.geometry.dispose()}b.name="Background.material",b.side=L,b.depthTest=!1,b.depthWrite=!1,b.allowOverride=!1,b.fog=!1,b.lights=!1,b.vertexNode=y,b.colorNode=h,u.backgroundMeshNode=h,u.backgroundMesh=d=new oe(new ft(1,32,32),b),d.frustumCulled=!1,d.name="Background.mesh",i.addEventListener("dispose",x)}const c=l.getCacheKey();u.backgroundCacheKey!==c&&(u.backgroundMeshNode.node=Cn(l).mul(Fx),u.backgroundMeshNode.needsUpdate=!0,d.material.needsUpdate=!0,u.backgroundCacheKey=c),t.unshift(d,d.geometry,d.material,0,0,null,null)}else o("Renderer: Unsupported background configuration.",i);const a=s.xr.getEnvironmentBlendMode();if("additive"===a?mN.set(0,0,0,1):"alpha-blend"===a&&mN.set(0,0,0,0),!0===s.autoClear||!0===n){const T=r.clearColorValue;T.r=mN.r,T.g=mN.g,T.b=mN.b,T.a=mN.a,!0!==s.backend.isWebGLBackend&&!0!==s.alpha||(T.r*=T.a,T.g*=T.a,T.b*=T.a),r.depthClearValue=s.getClearDepth(),r.stencilClearValue=s.getClearStencil(),r.clearColor=!0===s.autoClearColor,r.clearDepth=!0===s.autoClearDepth,r.clearStencil=!0===s.autoClearStencil}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}}let yN=0;class bN{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=yN++}}class xN{constructor(e,t,r,s,i,n,a,o,u,l=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=l,this.nodeAttributes=s,this.bindings=i,this.updateNodes=n,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=u,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const r=new bN(t.name,[]);e.push(r);for(const e of t.bindings)r.bindings.push(e.clone())}else e.push(t)}return e}}class TN{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}}class _N{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class vN{constructor(e,t,r=!1,s=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=s}}class NN extends vN{constructor(e,t,r=null,s=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=s}}class SN{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}let RN=0;class EN{constructor(e=null){this.id=RN++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class AN{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class wN{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class CN extends wN{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class MN extends wN{constructor(e,r=new t){super(e,r),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class BN extends wN{constructor(e,t=new r){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class FN extends wN{constructor(e,t=new s){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class LN extends wN{constructor(t,r=new e){super(t,r),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class PN extends wN{constructor(e,t=new i){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class DN extends wN{constructor(e,t=new n){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class UN extends wN{constructor(e,t=new a){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class IN extends CN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class ON extends MN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class VN extends BN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kN extends FN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class GN extends LN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zN extends PN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class $N extends DN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class WN extends UN{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let HN=0;const qN=new WeakMap,jN=new WeakMap,XN=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),KN=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class QN{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=nb(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new EN,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:HN++})}isFlatShading(){return!0===this.material.flatShading||!1===this.geometry.hasAttribute("normal")}isOpaque(){const e=this.material;return!1===e.transparent&&e.blending===tt&&!1===e.alphaToCoverage}createRenderTarget(e,t,r){return new ne(e,t,r)}createCubeRenderTarget(e,t){return new Fg(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const r=t[0].groupNode;let s,i=r.shared;if(i)for(let e=1;ee.nodeUniform.node.id-t.nodeUniform.node.id);for(const t of e.uniforms)r+=t.nodeUniform.node.id}else r+=e.nodeUniform.id;const i=this.renderer._currentRenderContext||this.renderer;let n=qN.get(i);void 0===n&&(n=new Map,qN.set(i,n));const a=Vs(r);s=n.get(a),void 0===s&&(s=new bN(e,t),n.set(a,s))}else s=new bN(e,t);return s}getBindGroupArray(e,t){const r=this.bindings[t];let s=r[e];return void 0===s&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=s=[]),s}getBindings(){let e=this.bindGroups;if(null===e){const t={},r=this.bindings;for(const e of oi)for(const s in r[e]){const i=r[e][s],n=t[s]||(t[s]=[]);for(const e of i)!1===n.includes(e)&&n.push(e)}e=[];for(const r in t){const s=t[r],i=this._getBindGroup(r,s);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(n)}u`:"0u";if("bool"===i)return n?"true":"false";if("color"===i)return`${this.getType("vec3")}( ${KN(n.r)}, ${KN(n.g)}, ${KN(n.b)} )`;const a=this.getTypeLength(i),o=this.getComponentType(i),u=e=>this.generateConst(o,e);if(2===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)} )`;if(3===a)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)} )`;if(4===a&&"mat2"!==i)return`${this.getType(i)}( ${u(n.x)}, ${u(n.y)}, ${u(n.z)}, ${u(n.w)} )`;if(a>=4&&n&&(n.isMatrix2||n.isMatrix3||n.isMatrix4))return`${this.getType(i)}( ${n.elements.map(u).join(", ")} )`;if(a>4)return`${this.getType(i)}()`;throw new Error(`NodeBuilder: Type '${i}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const r=this.attributes;for(const t of r)if(t.name===e)return t;const s=new TN(e,t);return this.registerDeclaration(s),r.push(s),s}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===R)return"int";if(t===S)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let r=Ws(e);const s="float"===t?"":t[0];return!0===/mat2/.test(t)&&(r=r.replace("vec","mat")),s+r}getTypeFromArray(e){return XN.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const r=t.array,s=e.itemSize,i=e.normalized;let n;return e instanceof xt||!0===i||(n=this.getTypeFromArray(r)),this.getTypeFromLength(s,n)}getTypeLength(e){const t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]!==e)throw new Error("NodeBuilder: Invalid active stack removal.");this.activeStacks.pop()}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=nb(this.stack);const e=pn();return this.stacks.push(e),hn(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){this.getDataFromNode(t).stack=e}return this.stack=e.parent,hn(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){let s=(r=null===r?e.isGlobal(this)?this.globalCache:this.cache:r).getData(e);void 0===s&&(s={},r.setData(e,s)),void 0===s[t]&&(s[t]={});let i=s[t];const n=s.any?s.any.subBuilds:null,a=this.getClosestSubBuild(n);return a&&(void 0===i.subBuildsCache&&(i.subBuildsCache={}),i=i.subBuildsCache[a]||(i.subBuildsCache[a]={}),i.subBuilds=n),i}getNodeProperties(e,t="any"){const r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const r=this.getDataFromNode(e,"vertex");let s=r.bufferAttribute;if(void 0===s){const i=this.uniforms.index++;s=new TN("nodeAttribute"+i,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,s=this.shaderStage){const i=this.getDataFromNode(e,s,this.globalCache);let n=i.structType;if(void 0===n){const a=this.structs.index++;null===r&&(r="StructType"+a),n=new AN(r,t),this.structs[s].push(n),this.types[s][r]=e,i.structType=n}return n}getOutputStructTypeFromNode(e,t){const r=this.getStructTypeFromNode(e,t,"OutputType","fragment");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,s=null){const i=this.getDataFromNode(e,r,this.globalCache);let n=i.uniform;if(void 0===n){const a=this.uniforms.index++;n=new _N(s||"nodeUniform"+a,t,e),this.uniforms[r].push(n),this.registerDeclaration(n),i.uniform=n}return n}getVarFromNode(e,t=null,r=e.getNodeType(this),s=this.shaderStage,i=!1){const n=this.getDataFromNode(e,s),a=this.getSubBuildProperty("variable",n.subBuilds);let o=n[a];if(void 0===o){const u=i?"_const":"_var",l=this.vars[s]||(this.vars[s]=[]),d=this.vars[u]||(this.vars[u]=0);null===t&&(t=(i?"nodeConst":"nodeVar")+d,this.vars[u]++),"variable"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds));const c=e.getArrayCount(this);o=new vN(t,r,i,c),i||l.push(o),this.registerDeclaration(o),n[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,r=e.getNodeType(this),s=null,i=null){const n=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",n.subBuilds);let o=n[a];if(void 0===o){const e=this.varyings,u=e.length;null===t&&(t="nodeVarying"+u),"varying"!==a&&(t=this.getSubBuildProperty(t,n.subBuilds)),o=new NN(t,r,s,i),e.push(o),this.registerDeclaration(o),n[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),s=this.getPropertyName(e);let i=1,n=s;for(;void 0!==r[n];)n=s+"_"+i++;i>1&&(e.name=n,d(`TSL: Declaration name '${s}' of '${e.type}' already in use. Renamed to '${n}'.`)),r[n]=e}getCodeFromNode(e,t,r=this.shaderStage){const s=this.getDataFromNode(e);let i=s.code;if(void 0===i){const e=this.codes[r]||(this.codes[r]=[]),n=e.length;i=new SN("nodeCode"+n,t),e.push(i),s.code=i}return i}addFlowCodeHierarchy(e,t){const{flowCodes:r,flowCodeBlock:s}=this.getDataFromNode(e);let i=!0,n=t;for(;n;){if(!0===s.get(n)){i=!1;break}n=this.getDataFromNode(n).parentNodeBlock}if(i)for(const e of r)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,r){const s=this.getDataFromNode(e),i=s.flowCodes||(s.flowCodes=[]),n=s.flowCodeBlock||(s.flowCodeBlock=new WeakMap);i.push(t),n.set(r,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new bT,r=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=r,t}flowShaderNode(e){const t=e.layout,r={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const e of t.inputs)r[e.name]=new sb(e.type,e.name);e.layout=null;const s=e.call(r),i=this.flowStagesNode(s,t.type);return e.layout=t,i}flowBuildStage(e,t,r=null){const s=this.getBuildStage();this.setBuildStage(t);const i=e.build(this,r);return this.setBuildStage(s),i}flowStagesNode(e,t=null){const r=this.flow,s=this.vars,i=this.declarations,n=this.cache,a=this.buildStage,o=this.stack,u={code:""};this.flow=u,this.vars={},this.declarations={},this.cache=new EN,this.stack=nb();for(const r of ai)this.setBuildStage(r),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=s,this.declarations=i,this.cache=n,this.stack=o,this.setBuildStage(a),u}getFunctionOperator(){return null}buildFunctionCode(){d("Abstract function.")}flowChildNode(e,t=null){const r=this.flow,s={code:""};return this.flow=s,s.result=e.build(this,t),this.flow=r,s}flowNodeFromShaderStage(e,t,r=null,s=null){const i=this.tab,n=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const u={...this.context};delete u.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=u;let l=null;if("generate"===this.buildStage){const i=this.flowChildNode(t,r);null!==s&&(i.code+=`${this.tab+s} = ${i.result};\n`),this.flowCode[e]=this.flowCode[e]+i.code,l=i}else l=t.build(this);return this.setShaderStage(a),this.cache=n,this.tab=i,this.context=o,l}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){d("Abstract function.")}getVaryings(){d("Abstract function.")}getVar(e,t,r=null){return`${null!==r?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e,t=!1){const r=[],s=this.vars[e];if(void 0!==s)for(const e of s)r.push(`${this.getVar(e.type,e.name,e.count)};`);return r.join(t?"\n":"\n\t")}getUniforms(){d("Abstract function.")}getCodes(e){const t=this.codes[e];let r="";if(void 0!==t)for(const e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){d("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const r=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){const s=t[e];if(r.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let r,s;return r=null!==t?this.getClosestSubBuild(t):this.subBuildFn,s=r?e?r+"_"+e:r:e,s}prebuild(){const{object:e,renderer:t,material:r}=this;if(!0===t.contextNode.isContextNode?this.context={...this.context,...t.contextNode.getFlowContextData()}:o('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),r&&r.contextNode&&(!0===r.contextNode.isContextNode?this.context={...this.context,...r.contextNode.getFlowContextData()}:o('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),null!==r){let e=t.library.fromMaterial(r);null===e&&(o(`NodeBuilder: Material "${r.type}" is not compatible.`),e=new vg),e.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(const e of ai){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of oi){this.setShaderStage(t);const r=this.flowNodes[t];for(const t of r)"generate"===e?this.flowNode(t):t.build(this);await Tt()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=jN.get(e);return void 0===t&&(t={}),t}getNodeUniform(e,t){const r=this.getSharedDataFromNode(e);let s=r.cache;if(void 0===s){if("float"===t||"int"===t||"uint"===t)s=new IN(e);else if("vec2"===t||"ivec2"===t||"uvec2"===t)s=new ON(e);else if("vec3"===t||"ivec3"===t||"uvec3"===t)s=new VN(e);else if("vec4"===t||"ivec4"===t||"uvec4"===t)s=new kN(e);else if("color"===t)s=new GN(e);else if("mat2"===t)s=new zN(e);else if("mat3"===t)s=new $N(e);else{if("mat4"!==t)throw new Error(`Uniform "${t}" not implemented.`);s=new WN(e)}r.cache=s}return s}format(e,t,r){if((t=this.getVectorType(t))===(r=this.getVectorType(r))||null===r||this.isReference(r))return e;const s=this.getTypeLength(t),i=this.getTypeLength(r);return 16===s&&9===i?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===s&&4===i?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:s>4||i>4||0===i?e:s===i?`${this.getType(r)}( ${e} )`:s>i?(e="bool"===r?`all( ${e} )`:`${e}.${"xyz".slice(0,i)}`,this.format(e,this.getTypeFromLength(i,this.getComponentType(t)),r)):4===i&&s>1?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===s?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===s&&i>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r${_t} - Node System\n`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||!0===Ys(this.object).useVelocity}}class YN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return void 0===r&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){const t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateBeforeMap,r);if(t.frameId!==this.frameId){const r=t.frameId;t.frameId=this.frameId,!1===e.updateBefore(this)&&(t.frameId=r)}}else if(t===ri.RENDER){const t=this._getMaps(this.updateBeforeMap,r);if(t.renderId!==this.renderId){const r=t.renderId;t.renderId=this.renderId,!1===e.updateBefore(this)&&(t.renderId=r)}}else t===ri.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateAfterMap,r);t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateAfterMap,r);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),r=e.updateReference(this);if(t===ri.FRAME){const t=this._getMaps(this.updateMap,r);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===ri.RENDER){const t=this._getMaps(this.updateMap,r);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===ri.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class ZN{constructor(e,t,r=null,s="",i=!1){this.type=e,this.name=t,this.count=r,this.qualifier=s,this.isConst=i}}ZN.isNodeFunctionInput=!0;class JN extends gv{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class eS extends gv{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:v_(this.light),lightColor:e}}}class tS extends gv{static get type(){return"HemisphereLightNode"}constructor(t=null){super(t),this.lightPositionNode=x_(t),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Sa(new e).setGroup(_a)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:r,lightDirectionNode:s}=this,i=Rc.dot(s).mul(.5).add(.5),n=gu(r,t,i);e.context.irradiance.addAssign(n)}}class rS extends gv{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Sa(0).setGroup(_a),this.penumbraCosNode=Sa(0).setGroup(_a),this.cutoffDistanceNode=Sa(0).setGroup(_a),this.decayExponentNode=Sa(0).setGroup(_a),this.colorNode=Sa(this.color).setGroup(_a)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:r,penumbraCosNode:s}=this;return bu(r,s,t)}getLightCoord(e){const t=e.getNodeProperties(this);let r=t.projectionUV;return void 0===r&&(r=b_(this.light,e.context.positionWorld),t.projectionUV=r),r}setupDirect(e){const{colorNode:t,cutoffDistanceNode:r,decayExponentNode:s,light:i}=this,n=this.getLightVector(e),a=n.normalize(),o=a.dot(v_(i)),u=this.getSpotAttenuation(e,o),l=n.length(),d=mv({lightDistance:l,cutoffDistance:r,decayExponent:s});let c,h,p=t.mul(u).mul(d);if(i.colorNode?(h=this.getLightCoord(e),c=i.colorNode(h)):i.map&&(h=this.getLightCoord(e),c=Kl(i.map,h.xy).onRenderUpdate(()=>i.map)),c){p=h.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(c),p)}return{lightColor:p,lightDirection:a}}}class sS extends rS{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const r=this.light.iesMap;let s=null;if(r&&!0===r.isTexture){const e=t.acos().mul(1/Math.PI);s=Kl(r,_n(e,0),0).r}else s=super.getSpotAttenuation(t);return s}}class iS extends gv{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new r);this.lightProbe=td(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=pN(Rc,this.lightProbe);e.context.irradiance.addAssign(t)}}const nS=cn(([e,t])=>{const r=e.abs().sub(t);return Go(eu(r,0)).add(Jo(eu(r.x,r.y),0))});class aS extends rS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=yn(0),r=this.penumbraCosNode,s=y_(this.light).mul(e.context.positionWorld||cc);return gn(s.w.greaterThan(0),()=>{const e=s.xyz.div(s.w),i=nS(e.xy.sub(_n(.5)),_n(.5)),n=Ua(-1,Pa(1,Do(r)).sub(1));t.assign(fu(i.mul(-2).mul(n)))}),t}}const oS=new a,uS=new a;let lS=null;class dS extends gv{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Sa(new r).setGroup(_a),this.halfWidth=Sa(new r).setGroup(_a),this.updateType=ri.RENDER}update(e){super.update(e);const{light:t}=this,r=e.camera.matrixWorldInverse;uS.identity(),oS.copy(t.matrixWorld),oS.premultiply(r),uS.extractRotation(oS),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(uS),this.halfHeight.value.applyMatrix4(uS)}setupDirectRectArea(e){let t,r;e.isAvailable("float32Filterable")?(t=Kl(lS.LTC_FLOAT_1),r=Kl(lS.LTC_FLOAT_2)):(t=Kl(lS.LTC_HALF_1),r=Kl(lS.LTC_HALF_2));const{colorNode:s,light:i}=this;return{lightColor:s,lightPosition:__(i),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){lS=e}}class cS{parseFunction(){d("Abstract function.")}}class hS{constructor(e,t,r="",s=""){this.type=e,this.inputs=t,this.name=r,this.precision=s}getCode(){d("Abstract function.")}}hS.isNodeFunction=!0;const pS=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,gS=/[a-z_0-9]+/gi,mS="#pragma main";class fS extends hS{constructor(e){const{type:t,inputs:r,name:s,precision:i,inputsCode:n,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(mS),r=-1!==t?e.slice(t+12):e,s=r.match(pS);if(null!==s&&5===s.length){const i=s[4],n=[];let a=null;for(;null!==(a=gS.exec(i));)n.push(a);const o=[];let u=0;for(;u{let r=this._createNodeBuilder(e,e.material);try{t?await r.buildAsync():r.build()}catch(s){r=this._createNodeBuilder(e,new vg),t?await r.buildAsync():r.build(),o("TSL: "+s)}return r})().then(e=>(s=this._createNodeBuilderState(e),i.set(n,s),s.usedTimes++,r.nodeBuilderState=s,s));{let t=this._createNodeBuilder(e,e.material);try{t.build()}catch(r){t=this._createNodeBuilder(e,new vg),t.build();let s=r.stackTrace;!s&&r.stack&&(s=new Is(r.stack)),o("TSL: "+r,s)}s=this._createNodeBuilderState(t),i.set(n,s)}}s.usedTimes++,r.nodeBuilderState=s}return s}getForRenderAsync(e){const t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){const t=this.get(e);if(void 0!==t.nodeBuilderState)return t.nodeBuilderState;const r=this.getForRenderCacheKey(e),s=this.nodeBuilderCache.get(r);return void 0!==s?(s.usedTimes++,t.nodeBuilderState=s,s):(!0!==t.pendingBuild&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||0===this._buildQueue.length)return;this._buildInProgress=!0;this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;void 0!==t&&(t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){const t=this.get(e);let r=t.nodeBuilderState;if(void 0===r){const s=this.backend.createNodeBuilder(e,this.renderer);s.build(),r=this._createNodeBuilderState(s),t.nodeBuilderState=r}return r}_createNodeBuilderState(e){return new xN(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){bS[0]=e,bS[1]=t;const r=this.renderer.info.calls,s=this.callHashCache.get(bS)||{};if(s.callId!==r){const i=this.getEnvironmentNode(e),n=this.getFogNode(e);t&&xS.push(t.getCacheKey(!0)),i&&xS.push(i.getCacheKey()),n&&xS.push(n.getCacheKey()),xS.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),xS.push(this.renderer.shadowMap.enabled?1:0),xS.push(this.renderer.shadowMap.type),s.callId=r,s.cacheKey=ks(xS),this.callHashCache.set(bS,s),xS.length=0}return bS[0]=null,bS[1]=null,s.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),r=e.background;if(r){const s=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==r||s){const i=this.getCacheNode("background",r,()=>{if(!0===r.isCubeTexture||r.mapping===ce||r.mapping===he||r.mapping===Ae){if(e.backgroundBlurriness>0||r.mapping===Ae)return Vf(r);{let e;return e=!0===r.isCubeTexture?$c(r):Kl(r),Ig(e)}}if(!0===r.isTexture)return Kl(r,ud.flipY()).setUpdateMatrix(!0);!0!==r.isColor&&o("WebGPUNodes: Unsupported background configuration.",r)},s);t.backgroundNode=i,t.background=r,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,s=!1){const i=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let n=i.get(t);return(void 0===n||s)&&(n=r(),i.set(t,n)),n}updateFog(e){const t=this.get(e),r=e.fog;if(r){if(t.fog!==r){const e=this.getCacheNode("fog",r,()=>{if(r.isFogExp2){const e=qc("color","color",r).setGroup(_a),t=qc("density","float",r).setGroup(_a);return ST(e,vT(t))}if(r.isFog){const e=qc("color","color",r).setGroup(_a),t=qc("near","float",r).setGroup(_a),s=qc("far","float",r).setGroup(_a);return ST(e,_T(t,s))}o("Renderer: Unsupported fog configuration.",r)});t.fogNode=e,t.fog=r}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),r=e.environment;if(r){if(t.environment!==r){const e=this.getCacheNode("environment",r,()=>!0===r.isCubeTexture?$c(r):!0===r.isTexture?Kl(r):void o("Nodes: Unsupported environment configuration.",r));t.environmentNode=e,t.environment=r}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,s=null,i=null){const n=this.nodeFrame;return n.renderer=e,n.scene=t,n.object=r,n.camera=s,n.material=i,n}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){const t=this.renderer;return e.isArrayTexture?Kl(e,ud).depth(sd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):Kl(e,ud).renderOutput(t.toneMapping,t.currentColorSpace)}updateBefore(e){const t=e.getNodeBuilderState();for(const r of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(r)}updateAfter(e){const t=e.getNodeBuilderState();for(const r of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(r)}updateForCompute(e){const t=this.getNodeFrame(),r=this.getForCompute(e);for(const e of r.updateNodes)t.updateNode(e)}updateForRender(e){const t=this.getNodeFrameForRender(e),r=e.getNodeBuilderState();for(const e of r.updateNodes)t.updateNode(e)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new YN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const _S=new ut;class vS{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new n,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,r){const s=e.length;for(let i=0;iFl(e,i.toneMapping,i.outputColorSpace)}),LS.set(r,n))}else n=r;i.contextNode=n,i.setRenderTarget(t.renderTarget),t.rendercall(),i.contextNode=r}i.setRenderTarget(o),i._setXRLayerSize(a.x,a.y),this.isPresenting=n}getSession(){return this._session}async setSession(e){const t=this._renderer,r=t.backend;this._gl=t.getContext();const s=this._gl,i=s.getContextAttributes();if(this._session=e,null!==e){if(!0===r.isWebGPUBackend)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await r.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),!0===this._supportsLayers){let r=null,n=null,a=null;t.depth&&(a=t.stencil?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24,r=t.stencil?qe:He,n=t.stencil?Ze:S);const o={colorFormat:s.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const u=this._glBinding.createProjectionLayer(o),l=[u];this._glProjLayer=u,t.setPixelRatio(1),t._setXRLayerSize(u.textureWidth,u.textureHeight);const d=this._useMultiview?2:1,c=new Z(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,r,d);if(this._xrRenderTarget=new MS(u.textureWidth,u.textureHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,depthTexture:c,stencilBuffer:t.stencil,samples:i.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const e of this._layers)e.plane.material=new fe({color:16777215,side:"cylinder"===e.type?L:St}),e.plane.material.blending=Rt,e.plane.material.blendEquation=it,e.plane.material.blendSrc=Et,e.plane.material.blendDst=Et,e.xrlayer=this._createXRLayer(e),l.unshift(e.xrlayer);e.updateRenderState({layers:l})}else{const r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},i=new XRWebGLLayer(e,s,r);this._glBaseLayer=i,e.updateRenderState({baseLayer:i}),t.setPixelRatio(1),t._setXRLayerSize(i.framebufferWidth,i.framebufferHeight),this._xrRenderTarget=new MS(i.framebufferWidth,i.framebufferHeight,{format:Ee,type:Ve,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===i.ignoreDepthValues,resolveStencilBuffer:!1===i.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(null===t)return;const r=e.near,s=e.far,i=this._cameraXR,n=this._cameraL,a=this._cameraR;i.near=a.near=n.near=r,i.far=a.far=n.far=s,i.isMultiViewCamera=this._useMultiview,this._currentDepthNear===i.near&&this._currentDepthFar===i.far||(t.updateRenderState({depthNear:i.near,depthFar:i.far}),this._currentDepthNear=i.near,this._currentDepthFar=i.far),i.layers.mask=6|e.layers.mask,n.layers.mask=-5&i.layers.mask,a.layers.mask=-3&i.layers.mask;const o=e.parent,u=i.cameras;DS(i,o);for(let e=0;e=0&&(r[n]=null,t[n].disconnect(i))}for(let s=0;s=r.length){r.push(i),n=e;break}if(null===r[e]){r[e]=i,n=e;break}}if(-1===n)break}const a=t[n];a&&a.connect(i)}}function VS(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function kS(e,t){if(void 0===t)return;const r=this._cameraXR,i=this._renderer,n=i.backend,a=this._glBaseLayer,o=this.getReferenceSpace(),u=t.getViewerPose(o);if(this._xrFrame=t,null!==u){const e=u.views;null!==this._glBaseLayer&&n.setXRTarget(a.framebuffer);let t=!1;e.length!==r.cameras.length&&(r.cameras.length=0,t=!0);for(let i=0;i{await this.compileAsync(e,t);const s=this._renderLists.get(e,t),i=this._renderContexts.get(this._renderTarget,this._mrt),n=e.overrideMaterial||r.material,a=this._objects.get(r,n,e,t,s.lightsNode,i,i.clippingContext),{fragmentShader:o,vertexShader:u}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:u}}}}async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=r=this._getFallback(e),await r.init(this)}catch(e){return void t(e)}}this._nodes=new TS(this,r),this._animation=new xy(this,this._nodes,this.info),this._attributes=new By(r,this.info),this._background=new fN(this,this._nodes),this._geometries=new Dy(this._attributes,this.info),this._textures=new tb(this,r,this.info),this._pipelines=new zy(r,this._nodes,this.info),this._bindings=new $y(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new Sy(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Ky(this.lighting),this._bundles=new RS,this._renderContexts=new Jy(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const s=this._nodes.nodeFrame,i=s.renderId,n=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._handleObjectFunction,u=this._compilationPromises;null===r&&(r=e);const l=!0===e.isScene?e:!0===r.isScene?r:$S,d=this.needsFrameBufferTarget&&null===this._renderTarget?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,c=this._renderContexts.get(d,this._mrt),h=this._activeMipmapLevel,p=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,s.renderId++,s.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new vS),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,d);const g=this._renderLists.get(l,t);if(g.begin(),this._projectObject(e,t,0,g,c.clippingContext),r!==e&&r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&g.pushLight(e)}),g.finish(),null!==d){this._textures.updateRenderTarget(d,h);const e=this._textures.get(d);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;r!==e?this._background.update(r,g,c):this._background.update(l,g,c);const m=g.opaque,f=g.transparent,y=g.transparentDoublePass,b=g.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,l,b),!0===this.transparent&&f.length>0&&this._renderTransparents(f,y,t,l,b),s.renderId=i,this._currentRenderContext=n,this._currentRenderObjectFunction=a,this._handleObjectFunction=o,this._compilationPromises=u;for(const e of p){const t=this._objects.get(e.object,e.material,e.scene,e.camera,e.lightsNode,e.renderContext,e.clippingContext,e.passId);t.drawRange=e.object.geometry.drawRange,t.group=e.group,this._geometries.updateForRender(t),await this._nodes.getForRenderAsync(t),this._nodes.updateBefore(t),this._nodes.updateForRender(t),this._bindings.updateForRender(t);const r=[];this._pipelines.getForRender(t,r),r.length>0&&await Promise.all(r),this._nodes.updateAfter(t),await Tt()}}async renderAsync(e,t){v('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){o("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;!0===e?(t.modelViewMatrix=nc,t.modelNormalViewMatrix=ac):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===nc&&e.modelNormalViewMatrix===ac}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return v('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),o(t),this._isDeviceLost=!0}_renderBundle(e,t,r){const{bundleGroup:s,camera:i,renderList:n}=e,a=this._currentRenderContext,o=this._bundles.get(s,i,a),u=this.backend.get(o),l=s.version!==u.version;if(l||void 0===u.bundleGPU){this.backend.beginBundle(a),(void 0===u.renderObjects||l)&&(u.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:d,opaque:c}=n;!0===this.opaque&&c.length>0&&this._renderObjects(c,i,t,r),!0===this.transparent&&d.length>0&&this._renderTransparents(d,e,i,t,r),this._currentRenderBundle=null,this.backend.finishBundle(a,o),u.version=s.version}else{const{renderObjects:e}=u;for(let t=0,r=e.length;t{u.removeEventListener("dispose",e),l.dispose(),this._frameBufferTargets.delete(u)};u.addEventListener("dispose",e),this._frameBufferTargets.set(u,l)}const d=this.getOutputRenderTarget();l.depthBuffer=a,l.stencilBuffer=o,null!==d?l.setSize(d.width,d.height,d.depth):l.setSize(i,n,1);const c=this._outputRenderTarget?this._outputRenderTarget.viewport:u._viewport,h=this._outputRenderTarget?this._outputRenderTarget.scissor:u._scissor,g=this._outputRenderTarget?1:u._pixelRatio,f=this._outputRenderTarget?this._outputRenderTarget.scissorTest:u._scissorTest;return l.viewport.copy(c),l.scissor.copy(h),l.viewport.multiplyScalar(g),l.scissor.multiplyScalar(g),l.scissorTest=f,l.multiview=null!==d&&d.multiview,l.resolveDepthBuffer=null===d||d.resolveDepthBuffer,l._autoAllocateDepthBuffer=null!==d&&d._autoAllocateDepthBuffer,l}_renderScene(e,t,r=!0){if(!0===this._isDeviceLost)return;const s=r?this._getFrameBufferTarget():null,i=this._nodes.nodeFrame,n=i.renderId,a=this._currentRenderContext,o=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;const l=!0===e.isScene?e:$S,d=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,h=this._activeMipmapLevel;let p;if(null!==s?(p=s,this.setRenderTarget(p)):p=d,null!==p&&!0===p.depthBuffer){const e=this._textures.get(p);!0!==e.depthInitialized&&((!1===this.autoClear||!0===this.autoClear&&!1===this.autoClearDepth)&&this.clearDepth(),e.depthInitialized=!0)}const g=this._renderContexts.get(p,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,i.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,p);const m=this.xr;if(!1===m.isPresenting){let e=!1;if(!0===this.reversedDepthBuffer&&!0!==t.reversedDepth){if(t._reversedDepth=!0,t.isArrayCamera)for(const e of t.cameras)e._reversedDepth=!0;e=!0}const r=this.coordinateSystem;if(t.coordinateSystem!==r){if(t.coordinateSystem=r,t.isArrayCamera)for(const e of t.cameras)e.coordinateSystem=r;e=!0}if(!0===e&&(t.updateProjectionMatrix(),t.isArrayCamera))for(const e of t.cameras)e.updateProjectionMatrix()}!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===m.enabled&&!0===m.isPresenting&&(!0===m.cameraAutoUpdate&&m.updateCamera(t),t=m.getCamera());const f=this._canvasTarget;let y=f._viewport,b=f._scissor,x=f._pixelRatio;null!==p&&(y=p.viewport,b=p.scissor,x=1),this.getDrawingBufferSize(WS),HS.set(0,0,WS.width,WS.height);const T=void 0===y.minDepth?0:y.minDepth,_=void 0===y.maxDepth?1:y.maxDepth;g.viewportValue.copy(y).multiplyScalar(x).floor(),g.viewportValue.width>>=h,g.viewportValue.height>>=h,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=_,g.viewport=!1===g.viewportValue.equals(HS),g.scissorValue.copy(b).multiplyScalar(x).floor(),g.scissor=f._scissorTest&&!1===g.scissorValue.equals(HS),g.scissorValue.width>>=h,g.scissorValue.height>>=h,g.clippingContext||(g.clippingContext=new vS),g.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,p);const v=t.isArrayCamera?jS:qS;t.isArrayCamera||(XS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),v.setFromProjectionMatrix(XS,t.coordinateSystem,t.reversedDepth));const N=this._renderLists.get(e,t);if(N.begin(),this._projectObject(e,t,0,N,g.clippingContext),N.finish(),!0===this.sortObjects&&N.sort(this._opaqueSort,this._transparentSort),null!==p){this._textures.updateRenderTarget(p,h);const e=this._textures.get(p);g.textures=e.textures,g.depthTexture=e.depthTexture,g.width=e.width,g.height=e.height,g.renderTarget=p,g.depth=p.depthBuffer,g.stencil=p.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=WS.width,g.height=WS.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=h,g.height>>=h,g.activeCubeFace=c,g.activeMipmapLevel=h,g.occlusionQueryCount=N.occlusionQueryCount,g.scissorValue.max(KS.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(l,N,g),g.camera=t,this.backend.beginRender(g);const{bundles:S,lightsNode:R,transparentDoublePass:E,transparent:A,opaque:w}=N;return S.length>0&&this._renderBundles(S,l,R),!0===this.opaque&&w.length>0&&this._renderObjects(w,t,l,R),!0===this.transparent&&A.length>0&&this._renderTransparents(A,E,t,l,R),this.backend.finishRender(g),i.renderId=n,this._currentRenderContext=a,this._currentRenderObjectFunction=o,this._handleObjectFunction=u,this._callDepth--,null!==s&&(this.setRenderTarget(d,c,h),this._renderOutput(p)),l.onAfterRender(this,e,t,p),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._nodes.getOutputCacheKey();let r,s=this._quadCache.get(e.texture);if(void 0===s){r=new gx(new vg),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),s={quad:r,cacheKey:t},this._quadCache.set(e.texture,s);const i=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",i)};e.texture.addEventListener("dispose",i)}else r=s.quad,s.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,s.cacheKey=t);const i=this.autoClear,n=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(r,r.camera,!1),this.autoClear=i,this.xr.enabled=n}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){let t=e;if(!0!==t.isReadbackBuffer){const r=e,s=this.backend.get(r);if(t=s.readbackBuffer,void 0===t){t=new zS(r);const e=()=>{r.removeEventListener("dispose",e),t.dispose(),delete s.readbackBuffer};r.addEventListener("dispose",e),s.readbackBuffer=t}}if(!1===this.info.memoryMap.has(t)){this.info.createReadbackBuffer(t);const e=()=>{t.removeEventListener("dispose",e),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",e)}return t.release(),await this.backend.getArrayBufferAsync(t)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,s){this._canvasTarget.setScissor(e,t,r,s)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,s,i=0,n=1){this._canvasTarget.setViewport(e,t,r,s,i,n)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return!0===this.reversedDepthBuffer?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(!1===this._initialized)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const s=this._renderTarget||this._getFrameBufferTarget();let i=null;if(null!==s){this._textures.updateRenderTarget(s);const e=this._textures.get(s);i=this._renderContexts.get(s,null,-1),i.textures=e.textures,i.depthTexture=e.depthTexture,i.width=e.width,i.height=e.height,i.renderTarget=s,i.depth=s.depthBuffer,i.stencil=s.stencilBuffer;const t=this.backend.getClearColor();i.clearColorValue.r=t.r,i.clearColorValue.g=t.g,i.clearColorValue.b=t.b,i.clearColorValue.a=t.a,i.clearDepthValue=this.getClearDepth(),i.clearStencilValue=this.getClearStencil(),i.activeCubeFace=this.getActiveCubeFace(),i.activeMipmapLevel=this.getActiveMipmapLevel(),!0===s.depthBuffer&&(e.depthInitialized=!0)}this.backend.clear(e,t,r,i),null!==s&&null===this._renderTarget&&this._renderOutput(s)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){v('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){v('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){v('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){v('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==m,t=this.currentColorSpace!==p.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:m}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:p.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){if(!0===this._initialized){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(const e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(const e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return d("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const r=this._nodes.nodeFrame,s=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const i=this.backend,n=this._pipelines,a=this._bindings,o=this._nodes,u=Array.isArray(e)?e:[e];if(void 0===u[0]||!0!==u[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");i.beginCompute(e);for(const r of u){if(!1===n.has(r)){const e=()=>{r.removeEventListener("dispose",e),n.delete(r),a.deleteForCompute(r),o.delete(r)};r.addEventListener("dispose",e);const t=r.onInitFunction;null!==t&&t.call(r,{renderer:this})}o.updateForCompute(r),a.updateForCompute(r);const s=a.getForCompute(r),u=n.getForCompute(r,s);i.compute(e,r,s,u,t)}i.finishCompute(e),r.renderId=s,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return v('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){v('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(!1===this._initialized)throw new Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=KS.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void o("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=KS.copy(t).floor()}else t=KS.set(0,0,e.image.width,e.image.height);let r,s=this._currentRenderContext;null!==s?r=s.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),null!==r&&(this._textures.updateRenderTarget(r),s=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,s,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,s=null,i=0,n=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,s,i,n),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,s,i,n=0,a=0){return this.backend.copyTextureToBuffer(e.textures[n],t,r,s,i,a)}_projectObject(e,t,r,s,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(i=i.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)s.pushLight(e);else if(e.isSprite){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsSprite(e,t)){!0===this.sortObjects&&KS.setFromMatrixPosition(e.matrixWorld).applyMatrix4(XS);const{geometry:t,material:n}=e;n.visible&&s.push(e,t,n,r,KS.z,null,i)}}else if(e.isLineLoop)o("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const n=t.isArrayCamera?jS:qS;if(!e.frustumCulled||n.intersectsObject(e,t)){const{geometry:t,material:n}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),KS.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(XS)),Array.isArray(n)){const a=t.groups;for(let o=0,u=a.length;o0){for(const{material:e}of t)e.side=L;this._renderObjects(t,r,s,i,"backSide");for(const{material:e}of t)e.side=St;this._renderObjects(e,r,s,i);for(const{material:e}of t)e.side=P}else this._renderObjects(e,r,s,i)}_renderObjects(e,t,r,s,i=null){for(let n=0,a=e.length;n(t.not().discard(),e))(u)}}e.depthNode&&e.depthNode.isNode&&(l=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:u,depthNode:l,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}renderObject(e,t,r,s,i,n,a,o=null,u=null){let l,d,c,h,p=!1;if(e.onBeforeRender(this,t,r,s,i,n),!0===i.allowOverride&&null!==t.overrideMaterial){const e=t.overrideMaterial;if(p=!0,l=e.isNodeMaterial?e.colorNode:null,d=e.isNodeMaterial?e.depthNode:null,c=e.isNodeMaterial?e.positionNode:null,h=t.overrideMaterial.side,i.positionNode&&i.positionNode.isNode&&(e.positionNode=i.positionNode),e.alphaTest=i.alphaTest,e.alphaMap=i.alphaMap,e.transparent=i.transparent||i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode||i.backdropNode&&i.backdropNode.isNode,e.isShadowPassMaterial){const{colorNode:t,depthNode:r,positionNode:s}=this._getShadowNodes(i);this.shadowMap.type===pt?e.side=null!==i.shadowSide?i.shadowSide:i.side:e.side=null!==i.shadowSide?i.shadowSide:QS[i.side],null!==t&&(e.colorNode=t),null!==r&&(e.depthNode=r),null!==s&&(e.positionNode=s)}i=e}!0===i.transparent&&i.side===P&&!1===i.forceSinglePass?(i.side=L,this._handleObjectFunction(e,i,t,r,a,n,o,"backSide"),i.side=St,this._handleObjectFunction(e,i,t,r,a,n,o,u),i.side=P):this._handleObjectFunction(e,i,t,r,a,n,o,u),p&&(t.overrideMaterial.colorNode=l,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=h),e.onAfterRender(this,t,r,s,i,n)}hasCompatibility(e){if(!1===this._initialized)throw new Error('Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,s,i,n,a,o){const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);if(u.drawRange=e.geometry.drawRange,u.group=n,null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(u),u.bundle=this._currentRenderBundle.bundleGroup}const l=this._nodes.needsRefresh(u);l&&(this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u)),this._pipelines.updateForRender(u),this._pipelines.isReady(u)&&(this.backend.draw(u,this.info),l&&this._nodes.updateAfter(u))}_createObjectPipeline(e,t,r,s,i,n,a,o){if(null!==this._compilationPromises)return void this._compilationPromises.push({object:e,material:t,scene:r,camera:s,lightsNode:i,group:n,clippingContext:a,passId:o,renderContext:this._currentRenderContext});const u=this._objects.get(e,t,r,s,i,this._currentRenderContext,a,o);u.drawRange=e.geometry.drawRange,u.group=n,this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u),this._pipelines.getForRender(u,this._compilationPromises),this._nodes.updateAfter(u)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class ZS{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}class JS extends ZS{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return(e=this._buffer.byteLength)+(My-e%My)%My;var e}get buffer(){return this._buffer}update(){return!0}}class eR extends JS{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let tR=0;class rR extends eR{constructor(e,t){super("UniformBuffer_"+tR++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class sR extends eR{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){const t=e.index;if(!0!==this._updateRangeCache.has(t)){const r=this.updateRanges,s={start:e.offset,count:e.itemSize};r.push(s),this._updateRangeCache.set(t,s)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let r=0,s=this.uniforms.length;r{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let oR=0;class uR extends aR{constructor(e,t){super(e,t),this.id=oR++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class lR extends uR{constructor(e,t,r,s=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=s}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class dR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledCubeTexture=!0}}class cR extends lR{constructor(e,t,r,s=null){super(e,t,r,s),this.isSampledTexture3D=!0}}const hR={bitcast_int_uint:new fT("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new fT("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},pR={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},gR={low:"lowp",medium:"mediump",high:"highp"},mR={swizzleAssign:!0,storageBuffer:!1},fR={perspective:"smooth",linear:"noperspective"},yR={centroid:"centroid"},bR="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision highp sampler2DShadow;\nprecision highp sampler2DArrayShadow;\nprecision highp samplerCubeShadow;\n";class xR extends QN{constructor(e,t){super(e,t,new yS),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==T}_include(e){const t=hR[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==hR[e]&&this._include(e),pR[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {\n\n\t${r.vars}\n\n${r.code}\n\treturn ${r.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,r=t.count*t.itemSize,{itemSize:s}=t,i=t.array.constructor.name.toLowerCase().includes("int");let n=i?We:$e;2===s?n=i?je:$:3===s?n=i?Ke:Xe:4===s&&(n=i?Lt:Ee);const a={Float32Array:K,Uint8Array:Ve,Uint16Array:Ge,Uint32Array:S,Int8Array:Oe,Int16Array:ke,Int32Array:R,Uint8ClampedArray:Ve},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let u=Math.ceil(r/s/o);o*u*s0?i:"";t=`${r.name} {\n\t${s} ${e.name}[${n}];\n};\n`}else{const t=e.groupNode.name;if(void 0===s[t]){const e=this.uniformGroups[t];if(void 0!==e){const r=[];for(const t of e.uniforms){const e=t.getType(),s=this.getVectorType(e),i=t.nodeUniform.node.precision;let n=`${s} ${t.name};`;null!==i&&(n=gR[i]+" "+n),r.push("\t"+n)}s[t]=r}}i=!0}if(!i){const s=e.node.precision;null!==s&&(t=gR[s]+" "+t),t="uniform "+t,r.push(t)}}let i="";for(const e in s){const t=s[e];i+=this._getGLSLUniformStruct(e,t.join("\n"))+"\n"}return i+=r.join("\n"),i}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==R){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);const s=r.array;!1==(s instanceof Uint32Array||s instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let r=0;for(const s of e)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};\n`}return t}getStructMembers(e){const t=[];for(const r of e.members)t.push(`\t${r.type} ${r.name};`);return t.join("\n")}getStructs(e){const t=[],r=this.structs[e],s=[];for(const e of r)if(e.output)for(const t of e.members)s.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let r="struct "+e.name+" {\n";r+=this.getStructMembers(e),r+="\n};\n",t.push(r)}return 0===s.length&&s.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+s.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const r=this.varyings;if("vertex"===e||"compute"===e)for(const s of r){"compute"===e&&(s.needsInterpolation=!0);const r=this.getType(s.type);if(s.needsInterpolation)if(s.interpolationType){t+=`${fR[s.interpolationType]||s.interpolationType} ${yR[s.interpolationSampling]||""} out ${r} ${s.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}out ${r} ${s.name};\n`}else t+=`${r} ${s.name};\n`}else if("fragment"===e)for(const e of r)if(e.needsInterpolation){const r=this.getType(e.type);if(e.interpolationType){t+=`${fR[e.interpolationType]||e.interpolationType} ${yR[e.interpolationSampling]||""} in ${r} ${e.name};\n`}else{t+=`${r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":""}in ${r} ${e.name};\n`}}for(const r of this.builtins[e])t+=`${r};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){o("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,r=this.shaderStage){const s=this.extensions[r]||(this.extensions[r]=new Map);!1===s.has(e)&&s.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const r=this.extensions[e];if(void 0!==r)for(const{name:e,behavior:s}of r.values())t.push(`#extension ${e} : ${s}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=mR[e];if(void 0===t){let r;switch(t=!1,e){case"float32Filterable":r="OES_texture_float_linear";break;case"clipDistance":r="WEBGL_clip_cull_distance"}if(void 0!==r){const e=this.renderer.backend.extensions;e.has(r)&&(e.get(r),t=!0)}mR[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let r=0;r0&&(r+="\n"),r+=`\t// flow -> ${n}\n\t`),r+=`${s.code}\n\t`,e===i&&"compute"!==t&&(r+="// result\n\t","vertex"===t?(r+="gl_Position = ",r+=`${s.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(r+="fragColor = ",r+=`${s.result};`)))}const n=e[t];if(n.extensions=this.getExtensions(t),n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.vars=this.getVars(t,!0),n.structs=this.getStructs(t),n.codes=this.getCodes(t),n.transforms=this.getTransforms(t),n.flow=r,"vertex"===t){const e=this.renderer.backend.extensions;this.object.isBatchedMesh&&!1===e.has("WEBGL_multi_draw")&&(n.uniforms+="\nuniform uint nodeUniformDrawId;\n")}}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);let a=n.uniformGPU;if(void 0===a){const s=e.groupNode,o=s.name,u=this.getBindGroupArray(o,r);if("texture"===t)a=new lR(i.name,i.node,s),u.push(a);else if("cubeTexture"===t||"cubeDepthTexture"===t)a=new dR(i.name,i.node,s),u.push(a);else if("texture3D"===t)a=new cR(i.name,i.node,s),u.push(a);else if("buffer"===t){i.name=`buffer${e.id}`;const t=this.getSharedDataFromNode(e);let r=t.buffer;void 0===r&&(e.name=`NodeBuffer_${e.id}`,r=new rR(e,s),r.name=e.name,t.buffer=r),u.push(r),a=r}else{let e=this.uniformGroups[o];void 0===e?(e=new nR(o,s),this.uniformGroups[o]=e,u.push(e)):-1===u.indexOf(e)&&u.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}}let TR=null,_R=null;class vR{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Pt.RENDER]:null,[Pt.COMPUTE]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),r=this.renderer.info.frame;let s;s=!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls,t.timestampUID=s+":"+e.id+":f"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?Pt.COMPUTE:Pt.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void v("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return;const r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return TR=TR||new t,this.renderer.getDrawingBufferSize(TR)}setScissorTest(){}getClearColor(){const e=this.renderer;return _R=_R||new rb,e.getClearColor(_R),_R.getRGB(_R),_R}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Dt(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${_t} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let NR,SR,RR=0;class ER{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class AR{constructor(e){this.backend=e}createAttribute(e,t){const r=this.backend,{gl:s}=r,i=e.array,n=e.usage||s.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=r.get(a);let u,l=o.bufferGPU;if(void 0===l&&(l=this._createBuffer(s,t,i,n),o.bufferGPU=l,o.bufferType=t,o.version=a.version),i instanceof Float32Array)u=s.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)u=s.HALF_FLOAT;else if(i instanceof Uint16Array)u=e.isFloat16BufferAttribute?s.HALF_FLOAT:s.UNSIGNED_SHORT;else if(i instanceof Int16Array)u=s.SHORT;else if(i instanceof Uint32Array)u=s.UNSIGNED_INT;else if(i instanceof Int32Array)u=s.INT;else if(i instanceof Int8Array)u=s.BYTE;else if(i instanceof Uint8Array)u=s.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+i);u=s.UNSIGNED_BYTE}let d={bufferGPU:l,bufferType:t,type:u,byteLength:i.byteLength,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===s.INT||u===s.UNSIGNED_INT||e.gpuType===R,id:RR++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(s,t,i,n);d=new ER(d,e)}r.set(e,d)}updateAttribute(e){const t=this.backend,{gl:r}=t,s=e.array,i=e.isInterleavedBufferAttribute?e.data:e,n=t.get(i),a=n.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(a,n.bufferGPU),0===o.length)r.bufferSubData(a,0,s);else{for(let e=0,t=o.length;e{r.deleteBuffer(l),t.delete(e),e.removeEventListener("dispose",s)};e.addEventListener("dispose",s),u.writeBuffer=l}else r.bindBuffer(r.COPY_WRITE_BUFFER,l);r.copyBufferSubData(r.COPY_READ_BUFFER,r.COPY_WRITE_BUFFER,0,0,o),await t.utils._clientWaitAsync();const d=new s.array.constructor(a.length);return r.bindBuffer(r.COPY_WRITE_BUFFER,l),r.getBufferSubData(r.COPY_WRITE_BUFFER,0,d),r.bindBuffer(r.COPY_READ_BUFFER,null),r.bindBuffer(r.COPY_WRITE_BUFFER,null),d}_createBuffer(e,t,r,s){const i=e.createBuffer();return e.bindBuffer(t,i),e.bufferData(t,r,s),e.bindBuffer(t,null),i}}class wR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;NR={[it]:e.FUNC_ADD,[It]:e.FUNC_SUBTRACT,[Ut]:e.FUNC_REVERSE_SUBTRACT},SR={[Et]:e.ZERO,[Ht]:e.ONE,[Wt]:e.SRC_COLOR,[rt]:e.SRC_ALPHA,[$t]:e.SRC_ALPHA_SATURATE,[zt]:e.DST_COLOR,[Gt]:e.DST_ALPHA,[kt]:e.ONE_MINUS_SRC_COLOR,[st]:e.ONE_MINUS_SRC_ALPHA,[Vt]:e.ONE_MINUS_DST_COLOR,[Ot]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=(new s).fromArray(t),this.currentViewport=(new s).fromArray(r),this._tempVec4=new s}enable(e){const{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==qt?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===jt?t.cullFace(t.BACK):e===Xt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){const s=this.gl,i=this.backend.drawBuffersIndexedExt;if(i)for(let n=0;n0?this.enable(s.SAMPLE_ALPHA_TO_COVERAGE):this.disable(s.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r){const e=12288;for(let t=0;t<8;t++)t{!function i(){const n=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(n===e.WAIT_FAILED)return e.deleteSync(t),void s();n!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),r()):requestAnimationFrame(i)}()})}}let MR,BR,FR,LR=!1;class PR{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===LR&&(this._init(),LR=!0)}_init(){const e=this.gl;MR={[kr]:e.REPEAT,[_e]:e.CLAMP_TO_EDGE,[Vr]:e.MIRRORED_REPEAT},BR={[B]:e.NEAREST,[Gr]:e.NEAREST_MIPMAP_NEAREST,[bt]:e.NEAREST_MIPMAP_LINEAR,[le]:e.LINEAR,[yt]:e.LINEAR_MIPMAP_NEAREST,[Y]:e.LINEAR_MIPMAP_LINEAR},FR={[Hr]:e.NEVER,[Wr]:e.ALWAYS,[A]:e.LESS,[w]:e.LEQUAL,[$r]:e.EQUAL,[M]:e.GEQUAL,[C]:e.GREATER,[zr]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let r;return r=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,r}getInternalFormat(e,t,r,s,i,n=!1){const{gl:a,extensions:o}=this;if(null!==e){if(void 0!==a[e])return a[e];d("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=null;s&&(u=o.get("EXT_texture_norm16"),u||d("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let l=t;if(t===a.RED&&(r===a.FLOAT&&(l=a.R32F),r===a.HALF_FLOAT&&(l=a.R16F),r===a.UNSIGNED_BYTE&&(l=a.R8),r===a.BYTE&&(l=a.R8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.R16_EXT),r===a.SHORT&&u&&(l=u.R16_SNORM_EXT)),t===a.RED_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.R8UI),r===a.UNSIGNED_SHORT&&(l=a.R16UI),r===a.UNSIGNED_INT&&(l=a.R32UI),r===a.BYTE&&(l=a.R8I),r===a.SHORT&&(l=a.R16I),r===a.INT&&(l=a.R32I)),t===a.RG&&(r===a.FLOAT&&(l=a.RG32F),r===a.HALF_FLOAT&&(l=a.RG16F),r===a.UNSIGNED_BYTE&&(l=a.RG8),r===a.BYTE&&(l=a.RG8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RG16_EXT),r===a.SHORT&&u&&(l=u.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RG8UI),r===a.UNSIGNED_SHORT&&(l=a.RG16UI),r===a.UNSIGNED_INT&&(l=a.RG32UI),r===a.BYTE&&(l=a.RG8I),r===a.SHORT&&(l=a.RG16I),r===a.INT&&(l=a.RG32I)),t===a.RGB){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGB32F),r===a.HALF_FLOAT&&(l=a.RGB16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8:a.RGB8),r===a.BYTE&&(l=a.RGB8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGB16_EXT),r===a.SHORT&&u&&(l=u.RGB16_SNORM_EXT),r===a.UNSIGNED_SHORT_5_6_5&&(l=a.RGB565),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGB4),r===a.UNSIGNED_INT_5_9_9_9_REV&&(l=a.RGB9_E5),r===a.UNSIGNED_INT_10F_11F_11F_REV&&(l=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGB8UI),r===a.UNSIGNED_SHORT&&(l=a.RGB16UI),r===a.UNSIGNED_INT&&(l=a.RGB32UI),r===a.BYTE&&(l=a.RGB8I),r===a.SHORT&&(l=a.RGB16I),r===a.INT&&(l=a.RGB32I)),t===a.RGBA){const e=n?qr:p.getTransfer(i);r===a.FLOAT&&(l=a.RGBA32F),r===a.HALF_FLOAT&&(l=a.RGBA16F),r===a.UNSIGNED_BYTE&&(l=e===g?a.SRGB8_ALPHA8:a.RGBA8),r===a.BYTE&&(l=a.RGBA8_SNORM),r===a.UNSIGNED_SHORT&&u&&(l=u.RGBA16_EXT),r===a.SHORT&&u&&(l=u.RGBA16_SNORM_EXT),r===a.UNSIGNED_SHORT_4_4_4_4&&(l=a.RGBA4),r===a.UNSIGNED_SHORT_5_5_5_1&&(l=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(r===a.UNSIGNED_BYTE&&(l=a.RGBA8UI),r===a.UNSIGNED_SHORT&&(l=a.RGBA16UI),r===a.UNSIGNED_INT&&(l=a.RGBA32UI),r===a.BYTE&&(l=a.RGBA8I),r===a.SHORT&&(l=a.RGBA16I),r===a.INT&&(l=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(r===a.UNSIGNED_SHORT&&(l=a.DEPTH_COMPONENT16),r===a.UNSIGNED_INT&&(l=a.DEPTH_COMPONENT24),r===a.FLOAT&&(l=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&r===a.UNSIGNED_INT_24_8&&(l=a.DEPTH24_STENCIL8),l!==a.R16F&&l!==a.R32F&&l!==a.RG16F&&l!==a.RG32F&&l!==a.RGBA16F&&l!==a.RGBA32F||o.get("EXT_color_buffer_float"),l}setTextureParameters(e,t){const{gl:r,extensions:s,backend:i}=this,{state:n}=this.backend,a=p.getPrimaries(p.workingColorSpace),o=t.colorSpace===T?null:p.getPrimaries(t.colorSpace),u=t.colorSpace===T||a===o?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,u),r.texParameteri(e,r.TEXTURE_WRAP_S,MR[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,MR[t.wrapT]),e!==r.TEXTURE_3D&&e!==r.TEXTURE_2D_ARRAY||t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,MR[t.wrapR]),r.texParameteri(e,r.TEXTURE_MAG_FILTER,BR[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,d=t.minFilter===le&&l?Y:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,BR[d]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,FR[t.compareFunction])),!0===s.has("EXT_texture_filter_anisotropic")){if(t.magFilter===B)return;if(t.minFilter!==bt&&t.minFilter!==Y)return;if(t.type===K&&!1===s.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const n=s.get("EXT_texture_filter_anisotropic");r.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:r,defaultTextures:s}=this,i=this.getGLTextureType(e);let n=s[i];void 0===n&&(n=t.createTexture(),r.state.bindTexture(i,n),t.texParameteri(i,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(i,t.TEXTURE_MAG_FILTER,t.NEAREST),s[i]=n),r.set(e,{textureGPU:n,glTextureType:i})}createTexture(e,t){const{gl:r,backend:s}=this,{levels:i,width:n,height:a,depth:o}=t,u=s.utils.convert(e.format,e.colorSpace),l=s.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,u,l,e.normalized,e.colorSpace,e.isVideoTexture),c=r.createTexture(),h=this.getGLTextureType(e);s.state.bindTexture(h,c),this.setTextureParameters(h,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,i,d,n,a,o):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,i,d,n,a,o):e.isVideoTexture||r.texStorage2D(h,i,d,n,a),s.set(e,{textureGPU:c,glTextureType:h,glFormat:u,glType:l,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:r,backend:s}=this,{state:i}=s,{textureGPU:n,glTextureType:a,glFormat:o,glType:u}=s.get(t),{width:l,height:d}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),s.state.bindTexture(a,n),i.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(a,0,0,0,l,d,o,u,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),s.state.unbindTexture()}updateTexture(e,t){const{gl:r}=this,{width:s,height:i}=t,{textureGPU:n,glTextureType:a,glFormat:o,glType:u,glInternalFormat:l}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==n)if(this.backend.state.bindTexture(a,n),this.setTextureParameters(a,e),e.isCompressedTexture){const s=e.mipmaps,i=t.image;for(let t=0;t0){const t=jr(s.width,s.height,e.format,e.type);for(const i of e.layerUpdates){const e=s.data.subarray(i*t/s.data.BYTES_PER_ELEMENT,(i+1)*t/s.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,i,s.width,s.height,1,o,u,e)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,s.width,s.height,s.depth,o,u,s.data)}else if(e.isData3DTexture){const e=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,u,e.data)}else if(e.isVideoTexture)e.update(),r.texImage2D(a,0,l,o,u,t.image);else{const n=e.mipmaps;if(n.length>0)for(let e=0,t=n.length;e0,c=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(d){const r=0!==a||0!==o;let d,h;if(!0===e.isDepthTexture?(d=s.DEPTH_BUFFER_BIT,h=s.DEPTH_ATTACHMENT,t.stencil&&(d|=s.STENCIL_BUFFER_BIT)):(d=s.COLOR_BUFFER_BIT,h=s.COLOR_ATTACHMENT0),r){const e=this.backend.get(t.renderTarget),r=e.framebuffers[t.getCacheKey()],h=e.msaaFrameBuffer;i.bindFramebuffer(s.DRAW_FRAMEBUFFER,r),i.bindFramebuffer(s.READ_FRAMEBUFFER,h);const p=c-o-l;s.blitFramebuffer(a,p,a+u,p+l,a,p,a+u,p+l,d,s.NEAREST),i.bindFramebuffer(s.READ_FRAMEBUFFER,r),i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,p,u,l),i.unbindTexture()}else{const e=s.createFramebuffer();i.bindFramebuffer(s.DRAW_FRAMEBUFFER,e),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,h,s.TEXTURE_2D,n,0),s.blitFramebuffer(0,0,u,l,0,0,u,l,d,s.NEAREST),s.deleteFramebuffer(e)}}else i.bindTexture(s.TEXTURE_2D,n),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,a,c-l-o,u,l),i.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,s=!1){const{gl:i}=this,n=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:u,width:l,height:d}=n;if(i.bindRenderbuffer(i.RENDERBUFFER,e),o&&!u){let t=i.DEPTH_COMPONENT24;if(!0===s){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(i.RENDERBUFFER,n.samples,t,l,d)}else r>0?(a&&a.isDepthTexture&&a.type===i.FLOAT&&(t=i.DEPTH_COMPONENT32F),i.renderbufferStorageMultisample(i.RENDERBUFFER,r,t,l,d)):i.renderbufferStorage(i.RENDERBUFFER,t,l,d);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e)}else o&&u&&(r>0?i.renderbufferStorageMultisample(i.RENDERBUFFER,r,i.DEPTH24_STENCIL8,l,d):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,l,d),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e));i.bindRenderbuffer(i.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,s,i,n){const{backend:a,gl:o}=this,{textureGPU:u,glFormat:l,glType:d}=this.backend.get(e),c=o.createFramebuffer();a.state.bindFramebuffer(o.READ_FRAMEBUFFER,c);const h=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+n:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,u,0);const p=this._getTypedArrayType(d),g=s*i*this._getBytesPerTexel(d,l),m=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.bufferData(o.PIXEL_PACK_BUFFER,g,o.STREAM_READ),o.readPixels(t,r,s,i,l,d,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const f=new p(g/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,f),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(c),f}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:r}=this;let s=0;return e===r.UNSIGNED_BYTE&&(s=1),e!==r.UNSIGNED_SHORT_4_4_4_4&&e!==r.UNSIGNED_SHORT_5_5_5_1&&e!==r.UNSIGNED_SHORT_5_6_5&&e!==r.UNSIGNED_SHORT&&e!==r.HALF_FLOAT||(s=2),e!==r.UNSIGNED_INT&&e!==r.FLOAT||(s=4),t===r.RGBA?4*s:t===r.RGB?3*s:t===r.ALPHA?s:void 0}dispose(){const{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function DR(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class UR{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class IR{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(null!==this.maxUniformBlockSize)return this.maxUniformBlockSize;const e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}}const OR={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class VR{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:r,mode:s,object:i,type:n,info:a,index:o}=this;0!==o?r.drawElements(s,t,n,e):r.drawArrays(s,e,t),a.update(i,t,1)}renderInstances(e,t,r){const{gl:s,mode:i,type:n,index:a,object:o,info:u}=this;0!==r&&(0!==a?s.drawElementsInstanced(i,t,n,e,r):s.drawArraysInstanced(i,e,t,r),u.update(o,t,r))}renderMultiDraw(e,t,r){const{extensions:s,mode:i,object:n,info:a}=this;if(0===r)return;const o=s.get("WEBGL_multi_draw");if(null===o)for(let s=0;sthis.maxQueries)return v(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null==t)return;if(null!==this.activeQuery)return;const r=this.queries[t];if(r)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){o("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){o("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[t,r]of this.queryOffsets){if("ended"===this.queryStates.get(r)){const s=this.queries[r];e.set(t,this.resolveQuery(s))}}if(0===e.size)return this.lastValue;const t={},r=[];for(const[s,i]of e){const e=s.match(/^(.*):f(\d+)$/),n=parseInt(e[2]);!1===r.includes(n)&&r.push(n),void 0===t[n]&&(t[n]=0);const a=await i;this.timestamps.set(s,a),t[n]+=a}const s=t[r[r.length-1]];return this.lastValue=s,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,s}catch(e){return o("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let r,s=!1;const i=e=>{s||(s=!0,r&&(clearTimeout(r),r=null),t(e))},n=()=>{if(this.isDisposed)i(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void i(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(r=setTimeout(n,1));const s=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(s)/1e6)}catch(e){o("Error checking query:",e),t(this.lastValue)}};n()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class zR extends vR{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},s=void 0!==t.context?t.context:e.domElement.getContext("webgl2",r);function i(t){t.preventDefault();const r={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(r)}this._onContextLost=i,e.domElement.addEventListener("webglcontextlost",i,!1),this.gl=s,this.extensions=new UR(this),this.capabilities=new IR(this),this.attributeUtils=new AR(this),this.textureUtils=new PR(this),this.bufferRenderer=new VR(this),this.state=new wR(this),this.utils=new CR(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(d("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return c}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){const s=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:s.RGBA8}),null!==r){const t=e.stencilBuffer?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&d("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new GR(this.gl,e,2048));const r=this.timestampQueryPool[e];null!==r.allocateQueriesForContext(t)&&r.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.viewport(0,0,e,r)}if(e.scissor)this.updateScissor(e);else{const{width:e,height:r}=this.getDrawingBufferSize();t.scissor(0,0,e,r)}this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const s=e.occlusionQueryCount;s>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=new Array(s),r.occlusionQueryObjects=new Array(s),r.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:r}=this,s=this.get(e),i=s.previousContext;r.resetVertexState();const n=e.occlusionQueryCount;n>0&&(n>s.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let e=0;e{let a=0;for(let t=0;t1?t.renderInstances(r,s,i):t.render(r,s)}draw(e){const{object:t,pipeline:r,material:s,context:i,hardwareClippingPlanes:n}=e,{programGPU:a}=this.get(r),{gl:o,state:u}=this,l=this.get(i),d=e.getDrawParameters();if(null===d)return;this._bindUniforms(e.getBindings());const c=t.isMesh&&t.matrixWorld.determinant()<0;u.setMaterial(s,c,n),null!==i.mrt&&null!==i.textures&&u.setMRTBlending(i.textures,i.mrt,s),u.useProgram(a);const h=e.getAttributes(),p=this.get(h);let g=p.vaoGPU;if(void 0===g){const e=this._getVaoKey(h);g=this.vaoCache[e],void 0===g&&(g=this._createVao(h),this.vaoCache[e]=g,p.vaoGPU=g)}const m=e.getIndex(),f=null!==m?this.get(m).bufferGPU:null;u.setVertexState(g,f);const y=l.lastOcclusionObject;if(y!==t&&void 0!==y){if(null!==y&&!0===y.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),l.occlusionQueryIndex++),!0===t.occlusionTest){const e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),l.occlusionQueries[l.occlusionQueryIndex]=e,l.occlusionQueryObjects[l.occlusionQueryIndex]=t}l.lastOcclusionObject=t}const b=this.bufferRenderer;t.isPoints?b.mode=o.POINTS:t.isLineSegments?b.mode=o.LINES:t.isLine?b.mode=o.LINE_STRIP:t.isLineLoop?b.mode=o.LINE_LOOP:!0===s.wireframe?(u.setLineWidth(s.wireframeLinewidth*this.renderer.getPixelRatio()),b.mode=o.LINES):b.mode=o.TRIANGLES;const{vertexCount:x,instanceCount:T}=d;let{firstVertex:_}=d;if(b.object=t,null!==m){_*=m.array.BYTES_PER_ELEMENT;const e=this.get(m);b.index=m.count,b.type=e.type}else b.index=0;if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const r=this.get(e.camera),s=e.camera.cameras,i=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===r.indexesGPU||r.indexesGPU.length!==s.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let r=0,i=s.length;r{const i=this.parallel,n=()=>{r.getProgramParameter(a,i.COMPLETION_STATUS_KHR)?(this._completeCompile(e,s),t()):requestAnimationFrame(n)};n()});return void t.push(i)}this._completeCompile(e,s)}_handleSource(e,t){const r=e.split("\n"),s=[],i=Math.max(t-6,0),n=Math.min(t+6,r.length);for(let e=i;e":" "} ${i}: ${r[e]}`)}return s.join("\n")}_getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(s&&""===i)return"";const n=/ERROR: 0:(\d+)/.exec(i);if(n){const s=parseInt(n[1]);return r.toUpperCase()+"\n\n"+i+"\n\n"+this._handleSource(e.getShaderSource(t),s)}return i}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){const s=this.gl,i=(s.getProgramInfoLog(e)||"").trim();if(!1===s.getProgramParameter(e,s.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(s,e,r,t);else{const n=this._getShaderErrors(s,r,"vertex"),a=this._getShaderErrors(s,t,"fragment");o("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(e,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+n+"\n"+a)}else""!==i&&d("WebGLProgram: Program Info Log:",i)}}_completeCompile(e,t){const{state:r,gl:s}=this,i=this.get(t),{programGPU:n,fragmentShader:a,vertexShader:o}=i;!1===s.getProgramParameter(n,s.LINK_STATUS)&&this._logProgramError(n,a,o),r.useProgram(n);const u=e.getBindings();this._setupBindings(u,n),this.set(t,{programGPU:n,pipeline:n})}createComputePipeline(e,t){const{state:r,gl:s}=this,i={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(i);const{computeProgram:n}=e,a=s.createProgram(),o=this.get(i).shaderGPU,u=this.get(n).shaderGPU,l=n.transforms,d=[],c=[];for(let e=0;eOR[t]===e),r=this.extensions;for(let e=0;e1,h=!0===i.isXRRenderTarget,p=!0===h&&!0===i._hasExternalTextures;let g=n.msaaFrameBuffer,m=n.depthRenderbuffer;const f=this.extensions.get("WEBGL_multisampled_render_to_texture"),y=this.extensions.get("OVR_multiview2"),b=this._useMultisampledExtension(i),x=Zy(e);let T;if(l?(n.cubeFramebuffers||(n.cubeFramebuffers={}),T=n.cubeFramebuffers[x]):h&&!1===p?T=this._xrFramebuffer:(n.framebuffers||(n.framebuffers={}),T=n.framebuffers[x]),void 0===T){T=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,T);const s=e.textures,o=[];if(l){n.cubeFramebuffers[x]=T;const{textureGPU:e}=this.get(s[0]),r=this.renderer._activeCubeFace,i=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,i)}else{n.framebuffers[x]=T;for(let r=0;r0&&!1===b&&!i.multiview){if(void 0===g){const s=[];g=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,g);const i=[],l=e.textures;for(let r=0;r0&&!1===this._useMultisampledExtension(s)){const n=i.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;s.resolveDepthBuffer&&(s.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),s.stencilBuffer&&s.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=i.msaaFrameBuffer,u=i.msaaRenderbuffers,l=e.textures,d=l.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,n),d)for(let e=0;e0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const $R="point-list",WR="line-list",HR="line-strip",qR="triangle-list",jR="undefined"!=typeof self&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},XR="never",KR="less",QR="equal",YR="less-equal",ZR="greater",JR="not-equal",eE="greater-equal",tE="always",rE="store",sE="load",iE="clear",nE="ccw",aE="cw",oE="none",uE="back",lE="uint16",dE="uint32",cE="r8unorm",hE="r8snorm",pE="r8uint",gE="r8sint",mE="r16uint",fE="r16sint",yE="r16float",bE="rg8unorm",xE="rg8snorm",TE="rg8uint",_E="rg8sint",vE="r16unorm",NE="r16snorm",SE="r32uint",RE="r32sint",EE="r32float",AE="rg16uint",wE="rg16sint",CE="rg16float",ME="rgba8unorm",BE="rgba8unorm-srgb",FE="rgba8snorm",LE="rgba8uint",PE="rgba8sint",DE="bgra8unorm",UE="bgra8unorm-srgb",IE="rg16unorm",OE="rg16snorm",VE="rgb9e5ufloat",kE="rgb10a2unorm",GE="rg11b10ufloat",zE="rg32uint",$E="rg32sint",WE="rg32float",HE="rgba16uint",qE="rgba16sint",jE="rgba16float",XE="rgba16unorm",KE="rgba16snorm",QE="rgba32uint",YE="rgba32sint",ZE="rgba32float",JE="depth16unorm",eA="depth24plus",tA="depth24plus-stencil8",rA="depth32float",sA="depth32float-stencil8",iA="bc1-rgba-unorm",nA="bc1-rgba-unorm-srgb",aA="bc2-rgba-unorm",oA="bc2-rgba-unorm-srgb",uA="bc3-rgba-unorm",lA="bc3-rgba-unorm-srgb",dA="bc4-r-unorm",cA="bc4-r-snorm",hA="bc5-rg-unorm",pA="bc5-rg-snorm",gA="bc6h-rgb-ufloat",mA="bc6h-rgb-float",fA="bc7-rgba-unorm",yA="bc7-rgba-unorm-srgb",bA="etc2-rgb8unorm",xA="etc2-rgb8unorm-srgb",TA="etc2-rgb8a1unorm",_A="etc2-rgb8a1unorm-srgb",vA="etc2-rgba8unorm",NA="etc2-rgba8unorm-srgb",SA="eac-r11unorm",RA="eac-r11snorm",EA="eac-rg11unorm",AA="eac-rg11snorm",wA="astc-4x4-unorm",CA="astc-4x4-unorm-srgb",MA="astc-5x4-unorm",BA="astc-5x4-unorm-srgb",FA="astc-5x5-unorm",LA="astc-5x5-unorm-srgb",PA="astc-6x5-unorm",DA="astc-6x5-unorm-srgb",UA="astc-6x6-unorm",IA="astc-6x6-unorm-srgb",OA="astc-8x5-unorm",VA="astc-8x5-unorm-srgb",kA="astc-8x6-unorm",GA="astc-8x6-unorm-srgb",zA="astc-8x8-unorm",$A="astc-8x8-unorm-srgb",WA="astc-10x5-unorm",HA="astc-10x5-unorm-srgb",qA="astc-10x6-unorm",jA="astc-10x6-unorm-srgb",XA="astc-10x8-unorm",KA="astc-10x8-unorm-srgb",QA="astc-10x10-unorm",YA="astc-10x10-unorm-srgb",ZA="astc-12x10-unorm",JA="astc-12x10-unorm-srgb",ew="astc-12x12-unorm",tw="astc-12x12-unorm-srgb",rw="clamp-to-edge",sw="repeat",iw="mirror-repeat",nw="linear",aw="nearest",ow="zero",uw="one",lw="src",dw="one-minus-src",cw="src-alpha",hw="one-minus-src-alpha",pw="dst",gw="one-minus-dst",mw="dst-alpha",fw="one-minus-dst-alpha",yw="src-alpha-saturated",bw="constant",xw="one-minus-constant",Tw="add",_w="subtract",vw="reverse-subtract",Nw="min",Sw="max",Rw=0,Ew=15,Aw="keep",ww="zero",Cw="replace",Mw="invert",Bw="increment-clamp",Fw="decrement-clamp",Lw="increment-wrap",Pw="decrement-wrap",Dw="storage",Uw="read-only-storage",Iw="write-only",Ow="read-only",Vw="read-write",kw="non-filtering",Gw="comparison",zw="float",$w="unfilterable-float",Ww="depth",Hw="sint",qw="uint",jw="2d",Xw="3d",Kw="2d",Qw="2d-array",Yw="cube",Zw="3d",Jw="all",eC="vertex",tC="instance",rC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},sC={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class iC extends aR{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class nC extends JS{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let aC=0;class oC extends nC{constructor(e,t){super("StorageBuffer_"+aC++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:ii.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class uC extends Ry{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:nw}),this.flipYSampler=e.createSampler({minFilter:aw}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4f,\n\t@location( 0 ) vTex : vec2f,\n\t@location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32,\n};\n\n@group( 0 ) @binding ( 2 )\nvar flipY: u32;\n\n@vertex\nfn mainVS(\n\t\t@builtin( vertex_index ) vertexIndex : u32,\n\t\t@builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array(\n\t\tvec2f( -1, -1 ),\n\t\tvec2f( -1, 3 ),\n\t\tvec2f( 3, -1 ),\n\t);\n\n\tlet p = pos[ vertexIndex ];\n\tlet mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 );\n\tVarys.vTex = p * mult + vec2f( 0.5 );\n\tVarys.Position = vec4f( p, 0, 1 );\n\tVarys.vBaseArrayLayer = instanceIndex;\n\n\treturn Varys;\n\n}\n\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img2d : texture_2d;\n\n@fragment\nfn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2d, imgSampler, Varys.vTex );\n\n}\n\n@group( 0 ) @binding( 1 )\nvar img2dArray : texture_2d_array;\n\n@fragment\nfn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer );\n\n}\n\nconst faceMat = array(\n mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x\n mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x\n mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y\n mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y\n mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z\n mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z\n);\n\n@group( 0 ) @binding( 1 )\nvar imgCube : texture_cube;\n\n@fragment\nfn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );\n\n}\n"})}getTransferPipeline(e,t){const r=`${e}-${t=t||"2d-array"}`;let s=this.transferPipelines[r];return void 0===s&&(s=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[r]=s),s}flipY(e,t,r=0){const s=t.format,{width:i,height:n}=t.size,a=this.device.createTexture({size:{width:i,height:n},format:s,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),o=this.getTransferPipeline(s,e.textureBindingViewDimension),u=this.getTransferPipeline(s,a.textureBindingViewDimension),l=this.device.createCommandEncoder({}),d=(e,t,r,s,i,n)=>{const a=e.getBindGroupLayout(0),o=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t.createView({dimension:t.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:n?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),u=l.beginRenderPass({colorAttachments:[{view:s.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1}),loadOp:iE,storeOp:rE}]});u.setPipeline(e),u.setBindGroup(0,o),u.draw(3,1,0,r),u.end()};d(o,e,r,a,0,!1),d(u,a,0,e,r,!0),this.device.queue.submit([l.finish()]),a.destroy()}generateMipmaps(e,t=null){const r=this.get(e),s=r.layers||this._mipmapCreateBundles(e),i=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(i,s),null===t&&this.device.queue.submit([i.finish()]),r.layers=s}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",r=this.getTransferPipeline(e.format,t),s=r.getBindGroupLayout(0),i=[];for(let n=1;n0)for(let t=0,n=s.length;t0){for(const s of e.layerUpdates)this._copyBufferToTexture(t.image,r.texture,i,s,e.flipY,s);e.clearLayerUpdates()}else for(let s=0;s0)for(let t=0,n=s.length;t{const t=e.changedElements;for(const e of r)t.includes(e.image)&&(e.needsUpdate=!0)}}dispose(){this._samplerCache.clear(),this._htmlTextures.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(void 0===t){const r=new N;r.minFilter=B,r.magFilter=B,this.createTexture(r,{width:1,height:1,format:e}),this.defaultTexture[e]=t=r}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(void 0===t){const r=new D;r.minFilter=B,r.magFilter=B,this.createTexture(r,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=r}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,r){const s=e.images,i=e.mipmaps;for(let n=0;n<6;n++){const a=s[n],o=!0===e.flipY?dC[n]:n;a.isDataTexture?this._copyBufferToTexture(a.image,t,r,o,e.flipY):this._copyImageToTexture(a,t,r,o,e.flipY,e.premultiplyAlpha);for(let s=0;s0?e.width:r.size.width,l=a>0?e.height:r.size.height;try{o.queue.copyExternalImageToTexture({source:e,flipY:i},{texture:t,mipLevel:a,origin:{x:0,y:0,z:s},premultipliedAlpha:n},{width:u,height:l,depthOrArrayLayers:1})}catch(e){}}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new uC(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,s,i,n=0,a=0){const o=this.backend.device,u=e.data,l=this._getBytesPerTexel(r.format),d=e.width*l;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:s}},u,{offset:e.width*e.height*l*n,bytesPerRow:d},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===i&&this._flipY(t,r,s)}_copyCompressedBufferToTexture(e,t,r){const s=this.backend.device,i=this._getBlockData(r.format),n=r.size.depthOrArrayLayers>1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,gC=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,mC={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class fC extends hS{constructor(e){const{type:t,inputs:r,name:s,inputsCode:i,blockCode:n,outputType:a}=(e=>{const t=(e=e.trim()).match(pC);if(null!==t&&4===t.length){const r=t[2],s=[];let i=null;for(;null!==(i=gC.exec(r));)s.push({name:i[1],type:i[2]});const n=[];for(let e=0;e "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class yC extends cS{parseFunction(e){return new fC(e)}}const bC={[ii.READ_ONLY]:"read",[ii.WRITE_ONLY]:"write",[ii.READ_WRITE]:"read_write"},xC={[kr]:"repeat",[_e]:"clamp",[Vr]:"mirror"},TC={vertex:jR.VERTEX,fragment:jR.FRAGMENT,compute:jR.COMPUTE},_C={instance:!0,swizzleAssign:!1,storageBuffer:!0},vC={"^^":"tsl_xor"},NC={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},SC={},RC={tsl_xor:new fT("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new fT("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new fT("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new fT("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new fT("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new fT("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new fT("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new fT("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new fT("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new fT("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new fT("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new fT("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new fT("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n"),biquadraticTextureArray:new fT("\nfn tsl_biquadraticTexture_array( map : texture_2d_array, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},EC={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let AC="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(AC+="diagnostic( off, derivative_uniformity );\n");class wC extends QN{constructor(e,t){super(e,t,new yC),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,r,s,i,n=this.shaderStage){return"fragment"===n?s?i?`textureSample( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${s} )`:i?`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`:this.generateTextureSampleLevel(e,t,r,"0",s)}generateTextureSampleLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateWrapFunction(e){const t=`tsl_coord_${xC[e.wrapS]}S_${xC[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let r=SC[t];if(void 0===r){const s=[],i=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let n=`fn ${t}( coord : ${i} ) -> ${i} {\n\n\treturn ${i}(\n`;const a=(e,t)=>{e===kr?(s.push(RC.repeatWrapping_float),n+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===_e?(s.push(RC.clampWrapping_float),n+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===Vr?(s.push(RC.mirrorWrapping_float),n+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):(n+=`\t\tcoord.${t}`,d(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};a(e.wrapS,"x"),n+=",\n",a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(n+=",\n",a(e.wrapR,"z")),n+="\n\t);\n\n}\n",SC[t]=r=new fT(n,s)}return r.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){const s=this.getDataFromNode(e,this.shaderStage,this.cache);void 0===s.dimensionsSnippet&&(s.dimensionsSnippet={});let i=s.dimensionsSnippet[r];if(void 0===s.dimensionsSnippet[r]){let n,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),u=o>1;a=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",n=u||e.isStorageTexture?t:`${t}${r?`, u32( ${r} )`:""}`,i=new Du(new wl(`textureDimensions( ${n} )`,a)),s.dimensionsSnippet[r]=i,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(s.arrayLayerCount=new Du(new wl(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(s.cubeFaceCount=new Du(new wl("6u","u32")))}return i.build(this)}generateFilteredTexture(e,t,r,s,i="0u",n){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,i);return s&&(r=`${r} + vec2(${s}) / ${o}`),n?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${r} ), ${o}, u32( ${n} ), u32( ${i} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${r} ), ${o}, u32( ${i} ) )`)}generateTextureLod(e,t,r,s,i,n="0u"){if(!0===e.isCubeTexture){i&&(r=`${r} + vec3(${i})`);return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${e.isDepthTexture?"u32":"f32"}( ${n} ) )`}const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,n),u=e.is3DTexture||e.isData3DTexture?"vec3":"vec2";i&&(r=`${r} + ${u}(${i}) / ${u}( ${o} )`);return r=`${u}( clamp( floor( ${a}( ${r} ) * ${u}( ${o} ) ), ${`${u}( 0 )`}, ${`${u}( ${o} - ${"vec3"===u?"vec3( 1, 1, 1 )":"vec2( 1, 1 )"} )`} ) )`,this.generateTextureLoad(e,t,r,n,s,null)}generateStorageTextureLoad(e,t,r,s,i,n){let a;return n&&(r=`${r} + ${n}`),a=i?`textureLoad( ${t}, ${r}, ${i} )`:`textureLoad( ${t}, ${r} )`,a}generateTextureLoad(e,t,r,s,i,n){let a;return null===s&&(s="0u"),n&&(r=`${r} + ${n}`),i?a=`textureLoad( ${t}, ${r}, ${i}, u32( ${s} ) )`:(a=`textureLoad( ${t}, ${r}, u32( ${s} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,r,s,i){let n;return n=s?`textureStore( ${t}, ${r}, ${s}, ${i} )`:`textureStore( ${t}, ${r}, ${i} )`,n}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction&&this.renderer.hasCompatibility(E.TEXTURE_COMPARE)}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&e.type===K||!1===this.isSampleCompare(e)&&e.minFilter===B&&e.magFilter===B||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,s,i,n=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,r,s,i,"0",n):this._generateTextureSample(e,t,r,s,i,n),a}generateTextureGrad(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i}, ${s[0]}, ${s[1]} )`:n?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]}, ${n} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s[0]}, ${s[1]} )`;o(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,r,s,i,n){return!1===this.isUnfilterable(e)?i?n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,n,s,i):this.generateTextureLod(e,t,r,i,n,s)}generateTextureBias(e,t,r,s,i,n,a=this.shaderStage){if("fragment"===a)return i?n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:n?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${n} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s} )`;o(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,r=e.type;return"texture"===r||"cubeTexture"===r||"cubeDepthTexture"===r||"storageTexture"===r||"texture3D"===r?t:"buffer"===r||"storageBuffer"===r||"indirectStorageBuffer"===r?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=vC[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(d("WebGPURenderer: Atomic operations are only supported in compute shaders."),ii.READ_WRITE):ii.READ_ONLY:e.access}getStorageAccess(e,t){return bC[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,s=null){const i=super.getUniformFromNode(e,t,r,s),n=this.getDataFromNode(e,r,this.globalCache);if(void 0===n.uniformGPU){let a;const o=e.groupNode,u=o.name,l=this.getBindGroupArray(u,r);if("texture"===t||"cubeTexture"===t||"cubeDepthTexture"===t||"storageTexture"===t||"texture3D"===t){let s=null;const n=this.getNodeAccess(e,r);"texture"===t||"storageTexture"===t?s=!0===e.value.is3DTexture?new cR(i.name,i.node,o,n):new lR(i.name,i.node,o,n):"cubeTexture"===t||"cubeDepthTexture"===t?s=new dR(i.name,i.node,o,n):"texture3D"===t&&(s=new cR(i.name,i.node,o,n)),s.store=!0===e.isStorageTextureNode,s.mipLevel=s.store?e.mipLevel:0,s.setVisibility(TC[r]);if(!0===e.value.isCubeTexture||!1===this.isUnfilterable(e.value)&&!1===s.store){const e=new iC(`${i.name}_sampler`,i.node,o);e.setVisibility(TC[r]),l.push(e,s),a=[e,s]}else l.push(s),a=[s]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const n=this.getSharedDataFromNode(e);let u=n.buffer;if(void 0===u){u=new("buffer"===t?rR:oC)(e,o),n.buffer=u}u.setVisibility(u.getVisibility()|TC[r]),l.push(u),a=u,i.name=s||"NodeBuffer_"+i.id}else{let e=this.uniformGroups[u];void 0===e&&(e=new nR(u,o),e.setVisibility(jR.VERTEX|jR.FRAGMENT|jR.COMPUTE),this.uniformGroups[u]=e),-1===l.indexOf(e)&&l.push(e),a=this.getNodeUniform(i,t);const r=a.name;e.uniforms.some(e=>e.name===r)||e.addUniform(a)}n.uniformGPU=a}return i}getBuiltin(e,t,r,s=this.shaderStage){const i=this.builtins[s]||(this.builtins[s]=new Map);return!1===i.has(e)&&i.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,r=this.flowShaderNode(e),s=[];for(const e of t.inputs)s.push(e.name+" : "+this.getType(e.type));let i=`fn ${t.name}( ${s.join(", ")} ) -> ${this.getType(t.type)} {\n${r.vars}\n${r.code}\n`;return r.result&&(i+=`\treturn ${r.result};\n`),i+="\n}\n",i}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],r=this.directives[e];if(void 0!==r)for(const e of r)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],r=this.builtins[e];if(void 0!==r)for(const{name:e,property:s,type:i}of r.values())t.push(`@builtin( ${e} ) ${s} : ${i}`);return t.join(",\n\t")}getScopedArray(e,t,r,s){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:s}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:e,scope:r,bufferType:s,bufferCount:i}of this.scopedArrays.values()){const n=this.getType(s);t.push(`var<${r}> ${e}: array< ${n}, ${i} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const r=this.getAttributesArray();for(let e=0,s=r.length;e"),t.push(`\t${s+r.name} : ${i}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const r=this.structs[e];if(r.length>0){const e=[];for(const t of r){let r=`struct ${t.name} {\n`;r+=this.getStructMembers(t),r+="\n};",e.push(r)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,r=null,s=""){let i=`var${s} ${t} : `;return i+=null!==r?this.generateArrayDeclaration(e,r):this.getType(e),i}getVars(e,t=!1){let r="";t&&(r="");const s=[],i=this.vars[e];if(void 0!==i)for(const e of i)s.push(`${this.getVar(e.type,e.name,e.count,r)};`);return t?s.join("\n"):`\n\t${s.join("\n\t")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","builtinClipSpace","vec4","vertex"),"vertex"===e||"fragment"===e){const r=this.varyings,s=this.vars[e];let i=0;for(let n=0;nr.value.itemSize;return s&&!i}getUniforms(e){const t=this.renderer.backend,r=this.uniforms[e],s=[],i=[],n=[],a={};for(const n of r){const r=n.groupNode.name,o=this.bindingsIndexes[r];if("texture"===n.type||"cubeTexture"===n.type||"cubeDepthTexture"===n.type||"storageTexture"===n.type||"texture3D"===n.type){const r=n.node.value;let i;(!0===r.isCubeTexture||!1===this.isUnfilterable(r)&&!0!==n.node.isStorageTextureNode)&&(this.isSampleCompare(r)?s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler_comparison;`):s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name}_sampler : sampler;`));let a="";const{primarySamples:u}=t.utils.getTextureSampleData(r);if(u>1&&(a="_multisampled"),!0===r.isCubeTexture&&!0===r.isDepthTexture)i="texture_depth_cube";else if(!0===r.isCubeTexture)i="texture_cube";else if(!0===r.isDepthTexture)i=t.compatibilityMode&&null===r.compareFunction?`texture${a}_2d`:`texture_depth${a}_2d${!0===r.isArrayTexture?"_array":""}`;else if(!0===n.node.isStorageTextureNode){const s=hC(r,t.device),a=this.getStorageAccess(n.node,e),o=n.node.value.is3DTexture,u=n.node.value.isArrayTexture;i=`texture_storage_${o?"3d":"2d"+(u?"_array":"")}<${s}, ${a}>`}else if(!0===r.isArrayTexture||!0===r.isDataArrayTexture||!0===r.isCompressedArrayTexture)i="texture_2d_array";else if(!0===r.is3DTexture||!0===r.isData3DTexture)i="texture_3d";else{i=`texture${a}_2d<${this.getComponentTypeFromTexture(r).charAt(0)}32>`}s.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var ${n.name} : ${i};`)}else if("buffer"===n.type||"storageBuffer"===n.type||"indirectStorageBuffer"===n.type){const t=n.node,r=this.getType(t.getNodeType(this)),s=t.bufferCount,a=s>0&&"buffer"===n.type?", "+s:"",u=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(n))i.push(`@binding( ${o.binding++} ) @group( ${o.group} ) var<${u}> ${n.name} : ${r};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${r}>`:`${r}`}${a} >`;i.push(this._getWGSLStructBinding(n.name,e,u,o.binding++,o.group))}}else{const e=n.groupNode.name;if(void 0===a[e]){const t=this.uniformGroups[e];if(void 0!==t){const r=[];for(const e of t.uniforms){const t=e.getType(),s=this.getType(this.getVectorType(t));r.push(`\t${e.name} : ${s}`)}let s=this.uniformGroupsBindings[e];void 0===s&&(s={index:o.binding++,id:o.group},this.uniformGroupsBindings[e]=s),a[e]={index:s.index,id:s.id,snippets:r}}}}}for(const e in a){const t=a[e];n.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}return[...s,...i,...n].join("\n")}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const r=this.allowGlobalVariables,s=e[t];s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.structs=this.getStructs(t),s.vars=this.getVars(t,r),s.codes=this.getCodes(t),s.directives=this.getDirectives(t),s.scopedArrays=this.getScopedArrays(t);let i="// code\n\n";i+=this.flowCode[t];const n=this.flowNodes[t],a=n[n.length-1],o=a.outputNode,u=void 0!==o&&!0===o.isOutputStructNode;for(const e of n){const r=this.getFlowData(e),n=e.name;if(n&&(i.length>0&&(i+="\n"),i+=`\t// flow -> ${n}\n`),i+=`${r.code}\n\t`,e===a&&"compute"!==t)if(i+="// result\n\n\t","vertex"===t)i+=`varyings.builtinClipSpace = ${r.result};`;else if("fragment"===t)if(u)s.returnType=o.getNodeType(this),s.structs+="var output : "+s.returnType+";",i+=`return ${r.result};`;else{let e="\t@location( 0 ) color: vec4";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),s.returnType="OutputStruct",s.structs+=this._getWGSLStruct("OutputStruct",e),s.structs+="\nvar output : OutputStruct;",i+=`output.color = ${r.result};\n\n\treturn output;`}}s.flow=i}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return null!==t&&(r=this._getWGSLMethod(e+"_"+t)),void 0===r&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return NC[e]||e}isAvailable(e){let t=_C[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),_C[e]=t),t}_getWGSLMethod(e){return void 0!==RC[e]&&this._include(e),EC[e]}_include(e){const t=RC[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar varyings : VaryingsStruct;\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${AC}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${e.vars}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[r,s,i]=t;return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// vars\n${this.allowGlobalVariables?e.vars:""}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${r}, ${s}, ${i} )\nfn main( ${e.attributes} ) {\n\n\t// local vars\n\t${this.allowGlobalVariables?"":e.vars}\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${r} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${r} * numWorkgroups.x ) * ( ${s} * numWorkgroups.y );\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,r,s=0,i=0){const n=e+"Struct";return`${this._getWGSLStruct(n,t)}\n@binding( ${s} ) @group( ${i} )\nvar<${r}> ${e} : ${n};`}}class CC{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(t=null!==e.depthTexture?this.getTextureFormatGPU(e.depthTexture):e.stencil?!0===this.backend.renderer.reversedDepthBuffer?sA:tA:!0===this.backend.renderer.reversedDepthBuffer?rA:eA),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const e=this.backend.renderer,r=e.getRenderTarget();t=r?r.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const r=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:r?1:t,isMSAA:r}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?$R:e.isLineSegments||e.isMesh&&!0===t.wireframe?WR:e.isLine?HR:e.isMesh?qR:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===Ve)return DE;if(e===Te)return jE;throw new Error("Unsupported output buffer type.")}}const MC=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&MC.set(Float16Array,["float16"]);const BC=new Map([[xt,["float16"]]]),FC=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class LC{constructor(e){this.backend=e}createAttribute(e,t){const r=this._getBufferAttribute(e),s=this.backend,i=s.get(r);let n=i.buffer;if(void 0===n){const a=s.device;let o=r.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e{o.unmap()},u=()=>{o.destroy(),t.delete(e),e.removeEventListener("release",i),e.removeEventListener("dispose",u)};e.addEventListener("release",i),e.addEventListener("dispose",u),a.readBufferGPU=o}const u=r.createCommandEncoder({label:`readback_encoder_${s.name}`});u.copyBufferToBuffer(i,0,o,0,n);const l=u.finish();r.queue.submit([l]),await o.mapAsync(GPUMapMode.READ);return o.getMappedRange()}_getVertexFormat(e){const{itemSize:t,normalized:r}=e,s=e.array.constructor,i=e.constructor;let n;if(1===t)n=FC.get(s);else{const e=(BC.get(i)||MC.get(s))[r?1:0];if(e){const r=s.BYTES_PER_ELEMENT*t,i=4*Math.floor((r+3)/4)/s.BYTES_PER_ELEMENT;if(i%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");n=`${e}x${i}`}}return n||o("WebGPUAttributeUtils: Vertex format not supported yet."),n}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class PC{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class DC{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,r=t.device,s=t.get(e);if(s.layout)return s.layout.layoutGPU;const i=this._createLayoutEntries(e),n=Vs(JSON.stringify(i));let a=this._bindGroupLayoutCache.get(n);return void 0===a&&(a=new PC(r.createBindGroupLayout({entries:i})),this._bindGroupLayoutCache.set(n,a)),a.usedTimes++,s.layout=a,s.layoutKey=n,a.layoutGPU}createBindings(e,t,r,s=0){const{backend:i}=this,n=i.get(e),a=this.createBindingsLayout(e);let o;r>0&&(void 0===n.groups&&(n.groups=[],n.versions=[]),n.versions[r]===s&&(o=n.groups[r])),void 0===o&&(o=this.createBindGroup(e,a),r>0&&(n.groups[r]=o,n.versions[r]=s)),n.group=o}updateBinding(e){const t=this.backend,r=t.device,s=e.buffer,i=t.get(e).buffer,n=e.updateRanges;if(0===n.length)r.queue.writeBuffer(i,0,s,0);else{const e=Xr(s),t=e?1:s.BYTES_PER_ELEMENT;for(let a=0,o=n.length;a1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${r}-${s}`,a=e[i],void 0===a){const n=Jw;let o;o=t.isSampledCubeTexture?Yw:t.isSampledTexture3D?Zw:t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?Qw:Kw,a=e[i]=e.texture.createView({aspect:n,dimension:o,mipLevelCount:r,baseMipLevel:s})}}n.push({binding:i,resource:a})}else if(t.isSampler){const e=r.get(t.texture);n.push({binding:i,resource:e.sampler})}i++}return s.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:n})}_createLayoutEntries(e){const t=[];let r=0;for(const s of e.bindings){const e=this.backend,i={binding:r,visibility:s.visibility};if(s.isUniformBuffer||s.isStorageBuffer){const e={};s.isStorageBuffer&&(s.visibility&jR.COMPUTE&&(s.access===ii.READ_WRITE||s.access===ii.WRITE_ONLY)?e.type=Dw:e.type=Uw),i.buffer=e}else if(s.isSampledTexture&&s.store){const e={};e.format=this.backend.get(s.texture).texture.format;const t=s.access;e.access=t===ii.READ_WRITE?Vw:t===ii.WRITE_ONLY?Iw:Ow,s.texture.isArrayTexture?e.viewDimension=Qw:s.texture.is3DTexture&&(e.viewDimension=Zw),i.storageTexture=e}else if(s.isSampledTexture){const t={},{primarySamples:r}=e.utils.getTextureSampleData(s.texture);if(r>1&&(t.multisampled=!0,s.texture.isDepthTexture||(t.sampleType=$w)),s.texture.isDepthTexture)e.compatibilityMode&&null===s.texture.compareFunction?t.sampleType=$w:t.sampleType=Ww;else if(s.texture.isDataTexture||s.texture.isDataArrayTexture||s.texture.isData3DTexture||s.texture.isStorageTexture){const e=s.texture.type;e===R?t.sampleType=Hw:e===S?t.sampleType=qw:e===K&&(this.backend.hasFeature("float32-filterable")?t.sampleType=zw:t.sampleType=$w)}s.isSampledCubeTexture?t.viewDimension=Yw:s.texture.isArrayTexture||s.texture.isDataArrayTexture||s.texture.isCompressedArrayTexture?t.viewDimension=Qw:s.isSampledTexture3D&&(t.viewDimension=Zw),i.texture=t}else if(s.isSampler){const t={};s.texture.isDepthTexture&&(null!==s.texture.compareFunction&&e.hasCompatibility(E.TEXTURE_COMPARE)?t.type=Gw:t.type=kw),i.sampler=t}else o(`WebGPUBindingUtils: Unsupported binding "${s}".`);t.push(i),r++}return t}deleteBindGroupData(e){const{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,0===r.layout.usedTimes&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class UC{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}}class IC{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:r,material:s,geometry:i,pipeline:n}=e,{vertexProgram:a,fragmentProgram:u}=n,l=this.backend,d=l.device,c=l.utils,h=l.get(n),p=[];for(const t of e.getBindings()){const e=l.get(t),{layoutGPU:r}=e.layout;p.push(r)}const g=l.attributeUtils.createShaderVertexBuffers(e);let m;s.blending===re||s.blending===tt&&!1===s.transparent||(m=this._getBlending(s));let f={};!0===s.stencilWrite&&(f={compare:this._getStencilCompare(s),failOp:this._getStencilOperation(s.stencilFail),depthFailOp:this._getStencilOperation(s.stencilZFail),passOp:this._getStencilOperation(s.stencilZPass)});const y=this._getColorWriteMask(s),b=[];if(null!==e.context.textures){const t=e.context.textures,r=e.context.mrt;for(let e=0;e1},layout:d.createPipelineLayout({bindGroupLayouts:p})},A={},w=e.context.depth,C=e.context.stencil;if(!0!==w&&!0!==C||(!0===w&&(A.format=S,A.depthWriteEnabled=s.depthWrite,A.depthCompare=N),!0===C&&(A.stencilFront=f,A.stencilBack=f,A.stencilReadMask=s.stencilFuncMask,A.stencilWriteMask=s.stencilWriteMask),!0===s.polygonOffset&&(A.depthBias=s.polygonOffsetUnits,A.depthBiasSlopeScale=s.polygonOffsetFactor,A.depthBiasClamp=0),E.depthStencil=A),d.pushErrorScope("validation"),null===t)h.pipeline=d.createRenderPipeline(E),d.popErrorScope().then(e=>{null!==e&&(h.error=!0,o(e.message))});else{const e=new Promise(async e=>{try{h.pipeline=await d.createRenderPipelineAsync(E)}catch(e){}const t=await d.popErrorScope();null!==t&&(h.error=!0,o(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const r=this.backend,{utils:s,device:i}=r,n=s.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:s.getCurrentColorFormats(e),depthStencilFormat:n,sampleCount:this._getSampleCount(e)};return i.createRenderBundleEncoder(a)}createComputePipeline(e,t){const r=this.backend,s=r.device,i=r.get(e.computeProgram).module,n=r.get(e),a=[];for(const e of t){const t=r.get(e),{layoutGPU:s}=t.layout;a.push(s)}n.pipeline=s.createComputePipeline({compute:i,layout:s.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,r;const s=e.blending,i=e.blendSrc,n=e.blendDst,a=e.blendEquation;if(s===Rt){const s=null!==e.blendSrcAlpha?e.blendSrcAlpha:i,o=null!==e.blendDstAlpha?e.blendDstAlpha:n,u=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(n),operation:this._getBlendOperation(a)},r={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(u)}}else{const i=(e,s,i,n)=>{t={srcFactor:e,dstFactor:s,operation:Tw},r={srcFactor:i,dstFactor:n,operation:Tw}};if(e.premultipliedAlpha)switch(s){case tt:i(uw,hw,uw,hw);break;case Yt:i(uw,uw,uw,uw);break;case Qt:i(ow,dw,ow,uw);break;case Kt:i(pw,hw,ow,uw)}else switch(s){case tt:i(cw,hw,uw,hw);break;case Yt:i(cw,uw,uw,uw);break;case Qt:o(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Kt:o(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`)}}if(void 0!==t&&void 0!==r)return{color:t,alpha:r};o("WebGPURenderer: Invalid blending: ",s)}_getBlendFactor(e){let t;switch(e){case Et:t=ow;break;case Ht:t=uw;break;case Wt:t=lw;break;case kt:t=dw;break;case rt:t=cw;break;case st:t=hw;break;case zt:t=pw;break;case Vt:t=gw;break;case Gt:t=mw;break;case Ot:t=fw;break;case $t:t=yw;break;case 211:t=bw;break;case 212:t=xw;break;default:o("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const r=e.stencilFunc;switch(r){case rs:t=XR;break;case ts:t=tE;break;case es:t=KR;break;case Jr:t=YR;break;case Zr:t=QR;break;case Yr:t=eE;break;case Qr:t=ZR;break;case Kr:t=JR;break;default:o("WebGPURenderer: Invalid stencil function.",r)}return t}_getStencilOperation(e){let t;switch(e){case ds:t=Aw;break;case ls:t=ww;break;case us:t=Cw;break;case os:t=Mw;break;case as:t=Bw;break;case ns:t=Fw;break;case is:t=Lw;break;case ss:t=Pw;break;default:o("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case it:t=Tw;break;case It:t=_w;break;case Ut:t=vw;break;case hs:t=Nw;break;case cs:t=Sw;break;default:o("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,r){const s={},i=this.backend.utils;s.topology=i.getPrimitiveTopology(e,r),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(s.stripIndexFormat=t.index.array instanceof Uint16Array?lE:dE);let n=r.side===L;return e.isMesh&&e.matrixWorld.determinant()<0&&(n=!n),s.frontFace=!0===n?aE:nE,s.cullMode=r.side===P?oE:uE,s}_getColorWriteMask(e){return!0===e.colorWrite?Ew:Rw}_getDepthCompare(e){let t;if(!1===e.depthTest)t=tE;else{const r=this.backend.parameters.reversedDepthBuffer?ar[e.depthFunc]:e.depthFunc;switch(r){case nr:t=XR;break;case ir:t=tE;break;case sr:t=KR;break;case rr:t=YR;break;case tr:t=QR;break;case er:t=eE;break;case Jt:t=ZR;break;case Zt:t=JR;break;default:o("WebGPUPipelineUtils: Invalid depth function.",r)}}return t}}class OC extends kR{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const s=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return v(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const s=this.device.createCommandEncoder();s.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),s.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);const i=s.finish();if(this.device.queue.submit([i]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const n=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),a={},o=[];for(const[t,r]of e){const e=t.match(/^(.*):f(\d+)$/),s=parseInt(e[2]);!1===o.includes(s)&&o.push(s),void 0===a[s]&&(a[s]=0);const i=n[r],u=n[r+1],l=Number(u-i)/1e6;this.timestamps.set(t,l),a[s]+=l}const u=a[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=u,this.frames=o,u}catch(e){return o("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){o("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){o("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}const VC={r:0,g:0,b:0,a:1};class kC extends vR{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new CC(this),this.attributeUtils=new LC(this),this.bindingUtils=new DC(this),this.capabilities=new UC(this),this.pipelineUtils=new IC(this),this.textureUtils=new cC(this),this.occludedResolveCache=new Map;const t="undefined"==typeof navigator||!1===/Android/.test(navigator.userAgent);this._compatibility={[E.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let r;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:"compatibility"},s="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===s)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const i=Object.values(rC),n=[];for(const e of i)s.features.has(e)&&n.push(e);const a={requiredFeatures:n,requiredLimits:t.requiredLimits};r=await s.requestDevice(a)}else r=t.device;this.compatibilityMode=!r.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),r.lost.then(t=>{if("destroyed"===t.reason)return;const r={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(r)}),this.device=r,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(rC.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let r=t.context;if(void 0===r){const s=this.parameters;r=!0===e.isDefaultCanvasTarget&&void 0!==s.context?s.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${_t} webgpu`);const i=s.alpha?"premultiplied":"opaque",n=s.outputType===Te?"extended":"standard";r.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:i,toneMapping:{mode:n}}),t.context=r}return r}get coordinateSystem(){return h}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),s=e.currentSamples;let i=r.descriptor;if(void 0===i||r.samples!==s){i={colorAttachments:[{view:null}]},!0!==e.depth&&!0!==e.stencil||(i.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const t=i.colorAttachments[0];s>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,r.descriptor=i,r.samples=s}const n=i.colorAttachments[0];return s>0?n.resolveTarget=this.context.getCurrentTexture().createView():n.view=this.context.getCurrentTexture().createView(),i}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const r=e.renderTarget,s=this.get(r);let i=s.descriptors;void 0!==i&&s.width===r.width&&s.height===r.height&&s.samples===r.samples||(i={},s.descriptors=i);const n=e.getCacheKey();let a=i[n];if(void 0===a){const t=e.textures,o=[];let u;const l=this._isRenderCameraDepthArray(e);for(let s=0;s1)if(!0===l){const t=e.camera.cameras;for(let e=0;e0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,i=r.createQuerySet({type:"occlusion",count:s,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=i,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(s),t.lastOcclusionObject=null),n=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:sE}),this.initTimestampQuery(Pt.RENDER,this.getTimestampUID(e),n),n.occlusionQuerySet=i;const a=n.depthStencilAttachment;if(null!==e.textures){const t=n.colorAttachments;for(let r=0;r0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const s=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const r=[];for(let e=0;e0){const s=8*r;let i=this.occludedResolveCache.get(s);void 0===i&&(i=this.device.createBuffer({size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(s,i));const n=this.device.createBuffer({size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,i,0),t.encoder.copyBufferToBuffer(i,0,n,0,s),t.occlusionQueryBuffer=n,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;eo&&(i[0]=Math.min(a,o),i[1]=Math.ceil(a/o)),n.dispatchSize=i}i=n.dispatchSize}a.dispatchWorkgroups(i[0],i[1]||1,i[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}_draw(e,t,r,s,i,n,a,o,u){const{object:l,material:d,context:c}=e,h=e.getIndex(),p=null!==h;this.pipelineUtils.setPipeline(o,s),u.pipeline=s;const g=u.bindingGroups;for(let e=0,t=i.length;e65535?4:2);for(let n=0;n0){const i=this.get(e.camera),a=e.camera.cameras,c=e.getBindingGroup("cameraIndex");if(void 0===i.indexesGPU||i.indexesGPU.length!==a.length){const e=this.get(c),t=[],r=new Uint32Array([0,0,0,0]);for(let s=0,i=a.length;s(d("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new zR(e)));super(new t(e),e),this.library=new $C,this.isWebGPURenderer=!0}}class HC extends Es{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}}class qC{constructor(e,t=Cn(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const r=new vg;r.name="RenderPipeline",this._quadMesh=new gx(r),this._quadMesh.name="Render Pipeline",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){const e=this.renderer;this._update(),null!==this._context.onBeforeRenderPipeline&&this._context.onBeforeRenderPipeline();const t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=m,e.outputColorSpace=p.workingColorSpace;const s=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=s,e.toneMapping=t,e.outputColorSpace=r,null!==this._context.onAfterRenderPipeline&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),!0===this.needsUpdate){const e=this._toneMapping,t=this._outputColorSpace,r={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null};let s=this.outputNode;!0===this.outputColorTransform?(s=s.context(r),s=Fl(s,e,t)):(r.toneMapping=e,r.outputColorSpace=t,s=s.context(r)),this._context=r,this._quadMesh.material.fragmentNode=s,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){v('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class jC extends qC{constructor(e,t){v('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your code to use "THREE.RenderPipeline" instead.'),super(e,t)}}class XC extends N{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=le,this.minFilter=le,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){this.image.width===e&&this.image.height===t||(this.image.width=e,this.image.height=t,this.dispose())}}class KC extends Ax{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class QC extends As{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,r,s){const i=new ws(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,r=>{try{t(this.parse(JSON.parse(r)))}catch(t){s?s(t):o(t),this.manager.itemError(e)}},r,s)}parseNodes(e){const t={};if(void 0!==e){for(const r of e){const{uuid:e,type:s}=r;t[e]=this.createNodeFromType(s),t[e].uuid=e}const r={nodes:t,textures:this.textures};for(const s of e){s.meta=r;t[s.uuid].deserialize(s),delete s.meta}}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const r={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(o("NodeLoader: Node type not found:",e),yn()):new this.nodes[e]}}class YC extends Cs{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),r=this.nodes,s=e.inputNodes;for(const e in s){const i=s[e];t[e]=r[i]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class ZC extends Ms{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){const r=new QC;return r.setNodes(this.nodes),r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){const r={};if(void 0!==e){const s=this.parseNodes(this._nodesJSON,t),i=new YC;i.setTextures(t),i.setNodes(s),i.setNodeMaterials(this.nodeMaterials);for(let t=0,s=e.length;t Date: Fri, 10 Apr 2026 20:09:44 +0900 Subject: [PATCH 4/5] Examples: Update versions for external libraries (#33362) --- examples/webgl_batch_lod_bvh.html | 2 +- examples/webgl_geometry_csg.html | 4 ++-- examples/webgl_loader_3dtiles.html | 6 +++--- examples/webgl_raycaster_bvh.html | 6 +++--- examples/webgl_renderer_pathtracer.html | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/webgl_batch_lod_bvh.html b/examples/webgl_batch_lod_bvh.html index bbe79b22fdf5b4..8d8aded6aa56e4 100644 --- a/examples/webgl_batch_lod_bvh.html +++ b/examples/webgl_batch_lod_bvh.html @@ -26,7 +26,7 @@ "three": "../build/three.module.js", "three/addons/": "./jsm/", - "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.0/build/index.module.js", + "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.9/build/index.module.js", "@three.ez/batched-mesh-extensions": "https://cdn.jsdelivr.net/npm/@three.ez/batched-mesh-extensions@0.0.8/build/webgl.js", "bvh.js": "https://cdn.jsdelivr.net/npm/bvh.js@0.0.13/build/index.js", diff --git a/examples/webgl_geometry_csg.html b/examples/webgl_geometry_csg.html index 54068824f42b4f..768fbeae97eaa2 100644 --- a/examples/webgl_geometry_csg.html +++ b/examples/webgl_geometry_csg.html @@ -29,8 +29,8 @@ "imports": { "three": "../build/three.module.js", "three/addons/": "./jsm/", - "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.7.3/build/index.module.js", - "three-bvh-csg": "https://cdn.jsdelivr.net/npm/three-bvh-csg@0.0.16/build/index.module.js" + "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.9/build/index.module.js", + "three-bvh-csg": "https://cdn.jsdelivr.net/npm/three-bvh-csg@0.0.18/build/index.module.js" } } diff --git a/examples/webgl_loader_3dtiles.html b/examples/webgl_loader_3dtiles.html index 0c86c31df9c4fa..4d154053206349 100644 --- a/examples/webgl_loader_3dtiles.html +++ b/examples/webgl_loader_3dtiles.html @@ -52,9 +52,9 @@ "three": "../build/three.module.js", "three/addons/": "./jsm/", "three/examples/": "./", - "3d-tiles-renderer": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.23/build/index.js", - "3d-tiles-renderer/core/plugins": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.23/build/index.core-plugins.js", - "3d-tiles-renderer/three/plugins": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.23/build/index.three-plugins.js", + "3d-tiles-renderer": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.24/build/index.js", + "3d-tiles-renderer/core/plugins": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.24/build/index.core-plugins.js", + "3d-tiles-renderer/three/plugins": "https://cdn.jsdelivr.net/npm/3d-tiles-renderer@0.4.24/build/index.three-plugins.js", "postprocessing": "https://cdn.jsdelivr.net/npm/postprocessing@6.39.0/build/index.js", "@takram/three-clouds": "https://cdn.jsdelivr.net/npm/@takram/three-clouds@0.7.3/build/index.js", "@takram/three-atmosphere": "https://cdn.jsdelivr.net/npm/@takram/three-atmosphere@0.17.1/build/index.js", diff --git a/examples/webgl_raycaster_bvh.html b/examples/webgl_raycaster_bvh.html index e76003ae24894a..38f68a65c5efd2 100644 --- a/examples/webgl_raycaster_bvh.html +++ b/examples/webgl_raycaster_bvh.html @@ -29,7 +29,7 @@ "imports": { "three": "../build/three.module.js", "three/addons/": "./jsm/", - "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.7.3/build/index.module.js" + "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.9/build/index.module.js" } } @@ -37,7 +37,7 @@ From 446f223ae6405f885b7c754a394168ad75b8899a Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Fri, 10 Apr 2026 13:11:12 +0200 Subject: [PATCH 5/5] FBXLoader: Fix morph deltas. (#33350) --- examples/jsm/loaders/FBXLoader.js | 9 ++++++++- examples/models/fbx/morph-translation.fbx | Bin 0 -> 759424 bytes examples/webgl_loader_fbx.html | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 examples/models/fbx/morph-translation.fbx diff --git a/examples/jsm/loaders/FBXLoader.js b/examples/jsm/loaders/FBXLoader.js index 519c3b3e55b60f..7a78f38c2d99d6 100644 --- a/examples/jsm/loaders/FBXLoader.js +++ b/examples/jsm/loaders/FBXLoader.js @@ -2364,6 +2364,13 @@ class GeometryParser { parentGeo.morphAttributes.position = []; // parentGeo.morphAttributes.normal = []; // not implemented + // Morph attribute positions are stored as deltas (morphTargetsRelative = true), so the + // translation component of the geometric transform must not be applied to them — only the + // rotation/scale part. Otherwise every delta gets the geometric translation added, which + // shifts morphed vertices away from their intended position by `weight * translation` as + // the influence increases. + const morphPreTransform = preTransform.clone().setPosition( 0, 0, 0 ); + const scope = this; morphTargets.forEach( function ( morphTarget ) { @@ -2373,7 +2380,7 @@ class GeometryParser { if ( morphGeoNode !== undefined ) { - scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name ); + scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, morphPreTransform, rawTarget.name ); } diff --git a/examples/models/fbx/morph-translation.fbx b/examples/models/fbx/morph-translation.fbx new file mode 100644 index 0000000000000000000000000000000000000000..116354aa328bcc602e267d7cdbda8da969ddf603 GIT binary patch literal 759424 zcmd?Rc|4Tg7dWmYZAglcr6etu>|~fEN!haIou!E(#SAl+vCL?f6h$R_yGl~2?36Xx zT1aJI$Cj~=-S6I+QPZM#pU>y}&+q%auO83y+jqJ@J?8a6=<9XE;ev2|JH1d#=%D2 zZdMi+0#lDApvP<*M1GB_jZ+(Ahx2xI2XLm|u4rA*#Bv;>W)yBM92!Myb#g(QxT9QL zD?rQa*zDiXf+5?O8WvchQ8?WWb{3XNrdl?AEXMt?F6hg`4N%NtVcm)H)?ElHC73D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)%1=JAL0j9nhk;w~|sw)hdBpl-KYoLq;`Th}ZFd!fU~N`ue(E(3Q*db-Go1|o)~WU)7cQc@Bl=tHpo38C*?zIMH8J$;c*DapxvEl(c_x}uj_ z^K^r%1y6+q08-zF6cTz7Q^8_f_qD;3)wU-%;=cK;+k zkNDZfmHT7^5^EwATU+}N3_3t6HltK|3_4ya);`cfY`Ih{{LgZDwEa@CaeF<){*sCX z#06VnRK{hDya!!{FHrYkyfPw*4g- z%@A8J6+3+`EkCz6@SWpQv9*2xYWPmRX)>m!LJYAwQZZ8@hFA}&n5hs$EL$p;njfCc zaM%S>G4t6BvE5QJ^Vtls-=t#Zvl(I~UzRB(@adO$s4?8Xl~l|$%NZfHnfxHB*o-6m z-;W42#NH%gbm^%htPA0x`}=}I4EKjE=#U|q>G3REI}6`ytNC64`P^Pbz{igFPnQu- ztpd+rJWLa*nDK<6;X$1E0J+#IAa00_mx`HF92m?;TP_!y2csEc`=w&x&%oRnaqlmw zSo;(ZGXh%088U?wPcy_IQUy!J{3aR(10g6;DrQ>g{zjbXEUDQ3mB7>x`&cSw8uR5k ze6%xCvG4^jnjz*tQ^quA3Q#a2ReK_4x6;10(**7Y}{*Y^0Af6 zh_SCp#frZRMr+7#k%}!m3Zofb|C3ZKa4n2x$QPL{V;b-yjAjIfMpCiV%`loF-%lzQ zFyYiH#?*)*A>0#VKhU&lT<8x+TWb1VJgF=VwbPMXombuso4I>Fq&aeA4$amD>T~3)N9C-r&qjg xeX{z2gZsW6x<38hgo-!nkF|@Pr`MAIqt}i8Q-`0t_QSKkUMTuMnbT_*`9ExeA`}1s literal 0 HcmV?d00001 diff --git a/examples/webgl_loader_fbx.html b/examples/webgl_loader_fbx.html index 44e0de4898324e..8ca29b2124aab7 100644 --- a/examples/webgl_loader_fbx.html +++ b/examples/webgl_loader_fbx.html @@ -57,6 +57,7 @@ 'RotationTest', 'exampleWindow', 'Head_69', + 'morph-translation', ]; const scales = new Map();