From 4239e478e3714d3fd0faca83ad78b32d381ca888 Mon Sep 17 00:00:00 2001 From: Felix Palmer Date: Tue, 23 Jul 2024 11:08:26 +0200 Subject: [PATCH] HeatmapLayer fix to work with project UBO --- .../src/heatmap-layer/heatmap-layer.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/aggregation-layers/src/heatmap-layer/heatmap-layer.ts b/modules/aggregation-layers/src/heatmap-layer/heatmap-layer.ts index 814159516d5..ee326b8b3fd 100644 --- a/modules/aggregation-layers/src/heatmap-layer/heatmap-layer.ts +++ b/modules/aggregation-layers/src/heatmap-layer/heatmap-layer.ts @@ -41,7 +41,8 @@ import { log, Position, UpdateParameters, - DefaultProps + DefaultProps, + project32 } from '@deck.gl/core'; import TriangleLayer from './triangle-layer'; import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer'; @@ -201,6 +202,10 @@ export default class HeatmapLayer< viewportCorners: number[][]; }; + getShaders(shaders: any) { + return super.getShaders({...shaders, modules: [project32]}); + } + initializeState() { super.initializeAggregationLayer(DIMENSIONS); this.setState({colorDomain: DEFAULT_COLOR_DOMAIN}); @@ -593,6 +598,12 @@ export default class HeatmapLayer< weightsTransform.model.setVertexCount(this.getNumInstances()); weightsTransform.model.setUniforms(uniforms); weightsTransform.model.updateModuleSettings(moduleSettings); + + const {viewport, devicePixelRatio, coordinateSystem, coordinateOrigin} = moduleSettings; + const {modelMatrix} = this.props; + weightsTransform.model.shaderInputs.setProps({ + project: {viewport, devicePixelRatio, modelMatrix, coordinateSystem, coordinateOrigin} + }); weightsTransform.run({ parameters: {viewport: [0, 0, textureSize, textureSize]}, clearColor: [0, 0, 0, 0]