@uptimizr/dashboard 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +76 -0
- package/out/404.html +1 -0
- package/out/__next.__PAGE__.txt +9 -0
- package/out/__next._full.txt +20 -0
- package/out/__next._head.txt +6 -0
- package/out/__next._index.txt +5 -0
- package/out/__next._tree.txt +4 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_buildManifest.js +11 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_clientMiddlewareManifest.js +1 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_ssgManifest.js +1 -0
- package/out/_next/static/chunks/0-2y-_oomza2l.js +87 -0
- package/out/_next/static/chunks/00k_j_r7bv_eb.js +266 -0
- package/out/_next/static/chunks/00zdau6mcqeae.js +1 -0
- package/out/_next/static/chunks/023axeoslq39i.js +1 -0
- package/out/_next/static/chunks/068j6934u8j16.js +1 -0
- package/out/_next/static/chunks/0_rf76jneiwal.js +176 -0
- package/out/_next/static/chunks/0aznt7717miff.js +1 -0
- package/out/_next/static/chunks/0cu-q5q3a7uf3.js +1 -0
- package/out/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/out/_next/static/chunks/0dm32-jq30tg8.js +1 -0
- package/out/_next/static/chunks/0dn0yx0rn6mpf.js +1 -0
- package/out/_next/static/chunks/0flc7nppbmsl1.js +3 -0
- package/out/_next/static/chunks/0fskcfh9vbhtv.js +1 -0
- package/out/_next/static/chunks/0gv7mblzv3dl3.js +87 -0
- package/out/_next/static/chunks/0impkpmxx3ttp.js +1 -0
- package/out/_next/static/chunks/0jmn7u31w95ly.js +91 -0
- package/out/_next/static/chunks/0n8n481szj90g.js +1 -0
- package/out/_next/static/chunks/0o6ayai0s01js.js +1 -0
- package/out/_next/static/chunks/0rys92_73hdb0.js +22 -0
- package/out/_next/static/chunks/0tl_moiyi2txt.js +1 -0
- package/out/_next/static/chunks/0tx1j_ghpz7rc.css +3 -0
- package/out/_next/static/chunks/0ufbyo1x3qkmo.js +1 -0
- package/out/_next/static/chunks/0v82oqyoy9zol.js +1 -0
- package/out/_next/static/chunks/0wrm9jr-9bw0e.js +1893 -0
- package/out/_next/static/chunks/0wwcfw8i3j_zx.js +1 -0
- package/out/_next/static/chunks/0ys9-ozuluawt.js +1 -0
- package/out/_next/static/chunks/1-61zh4waha61.js +1 -0
- package/out/_next/static/chunks/10r_824wzt8hj.js +1 -0
- package/out/_next/static/chunks/112hws17nz665.js +7 -0
- package/out/_next/static/chunks/123xxske5c9na.js +1 -0
- package/out/_next/static/chunks/13isnf0--pmx1.js +1 -0
- package/out/_next/static/chunks/157d9euci08yu.js +1 -0
- package/out/_next/static/chunks/15s7425ffrec9.js +3 -0
- package/out/_next/static/chunks/163fa70v4mgxj.js +1 -0
- package/out/_next/static/chunks/17q0c2h5ui10r.js +4 -0
- package/out/_next/static/chunks/18u58lorfahxi.js +4 -0
- package/out/_next/static/chunks/1_aahautsz2v_.js +1 -0
- package/out/_next/static/chunks/1a9l89j7e6mqu.js +23 -0
- package/out/_next/static/chunks/1dsy2ngmfflis.js +123 -0
- package/out/_next/static/chunks/1flb8adpj6_2o.js +62 -0
- package/out/_next/static/chunks/1lsg-22yob8dx.js +1 -0
- package/out/_next/static/chunks/1nj82er7msdto.js +2 -0
- package/out/_next/static/chunks/1o1d0p-v1z8ty.js +1 -0
- package/out/_next/static/chunks/1pdep2_c530sg.js +1 -0
- package/out/_next/static/chunks/1thjncpj7u6pq.js +1 -0
- package/out/_next/static/chunks/1vdjn0pkoyypn.js +1 -0
- package/out/_next/static/chunks/1yehxf-fmeicg.js +1 -0
- package/out/_next/static/chunks/1zvc1tv--w8nn.js +1 -0
- package/out/_next/static/chunks/1zx2q-r32thv1.js +4 -0
- package/out/_next/static/chunks/2-sjjedfr0kfq.js +1 -0
- package/out/_next/static/chunks/21o42k82w4llc.js +1 -0
- package/out/_next/static/chunks/25b9x-li-tvk2.js +1 -0
- package/out/_next/static/chunks/2712627rfsmwn.js +1 -0
- package/out/_next/static/chunks/296w2ke-v5tbm.js +9 -0
- package/out/_next/static/chunks/29tfeb6amdkjb.js +23 -0
- package/out/_next/static/chunks/2a3spdq-m8drh.js +3 -0
- package/out/_next/static/chunks/2aelw3far6rii.js +1 -0
- package/out/_next/static/chunks/2aor7m-wbis85.js +1 -0
- package/out/_next/static/chunks/2cbmf9m7lqv6k.js +4 -0
- package/out/_next/static/chunks/2d09v5u7dfq0q.js +1 -0
- package/out/_next/static/chunks/2feca0xcipcyt.js +850 -0
- package/out/_next/static/chunks/2fh-_9b6tqhvb.js +1 -0
- package/out/_next/static/chunks/2g5gecypj0rqe.js +1 -0
- package/out/_next/static/chunks/2kazjq29jeamx.js +1109 -0
- package/out/_next/static/chunks/2p2vv6cc9i-3q.js +255 -0
- package/out/_next/static/chunks/2szdcpl41-kzv.js +1 -0
- package/out/_next/static/chunks/2tws5udjdcmh3.js +1 -0
- package/out/_next/static/chunks/2u6shh3oeycm-.js +1 -0
- package/out/_next/static/chunks/2unhhuv0arlcv.js +1 -0
- package/out/_next/static/chunks/2xwy0-qfho1iz.js +91 -0
- package/out/_next/static/chunks/2ycvtdd68gub7.js +1 -0
- package/out/_next/static/chunks/2yiy_l8bwiw2_.js +3 -0
- package/out/_next/static/chunks/2yph6f7khgqii.js +1 -0
- package/out/_next/static/chunks/3-shckrcpvbxu.js +1681 -0
- package/out/_next/static/chunks/30fq_t9e2_fv-.js +1 -0
- package/out/_next/static/chunks/30yzu213bqtq0.js +5 -0
- package/out/_next/static/chunks/310uz81hnnzsu.js +1 -0
- package/out/_next/static/chunks/3218lp8l0a5g_.js +1 -0
- package/out/_next/static/chunks/35h5n42wxwgzk.js +123 -0
- package/out/_next/static/chunks/37vzwr3ciejf1.js +1 -0
- package/out/_next/static/chunks/38fhw7fatsyvd.js +3 -0
- package/out/_next/static/chunks/3be6s4_kn9q-o.js +1 -0
- package/out/_next/static/chunks/3i3gbhccmhu7j.js +210 -0
- package/out/_next/static/chunks/3l1dr_qm_x5kp.js +1 -0
- package/out/_next/static/chunks/3mqy-84_ul3t2.js +1 -0
- package/out/_next/static/chunks/3nz-dh9d7cehk.js +1 -0
- package/out/_next/static/chunks/3pufs8g4ui943.js +1 -0
- package/out/_next/static/chunks/3sjq_xoi4rbyg.js +31 -0
- package/out/_next/static/chunks/3t06schbtqonl.js +1 -0
- package/out/_next/static/chunks/3v3-7fio3nw_t.js +1 -0
- package/out/_next/static/chunks/3v5ha25nxo43j.js +1 -0
- package/out/_next/static/chunks/3yfrsm8lfi6ls.js +22 -0
- package/out/_next/static/chunks/3zskk1hxu3-_o.js +1 -0
- package/out/_next/static/chunks/turbopack-2ropzf0axp1x9.js +1 -0
- package/out/_next/static/media/0c89a48fa5027cee-s.p.2cyn07wtgehh0.woff2 +0 -0
- package/out/_next/static/media/13bf9871fe164e7f-s.2f7nqdagzwx2-.woff2 +0 -0
- package/out/_next/static/media/28868e710e86be81-s.2eksvhm1z0jwa.woff2 +0 -0
- package/out/_next/static/media/32687112bd2dd8db-s.1gepa_7fcx9fm.woff2 +0 -0
- package/out/_next/static/media/3fe682a82f50d426-s.0vfdmo25voy_0.woff2 +0 -0
- package/out/_next/static/media/70bc3e132a0a741e-s.p.3t6q91iet4nsy.woff2 +0 -0
- package/out/_next/static/media/71b036adf157cdcf-s.0bp8oijd_gu96.woff2 +0 -0
- package/out/_next/static/media/89b21bb081cb7469-s.1fby2rem9ngyr.woff2 +0 -0
- package/out/_next/static/media/cc545e633e20c56d-s.176arc174-8zp.woff2 +0 -0
- package/out/_next/static/media/icon.08h29dad3pcxg.svg +4 -0
- package/out/_not-found/__next._full.txt +16 -0
- package/out/_not-found/__next._head.txt +6 -0
- package/out/_not-found/__next._index.txt +5 -0
- package/out/_not-found/__next._not-found.__PAGE__.txt +5 -0
- package/out/_not-found/__next._not-found.txt +5 -0
- package/out/_not-found/__next._tree.txt +2 -0
- package/out/_not-found.html +1 -0
- package/out/_not-found.txt +16 -0
- package/out/api/projects +1 -0
- package/out/icon.svg +4 -0
- package/out/index.html +1 -0
- package/out/index.txt +20 -0
- package/out/logo.svg +46 -0
- package/package.json +67 -0
- package/server/standalone.mjs +182 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68179,e=>{"use strict";function t(e){let t=r(e),s=i(e);return t-e>e-s?s:t}function r(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}function i(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)}e.s(["FloorPOT",0,i,"GetExponentOfTwo",0,function(e,s,a=2){let n;switch(a){case 1:n=i(e);break;case 2:n=t(e);break;default:n=r(e)}return Math.min(n,s)},"IsExponentOfTwo",0,function(e){let t=1;do t*=2;while(t<e)return t===e},"Mix",0,function(e,t,r){return e*(1-r)+t*r},"NearestPOT",0,t])},18064,30419,29485,e=>{"use strict";e.s(["IsWrapper",0,function(e){return void 0===e.getPipelineContext}],18064),e.s(["WebGLShaderProcessor",0,class{constructor(){this.shaderLanguage=0}postProcessor(e,t,r,i,s){return s.drawBuffersExtensionDisabled&&(e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")),e}}],30419);let t=/(flat\s)?\s*varying\s*.*/;e.s(["WebGL2ShaderProcessor",0,class{constructor(){this.shaderLanguage=0}attributeProcessor(e){return e.replace("attribute","in")}varyingCheck(e,r){return t.test(e)}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,r){let i=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),r){let r=-1!==e.search(/layout *\(location *= *0\) *out/g),s=-1!==t.indexOf("#define DUAL_SOURCE_BLENDING");s&&(e="#extension GL_EXT_blend_func_extended : require\n"+e),e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(i||r?"":s?"layout(location = 0, index = 0) out vec4 glFragColor;\nlayout(location = 0, index = 1) out vec4 glFragColor2;\n":"layout(location = 0) out vec4 glFragColor;\n")+"void main(")}else if(t.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0&&(e="invariant gl_Position;\n"+e),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e}}],29485)},24574,e=>{"use strict";class t{get underlyingResource(){return null}constructor(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=t._Counter++}}t._Counter=0,e.s(["DataBuffer",0,t])},20483,e=>{"use strict";var t=e.i(24574);class r extends t.DataBuffer{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}e.s(["WebGLDataBuffer",0,r])},71379,40462,79814,e=>{"use strict";var t,r,i,s,a,n,_,l,h=e.i(99904),u=e.i(8881),o=e.i(76535),c=e.i(18064),g=e.i(13379),f=e.i(64545),d=e.i(30419),E=e.i(29485),T=e.i(20483),R=e.i(68179);class p{get underlyingResource(){return this._webGLTexture}constructor(e=null,t){if(this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw Error("Unable to create webGL texture");this.set(e)}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffers=null}addMSAARenderBuffer(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)}releaseMSAARenderBuffers(){if(this._MSAARenderBuffers){for(let e of this._MSAARenderBuffers)this._context.deleteRenderbuffer(e);this._MSAARenderBuffers=null}}getMSAARenderBuffer(e=0){return this._MSAARenderBuffers?.[e]??null}release(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}e.s(["WebGLHardwareTexture",0,p],40462);var A=e.i(84201),x=e.i(75017),S=e.i(28799);function b(e){return 13===e||14===e||15===e||16===e||17===e||18===e||19===e}function m(e){return 13===e||17===e||18===e||19===e}e.s(["HasStencilAspect",0,m,"IsDepthTexture",0,b],79814);var B=e.i(41520),C=e.i(75405);class P{}class L extends o.AbstractEngine{get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}static get ShadersRepository(){return h.Effect.ShadersRepository}static set ShadersRepository(e){h.Effect.ShadersRepository=e}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get _supportsHardwareTextureRescaling(){return!1}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e}snapshotRenderingReset(){this.snapshotRendering=!1}constructor(e,t,r,i){let s;if(r=r||{},super(t??r.antialias,r,i),this._name="WebGL",this.forcePOTTextures=!1,this.validateShaderPrograms=!1,this.disableUniformBuffers=!1,this._webGLVersion=1,this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=[],this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=[],this._currentInstanceLocations=[],this._currentInstanceBuffers=[],this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=[],this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},!e)return;if(e.getContext){if(s=e,void 0===r.preserveDrawingBuffer&&(r.preserveDrawingBuffer=!1),void 0===r.xrCompatible&&(r.xrCompatible=!1),navigator&&navigator.userAgent){this._setupMobileChecks();const e=navigator.userAgent;for(const t of L.ExceptionList){const i=t.key,s=t.targets;if(new RegExp(i).test(e)){if(t.capture&&t.captureConstraint){const r=t.capture,i=t.captureConstraint,s=new RegExp(r).exec(e);if(s&&s.length>0&&parseInt(s[s.length-1])>=i)continue}for(const e of s)switch(e){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":r.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost?this._onContextLost=()=>{(0,u.deleteStateObject)(this._gl)}:(this._onContextLost=e=>{e.preventDefault(),this._contextWasLost=!0,(0,u.deleteStateObject)(this._gl),g.Logger.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(()=>this._initGLContext())},s.addEventListener("webglcontextrestored",this._onContextRestored,!1),r.powerPreference=r.powerPreference||"high-performance"),s.addEventListener("webglcontextlost",this._onContextLost,!1),this._badDesktopOS&&(r.xrCompatible=!1),!r.disableWebGL2Support)try{this._gl=s.getContext("webgl2",r)||s.getContext("experimental-webgl2",r),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!s)throw Error("The provided canvas is null or undefined.");try{this._gl=s.getContext("webgl",r)||s.getContext("experimental-webgl",r)}catch(e){throw Error("WebGL not supported",{cause:e})}}if(!this._gl)throw Error("WebGL not supported")}else{this._gl=e,s=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";const t=this._gl.getContextAttributes();t&&(r.stencil=t.stencil)}this._sharedInit(s),this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==r.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=r.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(let e=0;e<this._caps.maxVertexAttribs;e++)this._currentBufferPointers[e]=new P;this._shaderProcessor=this.webGLVersion>1?new E.WebGL2ShaderProcessor:new d.WebGLShaderProcessor;const a=`Babylon.js v${L.Version}`;g.Logger.Log(a+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",a);const n=(0,u.getStateObject)(this._gl);n.validateShaderPrograms=this.validateShaderPrograms,n.parallelShaderCompile=this._caps.parallelShaderCompile}_clearEmptyResources(){this._dummyFramebuffer=null,super._clearEmptyResources()}_getShaderProcessingContext(e){return null}areAllEffectsReady(){for(let e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_initGLContext(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),shaderFloatPrecision:0,parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),blendFloat:null!==this._gl.getExtension("EXT_float_blend"),supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1,textureNorm16:!!this._gl.getExtension("EXT_texture_norm16"),blendParametersPerTarget:!1,dualSourceBlending:!1,supportReadWriteStorageTextures:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);let e=this._gl.getExtension("WEBGL_debug_renderer_info");null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)??0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!!(this._caps.textureFloat&&this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!!(this._caps.textureFloat&&this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.textureNorm16&&(this._gl.R16_EXT=33322,this._gl.RG16_EXT=33324,this._gl.RGB16_EXT=32852,this._gl.RGBA16_EXT=32859,this._gl.R16_SNORM_EXT=36760,this._gl.RG16_SNORM_EXT=36761,this._gl.RGB16_SNORM_EXT=36762,this._gl.RGBA16_SNORM_EXT=36763);let t=this._gl.getExtension("OES_draw_buffers_indexed");if(this._caps.blendParametersPerTarget=!!t,this._alphaState=new B.AlphaState(this._caps.blendParametersPerTarget),t&&(this._gl.blendEquationSeparateIndexed=t.blendEquationSeparateiOES.bind(t),this._gl.blendEquationIndexed=t.blendEquationiOES.bind(t),this._gl.blendFuncSeparateIndexed=t.blendFuncSeparateiOES.bind(t),this._gl.blendFuncIndexed=t.blendFunciOES.bind(t),this._gl.colorMaskIndexed=t.colorMaskiOES.bind(t),this._gl.disableIndexed=t.disableiOES.bind(t),this._gl.enableIndexed=t.enableiOES.bind(t)),this._caps.dualSourceBlending=!!this._gl.getExtension("WEBGL_blend_func_extended"),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES),this._caps.maxDrawBuffers=this._gl.getParameter(this._gl.MAX_DRAW_BUFFERS);else{let e=this._gl.getExtension("WEBGL_draw_buffers");if(null!==e){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=e.drawBuffersWEBGL.bind(e),this._caps.maxDrawBuffers=this._gl.getParameter(e.MAX_DRAW_BUFFERS_WEBGL),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let t=0;t<16;t++)this._gl["COLOR_ATTACHMENT"+t+"_WEBGL"]=e["COLOR_ATTACHMENT"+t+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{let e=this._gl.getExtension("WEBGL_depth_texture");null!=e&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{let e=this._gl.getExtension("OES_vertex_array_object");null!=e&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=e.createVertexArrayOES.bind(e),this._gl.bindVertexArray=e.bindVertexArrayOES.bind(e),this._gl.deleteVertexArray=e.deleteVertexArrayOES.bind(e))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{let e=this._gl.getExtension("ANGLE_instanced_arrays");null!=e?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this._gl.drawElementsInstanced=e.drawElementsInstancedANGLE.bind(e),this._gl.vertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);if(e&&t&&(this._caps.highPrecisionShaderSupported=0!==e.precision&&0!==t.precision,this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision)),!this._shouldUseHighPrecisionShader){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.MEDIUM_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.MEDIUM_FLOAT);e&&t&&(this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision))}this._caps.shaderFloatPrecision<10&&(this._caps.shaderFloatPrecision=10)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{let e=this._gl.getExtension("EXT_blend_minmax");null!=e&&(this._caps.blendMinMax=!0,this._gl.MAX=e.MAX_EXT,this._gl.MIN=e.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{let e=this._gl.getExtension("EXT_sRGB");null!=e&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:e.SRGB_EXT,SRGB8:e.SRGB_ALPHA_EXT,SRGB8_ALPHA8:e.SRGB_ALPHA_EXT})}if(this._creationOptions){let e=this._creationOptions.forceSRGBBufferSupportState;void 0!==e&&(this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&e)}}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let e=0;e<this._maxSimultaneousTextures;e++)this._nextFreeTextureSlots.push(e);"Mali-G72"===this._glRenderer&&(this._caps.disableMorphTargetTexture=!0)}_initFeatures(){this._features={forceBitmapOverHTMLImageElement:"u"<typeof HTMLImageElement,supportRenderAndCopyToLodForFloatTextures:1!==this._webGLVersion,supportDepthStencilTexture:1!==this._webGLVersion,supportShadowSamplers:1!==this._webGLVersion,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:1!==this._webGLVersion,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:1!==this._webGLVersion,basisNeedsPOT:1===this._webGLVersion,support3DTextures:1!==this._webGLVersion,needTypeSuffixInShaderConstants:1!==this._webGLVersion,supportMSAA:1!==this._webGLVersion,supportSSAO2:1!==this._webGLVersion,supportIBLShadows:1!==this._webGLVersion,supportExtendedTextureFormats:1!==this._webGLVersion,supportSwitchCaseInShader:1!==this._webGLVersion,supportSyncTextureRead:!0,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!1,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!1,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!1}}get webGLVersion(){return this._webGLVersion}getClassName(){return"ThinEngine"}_prepareWorkingCanvas(){if(this._workingCanvas)return;this._workingCanvas=this.createCanvas(1,1);let e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}getInfo(){return this.getGlInfo()}getGlInfo(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}}extractDriverInfo(){let e=this.getGlInfo();return e&&e.renderer?e.renderer:""}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}clear(e,t,r,i=!1,s=0){let a=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=a;let n=0;if(t&&e){let t=!0;if(this._currentRenderTarget){let r=this._currentRenderTarget.texture?.format;if(8===r||9===r||10===r||11===r){let r=this._currentRenderTarget.texture?.type;7===r||5===r?(L._TempClearColorUint32[0]=255*e.r,L._TempClearColorUint32[1]=255*e.g,L._TempClearColorUint32[2]=255*e.b,L._TempClearColorUint32[3]=255*e.a,this._gl.clearBufferuiv(this._gl.COLOR,0,L._TempClearColorUint32)):(L._TempClearColorInt32[0]=255*e.r,L._TempClearColorInt32[1]=255*e.g,L._TempClearColorInt32[2]=255*e.b,L._TempClearColorInt32[3]=255*e.a,this._gl.clearBufferiv(this._gl.COLOR,0,L._TempClearColorInt32)),t=!1}}t&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),n|=this._gl.COLOR_BUFFER_BIT)}r&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),n|=this._gl.DEPTH_BUFFER_BIT),i&&(this._gl.clearStencil(s),n|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(n)}_viewport(e,t,r,i){(e!==this._viewportCached.x||t!==this._viewportCached.y||r!==this._viewportCached.z||i!==this._viewportCached.w)&&(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=r,this._viewportCached.w=i,this._gl.viewport(e,t,r,i))}endFrame(){super.endFrame(),this._badOS&&this.flushFramebuffer()}get performanceMonitor(){throw Error("Not Supported by ThinEngine")}bindFramebuffer(e,t=0,r,i,s,a=0,n=0){this._currentRenderTarget&&this._resolveAndGenerateMipMapsFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._framebuffer);let _=this._gl;e.isMulti||(e.is2DArray||e.is3D?(_.framebufferTextureLayer(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,e.texture._hardwareTexture?.underlyingResource,a,n),e._currentLOD=a):e.isCube?_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.texture._hardwareTexture?.underlyingResource,a):e._currentLOD!==a&&(_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,e.texture._hardwareTexture?.underlyingResource,a),e._currentLOD=a));let l=e._depthStencilTexture;if(l){e.is3D&&(e.texture.width!==l.width||e.texture.height!==l.height||e.texture.depth!==l.depth)&&g.Logger.Warn("Depth/Stencil attachment for 3D target must have same dimensions as color attachment");let r=e._depthStencilTextureWithStencil?_.DEPTH_STENCIL_ATTACHMENT:_.DEPTH_ATTACHMENT;e.is2DArray||e.is3D?_.framebufferTextureLayer(_.FRAMEBUFFER,r,l._hardwareTexture?.underlyingResource,a,n):e.isCube?_.framebufferTexture2D(_.FRAMEBUFFER,r,_.TEXTURE_CUBE_MAP_POSITIVE_X+t,l._hardwareTexture?.underlyingResource,a):_.framebufferTexture2D(_.FRAMEBUFFER,r,_.TEXTURE_2D,l._hardwareTexture?.underlyingResource,a)}e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._MSAAFramebuffer),this._cachedViewport&&!s?this.setViewport(this._cachedViewport,r,i):(!r&&(r=e.width,a&&(r/=Math.pow(2,a))),!i&&(i=e.height,a&&(i/=Math.pow(2,a))),this._viewport(0,0,r,i)),this.wipeCaches()}setStateCullFaceType(e,t){let r=this.cullBackFaces??e??!0?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==r||t)&&(this._depthCullingState.cullFace=r)}setState(e,t=0,r,i=!1,s,a,n=0){(this._depthCullingState.cull!==e||r)&&(this._depthCullingState.cull=e),this.setStateCullFaceType(s,r),this.setZOffset(t),this.setZOffsetUnits(n);let _=i?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==_||r)&&(this._depthCullingState.frontFace=_),this._stencilStateComposer.stencilMaterial=a}_resolveAndGenerateMipMapsFramebuffer(e,t=!1){e.disableAutomaticMSAAResolve||(e.isMulti?this.resolveMultiFramebuffer(e):this.resolveFramebuffer(e)),t||(e.isMulti?this.generateMipMapsMultiFramebuffer(e):this.generateMipMapsFramebuffer(e))}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return null===this._currentFramebuffer}generateMipmaps(e){let t=this._getTextureTarget(e);this._bindTextureDirectly(t,e,!0),this._gl.generateMipmap(t),this._bindTextureDirectly(t,null)}unBindFramebuffer(e,t,r){this._currentRenderTarget=null,this._resolveAndGenerateMipMapsFramebuffer(e,t),r&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),r()),this._bindUnboundFramebuffer(null)}generateMipMapsFramebuffer(e){!e.isMulti&&e.texture?.generateMipMaps&&!e.isCube&&this.generateMipmaps(e.texture)}resolveFramebuffer(e){let t=this._gl;if(!e._MSAAFramebuffer||e.isMulti)return;let r=e.resolveMSAAColors?t.COLOR_BUFFER_BIT:0;r|=e._generateDepthBuffer&&e.resolveMSAADepth?t.DEPTH_BUFFER_BIT:0,r|=e._generateStencilBuffer&&e.resolveMSAAStencil?t.STENCIL_BUFFER_BIT:0,t.bindFramebuffer(t.READ_FRAMEBUFFER,e._MSAAFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer),t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r,t.NEAREST)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e,t,r){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){let r=this._gl.createBuffer();if(!r)throw Error("Unable to create vertex buffer");let i=new T.WebGLDataBuffer(r);return this.bindArrayBuffer(i),"number"!=typeof e?e instanceof Array?(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t),i.capacity=4*e.length):(this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),i.capacity=e.byteLength):(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Uint8Array(e),t),i.capacity=e),this._resetVertexBufferBinding(),i.references=1,i}createDynamicVertexBuffer(e,t){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t,r){let i=this._gl.createBuffer(),s=new T.WebGLDataBuffer(i);if(!i)throw Error("Unable to create index buffer");this.bindIndexBuffer(s);let a=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,a,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),s.references=1,s.is32Bits=4===a.BYTES_PER_ELEMENT,s}_normalizeIndexData(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;else for(let t=0;t<e.length;t++)if(e[t]>=65535)return new Uint32Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,r){let i=e.program,s=this._gl.getUniformBlockIndex(i,t);this._gl.uniformBlockBinding(i,s,r)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,r,i,s,a,n){let _=this._currentBufferPointers[t];if(!_)return;let l=!1;_.active?(_.buffer!==e&&(_.buffer=e,l=!0),_.size!==r&&(_.size=r,l=!0),_.type!==i&&(_.type=i,l=!0),_.normalized!==s&&(_.normalized=s,l=!0),_.stride!==a&&(_.stride=a,l=!0),_.offset!==n&&(_.offset=n,l=!0)):(l=!0,_.active=!0,_.index=t,_.size=r,_.type=i,_.normalized=s,_.stride=a,_.offset=n,_.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),i===this._gl.UNSIGNED_INT||i===this._gl.INT?this._gl.vertexAttribIPointer(t,r,i,a,n):this._gl.vertexAttribPointer(t,r,i,s,a,n))}_bindIndexBufferWithCache(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,r){let i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let s=0;s<i.length;s++){let a=t.getAttributeLocation(s);if(a>=0){let t=i[s],n=null;if(r&&(n=r[t]),n||(n=e[t]),!n)continue;this._gl.enableVertexAttribArray(a),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[a]=!0);let _=n.getBuffer();_&&(this._vertexAttribPointer(_,a,n.getSize(),n.type,n.normalized,n.byteStride,n.byteOffset),n.getIsInstanced()&&(this._gl.vertexAttribDivisor(a,n.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(a),this._currentInstanceBuffers.push(_))))}}}recordVertexArrayObject(e,t,r,i){let s=this._gl.createVertexArray();if(!s)throw Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(s),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,r,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),s}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,r,i,s){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==s){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=s;let t=s.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let a=0;for(let n=0;n<t;n++)if(n<r.length){let t=s.getAttributeLocation(n);t>=0&&(this._gl.enableVertexAttribArray(t),this._vertexAttribArraysEnabled[t]=!0,this._vertexAttribPointer(e,t,r[n],this._gl.FLOAT,!1,i,a)),a+=4*r[n]}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,r,i){(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r)&&(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r,this._bindVertexBuffersAttributes(e,r,i)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,r=this._currentInstanceLocations.length;t<r;t++){let r=this._currentInstanceBuffers[t];e!=r&&r.references&&(e=r,this.bindArrayBuffer(r));let i=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(i,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0}releaseVertexArrayObject(e){this._gl.deleteVertexArray(e)}_releaseBuffer(e){return e.references--,0===e.references&&(this._deleteBuffer(e),!0)}_deleteBuffer(e){this._gl.deleteBuffer(e.underlyingResource)}updateAndBindInstancesBuffer(e,t,r){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==r[0].index)this.bindInstancesBuffer(e,r,!0);else for(let t=0;t<4;t++){let i=r[t];this._vertexAttribArraysEnabled[i]||(this._gl.enableVertexAttribArray(i),this._vertexAttribArraysEnabled[i]=!0),this._vertexAttribPointer(e,i,4,this._gl.FLOAT,!1,64,16*t),this._gl.vertexAttribDivisor(i,1),this._currentInstanceLocations.push(i),this._currentInstanceBuffers.push(e)}}bindInstancesBuffer(e,t,r=!0){this.bindArrayBuffer(e);let i=0;if(r)for(let e=0;e<t.length;e++)i+=4*t[e].attributeSize;for(let r=0;r<t.length;r++){let s=t[r];void 0===s.index&&(s.index=this._currentEffect.getAttributeLocationByName(s.attributeName)),s.index<0||(this._vertexAttribArraysEnabled[s.index]||(this._gl.enableVertexAttribArray(s.index),this._vertexAttribArraysEnabled[s.index]=!0),this._vertexAttribPointer(e,s.index,s.attributeSize,s.attributeType||this._gl.FLOAT,s.normalized||!1,i,s.offset),this._gl.vertexAttribDivisor(s.index,void 0===s.divisor?1:s.divisor),this._currentInstanceLocations.push(s.index),this._currentInstanceBuffers.push(e))}}disableInstanceAttributeByName(e){if(!this._currentEffect)return;let t=this._currentEffect.getAttributeLocationByName(e);this.disableInstanceAttribute(t)}disableInstanceAttribute(e){let t,r=!1;for(;-1!==(t=this._currentInstanceLocations.indexOf(e));)this._currentInstanceLocations.splice(t,1),this._currentInstanceBuffers.splice(t,1),r=!0;r&&(this._gl.vertexAttribDivisor(e,0),this.disableAttributeByIndex(e))}disableAttributeByIndex(e){this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1}draw(e,t,r,i){this.drawElementsType(+!e,t,r,i)}drawPointClouds(e,t,r){this.drawArraysType(2,e,t,r)}drawUnIndexed(e,t,r,i){this.drawArraysType(+!e,t,r,i)}drawElementsType(e,t,r,i){this.applyStates(),this._reportDrawCall();let s=this._drawMode(e),a=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,n=this._uintIndicesCurrentlySet?4:2;i?this._gl.drawElementsInstanced(s,r,a,t*n,i):this._gl.drawElements(s,r,a,t*n)}drawArraysType(e,t,r,i){this.applyStates(),this._reportDrawCall();let s=this._drawMode(e);i?this._gl.drawArraysInstanced(s,t,r,i):this._gl.drawArrays(s,t,r)}_drawMode(e){switch(e){case 0:default:return this._gl.TRIANGLES;case 2:case 3:return this._gl.POINTS;case 1:case 4:return this._gl.LINES;case 5:return this._gl.LINE_LOOP;case 6:return this._gl.LINE_STRIP;case 7:return this._gl.TRIANGLE_STRIP;case 8:return this._gl.TRIANGLE_FAN}}_releaseEffect(e){this._compiledEffects[e._key]&&delete this._compiledEffects[e._key];let t=e.getPipelineContext();t&&this._deletePipelineContext(t)}_deletePipelineContext(e){e&&e.program&&(e.program.__SPECTOR_rebuildProgram=null,(0,S.resetCachedPipeline)(e),this._gl&&(this._currentProgram===e.program&&this._setProgram(null),this._gl.deleteProgram(e.program)))}_getGlobalDefines(e){return(0,x._GetGlobalDefines)(e,this.isNDCHalfZRange,this.useReverseDepthBuffer,this.useExactSrgbConversions)}createEffect(e,t,r,i,s,a,n,_,l,o=0,c){let g="string"==typeof e?e:e.vertexToken||e.vertexSource||e.vertexElement||e.vertex,f="string"==typeof e?e:e.fragmentToken||e.fragmentSource||e.fragmentElement||e.fragment,d=this._getGlobalDefines(),E=void 0!==t.attributes,T=s??t.defines??"";d&&(T+=d);let R=g+"+"+f+"@"+T;if(this._compiledEffects[R]){let e=this._compiledEffects[R];return n&&e.isReady()&&n(e),e._refCount++,e}this._gl&&(0,u.getStateObject)(this._gl);let p=new h.Effect(e,t,E?this:r,i,this,s,a,n,_,l,R,t.shaderLanguage??o,t.extraInitializationsAsync??c);return this._compiledEffects[R]=p,p}_getShaderSource(e){return this._gl.getShaderSource(e)}createRawShaderProgram(e,t,r,i,s=null){let a=(0,u.getStateObject)(this._gl);return a._contextWasLost=this._contextWasLost,a.validateShaderPrograms=this.validateShaderPrograms,(0,u.createRawShaderProgram)(e,t,r,i||this._gl,s)}createShaderProgram(e,t,r,i,s,a=null){let n=(0,u.getStateObject)(this._gl);return n._contextWasLost=this._contextWasLost,n.validateShaderPrograms=this.validateShaderPrograms,(0,u.createShaderProgram)(e,t,r,i,s||this._gl,a)}inlineShaderCode(e){return e}createPipelineContext(e){this._gl&&((0,u.getStateObject)(this._gl).parallelShaderCompile=this._caps.parallelShaderCompile);let t=(0,u.createPipelineContext)(this._gl,e);return t.engine=this,t}createMaterialContext(){}createDrawContext(){}_finalizePipelineContext(e){return(0,u._finalizePipelineContext)(e,this._gl,this.validateShaderPrograms)}_preparePipelineContextAsync(e,t,r,i,s,a,n,_,l,h,o){let c=(0,u.getStateObject)(this._gl);return c._contextWasLost=this._contextWasLost,c.validateShaderPrograms=this.validateShaderPrograms,c._createShaderProgramInjection=this._createShaderProgram.bind(this),c.createRawShaderProgramInjection=this.createRawShaderProgram.bind(this),c.createShaderProgramInjection=this.createShaderProgram.bind(this),c.loadFileInjection=this._loadFile.bind(this),(0,u._preparePipelineContext)(e,t,r,i,s,a,n,_,l,h,o)}_createShaderProgram(e,t,r,i,s=null){return(0,u._createShaderProgram)(e,t,r,i,s)}_isRenderingStateCompiled(e){return!this._isDisposed&&(0,u._isRenderingStateCompiled)(e,this._gl,this.validateShaderPrograms)}_executeWhenRenderingStateIsCompiled(e,t){(0,u._executeWhenRenderingStateIsCompiled)(e,t)}getUniforms(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(this._gl.getUniformLocation(e.program,t[i]));return r}getAttributes(e,t){let r=[];for(let i=0;i<t.length;i++)try{r.push(this._gl.getAttribLocation(e.program,t[i]))}catch(e){r.push(-1)}return r}enableEffect(e){(e=null!==e&&(0,c.IsWrapper)(e)?e.effect:e)&&e!==this._currentEffect&&(this._stencilStateComposer.stencilMaterial=void 0,this.bindSamplers(e),this._currentEffect=e,e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))}setInt(e,t){return!!e&&(this._gl.uniform1i(e,t),!0)}setInt2(e,t,r){return!!e&&(this._gl.uniform2i(e,t,r),!0)}setInt3(e,t,r,i){return!!e&&(this._gl.uniform3i(e,t,r,i),!0)}setInt4(e,t,r,i,s){return!!e&&(this._gl.uniform4i(e,t,r,i,s),!0)}setIntArray(e,t){return!!e&&(this._gl.uniform1iv(e,t),!0)}setIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2iv(e,t),!0)}setIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3iv(e,t),!0)}setIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4iv(e,t),!0)}setUInt(e,t){return!!e&&(this._gl.uniform1ui(e,t),!0)}setUInt2(e,t,r){return!!e&&(this._gl.uniform2ui(e,t,r),!0)}setUInt3(e,t,r,i){return!!e&&(this._gl.uniform3ui(e,t,r,i),!0)}setUInt4(e,t,r,i,s){return!!e&&(this._gl.uniform4ui(e,t,r,i,s),!0)}setUIntArray(e,t){return!!e&&(this._gl.uniform1uiv(e,t),!0)}setUIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2uiv(e,t),!0)}setUIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3uiv(e,t),!0)}setUIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4uiv(e,t),!0)}setArray(e,t){return!!e&&!(t.length<1)&&(this._gl.uniform1fv(e,t),!0)}setArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2fv(e,t),!0)}setArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3fv(e,t),!0)}setArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4fv(e,t),!0)}setMatrices(e,t){return!!e&&(this._gl.uniformMatrix4fv(e,!1,t),!0)}setMatrix3x3(e,t){return!!e&&(this._gl.uniformMatrix3fv(e,!1,t),!0)}setMatrix2x2(e,t){return!!e&&(this._gl.uniformMatrix2fv(e,!1,t),!0)}setFloat(e,t){return!!e&&(this._gl.uniform1f(e,t),!0)}setFloat2(e,t,r){return!!e&&(this._gl.uniform2f(e,t,r),!0)}setFloat3(e,t,r,i){return!!e&&(this._gl.uniform3f(e,t,r,i),!0)}setFloat4(e,t,r,i,s){return!!e&&(this._gl.uniform4f(e,t,r,i,s),!0)}applyStates(){if(this._depthCullingState.apply(this._gl),this._stencilStateComposer.apply(this._gl),this._alphaState.apply(this._gl,this._currentRenderTarget&&this._currentRenderTarget.textures?this._currentRenderTarget.textures.length:1),this._colorWriteChanged){this._colorWriteChanged=!1;let e=this._colorWrite;this._gl.colorMask(e,e,e,e)}}wipeCaches(e){(!this.preventCacheWipeBetweenFrames||e)&&(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,this._unbindVertexArrayObject(),e&&(this._currentProgram=null,this.resetTextureCache(),this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=this._gl.LEQUAL,this._alphaState.reset(),this._resetAlphaMode(),this._colorWrite=!0,this._colorWriteChanged=!0,this._unpackFlipYCached=null,this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),this._mustWipeVertexAttributes=!0,this.unbindAllAttributes()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this.bindIndexBuffer(null))}_getSamplingParameters(e,t){let r=this._gl,i=r.NEAREST,s=r.NEAREST,a=!1;switch(e){case 11:i=r.LINEAR,s=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 3:i=r.LINEAR,a=!0,s=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 8:a=!0,i=r.NEAREST,s=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 4:i=r.NEAREST,s=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 5:i=r.NEAREST,s=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 6:a=!0,i=r.NEAREST,s=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 7:i=r.NEAREST,s=r.LINEAR;break;case 1:i=r.NEAREST,s=r.NEAREST;break;case 9:i=r.LINEAR,s=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 10:a=!0,i=r.LINEAR,s=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 2:i=r.LINEAR,s=r.LINEAR;break;case 12:i=r.LINEAR,s=r.NEAREST}return{min:s,mag:i,hasMipMaps:a}}_createTexture(){let e=this._gl.createTexture();if(!e)throw Error("Unable to create texture");return e}_createHardwareTexture(){return new p(this._createTexture(),this._gl)}_createInternalTexture(e,t,r=!0,i=0){let s,a,n=!1,_=0,l=3,h=5,u=!1,o=1,c=!1,f=0,d=!1;void 0!==t&&"object"==typeof t?(s=!!t.generateMipMaps,n=!!t.createMipMaps,_=void 0===t.type?0:t.type,l=void 0===t.samplingMode?3:t.samplingMode,h=void 0===t.format?5:t.format,u=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,o=t.samples??1,a=t.label,c=!!t.createMSAATexture,f=t.comparisonFunction||0,d=!!t.isCube):s=!!t,u&&(u=this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU)),(1!==_||this._caps.textureFloatLinearFiltering)&&(2!==_||this._caps.textureHalfFloatLinearFiltering)||(l=1),1!==_||this._caps.textureFloat||(_=0,g.Logger.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));let E=b(h),T=m(h),R=this._gl,p=new A.InternalTexture(this,i),x=e.width||e,S=e.height||e,B=e.depth||0,C=e.layers||0,P=this._getSamplingParameters(l,(s||n)&&!E),L=0!==C?R.TEXTURE_2D_ARRAY:0!==B?R.TEXTURE_3D:d?R.TEXTURE_CUBE_MAP:R.TEXTURE_2D,M=E?this._getInternalFormatFromDepthTextureFormat(h,!0,T):this._getRGBABufferInternalSizedFormat(_,h,u),G=E?T?R.DEPTH_STENCIL:R.DEPTH_COMPONENT:this._getInternalFormat(h),I=E?this._getWebGLTextureTypeFromDepthTextureFormat(h):this._getWebGLTextureType(_);if(this._bindTextureDirectly(L,p),0!==C)p.is2DArray=!0,R.texImage3D(L,0,M,x,S,C,0,G,I,null);else if(0!==B)p.is3D=!0,R.texImage3D(L,0,M,x,S,B,0,G,I,null);else if(d){p.isCube=!0;for(let e=0;e<6;e++)R.texImage2D(R.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,x,S,0,G,I,null)}else R.texImage2D(L,0,M,x,S,0,G,I,null);if(R.texParameteri(L,R.TEXTURE_MAG_FILTER,P.mag),R.texParameteri(L,R.TEXTURE_MIN_FILTER,P.min),R.texParameteri(L,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(L,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),E&&this.webGLVersion>1&&(0===f?(R.texParameteri(L,R.TEXTURE_COMPARE_FUNC,515),R.texParameteri(L,R.TEXTURE_COMPARE_MODE,R.NONE)):(R.texParameteri(L,R.TEXTURE_COMPARE_FUNC,f),R.texParameteri(L,R.TEXTURE_COMPARE_MODE,R.COMPARE_REF_TO_TEXTURE))),(s||n)&&this._gl.generateMipmap(L),this._bindTextureDirectly(L,null),p._useSRGBBuffer=u,p.baseWidth=x,p.baseHeight=S,p.width=x,p.height=S,p.depth=C||B,p.isReady=!0,p.samples=o,p.generateMipMaps=s,p.samplingMode=l,p.type=_,p.format=h,p.label=a,p.comparisonFunction=f,this._internalTexturesCache.push(p),c){let e;if(!(e=b(p.format)?this._setupFramebufferDepthAttachments(m(p.format),19!==p.format,p.width,p.height,o,p.format,!0):this._createRenderBuffer(p.width,p.height,o,-1,this._getRGBABufferInternalSizedFormat(p.type,p.format,p._useSRGBBuffer),-1)))throw Error("Unable to create render buffer");p._autoMSAAManagement=!0;let t=p._hardwareTexture;t||(t=p._hardwareTexture=this._createHardwareTexture()),t.addMSAARenderBuffer(e)}return p}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||t)}createTexture(e,t,r,i,s=3,a=null,n=null,_=null,l=null,h=null,u=null,o,c,g,f){return this._createTextureBase(e,t,r,i,s,a,n,(...e)=>this._prepareWebGLTexture(...e,h),(e,t,r,s,a,n)=>{let _=this._gl,l=r.width===e&&r.height===t;a._creationFlags=g??0;let h=this._getTexImageParametersForCreateTexture(a.format,a._useSRGBBuffer);if(l)return _.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),!1;let u=this._caps.maxTextureSize;if(r.width>u||r.height>u||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!!this._workingCanvas&&!!this._workingContext&&(this._workingCanvas.width=e,this._workingCanvas.height=t,this._workingContext.drawImage(r,0,0,r.width,r.height,0,0,e,t),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,this._workingCanvas),a.width=e,a.height=t,!1);{let e=new A.InternalTexture(this,2);this._bindTextureDirectly(_.TEXTURE_2D,e,!0),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),this._rescaleTexture(e,a,i,h.format,()=>{this._releaseTexture(e),this._bindTextureDirectly(_.TEXTURE_2D,a,!0),n()})}return!0},_,l,h,u,o,c,f)}_getTexImageParametersForCreateTexture(e,t){let r,i;return 1===this.webGLVersion?i=r=this._getInternalFormat(e,t):(r=this._getInternalFormat(e,!1),i=this._getRGBABufferInternalSizedFormat(0,e,t)),{internalFormat:i,format:r,type:this._gl.UNSIGNED_BYTE}}_rescaleTexture(e,t,r,i,s){}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,+!!e),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,r=!1){let i=this._getTextureTarget(t),s=this._getSamplingParameters(e,t.useMipMaps||r);this._setTextureParameterInteger(i,this._gl.TEXTURE_MAG_FILTER,s.mag,t),this._setTextureParameterInteger(i,this._gl.TEXTURE_MIN_FILTER,s.min),r&&s.hasMipMaps&&(t.generateMipMaps=!0,this._gl.generateMipmap(i)),this._bindTextureDirectly(i,null),t.samplingMode=e}updateTextureDimensions(e,t,r,i=1){}updateTextureWrappingMode(e,t,r=null,i=null){let s=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==r&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(r),e),e._cachedWrapV=r),(e.is2DArray||e.is3D)&&null!==i&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(i),e),e._cachedWrapR=i),this._bindTextureDirectly(s,null)}_uploadCompressedDataToTextureDirectly(e,t,r,i,s,a=0,n=0){let _=this._gl,l=_.TEXTURE_2D;if(e.isCube&&(l=_.TEXTURE_CUBE_MAP_POSITIVE_X+a),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=_.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=_.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 37809:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;break;case 37810:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;break;case 37811:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;break;case 37812:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;break;case 37813:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;break;case 37814:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;break;case 37815:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;break;case 37816:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;break;case 37817:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;break;case 37818:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;break;case 37819:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;break;case 37820:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;break;case 37821:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;break;case 33776:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}if(e.generateMipMaps){let a=e._hardwareTexture;a.memoryAllocated||(_.texStorage2D(e.isCube?_.TEXTURE_CUBE_MAP:_.TEXTURE_2D,Math.floor(Math.log2(Math.max(r,i)))+1,t,e.width,e.height),a.memoryAllocated=!0),this._gl.compressedTexSubImage2D(l,n,0,0,r,i,t,s)}else this._gl.compressedTexImage2D(l,n,t,r,i,0,s)}_uploadDataToTextureDirectly(e,t,r=0,i=0,s,a=!1){let n=this._gl,_=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===s?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(s,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let u=n.TEXTURE_2D;e.isCube&&(u=n.TEXTURE_CUBE_MAP_POSITIVE_X+r);let o=Math.round(Math.log(e.width)*Math.LOG2E),c=Math.round(Math.log(e.height)*Math.LOG2E),g=a?e.width:Math.pow(2,Math.max(o-i,0)),f=a?e.height:Math.pow(2,Math.max(c-i,0));n.texImage2D(u,i,h,g,f,0,l,_,t)}updateTextureData(e,t,r,i,s,a,n=0,_=0,l=!1){let h=this._gl,u=this._getWebGLTextureType(e.type),o=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let c=h.TEXTURE_2D,g=h.TEXTURE_2D;e.isCube&&(g=h.TEXTURE_CUBE_MAP_POSITIVE_X+n,c=h.TEXTURE_CUBE_MAP),this._bindTextureDirectly(c,e,!0),h.texSubImage2D(g,_,r,i,s,a,o,u,t),l&&this._gl.generateMipmap(g),this._bindTextureDirectly(c,null)}_uploadArrayBufferViewToTexture(e,t,r=0,i=0){let s=this._gl,a=e.isCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D;this._bindTextureDirectly(a,e,!0),this._uploadDataToTextureDirectly(e,t,r,i),this._bindTextureDirectly(a,null,!0)}_prepareWebGLTextureContinuation(e,t,r,i,s){let a=this._gl;if(!a)return;let n=this._getSamplingParameters(s,!r);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,n.mag),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,n.min),r||i||a.generateMipmap(a.TEXTURE_2D),this._bindTextureDirectly(a.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,r,i,s,a,n,_,l,h){let u=this.getCaps().maxTextureSize,o=Math.min(u,this.needPOTTextures?(0,R.GetExponentOfTwo)(i.width,u):i.width),c=Math.min(u,this.needPOTTextures?(0,R.GetExponentOfTwo)(i.height,u):i.height),g=this._gl;if(g){if(!e._hardwareTexture){r&&r.removePendingData(e);return}this._bindTextureDirectly(g.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===s||!!s),e.baseWidth=i.width,e.baseHeight=i.height,e.width=o,e.height=c,e.isReady=!0,e.type=-1!==e.type?e.type:0,e.format=-1!==e.format?e.format:h??(".jpg"!==t||e._useSRGBBuffer?5:4),_(o,c,i,t,e,()=>{this._prepareWebGLTextureContinuation(e,r,a,n,l)})||this._prepareWebGLTextureContinuation(e,r,a,n,l)}}_getInternalFormatFromDepthTextureFormat(e,t,r){let i=this._gl;if(!t)return i.STENCIL_INDEX8;let s=r?i.DEPTH_STENCIL:i.DEPTH_COMPONENT;return this.webGLVersion>1?15===e?s=i.DEPTH_COMPONENT16:16===e?s=i.DEPTH_COMPONENT24:17===e||13===e?s=r?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24:14===e?s=i.DEPTH_COMPONENT32F:18===e&&(s=r?i.DEPTH32F_STENCIL8:i.DEPTH_COMPONENT32F):s=i.DEPTH_COMPONENT16,s}_getWebGLTextureTypeFromDepthTextureFormat(e){let t=this._gl,r=t.UNSIGNED_INT;return 15===e?r=t.UNSIGNED_SHORT:17===e||13===e?r=t.UNSIGNED_INT_24_8:14===e?r=t.FLOAT:18===e?r=t.FLOAT_32_UNSIGNED_INT_24_8_REV:19===e&&(r=t.UNSIGNED_BYTE),r}_setupFramebufferDepthAttachments(e,t,r,i,s=1,a,n=!1){let _=this._gl;a=a??(e?13:14);let l=this._getInternalFormatFromDepthTextureFormat(a,t,e);return e&&t?this._createRenderBuffer(r,i,s,_.DEPTH_STENCIL,l,n?-1:_.DEPTH_STENCIL_ATTACHMENT):t?this._createRenderBuffer(r,i,s,l,l,n?-1:_.DEPTH_ATTACHMENT):e?this._createRenderBuffer(r,i,s,l,l,n?-1:_.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,r,i,s,a,n=!0){let _=this._gl.createRenderbuffer();return this._updateRenderBuffer(_,e,t,r,i,s,a,n)}_updateRenderBuffer(e,t,r,i,s,a,n,_=!0){let l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),i>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,i,a,t,r):l.renderbufferStorage(l.RENDERBUFFER,s,t,r),-1!==n&&l.framebufferRenderbuffer(l.FRAMEBUFFER,n,l.RENDERBUFFER,e),_&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){this._deleteTexture(e._hardwareTexture),this.unbindAllTextures();let t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_deleteTexture(e){e?.release()}_setProgram(e){this._currentProgram!==e&&((0,u._setProgram)(e,this._gl),this._currentProgram=e)}bindSamplers(e){let t=e.getPipelineContext();this._setProgram(t.program);let r=e.getSamplers();for(let t=0;t<r.length;t++){let i=e.getUniform(r[t]);i&&(this._boundUniforms[t]=i)}this._currentEffect=null}_activateCurrentTexture(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)}_bindTextureDirectly(e,t,r=!1,i=!1){let s=!1,a=t&&t._associatedChannel>-1;if(r&&a&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||i){if(this._activateCurrentTexture(),t&&t.isMultiview)throw g.Logger.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,t?._hardwareTexture?.underlyingResource??null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else r&&(s=!0,this._activateCurrentTexture());return a&&!r&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),s}_bindTexture(e,t,r){if(void 0===e)return;t&&(t._associatedChannel=e),this._activeChannel=e;let i=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(i,t)}unbindAllTextures(){for(let e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,r,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,r))}_bindSamplerUniformToChannel(e,t){let r=this._boundUniforms[e];r&&r._currentState!==t&&(this._gl.uniform1i(r,t),r._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:break;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,r=!1,i=!1,s=""){let a;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;let r=t.getInternalTexture();r&&(r._associatedChannel=e),t.update()}else if(4===t.delayLoadState)return t.delayLoad(),!1;a=i?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!r&&a&&(a._associatedChannel=e);let n=!0;this._boundTexturesCache[e]===a&&(r||this._bindSamplerUniformToChannel(a._associatedChannel,e),n=!1),this._activeChannel=e;let _=this._getTextureTarget(a);if(n&&this._bindTextureDirectly(_,a,r),a&&!a.isMultiview){if(a.isCube&&a._cachedCoordinatesMode!==t.coordinatesMode){a._cachedCoordinatesMode=t.coordinatesMode;let e=+(3!==t.coordinatesMode&&5!==t.coordinatesMode);t.wrapU=e,t.wrapV=e}a._cachedWrapU!==t.wrapU&&(a._cachedWrapU=t.wrapU,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),a)),a._cachedWrapV!==t.wrapV&&(a._cachedWrapV=t.wrapV,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),a)),a.is3D&&a._cachedWrapR!==t.wrapR&&(a._cachedWrapR=t.wrapR,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),a)),this._setAnisotropicLevel(_,a,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,r,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===r.length||(this._textureUnits=new Int32Array(r.length));for(let t=0;t<r.length;t++){let i=r[t].getInternalTexture();i?(this._textureUnits[t]=e+t,i._associatedChannel=e+t):this._textureUnits[t]=-1}this._gl.uniform1iv(t,this._textureUnits);for(let e=0;e<r.length;e++)this._setTexture(this._textureUnits[e],r[e],!0)}}_setAnisotropicLevel(e,t,r){let i=this._caps.textureAnisotropicFilterExtension;11!==t.samplingMode&&3!==t.samplingMode&&2!==t.samplingMode&&(r=1),i&&t._cachedAnisotropicFilteringLevel!==r&&(this._setTextureParameterFloat(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r,this._caps.maxAnisotropy),t),t._cachedAnisotropicFilteringLevel=r)}_setTextureParameterFloat(e,t,r,i){this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameterf(e,t,r)}_setTextureParameterInteger(e,t,r,i){i&&this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameteri(e,t,r)}unbindAllAttributes(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(let e=0;e<this._caps.maxVertexAttribs;e++)this.disableAttributeByIndex(e);return}for(let e=0,t=this._vertexAttribArraysEnabled.length;e<t;e++)!(e>=this._caps.maxVertexAttribs)&&this._vertexAttribArraysEnabled[e]&&this.disableAttributeByIndex(e)}releaseEffects(){this._compiledEffects={},this.onReleaseEffectsObservable.notifyObservers(this)}dispose(){(0,f.IsWindowObjectExist)()&&this._renderingCanvas&&(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._onContextRestored&&this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),super.dispose(),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._currentProgram=null,this._creationOptions.loseContextOnDispose&&this._gl.getExtension("WEBGL_lose_context")?.loseContext(),(0,u.deleteStateObject)(this._gl)}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){let t=this._gl;for(;t.getError()!==t.NO_ERROR;);let r=!0,i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);let a=t.checkFramebufferStatus(t.FRAMEBUFFER);if((r=(r=r&&a===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),r=r&&t.getError()===t.NO_ERROR),r){t.bindFramebuffer(t.FRAMEBUFFER,null);let e=t.RGBA,i=t.UNSIGNED_BYTE,s=new Uint8Array(4);t.readPixels(0,0,1,1,e,i,s),r=r&&t.getError()===t.NO_ERROR}for(t.deleteTexture(i),t.deleteFramebuffer(s),t.bindFramebuffer(t.FRAMEBUFFER,null);!r&&t.getError()!==t.NO_ERROR;);return r}_getWebGLTextureType(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:break;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:break;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:r=this._gl.ALPHA;break;case 1:r=this._gl.LUMINANCE;break;case 2:r=this._gl.LUMINANCE_ALPHA;break;case 6:case 33322:case 36760:r=this._gl.RED;break;case 7:case 33324:case 36761:r=this._gl.RG;break;case 4:case 32852:case 36762:r=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case 5:case 32859:case 36763:r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:r=this._gl.RED_INTEGER;break;case 9:r=this._gl.RG_INTEGER;break;case 10:r=this._gl.RGB_INTEGER;break;case 11:r=this._gl.RGBA_INTEGER}return r}_getRGBABufferInternalSizedFormat(e,t,r=!1){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return r?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return r?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case 5:return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 36760:return this._gl.R16_SNORM_EXT;case 36761:return this._gl.RG16_SNORM_EXT;case 36762:return this._gl.RGB16_SNORM_EXT;case 36763:return this._gl.RGBA16_SNORM_EXT;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 33322:return this._gl.R16_EXT;case 33324:return this._gl.RG16_EXT;case 32852:return this._gl.RGB16_EXT;case 32859:return this._gl.RGBA16_EXT;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:default:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI}}return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8}readPixels(e,t,r,i,s=!0,a=!0,n=null){let _=s?this._gl.RGBA:this._gl.RGB,l=r*i*(s?4:3);if(n){if(n.length<l)return g.Logger.Error(`Data buffer is too small to store the read pixels (${n.length} should be more than ${l})`),Promise.resolve(n)}else n=new Uint8Array(l);return a&&this.flushFramebuffer(),this._gl.readPixels(e,t,r,i,_,this._gl.UNSIGNED_BYTE,n),Promise.resolve(n)}static get IsSupportedAsync(){return Promise.resolve(this.isSupported())}static get IsSupported(){return this.isSupported()}static isSupported(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{let e=o.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!globalThis.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported}static get HasMajorPerformanceCaveat(){if(null===this._HasMajorPerformanceCaveat)try{let e=o.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat}}L._TempClearColorUint32=new Uint32Array(4),L._TempClearColorInt32=new Int32Array(4),L.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/12\\d\\..+?Mobile",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],L._ConcatenateShader=x._ConcatenateShader,L._IsSupported=null,L._HasMajorPerformanceCaveat=null,(t=L.prototype).startTimeQuery??(t.startTimeQuery=(0,C._MissingSideEffect)("ThinEngine","startTimeQuery")),(r=L.prototype).endTimeQuery??(r.endTimeQuery=(0,C._MissingSideEffect)("ThinEngine","endTimeQuery")),(i=L.prototype).createUniformBuffer??(i.createUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","createUniformBuffer")),(s=L.prototype).createDynamicUniformBuffer??(s.createDynamicUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","createDynamicUniformBuffer")),(a=L.prototype).updateUniformBuffer??(a.updateUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","updateUniformBuffer")),(n=L.prototype).bindUniformBuffer??(n.bindUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","bindUniformBuffer")),(_=L.prototype).bindUniformBufferBase??(_.bindUniformBufferBase=(0,C._MissingSideEffect)("ThinEngine","bindUniformBufferBase")),(l=L.prototype).bindUniformBlock??(l.bindUniformBlock=(0,C._MissingSideEffect)("ThinEngine","bindUniformBlock")),e.s(["ThinEngine",0,L],71379)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,20461,e=>{"use strict";var t=e.i(96265),r=e.i(46703),a=e.i(14953),o=e.i(89030),l=e.i(70653);class n{constructor(e,t,r,a){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=r,this.worldAxisForFileY=a}}class i{static _NearestPow2Floor(e){return e<=1?1:1<<Math.floor(Math.log2(e))}static ConvertCubeMapTextureToSphericalPolynomial(e){let t,r;if(!e.isCube)return null;e.getScene()?.getEngine().flushFramebuffer();let a=e.getSize().width,o=e._sphericalPolynomialTargetSize,l=o>0?this._NearestPow2Floor(o):0,n=!e.noMipmap&&e._texture?.generateMipMaps===!0,i=l>0&&l<a&&n,s=i?Math.max(0,Math.round(Math.log2(a/l))):0,f=i?Math.max(1,Math.floor(a/Math.pow(2,s))):a,u=e.readPixels(0,s,void 0,!1),c=e.readPixels(1,s,void 0,!1);e.isRenderTarget?(t=e.readPixels(3,s,void 0,!1),r=e.readPixels(2,s,void 0,!1)):(t=e.readPixels(2,s,void 0,!1),r=e.readPixels(3,s,void 0,!1));let p=e.readPixels(4,s,void 0,!1),d=e.readPixels(5,s,void 0,!1),A=e.gammaSpace,h=l>0&&l<a&&!i;return new Promise(e=>{Promise.all([c,u,t,r,p,d]).then(([t,r,o,n,i,s])=>{let u=f;h&&(t=this._DownsampleFace(t,a,l,4),r=this._DownsampleFace(r,a,l,4),o=this._DownsampleFace(o,a,l,4),n=this._DownsampleFace(n,a,l,4),i=this._DownsampleFace(i,a,l,4),s=this._DownsampleFace(s,a,l,4),u=l);let c={size:u,right:r,left:t,up:o,down:n,front:i,back:s,format:5,type:+(t instanceof Float32Array),gammaSpace:A};e(this.ConvertCubeMapToSphericalPolynomial(c))})})}static _AreaElement(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))}static _DownsampleFace(e,t,r,a){let o=e instanceof Float32Array?e:Float32Array.from(e),l=r*r*a,n=new Float32Array(l),i=t/r,s=1/(i*i);for(let e=0;e<r;e++){let l=Math.floor(e*i),f=Math.floor((e+1)*i);for(let u=0;u<r;u++){let c=Math.floor(u*i),p=Math.floor((u+1)*i),d=(e*r+u)*a;for(let e=0;e<a;e++){let r=0;for(let n=l;n<f;n++)for(let l=c;l<p;l++)r+=o[(n*t+l)*a+e];n[d+e]=r*s}}}if(e instanceof Float32Array)return n;let f=new e.constructor(l);for(let e=0;e<l;e++)f[e]=n[e]+.5|0;return f}static ConvertCubeMapToSphericalPolynomial(e,t=0){let n=t>0?this._NearestPow2Floor(t):0;if(n>0&&e.size>n){let t=5===e.format?4:3,r={};for(let a of["right","left","up","down","front","back"])r[a]=this._DownsampleFace(e[a],e.size,n,t);e={...e,...r,size:n}}let i=new a.SphericalHarmonics,s=0,f=2/e.size,u=.5*f,c=u-1;for(let t=0;t<6;t++){let a=this._FileFaces[t],n=e[a.name],p=c,d=5===e.format?4:3;for(let t=0;t<e.size;t++){let A=c;for(let c=0;c<e.size;c++){let h=a.worldAxisForFileX.scale(A).add(a.worldAxisForFileY.scale(p)).add(a.worldAxisForNormal);h.normalize();let m=this._AreaElement(A-u,p-u)-this._AreaElement(A-u,p+u)-this._AreaElement(A+u,p-u)+this._AreaElement(A+u,p+u),F=n[t*e.size*d+c*d+0],y=n[t*e.size*d+c*d+1],_=n[t*e.size*d+c*d+2];isNaN(F)&&(F=0),isNaN(y)&&(y=0),isNaN(_)&&(_=0),0===e.type&&(F/=255,y/=255,_/=255),e.gammaSpace&&(F=Math.pow((0,r.Clamp)(F),o.ToLinearSpace),y=Math.pow((0,r.Clamp)(y),o.ToLinearSpace),_=Math.pow((0,r.Clamp)(_),o.ToLinearSpace));let w=this.MAX_HDRI_VALUE;if(this.PRESERVE_CLAMPED_COLORS){let e=Math.max(F,y,_);if(e>w){let t=w/e;F*=t,y*=t,_*=t}}else F=(0,r.Clamp)(F,0,w),y=(0,r.Clamp)(y,0,w),_=(0,r.Clamp)(_,0,w);let C=new l.Color3(F,y,_);i.addLight(h,C,m),s+=m,A+=f}p+=f}}let p=4*Math.PI*6/6/s;return i.scaleInPlace(p),i.convertIncidentRadianceToIrradiance(),i.convertIrradianceToLambertianRadiance(),a.SphericalPolynomial.FromHarmonics(i)}}i._FileFaces=[new n("right",new t.Vector3(1,0,0),new t.Vector3(0,0,-1),new t.Vector3(0,-1,0)),new n("left",new t.Vector3(-1,0,0),new t.Vector3(0,0,1),new t.Vector3(0,-1,0)),new n("up",new t.Vector3(0,1,0),new t.Vector3(1,0,0),new t.Vector3(0,0,1)),new n("down",new t.Vector3(0,-1,0),new t.Vector3(1,0,0),new t.Vector3(0,0,-1)),new n("front",new t.Vector3(0,0,1),new t.Vector3(1,0,0),new t.Vector3(0,-1,0)),new n("back",new t.Vector3(0,0,-1),new t.Vector3(-1,0,0),new t.Vector3(0,-1,0))],i.MAX_HDRI_VALUE=4096,i.PRESERVE_CLAMPED_COLORS=!1,e.s(["CubeMapToSphericalPolynomialTools",0,i])},39669,e=>{"use strict";var t=e.i(46703),r=e.i(13379),a=e.i(20461),o=e.i(96704);function l(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}let n=l("DXT1"),i=l("DXT3"),s=l("DXT5"),f=l("DX10");class u{static GetDDSInfo(e){let t=new Int32Array(e.buffer,e.byteOffset,31),r=new Int32Array(e.buffer,e.byteOffset,35),a=1;131072&t[2]&&(a=Math.max(1,t[7]));let o=t[21],l=o===f?r[32]:0,u=0;switch(o){case 113:u=2;break;case 116:u=1;break;case f:if(10===l){u=2;break}2===l&&(u=1)}return{width:t[4],height:t[3],mipmapCount:a,isFourCC:(4&t[20])==4,isRGB:(64&t[20])==64,isLuminance:(131072&t[20])==131072,isCube:(512&t[28])==512,isCompressed:o===n||o===i||o===s,dxgiFormat:l,textureType:u}}static _GetHalfFloatAsFloatRGBAArrayBuffer(e,t,r,a,l,n){let i=new Float32Array(a),s=new Uint16Array(l,r),f=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=(t+r*e)*4;i[f]=(0,o.FromHalfFloat)(s[a]),i[f+1]=(0,o.FromHalfFloat)(s[a+1]),i[f+2]=(0,o.FromHalfFloat)(s[a+2]),u.StoreLODInAlphaChannel?i[f+3]=n:i[f+3]=(0,o.FromHalfFloat)(s[a+3]),f+=4}return i}static _GetHalfFloatRGBAArrayBuffer(e,t,r,a,l,n){if(u.StoreLODInAlphaChannel){let i=new Uint16Array(a),s=new Uint16Array(l,r),f=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=(t+r*e)*4;i[f]=s[a],i[f+1]=s[a+1],i[f+2]=s[a+2],i[f+3]=(0,o.ToHalfFloat)(n),f+=4}return i}return new Uint16Array(l,r,a)}static _GetFloatRGBAArrayBuffer(e,t,r,a,o,l){if(u.StoreLODInAlphaChannel){let n=new Float32Array(a),i=new Float32Array(o,r),s=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=(t+r*e)*4;n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=l,s+=4}return n}return new Float32Array(o,r,a)}static _GetFloatAsHalfFloatRGBAArrayBuffer(e,t,r,a,l,n){let i=new Uint16Array(a),s=new Float32Array(l,r),f=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++)i[f]=(0,o.ToHalfFloat)(s[f]),i[f+1]=(0,o.ToHalfFloat)(s[f+1]),i[f+2]=(0,o.ToHalfFloat)(s[f+2]),u.StoreLODInAlphaChannel?i[f+3]=(0,o.ToHalfFloat)(n):i[f+3]=(0,o.ToHalfFloat)(s[f+3]),f+=4;return i}static _GetFloatAsUIntRGBAArrayBuffer(e,r,a,o,l,n){let i=new Uint8Array(o),s=new Float32Array(l,a),f=0;for(let a=0;a<r;a++)for(let r=0;r<e;r++){let o=(r+a*e)*4;i[f]=255*(0,t.Clamp)(s[o]),i[f+1]=255*(0,t.Clamp)(s[o+1]),i[f+2]=255*(0,t.Clamp)(s[o+2]),u.StoreLODInAlphaChannel?i[f+3]=n:i[f+3]=255*(0,t.Clamp)(s[o+3]),f+=4}return i}static _GetHalfFloatAsUIntRGBAArrayBuffer(e,r,a,l,n,i){let s=new Uint8Array(l),f=new Uint16Array(n,a),c=0;for(let a=0;a<r;a++)for(let r=0;r<e;r++){let l=(r+a*e)*4;s[c]=255*(0,t.Clamp)((0,o.FromHalfFloat)(f[l])),s[c+1]=255*(0,t.Clamp)((0,o.FromHalfFloat)(f[l+1])),s[c+2]=255*(0,t.Clamp)((0,o.FromHalfFloat)(f[l+2])),u.StoreLODInAlphaChannel?s[c+3]=i:s[c+3]=255*(0,t.Clamp)((0,o.FromHalfFloat)(f[l+3])),c+=4}return s}static _GetRGBAArrayBuffer(e,t,r,a,o,l,n,i,s){let f=new Uint8Array(a),u=new Uint8Array(o,r),c=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=(t+r*e)*4;f[c]=u[a+l],f[c+1]=u[a+n],f[c+2]=u[a+i],f[c+3]=u[a+s],c+=4}return f}static _ExtractLongWordOrder(e){return 0===e||255===e||-0x1000000===e?0:1+u._ExtractLongWordOrder(e>>8)}static _GetRGBArrayBuffer(e,t,r,a,o,l,n,i){let s=new Uint8Array(a),f=new Uint8Array(o,r),u=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=(t+r*e)*3;s[u]=f[a+l],s[u+1]=f[a+n],s[u+2]=f[a+i],u+=3}return s}static _GetLuminanceArrayBuffer(e,t,r,a,o){let l=new Uint8Array(a),n=new Uint8Array(o,r),i=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){let a=t+r*e;l[i]=n[a],i++}return l}static UploadDDSLevels(e,t,o,l,c,p,d=-1,A,h=!0){let m,F,y,_=null;l.sphericalPolynomial&&(_=[]);let w=!!e.getCaps().s3tc;t.generateMipMaps=c;let C=new Int32Array(o.buffer,o.byteOffset,31),b,g,B,G=0,x,T=0,L=1;if(0x20534444!==C[0])return void r.Logger.Error("Invalid magic number in DDS header");if(!l.isFourCC&&!l.isRGB&&!l.isLuminance)return void r.Logger.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");if(l.isCompressed&&!w)return void r.Logger.Error("Compressed textures are not supported on this platform.");let D=C[22];x=C[1]+4;let R=!1;if(l.isFourCC)switch(b=C[21]){case n:L=8,T=33777;break;case i:L=16,T=33778;break;case s:L=16,T=33779;break;case 113:R=!0,D=64;break;case 116:R=!0,D=128;break;case f:{x+=20;let e=!1;switch(l.dxgiFormat){case 10:R=!0,D=64,e=!0;break;case 2:R=!0,D=128,e=!0;break;case 88:l.isRGB=!0,l.isFourCC=!1,D=32,e=!0}if(e)break}default:r.Logger.Error(["Unsupported FourCC code:",String.fromCharCode(255&b,b>>8&255,b>>16&255,b>>24&255)]);return}let M=u._ExtractLongWordOrder(C[23]),S=u._ExtractLongWordOrder(C[24]),P=u._ExtractLongWordOrder(C[25]),O=u._ExtractLongWordOrder(C[26]);R&&(T=e._getRGBABufferInternalSizedFormat(l.textureType)),F=1,131072&C[2]&&!1!==c&&(F=Math.max(1,C[7]));let U=A||0,v=e.getCaps();for(let r=U;r<p;r++){for(y=0,g=C[4],B=C[3];y<F;++y){if(-1===d||d===y){let a=-1===d?y:0;if(!l.isCompressed&&l.isFourCC){t.format=5,G=g*B*4;let l=null;if(e._badOS||e._badDesktopOS||!v.textureHalfFloat&&!v.textureFloat)128===D?(l=u._GetFloatAsUIntRGBAArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,a),_&&0==a&&_.push(u._GetFloatRGBAArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,a))):64===D&&(l=u._GetHalfFloatAsUIntRGBAArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,a),_&&0==a&&_.push(u._GetHalfFloatAsFloatRGBAArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,a))),t.type=0;else{let e,r=v.textureFloat&&(h&&v.textureFloatLinearFiltering||!h),n=v.textureHalfFloat&&(h&&v.textureHalfFloatLinearFiltering||!h),i=(128===D||64===D&&!n)&&r?1:(64===D||128===D&&!r)&&n?2:0,s=null;if(128===D)switch(i){case 1:e=u._GetFloatRGBAArrayBuffer,s=null;break;case 2:e=u._GetFloatAsHalfFloatRGBAArrayBuffer,s=u._GetFloatRGBAArrayBuffer;break;case 0:e=u._GetFloatAsUIntRGBAArrayBuffer,s=u._GetFloatRGBAArrayBuffer}else switch(i){case 1:e=u._GetHalfFloatAsFloatRGBAArrayBuffer,s=null;break;case 2:e=u._GetHalfFloatRGBAArrayBuffer,s=u._GetHalfFloatAsFloatRGBAArrayBuffer;break;case 0:e=u._GetHalfFloatAsUIntRGBAArrayBuffer,s=u._GetHalfFloatAsFloatRGBAArrayBuffer}t.type=i,l=e(g,B,o.byteOffset+x,G,o.buffer,a),_&&0==a&&_.push(s?s(g,B,o.byteOffset+x,G,o.buffer,a):l)}l&&e._uploadDataToTextureDirectly(t,l,r,a)}else if(l.isRGB)t.type=0,24===D?(t.format=4,G=g*B*3,m=u._GetRGBArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,M,S,P)):(t.format=5,G=g*B*4,m=u._GetRGBAArrayBuffer(g,B,o.byteOffset+x,G,o.buffer,M,S,P,O)),e._uploadDataToTextureDirectly(t,m,r,a);else if(l.isLuminance){let l=e._getUnpackAlignement(),n=g;G=Math.floor((g+l-1)/l)*l*(B-1)+n,m=u._GetLuminanceArrayBuffer(g,B,o.byteOffset+x,G,o.buffer),t.format=1,t.type=0,e._uploadDataToTextureDirectly(t,m,r,a)}else G=Math.max(4,g)/4*Math.max(4,B)/4*L,m=new Uint8Array(o.buffer,o.byteOffset+x,G),t.type=0,e._uploadCompressedDataToTextureDirectly(t,T,g,B,m,r,a)}x+=D?g*B*(D/8):G,g*=.5,B*=.5,g=Math.max(1,g),B=Math.max(1,B)}if(void 0!==A)break}_&&_.length>0?l.sphericalPolynomial=a.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial({size:C[4],right:_[0],left:_[1],up:_[2],down:_[3],front:_[4],back:_[5],format:5,type:1,gammaSpace:!1}):l.sphericalPolynomial=void 0}}u.StoreLODInAlphaChannel=!1,e.s(["DDSTools",0,u])},27054,e=>{"use strict";var t=e.i(84201),r=e.i(13379),a=e.i(46712),o=e.i(84768),l=e.i(53730),n=e.i(76535);let i=!1;i=!0,n.AbstractEngine.prototype._partialLoadFile=function(e,t,r,a,o=null){this._loadFile(e,e=>{r[t]=e,r._internalCount++,6===r._internalCount&&a(r)},void 0,void 0,!0,(e,t)=>{o&&e&&o(e.status+" "+e.statusText,t)})},n.AbstractEngine.prototype._cascadeLoadFiles=function(e,t,r,a=null){let o=[];o._internalCount=0;for(let e=0;e<6;e++)this._partialLoadFile(r[e],e,o,t,a)},n.AbstractEngine.prototype._cascadeLoadImgs=function(e,t,r,a,o=null,l){let n=[];n._internalCount=0;for(let i=0;i<6;i++)this._partialLoadImg(a[i],i,n,e,t,r,o,l)},n.AbstractEngine.prototype._partialLoadImg=function(e,t,r,l,n,i,s=null,f){let u=(0,o.RandomGUID)();(0,a.LoadImage)(e,e=>{r[t]=e,r._internalCount++,l&&l.removePendingData(u),6===r._internalCount&&i&&i(n,r)},(e,t)=>{l&&l.removePendingData(u),s&&s(e,t)},l?l.offlineProvider:null,f),l&&l.addPendingData(u)},n.AbstractEngine.prototype.createCubeTextureBase=function(e,a,o,n,i=null,s=null,f,u=null,c=!1,p=0,d=0,A=null,h=null,m=null,F=!1,y=null){let _,w,C=A||new t.InternalTexture(this,7);C.isCube=!0,C.url=e,C.generateMipMaps=!n,C._lodGenerationScale=p,C._lodGenerationOffset=d,C._useSRGBBuffer=!!F&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!n),C!==A&&(C.label=e.substring(0,60)),this._doNotHandleContextLost||(C._extension=u,C._files=o,C._buffer=y);let b=e;this._transformTextureUrl&&!A&&(e=this._transformTextureUrl(e));let g=u??((w=(_=e.split("?")[0]).lastIndexOf("."))>-1?_.substring(w).toLowerCase():""),B=(0,l._GetCompatibleTextureLoader)(g),G=(e,t)=>{C.dispose(),s?s(e,t):e&&r.Logger.Warn(e)},x=(t,l)=>{e===b?t&&G(t.status+" "+t.statusText,l):(r.Logger.Warn(`Failed to load ${e}, falling back to the ${b}`),this.createCubeTextureBase(b,a,o,!!n,i,G,f,u,c,p,d,C,h,m,F,y))};if(B)B.then(t=>{let r=e=>{h&&h(C,e),t.loadCubeData(e,C,c,i,(e,t)=>{G(e,t)})};y?r(y):o&&6===o.length?t.supportCascades?this._cascadeLoadFiles(a,e=>r(e.map(e=>new Uint8Array(e))),o,G):G("Textures type does not support cascades."):this._loadFile(e,e=>r(new Uint8Array(e)),void 0,a?a.offlineProvider||null:void 0,!0,x)});else{if(!o||0===o.length)throw Error("Cannot load cubemap because files were not defined, or the correct loader was not found.");this._cascadeLoadImgs(a,C,(e,t)=>{m&&m(e,t)},o,G)}return this._internalTexturesCache.push(C),C},e.s([],34255),e.i(34255);var s=e.i(39669);e.s(["DDSTools",()=>s.DDSTools],27054)}]);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65296,e=>{"use strict";var r=e.i(12423);let o="helperFunctions",a=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08;
|
|
2
|
+
const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;
|
|
3
|
+
#define saturate(x) clamp(x,0.0,1.0)
|
|
4
|
+
#define absEps(x) abs(x)+Epsilon
|
|
5
|
+
#define maxEps(x) max(x,Epsilon)
|
|
6
|
+
#define saturateEps(x) clamp(x,Epsilon,1.0)
|
|
7
|
+
mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(
|
|
8
|
+
vec3(i0.x,i1.x,i2.x),
|
|
9
|
+
vec3(i0.y,i1.y,i2.y),
|
|
10
|
+
vec3(i0.z,i1.z,i2.z)
|
|
11
|
+
);return outMatrix;}
|
|
12
|
+
mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),
|
|
13
|
+
b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),
|
|
14
|
+
b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}
|
|
15
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
16
|
+
vec3 toLinearSpaceExact(vec3 color)
|
|
17
|
+
{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));
|
|
18
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
19
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));
|
|
20
|
+
#else
|
|
21
|
+
return
|
|
22
|
+
vec3(
|
|
23
|
+
color.r<=0.04045 ? nearZeroSection.r : remainingSection.r,
|
|
24
|
+
color.g<=0.04045 ? nearZeroSection.g : remainingSection.g,
|
|
25
|
+
color.b<=0.04045 ? nearZeroSection.b : remainingSection.b);
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
vec3 toGammaSpaceExact(vec3 color)
|
|
29
|
+
{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);
|
|
30
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
31
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));
|
|
32
|
+
#else
|
|
33
|
+
return
|
|
34
|
+
vec3(
|
|
35
|
+
color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,
|
|
36
|
+
color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,
|
|
37
|
+
color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);
|
|
38
|
+
#endif
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
float toLinearSpace(float color)
|
|
42
|
+
{
|
|
43
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
44
|
+
float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;
|
|
45
|
+
#else
|
|
46
|
+
return pow(color,LinearEncodePowerApprox);
|
|
47
|
+
#endif
|
|
48
|
+
}
|
|
49
|
+
vec3 toLinearSpace(vec3 color)
|
|
50
|
+
{
|
|
51
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
52
|
+
return toLinearSpaceExact(color);
|
|
53
|
+
#else
|
|
54
|
+
return pow(color,vec3(LinearEncodePowerApprox));
|
|
55
|
+
#endif
|
|
56
|
+
}
|
|
57
|
+
vec4 toLinearSpace(vec4 color)
|
|
58
|
+
{
|
|
59
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
60
|
+
return vec4(toLinearSpaceExact(color.rgb),color.a);
|
|
61
|
+
#else
|
|
62
|
+
return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);
|
|
63
|
+
#endif
|
|
64
|
+
}
|
|
65
|
+
float toGammaSpace(float color)
|
|
66
|
+
{
|
|
67
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
68
|
+
float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;
|
|
69
|
+
#else
|
|
70
|
+
return pow(color,GammaEncodePowerApprox);
|
|
71
|
+
#endif
|
|
72
|
+
}
|
|
73
|
+
vec3 toGammaSpace(vec3 color)
|
|
74
|
+
{
|
|
75
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
76
|
+
return toGammaSpaceExact(color);
|
|
77
|
+
#else
|
|
78
|
+
return pow(color,vec3(GammaEncodePowerApprox));
|
|
79
|
+
#endif
|
|
80
|
+
}
|
|
81
|
+
vec4 toGammaSpace(vec4 color)
|
|
82
|
+
{
|
|
83
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
84
|
+
return vec4(toGammaSpaceExact(color.rgb),color.a);
|
|
85
|
+
#else
|
|
86
|
+
return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);
|
|
87
|
+
#endif
|
|
88
|
+
}
|
|
89
|
+
float square(float value)
|
|
90
|
+
{return value*value;}
|
|
91
|
+
vec3 square(vec3 value)
|
|
92
|
+
{return value*value;}
|
|
93
|
+
float pow5(float value) {float sq=value*value;return sq*sq*value;}
|
|
94
|
+
vec3 double_refract(vec3 I,vec3 N,float eta) {vec3 Tfront=refract(I,N,1.0/eta);vec3 Nback=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);}
|
|
95
|
+
float getLuminanceUnclamped(vec3 color)
|
|
96
|
+
{return dot(color,LuminanceEncodeApprox);}
|
|
97
|
+
float getLuminance(vec3 color)
|
|
98
|
+
{return saturate(getLuminanceUnclamped(color));}
|
|
99
|
+
float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}
|
|
100
|
+
float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}
|
|
101
|
+
const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);}
|
|
102
|
+
vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}
|
|
103
|
+
vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}
|
|
104
|
+
vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}
|
|
105
|
+
float sqrtClamped(float value) {return sqrt(max(value,0.));}
|
|
106
|
+
float avg(vec3 value) {return dot(value,vec3(0.333333333));}
|
|
107
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
108
|
+
uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<<width)-1u);}
|
|
109
|
+
int onlyBitPosition(uint value) {return (floatBitsToInt(float(value))>>23)-0x7f;}
|
|
110
|
+
vec3 singleScatterToMultiScatterAlbedo(vec3 rho_ss) {vec3 s=sqrt(max(vec3(1.0)-rho_ss,vec3(0.0)));return (vec3(1.0)-s)*(vec3(1.0)-vec3(0.139)*s)/(vec3(1.0)+vec3(1.17)*s);}
|
|
111
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return 1.0-s*s;}
|
|
112
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms,float aniso) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return (1.0-s*s)/maxEps(1.0-aniso*s*s);}
|
|
113
|
+
float min3(vec3 v) {return min(v.x,min(v.y,v.z));}
|
|
114
|
+
float max3(vec3 v) {return max(v.x,max(v.y,v.z));}
|
|
115
|
+
float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}
|
|
116
|
+
vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),
|
|
117
|
+
uint2float(rstate*2447445414u));}
|
|
118
|
+
#endif
|
|
119
|
+
`;r.ShaderStore.IncludesShadersStore[o]||(r.ShaderStore.IncludesShadersStore[o]=a),e.s(["helperFunctions",0,{name:o,shader:a}])},85949,e=>{"use strict";var r=e.i(12423),o=e.i(65296);let a="rgbdEncodePixelShader",t=`varying vec2 vUV;uniform sampler2D textureSampler;
|
|
120
|
+
#include<helperFunctions>
|
|
121
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
122
|
+
void main(void)
|
|
123
|
+
{gl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);}`;for(let e of(r.ShaderStore.ShadersStore[a]||(r.ShaderStore.ShadersStore[a]=t),[o.helperFunctions]))r.ShaderStore.IncludesShadersStore[e.name]||(r.ShaderStore.IncludesShadersStore[e.name]=e.shader);e.s(["rgbdEncodePixelShader",0,{name:a,shader:t}])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,34548,e=>{"use strict";var t=e.i(10272),i=e.i(96265),s=e.i(37143),r=e.i(99267),n=e.i(81623),a=e.i(75405),o=e.i(80871);class h{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new r.Observable,this._onClonedObservable=new r.Observable,this._inheritVisibility=!1,this._isVisible=!0}}class d{static AddNodeConstructor(e,t){this._NodeConstructors[e]=t}static Construct(e,t,i,s){let r=this._NodeConstructors[e];return r?r(t,i,s):null}set accessibilityTag(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)}get accessibilityTag(){return this._accessibilityTag}get doNotSerialize(){return!!this._nodeDataStorage._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize}set doNotSerialize(e){this._nodeDataStorage._doNotSerialize=e}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(e){if(this._parentNode===e)return;let t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){let t=this._parentNode._children.indexOf(this);-1!==t&&this._parentNode._children.splice(t,1),e||this._nodeDataStorage._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._isDirty=!0,this._parentNode&&((void 0===this._parentNode._children||null===this._parentNode._children)&&(this._parentNode._children=[]),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}get inheritVisibility(){return this._nodeDataStorage._inheritVisibility}set inheritVisibility(e){this._nodeDataStorage._inheritVisibility=e}get isVisible(){return(!this.inheritVisibility||!this._parentNode||!!this._parentNode.isVisible)&&this._nodeDataStorage._isVisible}set isVisible(e){this._nodeDataStorage._isVisible=e}_serializeAsParent(e){e.parentId=this.uniqueId}_addToSceneRootNodes(){-1===this._nodeDataStorage._sceneRootNodesIndex&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(-1!==this._nodeDataStorage._sceneRootNodesIndex){let e=this._scene.rootNodes,t=e.length-1;e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}getClassName(){return"Node"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}constructor(e,t=null,s=!0){this._isDirty=!1,this._nodeDataStorage=new h,this.state="",this.metadata=null,this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new r.Observable,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=i.Matrix.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new r.Observable,this._onDisposeObserver=null,this._behaviors=[],this.name=e,this.id=e,this._scene=t||n.EngineStore.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),s&&this._addToSceneRootNodes()}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(e,t=!1){return -1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce(()=>{this._behaviors.includes(e)&&e.attach(this)}):e.attach(this),this._behaviors.push(e)),this}removeBehavior(e){let t=this._behaviors.indexOf(e);return -1===t||(this._behaviors.splice(t,1),e.detach()),this}get behaviors(){return this._behaviors}getBehaviorByName(e){for(let t of this._behaviors)if(t.name===e)return t;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={}}updateCache(e){!e&&this.isSynchronized()||this._updateCache()}_getActionManagerForTrigger(e,t=!0){return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_updateCache(e){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return!this._parentNode||!this._parentNode._isDirty&&this._parentUpdateId===this._parentNode._childUpdateId&&this._parentNode.isSynchronized()}isSynchronized(){return(!this._parentNode||!!this.isSynchronizedWithParent())&&this._isSynchronized()}isReady(e=!1){return this._nodeDataStorage._isReady}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(e=!0){return!1===e?this._nodeDataStorage._isEnabled:!!this._nodeDataStorage._isEnabled&&this._nodeDataStorage._isParentEnabled}_syncParentEnabledState(){if(this._nodeDataStorage._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children)for(let e of this._children)e._syncParentEnabledState()}setEnabled(e){this._nodeDataStorage._isEnabled!==e&&(this._nodeDataStorage._isEnabled=e,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(e))}isDescendantOf(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))}_getDescendants(e,t=!1,i){if(this._children)for(let s=0;s<this._children.length;s++){let r=this._children[s];(!i||i(r))&&e.push(r),t||r._getDescendants(e,!1,i)}}getDescendants(e,t){let i=[];return this._getDescendants(i,e,t),i}getChildMeshes(e,t){let i=[];return this._getDescendants(i,e,e=>(!t||t(e))&&void 0!==e.cullingStrategy),i}getChildren(e,t=!0){return this.getDescendants(t,e)}_setReady(e){if(e!==this._nodeDataStorage._isReady){if(!e){this._nodeDataStorage._isReady=!1;return}this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0}}getAnimationByName(e){for(let t=0;t<this.animations.length;t++){let i=this.animations[t];if(i.name===e)return i}return null}createAnimationRange(e,t,i){if(!this._ranges[e]){this._ranges[e]=d._AnimationRangeFactory(e,t,i);for(let s=0,r=this.animations.length;s<r;s++)this.animations[s]&&this.animations[s].createRange(e,t,i)}}deleteAnimationRange(e,t=!0){for(let i=0,s=this.animations.length;i<s;i++)this.animations[i]&&this.animations[i].deleteRange(e,t);this._ranges[e]=null}getAnimationRange(e){return this._ranges[e]||null}clone(e,t,i){let s=o.SerializationHelper.Clone(()=>new d(e,this.getScene()),this);if(t&&(s.parent=t),!i){let t=this.getDescendants(!0);for(let i=0;i<t.length;i++){let r=t[i];r.clone(e+"."+r.name,s)}}return s}getAnimationRanges(){let e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t}beginAnimation(e,t,i,s){let r=this.getAnimationRange(e);return r?this._scene.beginAnimation(this,r.from,r.to,t,i,s):null}serializeAnimationRanges(){let e=[];for(let t in this._ranges){let i=this._ranges[t];if(!i)continue;let s={};s.name=t,s.from=i.from,s.to=i.to,e.push(s)}return e}computeWorldMatrix(e){return this._worldMatrix||(this._worldMatrix=i.Matrix.Identity()),this._worldMatrix}dispose(e,t=!1){if(this._nodeDataStorage._isDisposed=!0,!e)for(let i of this.getDescendants(!0))i.dispose(e,t);for(let e of(this.parent?this.parent=null:this._removeFromSceneRootNodes(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onEnabledStateChangedObservable.clear(),this.onClonedObservable.clear(),this._behaviors))e.detach();this._behaviors.length=0,this.metadata=null}static ParseAnimationRanges(e,t,i){if(t.ranges)for(let i=0;i<t.ranges.length;i++){let s=t.ranges[i];e.createAnimationRange(s.name,s.from,s.to)}}getHierarchyBoundingVectors(e=!0,t=null){let s,r;if(this.getScene().incrementRenderId(),this.computeWorldMatrix(!0),this.getBoundingInfo&&this.subMeshes){let e=this.getBoundingInfo();s=e.boundingBox.minimumWorld.clone(),r=e.boundingBox.maximumWorld.clone()}else s=new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);if(e)for(let e of this.getDescendants(!1)){if(e.computeWorldMatrix(!0),t&&!t(e)||!e.getBoundingInfo||0===e.getTotalVertices())continue;let n=e.getBoundingInfo().boundingBox,a=n.minimumWorld,o=n.maximumWorld;i.Vector3.CheckExtends(a,s,r),i.Vector3.CheckExtends(o,s,r)}return{min:s,max:r}}}d._AnimationRangeFactory=(e,t,i)=>{throw(0,a._WarnImport)("AnimationRange")},d._NodeConstructors={},(0,t.__decorate)([(0,s.serialize)()],d.prototype,"name",void 0),(0,t.__decorate)([(0,s.serialize)()],d.prototype,"id",void 0),(0,t.__decorate)([(0,s.serialize)()],d.prototype,"uniqueId",void 0),(0,t.__decorate)([(0,s.serialize)()],d.prototype,"state",void 0),(0,t.__decorate)([(0,s.serialize)()],d.prototype,"metadata",void 0),e.s(["Node",0,d])},12847,e=>{"use strict";var t=e.i(10272),i=e.i(37143),s=e.i(96265),r=e.i(70653),n=e.i(34548),a=e.i(33855),o=e.i(77052),h=e.i(21823),d=e.i(80871);class l extends n.Node{get range(){return this._range}set range(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)}get intensityMode(){return this._intensityMode}set intensityMode(e){this._intensityMode=e,this._computePhotometricScale()}get radius(){return this._radius}set radius(e){this._radius=e,this._computePhotometricScale()}get shadowEnabled(){return this._shadowEnabled}set shadowEnabled(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())}get includedOnlyMeshes(){return this._includedOnlyMeshes}set includedOnlyMeshes(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)}get excludedMeshes(){return this._excludedMeshes}set excludedMeshes(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)}get excludeWithLayerMask(){return this._excludeWithLayerMask}set excludeWithLayerMask(e){this._excludeWithLayerMask=e,this._resyncMeshes()}get includeOnlyWithLayerMask(){return this._includeOnlyWithLayerMask}set includeOnlyWithLayerMask(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()}get lightmapMode(){return this._lightmapMode}set lightmapMode(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())}getViewMatrix(e){return null}getProjectionMatrix(e,t){return null}constructor(e,t,i){super(e,t,!1),this.diffuse=new r.Color3(1,1,1),this.specular=new r.Color3(1,1,1),this.falloffType=l.FALLOFF_DEFAULT,this.intensity=1,this._range=Number.MAX_VALUE,this._inverseSquaredRange=0,this._photometricScale=1,this._intensityMode=l.INTENSITYMODE_AUTOMATIC,this._radius=1e-5,this.renderPriority=0,this._shadowEnabled=!0,this._excludeWithLayerMask=0,this._includeOnlyWithLayerMask=0,this._lightmapMode=0,this._shadowGenerators=null,this._excludedMeshesIds=[],this._includedOnlyMeshesIds=[],this._currentViewDepth=0,this._clusteredContainer=null,this._isLight=!0,i||this.getScene().addLight(this),this._uniformBuffer=new a.UniformBuffer(this.getScene().getEngine(),void 0,void 0,e),this._buildUniformLayout(),this.includedOnlyMeshes=[],this.excludedMeshes=[],i||this._resyncMeshes()}transferTexturesToEffect(e,t){return this}_bindLight(e,t,i,s,n=!0){let a=e.toString(),o=!1;if(this._uniformBuffer.bindToEffect(i,"Light"+a),this._renderId!==t.getRenderId()||this._lastUseSpecular!==s||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId(),this._lastUseSpecular=s;let e=this.getScaledIntensity();this.transferToEffect(i,a),this.diffuse.scaleToRef(e,r.TmpColors.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",r.TmpColors.Color3[0],this.range,a),s&&(this.specular.scaleToRef(e,r.TmpColors.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",r.TmpColors.Color3[1],this.radius,a)),o=!0}if(this.transferTexturesToEffect(i,a),t.shadowsEnabled&&this.shadowEnabled&&n){let e=this.getShadowGenerator(t.activeCamera)??this.getShadowGenerator();e&&(e.bindShadowLight(a,i),o=!0)}o?this._uniformBuffer.update():this._uniformBuffer.bindUniformBuffer()}getClassName(){return"Light"}toString(e){let t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric","Clustered"][this.getTypeID()],this.animations)for(let i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t}_syncParentEnabledState(){super._syncParentEnabledState(),this.isDisposed()||this._resyncMeshes()}setEnabled(e){super.setEnabled(e),this._resyncMeshes()}getShadowGenerator(e=null){return null===this._shadowGenerators?null:this._shadowGenerators.get(e)??null}getShadowGenerators(){return this._shadowGenerators}getAbsolutePosition(){return s.Vector3.Zero()}canAffectMesh(e){return!e||(!this.includedOnlyMeshes||!(this.includedOnlyMeshes.length>0)||-1!==this.includedOnlyMeshes.indexOf(e))&&(!this.excludedMeshes||!(this.excludedMeshes.length>0)||-1===this.excludedMeshes.indexOf(e))&&(0===this.includeOnlyWithLayerMask||(this.includeOnlyWithLayerMask&e.layerMask)!=0)&&(0===this.excludeWithLayerMask||!(this.excludeWithLayerMask&e.layerMask))}dispose(e,t=!1){if(this._shadowGenerators){let e=this._shadowGenerators.values();for(let t=e.next();!0!==t.done;t=e.next())t.value.dispose();this._shadowGenerators=null}if(this.getScene().stopAnimation(this),this._parentContainer){let e=this._parentContainer.lights.indexOf(this);e>-1&&this._parentContainer.lights.splice(e,1),this._parentContainer=null}for(let e of this.getScene().meshes)e._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),super.dispose(e,t)}getTypeID(){return 0}getScaledIntensity(){return this._photometricScale*this.intensity}clone(e,t=null){let i=l.GetConstructorFromName(this.getTypeID(),e,this.getScene());if(!i)return null;let s=d.SerializationHelper.Clone(i,this);return e&&(s.name=e),t&&(s.parent=t),s.setEnabled(this.isEnabled()),this.onClonedObservable.notifyObservers(s),s}serialize(){let e=d.SerializationHelper.Serialize(this);if(e.uniqueId=this.uniqueId,e.type=this.getTypeID(),this.parent&&this.parent._serializeAsParent(e),this.excludedMeshes.length>0)for(let t of(e.excludedMeshesIds=[],this.excludedMeshes))e.excludedMeshesIds.push(t.id);if(this.includedOnlyMeshes.length>0)for(let t of(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes))e.includedOnlyMeshesIds.push(t.id);return d.SerializationHelper.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e}static GetConstructorFromName(e,t,i){let s=n.Node.Construct("Light_Type_"+e,t,i);return s||null}static Parse(e,t){let i=l.GetConstructorFromName(e.type,e.name,t);if(!i)return null;let s=d.SerializationHelper.Parse(i,e,t);if(e.excludedMeshesIds&&(s._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(s._includedOnlyMeshesIds=e.includedOnlyMeshesIds),void 0!==e.parentId&&(s._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(s._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.falloffType&&(s.falloffType=e.falloffType),void 0!==e.lightmapMode&&(s.lightmapMode=e.lightmapMode),e.animations){for(let t=0;t<e.animations.length;t++){let i=e.animations[t],r=(0,o.GetClass)("BABYLON.Animation");r&&s.animations.push(r.Parse(i))}n.Node.ParseAnimationRanges(s,e,t)}return e.autoAnimate&&t.beginAnimation(s,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),void 0!==e.isEnabled&&s.setEnabled(e.isEnabled),s._onParsed(e,t),s}_onParsed(e,t){}_hookArrayForExcluded(e){let t=e.push;e.push=(...i)=>{let s=t.apply(e,i);if(this._clusteredContainer)return s;for(let e of i)e._resyncLightSource(this);return s};let i=e.splice;if(e.splice=(t,s)=>{let r=i.call(e,t,s??e.length);if(this._clusteredContainer)return r;for(let e of r)e._resyncLightSource(this);return r},!this._clusteredContainer)for(let t of e)t._resyncLightSource(this)}_hookArrayForIncludedOnly(e){let t=e.push;e.push=(...i)=>{let s=t.apply(e,i);return this._resyncMeshes(),s};let i=e.splice;e.splice=(t,s)=>{let r=i.call(e,t,s??e.length);return this._resyncMeshes(),r},this._resyncMeshes()}_resyncMeshes(){if(!this._clusteredContainer)for(let e of this.getScene().meshes)e._resyncLightSource(this)}_markMeshesAsLightDirty(){for(let e of this.getScene().meshes)-1!==e.lightSources.indexOf(this)&&e._markSubMeshesAsLightDirty()}_computePhotometricScale(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()}_getPhotometricScale(){let e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===l.INTENSITYMODE_AUTOMATIC&&(i=t===l.LIGHTTYPEID_DIRECTIONALLIGHT?l.INTENSITYMODE_ILLUMINANCE:l.INTENSITYMODE_LUMINOUSINTENSITY),t){case l.LIGHTTYPEID_POINTLIGHT:case l.LIGHTTYPEID_SPOTLIGHT:switch(i){case l.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case l.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case l.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case l.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case l.INTENSITYMODE_ILLUMINANCE:e=1;break;case l.INTENSITYMODE_LUMINANCE:{let t=this.radius;e=2*Math.PI*(1-Math.cos(t=Math.max(t,.001)))}}break;case l.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e}_reorderLightsInScene(){let e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()}areLightTexturesReady(){return!0}_isReady(){return!0}}l.FALLOFF_DEFAULT=h.LightConstants.FALLOFF_DEFAULT,l.FALLOFF_PHYSICAL=h.LightConstants.FALLOFF_PHYSICAL,l.FALLOFF_GLTF=h.LightConstants.FALLOFF_GLTF,l.FALLOFF_STANDARD=h.LightConstants.FALLOFF_STANDARD,l.LIGHTMAP_DEFAULT=h.LightConstants.LIGHTMAP_DEFAULT,l.LIGHTMAP_SPECULAR=h.LightConstants.LIGHTMAP_SPECULAR,l.LIGHTMAP_SHADOWSONLY=h.LightConstants.LIGHTMAP_SHADOWSONLY,l.INTENSITYMODE_AUTOMATIC=h.LightConstants.INTENSITYMODE_AUTOMATIC,l.INTENSITYMODE_LUMINOUSPOWER=h.LightConstants.INTENSITYMODE_LUMINOUSPOWER,l.INTENSITYMODE_LUMINOUSINTENSITY=h.LightConstants.INTENSITYMODE_LUMINOUSINTENSITY,l.INTENSITYMODE_ILLUMINANCE=h.LightConstants.INTENSITYMODE_ILLUMINANCE,l.INTENSITYMODE_LUMINANCE=h.LightConstants.INTENSITYMODE_LUMINANCE,l.LIGHTTYPEID_POINTLIGHT=h.LightConstants.LIGHTTYPEID_POINTLIGHT,l.LIGHTTYPEID_DIRECTIONALLIGHT=h.LightConstants.LIGHTTYPEID_DIRECTIONALLIGHT,l.LIGHTTYPEID_SPOTLIGHT=h.LightConstants.LIGHTTYPEID_SPOTLIGHT,l.LIGHTTYPEID_HEMISPHERICLIGHT=h.LightConstants.LIGHTTYPEID_HEMISPHERICLIGHT,l.LIGHTTYPEID_RECT_AREALIGHT=h.LightConstants.LIGHTTYPEID_RECT_AREALIGHT,(0,t.__decorate)([(0,i.serializeAsColor3)()],l.prototype,"diffuse",void 0),(0,t.__decorate)([(0,i.serializeAsColor3)()],l.prototype,"specular",void 0),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"falloffType",void 0),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"intensity",void 0),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"range",null),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"intensityMode",null),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"radius",null),(0,t.__decorate)([(0,i.serialize)()],l.prototype,"_renderPriority",void 0),(0,t.__decorate)([(0,i.expandToProperty)("_reorderLightsInScene")],l.prototype,"renderPriority",void 0),(0,t.__decorate)([(0,i.serialize)("shadowEnabled")],l.prototype,"_shadowEnabled",void 0),(0,t.__decorate)([(0,i.serialize)("excludeWithLayerMask")],l.prototype,"_excludeWithLayerMask",void 0),(0,t.__decorate)([(0,i.serialize)("includeOnlyWithLayerMask")],l.prototype,"_includeOnlyWithLayerMask",void 0),(0,t.__decorate)([(0,i.serialize)("lightmapMode")],l.prototype,"_lightmapMode",void 0);class _ extends l{constructor(e,t,i,n){super(e,i,n),this.groundColor=new r.Color3(0,0,0),this.direction=t||s.Vector3.Up()}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}getClassName(){return"HemisphericLight"}setDirectionToTarget(e){return this.direction=s.Vector3.Normalize(e.subtract(s.Vector3.Zero())),this.direction}getShadowGenerator(){return null}transferToEffect(e,t){let i=s.Vector3.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this}transferToNodeMaterialEffect(e,t){let i=s.Vector3.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this}computeWorldMatrix(){return this._worldMatrix||(this._worldMatrix=s.Matrix.Identity()),this._worldMatrix}getTypeID(){return l.LIGHTTYPEID_HEMISPHERICLIGHT}prepareLightSpecificDefines(e,t){e["HEMILIGHT"+t]=!0}}(0,t.__decorate)([(0,i.serializeAsColor3)()],_.prototype,"groundColor",void 0),(0,t.__decorate)([(0,i.serializeAsVector3)()],_.prototype,"direction",void 0);let c=!1;function u(){c||(c=!0,n.Node.AddNodeConstructor("Light_Type_3",(e,t)=>()=>new _(e,s.Vector3.Zero(),t)),(0,o.RegisterClass)("BABYLON.HemisphericLight",_))}e.s(["HemisphericLight",0,_,"RegisterHemisphericLight",0,u],21545),u(),e.s([],7509),e.i(7509),e.i(21545),e.s(["HemisphericLight",0,_,"RegisterHemisphericLight",0,u],12847)}]);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49697,e=>{"use strict";var t=e.i(12423);let r="lodPixelShader",o=`const GammaEncodePowerApprox=1.0/2.2;varying vUV: vec2f;var textureSampler: texture_2d<f32>;uniform lod: f32;uniform gamma: i32;@fragment
|
|
2
|
+
fn main(input: FragmentInputs)->FragmentOutputs {let textureSize=textureDimensions(textureSampler);fragmentOutputs.color=textureLoad(textureSampler,vec2u(fragmentInputs.vUV*vec2f(textureSize)),u32(uniforms.lod));if (uniforms.gamma==0) {fragmentOutputs.color=vec4f(pow(fragmentOutputs.color.rgb,vec3f(GammaEncodePowerApprox)),fragmentOutputs.color.a);}}
|
|
3
|
+
`;t.ShaderStore.ShadersStoreWGSL[r]||(t.ShaderStore.ShadersStoreWGSL[r]=o),e.s(["lodPixelShaderWGSL",0,{name:r,shader:o}])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,85821,e=>{"use strict";var t=e.i(96265);class r{static ConvertPanoramaToCubemap(e,t,r,a,o=!1,n=!0){let i;if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";if(e.length!=t*r*3)if(e.length!=t*r*4)throw"ConvertPanoramaToCubemap: input size is wrong";else i=4;else i=3;return{front:this.CreateCubemapTexture(a,this.FACE_FRONT,e,t,r,o,n,i),back:this.CreateCubemapTexture(a,this.FACE_BACK,e,t,r,o,n,i),left:this.CreateCubemapTexture(a,this.FACE_LEFT,e,t,r,o,n,i),right:this.CreateCubemapTexture(a,this.FACE_RIGHT,e,t,r,o,n,i),up:this.CreateCubemapTexture(a,this.FACE_UP,e,t,r,o,n,i),down:this.CreateCubemapTexture(a,this.FACE_DOWN,e,t,r,o,n,i),size:a,type:1,format:4,gammaSpace:!1}}static CreateCubemapTexture(e,t,r,a,o,n,i,h){let l=new Float32Array(new ArrayBuffer(e*e*12)),c=n?Math.max(1,Math.round(a/4/e)):1,u=1/c,w=u*u,s=t[1].subtract(t[0]).scale(u/e),f=t[3].subtract(t[2]).scale(u/e),d=1/e,C=0;for(let n=0;n<e;n++)for(let p=0;p<c;p++){let p=t[0],g=t[2];for(let t=0;t<e;t++)for(let u=0;u<c;u++){let c=g.subtract(p).scale(C).add(p);c.normalize();let u=this.CalcProjectionSpherical(c,r,a,o,h,i);l[n*e*3+3*t+0]+=u.r*w,l[n*e*3+3*t+1]+=u.g*w,l[n*e*3+3*t+2]+=u.b*w,p=p.add(s),g=g.add(f)}C+=d*u}return l}static CalcProjectionSpherical(e,t,r,a,o,n){let i=Math.atan2(e.z,e.x),h=Math.acos(e.y);for(;i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;let l=i/Math.PI,c=h/Math.PI,u=Math.round((l=.5*l+.5)*r);u<0?u=0:u>=r&&(u=r-1);let w=Math.round(c*a);w<0?w=0:w>=a&&(w=a-1);let s=n?a-w-1:w;return{r:t[s*r*o+u*o+0],g:t[s*r*o+u*o+1],b:t[s*r*o+u*o+2]}}}function a(e,t,r,a,o,n){if(o>0){var i;o=(i=o-136)>1023?898846567431158e293*Math.pow(2,i-1023):i<-1074?5e-324*Math.pow(2,i+1074):+Math.pow(2,i),e[n+0]=t*o,e[n+1]=r*o,e[n+2]=a*o}else e[n+0]=0,e[n+1]=0,e[n+2]=0}function o(e,t){let r,a="";for(let o=t;o<e.length-t&&"\n"!=(r=String.fromCharCode(e[o]));o++)a+=r;return a}r.FACE_LEFT=[new t.Vector3(-1,-1,-1),new t.Vector3(1,-1,-1),new t.Vector3(-1,1,-1),new t.Vector3(1,1,-1)],r.FACE_RIGHT=[new t.Vector3(1,-1,1),new t.Vector3(-1,-1,1),new t.Vector3(1,1,1),new t.Vector3(-1,1,1)],r.FACE_FRONT=[new t.Vector3(1,-1,-1),new t.Vector3(1,-1,1),new t.Vector3(1,1,-1),new t.Vector3(1,1,1)],r.FACE_BACK=[new t.Vector3(-1,-1,1),new t.Vector3(-1,-1,-1),new t.Vector3(-1,1,1),new t.Vector3(-1,1,-1)],r.FACE_DOWN=[new t.Vector3(1,1,-1),new t.Vector3(1,1,1),new t.Vector3(-1,1,-1),new t.Vector3(-1,1,1)],r.FACE_UP=[new t.Vector3(-1,-1,-1),new t.Vector3(-1,-1,1),new t.Vector3(1,-1,-1),new t.Vector3(1,-1,1)];function n(e,t){let r,o,n,i,h,l,c,u,w=t.height,s=t.width,f=t.dataPosition,d=new Uint8Array(new ArrayBuffer(4*s)),C=new Float32Array(new ArrayBuffer(t.width*t.height*12));for(;w>0;){if(r=e[f++],o=e[f++],n=e[f++],i=e[f++],2!=r||2!=o||128&n||t.width<8||t.width>32767)return function(e,t){let r,o,n,i=t.height,h=t.width,l=t.dataPosition,c=new Float32Array(new ArrayBuffer(t.width*t.height*12));for(;i>0;){for(n=0;n<t.width;n++)r=e[l++],o=e[l++],a(c,r,o,e[l++],e[l++],(t.height-i)*h*3+3*n);i--}return c}(e,t);if((n<<8|i)!=s)throw"HDR Bad header format, wrong scan line width";for(u=0,l=0;u<4;u++)for(c=(u+1)*s;l<c;)if(r=e[f++],o=e[f++],r>128){if(0==(h=r-128)||h>c-l)throw"HDR Bad Format, bad scanline data (run)";for(;h-- >0;)d[l++]=o}else{if(0==(h=r)||h>c-l)throw"HDR Bad Format, bad scanline data (non-run)";if(d[l++]=o,--h>0)for(let t=0;t<h;t++)d[l++]=e[f++]}for(u=0;u<s;u++)r=d[u],o=d[u+s],a(C,r,o,n=d[u+2*s],i=d[u+3*s],(t.height-w)*s*3+3*u);w--}return C}e.s(["_HDRTextureLoader",0,class{constructor(){this.supportCascades=!1}loadCubeData(){throw".hdr not supported in Cube."}loadData(e,t,r){let a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=function(e){let t=o(e,0);if("#"!=t[0]||"?"!=t[1])throw"Bad HDR Format.";let r=!1,a=!1,n=0;do n+=t.length+1,"FORMAT=32-bit_rle_rgbe"==(t=o(e,n))?a=!0:0==t.length&&(r=!0);while(!r)if(!a)throw"HDR Bad header format, unsupported FORMAT";n+=t.length+1,t=o(e,n);let i=/^-Y (.*) \+X (.*)$/g.exec(t);if(!i||i.length<3)throw"HDR Bad header format, no size";let h=parseInt(i[2]),l=parseInt(i[1]);if(h<8||h>32767)throw"HDR Bad header format, unsupported size";return{height:l,width:h,dataPosition:n+=t.length+1}}(a),h=n(a,i),l=i.width*i.height,c=new Float32Array(4*l);for(let e=0;e<l;e+=1)c[4*e]=h[3*e],c[4*e+1]=h[3*e+1],c[4*e+2]=h[3*e+2],c[4*e+3]=1;r(i.width,i.height,t.generateMipMaps,!1,()=>{let e=t.getEngine();t.type=1,t.format=5,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,c)})}}],85821)}]);
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65296,e=>{"use strict";var o=e.i(12423);let a="helperFunctions",r=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08;
|
|
2
|
+
const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;
|
|
3
|
+
#define saturate(x) clamp(x,0.0,1.0)
|
|
4
|
+
#define absEps(x) abs(x)+Epsilon
|
|
5
|
+
#define maxEps(x) max(x,Epsilon)
|
|
6
|
+
#define saturateEps(x) clamp(x,Epsilon,1.0)
|
|
7
|
+
mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(
|
|
8
|
+
vec3(i0.x,i1.x,i2.x),
|
|
9
|
+
vec3(i0.y,i1.y,i2.y),
|
|
10
|
+
vec3(i0.z,i1.z,i2.z)
|
|
11
|
+
);return outMatrix;}
|
|
12
|
+
mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),
|
|
13
|
+
b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),
|
|
14
|
+
b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}
|
|
15
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
16
|
+
vec3 toLinearSpaceExact(vec3 color)
|
|
17
|
+
{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));
|
|
18
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
19
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));
|
|
20
|
+
#else
|
|
21
|
+
return
|
|
22
|
+
vec3(
|
|
23
|
+
color.r<=0.04045 ? nearZeroSection.r : remainingSection.r,
|
|
24
|
+
color.g<=0.04045 ? nearZeroSection.g : remainingSection.g,
|
|
25
|
+
color.b<=0.04045 ? nearZeroSection.b : remainingSection.b);
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
vec3 toGammaSpaceExact(vec3 color)
|
|
29
|
+
{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);
|
|
30
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
31
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));
|
|
32
|
+
#else
|
|
33
|
+
return
|
|
34
|
+
vec3(
|
|
35
|
+
color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,
|
|
36
|
+
color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,
|
|
37
|
+
color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);
|
|
38
|
+
#endif
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
float toLinearSpace(float color)
|
|
42
|
+
{
|
|
43
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
44
|
+
float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;
|
|
45
|
+
#else
|
|
46
|
+
return pow(color,LinearEncodePowerApprox);
|
|
47
|
+
#endif
|
|
48
|
+
}
|
|
49
|
+
vec3 toLinearSpace(vec3 color)
|
|
50
|
+
{
|
|
51
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
52
|
+
return toLinearSpaceExact(color);
|
|
53
|
+
#else
|
|
54
|
+
return pow(color,vec3(LinearEncodePowerApprox));
|
|
55
|
+
#endif
|
|
56
|
+
}
|
|
57
|
+
vec4 toLinearSpace(vec4 color)
|
|
58
|
+
{
|
|
59
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
60
|
+
return vec4(toLinearSpaceExact(color.rgb),color.a);
|
|
61
|
+
#else
|
|
62
|
+
return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);
|
|
63
|
+
#endif
|
|
64
|
+
}
|
|
65
|
+
float toGammaSpace(float color)
|
|
66
|
+
{
|
|
67
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
68
|
+
float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;
|
|
69
|
+
#else
|
|
70
|
+
return pow(color,GammaEncodePowerApprox);
|
|
71
|
+
#endif
|
|
72
|
+
}
|
|
73
|
+
vec3 toGammaSpace(vec3 color)
|
|
74
|
+
{
|
|
75
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
76
|
+
return toGammaSpaceExact(color);
|
|
77
|
+
#else
|
|
78
|
+
return pow(color,vec3(GammaEncodePowerApprox));
|
|
79
|
+
#endif
|
|
80
|
+
}
|
|
81
|
+
vec4 toGammaSpace(vec4 color)
|
|
82
|
+
{
|
|
83
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
84
|
+
return vec4(toGammaSpaceExact(color.rgb),color.a);
|
|
85
|
+
#else
|
|
86
|
+
return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);
|
|
87
|
+
#endif
|
|
88
|
+
}
|
|
89
|
+
float square(float value)
|
|
90
|
+
{return value*value;}
|
|
91
|
+
vec3 square(vec3 value)
|
|
92
|
+
{return value*value;}
|
|
93
|
+
float pow5(float value) {float sq=value*value;return sq*sq*value;}
|
|
94
|
+
vec3 double_refract(vec3 I,vec3 N,float eta) {vec3 Tfront=refract(I,N,1.0/eta);vec3 Nback=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);}
|
|
95
|
+
float getLuminanceUnclamped(vec3 color)
|
|
96
|
+
{return dot(color,LuminanceEncodeApprox);}
|
|
97
|
+
float getLuminance(vec3 color)
|
|
98
|
+
{return saturate(getLuminanceUnclamped(color));}
|
|
99
|
+
float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}
|
|
100
|
+
float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}
|
|
101
|
+
const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);}
|
|
102
|
+
vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}
|
|
103
|
+
vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}
|
|
104
|
+
vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}
|
|
105
|
+
float sqrtClamped(float value) {return sqrt(max(value,0.));}
|
|
106
|
+
float avg(vec3 value) {return dot(value,vec3(0.333333333));}
|
|
107
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
108
|
+
uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<<width)-1u);}
|
|
109
|
+
int onlyBitPosition(uint value) {return (floatBitsToInt(float(value))>>23)-0x7f;}
|
|
110
|
+
vec3 singleScatterToMultiScatterAlbedo(vec3 rho_ss) {vec3 s=sqrt(max(vec3(1.0)-rho_ss,vec3(0.0)));return (vec3(1.0)-s)*(vec3(1.0)-vec3(0.139)*s)/(vec3(1.0)+vec3(1.17)*s);}
|
|
111
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return 1.0-s*s;}
|
|
112
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms,float aniso) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return (1.0-s*s)/maxEps(1.0-aniso*s*s);}
|
|
113
|
+
float min3(vec3 v) {return min(v.x,min(v.y,v.z));}
|
|
114
|
+
float max3(vec3 v) {return max(v.x,max(v.y,v.z));}
|
|
115
|
+
float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}
|
|
116
|
+
vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),
|
|
117
|
+
uint2float(rstate*2447445414u));}
|
|
118
|
+
#endif
|
|
119
|
+
`;o.ShaderStore.IncludesShadersStore[a]||(o.ShaderStore.IncludesShadersStore[a]=r),e.s(["helperFunctions",0,{name:a,shader:r}])},85668,6232,44661,92692,97226,e=>{"use strict";var o=e.i(12423);let a="sceneUboDeclaration",r=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
|
|
120
|
+
#ifdef MULTIVIEW
|
|
121
|
+
mat4 viewProjectionR;
|
|
122
|
+
#endif
|
|
123
|
+
mat4 view;mat4 projection;vec4 vEyePosition;mat4 inverseProjection;};
|
|
124
|
+
`;o.ShaderStore.IncludesShadersStore[a]||(o.ShaderStore.IncludesShadersStore[a]=r),e.s(["sceneUboDeclaration",0,{name:a,shader:r}],85668);let t="meshUboDeclaration",i=`#ifdef WEBGL2
|
|
125
|
+
uniform mat4 world;uniform float visibility;
|
|
126
|
+
#else
|
|
127
|
+
layout(std140,column_major) uniform;uniform Mesh
|
|
128
|
+
{mat4 world;float visibility;};
|
|
129
|
+
#endif
|
|
130
|
+
#define WORLD_UBO
|
|
131
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["meshUboDeclaration",0,{name:t,shader:i}],6232);let n="defaultUboDeclaration",c=`layout(std140,column_major) uniform;uniform Material
|
|
132
|
+
{vec4 diffuseLeftColor;vec4 diffuseRightColor;vec4 opacityParts;vec4 reflectionLeftColor;vec4 reflectionRightColor;vec4 refractionLeftColor;vec4 refractionRightColor;vec4 emissiveLeftColor;vec4 emissiveRightColor;vec2 vDiffuseInfos;vec2 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec2 vSpecularInfos;vec3 vBumpInfos;mat4 diffuseMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 specularMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;float pointSize;float alphaCutOff;mat4 refractionMatrix;vec4 vRefractionInfos;vec3 vRefractionPosition;vec3 vRefractionSize;vec4 vSpecularColor;vec3 vEmissiveColor;vec4 vDiffuseColor;vec3 vAmbientColor;vec4 cameraInfo;vec4 vTextureRepetitionHexTilingParams;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionPosition;vec3 vReflectionSize;
|
|
133
|
+
#define ADDITIONAL_UBO_DECLARATION
|
|
134
|
+
};
|
|
135
|
+
#include<sceneUboDeclaration>
|
|
136
|
+
#include<meshUboDeclaration>
|
|
137
|
+
`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=c),e.s(["defaultUboDeclaration",0,{name:n,shader:c}],44661);let l="mainUVVaryingDeclaration",f=`#ifdef MAINUV{X}
|
|
138
|
+
varying vec2 vMainUV{X};
|
|
139
|
+
#endif
|
|
140
|
+
`;o.ShaderStore.IncludesShadersStore[l]||(o.ShaderStore.IncludesShadersStore[l]=f),e.s(["mainUVVaryingDeclaration",0,{name:l,shader:f}],92692);let s="logDepthDeclaration",d=`#ifdef LOGARITHMICDEPTH
|
|
141
|
+
uniform float logarithmicDepthConstant;varying float vFragmentDepth;
|
|
142
|
+
#endif
|
|
143
|
+
`;o.ShaderStore.IncludesShadersStore[s]||(o.ShaderStore.IncludesShadersStore[s]=d),e.s(["logDepthDeclaration",0,{name:s,shader:d}],97226)},29981,56770,69838,40671,e=>{"use strict";var o=e.i(12423);let a="clipPlaneFragmentDeclaration",r=`#ifdef CLIPPLANE
|
|
144
|
+
varying float fClipDistance;
|
|
145
|
+
#endif
|
|
146
|
+
#ifdef CLIPPLANE2
|
|
147
|
+
varying float fClipDistance2;
|
|
148
|
+
#endif
|
|
149
|
+
#ifdef CLIPPLANE3
|
|
150
|
+
varying float fClipDistance3;
|
|
151
|
+
#endif
|
|
152
|
+
#ifdef CLIPPLANE4
|
|
153
|
+
varying float fClipDistance4;
|
|
154
|
+
#endif
|
|
155
|
+
#ifdef CLIPPLANE5
|
|
156
|
+
varying float fClipDistance5;
|
|
157
|
+
#endif
|
|
158
|
+
#ifdef CLIPPLANE6
|
|
159
|
+
varying float fClipDistance6;
|
|
160
|
+
#endif
|
|
161
|
+
`;o.ShaderStore.IncludesShadersStore[a]||(o.ShaderStore.IncludesShadersStore[a]=r),e.s(["clipPlaneFragmentDeclaration",0,{name:a,shader:r}],29981);let t="fogFragmentDeclaration",i=`#ifdef FOG
|
|
162
|
+
#define FOGMODE_NONE 0.
|
|
163
|
+
#define FOGMODE_EXP 1.
|
|
164
|
+
#define FOGMODE_EXP2 2.
|
|
165
|
+
#define FOGMODE_LINEAR 3.
|
|
166
|
+
#define E 2.71828
|
|
167
|
+
uniform vec4 vFogInfos;uniform vec3 vFogColor;varying vec3 vFogDistance;float CalcFogFactor()
|
|
168
|
+
{float fogCoeff=1.0;float fogStart=vFogInfos.y;float fogEnd=vFogInfos.z;float fogDensity=vFogInfos.w;float fogDistance=length(vFogDistance);if (FOGMODE_LINEAR==vFogInfos.x)
|
|
169
|
+
{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}
|
|
170
|
+
else if (FOGMODE_EXP==vFogInfos.x)
|
|
171
|
+
{fogCoeff=1.0/pow(E,fogDistance*fogDensity);}
|
|
172
|
+
else if (FOGMODE_EXP2==vFogInfos.x)
|
|
173
|
+
{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}
|
|
174
|
+
return clamp(fogCoeff,0.0,1.0);}
|
|
175
|
+
#endif
|
|
176
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["fogFragmentDeclaration",0,{name:t,shader:i}],56770);let n="clipPlaneFragment",c=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
|
|
177
|
+
if (false) {}
|
|
178
|
+
#endif
|
|
179
|
+
#ifdef CLIPPLANE
|
|
180
|
+
else if (fClipDistance>0.0)
|
|
181
|
+
{discard;}
|
|
182
|
+
#endif
|
|
183
|
+
#ifdef CLIPPLANE2
|
|
184
|
+
else if (fClipDistance2>0.0)
|
|
185
|
+
{discard;}
|
|
186
|
+
#endif
|
|
187
|
+
#ifdef CLIPPLANE3
|
|
188
|
+
else if (fClipDistance3>0.0)
|
|
189
|
+
{discard;}
|
|
190
|
+
#endif
|
|
191
|
+
#ifdef CLIPPLANE4
|
|
192
|
+
else if (fClipDistance4>0.0)
|
|
193
|
+
{discard;}
|
|
194
|
+
#endif
|
|
195
|
+
#ifdef CLIPPLANE5
|
|
196
|
+
else if (fClipDistance5>0.0)
|
|
197
|
+
{discard;}
|
|
198
|
+
#endif
|
|
199
|
+
#ifdef CLIPPLANE6
|
|
200
|
+
else if (fClipDistance6>0.0)
|
|
201
|
+
{discard;}
|
|
202
|
+
#endif
|
|
203
|
+
`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=c),e.s(["clipPlaneFragment",0,{name:n,shader:c}],69838);let l="fogFragment",f=`#ifdef FOG
|
|
204
|
+
float fog=CalcFogFactor();
|
|
205
|
+
#ifdef PBR
|
|
206
|
+
fog=toLinearSpace(fog);
|
|
207
|
+
#endif
|
|
208
|
+
color.rgb=mix(vFogColor,color.rgb,fog);
|
|
209
|
+
#endif
|
|
210
|
+
`;o.ShaderStore.IncludesShadersStore[l]||(o.ShaderStore.IncludesShadersStore[l]=f),e.s(["fogFragment",0,{name:l,shader:f}],40671)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47786,t=>{"use strict";function e(t){return Math.floor(t/8)}class r{constructor(t){this.size=t,this._byteArray=new Uint8Array(Math.ceil(this.size/8))}get(t){if(t>=this.size)throw RangeError("Bit index out of range");let r=e(t),o=1<<t%8;return(this._byteArray[r]&o)!=0}set(t,r){if(t>=this.size)throw RangeError("Bit index out of range");let o=e(t),i=1<<t%8;r?this._byteArray[o]|=i:this._byteArray[o]&=~i}}t.s(["OptimizeIndices",0,function(t){let e=[],o=t.length/3;for(let r=0;r<o;r++)e.push([t[3*r],t[3*r+1],t[3*r+2]]);let i=new Map;for(let t=0;t<e.length;t++)for(let r of e[t]){let e=i.get(r);e||i.set(r,e=[]),e.push(t)}let s=new r(o),l=[],n=t=>{let r=[t];for(;r.length>0;){let t=r.pop();if(!s.get(t))for(let o of(s.set(t,!0),l.push(e[t]),e[t])){let t=i.get(o);if(!t)return;for(let e of t)s.get(e)||r.push(e)}}};for(let t=0;t<o;t++)s.get(t)||n(t);let f=0;for(let e of l)t[f++]=e[0],t[f++]=e[1],t[f++]=e[2]}],47786)}]);
|