diff --git a/modules/aggregation-layers/package.json b/modules/aggregation-layers/package.json index baf659b7b44..456abb69a67 100644 --- a/modules/aggregation-layers/package.json +++ b/modules/aggregation-layers/package.json @@ -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" }, diff --git a/modules/arcgis/package.json b/modules/arcgis/package.json index 3de522c5a55..0ab69eb4fcb 100644 --- a/modules/arcgis/package.json +++ b/modules/arcgis/package.json @@ -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": { diff --git a/modules/carto/package.json b/modules/carto/package.json index b07a99b5fd8..63621c6c2f6 100644 --- a/modules/carto/package.json +++ b/modules/carto/package.json @@ -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", diff --git a/modules/core/package.json b/modules/core/package.json index a7e8f1c944a..fd8dbca0fbb 100644 --- a/modules/core/package.json +++ b/modules/core/package.json @@ -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", diff --git a/modules/core/src/lib/deck-picker.ts b/modules/core/src/lib/deck-picker.ts index 957efe4437d..29c613ed806 100644 --- a/modules/core/src/lib/deck-picker.ts +++ b/modules/core/src/lib/deck-picker.ts @@ -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(); } } @@ -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; } diff --git a/modules/core/src/passes/pick-layers-pass.ts b/modules/core/src/passes/pick-layers-pass.ts index eaec6e4509c..eb3ded73a90 100644 --- a/modules/core/src/passes/pick-layers-pass.ts +++ b/modules/core/src/passes/pick-layers-pass.ts @@ -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; } diff --git a/modules/extensions/package.json b/modules/extensions/package.json index 2ec3d6d257a..ab1c71765c9 100644 --- a/modules/extensions/package.json +++ b/modules/extensions/package.json @@ -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": { diff --git a/modules/geo-layers/package.json b/modules/geo-layers/package.json index ce3e5b08fbb..e6c8e082bc0 100644 --- a/modules/geo-layers/package.json +++ b/modules/geo-layers/package.json @@ -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", diff --git a/modules/google-maps/package.json b/modules/google-maps/package.json index db7726da8e6..f6120c8e651 100644 --- a/modules/google-maps/package.json +++ b/modules/google-maps/package.json @@ -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" }, diff --git a/modules/jupyter-widget/package.json b/modules/jupyter-widget/package.json index 4457a310a3c..cb7e149dd06 100644 --- a/modules/jupyter-widget/package.json +++ b/modules/jupyter-widget/package.json @@ -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" }, diff --git a/modules/mapbox/package.json b/modules/mapbox/package.json index b03b9e10f84..1b864ec7e4e 100644 --- a/modules/mapbox/package.json +++ b/modules/mapbox/package.json @@ -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": { diff --git a/modules/mesh-layers/package.json b/modules/mesh-layers/package.json index 64923de1986..e8fee60dd40 100644 --- a/modules/mesh-layers/package.json +++ b/modules/mesh-layers/package.json @@ -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", diff --git a/modules/test-utils/package.json b/modules/test-utils/package.json index 7efecc3c4f8..9c4d582e15b 100644 --- a/modules/test-utils/package.json +++ b/modules/test-utils/package.json @@ -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", diff --git a/package.json b/package.json index 0ad2e563c14..8dff6bdd8e3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/modules/core/lib/pick-layers.spec.ts b/test/modules/core/lib/pick-layers.spec.ts index f47c75b65ab..23a33bf2504 100644 --- a/test/modules/core/lib/pick-layers.spec.ts +++ b/test/modules/core/lib/pick-layers.spec.ts @@ -24,6 +24,7 @@ import test from 'tape-promise/tape'; import { MapView, ScatterplotLayer, + ColumnLayer, Deck, PolygonLayer, PathLayer, @@ -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, @@ -41,7 +44,7 @@ const VIEW_STATE = { bearing: 0 }; -const DECK_PROPS = { +const DECK_PROPS: DeckProps = { width: 500, height: 550, views: [new MapView()], @@ -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; @@ -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 { + return new Promise(resolve => { + deck.setProps({ + ...DECK_PROPS, + ...props, + onAfterRender: () => resolve() + }); + }); +} diff --git a/yarn.lock b/yarn.lock index f72f8d5f9bb..1917ce340c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2590,15 +2590,15 @@ 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" @@ -2606,53 +2606,53 @@ "@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"