Skip to content

Commit

Permalink
Merge a9eaaca into 9117414
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Apr 2, 2024
2 parents 9117414 + a9eaaca commit b2ff897
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 91 deletions.
4 changes: 2 additions & 2 deletions modules/aggregation-layers/package.json
Expand Up @@ -38,8 +38,8 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.0.8",
"@luma.gl/shadertools": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@luma.gl/shadertools": "^9.0.9",
"@math.gl/web-mercator": "^4.0.0",
"d3-hexbin": "^0.2.1"
},
Expand Down
4 changes: 2 additions & 2 deletions modules/arcgis/package.json
Expand Up @@ -36,8 +36,8 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.0.8",
"@luma.gl/webgl": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@luma.gl/webgl": "^9.0.9",
"esri-loader": "^3.3.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion modules/carto/package.json
Expand Up @@ -47,7 +47,7 @@
"@loaders.gl/mvt": "^4.1.4",
"@loaders.gl/schema": "^4.1.4",
"@loaders.gl/tiles": "^4.1.4",
"@luma.gl/constants": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@math.gl/web-mercator": "^4.0.0",
"@types/d3-array": "^3.0.2",
"@types/d3-color": "^1.4.2",
Expand Down
10 changes: 5 additions & 5 deletions modules/core/package.json
Expand Up @@ -42,11 +42,11 @@
"dependencies": {
"@loaders.gl/core": "^4.1.4",
"@loaders.gl/images": "^4.1.4",
"@luma.gl/constants": "^9.0.8",
"@luma.gl/core": "^9.0.8",
"@luma.gl/engine": "^9.0.8",
"@luma.gl/shadertools": "^9.0.8",
"@luma.gl/webgl": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@luma.gl/core": "^9.0.9",
"@luma.gl/engine": "^9.0.9",
"@luma.gl/shadertools": "^9.0.9",
"@luma.gl/webgl": "^9.0.9",
"@math.gl/core": "^4.0.0",
"@math.gl/sun": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
Expand Down
18 changes: 8 additions & 10 deletions modules/core/src/lib/deck-picker.ts
Expand Up @@ -100,11 +100,10 @@ export default class DeckPicker {

finalize() {
if (this.pickingFBO) {
this.pickingFBO.delete();
this.pickingFBO.destroy();
}
if (this.depthFBO) {
this.depthFBO.colorAttachments[0].delete();
this.depthFBO.delete();
this.depthFBO.destroy();
}
}

Expand Down Expand Up @@ -145,16 +144,15 @@ export default class DeckPicker {
_resizeBuffer() {
// Create a frame buffer if not already available
if (!this.pickingFBO) {
this.pickingFBO = this.device.createFramebuffer({colorAttachments: ['rgba8unorm']});
this.pickingFBO = this.device.createFramebuffer({
colorAttachments: ['rgba8unorm'],
depthStencilAttachment: 'depth16unorm'
});

if (this.device.isTextureFormatRenderable('rgba32float')) {
const depthFBO = this.device.createFramebuffer({
colorAttachments: [
this.device.createTexture({
format: 'rgba32float'
// type: GL.FLOAT
})
]
colorAttachments: ['rgba32float'],
depthStencilAttachment: 'depth16unorm'
});
this.depthFBO = depthFBO;
}
Expand Down
11 changes: 3 additions & 8 deletions modules/core/src/passes/pick-layers-pass.ts
Expand Up @@ -131,22 +131,17 @@ export default class PickLayersPass extends LayersPass {
depthMask: true,
depthTest: true,
depthRange: [0, 1],
...layer.props.parameters,
// Blending
...PICKING_BLENDING,
blend: !this.pickZ
...layer.props.parameters
};
const {pickable, operation} = layer.props;

if (!this._colorEncoderState) {
if (!this._colorEncoderState || operation.includes('terrain')) {
pickParameters.blend = false;
} else if (pickable && operation.includes('draw')) {
Object.assign(pickParameters, PICKING_BLENDING);
pickParameters.blend = true;
pickParameters.blendColor = encodeColor(this._colorEncoderState, layer, viewport);
}
if (operation.includes('terrain')) {
pickParameters.blend = false;
}

return pickParameters;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/package.json
Expand Up @@ -38,8 +38,8 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.0.8",
"@luma.gl/shadertools": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@luma.gl/shadertools": "^9.0.9",
"@math.gl/core": "^4.0.0"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions modules/geo-layers/package.json
Expand Up @@ -46,8 +46,8 @@
"@loaders.gl/terrain": "^4.1.4",
"@loaders.gl/tiles": "^4.1.4",
"@loaders.gl/wms": "^4.1.4",
"@luma.gl/gltf": "^9.0.8",
"@luma.gl/shadertools": "^9.0.8",
"@luma.gl/gltf": "^9.0.9",
"@luma.gl/shadertools": "^9.0.9",
"@math.gl/core": "^4.0.0",
"@math.gl/culling": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/google-maps/package.json
Expand Up @@ -38,7 +38,7 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@math.gl/core": "^4.0.0",
"@types/google.maps": "^3.48.6"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/jupyter-widget/package.json
Expand Up @@ -39,7 +39,7 @@
"@loaders.gl/3d-tiles": "^4.1.4",
"@loaders.gl/core": "^4.1.4",
"@loaders.gl/csv": "^4.1.4",
"@luma.gl/core": "^9.0.8",
"@luma.gl/core": "^9.0.9",
"d3-dsv": "^1.0.8",
"mapbox-gl": "^1.13.2"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/mapbox/package.json
Expand Up @@ -38,7 +38,7 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.0.8",
"@luma.gl/constants": "^9.0.9",
"@math.gl/web-mercator": "^4.0.0"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions modules/mesh-layers/package.json
Expand Up @@ -39,8 +39,8 @@
},
"dependencies": {
"@loaders.gl/gltf": "^4.1.4",
"@luma.gl/gltf": "^9.0.8",
"@luma.gl/shadertools": "^9.0.8"
"@luma.gl/gltf": "^9.0.9",
"@luma.gl/shadertools": "^9.0.9"
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion modules/test-utils/package.json
Expand Up @@ -33,7 +33,7 @@
"typed"
],
"dependencies": {
"@luma.gl/test-utils": "^9.0.8"
"@luma.gl/test-utils": "^9.0.9"
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@loaders.gl/csv": "^4.1.4",
"@loaders.gl/polyfills": "^4.1.4",
"@luma.gl/webgpu": "^9.0.8",
"@luma.gl/webgpu": "^9.0.9",
"@math.gl/proj4": "^4.0.0",
"@probe.gl/bench": "^4.0.9",
"jsdom": "^20.0.0",
Expand Down
65 changes: 48 additions & 17 deletions test/modules/core/lib/pick-layers.spec.ts
Expand Up @@ -24,6 +24,7 @@ import test from 'tape-promise/tape';
import {
MapView,
ScatterplotLayer,
ColumnLayer,
Deck,
PolygonLayer,
PathLayer,
Expand All @@ -32,6 +33,8 @@ import {
} from 'deck.gl';
import {MaskExtension} from '@deck.gl/extensions';
import * as DATA from '../../../../examples/layer-browser/src/data-samples';
import type {DeckProps} from '@deck.gl/core';
import {equals} from '@math.gl/core';

const VIEW_STATE = {
latitude: 37.751537058389985,
Expand All @@ -41,7 +44,7 @@ const VIEW_STATE = {
bearing: 0
};

const DECK_PROPS = {
const DECK_PROPS: DeckProps = {
width: 500,
height: 550,
views: [new MapView()],
Expand Down Expand Up @@ -750,16 +753,11 @@ const TEST_CASES = [
}
];

test(`pickingTest`, t => {
const deck = new Deck();
t.ok(deck, 'Deck should be constructed');
test(`pickingTest`, async t => {
const deck = new Deck(DECK_PROPS);

const len = TEST_CASES.length;
let index = 0;
let testCase;

function runTests() {
testCase = TEST_CASES[index++];
for (const testCase of TEST_CASES) {
await updateDeckProps(deck, testCase.props);
const pickingMethods = testCase.pickingMethods;

let pickInfos;
Expand Down Expand Up @@ -794,13 +792,46 @@ test(`pickingTest`, t => {
// }
}
}
if (index === len) {
deck.finalize();
t.end();
} else {
deck.setProps({...DECK_PROPS, ...TEST_CASES[index].props});
}
}
deck.finalize();
t.end();
});

test('pickingTest#unproject3D', async t => {
const deck = new Deck(DECK_PROPS);

deck.setProps({...DECK_PROPS, ...TEST_CASES[0].props, onAfterRender: runTests});
await updateDeckProps(deck, {
layers: [
new ColumnLayer({
data: [VIEW_STATE],
getPosition: d => [d.longitude, d.latitude],
radius: 100,
extruded: true,
getElevation: 1000,
getFillColor: [255, 0, 0],
pickable: true
})
]
});

let pickInfo = deck.pickObject({x: 250, y: 275, unproject3D: true});
t.is(pickInfo.object, VIEW_STATE, 'object is picked');
t.comment(`pickInfo.coordinate: ${pickInfo.coordinate}`);
t.ok(
equals(pickInfo.coordinate, [VIEW_STATE.longitude, VIEW_STATE.latitude, 1000], 0.0001),
'unprojects to 3D coordinate'
);

deck.finalize();
t.end();
});

function updateDeckProps(deck: Deck, props: DeckProps): Promise<void> {
return new Promise(resolve => {
deck.setProps({
...DECK_PROPS,
...props,
onAfterRender: () => resolve()
});
});
}
70 changes: 35 additions & 35 deletions yarn.lock
Expand Up @@ -2590,69 +2590,69 @@
jszip "^3.1.5"
md5 "^2.3.0"

"@luma.gl/constants@9.0.8", "@luma.gl/constants@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/constants/-/constants-9.0.8.tgz#0a12f6a46f0ca1dd6339b57667012d66aff7ec4c"
integrity sha512-107qD7Z70TiaGgNmQ2KU4vpNOuf4dB6EgZ+CS9fIhyBFTK8okH21g9ZjzjJ6IrDbvkxuVbXp6ooMw7bcC3FyoQ==
"@luma.gl/constants@9.0.9", "@luma.gl/constants@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/constants/-/constants-9.0.9.tgz#4fdb735c4b78f09aa92db2b8020b0175ed279bb9"
integrity sha512-o8NgH4F//e2wVWyZoYmaoopoTejDEITBP78fJtU2ivmCW1viCvByUawEXISPzsekHosDYo9q1/XFjmusXZa3fQ==

"@luma.gl/core@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/core/-/core-9.0.8.tgz#8889b5704ce0c05b9b8aa7bb3258b3388cdb0260"
integrity sha512-TtGZ9iN5MFrP28jym+TR9VcLIw0jHN8u6x6tJmy9AivxzSmpZFQB+yhV2bCFDl5a8NvZo16YxyPPhrIGGrGs6Q==
"@luma.gl/core@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/core/-/core-9.0.9.tgz#1199400c94d60171875dcbbaa3d2ed2579607df1"
integrity sha512-G0N4+bSWLU6gt3grgzF5xf+vMnfYaryHFLDkAeZV5kJ2helnfzUsjwUKCEYk36V2vygu7TEXlByYgwestB7+Ew==
dependencies:
"@math.gl/types" "^4.0.0"
"@probe.gl/env" "^4.0.2"
"@probe.gl/log" "^4.0.2"
"@probe.gl/stats" "^4.0.2"
"@types/offscreencanvas" "^2019.6.4"

"@luma.gl/engine@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/engine/-/engine-9.0.8.tgz#5b84cc9a207d517c674b6acf55544626b1388322"
integrity sha512-zCB2rnvzEJlcGTOFrQUW1L68QBlSgnDvODa+VKf6IWBxwh1+sN9tdY+f7ZY+UY7vtlYADcEUwtfB6PDoWm4vjA==
"@luma.gl/engine@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/engine/-/engine-9.0.9.tgz#5eaeb784a4731969eca62acf4cf8fdb4d0d239ab"
integrity sha512-4qW4OCYaGZJ/iGqerAtnP8FzcNtnXvv+aShLkE4ay2D4zdOIML5kZSLslmU/ByZ3FR606k0c5AjTBOgZ77lkiQ==
dependencies:
"@luma.gl/shadertools" "9.0.8"
"@luma.gl/shadertools" "9.0.9"
"@math.gl/core" "^4.0.0"
"@probe.gl/log" "^4.0.2"
"@probe.gl/stats" "^4.0.2"

"@luma.gl/gltf@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/gltf/-/gltf-9.0.8.tgz#5cd84cd8145649204d0dfb74ac6693c6df7e8907"
integrity sha512-ATcMcyC0i/KuW4JPRLjyACcs8Q7c8ZRWeM5ugmQ5mQAIMVv3PfC/ZSVVtOqkBa4m+JJGHcZj2z4TXRkjJ6maOg==
"@luma.gl/gltf@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/gltf/-/gltf-9.0.9.tgz#9c326e066cd73806b01bf8f79b46c0b942b9cf74"
integrity sha512-QuV4gbxIZ8qGOmZsf9DGvavogQUyplpDVAs38eczBBqIKCGFq2d+mOIQMmn1SWFF0RjicjyjnQ2KAFWgdy2jIQ==
dependencies:
"@loaders.gl/textures" "^4.1.0"
"@luma.gl/shadertools" "9.0.8"
"@luma.gl/shadertools" "9.0.9"
"@math.gl/core" "^4.0.0"

"@luma.gl/shadertools@9.0.8", "@luma.gl/shadertools@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/shadertools/-/shadertools-9.0.8.tgz#b5225553a8ab988b2179f797c027cb90aa338214"
integrity sha512-d+x/2zy6wcwQW3uthyQDQSqRc6164IfQCciUYm88opQSVqIy0+feoLXDC/SCEM1+NOXSVcd+bDpyfP8lAKy4Fw==
"@luma.gl/shadertools@9.0.9", "@luma.gl/shadertools@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/shadertools/-/shadertools-9.0.9.tgz#88269c9889a32cd8636e7bb2351fe8d5d8b77ba9"
integrity sha512-99wfDMtkIeWziAf96UrqXteJi4uBFvMN0TdU8TvTv0V6BJRjd1xZVWnF9Xx2D+DPH9Mmn4q/hQH0NJ0sQlYeHw==
dependencies:
"@math.gl/core" "^4.0.0"
"@math.gl/types" "^4.0.0"

"@luma.gl/test-utils@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/test-utils/-/test-utils-9.0.8.tgz#c80d6c72c1fad1d168d5bae5d5ef7cc82efd73cc"
integrity sha512-bT1tuhWOwt3d5oXUG9Db7xIXF/53rgdyK9DNZ1OhDolnGPgjg8lOC6imD2ETX++E1GhoDr1PXOgFE5r4w5zwMw==
"@luma.gl/test-utils@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/test-utils/-/test-utils-9.0.9.tgz#1687d87e1bf070d1cfe145b3c7e77045a0dc875f"
integrity sha512-oMRl3ede73pp4KGvzJHhkk/QusrBoOj+PHaQ/X78ULoutAAqZpNLpiL2EkJOk3otkZMzePOW4RZeviHj0/McKQ==
dependencies:
"@probe.gl/env" "^4.0.2"
"@probe.gl/stats" "^4.0.2"

"@luma.gl/webgl@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/webgl/-/webgl-9.0.8.tgz#609c6f46bd4e0ce2f5d2de021115b8f443a205f5"
integrity sha512-2US5Nnk4B1v6HlI0NaisRktE5ko13aWo3ubbO1f9xLQ3ZxxRM6M8T2Mcl5HvOHQ37PTswbFt45dGYLOIsH6nDQ==
"@luma.gl/webgl@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/webgl/-/webgl-9.0.9.tgz#c8d9563a0e45bef2a2cb3ddfc9efbff558e3f954"
integrity sha512-dP91Md5u6OnK3PFt0h1uqcxWh3T/COBHyZ5OcAirRUB1laFdzhdXUWbtuvLgpF6b7o0MsaEUcXaAbYf+e7lEzA==
dependencies:
"@luma.gl/constants" "9.0.8"
"@luma.gl/constants" "9.0.9"
"@probe.gl/env" "^4.0.2"

"@luma.gl/webgpu@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@luma.gl/webgpu/-/webgpu-9.0.8.tgz#9175b74f4592bbd4ad4978dcd103b34b0a833f83"
integrity sha512-lyPAxQFdn51uWZlY+AXnL4QFIETuzb69ubGADqDJgDbo/gV0TK2h7Lp06oSmz4gO2XSpPfldi8TSVIEbPbP5ig==
"@luma.gl/webgpu@^9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@luma.gl/webgpu/-/webgpu-9.0.9.tgz#9e61ade913e4dced18cd18f36bae3fd90e4d4f26"
integrity sha512-HaGbab8EKMy33NKQqTqPMT1eq0dOSY2A4QoS24AXn9i7NODBgP540he1VA5fj2tmDuVzyNgzh2/EHuFKbDk0Sg==
dependencies:
"@probe.gl/env" "^4.0.2"
"@webgpu/types" "^0.1.34"
Expand Down

0 comments on commit b2ff897

Please sign in to comment.