@luma.gl/webgl 9.0.0-alpha.14 → 9.0.0-alpha.16
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/dist/adapter/converters/device-parameters.js +199 -136
- package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +62 -176
- package/dist/adapter/converters/sampler-parameters.js +149 -206
- package/dist/adapter/converters/texture-formats.d.ts +2 -2
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +437 -890
- package/dist/adapter/converters/vertex-formats.js +15 -33
- package/dist/adapter/device-helpers/device-features.js +119 -100
- 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 +88 -86
- package/dist/adapter/device-helpers/get-device-info.js +42 -43
- package/dist/adapter/device-helpers/is-old-ie.js +9 -6
- package/dist/adapter/helpers/attribute-utils.js +50 -74
- package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
- package/dist/adapter/helpers/get-shader-info.js +27 -0
- package/dist/adapter/helpers/get-shader-layout.js +307 -296
- 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 +32 -33
- package/dist/adapter/helpers/set-uniform.js +67 -110
- package/dist/adapter/helpers/uniforms.js +80 -85
- package/dist/adapter/objects/constants-to-keys.js +33 -33
- 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 +67 -86
- package/dist/adapter/objects/webgl-resource.js +213 -205
- 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 +74 -76
- package/dist/adapter/resources/webgl-buffer.js +150 -147
- package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +39 -55
- package/dist/adapter/resources/webgl-command-encoder.js +25 -49
- package/dist/adapter/resources/webgl-external-texture.js +91 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +231 -258
- 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 +8 -18
- package/dist/adapter/resources/webgl-render-pipeline.js +316 -378
- package/dist/adapter/resources/webgl-sampler.js +42 -47
- package/dist/adapter/resources/webgl-shader.d.ts +1 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +58 -68
- package/dist/adapter/resources/webgl-texture.d.ts +5 -5
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +661 -815
- package/dist/adapter/webgl-canvas-context.js +55 -49
- package/dist/adapter/webgl-device.js +288 -338
- package/dist/bundle.js +1 -2
- package/dist/classic/accessor.js +120 -127
- package/dist/classic/buffer.d.ts +1 -1
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +325 -356
- 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 +91 -101
- package/dist/context/context/create-browser-context.d.ts +1 -2
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +61 -52
- package/dist/context/context/create-headless-context.d.ts +1 -1
- package/dist/context/context/create-headless-context.d.ts.map +1 -1
- package/dist/context/context/create-headless-context.js +26 -33
- package/dist/context/context/webgl-checks.js +25 -20
- package/dist/context/debug/spector.d.ts +1 -2
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +53 -62
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +106 -93
- package/dist/context/parameters/unified-parameter-api.js +91 -55
- package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +462 -423
- package/dist/context/polyfill/context-data.js +16 -12
- package/dist/context/polyfill/get-parameter-polyfill.js +91 -76
- package/dist/context/polyfill/polyfill-context.js +75 -80
- package/dist/context/polyfill/polyfill-table.js +133 -139
- package/dist/context/polyfill/polyfill-vertex-array-object.js +255 -297
- package/dist/context/state-tracker/deep-array-equal.js +16 -18
- package/dist/context/state-tracker/track-context-state.js +183 -161
- package/dist/context/state-tracker/with-parameters.js +43 -35
- package/dist/dist.min.js +1 -0
- package/dist/es5/adapter/converters/device-parameters.js +3 -38
- package/dist/es5/adapter/converters/device-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +2 -14
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +2 -65
- package/dist/es5/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/texture-formats.js +9 -81
- package/dist/es5/adapter/converters/texture-formats.js.map +1 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -12
- package/dist/es5/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-features.js +6 -40
- package/dist/es5/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -10
- package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -10
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +3 -25
- package/dist/es5/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/es5/adapter/helpers/get-shader-info.js +31 -0
- package/dist/es5/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/es5/adapter/helpers/get-shader-layout.js +23 -101
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +6 -24
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -33
- package/dist/es5/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/es5/adapter/helpers/uniforms.js +13 -37
- package/dist/es5/adapter/helpers/uniforms.js.map +1 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +1 -12
- package/dist/es5/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +5 -33
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-resource.js +6 -60
- package/dist/es5/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +7 -35
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +20 -66
- package/dist/es5/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +6 -32
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -18
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +10 -82
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +2 -19
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +24 -133
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +2 -28
- package/dist/es5/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-shader.js +13 -52
- package/dist/es5/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-texture.js +137 -291
- package/dist/es5/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -24
- package/dist/es5/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/es5/adapter/webgl-device.js +40 -127
- package/dist/es5/adapter/webgl-device.js.map +1 -1
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/classic/accessor.js +1 -31
- package/dist/es5/classic/accessor.js.map +1 -1
- package/dist/es5/classic/buffer.js +32 -102
- package/dist/es5/classic/buffer.js.map +1 -1
- package/dist/es5/classic/typed-array-utils.js +10 -37
- package/dist/es5/classic/typed-array-utils.js.map +1 -1
- package/dist/es5/context/context/create-browser-context.js +4 -21
- package/dist/es5/context/context/create-browser-context.js.map +1 -1
- package/dist/es5/context/context/create-headless-context.js +8 -21
- package/dist/es5/context/context/create-headless-context.js.map +1 -1
- package/dist/es5/context/context/webgl-checks.js +4 -14
- package/dist/es5/context/context/webgl-checks.js.map +1 -1
- package/dist/es5/context/debug/spector.js +20 -54
- package/dist/es5/context/debug/spector.js.map +1 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +19 -65
- package/dist/es5/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +3 -28
- package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +18 -65
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/es5/context/polyfill/context-data.js +0 -3
- package/dist/es5/context/polyfill/context-data.js.map +1 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -12
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-context.js +8 -33
- package/dist/es5/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-table.js +3 -27
- package/dist/es5/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -5
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/es5/context/state-tracker/track-context-state.js +10 -53
- package/dist/es5/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/es5/context/state-tracker/with-parameters.js +1 -13
- package/dist/es5/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/es5/index.js +72 -99
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/init.js +0 -3
- package/dist/es5/init.js.map +1 -1
- package/dist/es5/types/webgl.js +0 -1
- package/dist/es5/types/webgl.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -20
- package/dist/esm/adapter/converters/device-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -4
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +2 -57
- package/dist/esm/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/texture-formats.js +8 -52
- package/dist/esm/adapter/converters/texture-formats.js.map +1 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -9
- package/dist/esm/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-features.js +2 -19
- package/dist/esm/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -3
- package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -6
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -17
- package/dist/esm/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/esm/adapter/helpers/get-shader-info.js +25 -0
- package/dist/esm/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/esm/adapter/helpers/get-shader-layout.js +2 -48
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -7
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -30
- package/dist/esm/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -10
- package/dist/esm/adapter/helpers/uniforms.js.map +1 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -7
- package/dist/esm/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +2 -18
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-resource.js +10 -57
- package/dist/esm/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +5 -15
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +12 -40
- package/dist/esm/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +2 -17
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -12
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -60
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +1 -8
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -89
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -12
- package/dist/esm/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-shader.js +2 -16
- package/dist/esm/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-texture.js +36 -154
- package/dist/esm/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -14
- package/dist/esm/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/esm/adapter/webgl-device.js +19 -89
- package/dist/esm/adapter/webgl-device.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/classic/accessor.js +10 -34
- package/dist/esm/classic/accessor.js.map +1 -1
- package/dist/esm/classic/buffer.js +15 -71
- package/dist/esm/classic/buffer.js.map +1 -1
- package/dist/esm/classic/typed-array-utils.js +0 -20
- package/dist/esm/classic/typed-array-utils.js.map +1 -1
- package/dist/esm/context/context/create-browser-context.js +6 -14
- package/dist/esm/context/context/create-browser-context.js.map +1 -1
- package/dist/esm/context/context/create-headless-context.js +2 -6
- package/dist/esm/context/context/create-headless-context.js.map +1 -1
- package/dist/esm/context/context/webgl-checks.js +0 -3
- package/dist/esm/context/context/webgl-checks.js.map +1 -1
- package/dist/esm/context/debug/spector.js +2 -14
- package/dist/esm/context/debug/spector.js.map +1 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +4 -22
- package/dist/esm/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +2 -13
- package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -19
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/esm/context/polyfill/context-data.js +0 -2
- package/dist/esm/context/polyfill/context-data.js.map +1 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -5
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-context.js +14 -21
- package/dist/esm/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -23
- package/dist/esm/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/esm/context/state-tracker/track-context-state.js +11 -45
- package/dist/esm/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -6
- package/dist/esm/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/webgl.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.js +39 -25
- package/dist/init.js +1 -2
- package/dist/types/webgl.d.ts +20 -20
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +8 -8
- package/src/adapter/helpers/get-shader-info.ts +37 -0
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/resources/webgl-render-pass.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/adapter/webgl-device.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +0 -1
- package/src/types/webgl.ts +4 -4
- package/dist/adapter/converters/device-parameters.js.map +0 -1
- package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/adapter/converters/texture-formats.js.map +0 -1
- package/dist/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/adapter/helpers/uniforms.js.map +0 -1
- package/dist/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/adapter/webgl-device.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/classic/accessor.js.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
- package/dist/classic/typed-array-utils.js.map +0 -1
- package/dist/context/context/create-browser-context.js.map +0 -1
- package/dist/context/context/create-headless-context.js.map +0 -1
- package/dist/context/context/webgl-checks.js.map +0 -1
- package/dist/context/debug/spector.js.map +0 -1
- package/dist/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/context/polyfill/context-data.js.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/types/webgl.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,97 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
7
|
+
exports.flipRows = flipRows;
|
|
8
8
|
exports.getGLTypeFromTypedArray = getGLTypeFromTypedArray;
|
|
9
9
|
exports.getTypedArrayFromGLType = getTypedArrayFromGLType;
|
|
10
|
-
exports.flipRows = flipRows;
|
|
11
10
|
exports.scalePixels = scalePixels;
|
|
12
|
-
|
|
13
11
|
var _constants = _interopRequireDefault(require("@luma.gl/constants"));
|
|
14
|
-
|
|
15
12
|
var ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
|
|
16
|
-
|
|
17
13
|
function getGLTypeFromTypedArray(arrayOrType) {
|
|
18
14
|
var type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
19
|
-
|
|
20
15
|
switch (type) {
|
|
21
16
|
case Float32Array:
|
|
22
17
|
return _constants.default.FLOAT;
|
|
23
|
-
|
|
24
18
|
case Uint16Array:
|
|
25
19
|
return _constants.default.UNSIGNED_SHORT;
|
|
26
|
-
|
|
27
20
|
case Uint32Array:
|
|
28
21
|
return _constants.default.UNSIGNED_INT;
|
|
29
|
-
|
|
30
22
|
case Uint8Array:
|
|
31
23
|
return _constants.default.UNSIGNED_BYTE;
|
|
32
|
-
|
|
33
24
|
case Uint8ClampedArray:
|
|
34
25
|
return _constants.default.UNSIGNED_BYTE;
|
|
35
|
-
|
|
36
26
|
case Int8Array:
|
|
37
27
|
return _constants.default.BYTE;
|
|
38
|
-
|
|
39
28
|
case Int16Array:
|
|
40
29
|
return _constants.default.SHORT;
|
|
41
|
-
|
|
42
30
|
case Int32Array:
|
|
43
31
|
return _constants.default.INT;
|
|
44
|
-
|
|
45
32
|
default:
|
|
46
33
|
throw new Error(ERR_TYPE_DEDUCTION);
|
|
47
34
|
}
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function getTypedArrayFromGLType(glType, options) {
|
|
51
37
|
var _ref = options || {},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
_ref$clamped = _ref.clamped,
|
|
39
|
+
clamped = _ref$clamped === void 0 ? true : _ref$clamped;
|
|
55
40
|
switch (glType) {
|
|
56
41
|
case _constants.default.FLOAT:
|
|
57
42
|
return Float32Array;
|
|
58
|
-
|
|
59
43
|
case _constants.default.UNSIGNED_SHORT:
|
|
60
44
|
case _constants.default.UNSIGNED_SHORT_5_6_5:
|
|
61
45
|
case _constants.default.UNSIGNED_SHORT_4_4_4_4:
|
|
62
46
|
case _constants.default.UNSIGNED_SHORT_5_5_5_1:
|
|
63
47
|
return Uint16Array;
|
|
64
|
-
|
|
65
48
|
case _constants.default.UNSIGNED_INT:
|
|
66
49
|
return Uint32Array;
|
|
67
|
-
|
|
68
50
|
case _constants.default.UNSIGNED_BYTE:
|
|
69
51
|
return clamped ? Uint8ClampedArray : Uint8Array;
|
|
70
|
-
|
|
71
52
|
case _constants.default.BYTE:
|
|
72
53
|
return Int8Array;
|
|
73
|
-
|
|
74
54
|
case _constants.default.SHORT:
|
|
75
55
|
return Int16Array;
|
|
76
|
-
|
|
77
56
|
case _constants.default.INT:
|
|
78
57
|
return Int32Array;
|
|
79
|
-
|
|
80
58
|
default:
|
|
81
59
|
throw new Error('Failed to deduce typed array type from GL constant');
|
|
82
60
|
}
|
|
83
61
|
}
|
|
84
|
-
|
|
85
62
|
function flipRows(options) {
|
|
86
63
|
var data = options.data,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
width = options.width,
|
|
65
|
+
height = options.height,
|
|
66
|
+
_options$bytesPerPixe = options.bytesPerPixel,
|
|
67
|
+
bytesPerPixel = _options$bytesPerPixe === void 0 ? 4 : _options$bytesPerPixe,
|
|
68
|
+
temp = options.temp;
|
|
92
69
|
var bytesPerRow = width * bytesPerPixel;
|
|
93
70
|
var tempBuffer = temp || new Uint8Array(bytesPerRow);
|
|
94
|
-
|
|
95
71
|
for (var y = 0; y < height / 2; ++y) {
|
|
96
72
|
var topOffset = y * bytesPerRow;
|
|
97
73
|
var bottomOffset = (height - y - 1) * bytesPerRow;
|
|
@@ -100,15 +76,13 @@ function flipRows(options) {
|
|
|
100
76
|
data.set(tempBuffer, bottomOffset);
|
|
101
77
|
}
|
|
102
78
|
}
|
|
103
|
-
|
|
104
79
|
function scalePixels(options) {
|
|
105
80
|
var data = options.data,
|
|
106
|
-
|
|
107
|
-
|
|
81
|
+
width = options.width,
|
|
82
|
+
height = options.height;
|
|
108
83
|
var newWidth = Math.round(width / 2);
|
|
109
84
|
var newHeight = Math.round(height / 2);
|
|
110
85
|
var newData = new Uint8Array(newWidth * newHeight * 4);
|
|
111
|
-
|
|
112
86
|
for (var y = 0; y < newHeight; y++) {
|
|
113
87
|
for (var x = 0; x < newWidth; x++) {
|
|
114
88
|
for (var c = 0; c < 4; c++) {
|
|
@@ -116,7 +90,6 @@ function scalePixels(options) {
|
|
|
116
90
|
}
|
|
117
91
|
}
|
|
118
92
|
}
|
|
119
|
-
|
|
120
93
|
return {
|
|
121
94
|
data: newData,
|
|
122
95
|
width: newWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"typed-array-utils.js","names":["_constants","_interopRequireDefault","require","ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","GL","FLOAT","Uint16Array","UNSIGNED_SHORT","Uint32Array","UNSIGNED_INT","Uint8Array","UNSIGNED_BYTE","Uint8ClampedArray","Int8Array","BYTE","Int16Array","SHORT","Int32Array","INT","Error","getTypedArrayFromGLType","glType","options","_ref","_ref$clamped","clamped","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","flipRows","data","width","height","_options$bytesPerPixe","bytesPerPixel","temp","bytesPerRow","tempBuffer","y","topOffset","bottomOffset","set","subarray","copyWithin","scalePixels","newWidth","Math","round","newHeight","newData","x","c"],"sources":["../../../src/classic/typed-array-utils.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {TypedArray} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {GLType} from '../types/webgl'\n\nconst ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';\n\ntype TypedArrayConstructor =\n | Float32ArrayConstructor\n | Uint16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint8ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Int8ArrayConstructor\n | Int16ArrayConstructor\n | Int32ArrayConstructor;\n\n/**\n * Converts TYPED ARRAYS to corresponding GL constant\n * Used to auto deduce gl parameter types\n * @param {*} arrayOrType\n * @returns\n */\nexport function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLType {\n // If typed array, look up constructor\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return GL.FLOAT;\n case Uint16Array:\n return GL.UNSIGNED_SHORT;\n case Uint32Array:\n return GL.UNSIGNED_INT;\n case Uint8Array:\n return GL.UNSIGNED_BYTE;\n case Uint8ClampedArray:\n return GL.UNSIGNED_BYTE;\n case Int8Array:\n return GL.BYTE;\n case Int16Array:\n return GL.SHORT;\n case Int32Array:\n return GL.INT;\n default:\n throw new Error(ERR_TYPE_DEDUCTION);\n }\n}\n\n/**\n * Converts GL constant to corresponding TYPED ARRAY\n * Used to auto deduce gl parameter types\n * @param {*} glType\n * @param {*} param1\n * @returns\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayFromGLType(\n glType: any,\n options?: {\n clamped?: boolean;\n }\n): TypedArrayConstructor {\n const {clamped = true} = options || {};\n // Sorted in some order of likelihood to reduce amount of comparisons\n switch (glType) {\n case GL.FLOAT:\n return Float32Array;\n case GL.UNSIGNED_SHORT:\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n case GL.UNSIGNED_INT:\n return Uint32Array;\n case GL.UNSIGNED_BYTE:\n return clamped ? Uint8ClampedArray : Uint8Array;\n case GL.BYTE:\n return Int8Array;\n case GL.SHORT:\n return Int16Array;\n case GL.INT:\n return Int32Array;\n default:\n throw new Error('Failed to deduce typed array type from GL constant');\n }\n}\n\n/**\n * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)\n * https: *stackoverflow.com/questions/41969562/\n * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels\n * @param {*} param0\n */\n export function flipRows(options: {\n data: any;\n width: any;\n height: any;\n bytesPerPixel?: number;\n temp?: any;\n}): void {\n const {data, width, height, bytesPerPixel = 4, temp} = options;\n const bytesPerRow = width * bytesPerPixel;\n\n // make a temp buffer to hold one row\n const tempBuffer = temp || new Uint8Array(bytesPerRow);\n for (let y = 0; y < height / 2; ++y) {\n const topOffset = y * bytesPerRow;\n const bottomOffset = (height - y - 1) * bytesPerRow;\n // make copy of a row on the top half\n tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));\n // copy a row from the bottom half to the top\n data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);\n // copy the copy of the top half row to the bottom half\n data.set(tempBuffer, bottomOffset);\n }\n}\n\n\nexport function scalePixels(options: {\n data: any;\n width: any;\n height: any;\n}): {\n data: Uint8Array;\n width: number;\n height: number;\n} {\n const {data, width, height} = options;\n const newWidth = Math.round(width / 2);\n const newHeight = Math.round(height / 2);\n const newData = new Uint8Array(newWidth * newHeight * 4);\n for (let y = 0; y < newHeight; y++) {\n for (let x = 0; x < newWidth; x++) {\n for (let c = 0; c < 4; c++) {\n newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];\n }\n }\n }\n return {data: newData, width: newWidth, height: newHeight};\n}\n"],"mappings":"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"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createBrowserContext = createBrowserContext;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
|
-
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
11
|
var DEFAULT_CONTEXT_PROPS = {
|
|
17
12
|
webgl2: true,
|
|
18
13
|
webgl1: true,
|
|
@@ -24,60 +19,48 @@ var DEFAULT_CONTEXT_PROPS = {
|
|
|
24
19
|
return console.info('WebGL context restored');
|
|
25
20
|
}
|
|
26
21
|
};
|
|
27
|
-
|
|
28
22
|
function createBrowserContext(canvas, props) {
|
|
29
23
|
props = _objectSpread(_objectSpread({}, DEFAULT_CONTEXT_PROPS), props);
|
|
30
24
|
var errorMessage = null;
|
|
31
|
-
|
|
32
25
|
var onCreateError = function onCreateError(error) {
|
|
33
26
|
return errorMessage = error.statusMessage || errorMessage;
|
|
34
27
|
};
|
|
35
|
-
|
|
36
28
|
canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
|
|
37
29
|
var gl = null;
|
|
38
|
-
|
|
39
30
|
if (props.type === 'webgl2') {
|
|
40
31
|
props = _objectSpread(_objectSpread({}, props), {}, {
|
|
41
32
|
webgl1: false
|
|
42
33
|
});
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
if (props.type === 'webgl1') {
|
|
46
36
|
props = _objectSpread(_objectSpread({}, props), {}, {
|
|
47
37
|
webgl2: false
|
|
48
38
|
});
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
if (props.webgl2) {
|
|
52
41
|
gl = gl || canvas.getContext('webgl2', props);
|
|
53
42
|
}
|
|
54
|
-
|
|
55
43
|
if (props.webgl1) {
|
|
56
44
|
gl = gl || canvas.getContext('webgl', props);
|
|
57
45
|
}
|
|
58
|
-
|
|
59
46
|
canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
|
|
60
|
-
|
|
61
47
|
if (!gl) {
|
|
62
48
|
throw new Error("Failed to create ".concat(props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL', " context: ").concat(errorMessage || 'Unknown error'));
|
|
63
49
|
}
|
|
64
|
-
|
|
65
50
|
if (props.onContextLost) {
|
|
66
51
|
var _props = props,
|
|
67
|
-
|
|
52
|
+
onContextLost = _props.onContextLost;
|
|
68
53
|
canvas.addEventListener('webglcontextlost', function (event) {
|
|
69
54
|
return onContextLost(event);
|
|
70
55
|
}, false);
|
|
71
56
|
}
|
|
72
|
-
|
|
73
57
|
if (props.onContextRestored) {
|
|
74
58
|
var _props2 = props,
|
|
75
|
-
|
|
59
|
+
onContextRestored = _props2.onContextRestored;
|
|
76
60
|
canvas.addEventListener('webglcontextrestored', function (event) {
|
|
77
61
|
return onContextRestored(event);
|
|
78
62
|
}, false);
|
|
79
63
|
}
|
|
80
|
-
|
|
81
64
|
return gl;
|
|
82
65
|
}
|
|
83
66
|
//# sourceMappingURL=create-browser-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"create-browser-context.js","names":["DEFAULT_CONTEXT_PROPS","webgl2","webgl1","powerPreference","onContextLost","console","error","onContextRestored","info","createBrowserContext","canvas","props","_objectSpread","errorMessage","onCreateError","statusMessage","addEventListener","gl","type","getContext","removeEventListener","Error","concat","_props","event","_props2"],"sources":["../../../../src/context/context/create-browser-context.ts"],"sourcesContent":["// luma.gl, MIT license\n\n/**\n * ContextProps\n* @param webgl2 Set to false to not create a WebGL2 context (force webgl1)\n* @param webgl1 set to false to not create a WebGL1 context (fail if webgl2 not available)\n* @param onContextLost\n* @param onContextRestored\n*\n* BROWSER CONTEXT PARAMETERS\n* @param debug Instrument context (at the expense of performance).\n* @param alpha Default render target has an alpha buffer.\n* @param depth Default render target has a depth buffer of at least 16 bits.\n* @param stencil Default render target has a stencil buffer of at least 8 bits.\n* @param antialias Boolean that indicates whether or not to perform anti-aliasing.\n* @param premultipliedAlpha Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n* @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n* @param failIfMajorPerformanceCaveat Do not create if the system performance is low.\n*/\ntype ContextProps = {\n type?: 'webgl' | 'webgl1' | 'webgl2' | string;\n webgl1?: boolean;\n webgl2?: boolean;\n onContextLost?: (event: Event) => void;\n onContextRestored?: (event: Event) => void;\n alpha?: boolean; // indicates if the canvas contains an alpha buffer.\n desynchronized?: boolean; // hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop\n antialias?: boolean; // indicates whether or not to perform anti-aliasing.\n depth?: boolean; // indicates that the drawing buffer has a depth buffer of at least 16 bits.\n failIfMajorPerformanceCaveat?: boolean, // indicates if a context will be created if the system performance is low or if no hardware GPU is available.\n powerPreference?: 'default' | 'high-performance' | 'low-power',\n premultipliedAlpha?: boolean, // page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n preserveDrawingBuffer?: boolean // buffers will not be cleared and will preserve their values until cleared or overwritten by the author.\n};\n\nconst DEFAULT_CONTEXT_PROPS: ContextProps = {\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n powerPreference: 'high-performance', // After all, most apps are using WebGL for performance reasons\n onContextLost: () => console.error('WebGL context lost'),\n onContextRestored: () => console.info('WebGL context restored'),\n};\n\n/**\n * Create a WebGL context for a canvas\n * Note calling this multiple time on the same canvas does return the same context\n* @param canvas A canvas element or offscreen canvas\n */\n export function createBrowserContext(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): WebGLRenderingContext {\n props = {...DEFAULT_CONTEXT_PROPS, ...props};\n\n // Try to extract any extra information about why context creation failed\n let errorMessage = null;\n const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);\n canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n // Create the desired context\n let gl: WebGLRenderingContext | null = null;\n\n if (props.type === 'webgl2') {\n props = {...props, webgl1: false};\n }\n if (props.type === 'webgl1') {\n props = {...props, webgl2: false};\n }\n\n // Prefer webgl2 over webgl1 if both are acceptable\n if (props.webgl2) {\n gl = gl || canvas.getContext('webgl2', props) as WebGL2RenderingContext | null;\n }\n if (props.webgl1) {\n gl = gl || canvas.getContext('webgl', props) as WebGLRenderingContext | null;\n }\n\n // TODO are we removing this listener before giving it a chance to fire?\n canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n\n if (!gl) {\n throw new Error(\n `Failed to create ${props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL'} context: ${\n errorMessage || 'Unknown error'\n }`\n );\n }\n\n if (props.onContextLost) {\n // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.\n const {onContextLost} = props;\n canvas.addEventListener('webglcontextlost',(event: Event) => onContextLost(event), false);\n }\n if (props.onContextRestored) {\n // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.\n const {onContextRestored} = props;\n canvas.addEventListener('webglcontextrestored', (event: Event) => onContextRestored(event), false);\n }\n\n return gl;\n}\n\n/* TODO - can we call this asynchronously to catch the error events?\nexport async function createBrowserContextAsync(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): Promise<WebGLRenderingContext> {\n props = {...DEFAULT_CONTEXT_PROPS, ...props};\n\n // Try to extract any extra information about why context creation failed\n let errorMessage = null;\n const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);\n canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n const gl = createBrowserContext(canvas, props);\n\n // Give the listener a chance to fire\n await new Promise(resolve => setTimeout(resolve, 0));\n\n canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n\n return gl;\n}\n*/\n"],"mappings":";;;;;;;;;;AAmCA,IAAMA,qBAAmC,GAAG;EAC1CC,MAAM,EAAE,IAAI;EACZC,MAAM,EAAE,IAAI;EACZC,eAAe,EAAE,kBAAkB;EACnCC,aAAa,EAAE,SAAAA,cAAA;IAAA,OAAMC,OAAO,CAACC,KAAK,CAAC,oBAAoB,CAAC;EAAA;EACxDC,iBAAiB,EAAE,SAAAA,kBAAA;IAAA,OAAMF,OAAO,CAACG,IAAI,CAAC,wBAAwB,CAAC;EAAA;AACjE,CAAC;AAOO,SAASC,oBAAoBA,CAACC,MAA2C,EAAEC,KAAmB,EAAyB;EAC5HA,KAAK,GAAAC,aAAA,CAAAA,aAAA,KAAOZ,qBAAqB,GAAKW,KAAK,CAAC;EAG7C,IAAIE,YAAY,GAAG,IAAI;EACvB,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAIR,KAAK;IAAA,OAAMO,YAAY,GAAGP,KAAK,CAACS,aAAa,IAAIF,YAAY;EAAA,CAAC;EACrFH,MAAM,CAACM,gBAAgB,CAAC,2BAA2B,EAAEF,aAAa,EAAE,KAAK,CAAC;EAG1E,IAAIG,EAAgC,GAAG,IAAI;EAE3C,IAAIN,KAAK,CAACO,IAAI,KAAK,QAAQ,EAAE;IAC3BP,KAAK,GAAAC,aAAA,CAAAA,aAAA,KAAOD,KAAK;MAAET,MAAM,EAAE;IAAK,EAAC;EACnC;EACA,IAAIS,KAAK,CAACO,IAAI,KAAK,QAAQ,EAAE;IAC3BP,KAAK,GAAAC,aAAA,CAAAA,aAAA,KAAOD,KAAK;MAAEV,MAAM,EAAE;IAAK,EAAC;EACnC;EAGA,IAAIU,KAAK,CAACV,MAAM,EAAE;IAChBgB,EAAE,GAAGA,EAAE,IAAIP,MAAM,CAACS,UAAU,CAAC,QAAQ,EAAER,KAAK,CAAkC;EAChF;EACA,IAAIA,KAAK,CAACT,MAAM,EAAE;IAChBe,EAAE,GAAGA,EAAE,IAAIP,MAAM,CAACS,UAAU,CAAC,OAAO,EAAER,KAAK,CAAiC;EAC9E;EAGAD,MAAM,CAACU,mBAAmB,CAAC,2BAA2B,EAAEN,aAAa,EAAE,KAAK,CAAC;EAE7E,IAAI,CAACG,EAAE,EAAE;IACP,MAAM,IAAII,KAAK,qBAAAC,MAAA,CACOX,KAAK,CAACV,MAAM,IAAI,CAACU,KAAK,CAACT,MAAM,GAAG,QAAQ,GAAG,OAAO,gBAAAoB,MAAA,CACpET,YAAY,IAAI,eAAe,EAElC;EACH;EAEA,IAAIF,KAAK,CAACP,aAAa,EAAE;IAEvB,IAAAmB,MAAA,GAAwBZ,KAAK;MAAtBP,aAAa,GAAAmB,MAAA,CAAbnB,aAAa;IACpBM,MAAM,CAACM,gBAAgB,CAAC,kBAAkB,EAAC,UAACQ,KAAY;MAAA,OAAKpB,aAAa,CAACoB,KAAK,CAAC;IAAA,GAAE,KAAK,CAAC;EAC3F;EACA,IAAIb,KAAK,CAACJ,iBAAiB,EAAE;IAE3B,IAAAkB,OAAA,GAA4Bd,KAAK;MAA1BJ,iBAAiB,GAAAkB,OAAA,CAAjBlB,iBAAiB;IACxBG,MAAM,CAACM,gBAAgB,CAAC,sBAAsB,EAAE,UAACQ,KAAY;MAAA,OAAKjB,iBAAiB,CAACiB,KAAK,CAAC;IAAA,GAAE,KAAK,CAAC;EACpG;EAEA,OAAOP,EAAE;AACX"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.registerHeadlessGL = registerHeadlessGL;
|
|
9
|
-
exports.isHeadlessGLRegistered = isHeadlessGLRegistered;
|
|
10
7
|
exports.createHeadlessContext = createHeadlessContext;
|
|
11
|
-
|
|
8
|
+
exports.isHeadlessGLRegistered = isHeadlessGLRegistered;
|
|
9
|
+
exports.registerHeadlessGL = registerHeadlessGL;
|
|
12
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
13
|
var ERR_HEADLESSGL_FAILED = 'Failed to create WebGL context in Node.js, headless gl returned null';
|
|
19
14
|
var ERR_HEADLESSGL_LOAD = " 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.";
|
|
20
15
|
var CONTEXT_DEFAULTS = {
|
|
@@ -24,37 +19,29 @@ var CONTEXT_DEFAULTS = {
|
|
|
24
19
|
throwOnError: false
|
|
25
20
|
};
|
|
26
21
|
var headlessGL = null;
|
|
27
|
-
|
|
28
22
|
function registerHeadlessGL(headlessgl) {
|
|
29
23
|
headlessGL = headlessgl;
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
function isHeadlessGLRegistered() {
|
|
33
26
|
return headlessGL !== null;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
function createHeadlessContext(options) {
|
|
37
29
|
options = _objectSpread(_objectSpread({}, CONTEXT_DEFAULTS), options);
|
|
38
30
|
var _options = options,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
width = _options.width,
|
|
32
|
+
height = _options.height,
|
|
33
|
+
webgl1 = _options.webgl1,
|
|
34
|
+
webgl2 = _options.webgl2;
|
|
44
35
|
if (webgl2 && !webgl1) {
|
|
45
36
|
throw new Error('headless-gl does not support WebGL2');
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
if (!headlessGL) {
|
|
49
39
|
throw new Error(ERR_HEADLESSGL_LOAD);
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
var gl = headlessGL(width, height, options);
|
|
53
|
-
|
|
54
42
|
if (!gl) {
|
|
55
43
|
throw new Error(ERR_HEADLESSGL_FAILED);
|
|
56
44
|
}
|
|
57
|
-
|
|
58
45
|
return gl;
|
|
59
46
|
}
|
|
60
47
|
//# sourceMappingURL=create-headless-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"create-headless-context.js","names":["ERR_HEADLESSGL_FAILED","ERR_HEADLESSGL_LOAD","CONTEXT_DEFAULTS","width","height","debug","throwOnError","headlessGL","registerHeadlessGL","headlessgl","isHeadlessGLRegistered","createHeadlessContext","options","_objectSpread","_options","webgl1","webgl2","Error","gl"],"sources":["../../../../src/context/context/create-headless-context.ts"],"sourcesContent":["const ERR_HEADLESSGL_FAILED =\n 'Failed to create WebGL context in Node.js, headless gl returned null';\n\nconst ERR_HEADLESSGL_LOAD = `\\\n luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL \\\n contexts can not be created. This may not be an error. For example, this is a \\\n typical configuration for isorender applications running on the server.`;\n\nconst CONTEXT_DEFAULTS = {\n width: 1,\n height: 1,\n debug: true,\n throwOnError: false\n};\n\n/** Duck typing for the main headless gl export, a function to create contexts */\nexport type HeadlessGL = (width: number, height: number, options: Record<string, unknown>) => WebGLRenderingContext;\n\nlet headlessGL: HeadlessGL | null = null; \n\n/** By importing `gl` and registering it with this function, contexts can be created under Node.js */\nexport function registerHeadlessGL(headlessgl: HeadlessGL) {\n headlessGL = headlessgl;\n}\n\n/** @returns true if headless gl is registered */\nexport function isHeadlessGLRegistered(): boolean {\n return headlessGL !== null;\n}\n\n/** Create headless gl context (for running under Node.js) */\nexport function createHeadlessContext(options?: Record<string, any>): WebGLRenderingContext {\n options = {...CONTEXT_DEFAULTS, ...options};\n\n const {width, height, webgl1, webgl2} = options;\n\n if (webgl2 && !webgl1) {\n throw new Error('headless-gl does not support WebGL2');\n }\n if (!headlessGL) {\n throw new Error(ERR_HEADLESSGL_LOAD);\n }\n const gl = headlessGL(width, height, options);\n if (!gl) {\n throw new Error(ERR_HEADLESSGL_FAILED);\n }\n return gl;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAMA,qBAAqB,GACzB,sEAAsE;AAExE,IAAMC,mBAAmB,gPAGiD;AAE1E,IAAMC,gBAAgB,GAAG;EACvBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;AAChB,CAAC;AAKD,IAAIC,UAA6B,GAAG,IAAI;AAGjC,SAASC,kBAAkBA,CAACC,UAAsB,EAAE;EACzDF,UAAU,GAAGE,UAAU;AACzB;AAGO,SAASC,sBAAsBA,CAAA,EAAY;EAChD,OAAOH,UAAU,KAAK,IAAI;AAC5B;AAGO,SAASI,qBAAqBA,CAACC,OAA6B,EAAyB;EAC1FA,OAAO,GAAAC,aAAA,CAAAA,aAAA,KAAOX,gBAAgB,GAAKU,OAAO,CAAC;EAE3C,IAAAE,QAAA,GAAwCF,OAAO;IAAxCT,KAAK,GAAAW,QAAA,CAALX,KAAK;IAAEC,MAAM,GAAAU,QAAA,CAANV,MAAM;IAAEW,MAAM,GAAAD,QAAA,CAANC,MAAM;IAAEC,MAAM,GAAAF,QAAA,CAANE,MAAM;EAEpC,IAAIA,MAAM,IAAI,CAACD,MAAM,EAAE;IACrB,MAAM,IAAIE,KAAK,CAAC,qCAAqC,CAAC;EACxD;EACA,IAAI,CAACV,UAAU,EAAE;IACf,MAAM,IAAIU,KAAK,CAAChB,mBAAmB,CAAC;EACtC;EACA,IAAMiB,EAAE,GAAGX,UAAU,CAACJ,KAAK,EAAEC,MAAM,EAAEQ,OAAO,CAAC;EAC7C,IAAI,CAACM,EAAE,EAAE;IACP,MAAM,IAAID,KAAK,CAACjB,qBAAqB,CAAC;EACxC;EACA,OAAOkB,EAAE;AACX"}
|
|
@@ -3,50 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ERR_WEBGL2 = exports.ERR_WEBGL = void 0;
|
|
7
|
+
exports.assertWebGL2Context = assertWebGL2Context;
|
|
8
|
+
exports.assertWebGLContext = assertWebGLContext;
|
|
9
|
+
exports.getWebGL2Context = getWebGL2Context;
|
|
6
10
|
exports.isWebGL = isWebGL;
|
|
7
11
|
exports.isWebGL2 = isWebGL2;
|
|
8
|
-
exports.getWebGL2Context = getWebGL2Context;
|
|
9
|
-
exports.assertWebGLContext = assertWebGLContext;
|
|
10
|
-
exports.assertWebGL2Context = assertWebGL2Context;
|
|
11
|
-
exports.ERR_WEBGL2 = exports.ERR_WEBGL = void 0;
|
|
12
|
-
|
|
13
12
|
var _api = require("@luma.gl/api");
|
|
14
|
-
|
|
15
13
|
var ERR_CONTEXT = 'Invalid WebGLRenderingContext';
|
|
16
14
|
var ERR_WEBGL = ERR_CONTEXT;
|
|
17
15
|
exports.ERR_WEBGL = ERR_WEBGL;
|
|
18
16
|
var ERR_WEBGL2 = 'Requires WebGL2';
|
|
19
17
|
exports.ERR_WEBGL2 = ERR_WEBGL2;
|
|
20
|
-
|
|
21
18
|
function isWebGL(gl) {
|
|
22
19
|
if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
|
|
23
20
|
return true;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
27
23
|
return true;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return Boolean(gl && Number.isFinite(gl._version));
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
function isWebGL2(gl) {
|
|
34
28
|
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
35
29
|
return true;
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
return Boolean(gl && gl._version === 2);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
function getWebGL2Context(gl) {
|
|
42
34
|
return isWebGL2(gl) ? gl : null;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
function assertWebGLContext(gl) {
|
|
46
37
|
(0, _api.assert)(isWebGL(gl), ERR_CONTEXT);
|
|
47
38
|
return gl;
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
function assertWebGL2Context(gl) {
|
|
51
41
|
(0, _api.assert)(isWebGL2(gl), ERR_WEBGL2);
|
|
52
42
|
return gl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgl-checks.js","names":["_api","require","ERR_CONTEXT","ERR_WEBGL","exports","ERR_WEBGL2","isWebGL","gl","WebGLRenderingContext","WebGL2RenderingContext","Boolean","Number","isFinite","_version","isWebGL2","getWebGL2Context","assertWebGLContext","assert","assertWebGL2Context"],"sources":["../../../../src/context/context/webgl-checks.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {assert} from '@luma.gl/api';\n\nconst ERR_CONTEXT = 'Invalid WebGLRenderingContext';\nexport const ERR_WEBGL = ERR_CONTEXT;\nexport const ERR_WEBGL2 = 'Requires WebGL2';\n\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nexport function isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nexport function isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n\n\n/** Returns a properly typed WebGL2RenderingContext from a WebGL1 context, or null */\nexport function getWebGL2Context(gl: WebGLRenderingContext): WebGL2RenderingContext | null {\n // @ts-expect-error\n return isWebGL2(gl) ? gl : null;\n}\n\n\n/** Throw if supplied parameter is not a WebGLRenderingContext, otherwise return properly typed value */\nexport function assertWebGLContext(gl: any): WebGLRenderingContext {\n assert(isWebGL(gl), ERR_CONTEXT);\n return gl;\n}\n\n/** Throw if supplied parameter is not a WebGL2RenderingContext, otherwise return properly typed value */\nexport function assertWebGL2Context(gl: any): WebGL2RenderingContext {\n assert(isWebGL2(gl), ERR_WEBGL2);\n return gl;\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAMC,WAAW,GAAG,+BAA+B;AAC5C,IAAMC,SAAS,GAAGD,WAAW;AAACE,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAC9B,IAAME,UAAU,GAAG,iBAAiB;AAACD,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAIrC,SAASC,OAAOA,CAACC,EAAO,EAAW;EACxC,IAAI,OAAOC,qBAAqB,KAAK,WAAW,IAAID,EAAE,YAAYC,qBAAqB,EAAE;IACvF,OAAO,IAAI;EACb;EACA,IAAI,OAAOC,sBAAsB,KAAK,WAAW,IAAIF,EAAE,YAAYE,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAACH,EAAE,IAAII,MAAM,CAACC,QAAQ,CAACL,EAAE,CAACM,QAAQ,CAAC,CAAC;AACpD;AAIO,SAASC,QAAQA,CAACP,EAAO,EAAW;EACzC,IAAI,OAAOE,sBAAsB,KAAK,WAAW,IAAIF,EAAE,YAAYE,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAACH,EAAE,IAAIA,EAAE,CAACM,QAAQ,KAAK,CAAC,CAAC;AACzC;AAIO,SAASE,gBAAgBA,CAACR,EAAyB,EAAiC;EAEzF,OAAOO,QAAQ,CAACP,EAAE,CAAC,GAAGA,EAAE,GAAG,IAAI;AACjC;AAIO,SAASS,kBAAkBA,CAACT,EAAO,EAAyB;EACjE,IAAAU,WAAM,EAACX,OAAO,CAACC,EAAE,CAAC,EAAEL,WAAW,CAAC;EAChC,OAAOK,EAAE;AACX;AAGO,SAASW,mBAAmBA,CAACX,EAAO,EAA0B;EACnE,IAAAU,WAAM,EAACH,QAAQ,CAACP,EAAE,CAAC,EAAEF,UAAU,CAAC;EAChC,OAAOE,EAAE;AACX"}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.loadSpectorJS = loadSpectorJS;
|
|
9
7
|
exports.initializeSpectorJS = initializeSpectorJS;
|
|
10
|
-
|
|
8
|
+
exports.loadSpectorJS = loadSpectorJS;
|
|
11
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
|
|
13
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
|
|
15
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
|
-
|
|
17
12
|
var _api = require("@luma.gl/api");
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
-
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
15
|
var DEFAULT_SPECTOR_PROPS = {
|
|
24
16
|
spector: _api.log.get('spector') || _api.log.get('inspect')
|
|
25
17
|
};
|
|
@@ -27,72 +19,54 @@ var SPECTOR_CDN_URL = 'https://spectorcdn.babylonjs.com/spector.bundle.js';
|
|
|
27
19
|
var LOG_LEVEL = 1;
|
|
28
20
|
var spector = null;
|
|
29
21
|
var initialized = false;
|
|
30
|
-
|
|
31
22
|
function loadSpectorJS(_x) {
|
|
32
23
|
return _loadSpectorJS.apply(this, arguments);
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
function _loadSpectorJS() {
|
|
36
26
|
_loadSpectorJS = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(props) {
|
|
37
27
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
38
|
-
while (1) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (globalThis.SPECTOR) {
|
|
42
|
-
_context.next = 9;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_context.prev = 1;
|
|
47
|
-
_context.next = 4;
|
|
48
|
-
return (0, _api.loadScript)(SPECTOR_CDN_URL);
|
|
49
|
-
|
|
50
|
-
case 4:
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
if (globalThis.SPECTOR) {
|
|
51
31
|
_context.next = 9;
|
|
52
32
|
break;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
}
|
|
34
|
+
_context.prev = 1;
|
|
35
|
+
_context.next = 4;
|
|
36
|
+
return (0, _api.loadScript)(SPECTOR_CDN_URL);
|
|
37
|
+
case 4:
|
|
38
|
+
_context.next = 9;
|
|
39
|
+
break;
|
|
40
|
+
case 6:
|
|
41
|
+
_context.prev = 6;
|
|
42
|
+
_context.t0 = _context["catch"](1);
|
|
43
|
+
_api.log.warn(String(_context.t0));
|
|
44
|
+
case 9:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
64
47
|
}
|
|
65
48
|
}, _callee, null, [[1, 6]]);
|
|
66
49
|
}));
|
|
67
50
|
return _loadSpectorJS.apply(this, arguments);
|
|
68
51
|
}
|
|
69
|
-
|
|
70
52
|
function initializeSpectorJS(props) {
|
|
71
53
|
var _props, _props2;
|
|
72
|
-
|
|
73
54
|
props = _objectSpread(_objectSpread({}, DEFAULT_SPECTOR_PROPS), props);
|
|
74
|
-
|
|
75
55
|
if (!((_props = props) !== null && _props !== void 0 && _props.spector)) {
|
|
76
56
|
return null;
|
|
77
57
|
}
|
|
78
|
-
|
|
79
58
|
if (!spector && globalThis.SPECTOR) {
|
|
80
59
|
_api.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
|
|
81
|
-
|
|
82
60
|
spector = new globalThis.SPECTOR.Spector();
|
|
83
|
-
|
|
84
61
|
if (globalThis.luma) {
|
|
85
62
|
globalThis.luma.spector = spector;
|
|
86
63
|
}
|
|
87
64
|
}
|
|
88
|
-
|
|
89
65
|
if (!spector) {
|
|
90
66
|
return null;
|
|
91
67
|
}
|
|
92
|
-
|
|
93
68
|
if (!initialized) {
|
|
94
69
|
var _spector, _spector2;
|
|
95
|
-
|
|
96
70
|
initialized = true;
|
|
97
71
|
spector.spyCanvases();
|
|
98
72
|
(_spector = spector) === null || _spector === void 0 ? void 0 : _spector.onCaptureStarted.add(function (capture) {
|
|
@@ -100,34 +74,26 @@ function initializeSpectorJS(props) {
|
|
|
100
74
|
});
|
|
101
75
|
(_spector2 = spector) === null || _spector2 === void 0 ? void 0 : _spector2.onCapture.add(function (capture) {
|
|
102
76
|
var _spector3, _spector4, _spector5;
|
|
103
|
-
|
|
104
77
|
_api.log.info("Spector capture complete:", capture)();
|
|
105
|
-
|
|
106
78
|
(_spector3 = spector) === null || _spector3 === void 0 ? void 0 : _spector3.getResultUI();
|
|
107
79
|
(_spector4 = spector) === null || _spector4 === void 0 ? void 0 : _spector4.resultView.display();
|
|
108
80
|
(_spector5 = spector) === null || _spector5 === void 0 ? void 0 : _spector5.resultView.addCapture(capture);
|
|
109
81
|
});
|
|
110
82
|
}
|
|
111
|
-
|
|
112
83
|
if ((_props2 = props) !== null && _props2 !== void 0 && _props2.canvas) {
|
|
113
84
|
var _spector6, _props3;
|
|
114
|
-
|
|
115
85
|
if (typeof props.spector === 'string' && props.spector !== props.canvas.id) {
|
|
116
86
|
return spector;
|
|
117
87
|
}
|
|
118
|
-
|
|
119
88
|
(_spector6 = spector) === null || _spector6 === void 0 ? void 0 : _spector6.startCapture((_props3 = props) === null || _props3 === void 0 ? void 0 : _props3.canvas, 500);
|
|
120
89
|
new Promise(function (resolve) {
|
|
121
90
|
return setTimeout(resolve, 2000);
|
|
122
91
|
}).then(function (_) {
|
|
123
92
|
var _spector7;
|
|
124
|
-
|
|
125
93
|
_api.log.info("Spector capture stopped after 2 seconds")();
|
|
126
|
-
|
|
127
94
|
(_spector7 = spector) === null || _spector7 === void 0 ? void 0 : _spector7.stopCapture();
|
|
128
95
|
});
|
|
129
96
|
}
|
|
130
|
-
|
|
131
97
|
return spector;
|
|
132
98
|
}
|
|
133
99
|
//# sourceMappingURL=spector.js.map
|