@luma.gl/webgl 9.0.0-alpha.29 → 9.0.0-alpha.30
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 +2 -1
- package/dist/adapter/converters/device-parameters.d.ts +1 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +1 -1
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts +1 -1
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +1 -1
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.d.ts +4 -4
- package/dist/adapter/helpers/attribute-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts +2 -2
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +1 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -1
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.d.ts +1 -1
- package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +1 -1
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +2 -2
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +1 -1
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +7 -3
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +2 -2
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +7 -8
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +1 -1
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +1 -1
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +2 -2
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +2 -2
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +1 -1
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +3 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +1 -1
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +1 -1
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/buffer-with-accessor.d.ts +1 -1
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -1
- package/dist/classic/buffer-with-accessor.js +1 -1
- package/dist/classic/buffer-with-accessor.js.map +1 -1
- package/dist/classic/clear.d.ts +1 -1
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +1 -1
- package/dist/classic/clear.js.map +1 -1
- package/dist/classic/copy-and-blit.d.ts +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +1 -1
- package/dist/classic/copy-and-blit.js.map +1 -1
- package/dist/classic/format-utils.js +1 -1
- package/dist/classic/format-utils.js.map +1 -1
- package/dist/classic/typed-array-utils.d.ts +1 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/webgl-checks.js +1 -1
- package/dist/context/context/webgl-checks.js.map +1 -1
- package/dist/context/debug/spector.js +1 -1
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +1 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +1 -1
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +1 -1
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +1 -1
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +55 -37
- package/dist/index.cjs +185 -170
- package/dist/index.js.map +1 -1
- package/dist.min.js +4 -4
- package/package.json +5 -5
- package/src/adapter/converters/device-parameters.ts +1 -1
- package/src/adapter/converters/sampler-parameters.ts +1 -1
- package/src/adapter/converters/texture-formats.ts +2 -2
- package/src/adapter/converters/vertex-formats.ts +1 -1
- package/src/adapter/device-helpers/device-features.ts +1 -1
- package/src/adapter/device-helpers/device-limits.ts +1 -1
- package/src/adapter/device-helpers/get-device-info.ts +1 -1
- package/src/adapter/helpers/attribute-utils.ts +4 -4
- package/src/adapter/helpers/get-shader-layout.ts +3 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/helpers/set-uniform.ts +3 -4
- package/src/adapter/helpers/uniforms.ts +1 -1
- package/src/adapter/objects/constants-to-keys.ts +1 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +2 -2
- package/src/adapter/objects/webgl-vertex-array-object.ts +2 -2
- package/src/adapter/resources/webgl-buffer.ts +2 -2
- package/src/adapter/resources/webgl-command-buffer.ts +2 -2
- package/src/adapter/resources/webgl-command-encoder.ts +2 -2
- package/src/adapter/resources/webgl-framebuffer.ts +2 -2
- package/src/adapter/resources/webgl-render-pass.ts +9 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +13 -8
- package/src/adapter/resources/webgl-sampler.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +1 -1
- package/src/adapter/resources/webgl-texture.ts +2 -2
- package/src/adapter/webgl-canvas-context.ts +2 -2
- package/src/adapter/webgl-device.ts +3 -3
- package/src/classic/accessor.ts +1 -1
- package/src/classic/buffer-with-accessor.ts +2 -2
- package/src/classic/clear.ts +1 -1
- package/src/classic/copy-and-blit.ts +1 -1
- package/src/classic/format-utils.ts +1 -1
- package/src/classic/typed-array-utils.ts +1 -1
- package/src/context/context/webgl-checks.ts +1 -1
- package/src/context/debug/spector.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +1 -1
- package/src/context/parameters/unified-parameter-api.ts +1 -1
- package/src/context/polyfill/polyfill-context.ts +1 -1
- package/src/context/polyfill/polyfill-table.ts +1 -1
- package/src/context/state-tracker/track-context-state.ts +1 -1
- package/src/context/state-tracker/with-parameters.ts +1 -1
- package/src/index.ts +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +0 -12
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +0 -84
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +0 -123
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["registerHeadlessGL","WebGLDevice","WebGLCanvasContext","WebGLResource","WEBGLResource","WEBGLBuffer","WEBGLTexture","WEBGLShader","WEBGLSampler","WEBGLFramebuffer","WEBGLRenderPipeline","WEBGLCommandEncoder","WEBGLRenderPass","WEBGLRenderbuffer","WEBGLVertexArrayObject","Accessor","BufferWithAccessor","isWebGL","isWebGL2","getWebGL2Context","assertWebGLContext","assertWebGL2Context","setDeviceParameters","withDeviceParameters","getParameters","setParameters","resetParameters","withParameters","trackContextState","pushContextState","popContextState","polyfillContext","getShaderLayout","mergeShaderLayout","convertGLToTextureFormat","_checkFloat32ColorAttachment","TEXTURE_FORMATS","_TEXTURE_FORMATS","clear","readPixelsToBuffer","readPixelsToArray","copyToTexture"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl Base WebGL wrapper library\n// Provides simple class/function wrappers around the low level webgl objects\n// These classes are intentionally close to the WebGL API\n// but make it easier to use.\n// Higher level abstractions can be built on these classes\n\n// Types\nexport type {WebGLLimits} from './adapter/device-helpers/device-limits';\n\nexport {registerHeadlessGL} from './context/context/create-headless-context';\n\n// WebGL adapter classes\nexport {WebGLDevice} from './adapter/webgl-device';\nexport {WebGLCanvasContext} from './adapter/webgl-canvas-context';\n\n// WebGL Resource classes\nexport {WebGLResource, WebGLResource as WEBGLResource} from './adapter/objects/webgl-resource';\nexport {WEBGLBuffer} from './adapter/resources/webgl-buffer';\nexport {WEBGLTexture} from './adapter/resources/webgl-texture';\n// export {WEBGLExternalTexture} from './adapter/resources/webgl-external-texture';\nexport {WEBGLShader} from './adapter/resources/webgl-shader';\nexport {WEBGLSampler} from './adapter/resources/webgl-sampler';\nexport {WEBGLFramebuffer} from './adapter/resources/webgl-framebuffer';\n\nexport {WEBGLRenderPipeline} from './adapter/resources/webgl-render-pipeline';\n// export {WEBGLComputePipeline} from './adapter/resources/webgl-compute-pipeline';\nexport {WEBGLCommandEncoder} from './adapter/resources/webgl-command-encoder';\nexport {WEBGLRenderPass} from './adapter/resources/webgl-render-pass';\n// export {WEBGLComputePass} from './adapter/resources/webgl-compute-pass';\n\n// non-api resources\nexport type {RenderbufferProps} from './adapter/objects/webgl-renderbuffer';\nexport {WEBGLRenderbuffer} from './adapter/objects/webgl-renderbuffer';\nexport {WEBGLVertexArrayObject} from './adapter/objects/webgl-vertex-array-object';\n\n// WebGL adapter classes (Legacy
|
|
1
|
+
{"version":3,"file":"index.js","names":["registerHeadlessGL","WebGLDevice","WebGLCanvasContext","WebGLResource","WEBGLResource","WEBGLBuffer","WEBGLTexture","WEBGLShader","WEBGLSampler","WEBGLFramebuffer","WEBGLRenderPipeline","WEBGLCommandEncoder","WEBGLRenderPass","WEBGLRenderbuffer","WEBGLVertexArrayObject","Accessor","BufferWithAccessor","isWebGL","isWebGL2","getWebGL2Context","assertWebGLContext","assertWebGL2Context","setDeviceParameters","withDeviceParameters","getParameters","setParameters","resetParameters","withParameters","trackContextState","pushContextState","popContextState","polyfillContext","getShaderLayout","mergeShaderLayout","convertGLToTextureFormat","_checkFloat32ColorAttachment","TEXTURE_FORMATS","_TEXTURE_FORMATS","clear","readPixelsToBuffer","readPixelsToArray","copyToTexture"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl Base WebGL wrapper library\n// Provides simple class/function wrappers around the low level webgl objects\n// These classes are intentionally close to the WebGL API\n// but make it easier to use.\n// Higher level abstractions can be built on these classes\n\n// Types\nexport type {WebGLLimits} from './adapter/device-helpers/device-limits';\n\nexport {registerHeadlessGL} from './context/context/create-headless-context';\n\n// WebGL adapter classes\nexport {WebGLDevice} from './adapter/webgl-device';\nexport {WebGLCanvasContext} from './adapter/webgl-canvas-context';\n\n// WebGL Resource classes\nexport {WebGLResource, WebGLResource as WEBGLResource} from './adapter/objects/webgl-resource';\nexport {WEBGLBuffer} from './adapter/resources/webgl-buffer';\nexport {WEBGLTexture} from './adapter/resources/webgl-texture';\n// export {WEBGLExternalTexture} from './adapter/resources/webgl-external-texture';\nexport {WEBGLShader} from './adapter/resources/webgl-shader';\nexport {WEBGLSampler} from './adapter/resources/webgl-sampler';\nexport {WEBGLFramebuffer} from './adapter/resources/webgl-framebuffer';\n\nexport {WEBGLRenderPipeline} from './adapter/resources/webgl-render-pipeline';\n// export {WEBGLComputePipeline} from './adapter/resources/webgl-compute-pipeline';\nexport {WEBGLCommandEncoder} from './adapter/resources/webgl-command-encoder';\nexport {WEBGLRenderPass} from './adapter/resources/webgl-render-pass';\n// export {WEBGLComputePass} from './adapter/resources/webgl-compute-pass';\n\n// non-api resources\nexport type {RenderbufferProps} from './adapter/objects/webgl-renderbuffer';\nexport {WEBGLRenderbuffer} from './adapter/objects/webgl-renderbuffer';\nexport {WEBGLVertexArrayObject} from './adapter/objects/webgl-vertex-array-object';\n\n// WebGL adapter classes (Legacy will likely be removed)\nexport {Accessor} from './classic/accessor';\nexport type {AccessorObject} from './types';\nexport type {BufferWithAccessorProps} from './classic/buffer-with-accessor';\nexport {BufferWithAccessor} from './classic/buffer-with-accessor';\n\nexport {\n isWebGL,\n isWebGL2,\n getWebGL2Context,\n assertWebGLContext,\n assertWebGL2Context\n} from './context/context/webgl-checks';\n\n// Unified parameter API\n\nexport {setDeviceParameters, withDeviceParameters} from './adapter/converters/device-parameters';\n\nexport type {GLParameters} from '@luma.gl/constants';\nexport {\n getParameters,\n setParameters,\n resetParameters\n} from './context/parameters/unified-parameter-api';\n\nexport {\n withParameters\n} from './context/state-tracker/with-parameters';\n\n// State tracking\nexport {\n trackContextState,\n pushContextState,\n popContextState\n} from './context/state-tracker/track-context-state';\n\n// Polyfills (supports a subset of WebGL2 APIs on WebGL1 contexts)\nexport {polyfillContext} from './context/polyfill/polyfill-context';\n\n// HELPERS - EXPERIMENTAL\nexport {getShaderLayout, mergeShaderLayout} from './adapter/helpers/get-shader-layout';\nexport {convertGLToTextureFormat, _checkFloat32ColorAttachment} from './adapter/converters/texture-formats';\n\n// TEST EXPORTS\nexport {TEXTURE_FORMATS as _TEXTURE_FORMATS} from './adapter/converters/texture-formats';\n\n// DEPRECATED EXPORTS\nexport {clear} from './classic/clear';\nexport {readPixelsToBuffer, readPixelsToArray, copyToTexture} from './classic/copy-and-blit';\n"],"mappings":"SASQA,kBAAkB;AAAA,SAGlBC,WAAW;AAAA,SACXC,kBAAkB;AAAA,SAGlBC,aAAa,EAAEA,aAAa,IAAIC,aAAa;AAAA,SAC7CC,WAAW;AAAA,SACXC,YAAY;AAAA,SAEZC,WAAW;AAAA,SACXC,YAAY;AAAA,SACZC,gBAAgB;AAAA,SAEhBC,mBAAmB;AAAA,SAEnBC,mBAAmB;AAAA,SACnBC,eAAe;AAAA,SAKfC,iBAAiB;AAAA,SACjBC,sBAAsB;AAAA,SAGtBC,QAAQ;AAAA,SAGRC,kBAAkB;AAAA,SAGxBC,OAAO,EACPC,QAAQ,EACRC,gBAAgB,EAChBC,kBAAkB,EAClBC,mBAAmB;AAAA,SAKbC,mBAAmB,EAAEC,oBAAoB;AAAA,SAI/CC,aAAa,EACbC,aAAa,EACbC,eAAe;AAAA,SAIfC,cAAc;AAAA,SAKdC,iBAAiB,EACjBC,gBAAgB,EAChBC,eAAe;AAAA,SAITC,eAAe;AAAA,SAGfC,eAAe,EAAEC,iBAAiB;AAAA,SAClCC,wBAAwB,EAAEC,4BAA4B;AAAA,SAGtDC,eAAe,IAAIC,gBAAgB;AAAA,SAGnCC,KAAK;AAAA,SACLC,kBAAkB,EAAEC,iBAAiB,EAAEC,aAAa"}
|
package/dist.min.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
7
|
var __exports__=(()=>{var Ao=Object.create;var Yt=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var mo=Object.getOwnPropertyNames;var ho=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var yr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),go=(e,t)=>{for(var r in t)Yt(e,r,{get:t[r],enumerable:!0})},Bn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of mo(t))!So.call(e,a)&&a!==r&&Yt(e,a,{get:()=>t[a],enumerable:!(n=po(t,a))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Ao(ho(e)):{},Bn(t||!e||!e.__esModule?Yt(r,"default",{value:e,enumerable:!0}):r,e)),vo=e=>Bn(Yt({},"__esModule",{value:!0}),e);var Hn=yr((uc,Me)=>{function Fr(e){return Me.exports=Fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me.exports.__esModule=!0,Me.exports.default=Me.exports,Fr(e)}Me.exports=Fr,Me.exports.__esModule=!0,Me.exports.default=Me.exports});var Vn=yr((fc,De)=>{var Co=Hn().default;function Wn(){"use strict";De.exports=Wn=function(){return e},De.exports.__esModule=!0,De.exports.default=De.exports;var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(O,m,g){O[m]=g.value},a=typeof Symbol=="function"?Symbol:{},o=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function _(O,m,g){return Object.defineProperty(O,m,{value:g,enumerable:!0,configurable:!0,writable:!0}),O[m]}try{_({},"")}catch{_=function(g,M,X){return g[M]=X}}function c(O,m,g,M){var X=m&&m.prototype instanceof R?m:R,U=Object.create(X.prototype),Y=new q(M||[]);return n(U,"_invoke",{value:L(O,g,Y)}),U}function E(O,m,g){try{return{type:"normal",arg:O.call(m,g)}}catch(M){return{type:"throw",arg:M}}}e.wrap=c;var l={};function R(){}function T(){}function A(){}var h={};_(h,o,function(){return this});var v=Object.getPrototypeOf,S=v&&v(v(ee([])));S&&S!==t&&r.call(S,o)&&(h=S);var I=A.prototype=R.prototype=Object.create(h);function C(O){["next","throw","return"].forEach(function(m){_(O,m,function(g){return this._invoke(m,g)})})}function D(O,m){function g(X,U,Y,ae){var te=E(O[X],O,U);if(te.type!=="throw"){var Ae=te.arg,ve=Ae.value;return ve&&Co(ve)=="object"&&r.call(ve,"__await")?m.resolve(ve.__await).then(function(Be){g("next",Be,Y,ae)},function(Be){g("throw",Be,Y,ae)}):m.resolve(ve).then(function(Be){Ae.value=Be,Y(Ae)},function(Be){return g("throw",Be,Y,ae)})}ae(te.arg)}var M;n(this,"_invoke",{value:function(U,Y){function ae(){return new m(function(te,Ae){g(U,Y,te,Ae)})}return M=M?M.then(ae,ae):ae()}})}function L(O,m,g){var M="suspendedStart";return function(X,U){if(M==="executing")throw new Error("Generator is already running");if(M==="completed"){if(X==="throw")throw U;return j()}for(g.method=X,g.arg=U;;){var Y=g.delegate;if(Y){var ae=W(Y,g);if(ae){if(ae===l)continue;return ae}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(M==="suspendedStart")throw M="completed",g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);M="executing";var te=E(O,m,g);if(te.type==="normal"){if(M=g.done?"completed":"suspendedYield",te.arg===l)continue;return{value:te.arg,done:g.done}}te.type==="throw"&&(M="completed",g.method="throw",g.arg=te.arg)}}}function W(O,m){var g=m.method,M=O.iterator[g];if(M===void 0)return m.delegate=null,g==="throw"&&O.iterator.return&&(m.method="return",m.arg=void 0,W(O,m),m.method==="throw")||g!=="return"&&(m.method="throw",m.arg=new TypeError("The iterator does not provide a '"+g+"' method")),l;var X=E(M,O.iterator,m.arg);if(X.type==="throw")return m.method="throw",m.arg=X.arg,m.delegate=null,l;var U=X.arg;return U?U.done?(m[O.resultName]=U.value,m.next=O.nextLoc,m.method!=="return"&&(m.method="next",m.arg=void 0),m.delegate=null,l):U:(m.method="throw",m.arg=new TypeError("iterator result is not an object"),m.delegate=null,l)}function K(O){var m={tryLoc:O[0]};1 in O&&(m.catchLoc=O[1]),2 in O&&(m.finallyLoc=O[2],m.afterLoc=O[3]),this.tryEntries.push(m)}function ne(O){var m=O.completion||{};m.type="normal",delete m.arg,O.completion=m}function q(O){this.tryEntries=[{tryLoc:"root"}],O.forEach(K,this),this.reset(!0)}function ee(O){if(O){var m=O[o];if(m)return m.call(O);if(typeof O.next=="function")return O;if(!isNaN(O.length)){var g=-1,M=function X(){for(;++g<O.length;)if(r.call(O,g))return X.value=O[g],X.done=!1,X;return X.value=void 0,X.done=!0,X};return M.next=M}}return{next:j}}function j(){return{value:void 0,done:!0}}return T.prototype=A,n(I,"constructor",{value:A,configurable:!0}),n(A,"constructor",{value:T,configurable:!0}),T.displayName=_(A,f,"GeneratorFunction"),e.isGeneratorFunction=function(O){var m=typeof O=="function"&&O.constructor;return!!m&&(m===T||(m.displayName||m.name)==="GeneratorFunction")},e.mark=function(O){return Object.setPrototypeOf?Object.setPrototypeOf(O,A):(O.__proto__=A,_(O,f,"GeneratorFunction")),O.prototype=Object.create(I),O},e.awrap=function(O){return{__await:O}},C(D.prototype),_(D.prototype,u,function(){return this}),e.AsyncIterator=D,e.async=function(O,m,g,M,X){X===void 0&&(X=Promise);var U=new D(c(O,m,g,M),X);return e.isGeneratorFunction(m)?U:U.next().then(function(Y){return Y.done?Y.value:U.next()})},C(I),_(I,f,"Generator"),_(I,o,function(){return this}),_(I,"toString",function(){return"[object Generator]"}),e.keys=function(O){var m=Object(O),g=[];for(var M in m)g.push(M);return g.reverse(),function X(){for(;g.length;){var U=g.pop();if(U in m)return X.value=U,X.done=!1,X}return X.done=!0,X}},e.values=ee,q.prototype={constructor:q,reset:function(m){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(ne),!m)for(var g in this)g.charAt(0)==="t"&&r.call(this,g)&&!isNaN(+g.slice(1))&&(this[g]=void 0)},stop:function(){this.done=!0;var m=this.tryEntries[0].completion;if(m.type==="throw")throw m.arg;return this.rval},dispatchException:function(m){if(this.done)throw m;var g=this;function M(Ae,ve){return Y.type="throw",Y.arg=m,g.next=Ae,ve&&(g.method="next",g.arg=void 0),!!ve}for(var X=this.tryEntries.length-1;X>=0;--X){var U=this.tryEntries[X],Y=U.completion;if(U.tryLoc==="root")return M("end");if(U.tryLoc<=this.prev){var ae=r.call(U,"catchLoc"),te=r.call(U,"finallyLoc");if(ae&&te){if(this.prev<U.catchLoc)return M(U.catchLoc,!0);if(this.prev<U.finallyLoc)return M(U.finallyLoc)}else if(ae){if(this.prev<U.catchLoc)return M(U.catchLoc,!0)}else{if(!te)throw new Error("try statement without catch or finally");if(this.prev<U.finallyLoc)return M(U.finallyLoc)}}}},abrupt:function(m,g){for(var M=this.tryEntries.length-1;M>=0;--M){var X=this.tryEntries[M];if(X.tryLoc<=this.prev&&r.call(X,"finallyLoc")&&this.prev<X.finallyLoc){var U=X;break}}U&&(m==="break"||m==="continue")&&U.tryLoc<=g&&g<=U.finallyLoc&&(U=null);var Y=U?U.completion:{};return Y.type=m,Y.arg=g,U?(this.method="next",this.next=U.finallyLoc,l):this.complete(Y)},complete:function(m,g){if(m.type==="throw")throw m.arg;return m.type==="break"||m.type==="continue"?this.next=m.arg:m.type==="return"?(this.rval=this.arg=m.arg,this.method="return",this.next="end"):m.type==="normal"&&g&&(this.next=g),l},finish:function(m){for(var g=this.tryEntries.length-1;g>=0;--g){var M=this.tryEntries[g];if(M.finallyLoc===m)return this.complete(M.completion,M.afterLoc),ne(M),l}},catch:function(m){for(var g=this.tryEntries.length-1;g>=0;--g){var M=this.tryEntries[g];if(M.tryLoc===m){var X=M.completion;if(X.type==="throw"){var U=X.arg;ne(M)}return U}}throw new Error("illegal catch attempt")},delegateYield:function(m,g,M){return this.delegate={iterator:ee(m),resultName:g,nextLoc:M},this.method==="next"&&(this.arg=void 0),l}},e}De.exports=Wn,De.exports.__esModule=!0,De.exports.default=De.exports});var Xe=yr((_c,kn)=>{var Gt=Vn()();kn.exports=Gt;try{regeneratorRuntime=Gt}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=Gt:Function("r","regeneratorRuntime = r")(Gt)}});var X_={};go(X_,{Accessor:()=>ge,BufferWithAccessor:()=>St,WEBGLBuffer:()=>he,WEBGLCommandEncoder:()=>Cr,WEBGLFramebuffer:()=>pt,WEBGLRenderPass:()=>gr,WEBGLRenderPipeline:()=>Nr,WEBGLRenderbuffer:()=>At,WEBGLResource:()=>rt,WEBGLSampler:()=>tt,WEBGLShader:()=>Sr,WEBGLTexture:()=>Se,WEBGLVertexArrayObject:()=>br,WebGLCanvasContext:()=>hr,WebGLDevice:()=>fe,WebGLResource:()=>rt,_TEXTURE_FORMATS:()=>Je,_checkFloat32ColorAttachment:()=>lr,assertWebGL2Context:()=>ct,assertWebGLContext:()=>sr,clear:()=>uo,convertGLToTextureFormat:()=>et,copyToTexture:()=>Ro,getParameters:()=>_r,getShaderLayout:()=>vr,getWebGL2Context:()=>Dt,isWebGL:()=>Zr,isWebGL2:()=>V,mergeShaderLayout:()=>Or,polyfillContext:()=>fr,popContextState:()=>Ie,pushContextState:()=>xe,readPixelsToArray:()=>Eo,readPixelsToBuffer:()=>lo,registerHeadlessGL:()=>Un,resetParameters:()=>Ga,setDeviceParameters:()=>_n,setParameters:()=>Ue,trackContextState:()=>Xt,withDeviceParameters:()=>dr,withParameters:()=>Re});function ce(e){return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function Pr(e,t){if(ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gt(e){var t=Pr(e,"string");return ce(t)==="symbol"?t:String(t)}function s(e,t,r){return t=gt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mn(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Oo="Failed to create WebGL context in Node.js, headless gl returned null",bo=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",No={width:1,height:1,debug:!0,throwOnError:!1},zt=null;function Un(e){zt=e}function xn(){return zt!==null}function wn(e){e=Dn(Dn({},No),e);var t=e,r=t.width,n=t.height,a=t.webgl1,o=t.webgl2;if(o&&!a)throw new Error("headless-gl does not support WebGL2");if(!zt)throw new Error(bo);var u=zt(r,n,e);if(!u)throw new Error(Oo);return u}function Xn(e,t,r,n,a,o,u){try{var f=e[o](u),_=f.value}catch(c){r(c);return}f.done?t(_):Promise.resolve(_).then(n,a)}function ue(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(_){Xn(o,n,a,u,f,"next",_)}function f(_){Xn(o,n,a,u,f,"throw",_)}u(void 0)})}}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ln(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gt(n.key),n)}}function F(e,t,r){return t&&Ln(e.prototype,t),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e,t){return je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},je(e,t)}function x(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&je(e,t)}function w(e,t){if(t&&(ce(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},b(e)}var yn=ke(Xe(),1);function vt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function $(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||vt()}var Io=globalThis.self||globalThis.window||globalThis.global,nt=globalThis.window||globalThis.self||globalThis.global,yo=globalThis.document||{},Ke=globalThis.process||{},Po=globalThis.console,jn=globalThis.navigator||{};var Zt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Tc=$();var Br=globalThis;function Ot(e){if(!e&&!$())return"Node";if(vt(e))return"Electron";let t=e||jn.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Br.chrome?"Chrome":Br.safari?"Safari":Br.mozInnerScreenX?"Firefox":"Unknown"}function Fo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $t=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Fo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Kn(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Yn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function Qt(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,a=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,u=e.height*r,f=["font-size:1px;","padding:".concat(Math.floor(u/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(u,"px;"),"background:url(".concat(a,");"),"background-size:".concat(o,"px ").concat(u,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),f]}var qt;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(qt||(qt={}));var Bo=10;function zn(e){return typeof e!="string"?e:(e=e.toUpperCase(),qt[e]||qt.WHITE)}function Gn(e,t,r){if(!$&&typeof e=="string"){if(t){let n=zn(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=zn(r);e="\x1B[".concat(n+Bo,"m").concat(e,"\x1B[49m")}}return e}function Zn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),a=e;for(let o of n){let u=a[o];typeof u=="function"&&(t.find(f=>o===f)||(a[o]=u.bind(e)))}}function at(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ye(){let e;if($()&&nt.performance){var t,r;e=nt===null||nt===void 0||(t=nt.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Ke){var n;let a=Ke===null||Ke===void 0||(n=Ke.hrtime)===null||n===void 0?void 0:n.call(Ke);e=a[0]*1e3+a[1]/1e6}else e=Date.now();return e}var it={debug:$()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Mo={enabled:!0,level:0};function pe(){}var $n={},Qn={once:!0},Le=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Zt,this._startTs=Ye(),this._deltaTs=Ye(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $t("__probe-".concat(this.id,"__"),Mo),this.timeStamp("".concat(this.id," started")),Zn(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ye()-this._startTs).toPrecision(10))}getDelta(){return Number((Ye()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){at(t,r)}warn(t){return this._getLogFunction(0,t,it.warn,arguments,Qn)}error(t){return this._getLogFunction(0,t,it.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,it.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,it.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,it.debug||it.info,arguments,Qn)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||pe,n&&[n],{tag:wo(r)}):pe}image(t){let{logLevel:r,priority:n,image:a,message:o="",scale:u=1}=t;return this._shouldLog(r||n)?$()?xo({image:a,message:o,scale:u}):Uo({image:a,message:o,scale:u}):pe}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||pe)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},a=qn({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return a.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(a)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||pe)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jn(t)}_getLogFunction(t,r,n,a,o){if(this._shouldLog(t)){o=qn({logLevel:t,message:r,args:a,opts:o}),n=n||o.method,at(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Ye();let u=o.tag||o.message;if(o.once&&u)if(!$n[u])$n[u]=Ye();else return pe;return r=Do(this.id,o.message,o),n.bind(console,r,...o.args)}return pe}};Le.VERSION=Zt;function Jn(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return at(Number.isFinite(t)&&t>=0),t}function qn(e){let{logLevel:t,message:r}=e;e.logLevel=Jn(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return at(a==="string"||a==="object"),Object.assign(e,{args:n},e.opts)}function Do(e,t,r){if(typeof t=="string"){let n=r.time?Yn(Kn(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Gn(t,r.color,r.background)}return t}function Uo(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),pe}function xo(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let u=Qt(o,r,n);console.log(...u)},o.src=t,pe}let a=t.nodeName||"";if(a.toLowerCase()==="img")return console.log(...Qt(t,r,n)),pe;if(a.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...Qt(o,r,n)),o.src=t.toDataURL(),pe}return pe}function wo(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var zc=new Le({id:"@probe.gl/log"});var y=new Le({id:"luma.gl"});function bt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var ze=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=bt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(bt()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ot=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,a=this.stats[r];return a||(t instanceof ze?a=t:a=new ze(r,n),this.stats[r]=a),a}};var Xo=function(){function e(){P(this,e),s(this,"stats",new Map)}return F(e,[{key:"getStats",value:function(r){return this.get(r)}},{key:"get",value:function(r){return this.stats.has(r)||this.stats.set(r,new ot({id:r})),this.stats.get(r)}}]),e}(),Jt=new Xo;function Lo(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||($()&&y.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:y,stats:Jt}),e}var ea=Lo();var Mr={};function Oe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Mr[e]=Mr[e]||1;var t=Mr[e]++;return"".concat(e,"-").concat(t)}function er(e){return e>0&&(e&e-1)===0}function st(e){var t=!0;for(var r in e){t=!1;break}return t}function ta(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ta(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ta(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var oe={id:"undefined",handle:void 0,userData:void 0},Q=function(){function e(t,r,n){if(P(this,e),s(this,"id",void 0),s(this,"props",void 0),s(this,"userData",{}),s(this,"device",void 0),s(this,"_device",void 0),s(this,"destroyed",!1),s(this,"allocatedBytes",0),s(this,"_attachedResources",new Set),!t)throw new Error("no device");this._device=t,this.props=Wo(r,n);var a=this.props.id!=="undefined"?this.props.id:Oe(this[Symbol.toStringTag]);this.props.id=a,this.id=a,this.userData=this.props.userData||{},this.addStats()}return F(e,[{key:"destroy",value:function(){this.destroyResource()}},{key:"delete",value:function(){return this.destroy(),this}},{key:"toString",value:function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")}},{key:"getProps",value:function(){return this.props}},{key:"attachResource",value:function(r){this._attachedResources.add(r)}},{key:"detachResource",value:function(r){this._attachedResources.delete(r)}},{key:"destroyAttachedResource",value:function(r){this._attachedResources.delete(r)&&r.destroy()}},{key:"destroyAttachedResources",value:function(){for(var r=0,n=Object.values(this._attachedResources);r<n.length;r++){var a=n[r];a.destroy()}this._attachedResources=new Set}},{key:"destroyResource",value:function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}},{key:"removeStats",value:function(){var r=this._device.statsManager.getStats("Resource Counts"),n=this[Symbol.toStringTag];r.get("".concat(n,"s Active")).decrementCount()}},{key:"trackAllocatedMemory",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],a=this._device.statsManager.getStats("Resource Counts");a.get("GPU Memory").addCount(r),a.get("".concat(n," Memory")).addCount(r),this.allocatedBytes=r}},{key:"trackDeallocatedMemory",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").subtractCount(this.allocatedBytes),n.get("".concat(r," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0}},{key:"addStats",value:function(){var r=this._device.statsManager.getStats("Resource Counts"),n=this[Symbol.toStringTag];r.get("Resources Created").incrementCount(),r.get("".concat(n,"s Created")).incrementCount(),r.get("".concat(n,"s Active")).incrementCount()}}]),e}();s(Q,"defaultProps",oe);function Wo(e,t){var r=Ho({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var na;function Vo(e){var t=ko();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function ko(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ra(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Dr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ra(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ra(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var jo=Dr(Dr({},oe),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});na=Symbol.toStringTag;var ie=function(e){x(r,e);var t=Vo(r);function r(n,a){var o;P(this,r);var u=Dr({},a);return(a.usage||0)&r.INDEX&&!a.indexType&&(a.data instanceof Uint32Array?u.indexType="uint32":a.data instanceof Uint16Array&&(u.indexType="uint16")),o=t.call(this,n,u,jo),s(d(o),"byteLength",void 0),o}return F(r,[{key:na,get:function(){return"Buffer"}},{key:"write",value:function(a,o){throw new Error("not implemented")}},{key:"readAsync",value:function(a,o){throw new Error("not implemented")}},{key:"getData",value:function(){throw new Error("not implemented")}}]),r}(Q);s(ie,"MAP_READ",1);s(ie,"MAP_WRITE",2);s(ie,"COPY_SRC",4);s(ie,"COPY_DST",8);s(ie,"INDEX",16);s(ie,"VERTEX",32);s(ie,"UNIFORM",64);s(ie,"STORAGE",128);s(ie,"INDIRECT",256);s(ie,"QUERY_RESOLVE",512);var ia;function aa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ur(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ko={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(y.get("debug")),break:[],gl:null};ia=Symbol.toStringTag;var Nt=function(){function e(t){P(this,e),s(this,"id",void 0),s(this,"statsManager",Jt),s(this,"props",void 0),s(this,"userData",{}),s(this,"info",void 0),s(this,"lost",void 0),s(this,"canvasContext",void 0),this.props=Ur(Ur({},Ko),t),this.id=this.props.id||Oe(this[Symbol.toStringTag].toLowerCase())}return F(e,[{key:ia,get:function(){return"Device"}},{key:"loseDevice",value:function(){return!1}},{key:"createTexture",value:function(r){return(r instanceof Promise||typeof r=="string")&&(r={data:r}),this._createTexture(r)}},{key:"createCommandEncoder",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")}},{key:"_getBufferProps",value:function(r){if(r instanceof ArrayBuffer||ArrayBuffer.isView(r))return{data:r};var n=Ur({},r);return(r.usage||0)&ie.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?n.indexType="uint32":r.data instanceof Uint16Array&&(n.indexType="uint16")),n}}]),e}();s(Nt,"VERSION",ea);function Ct(e){if(Array.isArray(e))return e}function xr(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,u,f=[],_=!0,c=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;_=!1}else for(;!(_=(n=o.call(r)).done)&&(f.push(n.value),f.length!==t);_=!0);}catch(E){c=!0,a=E}finally{try{if(!_&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw a}}return f}}function ut(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ge(e,t){if(e){if(typeof e=="string")return ut(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ut(e,t)}}function It(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H(e,t){return Ct(e)||xr(e,t)||Ge(e,t)||It()}function Yo(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=zo(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function zo(e,t){if(e){if(typeof e=="string")return oa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oa(e,t)}}function oa(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ua(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Go=$()&&typeof document<"u",tr=function(){return Go&&document.readyState==="complete"},Zo={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},ft=function(){function e(t){var r=this;if(P(this,e),s(this,"device",void 0),s(this,"id",void 0),s(this,"props",void 0),s(this,"canvas",void 0),s(this,"htmlCanvas",void 0),s(this,"offscreenCanvas",void 0),s(this,"type",void 0),s(this,"width",1),s(this,"height",1),s(this,"resizeObserver",void 0),s(this,"_canvasSizeInfo",{clientWidth:0,clientHeight:0,devicePixelRatio:1}),this.props=ua(ua({},Zo),t),t=this.props,!$()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=qo(t.canvas):this.canvas=t.canvas;else{var n,a,o=Jo(t),u=Qo(((n=t)===null||n===void 0?void 0:n.container)||null);u.insertBefore(o,u.firstChild),this.canvas=o,(a=t)!==null&&a!==void 0&&a.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(function(f){var _=Yo(f),c;try{for(_.s();!(c=_.n()).done;){var E=c.value;E.target===r.canvas&&r.update()}}catch(l){_.e(l)}finally{_.f()}}),this.resizeObserver.observe(this.canvas))}return F(e,[{key:"getDevicePixelRatio",value:function(r){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(r=r===void 0?this.props.useDevicePixels:r,!r||r<=0))return 1;if(r===!0){var n=typeof window<"u"&&window.devicePixelRatio;return n||1}return r}},{key:"getPixelSize",value:function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var r=this.getDevicePixelRatio(),n=this.canvas;return n.parentElement?[n.clientWidth*r,n.clientHeight*r]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}},{key:"getAspect",value:function(){var r=this.getPixelSize(),n=H(r,2),a=n[0],o=n[1];return a/o}},{key:"cssToDeviceRatio",value:function(){try{var r=this.getDrawingBufferSize(),n=H(r,1),a=n[0],o=this._canvasSizeInfo.clientWidth;return o?a/o:1}catch{return 1}}},{key:"cssToDevicePixels",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this.cssToDeviceRatio(),o=this.getDrawingBufferSize(),u=H(o,2),f=u[0],_=u[1];return es(r,a,f,_,n)}},{key:"setDevicePixelRatio",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var a="width"in n?n.width:this.htmlCanvas.clientWidth,o="height"in n?n.height:this.htmlCanvas.clientHeight;(!a||!o)&&(y.log(1,"Canvas clientWidth/clientHeight is 0")(),r=1,a=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);var u=this._canvasSizeInfo;if(u.clientWidth!==a||u.clientHeight!==o||u.devicePixelRatio!==r){var f=r,_=Math.floor(a*f),c=Math.floor(o*f);this.htmlCanvas.width=_,this.htmlCanvas.height=c;var E=this.getDrawingBufferSize(),l=H(E,2),R=l[0],T=l[1];(R!==_||T!==c)&&(f=Math.min(R/a,T/o),this.htmlCanvas.width=Math.floor(a*f),this.htmlCanvas.height=Math.floor(o*f),y.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=a,this._canvasSizeInfo.clientHeight=o,this._canvasSizeInfo.devicePixelRatio=r}}}},{key:"getDrawingBufferSize",value:function(){var r=this.device.gl;if(!r)throw new Error("canvas size");return[r.drawingBufferWidth,r.drawingBufferHeight]}},{key:"_setAutoCreatedCanvasId",value:function(r){var n;((n=this.htmlCanvas)===null||n===void 0?void 0:n.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=r)}}],[{key:"isPageLoaded",get:function(){return tr()}}]),e}();s(ft,"pageLoaded",$o());function $o(){return tr()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function Qo(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!tr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function qo(e){var t=document.getElementById(e);if(!t&&!tr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("'".concat(t,"' is not a canvas element"));return t}function Jo(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function es(e,t,r,n,a){var o=e,u=fa(o[0],t,r),f=_a(o[1],t,n,a),_=fa(o[0]+1,t,r),c=_===r-1?_:_-1;_=_a(o[1]+1,t,n,a);var E;return a?(_=_===0?_:_+1,E=f,f=_):E=_===n-1?_:_-1,{x:u,y:f,width:Math.max(c-u+1,1),height:Math.max(E-f+1,1)}}function fa(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function _a(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var la;function ts(e){var t=rs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function rs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ca(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ea(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ca(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ns=Ea(Ea({},oe),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});la=Symbol.toStringTag;var Ee=function(e){x(r,e);var t=ts(r);function r(n,a){var o,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ns;return P(this,r),o=t.call(this,n,a,u),s(d(o),"dimension",void 0),s(d(o),"format",void 0),s(d(o),"width",void 0),s(d(o),"height",void 0),s(d(o),"depth",void 0),s(d(o),"sampler",void 0),o.dimension=o.props.dimension,o.format=o.props.format,o.width=o.props.width,o.height=o.props.height,o.depth=o.props.depth,o}return F(r,[{key:la,get:function(){return"Texture"}}]),r}(Q);s(Ee,"COPY_SRC",1);s(Ee,"COPY_DST",2);s(Ee,"TEXTURE_BINDING",4);s(Ee,"STORAGE_BINDING",8);s(Ee,"RENDER_ATTACHMENT",16);var Ta;function as(e){var t=is();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function is(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ra(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ra(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ra(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var os=da(da({},oe),{},{stage:"vertex",source:"",sourceMap:null,language:"glsl",shaderType:0});Ta=Symbol.toStringTag;var wr=function(e){x(r,e);var t=as(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,os),s(d(o),"stage",void 0),s(d(o),"source",void 0),o.stage=o.props.stage,o.source=o.props.source,o}return F(r,[{key:Ta,get:function(){return"Shader"}}]),r}(Q);function ss(e){var t=us();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function us(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Aa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function pa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Aa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Aa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var fs=pa(pa({},oe),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1}),Xr=function(e,t){x(n,e);var r=ss(n);function n(a,o){return P(this,n),r.call(this,a,o,fs)}return F(n,[{key:t,get:function(){return"Sampler"}}]),n}(Q,Symbol.toStringTag);var ha;function _s(e){var t=cs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function cs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ma(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ma(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ma(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Es=_t(_t({},oe),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});ha=Symbol.toStringTag;var yt=function(e){x(r,e);var t=_s(r);function r(n){var a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return P(this,r),a=t.call(this,n,o,Es),s(d(a),"width",void 0),s(d(a),"height",void 0),s(d(a),"colorAttachments",[]),s(d(a),"depthStencilAttachment",null),a.width=a.props.width,a.height=a.props.height,a}return F(r,[{key:ha,get:function(){return"Framebuffer"}},{key:"resize",value:function(a){var o=!a;if(a){var u=Array.isArray(a)?a:[a.width,a.height],f=H(u,2),_=f[0],c=f[1];o=o||c!==this.height||_!==this.width,this.width=_,this.height=c}o&&(y.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))}},{key:"autoCreateAttachmentTextures",value:function(){var a=this;if(this.colorAttachments=this.props.colorAttachments.map(function(u){if(typeof u=="string"){var f=a.createColorTexture(u);return a.attachResource(f),f}return u}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var o=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(o),this.depthStencilAttachment=o}else this.depthStencilAttachment=this.props.depthStencilAttachment}},{key:"createColorTexture",value:function(a){return this.device.createTexture({id:"color-attachment",usage:Ee.RENDER_ATTACHMENT,format:a,width:this.width,height:this.height})}},{key:"createDepthStencilTexture",value:function(a){return this.device.createTexture({id:"depth-stencil-attachment",usage:Ee.RENDER_ATTACHMENT,format:a,width:this.width,height:this.height})}},{key:"resizeAttachments",value:function(a,o){for(var u=0;u<this.colorAttachments.length;++u)if(this.colorAttachments[u]){var f=this.device._createTexture(_t(_t({},this.colorAttachments[u].props),{},{width:a,height:o}));this.destroyAttachedResource(this.colorAttachments[u]),this.colorAttachments[u]=f,this.attachResource(f)}if(this.depthStencilAttachment){var _=this.device._createTexture(_t(_t({},this.depthStencilAttachment.props),{},{width:a,height:o}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=_,this.attachResource(_)}}}]),r}(Q);var va;function ls(e){var t=Rs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function Rs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Oa=ga(ga({},oe),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},layout:null,topology:"triangle-list",parameters:{},bufferMap:[],vertexCount:0,instanceCount:0,indices:null,attributes:{},bindings:{},uniforms:{}});va=Symbol.toStringTag;var rr=function(e){x(r,e);var t=ls(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,Oa),s(d(o),"hash",""),s(d(o),"vs",void 0),s(d(o),"fs",void 0),o}return F(r,[{key:va,get:function(){return"RenderPipeline"}}]),r}(Q);s(rr,"_DEFAULT_PROPS",Oa);var Ca;function ba(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ba(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ba(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ds(e){var t=Ts();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function Ts(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Ca=Symbol.toStringTag;var nr=function(e){x(r,e);var t=ds(r);function r(n,a){return P(this,r),t.call(this,n,a,r.defaultProps)}return F(r,[{key:Ca,get:function(){return"RenderPass"}}]),r}(Q);s(nr,"defaultProps",Na(Na({},Q.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1}));function As(e){var t=ps();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function ps(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ia(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ms(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ia(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ia(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var hs=ms({},oe),Lr=function(e,t){x(n,e);var r=As(n);function n(a){return P(this,n),r.call(this,a,hs)}return F(n,[{key:t,get:function(){return"CommandEncoder"}},{key:"pushDebugGroup",value:function(o){}},{key:"popDebugGroup",value:function(){}},{key:"insertDebugMarker",value:function(o){}}]),n}(Q,Symbol.toStringTag);function Ss(e){var t=gs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function gs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ya(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function vs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ya(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ya(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Os=vs({},oe),Hr=function(e,t){x(n,e);var r=Ss(n);function n(a){return P(this,n),r.call(this,a,Os)}return F(n,[{key:t,get:function(){return"CommandBuffer"}}]),n}(Q,Symbol.toStringTag);function B(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}function ar(e){var t=Pa[e],r=bs(t),n=e.includes("norm"),a=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:Pa[e],byteLength:r,integer:a,signed:o,normalized:n}}function bs(e){var t=Ns[e];return t}var Pa={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ns={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Wr(e){var t=e.split("x"),r=H(t,2),n=r[0],a=r[1],o=n,u=a?parseInt(a):1,f=ar(o);return{type:o,components:u,byteLength:f.byteLength*u,integer:f.integer,signed:f.signed,normalized:f.normalized}}function Fa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Cs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Is=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function ir(e){var t=Is.exec(e);if(t){var r=H(t,6),n=r[1],a=r[2],o=r[3],u=r[4],f=r[5];if(n){var _="".concat(o).concat(a),c=ar(_);return Cs({format:n,components:0,srgb:u==="-srgb",unsized:f==="-unsized",webgl:f==="-webgl"},c)}}return Ps(e)}var ys={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2unorm-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Ps(e){var t=ys[e];if(!t)throw new Error("Unknown format ".concat(e));return{format:t.format||"",components:t.components||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}function Fs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Bs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function zo(e,t){if(e){if(typeof e=="string")return oa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oa(e,t)}}function oa(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ua(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Go=$()&&typeof document<"u",tr=function(){return Go&&document.readyState==="complete"},Zo={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},ft=function(){function e(t){var r=this;if(P(this,e),s(this,"device",void 0),s(this,"id",void 0),s(this,"props",void 0),s(this,"canvas",void 0),s(this,"htmlCanvas",void 0),s(this,"offscreenCanvas",void 0),s(this,"type",void 0),s(this,"width",1),s(this,"height",1),s(this,"resizeObserver",void 0),s(this,"_canvasSizeInfo",{clientWidth:0,clientHeight:0,devicePixelRatio:1}),this.props=ua(ua({},Zo),t),t=this.props,!$()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=qo(t.canvas):this.canvas=t.canvas;else{var n,a,o=Jo(t),u=Qo(((n=t)===null||n===void 0?void 0:n.container)||null);u.insertBefore(o,u.firstChild),this.canvas=o,(a=t)!==null&&a!==void 0&&a.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(function(f){var _=Yo(f),c;try{for(_.s();!(c=_.n()).done;){var E=c.value;E.target===r.canvas&&r.update()}}catch(l){_.e(l)}finally{_.f()}}),this.resizeObserver.observe(this.canvas))}return F(e,[{key:"getDevicePixelRatio",value:function(r){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(r=r===void 0?this.props.useDevicePixels:r,!r||r<=0))return 1;if(r===!0){var n=typeof window<"u"&&window.devicePixelRatio;return n||1}return r}},{key:"getPixelSize",value:function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var r=this.getDevicePixelRatio(),n=this.canvas;return n.parentElement?[n.clientWidth*r,n.clientHeight*r]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}},{key:"getAspect",value:function(){var r=this.getPixelSize(),n=H(r,2),a=n[0],o=n[1];return a/o}},{key:"cssToDeviceRatio",value:function(){try{var r=this.getDrawingBufferSize(),n=H(r,1),a=n[0],o=this._canvasSizeInfo.clientWidth;return o?a/o:1}catch{return 1}}},{key:"cssToDevicePixels",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this.cssToDeviceRatio(),o=this.getDrawingBufferSize(),u=H(o,2),f=u[0],_=u[1];return es(r,a,f,_,n)}},{key:"setDevicePixelRatio",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var a="width"in n?n.width:this.htmlCanvas.clientWidth,o="height"in n?n.height:this.htmlCanvas.clientHeight;(!a||!o)&&(y.log(1,"Canvas clientWidth/clientHeight is 0")(),r=1,a=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);var u=this._canvasSizeInfo;if(u.clientWidth!==a||u.clientHeight!==o||u.devicePixelRatio!==r){var f=r,_=Math.floor(a*f),c=Math.floor(o*f);this.htmlCanvas.width=_,this.htmlCanvas.height=c;var E=this.getDrawingBufferSize(),l=H(E,2),R=l[0],T=l[1];(R!==_||T!==c)&&(f=Math.min(R/a,T/o),this.htmlCanvas.width=Math.floor(a*f),this.htmlCanvas.height=Math.floor(o*f),y.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=a,this._canvasSizeInfo.clientHeight=o,this._canvasSizeInfo.devicePixelRatio=r}}}},{key:"getDrawingBufferSize",value:function(){var r=this.device.gl;if(!r)throw new Error("canvas size");return[r.drawingBufferWidth,r.drawingBufferHeight]}},{key:"_setAutoCreatedCanvasId",value:function(r){var n;((n=this.htmlCanvas)===null||n===void 0?void 0:n.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=r)}}],[{key:"isPageLoaded",get:function(){return tr()}}]),e}();s(ft,"pageLoaded",$o());function $o(){return tr()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function Qo(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!tr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function qo(e){var t=document.getElementById(e);if(!t&&!tr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("'".concat(t,"' is not a canvas element"));return t}function Jo(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function es(e,t,r,n,a){var o=e,u=fa(o[0],t,r),f=_a(o[1],t,n,a),_=fa(o[0]+1,t,r),c=_===r-1?_:_-1;_=_a(o[1]+1,t,n,a);var E;return a?(_=_===0?_:_+1,E=f,f=_):E=_===n-1?_:_-1,{x:u,y:f,width:Math.max(c-u+1,1),height:Math.max(E-f+1,1)}}function fa(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function _a(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var la;function ts(e){var t=rs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function rs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ca(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ea(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ca(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ns=Ea(Ea({},oe),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});la=Symbol.toStringTag;var Ee=function(e){x(r,e);var t=ts(r);function r(n,a){var o,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ns;return P(this,r),o=t.call(this,n,a,u),s(d(o),"dimension",void 0),s(d(o),"format",void 0),s(d(o),"width",void 0),s(d(o),"height",void 0),s(d(o),"depth",void 0),s(d(o),"sampler",void 0),o.dimension=o.props.dimension,o.format=o.props.format,o.width=o.props.width,o.height=o.props.height,o.depth=o.props.depth,o}return F(r,[{key:la,get:function(){return"Texture"}}]),r}(Q);s(Ee,"COPY_SRC",1);s(Ee,"COPY_DST",2);s(Ee,"TEXTURE_BINDING",4);s(Ee,"STORAGE_BINDING",8);s(Ee,"RENDER_ATTACHMENT",16);var Ta;function as(e){var t=is();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function is(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ra(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ra(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ra(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var os=da(da({},oe),{},{stage:"vertex",source:"",sourceMap:null,language:"glsl",shaderType:0});Ta=Symbol.toStringTag;var wr=function(e){x(r,e);var t=as(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,os),s(d(o),"stage",void 0),s(d(o),"source",void 0),o.stage=o.props.stage,o.source=o.props.source,o}return F(r,[{key:Ta,get:function(){return"Shader"}}]),r}(Q);function ss(e){var t=us();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function us(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Aa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function pa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Aa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Aa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var fs=pa(pa({},oe),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1}),Xr=function(e,t){x(n,e);var r=ss(n);function n(a,o){return P(this,n),r.call(this,a,o,fs)}return F(n,[{key:t,get:function(){return"Sampler"}}]),n}(Q,Symbol.toStringTag);var ha;function _s(e){var t=cs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function cs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ma(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ma(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ma(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Es=_t(_t({},oe),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});ha=Symbol.toStringTag;var yt=function(e){x(r,e);var t=_s(r);function r(n){var a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return P(this,r),a=t.call(this,n,o,Es),s(d(a),"width",void 0),s(d(a),"height",void 0),s(d(a),"colorAttachments",[]),s(d(a),"depthStencilAttachment",null),a.width=a.props.width,a.height=a.props.height,a}return F(r,[{key:ha,get:function(){return"Framebuffer"}},{key:"resize",value:function(a){var o=!a;if(a){var u=Array.isArray(a)?a:[a.width,a.height],f=H(u,2),_=f[0],c=f[1];o=o||c!==this.height||_!==this.width,this.width=_,this.height=c}o&&(y.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))}},{key:"autoCreateAttachmentTextures",value:function(){var a=this;if(this.colorAttachments=this.props.colorAttachments.map(function(u){if(typeof u=="string"){var f=a.createColorTexture(u);return a.attachResource(f),f}return u}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var o=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(o),this.depthStencilAttachment=o}else this.depthStencilAttachment=this.props.depthStencilAttachment}},{key:"createColorTexture",value:function(a){return this.device.createTexture({id:"color-attachment",usage:Ee.RENDER_ATTACHMENT,format:a,width:this.width,height:this.height})}},{key:"createDepthStencilTexture",value:function(a){return this.device.createTexture({id:"depth-stencil-attachment",usage:Ee.RENDER_ATTACHMENT,format:a,width:this.width,height:this.height})}},{key:"resizeAttachments",value:function(a,o){for(var u=0;u<this.colorAttachments.length;++u)if(this.colorAttachments[u]){var f=this.device._createTexture(_t(_t({},this.colorAttachments[u].props),{},{width:a,height:o}));this.destroyAttachedResource(this.colorAttachments[u]),this.colorAttachments[u]=f,this.attachResource(f)}if(this.depthStencilAttachment){var _=this.device._createTexture(_t(_t({},this.depthStencilAttachment.props),{},{width:a,height:o}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=_,this.attachResource(_)}}}]),r}(Q);var va;function ls(e){var t=Rs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function Rs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Oa=ga(ga({},oe),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},layout:null,topology:"triangle-list",parameters:{},bufferMap:[],vertexCount:0,instanceCount:0,indices:null,attributes:{},bindings:{},uniforms:{}});va=Symbol.toStringTag;var rr=function(e){x(r,e);var t=ls(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,Oa),s(d(o),"hash",""),s(d(o),"vs",void 0),s(d(o),"fs",void 0),o}return F(r,[{key:va,get:function(){return"RenderPipeline"}}]),r}(Q);s(rr,"_DEFAULT_PROPS",Oa);var Ca;function ba(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ba(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ba(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ds(e){var t=Ts();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function Ts(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Ca=Symbol.toStringTag;var nr=function(e){x(r,e);var t=ds(r);function r(n,a){return P(this,r),t.call(this,n,a,r.defaultProps)}return F(r,[{key:Ca,get:function(){return"RenderPass"}}]),r}(Q);s(nr,"defaultProps",Na(Na({},Q.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1}));function As(e){var t=ps();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function ps(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ia(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ms(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ia(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ia(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var hs=ms({},oe),Lr=function(e,t){x(n,e);var r=As(n);function n(a){return P(this,n),r.call(this,a,hs)}return F(n,[{key:t,get:function(){return"CommandEncoder"}},{key:"pushDebugGroup",value:function(o){}},{key:"popDebugGroup",value:function(){}},{key:"insertDebugMarker",value:function(o){}}]),n}(Q,Symbol.toStringTag);function Ss(e){var t=gs();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function gs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ya(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function vs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ya(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ya(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Os=vs({},oe),Hr=function(e,t){x(n,e);var r=Ss(n);function n(a){return P(this,n),r.call(this,a,Os)}return F(n,[{key:t,get:function(){return"CommandBuffer"}}]),n}(Q,Symbol.toStringTag);function B(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}function ar(e){var t=Pa[e],r=bs(t),n=e.includes("norm"),a=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:Pa[e],byteLength:r,integer:a,signed:o,normalized:n}}function bs(e){var t=Ns[e];return t}var Pa={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ns={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Wr(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=H(r,2),a=n[0],o=n[1],u=a,f=o?parseInt(o):1,_=ar(u),c={type:u,components:f,byteLength:_.byteLength*f,integer:_.integer,signed:_.signed,normalized:_.normalized};return t&&(c.webglOnly=!0),c}function Fa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Cs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fa(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Is=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function ir(e){var t=Is.exec(e);if(t){var r=H(t,6),n=r[1],a=r[2],o=r[3],u=r[4],f=r[5];if(n){var _="".concat(o).concat(a),c=ar(_);return Cs({format:n,components:0,srgb:u==="-srgb",unsized:f==="-unsized",webgl:f==="-webgl"},c)}}return Ps(e)}var ys={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2unorm-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Ps(e){var t=ys[e];if(!t)throw new Error("Unknown format ".concat(e));return{format:t.format||"",components:t.components||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}function Fs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Bs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function Bs(e,t){if(e){if(typeof e=="string")return Ba(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ba(e,t)}}function Ba(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Vr(e,t,r){var n=t.split(/\r?\n/),a="",o=Fs(e),u;try{for(o.s();!(u=o.n()).done;){var f=u.value;a+=Ms(f,n,f.lineNum,r)}}catch(_){o.e(_)}finally{o.f()}return a}function Ms(e,t,r,n){if(n!=null&&n.showSourceCode){var a=e.linePos>0?"".concat(" ".repeat(e.linePos+5),`^^^
|
|
11
11
|
`):"",o=Ds(t,r);return"".concat(o).concat(a).concat(e.type.toUpperCase(),": ").concat(e.message,`
|
|
12
12
|
|
|
@@ -24,9 +24,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24
24
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function mf(e,t){if(e){if(typeof e=="string")return Pi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pi(e,t)}}function Pi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Fi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Bi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var hf="https://unpkg.com/webgl-debug@2.0.1/index.js";function Mi(e){return e.luma=e.luma||{},e.luma}function Di(){return mn.apply(this,arguments)}function mn(){return mn=ue(pn.default.mark(function e(){return pn.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!($()&&!globalThis.WebGLDebugUtils)){r.next=5;break}return globalThis.global=globalThis.global||globalThis,globalThis.global.module={},r.next=5,Ft(hf);case 5:case"end":return r.stop()}},e)})),mn.apply(this,arguments)}function Ui(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?gf(e,t):Sf(e):null}function Sf(e){var t=Mi(e);return t.realContext?t.realContext:e}function gf(e,t){if(!globalThis.WebGLDebugUtils)return y.warn("webgl-debug not loaded")(),e;var r=Mi(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init(Bi(Bi({},i),e));var n=globalThis.WebGLDebugUtils.makeDebugContext(e,vf.bind(null,t),Of.bind(null,t));for(var a in i)!(a in n)&&typeof i[a]=="number"&&(n[a]=i[a]);var o=F(function f(){P(this,f)});Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);var u=Object.create(o);return r.realContext=e,r.debugContext=u,u.debug=!0,u}function An(e,t){t=Array.from(t).map(function(n){return n===void 0?"undefined":n});var r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r="".concat(r.slice(0,100)).concat(r.length>100?"...":""),"gl.".concat(e,"(").concat(r,")")}function vf(e,t,r,n){n=Array.from(n).map(function(_){return _===void 0?"undefined":_});var a=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),u=e.webgl2?"gl2":"gl1",f="".concat(a," in ").concat(u,".").concat(r,"(").concat(o,")");y.error(f)();debugger;if(e.throwOnError)throw new Error(f)}function Of(e,t,r){var n="";if(y.level>=1&&(n=An(t,r),y.log(1,n)()),e.break&&e.break.length>0){n=n||An(t,r);var a=e.break.every(function(_){return n.indexOf(_)!==-1});if(a)debugger}var o=pf(r),u;try{for(o.s();!(u=o.n()).done;){var f=u.value;if(f===void 0){if(n=n||An(t,r),e.throwOnError)throw new Error("Undefined argument: ".concat(n));y.error("Undefined argument: ".concat(n))();debugger}}}catch(_){o.e(_)}finally{o.f()}}function hn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function mt(e,t,r){return hn()?mt=Reflect.construct.bind():mt=function(a,o,u){var f=[null];f.push.apply(f,o);var _=Function.bind.apply(a,f),c=new _;return u&&je(c,u.prototype),c},mt.apply(null,arguments)}var bf="Failed to deduce GL constant from typed array";function ht(e){var t=ArrayBuffer.isView(e)?e.constructor:e;switch(t){case Float32Array:return i.FLOAT;case Uint16Array:return i.UNSIGNED_SHORT;case Uint32Array:return i.UNSIGNED_INT;case Uint8Array:return i.UNSIGNED_BYTE;case Uint8ClampedArray:return i.UNSIGNED_BYTE;case Int8Array:return i.BYTE;case Int16Array:return i.SHORT;case Int32Array:return i.INT;default:throw new Error(bf)}}function We(e,t){var r=t||{},n=r.clamped,a=n===void 0?!0:n;switch(e){case i.FLOAT:return Float32Array;case i.UNSIGNED_SHORT:case i.UNSIGNED_SHORT_5_6_5:case i.UNSIGNED_SHORT_4_4_4_4:case i.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;case i.UNSIGNED_INT:return Uint32Array;case i.UNSIGNED_BYTE:return a?Uint8ClampedArray:Uint8Array;case i.BYTE:return Int8Array;case i.SHORT:return Int16Array;case i.INT:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Nf={offset:0,stride:0,type:i.FLOAT,size:1,divisor:0,normalized:!1,integer:!1},Cf={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},ge=function(){function e(){var t=this;P(this,e),s(this,"offset",void 0),s(this,"stride",void 0),s(this,"type",void 0),s(this,"size",void 0),s(this,"divisor",void 0),s(this,"normalized",void 0),s(this,"integer",void 0),s(this,"buffer",void 0),s(this,"index",void 0);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];n.forEach(function(o){return t._assign(o)}),Object.freeze(this)}return F(e,[{key:"toString",value:function(){return JSON.stringify(this)}},{key:"BYTES_PER_ELEMENT",get:function(){return e.getBytesPerElement(this)}},{key:"BYTES_PER_VERTEX",get:function(){return e.getBytesPerVertex(this)}},{key:"_assign",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return r=Ze("Accessor",r,Cf),r.type!==void 0&&(this.type=r.type,(r.type===i.INT||r.type===i.UNSIGNED_INT)&&(this.integer=!0)),r.size!==void 0&&(this.size=r.size),r.offset!==void 0&&(this.offset=r.offset),r.stride!==void 0&&(this.stride=r.stride),r.normalize!==void 0&&(this.normalized=r.normalize),r.normalized!==void 0&&(this.normalized=r.normalized),r.integer!==void 0&&(this.integer=r.integer),r.divisor!==void 0&&(this.divisor=r.divisor),r.buffer!==void 0&&(this.buffer=r.buffer),r.index!==void 0&&(typeof r.index=="boolean"?this.index=r.index?1:0:this.index=r.index),r.instanced!==void 0&&(this.divisor=r.instanced?1:0),r.isInstanced!==void 0&&(this.divisor=r.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}}],[{key:"getBytesPerElement",value:function(r){var n=We(r.type||i.FLOAT);return n.BYTES_PER_ELEMENT}},{key:"getBytesPerVertex",value:function(r){B(r.size);var n=We(r.type||i.FLOAT);return n.BYTES_PER_ELEMENT*r.size}},{key:"resolve",value:function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return mt(e,[Nf].concat(n))}}]),e}();function If(e){var t=yf();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function yf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function xi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Pf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var wi=10,Xi={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},Li={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:Xi},Ff={removedProps:Xi};function Bf(e){if(ArrayBuffer.isView(e))return{data:e};if(typeof e=="number")return{byteLength:e};e=Ze("Buffer",e,Li);var t=Pf({},e);return t}var St=function(e){x(r,e);var t=If(r);function r(n){var a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(P(this,r),a=t.call(this,fe.attach(n),Bf(o)),s(d(a),"usage",void 0),s(d(a),"accessor",void 0),a.setAccessor(Object.assign({},o,o.accessor)),a.props.data){var u=ht(a.props.data);B(u),a.setAccessor(new ge(a.accessor,{type:u}))}return Object.seal(d(a)),a}return F(r,[{key:"getElementCount",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/ge.getBytesPerElement(a))}},{key:"getVertexCount",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/ge.getBytesPerVertex(a))}},{key:"initialize",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(a)&&(a={data:a}),Number.isFinite(a)&&(a={byteLength:a}),a=Ze("Buffer",a,Li),this.glUsage=a.glUsage||i.STATIC_DRAW,this.debugData=null,this.setAccessor(Object.assign({},a,a.accessor)),a.data?this._setData(a.data,a.byteOffset,a.byteLength):this._setByteLength(a.byteLength||0),this}},{key:"setProps",value:function(a){return a=Ze("Buffer",a,Ff),"accessor"in a&&this.setAccessor(a.accessor),this}},{key:"setAccessor",value:function(a){return a=Object.assign({},a),delete a.buffer,this.accessor=new ge(a),this}},{key:"reallocate",value:function(a){return a>this.byteLength?(this._setByteLength(a),!0):(this.bytesUsed=a,!1)}},{key:"setData",value:function(a){return this.initialize(a)}},{key:"subData",value:function(a){ArrayBuffer.isView(a)&&(a={data:a});var o=a,u=o.data,f=o.offset,_=f===void 0?0:f,c=o.srcOffset,E=c===void 0?0:c,l=a.byteLength||a.length;B(u);var R=this.gl.webgl2?i.COPY_WRITE_BUFFER:this.glTarget;return this.gl.bindBuffer(R,this.handle),E!==0||l!==void 0?(ct(this.gl),this.gl.bufferSubData(this.glTarget,_,u,E,l)):this.gl.bufferSubData(R,_,u),this.gl.bindBuffer(R,null),this.debugData=null,this._inferType(u),this}},{key:"copyData",value:function(a){var o=a.sourceBuffer,u=a.readOffset,f=u===void 0?0:u,_=a.writeOffset,c=_===void 0?0:_,E=a.size,l=this.gl,R=this.gl2;return ct(l),l.bindBuffer(i.COPY_READ_BUFFER,o.handle),l.bindBuffer(i.COPY_WRITE_BUFFER,this.handle),R?.copyBufferSubData(i.COPY_READ_BUFFER,i.COPY_WRITE_BUFFER,f,c,E),l.bindBuffer(i.COPY_READ_BUFFER,null),l.bindBuffer(i.COPY_WRITE_BUFFER,null),this.debugData=null,this}},{key:"getData",value:function(a){var o,u=a||{},f=u.dstData,_=f===void 0?null:f,c=u.length,E=c===void 0?0:c,l=a||{},R=l.srcByteOffset,T=R===void 0?0:R,A=l.dstOffset,h=A===void 0?0:A;ct(this.gl);var v=We(this.accessor.type||i.FLOAT,{clamped:!1}),S=this._getAvailableElementCount(T),I=h,C,D;_?(D=_.length,C=D-I):(C=Math.min(S,E||S),D=I+C);var L=Math.min(S,C);return E=E||L,B(E<=L),_=_||new v(D),this.gl.bindBuffer(i.COPY_READ_BUFFER,this.handle),(o=this.gl2)===null||o===void 0||o.getBufferSubData(i.COPY_READ_BUFFER,T,_,h,E),this.gl.bindBuffer(i.COPY_READ_BUFFER,null),_}},{key:"bind",value:function(a){var o=a||{},u=o.glTarget,f=u===void 0?this.glTarget:u,_=o.index,c=_===void 0?this.accessor&&this.accessor.index:_,E=o.offset,l=E===void 0?0:E,R=o.size;if(f===i.UNIFORM_BUFFER||f===i.TRANSFORM_FEEDBACK_BUFFER)if(R!==void 0){var T;(T=this.gl2)===null||T===void 0||T.bindBufferRange(f,c,this.handle,l,R)}else{var A;B(l===0),(A=this.gl2)===null||A===void 0||A.bindBufferBase(f,c,this.handle)}else this.gl.bindBuffer(f,this.handle);return this}},{key:"unbind",value:function(a){var o=a||{},u=o.glTarget,f=u===void 0?this.glTarget:u,_=o.index,c=_===void 0?this.accessor&&this.accessor.index:_,E=f===i.UNIFORM_BUFFER||f===i.TRANSFORM_FEEDBACK_BUFFER;if(E){var l;(l=this.gl2)===null||l===void 0||l.bindBufferBase(f,c,null)}else this.gl.bindBuffer(f,null);return this}},{key:"getDebugData",value:function(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(wi,this.byteLength)}),{data:this.debugData,changed:!0})}},{key:"invalidateDebugData",value:function(){this.debugData=null}},{key:"_setData",value:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:a.byteLength+o;B(ArrayBuffer.isView(a)),this.trackDeallocatedMemory();var f=this._getTarget();this.gl.bindBuffer(f,this.handle),this.gl.bufferData(f,u,this.glUsage),this.gl.bufferSubData(f,o,a),this.gl.bindBuffer(f,null),this.debugData=a.slice(0,wi),this.bytesUsed=u,this.byteLength=u,this.trackAllocatedMemory(u);var _=ht(a);return B(_),this.setAccessor(new ge(this.accessor,{type:_})),this}},{key:"_setByteLength",value:function(a){B(a>=0),this.trackDeallocatedMemory();var o=a;a===0&&(o=new Float32Array(0));var u=this._getTarget();return this.gl.bindBuffer(u,this.handle),this.gl.bufferData(u,o,this.glUsage),this.gl.bindBuffer(u,null),this.debugData=null,this.bytesUsed=a,this.byteLength=a,this.trackAllocatedMemory(a),this}},{key:"_getTarget",value:function(){return this.gl.webgl2?i.COPY_WRITE_BUFFER:this.glTarget}},{key:"_getAvailableElementCount",value:function(a){var o=We(this.accessor.type||i.FLOAT,{clamped:!1}),u=a/o.BYTES_PER_ELEMENT;return this.getElementCount()-u}},{key:"_inferType",value:function(a){this.accessor.type||this.setAccessor(new ge(this.accessor,{type:ht(a)}))}},{key:"getParameter",value:function(a){this.gl.bindBuffer(this.glTarget,this.handle);var o=this.gl.getBufferParameter(this.glTarget,a);return this.gl.bindBuffer(this.glTarget,null),o}},{key:"type",get:function(){return this.accessor.type}}]),r}(he);var On=ke(Xe(),1);function Sn(e,t){return{name:Mf(e,t),language:"glsl",version:Df(e)}}function Mf(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=r.exec(e);return n?n[1]:t}function Df(e){var t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){var n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}function gn(e){return Ct(e)||Ut(e)||Ge(e)||It()}function Uf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=xf(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
25
25
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function xf(e,t){if(e){if(typeof e=="string")return Hi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hi(e,t)}}function Hi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var wf=["warning","error","info"];function vn(e){var t=e.split(/\r?\n/),r=[],n=Uf(t),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;if(!(o.length<=1)){var u=o.split(":"),f=gn(u),_=f[0],c=f[1],E=f[2],l=f.slice(3),R=parseInt(E,10);isNaN(R)&&(R=0);var T=parseInt(c,10);isNaN(T)&&(T=0);var A=_.toLowerCase(),h=wf.includes(A)?A:"info";r.push({message:l.join(":").trim(),type:h,lineNum:R,linePos:T})}}}catch(v){n.e(v)}finally{n.f()}return r}function Wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Xf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Lf(e){var t=Hf();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function Hf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Sr=function(e){x(r,e);var t=Lf(r);function r(n,a){var o;switch(P(this,r),o=t.call(this,n,Xf({id:Wf(a)},a)),s(d(o),"device",void 0),s(d(o),"handle",void 0),o.device=n,o.props.stage){case"vertex":o.handle=o.props.handle||o.device.gl.createShader(i.VERTEX_SHADER);break;case"fragment":o.handle=o.props.handle||o.device.gl.createShader(i.FRAGMENT_SHADER);break;default:throw new Error(o.props.stage)}return o._compile(o.source),o}return F(r,[{key:"destroy",value:function(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}},{key:"compilationInfo",value:function(){var n=ue(On.default.mark(function o(){var u;return On.default.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return u=this.device.gl.getShaderInfoLog(this.handle),_.abrupt("return",u?vn(u):[]);case 2:case"end":return _.stop()}},o,this)}));function a(){return n.apply(this,arguments)}return a}()},{key:"_compile",value:function(a){var o=function(h){return h.startsWith("#version ")?h:`#version 100
|
|
26
26
|
`.concat(h)};a=o(a);var u=this.device.gl;u.shaderSource(this.handle,a),u.compileShader(this.handle);var f=u.getShaderParameter(this.handle,i.COMPILE_STATUS);if(!f){var _=u.getShaderInfoLog(this.handle),c=_?vn(_):[],E=c.filter(function(A){return A.type==="error"}),l=Vr(E,a),R=Sn(a).name,T="".concat(this.stage," shader ").concat(R);throw y.error("GLSL compilation errors in ".concat(T,`
|
|
27
|
-
`).concat(l))(),new Error("GLSL compilation errors in ".concat(R))}}}]),r}(wr);function Wf(e){return Sn(e.source).name||e.id||Oe("unnamed ".concat(e.stage,"-shader"))}function Vi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Vf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kf(e){var t=jf();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function jf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Kf=256,Yf=1024,zf=16384,bn=6144,gr=function(e){x(r,e);var t=kf(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a),s(d(o),"device",void 0),s(d(o),"glParameters",void 0),o.device=n,o.setParameters(o.props.parameters),o.clear(),o}return F(r,[{key:"end",value:function(){}},{key:"pushDebugGroup",value:function(a){}},{key:"popDebugGroup",value:function(){}},{key:"insertDebugMarker",value:function(a){}},{key:"setParameters",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o={};this.props.framebuffer&&(o.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(o.depthMask=!this.props.depthReadOnly),o.stencilMask=this.props.stencilReadOnly?0:1,o[i.RASTERIZER_DISCARD]=this.props.discard,a.viewport&&(o.viewport=a.viewport,o.depthRange=[a.viewport[4],a.viewport[5]]),o.scissorTest=Boolean(a.scissorRect),a.scissorRect&&(o.scissor=a.scissorRect),a.blendConstant&&(o.blendColor=a.blendConstant),a.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),a[i.STENCIL_REF]=a.stencilReference),this.glParameters=o}},{key:"clear",value:function(){var a=this,o=Vf({},this.glParameters),u=0;this.props.clearColor!==!1&&(u|=zf,o.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(u|=Kf,o.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(u|=Yf,o.clearStencil=this.props.clearStencil),u!==0&&Re(this.device,o,function(){a.device.gl.clear(u)})}},{key:"clearColorBuffer",value:function(){var a=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];Re(this.device.gl2,{framebuffer:this.props.framebuffer},function(){switch(u.constructor){case Int32Array:a.device.gl2.clearBufferiv(bn,o,u);break;case Uint32Array:a.device.gl2.clearBufferuiv(bn,o,u);break;case Float32Array:default:a.device.gl2.clearBufferfv(bn,o,u);break}})}}]),r}(nr);var G;function ki(e){return Gf.includes(e)}var Gf=[i.SAMPLER_2D,i.SAMPLER_CUBE,i.SAMPLER_3D,i.SAMPLER_2D_SHADOW,i.SAMPLER_2D_ARRAY,i.SAMPLER_2D_ARRAY_SHADOW,i.SAMPLER_CUBE_SHADOW,i.INT_SAMPLER_2D,i.INT_SAMPLER_3D,i.INT_SAMPLER_CUBE,i.INT_SAMPLER_2D_ARRAY,i.UNSIGNED_INT_SAMPLER_2D,i.UNSIGNED_INT_SAMPLER_3D,i.UNSIGNED_INT_SAMPLER_CUBE,i.UNSIGNED_INT_SAMPLER_2D_ARRAY],ji=(G={},s(G,i.FLOAT,[i.FLOAT,1,"float","f32","float32"]),s(G,i.FLOAT_VEC2,[i.FLOAT,2,"vec2","vec2<f32>","float32x2"]),s(G,i.FLOAT_VEC3,[i.FLOAT,3,"vec3","vec3<f32>","float32x3"]),s(G,i.FLOAT_VEC4,[i.FLOAT,4,"vec4","vec4<f32>","float32x4"]),s(G,i.INT,[i.INT,1,"int","i32","sint32"]),s(G,i.INT_VEC2,[i.INT,2,"ivec2","vec2<i32>","sint32x2"]),s(G,i.INT_VEC3,[i.INT,3,"ivec3","vec3<i32>","sint32x3"]),s(G,i.INT_VEC4,[i.INT,4,"ivec4","vec4<i32>","sint32x4"]),s(G,i.UNSIGNED_INT,[i.UNSIGNED_INT,1,"uint","u32","uint32"]),s(G,i.UNSIGNED_INT_VEC2,[i.UNSIGNED_INT,2,"uvec2","vec2<u32>","uint32x2"]),s(G,i.UNSIGNED_INT_VEC3,[i.UNSIGNED_INT,3,"uvec3","vec3<u32>","uint32x3"]),s(G,i.UNSIGNED_INT_VEC4,[i.UNSIGNED_INT,4,"uvec4","vec4<u32>","uint32x4"]),s(G,i.BOOL,[i.FLOAT,1,"bool","f32","float32x2"]),s(G,i.BOOL_VEC2,[i.FLOAT,2,"bvec2","vec2<f32>"]),s(G,i.BOOL_VEC3,[i.FLOAT,3,"bvec3","vec3<f32>"]),s(G,i.BOOL_VEC4,[i.FLOAT,4,"bvec4","vec4<f32>"]),s(G,i.FLOAT_MAT2,[i.FLOAT,8,"mat2","mat2x2<f32>"]),s(G,i.FLOAT_MAT2x3,[i.FLOAT,8,"mat2x3","mat2x3<f32>"]),s(G,i.FLOAT_MAT2x4,[i.FLOAT,8,"mat2x4","mat2x4<f32>"]),s(G,i.FLOAT_MAT3x2,[i.FLOAT,12,"mat3x2","mat3x2<f32>"]),s(G,i.FLOAT_MAT3,[i.FLOAT,12,"mat3","mat3x3<f32>"]),s(G,i.FLOAT_MAT3x4,[i.FLOAT,12,"mat3x4","mat3x4<f32>"]),s(G,i.FLOAT_MAT4x2,[i.FLOAT,16,"mat4x2","mat4x2<f32>"]),s(G,i.FLOAT_MAT4x3,[i.FLOAT,16,"mat4x3","mat4x3<f32>"]),s(G,i.FLOAT_MAT4,[i.FLOAT,16,"mat4","mat4x4<f32>"]),G);function Nn(e){var t=ji[e];if(!t)throw new Error("uniform");var r=H(t,4),n=r[0],a=r[1],o=r[3];return{format:o,components:a,glType:n}}function Ki(e){var t=ji[e];if(!t)throw new Error("attribute");var r=H(t,5),n=r[0],a=r[1],o=r[4];return{format:o,components:a,glType:n}}function Yi(e,t){var r=Zf(e);switch(t){case 1:return r;case 2:return"".concat(r,"x2");case 3:return"".concat(r,"x3");case 4:return"".concat(r,"x4");default:throw new Error(String(t))}}function Zf(e){switch(e){case i.INT:return"sint32";case i.UNSIGNED_INT:return"uint32";case i.FLOAT:return"float32";default:throw new Error(String(e))}}var se;function Cn(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=$f(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
28
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function $f(e,t){if(e){if(typeof e=="string")return zi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zi(e,t)}}function zi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Gi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vr(e,t){for(var r={attributes:[],bindings:[]},n=qf(e,t),a=0,o=n;a<o.length;a++){var u=o[a],f=Math.min(u.accessor.size,4),_=Yi(u.accessor.type||i.FLOAT,f);r.attributes.push({name:u.name,location:u.location,format:_,stepMode:u.accessor.divisor===1?"instance":"vertex"})}for(var c=t_(e,t),E=0,l=c;E<l.length;E++){var R=l[E],T=R.uniforms.map(function(K){return{name:K.name,format:K.format,byteOffset:K.byteOffset,byteStride:K.byteStride,arrayLength:K.arrayLength}});r.bindings.push({type:"uniform",name:R.name,location:R.location,visibility:(R.vertex?1:0)&(R.fragment?2:0),minBindingSize:R.byteLength,uniforms:T})}for(var A=e_(e,t),h=0,v=0,S=A;v<S.length;v++){var I=S[v];if(ki(I.type)){var C=n_(I.type),D=C.viewDimension,L=C.sampleType;r.bindings.push({type:"texture",name:I.name,location:h,viewDimension:D,sampleType:L}),I.textureUnit=h,h+=1}}A.length&&(r.uniforms=A);var W=Jf(e,t);return W!=null&&W.length&&(r.varyings=W),r}function Or(e,t){var r=Ve(Ve({},e),{},{attributes:e.attributes.map(function(u){return Ve({},u)})}),n=Cn(t?.attributes||[]),a;try{var o=function(){var f=a.value,_=r.attributes.find(function(c){return c.name===f.name});_?(_.format=f.format||_.format,_.stepMode=f.stepMode||_.stepMode):y.warn("shader layout attribute ".concat(f.name," not present in shader"))};for(n.s();!(a=n.n()).done;)o()}catch(u){n.e(u)}finally{n.f()}return r}function $i(e,t){var r=Ve(Ve({},e),{},{attributes:e.attributes.map(function(c){return Ve({},c)})}),n=Cn(t),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;switch(o.type){case"interleave":var u=Cn(o.attributes),f;try{for(u.s();!(f=u.n()).done;){var _=f.value;Zi(r,_)}}catch(c){u.e(c)}finally{u.f()}break;default:Zi(r,o)}}}catch(c){n.e(c)}finally{n.f()}return r}function Zi(e,t){var r=Qf(e,t.name);r&&t.format&&(r.format=t.format)}function Qf(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||y.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function qf(e,t){for(var r=[],n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),a=0;a<n;a++){var o=e.getActiveAttrib(t,a);if(!o)throw new Error("activeInfo");var u=o.name,f=o.type,_=o.size,c=e.getAttribLocation(t,u);if(c>=0){var E=Ki(f),l=E.glType,R=E.components,T={type:l,size:_*R};/instance/i.test(u)&&(T.divisor=1);var A={location:c,name:u,accessor:new ge(T)};r.push(A)}}return r.sort(function(h,v){return h.location-v.location}),r}function Jf(e,t){if(!V(e))return[];for(var r=e,n=[],a=e.getProgramParameter(t,i.TRANSFORM_FEEDBACK_VARYINGS),o=0;o<a;o++){var u=r.getTransformFeedbackVarying(t,o);if(!u)throw new Error("activeInfo");var f=u.name,_=u.type,c=u.size,E=Nn(_),l=E.glType,R=E.components,T=new ge({type:l,size:c*R}),A={location:o,name:f,accessor:T};n.push(A)}return n.sort(function(h,v){return h.location-v.location}),n}function e_(e,t){for(var r=[],n=e.getProgramParameter(t,i.ACTIVE_UNIFORMS),a=0;a<n;a++){var o=e.getActiveUniform(t,a);if(!o)throw new Error("activeInfo");var u=o.name,f=o.size,_=o.type,c=a_(u),E=c.name,l=c.isArray,R=e.getUniformLocation(t,E),T={location:R,name:E,size:f,type:_,isArray:l};if(r.push(T),T.size>1)for(var A=0;A<T.size;A++){var h="".concat(E,"[").concat(A,"]");R=e.getUniformLocation(t,h);var v=Ve(Ve({},T),{},{name:h,location:R});r.push(v)}}return r}function t_(e,t){if(!V(e))return[];for(var r=e,n=function(v,S){return r.getActiveUniformBlockParameter(t,v,S)},a=[],o=r.getProgramParameter(t,i.ACTIVE_UNIFORM_BLOCKS),u=0;u<o;u++){for(var f={name:r.getActiveUniformBlockName(t,u)||"",location:n(u,i.UNIFORM_BLOCK_BINDING),byteLength:n(u,i.UNIFORM_BLOCK_DATA_SIZE),vertex:n(u,i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),fragment:n(u,i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),uniformCount:n(u,i.UNIFORM_BLOCK_ACTIVE_UNIFORMS),uniforms:[]},_=n(u,i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)||[],c=r.getActiveUniforms(t,_,i.UNIFORM_TYPE),E=r.getActiveUniforms(t,_,i.UNIFORM_SIZE),l=r.getActiveUniforms(t,_,i.UNIFORM_OFFSET),R=r.getActiveUniforms(t,_,i.UNIFORM_ARRAY_STRIDE),T=0;T<f.uniformCount;++T){var A=r.getActiveUniform(t,_[T]);if(!A)throw new Error("activeInfo");f.uniforms.push({name:A.name,format:Nn(c[T]).format,type:c[T],arrayLength:E[T],byteOffset:l[T],byteStride:R[T]})}a.push(f)}return a.sort(function(h,v){return h.location-v.location}),a}var r_=(se={},s(se,i.SAMPLER_2D,["2d","float"]),s(se,i.SAMPLER_CUBE,["cube","float"]),s(se,i.SAMPLER_3D,["3d","float"]),s(se,i.SAMPLER_2D_SHADOW,["3d","depth"]),s(se,i.SAMPLER_2D_ARRAY,["2d-array","float"]),s(se,i.SAMPLER_2D_ARRAY_SHADOW,["2d-array","depth"]),s(se,i.SAMPLER_CUBE_SHADOW,["cube","float"]),s(se,i.INT_SAMPLER_2D,["2d","sint"]),s(se,i.INT_SAMPLER_3D,["3d","sint"]),s(se,i.INT_SAMPLER_CUBE,["cube","sint"]),s(se,i.INT_SAMPLER_2D_ARRAY,["2d-array","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_2D,["2d","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_3D,["3d","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_CUBE,["cube","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_2D_ARRAY,["2d-array","uint"]),se);function n_(e){var t=r_[e];if(!t)throw new Error("sampler");var r=H(t,2),n=r[0],a=r[1];return{viewDimension:n,sampleType:a}}function a_(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};var t=/([^[]*)(\[[0-9]+\])?/,r=t.exec(e);if(!r||r.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Qi(e,t,r,n){var a=e;if(typeof n=="number")switch(r){case i.SAMPLER_2D:case i.SAMPLER_CUBE:case i.SAMPLER_3D:case i.SAMPLER_2D_SHADOW:case i.SAMPLER_2D_ARRAY:case i.SAMPLER_2D_ARRAY_SHADOW:case i.SAMPLER_CUBE_SHADOW:case i.INT_SAMPLER_2D:case i.INT_SAMPLER_3D:case i.INT_SAMPLER_CUBE:case i.INT_SAMPLER_2D_ARRAY:case i.UNSIGNED_INT_SAMPLER_2D:case i.UNSIGNED_INT_SAMPLER_3D:case i.UNSIGNED_INT_SAMPLER_CUBE:case i.UNSIGNED_INT_SAMPLER_2D_ARRAY:return e.uniform1i(t,n)}n===!0&&(n=1),n===!1&&(n=1);var o=typeof n=="number"?[n]:n;switch(r){case i.FLOAT:return e.uniform1fv(t,o);case i.FLOAT_VEC2:return e.uniform2fv(t,o);case i.FLOAT_VEC3:return e.uniform3fv(t,o);case i.FLOAT_VEC4:return e.uniform4fv(t,o);case i.INT:return e.uniform1iv(t,o);case i.INT_VEC2:return e.uniform2iv(t,o);case i.INT_VEC3:return e.uniform3iv(t,o);case i.INT_VEC4:return e.uniform4iv(t,o);case i.BOOL:return e.uniform1iv(t,o);case i.BOOL_VEC2:return e.uniform2iv(t,o);case i.BOOL_VEC3:return e.uniform3iv(t,o);case i.BOOL_VEC4:return e.uniform4iv(t,o);case i.UNSIGNED_INT:return a.uniform1uiv(t,o,1);case i.UNSIGNED_INT_VEC2:return a.uniform2uiv(t,o,2);case i.UNSIGNED_INT_VEC3:return a.uniform3uiv(t,o,3);case i.UNSIGNED_INT_VEC4:return a.uniform4uiv(t,o,4);case i.FLOAT_MAT2:return e.uniformMatrix2fv(t,!1,o);case i.FLOAT_MAT3:return e.uniformMatrix3fv(t,!1,o);case i.FLOAT_MAT4:return e.uniformMatrix4fv(t,!1,o);case i.FLOAT_MAT2x3:return a.uniformMatrix2x3fv(t,!1,o);case i.FLOAT_MAT2x4:return a.uniformMatrix2x4fv(t,!1,o);case i.FLOAT_MAT3x2:return a.uniformMatrix3x2fv(t,!1,o);case i.FLOAT_MAT3x4:return a.uniformMatrix3x4fv(t,!1,o);case i.FLOAT_MAT4x2:return a.uniformMatrix4x2fv(t,!1,o);case i.FLOAT_MAT4x3:return a.uniformMatrix4x3fv(t,!1,o)}throw new Error("Illegal uniform")}var eo;function qi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ji(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function i_(e){var t=o_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function o_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var s_="elements must be GL.ELEMENT_ARRAY_BUFFER";eo=Symbol.toStringTag;var br=function(e){x(r,e);var t=i_(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,Ji(Ji({},Q.defaultProps),{},{constantAttributeZero:!1})),s(d(o),"buffer",null),s(d(o),"bufferValue",null),Object.seal(d(o)),o}return F(r,[{key:eo,get:function(){return"BaseVertexArrayObject"}},{key:"destroy",value:function(){if(He(b(r.prototype),"destroy",this).call(this),this.buffer){var a;(a=this.buffer)===null||a===void 0||a.destroy()}}},{key:"_createHandle",value:function(){return this.gl2.createVertexArray()}},{key:"_deleteHandle",value:function(){return this.gl2.deleteVertexArray(this.handle),[this.elements]}},{key:"_bindHandle",value:function(a){this.gl2.bindVertexArray(a)}},{key:"enable",value:function(a){var o=this,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,f=this.device.isWebGL2||Ot()==="Chrome",_=f||a!==0;(u||_)&&(a=Number(a),this.bind(function(){return u?o.gl.enableVertexAttribArray(a):o.gl.disableVertexAttribArray(a)}))}},{key:"setElementBuffer",value:function(){var a=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};B(!o||o.glTarget===i.ELEMENT_ARRAY_BUFFER,s_),this.bind(function(){a.gl.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o?o.handle:null)})}},{key:"setBuffer",value:function(a,o,u){var f=this;if(o.glTarget===i.ELEMENT_ARRAY_BUFFER){this.setElementBuffer(o,u);return}var _=u.size,c=u.type,E=u.stride,l=u.offset,R=u.normalized,T=u.integer,A=u.divisor,h=this.gl,v=this.gl2;a=Number(a),this.bind(function(){h.bindBuffer(h.ARRAY_BUFFER,o.handle),T?(f.device.assertWebGL2(),v.vertexAttribIPointer(a,_,c,E,l)):h.vertexAttribPointer(a,_,c,R,E,l),h.enableVertexAttribArray(a),v.vertexAttribDivisor(a,A||0)})}},{key:"setConstant",value:function(a,o){switch(o.constructor){case Float32Array:u_(this.device,a,o);break;case Int32Array:f_(this.device,a,o);break;case Uint32Array:__(this.device,a,o);break;default:B(!1)}}},{key:"getConstantBuffer",value:function(a,o){var u=c_(o),f=u.byteLength*a,_=u.length*a,c=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:f}),c=c||this.buffer.reallocate(f),c=c||!E_(u,this.bufferValue),c){var E=zr(o.constructor,_);Gr({target:E,source:u,start:0,count:_}),this.buffer.subData(E),this.bufferValue=o}return this.buffer}}],[{key:"isConstantAttributeZeroSupported",value:function(a){return a.info.type==="webgl2"||Ot()==="Chrome"}}]),r}(rt);function u_(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:B(!1)}}function f_(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function __(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function c_(e){return Array.isArray(e)?new Float32Array(e):e}function E_(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function to(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
29
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function l_(e,t){if(e){if(typeof e=="string")return ro(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ro(e,t)}}function ro(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R_(e){var t=d_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function d_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var no=4,Nr=function(e){x(r,e);var t=R_(r);function r(n,a){var o;P(this,r),o=t.call(this,n,a),s(d(o),"device",void 0),s(d(o),"handle",void 0),s(d(o),"vs",void 0),s(d(o),"fs",void 0),s(d(o),"layout",void 0),s(d(o),"introspectedLayout",void 0),s(d(o),"bufferMap",void 0),s(d(o),"uniforms",{}),s(d(o),"bindings",{}),s(d(o),"constantAttributes",{}),s(d(o),"_indexBuffer",void 0),s(d(o),"varyings",null),s(d(o),"vertexArrayObject",void 0),s(d(o),"_textureUniforms",{}),s(d(o),"_textureIndexCounter",0),s(d(o),"_uniformCount",0),s(d(o),"_uniformSetters",{}),o.device=n,o.handle=o.props.handle||o.device.gl.createProgram(),o.device.setSpectorMetadata(o.handle,{id:o.props.id}),o.vs=a.vs,o.fs=a.fs;var u=a.varyings,f=a.bufferMode,_=f===void 0?i.SEPARATE_ATTRIBS:f;if(u&&u.length>0){var c;o.device.assertWebGL2(),o.varyings=u,(c=o.device.gl2)===null||c===void 0||c.transformFeedbackVaryings(o.handle,u,_)}return o._compileAndLink(),o.introspectedLayout=vr(o.device.gl,o.handle),o.layout=Or(o.introspectedLayout,a.layout),o.bufferMap=a.bufferMap||[],o.layout=$i(o.layout,o.bufferMap),o.vertexArrayObject=new br(o.device),o}return F(r,[{key:"destroy",value:function(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}},{key:"setIndexBuffer",value:function(a){var o=a;this.vertexArrayObject.setElementBuffer(o),this._indexBuffer=o}},{key:"setAttributes",value:function(a){for(var o=0,u=Object.entries(a);o<u.length;o++){var f=H(u[o],2),_=f[0],c=f[1],E=c,l=In(this.layout,_);if(!l){y.warn('Ignoring buffer supplied for unknown attribute "'.concat(_,'" in pipeline "').concat(this.id,'" (buffer "').concat(c.id,'")'))();continue}var R=Wr(l.format),T=R.type,A=R.components,h=R.byteLength,v=R.normalized,S=
|
|
27
|
+
`).concat(l))(),new Error("GLSL compilation errors in ".concat(R))}}}]),r}(wr);function Wf(e){return Sn(e.source).name||e.id||Oe("unnamed ".concat(e.stage,"-shader"))}function Vi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Vf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kf(e){var t=jf();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function jf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Kf=256,Yf=1024,zf=16384,bn=6144,gr=function(e){x(r,e);var t=kf(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a),s(d(o),"device",void 0),s(d(o),"glParameters",void 0),o.device=n,o.setParameters(o.props.parameters),o.clear(),o}return F(r,[{key:"end",value:function(){}},{key:"pushDebugGroup",value:function(a){}},{key:"popDebugGroup",value:function(){}},{key:"insertDebugMarker",value:function(a){}},{key:"setParameters",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o={};this.props.framebuffer&&(o.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(o.depthMask=!this.props.depthReadOnly),o.stencilMask=this.props.stencilReadOnly?0:1,o[i.RASTERIZER_DISCARD]=this.props.discard,a.viewport&&(a.viewport.length>=6?(o.viewport=a.viewport.slice(0,4),o.depthRange=[a.viewport[4],a.viewport[5]]):o.viewport=a.viewport),o.scissorTest=Boolean(a.scissorRect),a.scissorRect&&(o.scissor=a.scissorRect),a.blendConstant&&(o.blendColor=a.blendConstant),a.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),a[i.STENCIL_REF]=a.stencilReference),this.glParameters=o}},{key:"clear",value:function(){var a=this,o=Vf({},this.glParameters),u=0;this.props.clearColor!==!1&&(u|=zf,o.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(u|=Kf,o.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(u|=Yf,o.clearStencil=this.props.clearStencil),u!==0&&Re(this.device,o,function(){a.device.gl.clear(u)})}},{key:"clearColorBuffer",value:function(){var a=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];Re(this.device.gl2,{framebuffer:this.props.framebuffer},function(){switch(u.constructor){case Int32Array:a.device.gl2.clearBufferiv(bn,o,u);break;case Uint32Array:a.device.gl2.clearBufferuiv(bn,o,u);break;case Float32Array:default:a.device.gl2.clearBufferfv(bn,o,u);break}})}}]),r}(nr);var G;function ki(e){return Gf.includes(e)}var Gf=[i.SAMPLER_2D,i.SAMPLER_CUBE,i.SAMPLER_3D,i.SAMPLER_2D_SHADOW,i.SAMPLER_2D_ARRAY,i.SAMPLER_2D_ARRAY_SHADOW,i.SAMPLER_CUBE_SHADOW,i.INT_SAMPLER_2D,i.INT_SAMPLER_3D,i.INT_SAMPLER_CUBE,i.INT_SAMPLER_2D_ARRAY,i.UNSIGNED_INT_SAMPLER_2D,i.UNSIGNED_INT_SAMPLER_3D,i.UNSIGNED_INT_SAMPLER_CUBE,i.UNSIGNED_INT_SAMPLER_2D_ARRAY],ji=(G={},s(G,i.FLOAT,[i.FLOAT,1,"float","f32","float32"]),s(G,i.FLOAT_VEC2,[i.FLOAT,2,"vec2","vec2<f32>","float32x2"]),s(G,i.FLOAT_VEC3,[i.FLOAT,3,"vec3","vec3<f32>","float32x3"]),s(G,i.FLOAT_VEC4,[i.FLOAT,4,"vec4","vec4<f32>","float32x4"]),s(G,i.INT,[i.INT,1,"int","i32","sint32"]),s(G,i.INT_VEC2,[i.INT,2,"ivec2","vec2<i32>","sint32x2"]),s(G,i.INT_VEC3,[i.INT,3,"ivec3","vec3<i32>","sint32x3"]),s(G,i.INT_VEC4,[i.INT,4,"ivec4","vec4<i32>","sint32x4"]),s(G,i.UNSIGNED_INT,[i.UNSIGNED_INT,1,"uint","u32","uint32"]),s(G,i.UNSIGNED_INT_VEC2,[i.UNSIGNED_INT,2,"uvec2","vec2<u32>","uint32x2"]),s(G,i.UNSIGNED_INT_VEC3,[i.UNSIGNED_INT,3,"uvec3","vec3<u32>","uint32x3"]),s(G,i.UNSIGNED_INT_VEC4,[i.UNSIGNED_INT,4,"uvec4","vec4<u32>","uint32x4"]),s(G,i.BOOL,[i.FLOAT,1,"bool","f32","float32x2"]),s(G,i.BOOL_VEC2,[i.FLOAT,2,"bvec2","vec2<f32>"]),s(G,i.BOOL_VEC3,[i.FLOAT,3,"bvec3","vec3<f32>"]),s(G,i.BOOL_VEC4,[i.FLOAT,4,"bvec4","vec4<f32>"]),s(G,i.FLOAT_MAT2,[i.FLOAT,8,"mat2","mat2x2<f32>"]),s(G,i.FLOAT_MAT2x3,[i.FLOAT,8,"mat2x3","mat2x3<f32>"]),s(G,i.FLOAT_MAT2x4,[i.FLOAT,8,"mat2x4","mat2x4<f32>"]),s(G,i.FLOAT_MAT3x2,[i.FLOAT,12,"mat3x2","mat3x2<f32>"]),s(G,i.FLOAT_MAT3,[i.FLOAT,12,"mat3","mat3x3<f32>"]),s(G,i.FLOAT_MAT3x4,[i.FLOAT,12,"mat3x4","mat3x4<f32>"]),s(G,i.FLOAT_MAT4x2,[i.FLOAT,16,"mat4x2","mat4x2<f32>"]),s(G,i.FLOAT_MAT4x3,[i.FLOAT,16,"mat4x3","mat4x3<f32>"]),s(G,i.FLOAT_MAT4,[i.FLOAT,16,"mat4","mat4x4<f32>"]),G);function Nn(e){var t=ji[e];if(!t)throw new Error("uniform");var r=H(t,4),n=r[0],a=r[1],o=r[3];return{format:o,components:a,glType:n}}function Ki(e){var t=ji[e];if(!t)throw new Error("attribute");var r=H(t,5),n=r[0],a=r[1],o=r[4];return{format:o,components:a,glType:n}}function Yi(e,t){var r=Zf(e);switch(t){case 1:return r;case 2:return"".concat(r,"x2");case 3:return"".concat(r,"x3");case 4:return"".concat(r,"x4");default:throw new Error(String(t))}}function Zf(e){switch(e){case i.INT:return"sint32";case i.UNSIGNED_INT:return"uint32";case i.FLOAT:return"float32";default:throw new Error(String(e))}}var se;function Cn(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=$f(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
28
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function $f(e,t){if(e){if(typeof e=="string")return zi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zi(e,t)}}function zi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Gi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vr(e,t){for(var r={attributes:[],bindings:[]},n=qf(e,t),a=0,o=n;a<o.length;a++){var u=o[a],f=Math.min(u.accessor.size,4),_=Yi(u.accessor.type||i.FLOAT,f);r.attributes.push({name:u.name,location:u.location,format:_,stepMode:u.accessor.divisor===1?"instance":"vertex"})}for(var c=t_(e,t),E=0,l=c;E<l.length;E++){var R=l[E],T=R.uniforms.map(function(K){return{name:K.name,format:K.format,byteOffset:K.byteOffset,byteStride:K.byteStride,arrayLength:K.arrayLength}});r.bindings.push({type:"uniform",name:R.name,location:R.location,visibility:(R.vertex?1:0)&(R.fragment?2:0),minBindingSize:R.byteLength,uniforms:T})}for(var A=e_(e,t),h=0,v=0,S=A;v<S.length;v++){var I=S[v];if(ki(I.type)){var C=n_(I.type),D=C.viewDimension,L=C.sampleType;r.bindings.push({type:"texture",name:I.name,location:h,viewDimension:D,sampleType:L}),I.textureUnit=h,h+=1}}A.length&&(r.uniforms=A);var W=Jf(e,t);return W!=null&&W.length&&(r.varyings=W),r}function Or(e,t){var r=Ve(Ve({},e),{},{attributes:e.attributes.map(function(u){return Ve({},u)})}),n=Cn(t?.attributes||[]),a;try{var o=function(){var f=a.value,_=r.attributes.find(function(c){return c.name===f.name});_?(_.format=f.format||_.format,_.stepMode=f.stepMode||_.stepMode):y.warn("shader layout attribute ".concat(f.name," not present in shader"))};for(n.s();!(a=n.n()).done;)o()}catch(u){n.e(u)}finally{n.f()}return r}function $i(e,t){var r=Ve(Ve({},e),{},{attributes:e.attributes.map(function(c){return Ve({},c)})}),n=Cn(t),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;switch(o.type){case"interleave":var u=Cn(o.attributes),f;try{for(u.s();!(f=u.n()).done;){var _=f.value;Zi(r,_)}}catch(c){u.e(c)}finally{u.f()}break;default:Zi(r,o)}}}catch(c){n.e(c)}finally{n.f()}return r}function Zi(e,t){var r=Qf(e,t.name);r&&t.format&&(r.format=t.format)}function Qf(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||y.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function qf(e,t){for(var r=[],n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),a=0;a<n;a++){var o=e.getActiveAttrib(t,a);if(!o)throw new Error("activeInfo");var u=o.name,f=o.type,_=o.size,c=e.getAttribLocation(t,u);if(c>=0){var E=Ki(f),l=E.glType,R=E.components,T={type:l,size:_*R};/instance/i.test(u)&&(T.divisor=1);var A={location:c,name:u,accessor:new ge(T)};r.push(A)}}return r.sort(function(h,v){return h.location-v.location}),r}function Jf(e,t){if(!V(e))return[];for(var r=e,n=[],a=e.getProgramParameter(t,i.TRANSFORM_FEEDBACK_VARYINGS),o=0;o<a;o++){var u=r.getTransformFeedbackVarying(t,o);if(!u)throw new Error("activeInfo");var f=u.name,_=u.type,c=u.size,E=Nn(_),l=E.glType,R=E.components,T=new ge({type:l,size:c*R}),A={location:o,name:f,accessor:T};n.push(A)}return n.sort(function(h,v){return h.location-v.location}),n}function e_(e,t){for(var r=[],n=e.getProgramParameter(t,i.ACTIVE_UNIFORMS),a=0;a<n;a++){var o=e.getActiveUniform(t,a);if(!o)throw new Error("activeInfo");var u=o.name,f=o.size,_=o.type,c=a_(u),E=c.name,l=c.isArray,R=e.getUniformLocation(t,E),T={location:R,name:E,size:f,type:_,isArray:l};if(r.push(T),T.size>1)for(var A=0;A<T.size;A++){var h="".concat(E,"[").concat(A,"]");R=e.getUniformLocation(t,h);var v=Ve(Ve({},T),{},{name:h,location:R});r.push(v)}}return r}function t_(e,t){if(!V(e))return[];for(var r=e,n=function(v,S){return r.getActiveUniformBlockParameter(t,v,S)},a=[],o=r.getProgramParameter(t,i.ACTIVE_UNIFORM_BLOCKS),u=0;u<o;u++){for(var f={name:r.getActiveUniformBlockName(t,u)||"",location:n(u,i.UNIFORM_BLOCK_BINDING),byteLength:n(u,i.UNIFORM_BLOCK_DATA_SIZE),vertex:n(u,i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),fragment:n(u,i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),uniformCount:n(u,i.UNIFORM_BLOCK_ACTIVE_UNIFORMS),uniforms:[]},_=n(u,i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)||[],c=r.getActiveUniforms(t,_,i.UNIFORM_TYPE),E=r.getActiveUniforms(t,_,i.UNIFORM_SIZE),l=r.getActiveUniforms(t,_,i.UNIFORM_OFFSET),R=r.getActiveUniforms(t,_,i.UNIFORM_ARRAY_STRIDE),T=0;T<f.uniformCount;++T){var A=r.getActiveUniform(t,_[T]);if(!A)throw new Error("activeInfo");f.uniforms.push({name:A.name,format:Nn(c[T]).format,type:c[T],arrayLength:E[T],byteOffset:l[T],byteStride:R[T]})}a.push(f)}return a.sort(function(h,v){return h.location-v.location}),a}var r_=(se={},s(se,i.SAMPLER_2D,["2d","float"]),s(se,i.SAMPLER_CUBE,["cube","float"]),s(se,i.SAMPLER_3D,["3d","float"]),s(se,i.SAMPLER_2D_SHADOW,["3d","depth"]),s(se,i.SAMPLER_2D_ARRAY,["2d-array","float"]),s(se,i.SAMPLER_2D_ARRAY_SHADOW,["2d-array","depth"]),s(se,i.SAMPLER_CUBE_SHADOW,["cube","float"]),s(se,i.INT_SAMPLER_2D,["2d","sint"]),s(se,i.INT_SAMPLER_3D,["3d","sint"]),s(se,i.INT_SAMPLER_CUBE,["cube","sint"]),s(se,i.INT_SAMPLER_2D_ARRAY,["2d-array","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_2D,["2d","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_3D,["3d","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_CUBE,["cube","uint"]),s(se,i.UNSIGNED_INT_SAMPLER_2D_ARRAY,["2d-array","uint"]),se);function n_(e){var t=r_[e];if(!t)throw new Error("sampler");var r=H(t,2),n=r[0],a=r[1];return{viewDimension:n,sampleType:a}}function a_(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};var t=/([^[]*)(\[[0-9]+\])?/,r=t.exec(e);if(!r||r.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Qi(e,t,r,n){var a=e;if(typeof n=="number")switch(r){case i.SAMPLER_2D:case i.SAMPLER_CUBE:case i.SAMPLER_3D:case i.SAMPLER_2D_SHADOW:case i.SAMPLER_2D_ARRAY:case i.SAMPLER_2D_ARRAY_SHADOW:case i.SAMPLER_CUBE_SHADOW:case i.INT_SAMPLER_2D:case i.INT_SAMPLER_3D:case i.INT_SAMPLER_CUBE:case i.INT_SAMPLER_2D_ARRAY:case i.UNSIGNED_INT_SAMPLER_2D:case i.UNSIGNED_INT_SAMPLER_3D:case i.UNSIGNED_INT_SAMPLER_CUBE:case i.UNSIGNED_INT_SAMPLER_2D_ARRAY:return e.uniform1i(t,n)}n===!0&&(n=1),n===!1&&(n=0);var o=typeof n=="number"?[n]:n;switch(r){case i.FLOAT:return e.uniform1fv(t,o);case i.FLOAT_VEC2:return e.uniform2fv(t,o);case i.FLOAT_VEC3:return e.uniform3fv(t,o);case i.FLOAT_VEC4:return e.uniform4fv(t,o);case i.INT:return e.uniform1iv(t,o);case i.INT_VEC2:return e.uniform2iv(t,o);case i.INT_VEC3:return e.uniform3iv(t,o);case i.INT_VEC4:return e.uniform4iv(t,o);case i.BOOL:return e.uniform1iv(t,o);case i.BOOL_VEC2:return e.uniform2iv(t,o);case i.BOOL_VEC3:return e.uniform3iv(t,o);case i.BOOL_VEC4:return e.uniform4iv(t,o);case i.UNSIGNED_INT:return a.uniform1uiv(t,o,1);case i.UNSIGNED_INT_VEC2:return a.uniform2uiv(t,o,2);case i.UNSIGNED_INT_VEC3:return a.uniform3uiv(t,o,3);case i.UNSIGNED_INT_VEC4:return a.uniform4uiv(t,o,4);case i.FLOAT_MAT2:return e.uniformMatrix2fv(t,!1,o);case i.FLOAT_MAT3:return e.uniformMatrix3fv(t,!1,o);case i.FLOAT_MAT4:return e.uniformMatrix4fv(t,!1,o);case i.FLOAT_MAT2x3:return a.uniformMatrix2x3fv(t,!1,o);case i.FLOAT_MAT2x4:return a.uniformMatrix2x4fv(t,!1,o);case i.FLOAT_MAT3x2:return a.uniformMatrix3x2fv(t,!1,o);case i.FLOAT_MAT3x4:return a.uniformMatrix3x4fv(t,!1,o);case i.FLOAT_MAT4x2:return a.uniformMatrix4x2fv(t,!1,o);case i.FLOAT_MAT4x3:return a.uniformMatrix4x3fv(t,!1,o)}throw new Error("Illegal uniform")}var eo;function qi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ji(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qi(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function i_(e){var t=o_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function o_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var s_="elements must be GL.ELEMENT_ARRAY_BUFFER";eo=Symbol.toStringTag;var br=function(e){x(r,e);var t=i_(r);function r(n,a){var o;return P(this,r),o=t.call(this,n,a,Ji(Ji({},Q.defaultProps),{},{constantAttributeZero:!1})),s(d(o),"buffer",null),s(d(o),"bufferValue",null),Object.seal(d(o)),o}return F(r,[{key:eo,get:function(){return"BaseVertexArrayObject"}},{key:"destroy",value:function(){if(He(b(r.prototype),"destroy",this).call(this),this.buffer){var a;(a=this.buffer)===null||a===void 0||a.destroy()}}},{key:"_createHandle",value:function(){return this.gl2.createVertexArray()}},{key:"_deleteHandle",value:function(){return this.gl2.deleteVertexArray(this.handle),[this.elements]}},{key:"_bindHandle",value:function(a){this.gl2.bindVertexArray(a)}},{key:"enable",value:function(a){var o=this,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,f=this.device.isWebGL2||Ot()==="Chrome",_=f||a!==0;(u||_)&&(a=Number(a),this.bind(function(){return u?o.gl.enableVertexAttribArray(a):o.gl.disableVertexAttribArray(a)}))}},{key:"setElementBuffer",value:function(){var a=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};B(!o||o.glTarget===i.ELEMENT_ARRAY_BUFFER,s_),this.bind(function(){a.gl.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o?o.handle:null)})}},{key:"setBuffer",value:function(a,o,u){var f=this;if(o.glTarget===i.ELEMENT_ARRAY_BUFFER){this.setElementBuffer(o,u);return}var _=u.size,c=u.type,E=u.stride,l=u.offset,R=u.normalized,T=u.integer,A=u.divisor,h=this.gl,v=this.gl2;a=Number(a),this.bind(function(){h.bindBuffer(h.ARRAY_BUFFER,o.handle),T?(f.device.assertWebGL2(),v.vertexAttribIPointer(a,_,c,E,l)):h.vertexAttribPointer(a,_,c,R,E,l),h.enableVertexAttribArray(a),v.vertexAttribDivisor(a,A||0)})}},{key:"setConstant",value:function(a,o){switch(o.constructor){case Float32Array:u_(this.device,a,o);break;case Int32Array:f_(this.device,a,o);break;case Uint32Array:__(this.device,a,o);break;default:B(!1)}}},{key:"getConstantBuffer",value:function(a,o){var u=c_(o),f=u.byteLength*a,_=u.length*a,c=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:f}),c=c||this.buffer.reallocate(f),c=c||!E_(u,this.bufferValue),c){var E=zr(o.constructor,_);Gr({target:E,source:u,start:0,count:_}),this.buffer.subData(E),this.bufferValue=o}return this.buffer}}],[{key:"isConstantAttributeZeroSupported",value:function(a){return a.info.type==="webgl2"||Ot()==="Chrome"}}]),r}(rt);function u_(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:B(!1)}}function f_(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function __(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function c_(e){return Array.isArray(e)?new Float32Array(e):e}function E_(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function to(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
29
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function l_(e,t){if(e){if(typeof e=="string")return ro(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ro(e,t)}}function ro(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R_(e){var t=d_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function d_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var no=4,Nr=function(e){x(r,e);var t=R_(r);function r(n,a){var o;P(this,r),o=t.call(this,n,a),s(d(o),"device",void 0),s(d(o),"handle",void 0),s(d(o),"vs",void 0),s(d(o),"fs",void 0),s(d(o),"layout",void 0),s(d(o),"introspectedLayout",void 0),s(d(o),"bufferMap",void 0),s(d(o),"uniforms",{}),s(d(o),"bindings",{}),s(d(o),"constantAttributes",{}),s(d(o),"_indexBuffer",void 0),s(d(o),"varyings",null),s(d(o),"vertexArrayObject",void 0),s(d(o),"_textureUniforms",{}),s(d(o),"_textureIndexCounter",0),s(d(o),"_uniformCount",0),s(d(o),"_uniformSetters",{}),o.device=n,o.handle=o.props.handle||o.device.gl.createProgram(),o.device.setSpectorMetadata(o.handle,{id:o.props.id}),o.vs=a.vs,o.fs=a.fs;var u=a.varyings,f=a.bufferMode,_=f===void 0?i.SEPARATE_ATTRIBS:f;if(u&&u.length>0){var c;o.device.assertWebGL2(),o.varyings=u,(c=o.device.gl2)===null||c===void 0||c.transformFeedbackVaryings(o.handle,u,_)}return o._compileAndLink(),o.introspectedLayout=vr(o.device.gl,o.handle),o.layout=Or(o.introspectedLayout,a.layout),o.bufferMap=a.bufferMap||[],o.layout=$i(o.layout,o.bufferMap),o.vertexArrayObject=new br(o.device),o}return F(r,[{key:"destroy",value:function(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}},{key:"setIndexBuffer",value:function(a){var o=a;this.vertexArrayObject.setElementBuffer(o),this._indexBuffer=o}},{key:"setAttributes",value:function(a){for(var o=0,u=Object.entries(a);o<u.length;o++){var f=H(u[o],2),_=f[0],c=f[1],E=c,l=In(this.layout,_);if(!l){y.warn('Ignoring buffer supplied for unknown attribute "'.concat(_,'" in pipeline "').concat(this.id,'" (buffer "').concat(c.id,'")'))();continue}var R=Wr(l.format),T=R.type,A=R.components,h=R.byteLength,v=R.normalized,S=l.stepMode==="instance"?1:0,I=an(T);this.vertexArrayObject.setBuffer(l.location,E,{size:A,type:I,stride:h,offset:0,normalized:v,integer:!1,divisor:S})}}},{key:"setConstantAttributes",value:function(a){for(var o=0,u=Object.entries(a);o<u.length;o++){var f=H(u[o],2),_=f[0],c=f[1],E=In(this.layout,_);if(!E){y.warn('Ignoring constant value supplied for unknown attribute "'.concat(_,'" in pipeline "').concat(this.id,'"'))();continue}this.vertexArrayObject.setConstant(E.location,c)}Object.assign(this.constantAttributes,a)}},{key:"setBindings",value:function(a){for(var o=this,u=function(){var l=H(_[f],2),R=l[0],T=l[1],A=o.layout.bindings.find(function(h){return h.name===R});if(!A)return y.warn("Unknown binding ".concat(R," in render pipeline ").concat(o.id))(),"continue";switch(T||y.warn("Unsetting binding ".concat(R," in render pipeline ").concat(o.id))(),A.type){case"uniform":if(!(T instanceof he)&&!(T.buffer instanceof he))throw new Error("buffer value");break;case"texture":if(!(T instanceof Se))throw new Error("texture value");break;case"sampler":y.warn("Ignoring sampler ".concat(R))();break;default:throw new Error(A.type)}o.bindings[R]=T},f=0,_=Object.entries(a);f<_.length;f++)var c=u()}},{key:"setUniforms",value:function(a){Object.assign(this.uniforms,a)}},{key:"draw",value:function(a){var o,u=this,f=a.renderPass,_=a.vertexCount,c=a.instanceCount,E=a.firstVertex,l=E===void 0?0:E,R=T_(this.props.topology),T=Boolean(this._indexBuffer),A=(o=this._indexBuffer)===null||o===void 0?void 0:o.glIndexType,h=Number(a.instanceCount)>0;return!this._areTexturesRenderable()||a.vertexCount===0?!1:(this.device.gl.useProgram(this.handle),this.vertexArrayObject.bind(function(){var v=A_(u.props.topology),S=null;S&&S.begin(v),u._applyBindings(),u._applyUniforms(),u._applyConstantAttributes();var I=f;dr(u.device,u.props.parameters,function(){Ei(u.device,I.glParameters,function(){if(T&&h){var C;(C=u.device.gl2)===null||C===void 0||C.drawElementsInstanced(R,_||0,A,l,c||0)}else if(T)u.device.gl.drawElements(R,_||0,A,l);else if(h){var D;(D=u.device.gl2)===null||D===void 0||D.drawArraysInstanced(R,l,_||0,c||0)}else u.device.gl.drawArrays(R,l,_||0)}),S&&S.end()})}),!0)}},{key:"_compileAndLink",value:function(){var a=this.device.gl;if(a.attachShader(this.handle,this.vs.handle),a.attachShader(this.handle,this.fs.handle),y.time(no,"linkProgram for ".concat(this.id))(),a.linkProgram(this.handle),y.timeEnd(no,"linkProgram for ".concat(this.id))(),a.debug||y.level>0){var o=a.getProgramParameter(this.handle,a.LINK_STATUS);if(!o)throw new Error("Error linking: ".concat(a.getProgramInfoLog(this.handle)));a.validateProgram(this.handle);var u=a.getProgramParameter(this.handle,a.VALIDATE_STATUS);if(!u)throw new Error("Error validating: ".concat(a.getProgramInfoLog(this.handle)))}}},{key:"_areTexturesRenderable",value:function(){for(var a=!0,o=0,u=Object.entries(this._textureUniforms);o<u.length;o++){var f=H(u[o],2),_=f[1];_.update(),a=a&&_.loaded}for(var c=0,E=Object.entries(this.bindings);c<E.length;c++){var l=H(E[c],2),R=l[1];R.loaded!==void 0&&(a=a&&R.loaded)}return a}},{key:"_applyBindings",value:function(){this.device.gl.useProgram(this.handle);var a=this.device.gl2;if(!a)throw new Error("bindings");var o=0,u=0,f=to(this.layout.bindings),_;try{for(f.s();!(_=f.n()).done;){var c=_.value,E=this.bindings[c.name];if(!E)throw new Error("No value for binding ".concat(c.name," in ").concat(this.id));switch(c.type){case"uniform":var l=c.name,R=a.getUniformBlockIndex(this.handle,l);if(R===i.INVALID_INDEX)throw new Error("Invalid uniform block name ".concat(l));a.uniformBlockBinding(this.handle,u,R),E instanceof he?a.bindBufferBase(i.UNIFORM_BUFFER,u,E.handle):a.bindBufferRange(i.UNIFORM_BUFFER,u,E.buffer.handle,E.offset||0,E.size||E.buffer.byteLength-E.offset),u+=1;break;case"texture":if(!(E instanceof Se))throw new Error("texture");var T=E;a.activeTexture(i.TEXTURE0+o),a.bindTexture(T.target,T.handle),o+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error("binding type '".concat(c.type,"' not supported in WebGL"))}}}catch(A){f.e(A)}finally{f.f()}}},{key:"_applyUniforms",value:function(){var a=to(this.layout.uniforms||[]),o;try{for(a.s();!(o=a.n()).done;){var u,f=o.value,_=f.name,c=f.location,E=f.type,l=f.textureUnit,R=(u=this.uniforms[_])!==null&&u!==void 0?u:l;R!==void 0&&Qi(this.device.gl,c,E,R)}}catch(T){a.e(T)}finally{a.f()}}},{key:"_applyConstantAttributes",value:function(){for(var a=0,o=Object.entries(this.constantAttributes);a<o.length;a++){var u=H(o[a],2),f=u[0],_=u[1],c=In(this.layout,f);if(!c){y.warn('Ignoring constant value supplied for unknown attribute "'.concat(f,'" in pipeline "').concat(this.id,'"'))();continue}this.vertexArrayObject.setConstant(c.location,_)}}}]),r}(rr);function T_(e){switch(e){case"point-list":return i.POINTS;case"line-list":return i.LINES;case"line-strip":return i.LINE_STRIP;case"line-loop-webgl":return i.LINE_LOOP;case"triangle-list":return i.TRIANGLES;case"triangle-strip":return i.TRIANGLE_STRIP;case"triangle-fan-webgl":return i.TRIANGLE_FAN;default:throw new Error(e)}}function A_(e){switch(e){case"point-list":return i.POINTS;case"line-list":return i.LINES;case"line-strip":return i.LINES;case"line-loop-webgl":return i.LINES;case"triangle-list":return i.TRIANGLES;case"triangle-strip":return i.TRIANGLES;case"triangle-fan-webgl":return i.TRIANGLES;default:throw new Error(e)}}function In(e,t){return e.attributes.find(function(r){return r.name===t})||null}function p_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=m_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
30
30
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,u=!1,f;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){u=!0,f=c},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(u)throw f}}}}function m_(e,t){if(e){if(typeof e=="string")return ao(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ao(e,t)}}function ao(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function h_(e){var t=S_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function S_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var io=function(e){x(r,e);var t=h_(r);function r(n){var a;return P(this,r),a=t.call(this,{}),s(d(a),"device",void 0),s(d(a),"commands",[]),a.device=n,a}return F(r,[{key:"submitCommands",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands,o=p_(a),u;try{for(o.s();!(u=o.n()).done;){var f=u.value;switch(f.name){case"copy-buffer-to-buffer":g_(this.device,f.options);break;case"copy-buffer-to-texture":v_(this.device,f.options);break;case"copy-texture-to-buffer":O_(this.device,f.options);break;case"copy-texture-to-texture":b_(this.device,f.options);break}}}catch(_){o.e(_)}finally{o.f()}}}]),r}(Hr);function g_(e,t){var r=t.source,n=t.destination,a=e.assertWebGL2();if(a){var o,u;a.bindBuffer(i.COPY_READ_BUFFER,r.handle),a.bindBuffer(i.COPY_WRITE_BUFFER,n.handle),a.copyBufferSubData(i.COPY_READ_BUFFER,i.COPY_WRITE_BUFFER,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(u=t.destinationOffset)!==null&&u!==void 0?u:0,t.size),a.bindBuffer(i.COPY_READ_BUFFER,null),a.bindBuffer(i.COPY_WRITE_BUFFER,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function v_(e,t){throw new Error("Not implemented")}function O_(e,t){var r=t.source,n=t.mipLevel,a=n===void 0?0:n,o=t.aspect,u=o===void 0?"all":o,f=t.width,_=f===void 0?t.source.width:f,c=t.height,E=c===void 0?t.source.height:c,l=t.depthOrArrayLayers,R=l===void 0?0:l,T=t.origin,A=T===void 0?[0,0]:T,h=t.destination,v=t.byteOffset,S=v===void 0?0:v,I=t.bytesPerRow,C=t.rowsPerImage;if(u!=="all")throw new Error("not supported");if(a!==0||R!==void 0||I||C)throw new Error("not implemented");var D=e.assertWebGL2(),L=oo(r),W=L.framebuffer,K=L.destroyFramebuffer;try{var ne=h,q=_||W.width,ee=E||W.height,j=i.RGBA,O=i.UNSIGNED_BYTE;D.bindBuffer(i.PIXEL_PACK_BUFFER,ne.handle),D.bindFramebuffer(i.FRAMEBUFFER,W.handle),D.readPixels(A[0],A[1],q,ee,j,O,S)}finally{D.bindBuffer(i.PIXEL_PACK_BUFFER,null),D.bindFramebuffer(i.FRAMEBUFFER,null),K&&W.destroy()}}function b_(e,t){var r=t.source,n=t.origin,a=n===void 0?[0,0]:n,o=t.destination,u=t.width,f=u===void 0?t.destination.width:u,_=t.height,c=_===void 0?t.destination.width:_,E=0,l=i.RGBA,R=oo(r),T=R.framebuffer,A=R.destroyFramebuffer,h=H(a,2),v=h[0],S=h[1],I=!1;e.gl.bindFramebuffer(i.FRAMEBUFFER,T.handle);var C=null,D;if(o instanceof Se)C=o,f=Number.isFinite(f)?f:C.width,c=Number.isFinite(c)?c:C.height,C.bind(0),D=C.destination;else throw new Error("whoops");return I||e.gl.copyTexImage2D(D,E,l,v,S,f,c,0),C&&C.unbind(),e.gl.bindFramebuffer(i.FRAMEBUFFER,prevHandle||null),A&&T.destroy(),C}function oo(e){if(e instanceof Ee){var t=e.width,r=e.height,n=e.id,a=e.device.createFramebuffer({id:"framebuffer-for-".concat(n),width:t,height:r,colorAttachments:[e]});return{framebuffer:a,destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}function N_(e){var t=C_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function C_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Cr=function(e){x(r,e);var t=N_(r);function r(n,a){var o;return P(this,r),o=t.call(this,a),s(d(o),"device",void 0),s(d(o),"commandBuffer",void 0),o.device=n,o.commandBuffer=new io(n),o}return F(r,[{key:"destroy",value:function(){}},{key:"finish",value:function(){this.commandBuffer.submitCommands()}},{key:"copyBufferToBuffer",value:function(a){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:a})}},{key:"copyBufferToTexture",value:function(a){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:a})}},{key:"copyTextureToBuffer",value:function(a){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:a})}},{key:"copyTextureToTexture",value:function(a){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:a})}},{key:"pushDebugGroup",value:function(a){}},{key:"popDebugGroup",value:function(){}},{key:"insertDebugMarker",value:function(a){}}]),r}(Lr);function so(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?so(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):so(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function I_(e){var t=y_();return function(){var n=b(e),a;if(t){var o=b(this).constructor;a=Reflect.construct(n,arguments,o)}else a=n.apply(this,arguments);return w(this,a)}}function y_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ir=1,fe=function(e){x(r,e);var t=I_(r);function r(n){var a,o;P(this,r),o=t.call(this,Fe(Fe({},n),{},{id:n.id||Oe("webgl-device")})),s(d(o),"info",void 0),s(d(o),"canvasContext",void 0),s(d(o),"handle",void 0),s(d(o),"lost",void 0),s(d(o),"_resolveContextLost",void 0),s(d(o),"_features",void 0),s(d(o),"_limits",void 0),s(d(o),"renderPass",null),s(d(o),"gl",void 0),s(d(o),"gl2",null),s(d(o),"debug",!1),s(d(o),"isWebGL1",void 0),s(d(o),"isWebGL2",void 0),s(d(o),"_canvasSizeInfo",{clientWidth:0,clientHeight:0,devicePixelRatio:1}),s(d(o),"_extensions",{}),s(d(o),"_polyfilled",!1),s(d(o),"spector",void 0),s(d(o),"_webglLimits",void 0);var u=(a=n.gl)===null||a===void 0?void 0:a.device;if(u)throw new Error("WebGL context already attached to device ".concat(u.id));o.canvasContext=new hr(d(o),n),o.lost=new Promise(function(h){o._resolveContextLost=h});var f=function(v){var S,I;return(S=(I=o)._resolveContextLost)===null||S===void 0?void 0:S.call(I,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},_=n.gl||null;if(_=_||($()?qa(o.canvasContext.canvas,Fe(Fe({},n),{},{onContextLost:f})):null),_=_||($()?null:wn(Fe(Fe({},n),{},{onContextLost:f}))),!_)throw new Error("WebGL context creation failed");o.handle=_,o.gl=o.handle,o.gl2=o.gl,o.isWebGL2=F_(o.gl),o.isWebGL1=!o.isWebGL2,o.info=Ja(o.gl),o.gl.device=d(o),o.gl._version=o.isWebGL2?2:1,fr(o.gl);var c=n.enable,E=c===void 0?!0:c,l=n.copyState,R=l===void 0?!1:l;if(Xt(o.gl,{enable:E,copyState:R,log:function(){for(var v=arguments.length,S=new Array(v),I=0;I<v;I++)S[I]=arguments[I];return y.log.apply(y,[1].concat(S))()}}),$()&&n.debug&&(o.gl=Ui(o.gl,Fe(Fe({},n),{},{webgl2:o.isWebGL2,throwOnError:!0})),o.gl2=o.gl,o.debug=!0,y.level=Math.max(y.level,1),y.warn("WebGL debug mode activated. Performance reduced.")()),$()&&n.spector){var T=o.handle.canvas||n.canvas;o.spector=yi(Fe(Fe({},o.props),{},{canvas:T}))}var A="Created ".concat(o.info.type).concat(o.debug?" debug":""," context: ").concat(o.info.vendor,", ").concat(o.info.renderer," for canvas: ").concat(o.canvasContext.id);return y.probe(Ir,A)(),y.groupEnd(Ir)(),o}return F(r,[{key:"features",get:function(){return this._features=this._features||ui(this.gl),this._features}},{key:"limits",get:function(){return this._limits=this._limits||_i(this.gl),this._limits}},{key:"destroy",value:function(){var a=this.gl.getExtension("STACKGL_destroy_context");a&&a.destroy()}},{key:"isLost",get:function(){return this.gl.isContextLost()}},{key:"getSize",value:function(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}},{key:"isTextureFormatSupported",value:function(a){return Vt(this.gl,a)}},{key:"isTextureFormatFilterable",value:function(a){return ai(this.gl,a)}},{key:"isTextureFormatRenderable",value:function(a){return ii(this.gl,a)}},{key:"assertWebGL2",value:function(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}},{key:"createCanvasContext",value:function(a){throw new Error("WebGL only supports a single canvas")}},{key:"createBuffer",value:function(a){var o=this._getBufferProps(a);return new St(this,o)}},{key:"_createTexture",value:function(a){return new Se(this,a)}},{key:"createExternalTexture",value:function(a){throw new Error("createExternalTexture() not implemented")}},{key:"createSampler",value:function(a){return new tt(this,a)}},{key:"createShader",value:function(a){return new Sr(this,a)}},{key:"createFramebuffer",value:function(a){return new pt(this,a)}},{key:"createRenderPipeline",value:function(a){return new Nr(this,a)}},{key:"beginRenderPass",value:function(a){return new gr(this,a)}},{key:"createComputePipeline",value:function(a){throw new Error("ComputePipeline not supported in WebGL")}},{key:"beginComputePass",value:function(a){throw new Error("compute shaders not supported in WebGL")}},{key:"getDefaultRenderPass",value:function(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}},{key:"createCommandEncoder",value:function(a){return new Cr(this,a)}},{key:"submit",value:function(){var a;(a=this.renderPass)===null||a===void 0||a.end(),this.renderPass=null}},{key:"webglLimits",get:function(){return this._webglLimits=this._webglLimits||ci(this.gl),this._webglLimits}},{key:"loseDevice",value:function(){var a,o=!1,u=this.gl.getExtension("WEBGL_lose_context");return u&&(o=!0,u.loseContext()),(a=this._resolveContextLost)===null||a===void 0||a.call(this,{reason:"destroyed",message:"Application triggered context loss"}),o}},{key:"pushState",value:function(){xe(this.gl)}},{key:"popState",value:function(){Ie(this.gl)}},{key:"setSpectorMetadata",value:function(a,o){a.__SPECTOR_Metadata=o}},{key:"getGLKey",value:function(a,o){o=o||this.gl2||this.gl;var u=Number(a);for(var f in o)if(o[f]===u)return"GL.".concat(f);return String(a)}}],[{key:"isSupported",value:function(){return typeof WebGLRenderingContext<"u"||xn()}},{key:"attach",value:function(a){if(a instanceof r)return a;if(a?.device instanceof Nt)return a.device;if(!P_(a))throw new Error("Invalid WebGLRenderingContext");return new r({gl:a})}},{key:"create",value:function(){var n=ue(yn.default.mark(function o(){var u,f,_=arguments;return yn.default.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(u=_.length>0&&_[0]!==void 0?_[0]:{},y.groupCollapsed(Ir,"WebGLDevice created"),typeof u.canvas!="string"){E.next=5;break}return E.next=5,ft.pageLoaded;case 5:if(!(y.get("debug")||u.debug)){E.next=8;break}return E.next=8,Di();case 8:if(f=u.spector,!(y.get("spector")||f)){E.next=12;break}return E.next=12,Ii();case 12:if(y.probe(Ir+1,"DOM is loaded")(),!(u.gl&&u.gl.device)){E.next=15;break}return E.abrupt("return",r.attach(u.gl));case 15:return E.abrupt("return",new r(u));case 16:case"end":return E.stop()}},o)}));function a(){return n.apply(this,arguments)}return a}()}]),r}(Nt);s(fe,"type","webgl");function P_(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function F_(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}var B_=256,M_=1024,D_=16384;var U_="clear: bad arguments";function uo(e,t){var r=fe.attach(e),n=t||{},a=n.framebuffer,o=a===void 0?null:a,u=n.color,f=u===void 0?null:u,_=n.depth,c=_===void 0?null:_,E=n.stencil,l=E===void 0?null:E,R={};o&&(R.framebuffer=o);var T=0;f&&(T|=D_,f!==!0&&(R.clearColor=f)),c&&(T|=B_,c!==!0&&(R.clearDepth=c)),l&&(T|=M_,c!==!0&&(R.clearStencil=c)),B(T!==0,U_),Re(r.gl,R,function(){r.gl.clear(T)})}function Pn(e){switch(e){case i.ALPHA:case i.R32F:case i.RED:return 1;case i.RG32F:case i.RG:return 2;case i.RGB:case i.RGB32F:return 3;case i.RGBA:case i.RGBA32F:return 4;default:return B(!1),0}}function fo(e){switch(e){case i.UNSIGNED_BYTE:return 1;case i.UNSIGNED_SHORT_5_6_5:case i.UNSIGNED_SHORT_4_4_4_4:case i.UNSIGNED_SHORT_5_5_5_1:return 2;case i.FLOAT:return 4;default:return B(!1),0}}function _o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function co(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_o(Object(r),!0).forEach(function(n){s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_o(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Eo(e,t){var r=t||{},n=r.sourceX,a=n===void 0?0:n,o=r.sourceY,u=o===void 0?0:o,f=r.sourceFormat,_=f===void 0?i.RGBA:f,c=t||{},E=c.sourceAttachment,l=E===void 0?i.COLOR_ATTACHMENT0:E,R=c.target,T=R===void 0?null:R,A=c.sourceWidth,h=c.sourceHeight,v=c.sourceType,S=Fn(e),I=S.framebuffer,C=S.deleteFramebuffer;B(I);var D=I,L=D.gl,W=D.handle;A=A||I.width,h=h||I.height,l===i.COLOR_ATTACHMENT0&&W===null&&(l=i.FRONT);var K=l-i.COLOR_ATTACHMENT0;v=v||I.colorAttachments[K].type,T=w_(T,v,_,A,h),v=v||ht(T);var ne=L.bindFramebuffer(i.FRAMEBUFFER,W);return L.readPixels(a,u,A,h,_,v,T),L.bindFramebuffer(i.FRAMEBUFFER,ne||null),C&&I.destroy(),T}function lo(e,t){var r=t||{},n=r.sourceX,a=n===void 0?0:n,o=r.sourceY,u=o===void 0?0:o,f=r.sourceFormat,_=f===void 0?i.RGBA:f,c=r.targetByteOffset,E=c===void 0?0:c,l=t||{},R=l.target,T=l.sourceWidth,A=l.sourceHeight,h=l.sourceType,v=Fn(e),S=v.framebuffer,I=v.deleteFramebuffer;B(S),T=T||S.width,A=A||S.height;var C=S,D=C.device.assertWebGL2();if(h=h||(R?R.type:i.UNSIGNED_BYTE),!R){var L=Pn(_),W=fo(h),K=E+T*A*L*W;R=new St(D,{byteLength:K,accessor:{type:h,size:L}})}return R.bind({glTarget:i.PIXEL_PACK_BUFFER}),Re(D,{framebuffer:S},function(){D.readPixels(a,u,T,A,_,h,E)}),R.unbind({glTarget:i.PIXEL_PACK_BUFFER}),I&&S.destroy(),R}function Ro(e,t,r){var n=r||{},a=n.sourceX,o=a===void 0?0:a,u=n.sourceY,f=u===void 0?0:u,_=n.targetMipmaplevel,c=_===void 0?0:_,E=n.targetInternalFormat,l=E===void 0?i.RGBA:E,R=r||{},T=R.targetX,A=R.targetY,h=R.targetZ,v=R.width,S=R.height,I=Fn(e),C=I.framebuffer,D=I.deleteFramebuffer;B(C);var L=C,W=L.device,K=L.handle,ne=typeof T<"u"||typeof A<"u"||typeof h<"u";T=T||0,A=A||0,h=h||0;var q=W.gl.bindFramebuffer(i.FRAMEBUFFER,K);B(t);var ee=null,j;if(t instanceof Ee?(ee=t,v=Number.isFinite(v)?v:ee.width,S=Number.isFinite(S)?S:ee.height,ee.bind(0),j=ee.target):j=t,!ne)W.gl.copyTexImage2D(j,c,l,o,f,v,S,0);else switch(j){case i.TEXTURE_2D:case i.TEXTURE_CUBE_MAP:W.gl.copyTexSubImage2D(j,c,T,A,o,f,v,S);break;case i.TEXTURE_2D_ARRAY:case i.TEXTURE_3D:W.assertWebGL2(),W.gl2.copyTexSubImage3D(j,c,T,A,h,o,f,v,S);break;default:}return ee&&ee.unbind(),gl.bindFramebuffer(i.FRAMEBUFFER,q||null),D&&C.destroy(),ee}function Fn(e){return e instanceof yt?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:x_(e),deleteFramebuffer:!0}}function x_(e,t){var r=e.device,n=e.width,a=e.height,o=e.id,u=r.createFramebuffer(co(co({},t),{},{id:"framebuffer-for-".concat(o),width:n,height:a,colorAttachments:[e]}));return u}function w_(e,t,r,n,a){if(e)return e;t=t||i.UNSIGNED_BYTE;var o=We(t,{clamped:!1}),u=Pn(r);return new o(n*a*u)}return vo(X_);})();
|
|
31
31
|
/*! Bundled license information:
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgl",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.30",
|
|
4
4
|
"description": "WebGL2 adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
|
-
"@luma.gl/
|
|
48
|
-
"@luma.gl/
|
|
47
|
+
"@luma.gl/constants": "9.0.0-alpha.30",
|
|
48
|
+
"@luma.gl/core": "9.0.0-alpha.30",
|
|
49
49
|
"@probe.gl/env": "^4.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@luma.gl/test-utils": "9.0.0-alpha.
|
|
52
|
+
"@luma.gl/test-utils": "9.0.0-alpha.30"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7fb163f20d3400d59b59a17d36b4f3c466c559ba"
|
|
55
55
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
StencilOperation,
|
|
6
6
|
log,
|
|
7
7
|
isObjectEmpty
|
|
8
|
-
} from '@luma.gl/
|
|
8
|
+
} from '@luma.gl/core';
|
|
9
9
|
import {GL} from '@luma.gl/constants';
|
|
10
10
|
import type {GLParameters} from '@luma.gl/constants';
|
|
11
11
|
import {pushContextState, popContextState} from '../../context/state-tracker/track-context-state';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SAMPLER FILTERS
|
|
2
|
-
import {SamplerParameters} from '@luma.gl/
|
|
2
|
+
import {SamplerParameters} from '@luma.gl/core';
|
|
3
3
|
import {GL, GLSamplerParameters} from '@luma.gl/constants';
|
|
4
4
|
import {convertCompareFunction, convertToCompareFunction} from './device-parameters';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {TextureFormat, DeviceFeature} from '@luma.gl/
|
|
2
|
-
import {decodeTextureFormat} from '@luma.gl/
|
|
1
|
+
import type {TextureFormat, DeviceFeature} from '@luma.gl/core';
|
|
2
|
+
import {decodeTextureFormat} from '@luma.gl/core';
|
|
3
3
|
import {GL} from '@luma.gl/constants';
|
|
4
4
|
import {isWebGL2} from '../../context/context/webgl-checks';
|
|
5
5
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Provides a function that enables simple checking of which WebGL features are
|
|
3
3
|
// available in an WebGL1 or WebGL2 environment.
|
|
4
4
|
|
|
5
|
-
import {DeviceFeature} from '@luma.gl/
|
|
5
|
+
import {DeviceFeature} from '@luma.gl/core';
|
|
6
6
|
import {isWebGL2} from '../../context/context/webgl-checks';
|
|
7
7
|
import {isOldIE} from './is-old-ie';
|
|
8
8
|
import {getTextureFeatures, _checkFloat32ColorAttachment} from '../converters/texture-formats';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {GL,
|
|
1
|
+
import {GL, GLPrimitiveTopology, GLPrimitive} from '@luma.gl/constants';
|
|
2
2
|
|
|
3
3
|
// Counts the number of complete primitives given a number of vertices and a drawMode
|
|
4
|
-
export function getPrimitiveDrawMode(drawMode:
|
|
4
|
+
export function getPrimitiveDrawMode(drawMode: GLPrimitiveTopology): GLPrimitive {
|
|
5
5
|
switch (drawMode) {
|
|
6
6
|
case GL.POINTS:
|
|
7
7
|
return GL.POINTS;
|
|
@@ -23,7 +23,7 @@ export function getPrimitiveDrawMode(drawMode: GLDrawMode): GLPrimitive {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// Counts the number of complete "primitives" given a number of vertices and a drawMode
|
|
26
|
-
export function getPrimitiveCount(options: {drawMode:
|
|
26
|
+
export function getPrimitiveCount(options: {drawMode: GLPrimitiveTopology, vertexCount: number}): number {
|
|
27
27
|
const {drawMode, vertexCount} = options;
|
|
28
28
|
switch (drawMode) {
|
|
29
29
|
case GL.POINTS:
|
|
@@ -44,7 +44,7 @@ export function getPrimitiveCount(options: {drawMode: GLDrawMode, vertexCount: n
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Counts the number of vertices after splitting the vertex stream into separate "primitives"
|
|
47
|
-
export function getVertexCount(options: {drawMode:
|
|
47
|
+
export function getVertexCount(options: {drawMode: GLPrimitiveTopology, vertexCount: number}): number {
|
|
48
48
|
const {drawMode, vertexCount} = options;
|
|
49
49
|
const primitiveCount = getPrimitiveCount({drawMode, vertexCount});
|
|
50
50
|
switch (getPrimitiveDrawMode(drawMode)) {
|