@deck.gl/aggregation-layers 8.7.9 → 8.7.12

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/aggregation-layers",
3
3
  "description": "deck.gl layers that aggregate the input data into alternative representations",
4
4
  "license": "MIT",
5
- "version": "8.7.9",
5
+ "version": "8.7.12",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -37,5 +37,5 @@
37
37
  "@deck.gl/core": "^8.0.0",
38
38
  "@deck.gl/layers": "^8.0.0"
39
39
  },
40
- "gitHead": "c060732d18d0dcf68b277da889a79bc428aca347"
40
+ "gitHead": "8982b5d2b1add585af1f7144bc259e2216707319"
41
41
  }
@@ -80,9 +80,14 @@ export function getTextureCoordinates(point, bounds) {
80
80
 
81
81
  // Returns format and type for creating texture objects
82
82
  export function getTextureParams({gl, floatTargetSupport}) {
83
- return {
84
- // format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures
85
- format: isWebGL2(gl) ? GL.RGBA32F : GL.RGBA,
86
- type: floatTargetSupport ? GL.FLOAT : GL.UNSIGNED_BYTE
87
- };
83
+ return floatTargetSupport
84
+ ? {
85
+ // format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures
86
+ format: isWebGL2(gl) ? GL.RGBA32F : GL.RGBA,
87
+ type: GL.FLOAT
88
+ }
89
+ : {
90
+ format: GL.RGBA,
91
+ type: GL.UNSIGNED_BYTE
92
+ };
88
93
  }
@@ -28,7 +28,15 @@ import {
28
28
  getTextureCoordinates,
29
29
  getTextureParams
30
30
  } from './heatmap-layer-utils';
31
- import {Buffer, Texture2D, Transform, getParameters, FEATURES, hasFeatures} from '@luma.gl/core';
31
+ import {
32
+ Buffer,
33
+ Texture2D,
34
+ Transform,
35
+ getParameters,
36
+ withParameters,
37
+ FEATURES,
38
+ hasFeatures
39
+ } from '@luma.gl/core';
32
40
  import {AttributeManager, COORDINATE_SYSTEM, log} from '@deck.gl/core';
33
41
  import TriangleLayer from './triangle-layer';
34
42
  import AggregationLayer from '../aggregation-layer';
@@ -72,7 +80,11 @@ const defaultProps = {
72
80
  const REQUIRED_FEATURES = [
73
81
  FEATURES.BLEND_EQUATION_MINMAX, // max weight calculation
74
82
  FEATURES.TEXTURE_FLOAT // weight-map as texture
75
- // FEATURES.FLOAT_BLEND, // implictly supported when TEXTURE_FLOAT is supported
83
+ ];
84
+
85
+ const FLOAT_TARGET_FEATURES = [
86
+ FEATURES.COLOR_ATTACHMENT_RGBA32F, // ability to render to float texture
87
+ FEATURES.FLOAT_BLEND // ability to blend when rendering to float texture
76
88
  ];
77
89
 
78
90
  const DIMENSIONS = {
@@ -266,7 +278,7 @@ export default class HeatmapLayer extends AggregationLayer {
266
278
  const {weightsTextureSize} = this.props;
267
279
 
268
280
  const textureSize = Math.min(weightsTextureSize, getParameters(gl, gl.MAX_TEXTURE_SIZE));
269
- const floatTargetSupport = hasFeatures(gl, FEATURES.COLOR_ATTACHMENT_RGBA32F);
281
+ const floatTargetSupport = hasFeatures(gl, FLOAT_TARGET_FEATURES);
270
282
  const {format, type} = getTextureParams({gl, floatTargetSupport});
271
283
  const weightsScale = floatTargetSupport ? 1 : 1 / 255;
272
284
  this.setState({textureSize, format, type, weightsScale});
@@ -480,17 +492,20 @@ export default class HeatmapLayer extends AggregationLayer {
480
492
  weightsTransform.update({
481
493
  elementCount: this.getNumInstances()
482
494
  });
483
- weightsTransform.run({
484
- uniforms,
485
- parameters: {
486
- blend: true,
487
- depthTest: false,
488
- blendFunc: [GL.ONE, GL.ONE],
489
- blendEquation: GL.FUNC_ADD
490
- },
491
- clearRenderTarget: true,
492
- attributes: this.getAttributes(),
493
- moduleSettings: this.getModuleSettings()
495
+ // Need to explictly specify clearColor as external context may have modified it
496
+ withParameters(this.context.gl, {clearColor: [0, 0, 0, 0]}, () => {
497
+ weightsTransform.run({
498
+ uniforms,
499
+ parameters: {
500
+ blend: true,
501
+ depthTest: false,
502
+ blendFunc: [GL.ONE, GL.ONE],
503
+ blendEquation: GL.FUNC_ADD
504
+ },
505
+ clearRenderTarget: true,
506
+ attributes: this.getAttributes(),
507
+ moduleSettings: this.getModuleSettings()
508
+ });
494
509
  });
495
510
  this._updateMaxWeightValue();
496
511