@luma.gl/webgl 9.0.0-alpha.4 → 9.0.0-alpha.41
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 +3 -1
- package/dist/adapter/converters/device-parameters.d.ts +23 -4
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +42 -47
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +5 -5
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +20 -56
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/shader-formats.d.ts +9 -0
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -0
- package/dist/adapter/converters/shader-formats.js +53 -0
- package/dist/adapter/converters/shader-formats.js.map +1 -0
- package/dist/adapter/converters/texture-formats.d.ts +32 -44
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +165 -201
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +9 -3
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +51 -19
- 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 +14 -21
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +3 -3
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +2 -5
- 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 +9 -11
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -1
- package/dist/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.d.ts +26 -0
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -0
- package/dist/adapter/helpers/{uniforms.js → decode-webgl-types.js} +20 -29
- package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
- 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 +25 -0
- package/dist/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/adapter/helpers/get-shader-layout.d.ts +1 -48
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +60 -115
- 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 +0 -7
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +27 -57
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.d.ts +11 -0
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -0
- package/dist/adapter/helpers/{attribute-utils.js → webgl-topology-utils.js} +2 -19
- package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +2 -29
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +34 -41
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +6 -9
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +26 -83
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +18 -10
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +49 -78
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +169 -43
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +10 -20
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +21 -24
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +46 -155
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +91 -11
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +53 -19
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +108 -230
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +10 -19
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +3 -4
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +19 -31
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +64 -44
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +119 -235
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.d.ts +67 -0
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-vertex-array.js +166 -0
- package/dist/adapter/resources/webgl-vertex-array.js.map +1 -0
- package/dist/adapter/webgl-canvas-context.d.ts +6 -7
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +10 -23
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +74 -41
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +214 -128
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +3 -3
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +23 -48
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/{buffer.d.ts → buffer-with-accessor.d.ts} +16 -29
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
- package/dist/classic/{buffer.js → buffer-with-accessor.js} +55 -125
- package/dist/classic/buffer-with-accessor.js.map +1 -0
- package/dist/classic/clear.d.ts +22 -0
- package/dist/classic/clear.d.ts.map +1 -0
- package/dist/classic/clear.js +88 -0
- package/dist/classic/clear.js.map +1 -0
- package/dist/classic/copy-and-blit.d.ts +62 -0
- package/dist/classic/copy-and-blit.d.ts.map +1 -0
- package/dist/classic/copy-and-blit.js +200 -0
- package/dist/classic/copy-and-blit.js.map +1 -0
- package/dist/classic/format-utils.d.ts +3 -0
- package/dist/classic/format-utils.d.ts.map +1 -0
- package/dist/classic/format-utils.js +38 -0
- package/dist/classic/format-utils.js.map +1 -0
- package/dist/classic/typed-array-utils.d.ts +15 -17
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +1 -21
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/create-browser-context.d.ts +40 -0
- package/dist/context/context/create-browser-context.d.ts.map +1 -0
- package/dist/context/context/create-browser-context.js +53 -0
- package/dist/context/context/create-browser-context.js.map +1 -0
- package/dist/context/context/create-headless-context.d.ts +9 -0
- package/dist/context/context/create-headless-context.d.ts.map +1 -0
- package/dist/context/context/create-headless-context.js +42 -0
- package/dist/context/context/create-headless-context.js.map +1 -0
- package/dist/context/context/webgl-checks.d.ts.map +1 -1
- package/dist/context/context/webgl-checks.js +1 -4
- package/dist/context/context/webgl-checks.js.map +1 -1
- 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 +8 -20
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +16 -39
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +9 -8
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +9 -19
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts +105 -106
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +18 -36
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfill/context-data.d.ts +13 -0
- package/dist/context/polyfill/context-data.d.ts.map +1 -0
- package/dist/context/polyfill/context-data.js +12 -0
- package/dist/context/polyfill/context-data.js.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +4 -9
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +22 -30
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.d.ts +8 -8
- package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +10 -32
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +26 -62
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts +2 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +8 -10
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +10391 -0
- package/dist/index.cjs +6625 -0
- package/dist/index.d.ts +27 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -26
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist.min.js +37 -0
- package/package.json +21 -9
- package/src/adapter/converters/device-parameters.ts +124 -36
- package/src/adapter/converters/sampler-parameters.ts +22 -9
- package/src/adapter/converters/shader-formats.ts +44 -0
- package/src/adapter/converters/texture-formats.ts +267 -194
- package/src/adapter/converters/vertex-formats.ts +71 -10
- package/src/adapter/device-helpers/device-features.ts +13 -3
- package/src/adapter/device-helpers/device-limits.ts +5 -3
- package/src/adapter/device-helpers/get-device-info.ts +17 -10
- package/src/adapter/device-helpers/is-old-ie.ts +3 -0
- package/src/adapter/helpers/{uniforms.ts → decode-webgl-types.ts} +39 -21
- package/src/adapter/helpers/get-shader-info.ts +41 -0
- package/src/adapter/helpers/get-shader-layout.ts +121 -146
- package/src/adapter/helpers/parse-shader-compiler-log.ts +4 -2
- package/src/adapter/helpers/set-uniform.ts +39 -35
- package/src/adapter/helpers/{attribute-utils.ts → webgl-topology-utils.ts} +7 -5
- package/src/adapter/objects/constants-to-keys.ts +6 -25
- package/src/adapter/objects/webgl-renderbuffer.ts +43 -37
- package/src/adapter/objects/webgl-resource.ts +16 -23
- package/src/adapter/resources/webgl-buffer.ts +59 -58
- package/src/adapter/resources/webgl-command-buffer.ts +333 -25
- package/src/adapter/resources/webgl-command-encoder.ts +20 -12
- package/src/adapter/resources/webgl-external-texture.ts +5 -2
- package/src/adapter/resources/webgl-framebuffer.ts +89 -133
- package/src/adapter/resources/webgl-render-pass.ts +160 -4
- package/src/adapter/resources/webgl-render-pipeline.ts +265 -170
- package/src/adapter/resources/webgl-sampler.ts +15 -9
- package/src/adapter/resources/webgl-shader.ts +14 -11
- package/src/adapter/resources/webgl-texture.ts +120 -90
- package/src/adapter/resources/webgl-vertex-array.ts +279 -0
- package/src/adapter/webgl-canvas-context.ts +16 -14
- package/src/adapter/webgl-device.ts +321 -78
- package/src/classic/accessor.ts +7 -17
- package/src/classic/{buffer.ts → buffer-with-accessor.ts} +68 -76
- package/src/classic/clear.ts +113 -0
- package/src/classic/copy-and-blit.ts +314 -0
- package/src/classic/format-utils.ts +46 -0
- package/src/classic/typed-array-utils.ts +19 -27
- package/src/context/context/create-browser-context.ts +140 -0
- package/src/context/context/create-headless-context.ts +51 -0
- package/src/context/context/webgl-checks.ts +3 -1
- package/src/context/debug/spector.ts +9 -6
- package/src/context/debug/webgl-developer-tools.ts +23 -15
- package/src/context/parameters/unified-parameter-api.ts +23 -14
- package/src/context/parameters/webgl-parameter-tables.ts +120 -98
- package/src/context/polyfill/context-data.ts +30 -0
- package/src/context/polyfill/get-parameter-polyfill.ts +11 -7
- package/src/context/polyfill/polyfill-context.ts +10 -9
- package/src/context/polyfill/polyfill-table.ts +21 -16
- package/src/context/polyfill/polyfill-vertex-array-object.ts +5 -0
- package/src/context/state-tracker/deep-array-equal.ts +2 -0
- package/src/context/state-tracker/track-context-state.ts +20 -16
- package/src/context/state-tracker/with-parameters.ts +13 -4
- package/src/index.ts +69 -35
- package/src/types.ts +5 -0
- package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
- package/dist/adapter/converters/renderbuffer-formats.js +0 -185
- package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/adapter/helpers/attribute-utils.d.ts +0 -11
- package/dist/adapter/helpers/attribute-utils.d.ts.map +0 -1
- package/dist/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/adapter/helpers/uniforms.d.ts +0 -26
- package/dist/adapter/helpers/uniforms.d.ts.map +0 -1
- package/dist/adapter/helpers/uniforms.js.map +0 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +0 -27
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +0 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +0 -84
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/classic/buffer.d.ts.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
- package/dist/context/context/context-state.d.ts +0 -18
- package/dist/context/context/context-state.d.ts.map +0 -1
- package/dist/context/context/context-state.js +0 -26
- package/dist/context/context/context-state.js.map +0 -1
- package/dist/context/context/create-context.d.ts +0 -41
- package/dist/context/context/create-context.d.ts.map +0 -1
- package/dist/context/context/create-context.js +0 -49
- package/dist/context/context/create-context.js.map +0 -1
- package/dist/context/context/device-pixels.d.ts +0 -25
- package/dist/context/context/device-pixels.d.ts.map +0 -1
- package/dist/context/context/device-pixels.js +0 -98
- package/dist/context/context/device-pixels.js.map +0 -1
- package/dist/es5/adapter/converters/device-parameters.js +0 -170
- package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
- package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/texture-formats.js +0 -1031
- package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -45
- package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-features.js +0 -144
- package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
- package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
- package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -125
- package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/es5/adapter/helpers/uniforms.js +0 -112
- package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
- package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-resource.js +0 -292
- package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
- package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
- package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-shader.js +0 -149
- package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-texture.js +0 -986
- package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -97
- package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/es5/adapter/webgl-device.js +0 -399
- package/dist/es5/adapter/webgl-device.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/classic/accessor.js +0 -181
- package/dist/es5/classic/accessor.js.map +0 -1
- package/dist/es5/classic/buffer.js +0 -470
- package/dist/es5/classic/buffer.js.map +0 -1
- package/dist/es5/classic/typed-array-utils.js +0 -126
- package/dist/es5/classic/typed-array-utils.js.map +0 -1
- package/dist/es5/context/context/context-state.js +0 -31
- package/dist/es5/context/context/context-state.js.map +0 -1
- package/dist/es5/context/context/create-context.js +0 -69
- package/dist/es5/context/context/create-context.js.map +0 -1
- package/dist/es5/context/context/device-pixels.js +0 -115
- package/dist/es5/context/context/device-pixels.js.map +0 -1
- package/dist/es5/context/context/webgl-checks.js +0 -54
- package/dist/es5/context/context/webgl-checks.js.map +0 -1
- package/dist/es5/context/debug/spector.js +0 -133
- package/dist/es5/context/debug/spector.js.map +0 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
- package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
- package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-context.js +0 -135
- package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-table.js +0 -166
- package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/es5/context/state-tracker/track-context-state.js +0 -211
- package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/es5/context/state-tracker/with-parameters.js +0 -44
- package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/es5/index.js +0 -276
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/init.js +0 -10
- package/dist/es5/init.js.map +0 -1
- package/dist/es5/types/webgl.js +0 -6
- package/dist/es5/types/webgl.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -155
- package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
- package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/texture-formats.js +0 -954
- package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -35
- package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-features.js +0 -102
- package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
- package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
- package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -115
- package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -99
- package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
- package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-resource.js +0 -216
- package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
- package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
- package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-shader.js +0 -75
- package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-texture.js +0 -831
- package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -54
- package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/esm/adapter/webgl-device.js +0 -280
- package/dist/esm/adapter/webgl-device.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/classic/accessor.js +0 -144
- package/dist/esm/classic/accessor.js.map +0 -1
- package/dist/esm/classic/buffer.js +0 -384
- package/dist/esm/classic/buffer.js.map +0 -1
- package/dist/esm/classic/typed-array-utils.js +0 -112
- package/dist/esm/classic/typed-array-utils.js.map +0 -1
- package/dist/esm/context/context/context-state.js +0 -26
- package/dist/esm/context/context/context-state.js.map +0 -1
- package/dist/esm/context/context/create-context.js +0 -49
- package/dist/esm/context/context/create-context.js.map +0 -1
- package/dist/esm/context/context/device-pixels.js +0 -98
- package/dist/esm/context/context/device-pixels.js.map +0 -1
- package/dist/esm/context/context/webgl-checks.js +0 -34
- package/dist/esm/context/context/webgl-checks.js.map +0 -1
- package/dist/esm/context/debug/spector.js +0 -76
- package/dist/esm/context/debug/spector.js.map +0 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
- package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
- package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-context.js +0 -92
- package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -160
- package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/esm/context/state-tracker/track-context-state.js +0 -183
- package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -36
- package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/init.js +0 -4
- package/dist/esm/init.js.map +0 -1
- package/dist/esm/types/webgl.js +0 -2
- package/dist/esm/types/webgl.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/dist/types/webgl.d.ts +0 -144
- package/dist/types/webgl.d.ts.map +0 -1
- package/dist/types/webgl.js +0 -2
- package/dist/types/webgl.js.map +0 -1
- package/src/adapter/converters/renderbuffer-formats.ts +0 -92
- package/src/adapter/objects/webgl-vertex-array-object.ts +0 -111
- package/src/bundle.ts +0 -4
- package/src/context/context/context-state.ts +0 -41
- package/src/context/context/create-context.ts +0 -110
- package/src/context/context/device-pixels.ts +0 -152
- package/src/init.ts +0 -4
- package/src/types/webgl.ts +0 -283
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// luma.gl, MIT license
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ContextProps
|
|
5
|
-
* @param webgl2 Set to false to not create a WebGL2 context (force webgl1)
|
|
6
|
-
* @param webgl1 set to false to not create a WebGL1 context (fail if webgl2 not available)
|
|
7
|
-
* @param onContextLost
|
|
8
|
-
* @param onContextRestored
|
|
9
|
-
*
|
|
10
|
-
* BROWSER CONTEXT PARAMETERS
|
|
11
|
-
* @param debug Instrument context (at the expense of performance).
|
|
12
|
-
* @param alpha Default render target has an alpha buffer.
|
|
13
|
-
* @param depth Default render target has a depth buffer of at least 16 bits.
|
|
14
|
-
* @param stencil Default render target has a stencil buffer of at least 8 bits.
|
|
15
|
-
* @param antialias Boolean that indicates whether or not to perform anti-aliasing.
|
|
16
|
-
* @param premultipliedAlpha Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.
|
|
17
|
-
* @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten
|
|
18
|
-
* @param failIfMajorPerformanceCaveat Do not create if the system performance is low.
|
|
19
|
-
*/
|
|
20
|
-
type ContextProps = {
|
|
21
|
-
type?: 'webgl' | 'webgl1' | 'webgl2' | string;
|
|
22
|
-
webgl1?: boolean;
|
|
23
|
-
webgl2?: boolean;
|
|
24
|
-
onContextLost?: (event: Event) => void;
|
|
25
|
-
onContextRestored?: (event: Event) => void;
|
|
26
|
-
alpha?: boolean; // indicates if the canvas contains an alpha buffer.
|
|
27
|
-
desynchronized?: boolean; // hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop
|
|
28
|
-
antialias?: boolean; // indicates whether or not to perform anti-aliasing.
|
|
29
|
-
depth?: boolean; // indicates that the drawing buffer has a depth buffer of at least 16 bits.
|
|
30
|
-
failIfMajorPerformanceCaveat?: boolean, // indicates if a context will be created if the system performance is low or if no hardware GPU is available.
|
|
31
|
-
powerPreference?: 'default' | 'high-performance' | 'low-power',
|
|
32
|
-
premultipliedAlpha?: boolean, // page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.
|
|
33
|
-
preserveDrawingBuffer?: boolean // buffers will not be cleared and will preserve their values until cleared or overwritten by the author.
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const DEFAULT_CONTEXT_PROPS: ContextProps = {
|
|
37
|
-
webgl2: true, // Attempt to create a WebGL2 context
|
|
38
|
-
webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)
|
|
39
|
-
powerPreference: 'high-performance', // After all, most apps are using WebGL for performance reasons
|
|
40
|
-
onContextLost: () => console.error('WebGL context lost'),
|
|
41
|
-
onContextRestored: () => console.info('WebGL context restored'),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Create a WebGL context for a canvas
|
|
46
|
-
* Note calling this multiple time on the same canvas does return the same context
|
|
47
|
-
* @param canvas A canvas element or offscreen canvas
|
|
48
|
-
*/
|
|
49
|
-
export function createBrowserContext(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): WebGLRenderingContext {
|
|
50
|
-
props = {...DEFAULT_CONTEXT_PROPS, ...props};
|
|
51
|
-
|
|
52
|
-
// Try to extract any extra information about why context creation failed
|
|
53
|
-
let errorMessage = null;
|
|
54
|
-
const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);
|
|
55
|
-
canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
|
|
56
|
-
|
|
57
|
-
// Create the desired context
|
|
58
|
-
let gl = null;
|
|
59
|
-
|
|
60
|
-
if (props.type === 'webgl2') {
|
|
61
|
-
props = {...props, webgl1: false};
|
|
62
|
-
}
|
|
63
|
-
if (props.type === 'webgl1') {
|
|
64
|
-
props = {...props, webgl2: false};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Prefer webgl2 over webgl1 if both are acceptable
|
|
68
|
-
if (props.webgl2) {
|
|
69
|
-
gl = gl || canvas.getContext('webgl2', props);
|
|
70
|
-
}
|
|
71
|
-
if (props.webgl1) {
|
|
72
|
-
gl = gl || canvas.getContext('webgl', props);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// TODO are we removing this listener before giving it a chance to fire?
|
|
76
|
-
canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
|
|
77
|
-
|
|
78
|
-
if (!gl) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
`Failed to create ${props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL'} context: ${
|
|
81
|
-
errorMessage || 'Unknown error'
|
|
82
|
-
}`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
canvas.addEventListener('webglcontextlost', props.onContextLost, false);
|
|
87
|
-
canvas.addEventListener('webglcontextrestored', props.onContextRestored, false);
|
|
88
|
-
|
|
89
|
-
return gl;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* TODO - can we call this asynchronously to catch the error events?
|
|
93
|
-
export async function createBrowserContextAsync(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): Promise<WebGLRenderingContext> {
|
|
94
|
-
props = {...DEFAULT_CONTEXT_PROPS, ...props};
|
|
95
|
-
|
|
96
|
-
// Try to extract any extra information about why context creation failed
|
|
97
|
-
let errorMessage = null;
|
|
98
|
-
const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);
|
|
99
|
-
canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
|
|
100
|
-
|
|
101
|
-
const gl = createBrowserContext(canvas, props);
|
|
102
|
-
|
|
103
|
-
// Give the listener a chance to fire
|
|
104
|
-
await new Promise(resolve => setTimeout(resolve, 0));
|
|
105
|
-
|
|
106
|
-
canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
|
|
107
|
-
|
|
108
|
-
return gl;
|
|
109
|
-
}
|
|
110
|
-
*/
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import {log} from '@luma.gl/api';
|
|
2
|
-
import {getContextState} from './context-state';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns multiplier need to convert CSS size to Device size
|
|
6
|
-
*/
|
|
7
|
-
export function cssToDeviceRatio(gl: WebGLRenderingContext): number {
|
|
8
|
-
const state = getContextState(gl);
|
|
9
|
-
|
|
10
|
-
if (gl.canvas && state) {
|
|
11
|
-
// For headless gl we might have used custom width and height
|
|
12
|
-
// hence use cached clientWidth
|
|
13
|
-
const {clientWidth} = state._canvasSizeInfo;
|
|
14
|
-
return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
|
|
15
|
-
}
|
|
16
|
-
// use default device pixel ratio
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Maps CSS pixel position to device pixel position
|
|
22
|
-
*/
|
|
23
|
-
export function cssToDevicePixels(
|
|
24
|
-
gl: WebGLRenderingContext,
|
|
25
|
-
cssPixel: number[],
|
|
26
|
-
yInvert: boolean = true
|
|
27
|
-
): {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
} {
|
|
33
|
-
const ratio = cssToDeviceRatio(gl);
|
|
34
|
-
const width = gl.drawingBufferWidth;
|
|
35
|
-
const height = gl.drawingBufferHeight;
|
|
36
|
-
return scalePixels(cssPixel, ratio, width, height, yInvert);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Calulates device pixel ratio, used during context creation
|
|
41
|
-
*
|
|
42
|
-
* @param useDevicePixels - boolean or a number
|
|
43
|
-
* @return - device pixel ratio
|
|
44
|
-
*/
|
|
45
|
-
export function getDevicePixelRatio(useDevicePixels: boolean | number): number {
|
|
46
|
-
const windowRatio = typeof window === 'undefined' ? 1 : window.devicePixelRatio || 1;
|
|
47
|
-
if (Number.isFinite(useDevicePixels)) {
|
|
48
|
-
// @ts-expect-error Can no longer be boolean after previous line
|
|
49
|
-
return useDevicePixels <= 0 ? 1 : useDevicePixels;
|
|
50
|
-
}
|
|
51
|
-
return useDevicePixels ? windowRatio : 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// use devicePixelRatio to set canvas width and height
|
|
55
|
-
export function setDevicePixelRatio(gl: WebGLRenderingContext, devicePixelRatio: number, options: {width?: number, height?: number} = {}) {
|
|
56
|
-
// NOTE: if options.width and options.height not used remove in v8
|
|
57
|
-
let clientWidth = 'width' in options ? options.width : gl.canvas.clientWidth;
|
|
58
|
-
let clientHeight = 'height' in options ? options.height : gl.canvas.clientHeight;
|
|
59
|
-
|
|
60
|
-
if (!clientWidth || !clientHeight) {
|
|
61
|
-
log.log(1, 'Canvas clientWidth/clientHeight is 0')();
|
|
62
|
-
// by forcing devicePixel ratio to 1, we do not scale gl.canvas.width and height in each frame.
|
|
63
|
-
devicePixelRatio = 1;
|
|
64
|
-
clientWidth = gl.canvas.width || 1;
|
|
65
|
-
clientHeight = gl.canvas.height || 1;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const contextState = getContextState(gl);
|
|
69
|
-
const cachedSize = contextState._canvasSizeInfo;
|
|
70
|
-
// Check if canvas needs to be resized
|
|
71
|
-
if (
|
|
72
|
-
cachedSize.clientWidth !== clientWidth ||
|
|
73
|
-
cachedSize.clientHeight !== clientHeight ||
|
|
74
|
-
cachedSize.devicePixelRatio !== devicePixelRatio
|
|
75
|
-
) {
|
|
76
|
-
let clampedPixelRatio = devicePixelRatio;
|
|
77
|
-
|
|
78
|
-
const canvasWidth = Math.floor(clientWidth * clampedPixelRatio);
|
|
79
|
-
const canvasHeight = Math.floor(clientHeight * clampedPixelRatio);
|
|
80
|
-
gl.canvas.width = canvasWidth;
|
|
81
|
-
gl.canvas.height = canvasHeight;
|
|
82
|
-
|
|
83
|
-
// Note: when devicePixelRatio is too high, it is possible we might hit system limit for
|
|
84
|
-
// drawing buffer width and hight, in those cases they get clamped and resulting aspect ration may not be maintained
|
|
85
|
-
// for those cases, reduce devicePixelRatio.
|
|
86
|
-
if (gl.drawingBufferWidth !== canvasWidth || gl.drawingBufferHeight !== canvasHeight) {
|
|
87
|
-
log.warn(`Device pixel ratio clamped`)();
|
|
88
|
-
clampedPixelRatio = Math.min(
|
|
89
|
-
gl.drawingBufferWidth / clientWidth,
|
|
90
|
-
gl.drawingBufferHeight / clientHeight
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
gl.canvas.width = Math.floor(clientWidth * clampedPixelRatio);
|
|
94
|
-
gl.canvas.height = Math.floor(clientHeight * clampedPixelRatio);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
Object.assign(contextState._canvasSizeInfo, {clientWidth, clientHeight, devicePixelRatio});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// PRIVATE
|
|
103
|
-
|
|
104
|
-
function scalePixels(pixel: number[], ratio: number, width: number, height: number, yInvert: boolean): {
|
|
105
|
-
x: number;
|
|
106
|
-
y: number;
|
|
107
|
-
width: number;
|
|
108
|
-
height: number;
|
|
109
|
-
} {
|
|
110
|
-
const x = scaleX(pixel[0], ratio, width);
|
|
111
|
-
let y = scaleY(pixel[1], ratio, height, yInvert);
|
|
112
|
-
|
|
113
|
-
// Find boundaries of next pixel to provide valid range of device pixel locaitons
|
|
114
|
-
|
|
115
|
-
let t = scaleX(pixel[0] + 1, ratio, width);
|
|
116
|
-
// If next pixel's position is clamped to boundary, use it as is, otherwise subtract 1 for current pixel boundary
|
|
117
|
-
const xHigh = t === width - 1 ? t : t - 1;
|
|
118
|
-
|
|
119
|
-
t = scaleY(pixel[1] + 1, ratio, height, yInvert);
|
|
120
|
-
let yHigh;
|
|
121
|
-
if (yInvert) {
|
|
122
|
-
// If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range
|
|
123
|
-
t = t === 0 ? t : t + 1;
|
|
124
|
-
// swap y and yHigh
|
|
125
|
-
yHigh = y;
|
|
126
|
-
y = t;
|
|
127
|
-
} else {
|
|
128
|
-
// If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range
|
|
129
|
-
yHigh = t === height - 1 ? t : t - 1;
|
|
130
|
-
// y remains same
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
x,
|
|
134
|
-
y,
|
|
135
|
-
// when ratio < 1, current css pixel and next css pixel may point to same device pixel, set width/height to 1 in those cases.
|
|
136
|
-
width: Math.max(xHigh - x + 1, 1),
|
|
137
|
-
height: Math.max(yHigh - y + 1, 1)
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function scaleX(x: number, ratio: number, width: number): number {
|
|
142
|
-
// since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit
|
|
143
|
-
const r = Math.min(Math.round(x * ratio), width - 1);
|
|
144
|
-
return r;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function scaleY(y: number, ratio: number, height: number, yInvert: boolean): number {
|
|
148
|
-
// since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit
|
|
149
|
-
return yInvert
|
|
150
|
-
? Math.max(0, height - 1 - Math.round(y * ratio))
|
|
151
|
-
: Math.min(Math.round(y * ratio), height - 1);
|
|
152
|
-
}
|
package/src/init.ts
DELETED
package/src/types/webgl.ts
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import type {NumberArray} from '@luma.gl/api';
|
|
2
|
-
import GL from '@luma.gl/constants';
|
|
3
|
-
|
|
4
|
-
type Framebuffer = any;
|
|
5
|
-
|
|
6
|
-
export type GLDrawMode =
|
|
7
|
-
| GL.POINTS
|
|
8
|
-
| GL.LINES
|
|
9
|
-
| GL.LINE_STRIP
|
|
10
|
-
| GL.LINE_LOOP
|
|
11
|
-
| GL.TRIANGLES
|
|
12
|
-
| GL.TRIANGLE_STRIP
|
|
13
|
-
| GL.TRIANGLE_FAN;
|
|
14
|
-
|
|
15
|
-
export type GLPrimitive = GL.POINTS | GL.LINES | GL.TRIANGLES;
|
|
16
|
-
|
|
17
|
-
export type GLType =
|
|
18
|
-
| GL.FLOAT
|
|
19
|
-
| GL.UNSIGNED_SHORT
|
|
20
|
-
| GL.UNSIGNED_INT
|
|
21
|
-
| GL.UNSIGNED_BYTE
|
|
22
|
-
| GL.BYTE
|
|
23
|
-
| GL.SHORT
|
|
24
|
-
| GL.INT;
|
|
25
|
-
|
|
26
|
-
export type GLPackedType =
|
|
27
|
-
| GL.UNSIGNED_SHORT_5_6_5
|
|
28
|
-
| GL.UNSIGNED_SHORT_4_4_4_4
|
|
29
|
-
| GL.UNSIGNED_SHORT_5_5_5_1;
|
|
30
|
-
|
|
31
|
-
export type GLUniformType = GLSamplerType | GLCompositeType;
|
|
32
|
-
|
|
33
|
-
export type GLSamplerType =
|
|
34
|
-
| GL.SAMPLER_2D
|
|
35
|
-
| GL.SAMPLER_CUBE
|
|
36
|
-
| GL.SAMPLER_3D
|
|
37
|
-
| GL.SAMPLER_2D_SHADOW
|
|
38
|
-
| GL.SAMPLER_2D_ARRAY
|
|
39
|
-
| GL.SAMPLER_2D_ARRAY_SHADOW
|
|
40
|
-
| GL.SAMPLER_CUBE_SHADOW
|
|
41
|
-
| GL.INT_SAMPLER_2D
|
|
42
|
-
| GL.INT_SAMPLER_3D
|
|
43
|
-
| GL.INT_SAMPLER_CUBE
|
|
44
|
-
| GL.INT_SAMPLER_2D_ARRAY
|
|
45
|
-
| GL.UNSIGNED_INT_SAMPLER_2D
|
|
46
|
-
| GL.UNSIGNED_INT_SAMPLER_3D
|
|
47
|
-
| GL.UNSIGNED_INT_SAMPLER_CUBE
|
|
48
|
-
| GL.UNSIGNED_INT_SAMPLER_2D_ARRAY;
|
|
49
|
-
|
|
50
|
-
// Composite types table
|
|
51
|
-
export type GLCompositeType =
|
|
52
|
-
| GL.FLOAT
|
|
53
|
-
| GL.FLOAT_VEC2
|
|
54
|
-
| GL.FLOAT_VEC3
|
|
55
|
-
| GL.FLOAT_VEC4
|
|
56
|
-
| GL.INT
|
|
57
|
-
| GL.INT_VEC2
|
|
58
|
-
| GL.INT_VEC3
|
|
59
|
-
| GL.INT_VEC4
|
|
60
|
-
| GL.UNSIGNED_INT
|
|
61
|
-
| GL.UNSIGNED_INT_VEC2
|
|
62
|
-
| GL.UNSIGNED_INT_VEC3
|
|
63
|
-
| GL.UNSIGNED_INT_VEC4
|
|
64
|
-
| GL.BOOL
|
|
65
|
-
| GL.BOOL_VEC2
|
|
66
|
-
| GL.BOOL_VEC3
|
|
67
|
-
| GL.BOOL_VEC4
|
|
68
|
-
| GL.FLOAT_MAT2
|
|
69
|
-
| GL.FLOAT_MAT2x3
|
|
70
|
-
| GL.FLOAT_MAT2x4
|
|
71
|
-
| GL.FLOAT_MAT3x2
|
|
72
|
-
| GL.FLOAT_MAT3
|
|
73
|
-
| GL.FLOAT_MAT3x4
|
|
74
|
-
| GL.FLOAT_MAT4x2
|
|
75
|
-
| GL.FLOAT_MAT4x3
|
|
76
|
-
| GL.FLOAT_MAT4;
|
|
77
|
-
|
|
78
|
-
export type GLFunction =
|
|
79
|
-
| GL.NEVER
|
|
80
|
-
| GL.LESS
|
|
81
|
-
| GL.EQUAL
|
|
82
|
-
| GL.LEQUAL
|
|
83
|
-
| GL.GREATER
|
|
84
|
-
| GL.NOTEQUAL
|
|
85
|
-
| GL.GEQUAL
|
|
86
|
-
| GL.ALWAYS;
|
|
87
|
-
|
|
88
|
-
export type GLBlendEquation =
|
|
89
|
-
| GL.FUNC_ADD
|
|
90
|
-
| GL.FUNC_SUBTRACT
|
|
91
|
-
| GL.FUNC_REVERSE_SUBTRACT
|
|
92
|
-
| GL.MIN_EXT
|
|
93
|
-
| GL.MAX_EXT;
|
|
94
|
-
|
|
95
|
-
export type GLBlendFunction =
|
|
96
|
-
| GL.ZERO
|
|
97
|
-
| GL.ONE
|
|
98
|
-
| GL.SRC_COLOR
|
|
99
|
-
| GL.ONE_MINUS_SRC_COLOR
|
|
100
|
-
| GL.DST_COLOR
|
|
101
|
-
| GL.ONE_MINUS_DST_COLOR
|
|
102
|
-
| GL.SRC_ALPHA
|
|
103
|
-
| GL.ONE_MINUS_SRC_ALPHA
|
|
104
|
-
| GL.DST_ALPHA
|
|
105
|
-
| GL.ONE_MINUS_DST_ALPHA
|
|
106
|
-
| GL.CONSTANT_COLOR
|
|
107
|
-
| GL.ONE_MINUS_CONSTANT_COLOR
|
|
108
|
-
| GL.CONSTANT_ALPHA
|
|
109
|
-
| GL.ONE_MINUS_CONSTANT_ALPHA
|
|
110
|
-
| GL.SRC_ALPHA_SATURATE;
|
|
111
|
-
|
|
112
|
-
export type GLStencilOp =
|
|
113
|
-
| GL.KEEP
|
|
114
|
-
| GL.ZERO
|
|
115
|
-
| GL.REPLACE
|
|
116
|
-
| GL.INCR
|
|
117
|
-
| GL.INCR_WRAP
|
|
118
|
-
| GL.DECR
|
|
119
|
-
| GL.DECR_WRAP
|
|
120
|
-
| GL.INVERT;
|
|
121
|
-
|
|
122
|
-
/** Parameters for textures and samplers */
|
|
123
|
-
export type WebGLSamplerParameters = {
|
|
124
|
-
[GL.TEXTURE_WRAP_S]?: GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT;
|
|
125
|
-
[GL.TEXTURE_WRAP_T]?: GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT;
|
|
126
|
-
[GL.TEXTURE_WRAP_R]?: GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT;
|
|
127
|
-
[GL.TEXTURE_MAG_FILTER]?: GL.NEAREST | GL.LINEAR;
|
|
128
|
-
[GL.TEXTURE_MIN_FILTER]?:
|
|
129
|
-
| GL.NEAREST
|
|
130
|
-
| GL.LINEAR
|
|
131
|
-
| GL.NEAREST_MIPMAP_NEAREST
|
|
132
|
-
| GL.NEAREST_MIPMAP_LINEAR
|
|
133
|
-
| GL.LINEAR_MIPMAP_NEAREST
|
|
134
|
-
| GL.LINEAR_MIPMAP_LINEAR;
|
|
135
|
-
[GL.TEXTURE_MIN_LOD]?: number;
|
|
136
|
-
[GL.TEXTURE_MAX_LOD]?: number;
|
|
137
|
-
[GL.TEXTURE_COMPARE_FUNC]?: number; // COMPARE_FUNC);
|
|
138
|
-
[GL.TEXTURE_MAX_ANISOTROPY_EXT]?: number; //
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* All global WebGL values set by a variety of setter gl.enable ...
|
|
143
|
-
*/
|
|
144
|
-
export type GLValueParameters = {
|
|
145
|
-
[GL.BLEND]?: boolean;
|
|
146
|
-
[GL.BLEND_COLOR]?: [number, number, number, number] | NumberArray;
|
|
147
|
-
[GL.BLEND_EQUATION_RGB]?: GLBlendEquation;
|
|
148
|
-
[GL.BLEND_EQUATION_ALPHA]?: GLBlendEquation;
|
|
149
|
-
[GL.BLEND_SRC_RGB]?: GLBlendFunction;
|
|
150
|
-
[GL.BLEND_DST_RGB]?: GLBlendFunction;
|
|
151
|
-
[GL.BLEND_SRC_ALPHA]?: GLBlendFunction;
|
|
152
|
-
[GL.BLEND_DST_ALPHA]?: GLBlendFunction;
|
|
153
|
-
[GL.COLOR_CLEAR_VALUE]?: [number, number, number, number] | NumberArray;
|
|
154
|
-
[GL.COLOR_WRITEMASK]?: [boolean, boolean, boolean, boolean] | boolean[];
|
|
155
|
-
[GL.CULL_FACE]?: boolean;
|
|
156
|
-
[GL.CULL_FACE_MODE]?: GL.FRONT | GL.BACK | GL.FRONT_AND_BACK;
|
|
157
|
-
[GL.DEPTH_TEST]?: boolean;
|
|
158
|
-
[GL.DEPTH_CLEAR_VALUE]?: number;
|
|
159
|
-
[GL.DEPTH_FUNC]?: GLFunction;
|
|
160
|
-
[GL.DEPTH_RANGE]?: [number, number] | NumberArray;
|
|
161
|
-
[GL.DEPTH_WRITEMASK]?: boolean;
|
|
162
|
-
[GL.DITHER]?: boolean;
|
|
163
|
-
[GL.FRAGMENT_SHADER_DERIVATIVE_HINT]?: GL.FASTEST | GL.NICEST | GL.DONT_CARE;
|
|
164
|
-
[GL.CURRENT_PROGRAM]?: WebGLProgram | null;
|
|
165
|
-
[GL.FRAMEBUFFER_BINDING]?: WebGLFramebuffer | null;
|
|
166
|
-
[GL.RENDERBUFFER_BINDING]?: WebGLRenderbuffer | null;
|
|
167
|
-
[GL.TRANSFORM_FEEDBACK_BINDING]?: WebGLTransformFeedback | null;
|
|
168
|
-
[GL.VERTEX_ARRAY_BINDING]?: WebGLVertexArrayObject | null;
|
|
169
|
-
[GL.ARRAY_BUFFER_BINDING]?: WebGLBuffer | null;
|
|
170
|
-
[GL.COPY_READ_BUFFER_BINDING]?: WebGLBuffer | null;
|
|
171
|
-
[GL.COPY_WRITE_BUFFER_BINDING]?: WebGLBuffer | null;
|
|
172
|
-
[GL.PIXEL_PACK_BUFFER_BINDING]?: WebGLBuffer | null;
|
|
173
|
-
[GL.PIXEL_UNPACK_BUFFER_BINDING]?: WebGLBuffer | null;
|
|
174
|
-
[GL.TEXTURE_BINDING_2D]?: WebGLTexture | null;
|
|
175
|
-
[GL.TEXTURE_BINDING_2D_ARRAY]?: WebGLTexture | null;
|
|
176
|
-
[GL.TEXTURE_BINDING_3D]?: WebGLTexture | null;
|
|
177
|
-
[GL.TEXTURE_BINDING_CUBE_MAP]?: WebGLTexture | null;
|
|
178
|
-
[GL.FRONT_FACE]?: GL.CW | GL.CCW;
|
|
179
|
-
[GL.GENERATE_MIPMAP_HINT]?: GL.FASTEST | GL.NICEST | GL.DONT_CARE;
|
|
180
|
-
[GL.LINE_WIDTH]?: number;
|
|
181
|
-
[GL.POLYGON_OFFSET_FILL]?: boolean;
|
|
182
|
-
[GL.POLYGON_OFFSET_FACTOR]?: number;
|
|
183
|
-
[GL.POLYGON_OFFSET_UNITS]?: number;
|
|
184
|
-
[GL.SAMPLE_ALPHA_TO_COVERAGE]?: boolean;
|
|
185
|
-
[GL.SAMPLE_COVERAGE]?: boolean;
|
|
186
|
-
[GL.RASTERIZER_DISCARD]?: boolean;
|
|
187
|
-
[GL.SAMPLE_COVERAGE_VALUE]?: number;
|
|
188
|
-
[GL.SAMPLE_COVERAGE_INVERT]?: boolean;
|
|
189
|
-
[GL.SCISSOR_TEST]?: boolean;
|
|
190
|
-
[GL.SCISSOR_BOX]?: [number, number, number, number] | NumberArray;
|
|
191
|
-
[GL.STENCIL_TEST]?: boolean;
|
|
192
|
-
[GL.STENCIL_CLEAR_VALUE]?: number;
|
|
193
|
-
[GL.STENCIL_WRITEMASK]?: number;
|
|
194
|
-
[GL.STENCIL_BACK_WRITEMASK]?: number;
|
|
195
|
-
[GL.STENCIL_FUNC]?: GLFunction;
|
|
196
|
-
[GL.STENCIL_REF]?: GLFunction;
|
|
197
|
-
[GL.STENCIL_VALUE_MASK]?: GLFunction;
|
|
198
|
-
[GL.STENCIL_BACK_FUNC]?: GLFunction;
|
|
199
|
-
[GL.STENCIL_BACK_REF]?: GLFunction;
|
|
200
|
-
[GL.STENCIL_BACK_VALUE_MASK]?: GLFunction;
|
|
201
|
-
[GL.STENCIL_FAIL]?: GLStencilOp;
|
|
202
|
-
[GL.STENCIL_PASS_DEPTH_FAIL]?: GLStencilOp;
|
|
203
|
-
[GL.STENCIL_PASS_DEPTH_PASS]?: GLStencilOp;
|
|
204
|
-
[GL.STENCIL_BACK_FAIL]?: GLStencilOp;
|
|
205
|
-
[GL.STENCIL_BACK_PASS_DEPTH_FAIL]?: GLStencilOp;
|
|
206
|
-
[GL.STENCIL_BACK_PASS_DEPTH_PASS]?: GLStencilOp;
|
|
207
|
-
[GL.VIEWPORT]?: [number, number, number, number] | NumberArray;
|
|
208
|
-
|
|
209
|
-
// WEBGL1 PIXEL PACK/UNPACK MODES
|
|
210
|
-
[GL.PACK_ALIGNMENT]?: number;
|
|
211
|
-
[GL.UNPACK_ALIGNMENT]?: number;
|
|
212
|
-
[GL.UNPACK_FLIP_Y_WEBGL]?: boolean;
|
|
213
|
-
[GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]?: boolean;
|
|
214
|
-
[GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]?: GL.NONE | GL.BROWSER_DEFAULT_WEBGL;
|
|
215
|
-
|
|
216
|
-
// WEBGL2 PIXEL PACK/UNPACK MODES
|
|
217
|
-
// RASTERIZER_DISCARD ...
|
|
218
|
-
[GL.PACK_ROW_LENGTH]?: number;
|
|
219
|
-
[GL.PACK_SKIP_PIXELS]?: number;
|
|
220
|
-
[GL.PACK_SKIP_ROWS]?: number;
|
|
221
|
-
[GL.READ_FRAMEBUFFER_BINDING]?: Framebuffer | null;
|
|
222
|
-
[GL.UNPACK_ROW_LENGTH]?: number;
|
|
223
|
-
[GL.UNPACK_IMAGE_HEIGHT]?: number;
|
|
224
|
-
[GL.UNPACK_SKIP_PIXELS]?: number;
|
|
225
|
-
[GL.UNPACK_SKIP_ROWS]?: number;
|
|
226
|
-
[GL.UNPACK_SKIP_IMAGES]?: number;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export type GLFunctionParameters = {
|
|
230
|
-
// Function-style setters
|
|
231
|
-
framebuffer?: Framebuffer | null;
|
|
232
|
-
blend?: boolean;
|
|
233
|
-
blendColor?: [number, number, number, number] | NumberArray;
|
|
234
|
-
blendEquation?: GLBlendEquation | [GLBlendEquation, GLBlendEquation];
|
|
235
|
-
blendFunc?:
|
|
236
|
-
| [GLBlendFunction, GLBlendFunction]
|
|
237
|
-
| [GLBlendFunction, GLBlendFunction, GLBlendFunction, GLBlendFunction];
|
|
238
|
-
|
|
239
|
-
clearColor?: [number, number, number, number] | NumberArray;
|
|
240
|
-
clearDepth?: number;
|
|
241
|
-
clearStencil?: number;
|
|
242
|
-
|
|
243
|
-
colorMask?: [boolean, boolean, boolean, boolean];
|
|
244
|
-
|
|
245
|
-
cull?: boolean;
|
|
246
|
-
cullFace?: GL.FRONT | GL.BACK | GL.FRONT_AND_BACK;
|
|
247
|
-
|
|
248
|
-
depthTest?: boolean;
|
|
249
|
-
depthFunc?: GLFunction;
|
|
250
|
-
depthMask?: boolean;
|
|
251
|
-
depthRange?: [number, number] | NumberArray;
|
|
252
|
-
|
|
253
|
-
dither?: boolean;
|
|
254
|
-
|
|
255
|
-
derivativeHint?: GL.FASTEST | GL.NICEST | GL.DONT_CARE;
|
|
256
|
-
|
|
257
|
-
frontFace?: GL.CW | GL.CCW;
|
|
258
|
-
|
|
259
|
-
mipmapHint?: GL.FASTEST | GL.NICEST | GL.DONT_CARE;
|
|
260
|
-
|
|
261
|
-
lineWidth?: number;
|
|
262
|
-
|
|
263
|
-
polygonOffsetFill?: boolean;
|
|
264
|
-
polygonOffset?: [number, number];
|
|
265
|
-
|
|
266
|
-
sampleCoverage?: [number, boolean];
|
|
267
|
-
|
|
268
|
-
scissorTest?: boolean;
|
|
269
|
-
scissor?: [number, number, number, number] | NumberArray;
|
|
270
|
-
|
|
271
|
-
stencilTest?: boolean;
|
|
272
|
-
stencilMask?: number | [number, number];
|
|
273
|
-
stencilFunc?:
|
|
274
|
-
| [GLFunction, number, number]
|
|
275
|
-
| [GLFunction, number, number, GLFunction, number, number];
|
|
276
|
-
stencilOp?:
|
|
277
|
-
| [GLStencilOp, GLStencilOp, GLStencilOp]
|
|
278
|
-
| [GLStencilOp, GLStencilOp, GLStencilOp, GLStencilOp, GLStencilOp, GLStencilOp];
|
|
279
|
-
viewport?: [number, number, number, number] | NumberArray;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
/** WebGL style parameters object (with both GL constants and function style fields) */
|
|
283
|
-
export type GLParameters = GLValueParameters | GLFunctionParameters;
|