@deck.gl/arcgis 9.0.0-beta.8 → 9.0.0-beta.9
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/dist/commons.d.ts +26 -0
- package/dist/commons.d.ts.map +1 -0
- package/dist/commons.js +120 -0
- package/dist/deck-layer-view-2d.d.ts +2 -0
- package/dist/deck-layer-view-2d.d.ts.map +1 -0
- package/dist/deck-layer-view-2d.js +44 -0
- package/dist/deck-layer.d.ts +2 -0
- package/dist/deck-layer.d.ts.map +1 -0
- package/dist/deck-layer.js +27 -0
- package/dist/deck-props.d.ts +2 -0
- package/dist/deck-props.d.ts.map +1 -0
- package/dist/deck-props.js +53 -0
- package/dist/deck-renderer.d.ts +14 -0
- package/dist/deck-renderer.d.ts.map +1 -0
- package/dist/deck-renderer.js +49 -0
- package/dist/dist.dev.js +95 -110
- package/dist/index.cjs +360 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/load-modules.d.ts +9 -0
- package/dist/load-modules.d.ts.map +1 -0
- package/dist/load-modules.js +46 -0
- package/dist.min.js +6 -6
- package/package.json +6 -5
- package/src/commons.ts +66 -51
- package/src/{deck-layer-view-2d.js → deck-layer-view-2d.ts} +12 -17
- package/src/deck-renderer.ts +65 -0
- package/src/{load-modules.js → load-modules.ts} +20 -9
- package/src/deck-renderer.js +0 -56
- /package/src/{deck-layer.js → deck-layer.ts} +0 -0
- /package/src/{deck-props.js → deck-props.ts} +0 -0
- /package/src/{index.js → index.ts} +0 -0
package/dist/dist.dev.js
CHANGED
|
@@ -279,7 +279,7 @@ var __exports__ = (() => {
|
|
|
279
279
|
// bundle.ts
|
|
280
280
|
__reExport(bundle_exports, peer_dependency_exports);
|
|
281
281
|
|
|
282
|
-
//
|
|
282
|
+
// dist/deck-props.js
|
|
283
283
|
var properties = {
|
|
284
284
|
layers: {},
|
|
285
285
|
layerFilter: {},
|
|
@@ -333,7 +333,7 @@ var __exports__ = (() => {
|
|
|
333
333
|
return DeckProps;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
//
|
|
336
|
+
// dist/deck-layer.js
|
|
337
337
|
function createDeckLayer(DeckProps, Layer2, DeckLayerView2D) {
|
|
338
338
|
return Layer2.createSubclass({
|
|
339
339
|
properties: {
|
|
@@ -351,9 +351,7 @@ var __exports__ = (() => {
|
|
|
351
351
|
layer: this
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
console.error(
|
|
355
|
-
"DeckLayer does not support SceneView at the moment. Use DeckRenderer instead."
|
|
356
|
-
);
|
|
354
|
+
console.error("DeckLayer does not support SceneView at the moment. Use DeckRenderer instead.");
|
|
357
355
|
return null;
|
|
358
356
|
}
|
|
359
357
|
});
|
|
@@ -4532,9 +4530,9 @@ ${source2}`;
|
|
|
4532
4530
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
4533
4531
|
}
|
|
4534
4532
|
this._linkShaders();
|
|
4535
|
-
import_core18.log.time(
|
|
4533
|
+
import_core18.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4536
4534
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
4537
|
-
import_core18.log.timeEnd(
|
|
4535
|
+
import_core18.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4538
4536
|
this.shaderLayout = (0, import_core19.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
|
|
4539
4537
|
switch (this.props.topology) {
|
|
4540
4538
|
case "triangle-fan-webgl":
|
|
@@ -5824,11 +5822,11 @@ ${source2}`;
|
|
|
5824
5822
|
return true;
|
|
5825
5823
|
}
|
|
5826
5824
|
|
|
5827
|
-
//
|
|
5825
|
+
// dist/commons.js
|
|
5828
5826
|
var import_engine = __toESM(require_engine(), 1);
|
|
5829
5827
|
var import_core29 = __toESM(require_core(), 1);
|
|
5830
5828
|
function initializeResources(device) {
|
|
5831
|
-
const
|
|
5829
|
+
const texture = device.createTexture({
|
|
5832
5830
|
format: "rgba8unorm",
|
|
5833
5831
|
width: 1,
|
|
5834
5832
|
height: 1,
|
|
@@ -5839,15 +5837,13 @@ ${source2}`;
|
|
|
5839
5837
|
addressModeV: "clamp-to-edge"
|
|
5840
5838
|
}
|
|
5841
5839
|
});
|
|
5842
|
-
|
|
5843
|
-
this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1]));
|
|
5844
|
-
this.model = new import_engine.Model(device, {
|
|
5840
|
+
const model = new import_engine.Model(device, {
|
|
5845
5841
|
vs: `#version 300 es
|
|
5846
|
-
in vec2
|
|
5842
|
+
in vec2 pos;
|
|
5847
5843
|
out vec2 v_texcoord;
|
|
5848
5844
|
void main(void) {
|
|
5849
|
-
gl_Position = vec4(
|
|
5850
|
-
v_texcoord = (
|
|
5845
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
5846
|
+
v_texcoord = (pos + 1.0) / 2.0;
|
|
5851
5847
|
}
|
|
5852
5848
|
`,
|
|
5853
5849
|
fs: `#version 300 es
|
|
@@ -5862,124 +5858,115 @@ void main(void) {
|
|
|
5862
5858
|
fragColor = imageColor;
|
|
5863
5859
|
}
|
|
5864
5860
|
`,
|
|
5865
|
-
bufferLayout: [{ name: "a_pos", format: "sint8x2" }],
|
|
5866
5861
|
bindings: {
|
|
5867
|
-
deckglTexture
|
|
5862
|
+
deckglTexture: texture
|
|
5868
5863
|
},
|
|
5869
5864
|
parameters: {
|
|
5870
5865
|
depthWriteEnabled: true,
|
|
5871
5866
|
depthCompare: "less-equal"
|
|
5872
5867
|
},
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5868
|
+
geometry: new import_engine.Geometry({
|
|
5869
|
+
topology: "triangle-strip",
|
|
5870
|
+
attributes: {
|
|
5871
|
+
pos: { size: 2, value: new Int8Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1]) }
|
|
5872
|
+
}
|
|
5873
|
+
}),
|
|
5874
|
+
vertexCount: 6
|
|
5878
5875
|
});
|
|
5879
|
-
|
|
5876
|
+
const fbo = device.createFramebuffer({
|
|
5880
5877
|
id: "deckfbo",
|
|
5881
5878
|
width: 1,
|
|
5882
5879
|
height: 1,
|
|
5883
|
-
colorAttachments: [
|
|
5880
|
+
colorAttachments: [texture]
|
|
5884
5881
|
});
|
|
5885
|
-
|
|
5882
|
+
const deckInstance = new import_core29.Deck({
|
|
5886
5883
|
viewState: {},
|
|
5887
5884
|
controller: false,
|
|
5888
|
-
|
|
5885
|
+
device,
|
|
5889
5886
|
parameters: {
|
|
5890
5887
|
depthTest: true
|
|
5891
5888
|
},
|
|
5892
|
-
_framebuffer:
|
|
5889
|
+
_framebuffer: fbo,
|
|
5893
5890
|
width: null,
|
|
5894
5891
|
height: null,
|
|
5895
5892
|
_customRender: (redrawReason) => {
|
|
5896
5893
|
if (redrawReason === "arcgis") {
|
|
5897
|
-
|
|
5894
|
+
deckInstance._drawLayers(redrawReason);
|
|
5898
5895
|
} else {
|
|
5899
5896
|
this.redraw();
|
|
5900
5897
|
}
|
|
5901
5898
|
}
|
|
5902
5899
|
});
|
|
5900
|
+
return { deck: deckInstance, texture, fbo, model };
|
|
5903
5901
|
}
|
|
5904
|
-
function render(
|
|
5905
|
-
const
|
|
5902
|
+
function render(resources, viewport) {
|
|
5903
|
+
const { model, deck, fbo } = resources;
|
|
5904
|
+
const device = model.device;
|
|
5905
|
+
const screenFbo = device.getParametersWebGL(36006);
|
|
5906
|
+
const { width, height, ...viewState } = viewport;
|
|
5906
5907
|
const dpr = window.devicePixelRatio;
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
const device = this.deckInstance.device;
|
|
5908
|
+
const pixelWidth = Math.round(width * dpr);
|
|
5909
|
+
const pixelHeight = Math.round(height * dpr);
|
|
5910
|
+
fbo.resize({ width: pixelWidth, height: pixelHeight });
|
|
5911
|
+
deck.setProps({ viewState });
|
|
5912
|
+
deck.redraw("arcgis");
|
|
5913
5913
|
const textureToScreenPass = device.beginRenderPass({
|
|
5914
5914
|
framebuffer: screenFbo,
|
|
5915
|
-
parameters: { viewport: [0, 0,
|
|
5915
|
+
parameters: { viewport: [0, 0, pixelWidth, pixelHeight] },
|
|
5916
5916
|
clearColor: [0, 0, 0, 0],
|
|
5917
5917
|
clearDepth: 1
|
|
5918
5918
|
});
|
|
5919
|
-
device.withParametersWebGL(
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
this.model.setBindings({
|
|
5926
|
-
deckglTexture: this.deckFbo.colorAttachments[0]
|
|
5927
|
-
});
|
|
5928
|
-
this.model.draw(textureToScreenPass);
|
|
5929
|
-
}
|
|
5930
|
-
);
|
|
5919
|
+
device.withParametersWebGL({
|
|
5920
|
+
blend: true,
|
|
5921
|
+
blendFunc: [1, 771]
|
|
5922
|
+
}, () => {
|
|
5923
|
+
model.draw(textureToScreenPass);
|
|
5924
|
+
});
|
|
5931
5925
|
}
|
|
5932
|
-
function finalizeResources() {
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
this.deckFbo?.delete();
|
|
5938
|
-
this.deckglTexture?.delete();
|
|
5926
|
+
function finalizeResources(resources) {
|
|
5927
|
+
resources.deck.finalize();
|
|
5928
|
+
resources.model.destroy();
|
|
5929
|
+
resources.fbo.destroy();
|
|
5930
|
+
resources.texture.destroy();
|
|
5939
5931
|
}
|
|
5940
5932
|
|
|
5941
|
-
//
|
|
5933
|
+
// dist/deck-layer-view-2d.js
|
|
5942
5934
|
function createDeckLayerView2D(BaseLayerViewGL2D) {
|
|
5943
5935
|
return BaseLayerViewGL2D.createSubclass({
|
|
5944
5936
|
properties: {
|
|
5945
|
-
|
|
5946
|
-
deckFbo: {},
|
|
5947
|
-
model: {},
|
|
5948
|
-
buffer: {}
|
|
5937
|
+
resources: null
|
|
5949
5938
|
},
|
|
5950
5939
|
attach() {
|
|
5951
5940
|
const gl = this.context;
|
|
5952
5941
|
const device = WebGLDevice.attach(gl);
|
|
5953
|
-
initializeResources.call(this, device);
|
|
5954
|
-
this.layer.deck.on("change", (props) => this.
|
|
5955
|
-
this.
|
|
5942
|
+
this.resources = initializeResources.call(this, device);
|
|
5943
|
+
this.layer.deck.on("change", (props) => this.resources.deck.setProps(props));
|
|
5944
|
+
this.resources.deck.setProps(this.layer.deck.toJSON());
|
|
5956
5945
|
},
|
|
5957
5946
|
redraw() {
|
|
5958
5947
|
this.requestRender();
|
|
5959
5948
|
},
|
|
5960
5949
|
detach() {
|
|
5961
|
-
finalizeResources
|
|
5950
|
+
finalizeResources(this.resources);
|
|
5951
|
+
this.resources = null;
|
|
5962
5952
|
},
|
|
5963
5953
|
render(renderParameters) {
|
|
5964
5954
|
const [width, height] = this.view.state.size;
|
|
5965
5955
|
const state = renderParameters.state;
|
|
5966
|
-
render
|
|
5967
|
-
gl: renderParameters.context,
|
|
5956
|
+
render(this.resources, {
|
|
5968
5957
|
width,
|
|
5969
5958
|
height,
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
pitch: 0
|
|
5976
|
-
}
|
|
5959
|
+
latitude: this.view.center.latitude,
|
|
5960
|
+
longitude: this.view.center.longitude,
|
|
5961
|
+
zoom: this.view.featuresTilingScheme.scaleToLevel(state.scale),
|
|
5962
|
+
bearing: -state.rotation,
|
|
5963
|
+
pitch: 0
|
|
5977
5964
|
});
|
|
5978
5965
|
}
|
|
5979
5966
|
});
|
|
5980
5967
|
}
|
|
5981
5968
|
|
|
5982
|
-
//
|
|
5969
|
+
// dist/deck-renderer.js
|
|
5983
5970
|
function arcgisFOVToDeckAltitude(fov, aspectRatio) {
|
|
5984
5971
|
const D = Math.sqrt(1 + aspectRatio ** 2);
|
|
5985
5972
|
const halfFOV = fov / 2 / 180 * Math.PI;
|
|
@@ -5988,44 +5975,46 @@ void main(void) {
|
|
|
5988
5975
|
function createDeckRenderer(DeckProps, externalRenderers) {
|
|
5989
5976
|
class DeckRenderer {
|
|
5990
5977
|
constructor(view, props) {
|
|
5978
|
+
this.resources = null;
|
|
5991
5979
|
this.view = view;
|
|
5992
5980
|
this.deck = new DeckProps(props);
|
|
5993
5981
|
}
|
|
5994
5982
|
setup(context) {
|
|
5995
5983
|
const gl = context.gl;
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
this.
|
|
5984
|
+
const device = WebGLDevice.attach(gl);
|
|
5985
|
+
const resources = initializeResources.call(this, device);
|
|
5986
|
+
this.deck.on("change", (props) => resources.deck.setProps(props));
|
|
5987
|
+
resources.deck.setProps(this.deck.toJSON());
|
|
5988
|
+
this.resources = resources;
|
|
5999
5989
|
}
|
|
6000
5990
|
dispose() {
|
|
6001
|
-
|
|
5991
|
+
if (this.resources) {
|
|
5992
|
+
finalizeResources(this.resources);
|
|
5993
|
+
}
|
|
6002
5994
|
}
|
|
6003
5995
|
redraw() {
|
|
6004
5996
|
externalRenderers.requestRender(this.view);
|
|
6005
5997
|
}
|
|
6006
|
-
render(
|
|
5998
|
+
render() {
|
|
6007
5999
|
const [width, height] = this.view.size;
|
|
6008
|
-
render
|
|
6009
|
-
gl: context.gl,
|
|
6000
|
+
render(this.resources, {
|
|
6010
6001
|
width,
|
|
6011
6002
|
height,
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
pitch: this.view.camera.tilt
|
|
6019
|
-
}
|
|
6003
|
+
latitude: this.view.center.latitude,
|
|
6004
|
+
longitude: this.view.center.longitude,
|
|
6005
|
+
altitude: arcgisFOVToDeckAltitude(this.view.camera.fov, width / height),
|
|
6006
|
+
zoom: this.view.zoom,
|
|
6007
|
+
bearing: this.view.camera.heading,
|
|
6008
|
+
pitch: this.view.camera.tilt
|
|
6020
6009
|
});
|
|
6021
6010
|
}
|
|
6022
6011
|
}
|
|
6023
6012
|
return DeckRenderer;
|
|
6024
6013
|
}
|
|
6025
6014
|
|
|
6026
|
-
//
|
|
6015
|
+
// dist/load-modules.js
|
|
6027
6016
|
var import_esri_loader = __toESM(require_esri_loader(), 1);
|
|
6028
|
-
var arcGIS
|
|
6017
|
+
var arcGIS;
|
|
6029
6018
|
async function loadArcGISModules(modules, loadScriptOptions) {
|
|
6030
6019
|
const namespace = Array.isArray(modules) ? null : modules;
|
|
6031
6020
|
await loadArcGISModule(namespace, loadScriptOptions);
|
|
@@ -6036,28 +6025,24 @@ void main(void) {
|
|
|
6036
6025
|
}
|
|
6037
6026
|
return arcGIS;
|
|
6038
6027
|
}
|
|
6039
|
-
function loadArcGISModule(esri, loadScriptOptions) {
|
|
6028
|
+
async function loadArcGISModule(esri, loadScriptOptions) {
|
|
6040
6029
|
if (arcGIS) {
|
|
6041
6030
|
return arcGIS;
|
|
6042
6031
|
}
|
|
6043
6032
|
if (esri) {
|
|
6044
|
-
const
|
|
6045
|
-
const
|
|
6046
|
-
const
|
|
6047
|
-
const
|
|
6048
|
-
return initialize(
|
|
6049
|
-
}
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
loadScriptOptions
|
|
6058
|
-
).then(([Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers]) => {
|
|
6059
|
-
return initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers);
|
|
6060
|
-
});
|
|
6033
|
+
const Layer3 = esri.layers.Layer;
|
|
6034
|
+
const Accessor3 = esri.core.Accessor;
|
|
6035
|
+
const BaseLayerViewGL2D2 = esri.views["2d"].layers.BaseLayerViewGL2D;
|
|
6036
|
+
const externalRenderers2 = esri.views["3d"].externalRenderers;
|
|
6037
|
+
return initialize(Layer3, Accessor3, BaseLayerViewGL2D2, externalRenderers2);
|
|
6038
|
+
}
|
|
6039
|
+
const [Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers] = await (0, import_esri_loader.loadModules)([
|
|
6040
|
+
"esri/layers/Layer",
|
|
6041
|
+
"esri/core/Accessor",
|
|
6042
|
+
"esri/views/2d/layers/BaseLayerViewGL2D",
|
|
6043
|
+
"esri/views/3d/externalRenderers"
|
|
6044
|
+
], loadScriptOptions);
|
|
6045
|
+
return initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers);
|
|
6061
6046
|
}
|
|
6062
6047
|
function initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers) {
|
|
6063
6048
|
const DeckProps = createDeckProps(Accessor2);
|