Skip to content

Commit

Permalink
Merge 1a7927a into 06391e5
Browse files Browse the repository at this point in the history
  • Loading branch information
1chandu committed May 23, 2019
2 parents 06391e5 + 1a7927a commit f62be86
Show file tree
Hide file tree
Showing 44 changed files with 768 additions and 233 deletions.
87 changes: 87 additions & 0 deletions CHANGELOG.md
Expand Up @@ -15,8 +15,95 @@ Each version should:
Ref: http://keepachangelog.com/en/0.3.0/
-->

## deck.gl v7.1

### deck.gl v7.1 Prereleases

#### deck.gl [v7.1.0-alpha.1] - May 22 2019

- GLTF Animation support in scenegraph-layer (#3010)
- Add JSON bindings Python library (#3013)
- Add stroke functionality for the H3Hexagon Layer (#3024)
- Add Jupyter notebook widget JS module (#3035)
- GPUGridLayer PART-1: Fix world space aggregation (#3051)
- Fix update vertices when regenerate models (#3078)
- Support 64-bit position in IDENTITY mode (#3071)
- [React] Add the ability to use react-map-gl controls (#3075)
- GPUGridLayer PART-2: Add support for multiple weights (#3057)
- Add Jupyter widget to pydeck library (#3050)
- Support variable attribute size with standard accessors (#3094)
- Prep Attribute class for partial update (#3091)
- Use a single model for stroke and fill in ColumnLayer (#3097)
- Aggregation-layers: Add unit tests, fix bugs. (#3101)
- Support stroke width in ColumnLayer and H3HexagonLayer (#3102)
- Improve H3HexagonLayer perf (#3103)
- ScenegraphLayer: add getScene and getAnimator properties (#3109)
- Fix TileLayer bug at low zoom levels (#3111)
- Add partial update support to AttributeManager (#3099)
- Fix coordinate origin z bug (#3131)
- GPU GridLayer PART-3: Add NewGridLayer. (#3095)
- post-processing effect rendering pipeline (#3107)

## deck.gl v7.0

#### deck.gl [v7.0.9] - May 21 2019

- Fix logging (#3126)
- Update peer dependency versions (#3128)
- Remove force override of position parameter in WebMercatorViewport (#3127)

#### deck.gl [v7.0.8] - May 17 2019

- Fix view state handling in mapbox integration (#3113)

#### deck.gl [v7.0.7] - May 16 2019

- Optimize bundle size (#3092)
- Fix elevationScale behavior (#3093)
- Fix react integration of mapbox layers (#3108)

#### deck.gl [v7.0.6] - May 13 2019

- Ensure UMD bundles are ES5 (#3085)

#### deck.gl [v7.0.5] - May 6 2019

- GPUAggregator: Fix Texture/Buffer resource leaks. (#3054)
- fix onClick callback in GoogleMapsOverlay (#3067)
- fix bundle size (#3069)

#### deck.gl [v7.0.4] - Apr 30 2019

- finalize all layers (#3044)
- Fix bug in click event handling (#3041)
- update internal props of point lights (#3047)
- Fix OrbitView and OrthographicView resize bug (#3043)
- Delete textures on layer finalization (#3045)

#### deck.gl [v7.0.3] - Apr 25 2019

- Various console warning fixes (#3022)
- Fix shader attribute constants and transitions (#3028)

#### deck.gl [v7.0.2] - Apr 23 2019

- More React synchronization fix (#3018)
- Fix GoogleMapsOverlay remove and finalize (#3019)

#### deck.gl [v7.0.1] - Apr 22 2019

- fix compareProps perf (#3011)

#### deck.gl [v7.0.0] - Apr 19 2019

- Bump luma.gl version to 7.0.0
- Content and Polish for Whats New 7.0 (#3001)
- improve babel config for Edge/IE (#3002)
- Add ArcLayer example to the gallery (#2972)
- Fix buffer warnings (#2999)
- fix website warnings (#2998)
- Remove deprecated APIs and update doc (#2997)

### deck.gl v7.0 Prereleases

#### deck.gl [v7.0.0-rc.1] - Apr 12 2019
Expand Down
10 changes: 2 additions & 8 deletions lerna.json
@@ -1,14 +1,8 @@
{
"lerna": "2.0.0",
"version": "7.0.0-rc.1",
"version": "7.1.0-alpha.1",
"commands": {
"publish": {
"ignore": [
"@deck.gl/lite",
"test",
"*.md"
]
},
"publish": {},
"bootstrap": {}
},
"npmClient": "yarn",
Expand Down
2 changes: 1 addition & 1 deletion modules/aggregation-layers/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "@deck.gl/aggregation-layers",
"description": "deck.gl layers that aggregate the input data into alternative representations",
"license": "MIT",
"version": "7.0.0-rc.1",
"version": "7.1.0-alpha.1",
"publishConfig": {
"access": "public"
},
Expand Down
Expand Up @@ -30,5 +30,6 @@ out vec4 fragColor;
void main(void) {
fragColor = vColor;
fragColor = picking_filterColor(fragColor);
}
`;
Expand Up @@ -30,6 +30,7 @@ in vec3 normals;
in vec4 colors;
in vec4 elevations;
in vec3 instancePickingColors;
// Custom uniforms
uniform vec2 offset;
Expand Down Expand Up @@ -112,6 +113,9 @@ void main(void) {
vec2 centroidPosition64xyLow = vec2(instancePositionXFP64[1], instancePositionYFP64[1]);
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
// Set color to be rendered to picking fbo (also used to check for selection highlight).
picking_setPickingColor(instancePickingColors);
vec4 position_commonspace;
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64xyLow, pos, position_commonspace);
Expand Down
Expand Up @@ -37,8 +37,6 @@ const defaultProps = {
elevationScale: {type: 'number', min: 0, value: 1},
extruded: true,
fp64: false,
pickable: false, // TODO: add picking support (read from aggregated texture)

material: defaultMaterial
};

Expand All @@ -48,6 +46,7 @@ export default class GPUGridCellLayer extends Layer {
}

initializeState() {
const {gl} = this.context;
const attributeManager = this.getAttributeManager();
attributeManager.addInstanced({
colors: {
Expand All @@ -61,27 +60,9 @@ export default class GPUGridCellLayer extends Layer {
noAlloc: true
}
});
}

updateState({props, oldProps, changeFlags}) {
super.updateState({props, oldProps, changeFlags});
// Re-generate model if geometry changed
if (props.fp64 !== oldProps.fp64) {
const {gl} = this.context;
if (this.state.model) {
this.state.model.delete();
}
const model = this._getModel(gl);
this._setupUniformBuffer(model);
this.setState({model});
this.state.attributeManager.invalidateAll();
}
if (props.colorBuffer !== oldProps.colorBuffer) {
this.state.attributeManager.invalidate('colors');
}
if (props.elevationBuffer !== oldProps.elevationBuffer) {
this.state.attributeManager.invalidate('elevations');
}
const model = this._getModel(gl);
this._setupUniformBuffer(model);
this.setState({model});
}

_getModel(gl) {
Expand All @@ -98,6 +79,7 @@ export default class GPUGridCellLayer extends Layer {

draw({uniforms}) {
const {
data,
cellSize,
offset,
extruded,
Expand All @@ -107,13 +89,13 @@ export default class GPUGridCellLayer extends Layer {
gridOrigin,
gridOffset,
colorRange,
colorMaxMinBuffer,
elevationRange,
elevationMaxMinBuffer
elevationRange
} = this.props;

const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
const colorMaxMinBuffer = data.color.maxMinBuffer;
const elevationMaxMinBuffer = data.elevation.maxMinBuffer;

colorMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX});
elevationMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX});
Expand All @@ -140,16 +122,16 @@ export default class GPUGridCellLayer extends Layer {
}

calculateColors(attribute) {
const {colorBuffer} = this.props;
const {data} = this.props;
attribute.update({
buffer: colorBuffer
buffer: data.color.aggregationBuffer
});
}

calculateElevations(attribute) {
const {elevationBuffer} = this.props;
const {data} = this.props;
attribute.update({
buffer: elevationBuffer
buffer: data.elevation.aggregationBuffer
});
}

Expand Down
93 changes: 72 additions & 21 deletions modules/aggregation-layers/src/gpu-grid-layer/gpu-grid-layer.js
Expand Up @@ -25,9 +25,8 @@ import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator
import {pointToDensityGridData} from '../utils/gpu-grid-aggregation/grid-aggregation-utils';
import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
import GPUGridCellLayer from './gpu-grid-cell-layer';
import {pointToDensityGridDataCPU} from './../grid-layer/grid-aggregator';

const MINCOLOR = [0, 0, 0, 255];
const MAXCOLOR = [0, 255, 0, 255];
const defaultMaterial = new PhongMaterial();
const defaultProps = {
// color
Expand All @@ -49,7 +48,6 @@ const defaultProps = {
getPosition: {type: 'accessor', value: x => x.position},
extruded: false,
fp64: false,
pickable: false, // TODO: Enable picking with GPU Aggregation

// Optional material for 'lighting' shader module
material: defaultMaterial,
Expand All @@ -73,8 +71,10 @@ export default class GPUGridLayer extends CompositeLayer {
updateState(opts) {
const aggregationFlags = this.getAggregationFlags(opts);
if (aggregationFlags) {
// project data into grid cells
// aggregate points into grid cells
this.getLayerData(aggregationFlags);
// reset cached CPU Aggregation results (used for picking)
this.setState({gridHash: null});
}
}

Expand Down Expand Up @@ -120,6 +120,71 @@ export default class GPUGridLayer extends CompositeLayer {
return false;
}

getHashKeyForIndex(index) {
const {gridSize, gridOrigin, cellSize} = this.state;
const yIndex = Math.floor(index / gridSize[0]);
const xIndex = index - yIndex * gridSize[0];
// This will match the index to the hash-key to access aggregation data from CPU aggregation results.
const latIdx = Math.floor(
(yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]
);
const lonIdx = Math.floor(
(xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]
);
return `${latIdx}-${lonIdx}`;
}

getPositionForIndex(index) {
const {gridSize, gridOrigin, cellSize} = this.state;
const yIndex = Math.floor(index / gridSize[0]);
const xIndex = index - yIndex * gridSize[0];
const yPos = yIndex * cellSize[1] + gridOrigin[1];
const xPos = xIndex * cellSize[0] + gridOrigin[0];
return [xPos, yPos];
}

getPickingInfo({info, mode}) {
const {index} = info;
let object = null;
if (index >= 0) {
const {gpuGridAggregator} = this.state;
const position = this.getPositionForIndex(index);
const colorInfo = GPUGridAggregator.getAggregationData(
Object.assign({pixelIndex: index}, gpuGridAggregator.getData('color'))
);
const elevationInfo = GPUGridAggregator.getAggregationData(
Object.assign({pixelIndex: index}, gpuGridAggregator.getData('elevation'))
);

object = {
colorValue: colorInfo.cellWeight,
elevationValue: elevationInfo.cellWeight,
count: colorInfo.cellCount || elevationInfo.cellCount,
position,
totalCount: colorInfo.totalCount || elevationInfo.totalCount
};
if (mode !== 'hover') {
// perform CPU aggregation for full list of points for each cell
const {data, getPosition} = this.props;
let {gridHash} = this.state;
if (!gridHash) {
const cpuAggregation = pointToDensityGridDataCPU(data, this.props.cellSize, getPosition);
gridHash = cpuAggregation.gridHash;
this.setState({gridHash});
}
const key = this.getHashKeyForIndex(index);
const cpuAggregationData = gridHash[key];
Object.assign(object, cpuAggregationData);
}
}

return Object.assign(info, {
picked: Boolean(object),
// override object with picked cell
object
});
}

getLayerData(aggregationFlags) {
const {
data,
Expand Down Expand Up @@ -162,11 +227,6 @@ export default class GPUGridLayer extends CompositeLayer {
this.setState({weights, gridSize, gridOrigin, cellSize, boundingBox});
}

getPickingInfo({info}) {
// TODO: perform picking
return info;
}

renderLayers() {
const {
elevationScale,
Expand All @@ -179,25 +239,16 @@ export default class GPUGridLayer extends CompositeLayer {
} = this.props;

const {weights, gridSize, gridOrigin, cellSize} = this.state;
const minColor = MINCOLOR;
const maxColor = MAXCOLOR;

const colorRange = colorRangeToFlatArray(this.props.colorRange, Float32Array, 255);

const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);

return new SubLayerClass(
{
colorBuffer: weights.color.aggregationBuffer,
colorMaxMinBuffer: weights.color.maxMinBuffer,
elevationBuffer: weights.elevation.aggregationBuffer,
elevationMaxMinBuffer: weights.elevation.maxMinBuffer,
gridSize,
gridOrigin,
gridOffset: cellSize,
numInstances: gridSize[0] * gridSize[1],
minColor,
maxColor,
colorRange,
elevationRange,

Expand All @@ -206,14 +257,14 @@ export default class GPUGridLayer extends CompositeLayer {
coverage,
material,
elevationScale,
extruded,
pickable: false
extruded
},
this.getSubLayerProps({
id: 'gpu-grid-cell'
}),
{
data: this.state.layerData
data: weights,
numInstances: gridSize[0] * gridSize[1]
}
);
}
Expand Down

0 comments on commit f62be86

Please sign in to comment.