1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18557],{18557:function(e,t,r){r.d(t,{WebGLRenderer:function(){return eq}});var s,n,i,a,o,l=r(37574),u=r(5446),_=r(46747),c=r(27236),h=r(47030),d=r(88542),f=r(70368),g=r(70024),m=r(41858),E=r(30169);class T{contextChange(e){let t=new E.o({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new u.y,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=e.limits.maxBatchableTextures,s=(0,_.o)({name:"graphics",bits:[c.T,(0,h.h)(r),d.$g,f.X]});this.shader=new m.e({glProgram:s,resources:{localUniforms:t,batchSamplers:(0,g.O)(r)}})}execute(e,t){let r=t.context,s=r.customShader||this.shader,n=e.renderer,{batcher:i,instructions:a}=n.graphicsContext.getContextRenderData(r);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(e.state),n.shader.bind(s),n.geometry.bind(i.geometry,s.glProgram);let o=a.instructions;for(let e=0;e<a.instructionSize;e++){let t=o[e];if(t.size){for(let e=0;e<t.textures.count;e++)n.texture.bind(t.textures.textures[e],e);n.geometry.draw(t.topology,t.size,t.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}T.extension={type:[l.nw.WebGLPipesAdaptor],name:"graphics"};var b=r(65967),R=r(46175),x=r(32649);class p{init(){let e=(0,_.o)({name:"mesh",bits:[d.$g,b.e,f.X]});this._shader=new m.e({glProgram:e,resources:{uTexture:R.x.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new u.y}}}})}execute(e,t){let r=e.renderer,s=t._shader;if(s){if(!s.glProgram){(0,x.Z)("Mesh shader has no glProgram",t.shader);return}}else{s=this._shader;let e=t.texture,r=e.source;s.resources.uTexture=r,s.resources.uSampler=r.style,s.resources.textureUniforms.uniforms.uTextureMatrix=e.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}p.extension={type:[l.nw.WebGLPipesAdaptor],name:"mesh"};var S=r(63203);class v{constructor(){this._tempState=S.Z.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,r){let s=e.renderer,n=this._didUploadHash[r.uid];s.shader.bind(r,n),n||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(t,r.glProgram)}execute(e,t){let r=e.renderer;this._tempState.blendMode=t.blendMode,r.state.set(this._tempState);let s=t.textures.textures;for(let e=0;e<t.textures.count;e++)r.texture.bind(s[e],e);r.geometry.draw(t.topology,t.size,t.start)}}v.extension={type:[l.nw.WebGLPipesAdaptor],name:"batch"};var A=r(852),B=r(86855),N=r(17296),C=r(19090),G=((s=G||{})[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s);class I{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}class D{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gl=this._renderer.gl,this._gpuBuffers=Object.create(null),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,r=this.getGlBuffer(e);t.bindBuffer(r.type,r.buffer)}bindBufferBase(e,t){let{_gl:r}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,r.bindBufferBase(r.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let e=this._boundBufferBases[s];if(e&&e._lastBindCallId===this._bindCallId){s++;continue}break}return(t=s,this._nextBindBaseIndex=s+1,r>=2)?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){let t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,r,s){let{_gl:n}=this;r||(r=0),t||(t=0),this._boundBufferBases[t]=null,n.bindBufferRange(n.UNIFORM_BUFFER,t||0,e.buffer,256*r,s||256)}updateBuffer(e){let{_gl:t}=this,r=this.getGlBuffer(e);if(e._updateID===r.updateID)return r;r.updateID=e._updateID,t.bindBuffer(r.type,r.buffer);let s=e.data,n=e.descriptor.usage&C.F.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?t.bufferSubData(r.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,t.bufferData(r.type,s,n)):(r.byteLength=e.descriptor.size,t.bufferData(r.type,r.byteLength,n)),r}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let r=this._gpuBuffers[e.uid],s=this._gl;t||s.deleteBuffer(r.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,r=G.ARRAY_BUFFER;
1e.descriptor.usage&C.F.INDEX?r=G.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&C.F.UNIFORM&&(r=G.UNIFORM_BUFFER);let s=new I(t.createBuffer(),r);return this._gpuBuffers[e.uid]=s,e.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}}D.extension={type:[l.nw.WebGLSystem],name:"buffer"};var y=r(39322);let F=class e{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(t){t={...e.defaultOptions,...t};let r=this.multiView=t.multiView;if(t.context&&r&&((0,x.Z)("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=y.z.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let e=this._renderer.background.alpha<1,r=t.premultipliedAlpha??!0,s=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:e,premultipliedAlpha:r,antialias:s,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&(0,x.Z)("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:t}=this;(t.width<e.width||t.height<e.height)&&(t.width=Math.max(e.width,e.width),t.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof y.z.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);let t=this._renderer.view.canvas;t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,t){let r;let s=this.canvas;if(2===e&&(r=s.getContext("webgl2",t)),!r&&!(r=s.getContext("webgl",t)))throw Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:e}=this,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(1===this.webGLVersion)this.extensions={...t,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...t,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};let r=e.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let t=e.getContextAttributes();t&&!t.stencil&&(0,x.Z)("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=2===this.webGLVersion,n=this.extensions;r.uint32Indices=s||!!n.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!n.vertexArrayObject,r.srgbTextures=s||!!n.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||(0,x.Z)("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};F.extension={type:[l.nw.WebGLSystem],name:"context"},F.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};var O=r(74393),P=r(40164),U=((n=U||{})[n.RGBA=6408]="RGBA",n[n.RGB=6407]="RGB",n[n.RG=33319]="RG",n[n.RED=6403]="RED",n[n.RGBA_INTEGER=36249]="RGBA_INTEGER",n[n.RGB_INTEGER=36248]="RGB_INTEGER",n[n.RG_INTEGER=33320]="RG_INTEGER",n[n.RED_INTEGER=36244]="RED_INTEGER",n[n.ALPHA=6406]="ALPHA",n[n.LUMINANCE=6409]="LUMINANCE",n[n.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",n[n.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",n[n.DEPTH_STENCIL=34041]="DEPTH_STENCIL",n),L=((i=L||{})[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i),M=((a=M||{})[a.CLAMP=33071]="CLAMP",a[a.REPEAT=10497]="REPEAT",a[a.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",a),H=((o=H||{})[o.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",o[o.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",o[o.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",o[o.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",o[o.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",o[o.UNSIGNED_INT=5125]="UNSIGNED_INT",o[o.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",o[o.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",o[o.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",o[o.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",o[o.BYTE=5120]="BYTE",o[o.SHORT=5122]="SHORT",o[o.INT=5124]="INT",o[o.FLOAT=5126]="FLOAT",o[o.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",o[o.HALF_FLOAT=36193]="HALF_FLOAT",o);let w={uint8x2:H.UNSIGNED_BYTE,uint8x4:H.UNSIGNED_BYTE,sint8x2:H.BYTE,sint8x4:H.BYTE,unorm8x2:H.UNSIGNED_BYTE,unorm8x4:H.UNSIGNED_BYTE,snorm8x2:H.BYTE,snorm8x4:H.BYTE,uint16x2:H.UNSIGNED_SHORT,uint16x4:H.UNSIGNED_SHORT,sint16x2:H.SHORT,sint16x4:H.SHORT,unorm16x2:H.UNSIGNED_SHORT,unorm16x4:H.UNSIGNED_SHORT,snorm16x2:H.SHORT,snorm16x4:H.SHORT,float16x2:H.HALF_FLOAT,float16x4:H.HALF_FLOAT,float32:H.FLOAT,float32x2:H.FLOAT,float32x3:H.FLOAT,float32x4:H.FLOAT,uint32:H.UNSIGNED_INT,uint32x2:H.UNSIGNED_INT,uint32x3:H.UNSIGNED_INT,uint32x4:H.UNSIGNED_INT,sint32:H.INT,sint32x2:H.INT,sint32x3:H.INT,sint32x4:H.INT},V={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class k{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(e.drawArraysInstanced=(e,t,s,n)=>{r.drawArraysInstancedANGLE(e,t,s,n)},e.drawElementsInstanced=(e,t,s,n,i)=>{r.drawElementsInstancedANGLE(e,t,s,n,i)},e.vertexAttribDivisor=(e,t)=>
1r.vertexAttribDivisorANGLE(e,t)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let r=this.gl;this._activeGeometry=e;let s=this.getVao(e,t);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let r=0;r<e.buffers.length;r++){let s=e.buffers[r];t.updateBuffer(s)}}checkCompatibility(e,t){let r=e.attributes,s=t._attributeData;for(let e in s)if(!r[e])throw Error(`shader and geometry incompatible, geometry missing the "${e}" attribute`)}getSignature(e,t){let r=e.attributes,s=t._attributeData,n=["g",e.uid];for(let e in r)s[e]&&n.push(e,s[e].location);return n.join("-")}getVao(e,t){return this._geometryVaoHash[e.uid]?.[t._key]||this.initGeometryVao(e,t)}initGeometryVao(e,t,r=!0){let s=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);let i=this.getSignature(e,t);this._geometryVaoHash[e.uid]||(this._geometryVaoHash[e.uid]=Object.create(null),e.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[e.uid],o=a[i];if(o)return a[t._key]=o,o;(0,P.B)(e,t._attributeData);let l=e.buffers;o=s.createVertexArray(),s.bindVertexArray(o);for(let e=0;e<l.length;e++){let t=l[e];n.bind(t)}return this.activateVao(e,t),a[t._key]=o,a[i]=o,s.bindVertexArray(null),o}onGeometryDestroy(e,t){let r=this._geometryVaoHash[e.uid],s=this.gl;if(r){if(t)for(let e in r)this._activeVao!==r[e]&&this.unbind(),s.deleteVertexArray(r[e]);this._geometryVaoHash[e.uid]=null}}destroyAll(e=!1){let t=this.gl;for(let r in this._geometryVaoHash){if(e)for(let e in this._geometryVaoHash[r]){let s=this._geometryVaoHash[r];this._activeVao!==s&&this.unbind(),t.deleteVertexArray(s[e])}this._geometryVaoHash[r]=null}}activateVao(e,t){let r=this._renderer.gl,s=this._renderer.buffer,n=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let i=null;for(let e in n){let a=n[e],o=a.buffer,l=s.getGlBuffer(o),u=t._attributeData[e];if(u){i!==l&&(s.bind(o),i=l);let e=u.location;r.enableVertexAttribArray(e);let t=(0,O.v)(a.format),n=w[a.format]??w.float32;if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(e,t.size,n,a.stride,a.offset):r.vertexAttribPointer(e,t.size,n,t.normalised,a.stride,a.offset),a.instance){if(this.hasInstance){let t=a.divisor??1;r.vertexAttribDivisor(e,t)}else throw Error("geometry error, GPU Instancing is not supported on this device")}}}}draw(e,t,r,s){let{gl:n}=this._renderer,i=this._activeGeometry,a=V[e||i.topology];if(s??(s=i.instanceCount),i.indexBuffer){let e=i.indexBuffer.data.BYTES_PER_ELEMENT,o=2===e?n.UNSIGNED_SHORT:n.UNSIGNED_INT;1!==s?n.drawElementsInstanced(a,t||i.indexBuffer.data.length,o,(r||0)*e,s):n.drawElements(a,t||i.indexBuffer.data.length,o,(r||0)*e)}else 1!==s?n.drawArraysInstanced(a,r||0,t||i.getSize(),s):n.drawArrays(a,r||0,t||i.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null,this._geometryVaoHash=null}}k.extension={type:[l.nw.WebGLSystem],name:"geometry"};var X=r(41890),W=r(76982),Y=r(72973);let z=new X.Z({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),j=class e{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(t={}){let{useBackBuffer:r,antialias:s}={...e.defaultOptions,...t};this.useBackBuffer=r,this._antialias=s,this._renderer.context.supports.msaa||((0,x.Z)("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=S.Z.for2d();let n=new Y.J({vertex:` 2 attribute vec2 aPosition; 3 out vec2 vUv; 4 5 void main() { 6 gl_Position = vec4(aPosition, 0.0, 1.0); 7 8 vUv = (aPosition + 1.0) / 2.0; 9 10 // flip dem UVs 11 vUv.y = 1.0 - vUv.y; 12 }`,fragment:` 13 in vec2 vUv; 14 out vec4 finalColor; 15 16 uniform sampler2D uTexture; 17 18 void main() { 19 finalColor = texture(uTexture, vUv); 20 }
20`,name:"big-triangle"});this._bigTriangleShader=new m.e({glProgram:n,resources:{uTexture:R.x.WHITE.source}})}renderStart(e){let t=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!t.isRoot,this._useBackBufferThisRender){let t=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=t.colorTexture,e.target=this._getBackBufferTexture(t.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:z,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new R.x({source:new W.p({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};j.extension={type:[l.nw.WebGLSystem],name:"backBuffer",priority:1},j.defaultOptions={useBackBuffer:!1};class K{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(8&e),!!(4&e),!!(2&e),!!(1&e)))}}K.extension={type:[l.nw.WebGLSystem],name:"colorMask"};class ${constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){let t=this._renderer,{geometry:r,shader:s,state:n,skipSync:i,topology:a,size:o,start:l,instanceCount:u}=e;t.shader.bind(s,i),t.geometry.bind(r,t.shader._activeProgram),n&&t.state.set(n),t.geometry.draw(a,o,l,u??r.instanceCount)}destroy(){this._renderer=null}}$.extension={type:[l.nw.WebGLSystem],name:"encoder"};var Z=r(4095);class q{constructor(e){this._renderer=e}contextChange(){let e=this._renderer.gl;this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=(0,Z.a)(this.maxTextures,e);let t=2===this._renderer.context.webGLVersion;this.maxUniformBindings=t?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}}q.extension={type:[l.nw.WebGLSystem],name:"limits"};var J=r(6313),Q=r(92459);class ee{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Q.D.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this.resetState()}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Q.D.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Q.D.NONE,this._stencilCache.stencilReference=0}setStencilMode(e,t){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=J.L[e],i=this._stencilCache;if(r.stencilMode=e,r.stencilReference=t,e===Q.D.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(e!==i.stencilMode||i.stencilReference!==t)&&(i.stencilMode=e,i.stencilReference=t,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],t,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}ee.extension={type:[l.nw.WebGLSystem],name:"stencil"};var et=r(43318);let er={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function es(e){let t=e.map(e=>({data:e,offset:0,size:0})),r=0,s=0;for(let e=0;e<t.length;e++){let n=t[e];if(!(r=er[n.data.type]))throw Error(`Unknown type ${n.data.type}`);
20n.data.size>1&&(r=Math.max(r,16)*n.data.size);let i=12===r?16:r;n.size=r;let a=s%16;a>0&&16-a<i?s+=(16-a)%16:s+=(r-a%r)%r,n.offset=s,s+=r}return{uboElements:t,size:s=16*Math.ceil(s/16)}}var en=r(63141),ei=r(44775);function ea(e,t){let r=Math.max(er[e.data.type]/16,1),s=e.data.value.length/e.data.size,n=(4-s%4)%4,i=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return` 21 v = uv.${e.data.name}; 22 offset += ${t}; 23 24 arrayOffset = offset; 25 26 t = 0; 27 28 for(var i=0; i < ${e.data.size*r}; i++) 29 { 30 for(var j = 0; j < ${s}; j++) 31 { 32 ${i}[arrayOffset++] = v[t++]; 33 } 34 ${0!==n?`arrayOffset += ${n};`:""} 35 } 36 `}function eo(e){return(0,en.S)(e,"uboStd40",ea,ei.d)}class el extends et.L{constructor(){super({createUboElements:es,generateUboSync:eo})}}el.extension={type:[l.nw.WebGLSystem],name:"ubo"};var eu=r(60015),e_=r(82934),ec=r(51223),eh=r(38685);class ed{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}class ef{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new e_.A}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new e_.A}copyToTexture(e,t,r,s,n){let i=this._renderTargetSystem,a=this._renderer,o=i.getGpuRenderTarget(e),l=a.gl;return this.finishRenderPass(e),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(t,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,r.x,r.y,s.width,s.height),t}startRenderPass(e,t=!0,r,s){let n=this._renderTargetSystem,i=e.colorTexture,a=n.getGpuRenderTarget(e),o=s.y;e.isRoot&&(o=i.pixelHeight-s.height),e.colorTextures.forEach(e=>{this._renderer.texture.unbind(e)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let u=this._viewPortCache;(u.x!==s.x||u.y!==o||u.width!==s.width||u.height!==s.height)&&(u.x=s.x,u.y=o,u.width=s.width,u.height=s.height,l.viewport(s.x,o,s.width,s.height)),!a.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(a),this.clear(e,t,r)}finishRenderPass(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);if(!t.msaa)return;let r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,t.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,t.framebuffer),r.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,t.framebuffer)}initGpuRenderTarget(e){let t=this._renderer.gl,r=new ed;return e.colorTexture instanceof ec.D?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),r.framebuffer=null):(this._initColor(e,r),t.bindFramebuffer(t.FRAMEBUFFER,null)),r}destroyGpuRenderTarget(e){let t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(e=>{t.deleteRenderbuffer(e)}),e.msaaRenderBuffer=null}clear(e,t,r){if(!t)return;let s=this._renderTargetSystem;"boolean"==typeof t&&(t=t?eh.E.ALL:eh.E.NONE);let n=this._renderer.gl;if(t&eh.E.COLOR){r??(r=s.defaultClearColor);let e=this._clearColorCache,t=r;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3])&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],n.clearColor(t[0],t[1],t[2],t[3]))}n.clear(t)}resizeGpuRenderTarget(e){if(e.isRoot)return;let t=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,t),(e.stencil||e.depth)&&this._resizeStencil(t)}_initColor(e,t){let r=this._renderer,s=r.gl,n=s.createFramebuffer();if(t.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.width=e.colorTexture.source.pixelWidth,t.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((e,n)=>{let i=e.source;i.antialias&&(r.context.supports.msaa?t.msaa=!0:(0,x.Z)("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(i,0);let a=r.texture.getGlSource(i).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+n,3553,a,0)}),t.msaa){let r=s.createFramebuffer();t.framebuffer=r,s.bindFramebuffer(s.FRAMEBUFFER,r),e.colorTextures.forEac
36h((e,r)=>{let n=s.createRenderbuffer();t.msaaRenderBuffer[r]=n})}else t.framebuffer=n;this._resizeColor(e,t)}_resizeColor(e,t){let r=e.colorTexture.source;if(t.width=r.pixelWidth,t.height=r.pixelHeight,e.colorTextures.forEach((e,t)=>{0!==t&&e.source.resize(r.width,r.height,r._resolution)}),t.msaa){let r=this._renderer,s=r.gl,n=t.framebuffer;s.bindFramebuffer(s.FRAMEBUFFER,n),e.colorTextures.forEach((e,n)=>{let i=e.source;r.texture.bindSource(i,0);let a=r.texture.getGlSource(i).internalFormat,o=t.msaaRenderBuffer[n];s.bindRenderbuffer(s.RENDERBUFFER,o),s.renderbufferStorageMultisample(s.RENDERBUFFER,4,a,i.pixelWidth,i.pixelHeight),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+n,s.RENDERBUFFER,o)})}}_initStencil(e){if(null===e.framebuffer)return;let t=this._renderer.gl,r=t.createRenderbuffer();e.depthStencilRenderBuffer=r,t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),this._resizeStencil(e)}_resizeStencil(e){let t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,2===this._renderer.context.webGLVersion?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}prerender(e){let t=e.colorTexture.resource;this._renderer.context.multiView&&ec.D.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(e){if(this._renderer.context.multiView&&ec.D.test(e.colorTexture.resource)){let t=this._renderer.context.canvas,r=e.colorTexture;r.context2D.drawImage(t,0,r.pixelHeight-t.height)}}}class eg extends eu.l{constructor(e){super(e),this.adaptor=new ef,this.adaptor.init(e,this)}}eg.extension={type:[l.nw.WebGLSystem],name:"renderTarget"};var em=r(71550);class eE{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function eT(e,t,r){let s=e.createShader(t);return e.shaderSource(s,r),e.compileShader(s),s}function eb(e){let t=Array(e);for(let e=0;e<t.length;e++)t[e]=!1;return t}function eR(e,t){switch(e){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return eb(2*t);case"bvec3":return eb(3*t);case"bvec4":return eb(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let ex=null,ep={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},eS={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function ev(e,t){if(!ex){let t=Object.keys(ep);ex={};for(let r=0;r<t.length;++r){let s=t[r];ex[e[s]]=ep[s]}}return ex[t]}function eA(e,t){let r=e.getShaderSource(t).split("\n").map((e,t)=>`${t}: ${e}`),s=e.getShaderInfoLog(t),n=s.split("\n"),i={},a=n.map(e=>
36parseFloat(e.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(e=>!!e&&!i[e]&&(i[e]=!0,!0)),o=[""];a.forEach(e=>{r[e-1]=`%c${r[e-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join("\n");o[0]=l,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}let eB={textureCount:0,blockIndex:0};class eN{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(e,t){if(this._setProgram(e.glProgram),t)return;eB.textureCount=0,eB.blockIndex=0;let r=this._shaderSyncFunctions[e.glProgram._key];r||(r=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),r(this._renderer,e,eB)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,eB)}bindUniformBlock(e,t,r=0){let s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),i=e._bufferResource;i||this._renderer.ubo.updateUniformGroup(e);let a=e.buffer,o=s.updateBuffer(a),l=s.freeLocationForBufferBase(o);if(i){let{offset:t,size:r}=e;0===t&&r===a.data.byteLength?s.bindBufferBase(o,l):s.bindBufferRange(o,l,t)}else s.getLastBindBaseLocation(o)!==l&&s.bindBufferBase(o,l);let u=this._activeProgram._uniformBlockData[t].index;n.uniformBlockBindings[r]!==l&&(n.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(n.program,u,l))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;let t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){let t=e._key;return this._programDataHash[t]=function(e,t){let r=eT(e,e.VERTEX_SHADER,t.vertex),s=eT(e,e.FRAGMENT_SHADER,t.fragment),n=e.createProgram();e.attachShader(n,r),e.attachShader(n,s);let i=t.transformFeedbackVaryings;i&&("function"!=typeof e.transformFeedbackVaryings?(0,x.Z)("TransformFeedback is not supported but TransformFeedbackVaryings are given."):e.transformFeedbackVaryings(n,i.names,"separate"===i.bufferMode?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS)),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)&&(e.getProgramParameter(n,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||eA(e,r),e.getShaderParameter(s,e.COMPILE_STATUS)||eA(e,s),console.error("PixiJS Error: Could not initialize shader."),""!==e.getProgramInfoLog(n)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(n)))),t._attributeData=function(e,t,r=!1){let s={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let n=t.getActiveAttrib(e,r);if(n.name.startsWith("gl_"))continue;let i=eS[ev(t,n.type)]||"float32";s[n.name]={location:0,format:i,stride:(0,O.v)(i).stride,offset:0,instance:!1,start:0}}let i=Object.keys(s);if(r){i.sort((e,t)=>e>t?1:-1);for(let r=0;r<i.length;r++)s[i[r]].location=r,t.bindAttribLocation(e,r,i[r]);t.linkProgram(e)}else for(let r=0;r<i.length;r++)s[i[r]].location=t.getAttribLocation(e,i[r]);return s}(n,e,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=function(e,t){let r={},s=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<s;n++){let s=t.getActiveUniform(e,n),i=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),o=ev(t,s.type);r[i]={name:i,index:n,type:o,size:s.size,isArray:a,value:eR(o,s.size)}}return r}(n,e),t._uniformBlockData=function(e,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let r={},s=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n<s;n++){let s=t.getActiveUniformBlockName(e,n),i=t.getUniformBlockIndex(e,s),a=t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE);r[s]={name:s,index:i,size:a}}return r}(n,e),e.deleteShader(r),e.deleteShader(s);let a={};for(let r in t._uniformData){let s=t._uniformData[r];a[r]={location:e.getUniformLocation(n,r),value:eR(s.type,s.size)}}return new eE(n,a)}(this._gl,e),this._programDataHash[t]}destroy(){for(let e of Object.keys(this._programDataHash))this._programDataHash[e].destroy(),this._programDataHash[e]=null;this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(e,t){return function(e,t){let r=[],s=[` 37 var g = s.groups; 38 var sS = r.shader; 39 var p = s.glProgram; 40 var ugS = r.uniformGroup; 41 var resources; 42 `],n=!1,i=0,a=t._getProgramData(e.glProgram);for(let o in e.groups){let l=e.groups[o];for(let u in r.push(` 43 resources = g[${o}].resources; 44 `),l.resources){let _=l.resources[u];if(_ instanceof E.o){if(_.ubo){let t=e._uniformBindMap[o][Number(u)];r.push(` 45 sS.bindUniformBlock( 46 resources[${u}], 47 '${t}', 48 ${e.glProgram._uniformBlockData[t].index} 49 ); 50 `)}else r.push(` 51 ugS.updateUniformGroup(resources[${u}], p, sD); 52 `)}else if(_ instanceof em.q){let t=e._uniformBindMap[o][Number(u)];r.push(` 53 sS.bindUniformBlock( 54 resources[${u}], 55 '${t}', 56 ${e.glProgram._uniformBlockData[t].index} 57 ); 58 `)}else if(_ instanceof W.p){let l=e._uniformBindMap[o][u],_=a.uniformData[l];_&&(n||(n=!0,s.push(` 59 var tS = r.texture; 60 `)),t._gl.uniform1i(_.location,i),r.push(` 61 tS.bind(resources[${u}], ${i}); 62 `),i++)}}}return Function("r","s","sD",[...s,...r].join("\n"))}(e,t)}resetState(){this._activeProgram=null}}eN.extension={type:[l.nw.WebGLSystem],name:"shader"};var eC=r(46940);let eG={f32:`if (cv !== v) { 63 cu.value = v; 64 gl.uniform1f(location, v); 65 }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { 66 cv[0] = v[0]; 67 cv[1] = v[1]; 68 gl.uniform2f(location, v[0], v[1]); 69 }`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { 70 cv[0] = v[0]; 71 cv[1] = v[1]; 72 cv[2] = v[2]; 73 gl.uniform3f(location, v[0], v[1], v[2]); 74 }`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { 75 cv[0] = v[0]; 76 cv[1] = v[1]; 77 cv[2] = v[2]; 78 cv[3] = v[3]; 79 gl.uniform4f(location, v[0], v[1], v[2], v[3]); 80 }`,i32:`if (cv !== v) { 81 cu.value = v; 82 gl.uniform1i(location, v); 83 }`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { 84 cv[0] = v[0]; 85 cv[1] = v[1]; 86 gl.uniform2i(location, v[0], v[1]); 87 }`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { 88 cv[0] = v[0]; 89 cv[1] = v[1]; 90 cv[2] = v[2]; 91 gl.uniform3i(location, v[0], v[1], v[2]); 92 }`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { 93 cv[0] = v[0]; 94 cv[1] = v[1]; 95 cv[2] = v[2]; 96 cv[3] = v[3]; 97 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 98 }`,u32:`if (cv !== v) { 99 cu.value = v; 100 gl.uniform1ui(location, v); 101 }`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { 102 cv[0] = v[0]; 103 cv[1] = v[1]; 104 gl.uniform2ui(location, v[0], v[1]); 105 }`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { 106 cv[0] = v[0]; 107 cv[1] = v[1]; 108 cv[2] = v[2]; 109 gl.uniform3ui(location, v[0], v[1], v[2]); 110 }`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { 111 cv[0] = v[0]; 112 cv[1] = v[1]; 113 cv[2] = v[2]; 114 cv[3] = v[3]; 115 gl.uniform4ui(location, v[0], v[1], v[2], v[3]); 116 }`,bool:`if (cv !== v) { 117 cu.value = v; 118 gl.uniform1i(location, v); 119 }`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { 120 cv[0] = v[0]; 121 cv[1] = v[1]; 122 gl.uniform2i(location, v[0], v[1]); 123 }`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { 124 cv[0] = v[0]; 125 cv[1] = v[1]; 126 cv[2] = v[2]; 127 gl.uniform3i(location, v[0], v[1], v[2]); 128 }`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { 129 cv[0] = v[0]; 130 cv[1] = v[1]; 131 cv[2] = v[2]; 132 cv[3] = v[3]; 133 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 134 }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},eI={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};class eD{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,r){let s=this._renderer.shader._getProgramData(t);e.isStatic&&e._dirtyId===s.uniformDirtyGroups[e.uid]||(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,r))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let r=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),r[t._key]=this._cache[s],r[t._key]}_generateUniformsSync(e,t){return function(e,t){let r=[` 135 var v = null; 136 var cv = null; 137 var cu = null; 138 var t = 0; 139 var gl = renderer.gl; 140 var name = null; 141 `];for(let s in e.uniforms){if(!t[s]){e.uniforms[s]instanceof E.o?e.uniforms[s].ubo?r.push(` 142 renderer.shader.bindUniformBlock(uv.${s}, "${s}"); 143 `):r.push(` 144 renderer.shader.updateUniformGroup(uv.${s}); 145 `):e.uniforms[s]instanceof em.q&&r.push(` 146 renderer.shader.bindBufferResource(uv.${s}, "${s}"); 147 `);continue}let n=e.uniformStructures[s],i=!1;for(let e=0;e<eC.s.length;e++){let t=eC.s[e];if(n.type===t.type&&t.test(n)){r.push(`name = "${s}";`,eC.s[e].uniform),i=!0;break}}if(!i){let e=(1===n.size?eG:eI)[n.type].replace("location",`ud["${s}"].location`);r.push(` 148 cu = ud["${s}"]; 149 cv = cu.value; 150 v = uv["${s}"]; 151 ${e};`)}}return Function("ud","uv","renderer","syncData",r.join("\n"))}(e,t)}_getSignature(e,t,r){let s=e.uniforms,n=[`${r}-`];for(let e in s)n.push(e),t[e]&&n.push(t[e].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}eD.extension={type:[l.nw.WebGLSystem],name:"uniformGroup"};let ey=class e{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=S.Z.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=function(e){let t={};if(t.normal=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t.add=[e.ONE,e.ONE],t.multiply=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.screen=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t["screen-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.erase
151=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],e instanceof y.z.get().getWebGLRenderingContext()){let r=e.getExtension("EXT_blend_minmax");r&&(t.min=[e.ONE,e.ONE,e.ONE,e.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,r.MAX_EXT,r.MAX_EXT])}else t.min=[e.ONE,e.ONE,e.ONE,e.ONE,e.MIN,e.MIN],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,e.MAX,e.MAX];return t}(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,r=0;for(;t;)1&t&&this.map[r].call(this,!!(e.data&1<<r)),t>>=1,r++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(t){this._updateCheck(e._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(e._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let t=this.blendModesMap[e],r=this.gl;2===t.length?r.blendFunc(t[0],t[1]):r.blendFuncSeparate(t[0],t[1],t[2],t[3]),6===t.length?(this._blendEq=!0,r.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,t){let r=this.checks.indexOf(e);t&&-1===r?this.checks.push(e):t||-1===r||this.checks.splice(r,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};ey.extension={type:[l.nw.WebGLSystem],name:"state"};class eF{constructor(e){this.target=L.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=H.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.format=U.RGBA,this.samplerType=0}}let eO={id:"buffer",upload(e,t,r){t.width===e.width||t.height===e.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.width,e.height,t.format,t.type,e.resource):r.texImage2D(t.target,0,t.internalFormat,e.width,e.height,0,t.format,t.type,e.resource),t.width=e.width,t.height=e.height}},eP={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0}
151,eU={id:"compressed",upload(e,t,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let s=e.pixelWidth,n=e.pixelHeight,i=!!eP[e.format];for(let a=0;a<e.resource.length;a++){let o=e.resource[a];i?r.compressedTexImage2D(r.TEXTURE_2D,a,t.internalFormat,s,n,0,o):r.texImage2D(r.TEXTURE_2D,a,t.internalFormat,s,n,0,t.format,t.type,o),s=Math.max(s>>1,1),n=Math.max(n>>1,1)}}},eL={id:"image",upload(e,t,r,s){let n=t.width,i=t.height,a=e.pixelWidth,o=e.pixelHeight,l=e.resourceWidth,u=e.resourceHeight;l<a||u<o?((n!==a||i!==o)&&r.texImage2D(t.target,0,t.internalFormat,a,o,0,t.format,t.type,null),2===s?r.texSubImage2D(r.TEXTURE_2D,0,0,0,l,u,t.format,t.type,e.resource):r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,t.type,e.resource)):n===a&&i===o?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,t.type,e.resource):2===s?r.texImage2D(t.target,0,t.internalFormat,a,o,0,t.format,t.type,e.resource):r.texImage2D(t.target,0,t.internalFormat,t.format,t.type,e.resource),t.width=a,t.height=o}},eM={id:"video",upload(e,t,r,s){if(!e.isValid){r.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}eL.upload(e,t,r,s)}},eH={linear:9729,nearest:9728},ew={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},eV={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},ek={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function eX(e,t,r,s,n,i,a,o){if(!o||"repeat"!==e.addressModeU||"repeat"!==e.addressModeV||"repeat"!==e.addressModeW){let r=eV[a?"clamp-to-edge":e.addressModeU],s=eV[a?"clamp-to-edge":e.addressModeV],o=eV[a?"clamp-to-edge":e.addressModeW];t[n](i,t.TEXTURE_WRAP_S,r),t[n](i,t.TEXTURE_WRAP_T,s),t.TEXTURE_WRAP_R&&t[n](i,t.TEXTURE_WRAP_R,o)}if(o&&"linear"===e.magFilter||t[n](i,t.TEXTURE_MAG_FILTER,eH[e.magFilter]),r){if(!o||"linear"!==e.mipmapFilter){let r=ew[e.minFilter][e.mipmapFilter];t[n](i,t.TEXTURE_MIN_FILTER,r)}}else t[n](i,t.TEXTURE_MIN_FILTER,eH[e.minFilter]);if(s&&e.maxAnisotropy>1){let r=Math.min(e.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[n](i,s.TEXTURE_MAX_ANISOTROPY_EXT,r)}e.compare&&t[n](i,t.TEXTURE_COMPARE_FUNC,ek[e.compare])}class eW{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:eL,buffer:eO,video:eM,compressed:eU},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){if(this._gl=e,!this._mapFormatToInternalFormat){var t;let r,s;this._mapFormatToInternalFormat=(t=this._renderer.context.extensions,r={},s=e.RGBA,e instanceof y.z.get().getWebGLRenderingContext()?t.srgb&&(r={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":e.SRGB8_ALPHA8,"bgra8unorm-srgb":e.SRGB8_ALPHA8},s=e.RGBA8),{r8unorm:e.R8,r8snorm:e.R8_SNORM,r8uint:e.R8UI,r8sint:e.R8I,r16uint:e.R16UI,r16sint:e.R16I,r16float:e.R16F,rg8unorm:e.RG8,rg8snorm:e.RG8_SNORM,rg8uint:e.RG8UI,rg8sint:e.RG8I,r32uint:e.R32UI,r32sint:e.R32I,r32float:e.R32F,rg16uint:e.RG16UI,rg16sint:e.RG16I,rg16float:e.RG16F,rgba8unorm:e.RGBA,...r,rgba8snorm:e.RGBA8_SNORM,rgba8uint:e.RGBA8UI,rgba8sint:e.RGBA8I,bgra8unorm:s,rgb9e5ufloat:e.RGB9_E5,rgb10a2unorm:e.RGB10_A2,rg11b10ufloat:e.R11F_G11F_B10F,rg32uint:e.RG32UI,rg32sint:e.RG32I,rg32float:e.RG32F,rgba16uint:e.RGBA16UI,rgba16sint:e.RGBA16I,rgba16float:e.RGBA16F,rgba32uint:e.RGBA32UI,rgba32sint:e.RGBA32I,rgba32float:e.RGBA32F,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT16,depth24plus:e.DEPTH_COMPONENT24,"depth24plus-stencil8":e.DEPTH24_STENCIL8,depth32float:e.DEPTH_COMPONENT32F,"depth32float-stencil8":e.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}
151,...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}),this._mapFormatToType={r8unorm:e.UNSIGNED_BYTE,r8snorm:e.BYTE,r8uint:e.UNSIGNED_BYTE,r8sint:e.BYTE,r16uint:e.UNSIGNED_SHORT,r16sint:e.SHORT,r16float:e.HALF_FLOAT,rg8unorm:e.UNSIGNED_BYTE,rg8snorm:e.BYTE,rg8uint:e.UNSIGNED_BYTE,rg8sint:e.BYTE,r32uint:e.UNSIGNED_INT,r32sint:e.INT,r32float:e.FLOAT,rg16uint:e.UNSIGNED_SHORT,rg16sint:e.SHORT,rg16float:e.HALF_FLOAT,rgba8unorm:e.UNSIGNED_BYTE,"rgba8unorm-srgb":e.UNSIGNED_BYTE,rgba8snorm:e.BYTE,rgba8uint:e.UNSIGNED_BYTE,rgba8sint:e.BYTE,bgra8unorm:e.UNSIGNED_BYTE,"bgra8unorm-srgb":e.UNSIGNED_BYTE,rgb9e5ufloat:e.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:e.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:e.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:e.UNSIGNED_INT,rg32sint:e.INT,rg32float:e.FLOAT,rgba16uint:e.UNSIGNED_SHORT,rgba16sint:e.SHORT,rgba16float:e.HALF_FLOAT,rgba32uint:e.UNSIGNED_INT,rgba32sint:e.INT,rgba32float:e.FLOAT,stencil8:e.UNSIGNED_BYTE,depth16unorm:e.UNSIGNED_SHORT,depth24plus:e.UNSIGNED_INT,"depth24plus-stencil8":e.UNSIGNED_INT_24_8,depth32float:e.FLOAT,"depth32float-stencil8":e.FLOAT_32_UNSIGNED_INT_24_8_REV},this._mapFormatToFormat={r8unorm:e.RED,r8snorm:e.RED,r8uint:e.RED,r8sint:e.RED,r16uint:e.RED,r16sint:e.RED,r16float:e.RED,rg8unorm:e.RG,rg8snorm:e.RG,rg8uint:e.RG,rg8sint:e.RG,r32uint:e.RED,r32sint:e.RED,r32float:e.RED,rg16uint:e.RG,rg16sint:e.RG,rg16float:e.RG,rgba8unorm:e.RGBA,"rgba8unorm-srgb":e.RGBA,rgba8snorm:e.RGBA,rgba8uint:e.RGBA,rgba8sint:e.RGBA,bgra8unorm:e.RGBA,"bgra8unorm-srgb":e.RGBA,rgb9e5ufloat:e.RGB,rgb10a2unorm:e.RGBA,rg11b10ufloat:e.RGB,rg32uint:e.RG,rg32sint:e.RG,rg32float:e.RG,rgba16uint:e.RGBA,rgba16sint:e.RGBA,rgba16float:e.RGBA,rgba32uint:e.RGBA,rgba32sint:e.RGBA,rgba32float:e.RGBA,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT,depth24plus:e.DEPTH_COMPONENT,"depth24plus-stencil8":e.DEPTH_STENCIL,depth32float:e.DEPTH_COMPONENT,"depth32float-stencil8":e.DEPTH_STENCIL}}this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(R.x.EMPTY,e)}initSource(e){this.bind(e)}bind(e,t=0){let r=e.source;e?(this.bindSource(r,t),this._useSeparateSamplers&&this._bindSampler(r.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let r=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=R.x.EMPTY.source);let s=this.getGlSource(e);r.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let r=this._gl;if(!e){this._boundSamplers[t]=null,r.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,r.bindSampler(t,s))}unbind(e){let t=e.source,r=this._boundTextures,s=this._gl;for(let e=0;e<r.length;e++)if(r[e]===t){this._activateLocation(e);let n=this.getGlSource(t);s.bindTexture(n.target,null),r[e]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let t=new eF(this._gl.createTexture());if(t.type=this._mapFormatToType[e.format],t.internalFormat=this._mapFormatToInternalFormat[e.format],t.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let t=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(t))+1}return this._glTextures[e.uid]=t,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),t}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){let r=this._gl,s=this.getGlSource(e);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,eX(e.style,r,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,r=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=e;let s="premultiply-alpha-on-upload"===e.alphaMode;this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,r,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let r=this.getGlSource(e);this._gl.generateMipmap(r.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,r=this._gl.createSampler();return this._glSamplers[e._resourceId]=r,eX(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>
1511,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:r,height:s}=this.getPixels(e),n=y.z.get().createCanvas();n.width=r,n.height=s;let i=n.getContext("2d");if(i){let e=i.createImageData(r,s);e.data.set(t),i.putImageData(e,0,0)}return n}getPixels(e){let t=e.source.resolution,r=e.frame,s=Math.max(Math.round(r.width*t),1),n=Math.max(Math.round(r.height*t),1),i=new Uint8Array(4*s*n),a=this._renderer,o=a.renderTarget.getRenderTarget(e),l=a.renderTarget.getGpuRenderTarget(o),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),u.readPixels(Math.round(r.x*t),Math.round(r.y*t),s,n,u.RGBA,u.UNSIGNED_BYTE,i),{pixels:new Uint8ClampedArray(i.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._glTextures=null,this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(R.x.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}}eW.extension={type:[l.nw.WebGLSystem],name:"texture"};let eY=[...B.N,el,j,F,q,D,eW,eg,k,eD,eN,$,ey,ee,K],ez=[...B.U],ej=[v,p,T],eK=[],e$=[],eZ=[];l.Rw.handleByNamedList(l.nw.WebGLSystem,eK),l.Rw.handleByNamedList(l.nw.WebGLPipes,e$),l.Rw.handleByNamedList(l.nw.WebGLPipesAdaptor,eZ),l.Rw.add(...eY,...ez,...ej);class eq extends A.I{constructor(){super({name:"webgl",type:N.g.WEBGL,systems:eK,renderPipes:e$,renderPipeAdaptors:eZ})}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.