@deck.gl/arcgis 8.10.0-alpha.7 → 9.0.0-alpha.4

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.
@@ -7,16 +7,19 @@ exports.initializeResources = initializeResources;
7
7
  exports.render = render;
8
8
  exports.finalizeResources = finalizeResources;
9
9
 
10
- var _core = require("@deck.gl/core");
10
+ var _engine = require("@luma.gl/engine");
11
+
12
+ var _constants = require("@luma.gl/constants");
11
13
 
12
- var _core2 = require("@luma.gl/core");
14
+ var _webgl = require("@luma.gl/webgl");
15
+
16
+ var _core = require("@deck.gl/core");
13
17
 
14
- function initializeResources(gl) {
18
+ function initializeResources(device) {
15
19
  var _this = this;
16
20
 
17
- (0, _core2.instrumentGLContext)(gl);
18
- this.buffer = new _core2.Buffer(gl, new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));
19
- this.model = new _core2.Model(gl, {
21
+ this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));
22
+ this.model = new _engine.Model(device, {
20
23
  vs: "\n attribute vec2 a_pos;\n varying vec2 v_texcoord;\n void main(void) {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n v_texcoord = (a_pos + 1.0) / 2.0;\n }\n ",
21
24
  fs: "\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texcoord;\n void main(void) {\n vec4 rgba = texture2D(u_texture, v_texcoord);\n rgba.rgb *= rgba.a;\n gl_FragColor = rgba;\n }\n ",
22
25
  attributes: {
@@ -25,14 +28,14 @@ function initializeResources(gl) {
25
28
  vertexCount: 4,
26
29
  drawMode: 5
27
30
  });
28
- this.deckFbo = new _core2.Framebuffer(gl, {
31
+ this.deckFbo = device.createFramebuffer({
29
32
  width: 1,
30
33
  height: 1
31
34
  });
32
35
  this.deckInstance = new _core.Deck({
33
36
  viewState: {},
34
37
  controller: false,
35
- gl: gl,
38
+ gl: device.gl,
36
39
  parameters: {
37
40
  depthTest: true
38
41
  },
@@ -68,7 +71,7 @@ function render(_ref) {
68
71
  viewState: viewState
69
72
  });
70
73
  this.deckInstance.redraw('arcgis');
71
- (0, _core2.withParameters)(gl, {
74
+ (0, _webgl.withGLParameters)(gl, {
72
75
  blend: true,
73
76
  blendFunc: [1, 771],
74
77
  framebuffer: screenFbo,
@@ -76,7 +79,7 @@ function render(_ref) {
76
79
  }, function () {
77
80
  _this2.model.setUniforms({
78
81
  u_texture: _this2.deckFbo
79
- }).draw();
82
+ }).draw(_this2.context.renderPass);
80
83
  });
81
84
  }
82
85
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commons.js"],"names":["initializeResources","gl","buffer","Buffer","Int8Array","model","Model","vs","fs","attributes","a_pos","vertexCount","drawMode","deckFbo","Framebuffer","width","height","deckInstance","Deck","viewState","controller","parameters","depthTest","_framebuffer","_customRender","redrawReason","_drawLayers","redraw","render","screenFbo","getParameter","dpr","window","devicePixelRatio","Math","round","resize","setProps","blend","blendFunc","framebuffer","viewport","setUniforms","u_texture","draw","finalizeResources","finalize","delete"],"mappings":";;;;;;;;;AAEA;;AACA;;AAEO,SAASA,mBAAT,CAA6BC,EAA7B,EAAiC;AAAA;;AACtC,kCAAoBA,EAApB;AAEA,OAAKC,MAAL,GAAc,IAAIC,aAAJ,CAAWF,EAAX,EAAe,IAAIG,SAAJ,CAAc,CAAC,CAAC,CAAF,EAAK,CAAC,CAAN,EAAS,CAAT,EAAY,CAAC,CAAb,EAAgB,CAAC,CAAjB,EAAoB,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,CAAd,CAAf,CAAd;AAEA,OAAKC,KAAL,GAAa,IAAIC,YAAJ,CAAUL,EAAV,EAAc;AACzBM,IAAAA,EAAE,sMADuB;AASzBC,IAAAA,EAAE,wQATuB;AAmBzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,KAAK,EAAE,KAAKR;AADF,KAnBa;AAsBzBS,IAAAA,WAAW,EAAE,CAtBY;AAuBzBC,IAAAA,QAAQ;AAv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K,EAALA,KAAD;AAAQC,IAAAA,MAAM,EAANA;AAAR,GAApB;AAEA,OAAKC,YAAL,CAAkBoB,QAAlB,CAA2B;AAAClB,IAAAA,SAAS,EAATA;AAAD,GAA3B;AAEA,OAAKF,YAAL,CAAkBU,MAAlB,CAAyB,QAAzB;AAGA,6BACE1B,EADF,EAEE;AACEqC,IAAAA,KAAK,EAAE,IADT;AAEEC,IAAAA,SAAS,EAAE,QAFb;AAGEC,IAAAA,WAAW,EAAEX,SAHf;AAIEY,IAAAA,QAAQ,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO1B,KAAP,EAAcC,MAAd;AAJZ,GAFF,EAQE,YAAM;AACJ,IAAA,MAAI,CAACX,KAAL,CAAWqC,WAAX,CAAuB;AAACC,MAAAA,SAAS,EAAE,MAAI,CAAC9B;AAAjB,KAAvB,EAAkD+B,IAAlD;AACD,GAVH;AAYD;;AAEM,SAASC,iBAAT,GAA6B;AAAA;;AAClC,6BAAK5B,YAAL,0EAAmB6B,QAAnB;AACA,OAAK7B,YAAL,GAAoB,IAApB;AAEA,sBAAKZ,KAAL,4DAAY0C,MAAZ;AACA,uBAAK7C,MAAL,8DAAa6C,MAAb;AACA,wBAAKlC,OAAL,gEAAckC,MAAd;AACD","sourcesContent":["/* eslint-disable no-invalid-this */\n\nimport {Deck} from '@deck.gl/core';\nimport {Model, Buffer, Framebuffer, instrumentGLContext, withParameters} from '@luma.gl/core';\n\nexport function initializeResources(gl) {\n instrumentGLContext(gl);\n\n this.buffer = new Buffer(gl, new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));\n\n this.model = new Model(gl, {\n vs: `\n attribute vec2 a_pos;\n varying vec2 v_texcoord;\n void main(void) {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n v_texcoord = (a_pos + 1.0) / 2.0;\n }\n `,\n fs: `\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texcoord;\n void main(void) {\n vec4 rgba = texture2D(u_texture, v_texcoord);\n rgba.rgb *= rgba.a;\n gl_FragColor = rgba;\n }\n `,\n attributes: {\n a_pos: this.buffer\n },\n vertexCount: 4,\n drawMode: gl.TRIANGLE_STRIP\n });\n\n this.deckFbo = new Framebuffer(gl, {width: 1, height: 1});\n\n this.deckInstance = new Deck({\n // The view state will be set dynamically to track the MapView current extent.\n viewState: {},\n\n // Input is handled by the ArcGIS API for JavaScript.\n controller: false,\n\n // We use the same WebGL context as the ArcGIS API for JavaScript.\n gl,\n\n // We need depth testing in general; we don't know what layers might be added to the deck.\n parameters: {\n depthTest: true\n },\n\n // This deck renders into an auxiliary framebuffer.\n _framebuffer: this.deckFbo,\n\n // To disable canvas resizing, since the FBO is owned by the ArcGIS API for JavaScript.\n width: null,\n height: null,\n\n _customRender: redrawReason => {\n if (redrawReason === 'arcgis') {\n this.deckInstance._drawLayers(redrawReason);\n } else {\n this.redraw();\n }\n }\n });\n}\n\nexport function render({gl, width, height, viewState}) {\n const screenFbo = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n /* global window */\n const dpr = window.devicePixelRatio;\n width = Math.round(width * dpr);\n height = Math.round(height * dpr);\n\n this.deckFbo.resize({width, height});\n\n this.deckInstance.setProps({viewState});\n // redraw deck immediately into deckFbo\n this.deckInstance.redraw('arcgis');\n\n // We overlay the texture on top of the map using the full-screen quad.\n withParameters(\n gl,\n {\n blend: true,\n blendFunc: [gl.ONE, gl.ONE_MINUS_SRC_ALPHA],\n framebuffer: screenFbo,\n viewport: [0, 0, width, height]\n },\n () => {\n this.model.setUniforms({u_texture: this.deckFbo}).draw();\n }\n );\n}\n\nexport function finalizeResources() {\n this.deckInstance?.finalize();\n this.deckInstance = null;\n\n this.model?.delete();\n this.buffer?.delete();\n this.deckFbo?.delete();\n}\n"],"file":"commons.js"}
1
+ {"version":3,"sources":["../../src/commons.ts"],"names":["initializeResources","device","buffer","createBuffer","Int8Array","model","Model","vs","fs","attributes","a_pos","vertexCount","drawMode","deckFbo","createFramebuffer","width","height","deckInstance","Deck","viewState","controller","gl","parameters","depthTest","_framebuffer","_customRender","redrawReason","_drawLayers","redraw","render","screenFbo","getParameter","dpr","window","devicePixelRatio","Math","round","resize","setProps","blend","blendFunc","framebuffer","viewport","setUniforms","u_texture","draw","context","renderPass","finalizeResources","finalize","delete"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAEA;;AAEO,SAASA,mBAAT,CAA6BC,MAA7B,EAA6C;AAAA;;AAElD,OAAKC,MAAL,GAAcD,MAAM,CAACE,YAAP,CAAoB,IAAIC,SAAJ,CAAc,CAAC,CAAC,CAAF,EAAK,CAAC,CAAN,EAAS,CAAT,EAAY,CAAC,CAAb,EAAgB,CAAC,CAAjB,EAAoB,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,CAAd,CAApB,CAAd;AAEA,OAAKC,KAAL,GAAa,IAAIC,aAAJ,CAAUL,MAAV,EAAkB;AAC7BM,IAAAA,EAAE,sMAD2B;AAS7BC,IAAAA,EAAE,wQAT2B;AAmB7BC,IAAAA,UAAU,EAAE;AAEVC,MAAAA,KAAK,EAAE,KAAKR;AAFF,KAnBiB;AAuB7BS,IAAAA,WAAW,EAAE,CAvBgB;AAwB7BC,IAAAA,QAAQ;AAxBqB,GAAlB,CAAb;AA2BA,OAAKC,OAAL,GAAeZ,MAAM,CAACa,iBAAP,CAAyB;AAACC,IAAAA,KAAK,EAAE,CAAR;AAAWC,IAAAA,MAAM,EAAE;AAAnB,GAAzB,CAAf;AAEA,OAAKC,YAAL,GAAoB,IAAIC,UAAJ,CAAS;AAE3BC,IAAAA,SAAS,EAAE,EAFgB;AAK3BC,IAAAA,UAAU,EAAE,KALe;AAQ3BC,IAAAA,EAAE,EAAEpB,MAAM,CAACoB,EARgB;AAW3BC,IAAAA,UAAU,EAAE;AACVC,MAAAA,SAAS,EAAE;AADD,KAXe;AAgB3BC,IAAAA,YAAY,EAAE,KAAKX,OAhBQ;AAmB3BE,IAAAA,KAAK,EAAE,IAnBoB;AAoB3BC,IAAAA,MAAM,EAAE,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AAI,CAAC/B;AAAjB,KAAvB,EAAkDgC,IAAlD,CAAuD,MAAI,CAACC,OAAL,CAAaC,UAApE;AACD,GAXH;AAaD;;AAEM,SAASC,iBAAT,GAA6B;AAAA;;AAClC,6BAAK/B,YAAL,0EAAmBgC,QAAnB;AACA,OAAKhC,YAAL,GAAoB,IAApB;AAEA,sBAAKZ,KAAL,4DAAY6C,MAAZ;AACA,uBAAKhD,MAAL,8DAAagD,MAAb;AACA,wBAAKrC,OAAL,gEAAcqC,MAAd;AACD","sourcesContent":["/* eslint-disable no-invalid-this */\n\nimport type {Device} from '@luma.gl/core';\nimport {Model} from '@luma.gl/engine';\nimport {GL} from '@luma.gl/constants';\nimport {withGLParameters} from '@luma.gl/webgl';\n\nimport {Deck} from '@deck.gl/core';\n\nexport function initializeResources(device: Device) {\n // What is `this` referring to this function???\n this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));\n\n this.model = new Model(device, {\n vs: `\n attribute vec2 a_pos;\n varying vec2 v_texcoord;\n void main(void) {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n v_texcoord = (a_pos + 1.0) / 2.0;\n }\n `,\n fs: `\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texcoord;\n void main(void) {\n vec4 rgba = texture2D(u_texture, v_texcoord);\n rgba.rgb *= rgba.a;\n gl_FragColor = rgba;\n }\n `,\n attributes: {\n // eslint-disable-next-line camelcase\n a_pos: this.buffer\n },\n vertexCount: 4,\n drawMode: GL.TRIANGLE_STRIP\n });\n\n this.deckFbo = device.createFramebuffer({width: 1, height: 1});\n\n this.deckInstance = new Deck({\n // The view state will be set dynamically to track the MapView current extent.\n viewState: {},\n\n // Input is handled by the ArcGIS API for JavaScript.\n controller: false,\n\n // We use the same WebGL context as the ArcGIS API for JavaScript.\n gl: device.gl,\n\n // We need depth testing in general; we don't know what layers might be added to the deck.\n parameters: {\n depthTest: true\n },\n\n // This deck renders into an auxiliary framebuffer.\n _framebuffer: this.deckFbo,\n\n // To disable canvas resizing, since the FBO is owned by the ArcGIS API for JavaScript.\n width: null,\n height: null,\n\n _customRender: redrawReason => {\n if (redrawReason === 'arcgis') {\n this.deckInstance._drawLayers(redrawReason);\n } else {\n this.redraw();\n }\n }\n });\n}\n\nexport function render({gl, width, height, viewState}) {\n const screenFbo = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n /* global window */\n const dpr = window.devicePixelRatio;\n width = Math.round(width * dpr);\n height = Math.round(height * dpr);\n\n this.deckFbo.resize({width, height});\n\n this.deckInstance.setProps({viewState});\n // redraw deck immediately into deckFbo\n this.deckInstance.redraw('arcgis');\n\n // We overlay the texture on top of the map using the full-screen quad.\n withGLParameters(\n gl,\n {\n blend: true,\n blendFunc: [gl.ONE, gl.ONE_MINUS_SRC_ALPHA],\n framebuffer: screenFbo,\n viewport: [0, 0, width, height]\n },\n () => {\n // eslint-disable-next-line camelcase\n this.model.setUniforms({u_texture: this.deckFbo}).draw(this.context.renderPass);\n }\n );\n}\n\nexport function finalizeResources() {\n this.deckInstance?.finalize();\n this.deckInstance = null;\n\n this.model?.delete();\n this.buffer?.delete();\n this.deckFbo?.delete();\n}\n"],"file":"commons.js"}
@@ -1,9 +1,10 @@
1
+ import { Model } from '@luma.gl/engine';
2
+ import { GL } from '@luma.gl/constants';
3
+ import { withGLParameters } from '@luma.gl/webgl';
1
4
  import { Deck } from '@deck.gl/core';
2
- import { Model, Buffer, Framebuffer, instrumentGLContext, withParameters } from '@luma.gl/core';
3
- export function initializeResources(gl) {
4
- instrumentGLContext(gl);
5
- this.buffer = new Buffer(gl, new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));
6
- this.model = new Model(gl, {
5
+ export function initializeResources(device) {
6
+ this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));
7
+ this.model = new Model(device, {
7
8
  vs: `
8
9
  attribute vec2 a_pos;
9
10
  varying vec2 v_texcoord;
@@ -28,14 +29,14 @@ export function initializeResources(gl) {
28
29
  vertexCount: 4,
29
30
  drawMode: 5
30
31
  });
31
- this.deckFbo = new Framebuffer(gl, {
32
+ this.deckFbo = device.createFramebuffer({
32
33
  width: 1,
33
34
  height: 1
34
35
  });
35
36
  this.deckInstance = new Deck({
36
37
  viewState: {},
37
38
  controller: false,
38
- gl,
39
+ gl: device.gl,
39
40
  parameters: {
40
41
  depthTest: true
41
42
  },
@@ -69,7 +70,7 @@ export function render({
69
70
  viewState
70
71
  });
71
72
  this.deckInstance.redraw('arcgis');
72
- withParameters(gl, {
73
+ withGLParameters(gl, {
73
74
  blend: true,
74
75
  blendFunc: [1, 771],
75
76
  framebuffer: screenFbo,
@@ -77,7 +78,7 @@ export function render({
77
78
  }, () => {
78
79
  this.model.setUniforms({
79
80
  u_texture: this.deckFbo
80
- }).draw();
81
+ }).draw(this.context.renderPass);
81
82
  });
82
83
  }
83
84
  export function finalizeResources() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commons.js"],"names":["Deck","Model","Buffer","Framebuffer","instrumentGLContext","withParameters","initializeResources","gl","buffer","Int8Array","model","vs","fs","attributes","a_pos","vertexCount","drawMode","deckFbo","width","height","deckInstance","viewState","controller","parameters","depthTest","_framebuffer","_customRender","redrawReason","_drawLayers","redraw","render","screenFbo","getParameter","dpr","window","devicePixelRatio","Math","round","resize","setProps","blend","blendFunc","framebuffer","viewport","setUniforms","u_texture","draw","finalizeResources","finalize","delete"],"mappings":"AAEA,SAAQA,IAAR,QAAmB,eAAnB;AACA,SAAQC,KAAR,EAAeC,MAAf,EAAuBC,WAAvB,EAAoCC,mBAApC,EAAyDC,cAAzD,QAA8E,eAA9E;AAEA,OAAO,SAASC,mBAAT,CAA6BC,EAA7B,EAAiC;AACtCH,EAAAA,mBAAmB,CAACG,EAAD,CAAnB;AAEA,OAAKC,MAAL,GAAc,IAAIN,MAAJ,CAAWK,EAAX,EAAe,IAAIE,SAAJ,CAAc,CAAC,CAAC,CAAF,EAAK,CAAC,CAAN,EAA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AoBE,EAAAA;AAApB,CAAhB,EAAgD;AACrD,QAAMU,SAAS,GAAGxB,EAAE,CAACyB,YAAH,OAAlB;AAGA,QAAMC,GAAG,GAAGC,MAAM,CAACC,gBAAnB;AACAjB,EAAAA,KAAK,GAAGkB,IAAI,CAACC,KAAL,CAAWnB,KAAK,GAAGe,GAAnB,CAAR;AACAd,EAAAA,MAAM,GAAGiB,IAAI,CAACC,KAAL,CAAWlB,MAAM,GAAGc,GAApB,CAAT;AAEA,OAAKhB,OAAL,CAAaqB,MAAb,CAAoB;AAACpB,IAAAA,KAAD;AAAQC,IAAAA;AAAR,GAApB;AAEA,OAAKC,YAAL,CAAkBmB,QAAlB,CAA2B;AAAClB,IAAAA;AAAD,GAA3B;AAEA,OAAKD,YAAL,CAAkBS,MAAlB,CAAyB,QAAzB;AAGAxB,EAAAA,cAAc,CACZE,EADY,EAEZ;AACEiC,IAAAA,KAAK,EAAE,IADT;AAEEC,IAAAA,SAAS,EAAE,QAFb;AAGEC,IAAAA,WAAW,EAAEX,SAHf;AAIEY,IAAAA,QAAQ,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAOzB,KAAP,EAAcC,MAAd;AAJZ,GAFY,EAQZ,MAAM;AACJ,SAAKT,KAAL,CAAWkC,WAAX,CAAuB;AAACC,MAAAA,SAAS,EAAE,KAAK5B;AAAjB,KAAvB,EAAkD6B,IAAlD;AACD,GAVW,CAAd;AAYD;AAED,OAAO,SAASC,iBAAT,GAA6B;AAAA;;AAClC,6BAAK3B,YAAL,0EAAmB4B,QAAnB;AACA,OAAK5B,YAAL,GAAoB,IAApB;AAEA,sBAAKV,KAAL,4DAAYuC,MAAZ;AACA,uBAAKzC,MAAL,8DAAayC,MAAb;AACA,wBAAKhC,OAAL,gEAAcgC,MAAd;AACD","sourcesContent":["/* eslint-disable no-invalid-this */\n\nimport {Deck} from '@deck.gl/core';\nimport {Model, Buffer, Framebuffer, instrumentGLContext, withParameters} from '@luma.gl/core';\n\nexport function initializeResources(gl) {\n instrumentGLContext(gl);\n\n this.buffer = new Buffer(gl, new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));\n\n this.model = new Model(gl, {\n vs: `\n attribute vec2 a_pos;\n varying vec2 v_texcoord;\n void main(void) {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n v_texcoord = (a_pos + 1.0) / 2.0;\n }\n `,\n fs: `\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texcoord;\n void main(void) {\n vec4 rgba = texture2D(u_texture, v_texcoord);\n rgba.rgb *= rgba.a;\n gl_FragColor = rgba;\n }\n `,\n attributes: {\n a_pos: this.buffer\n },\n vertexCount: 4,\n drawMode: gl.TRIANGLE_STRIP\n });\n\n this.deckFbo = new Framebuffer(gl, {width: 1, height: 1});\n\n this.deckInstance = new Deck({\n // The view state will be set dynamically to track the MapView current extent.\n viewState: {},\n\n // Input is handled by the ArcGIS API for JavaScript.\n controller: false,\n\n // We use the same WebGL context as the ArcGIS API for JavaScript.\n gl,\n\n // We need depth testing in general; we don't know what layers might be added to the deck.\n parameters: {\n depthTest: true\n },\n\n // This deck renders into an auxiliary framebuffer.\n _framebuffer: this.deckFbo,\n\n // To disable canvas resizing, since the FBO is owned by the ArcGIS API for JavaScript.\n width: null,\n height: null,\n\n _customRender: redrawReason => {\n if (redrawReason === 'arcgis') {\n this.deckInstance._drawLayers(redrawReason);\n } else {\n this.redraw();\n }\n }\n });\n}\n\nexport function render({gl, width, height, viewState}) {\n const screenFbo = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n /* global window */\n const dpr = window.devicePixelRatio;\n width = Math.round(width * dpr);\n height = Math.round(height * dpr);\n\n this.deckFbo.resize({width, height});\n\n this.deckInstance.setProps({viewState});\n // redraw deck immediately into deckFbo\n this.deckInstance.redraw('arcgis');\n\n // We overlay the texture on top of the map using the full-screen quad.\n withParameters(\n gl,\n {\n blend: true,\n blendFunc: [gl.ONE, gl.ONE_MINUS_SRC_ALPHA],\n framebuffer: screenFbo,\n viewport: [0, 0, width, height]\n },\n () => {\n this.model.setUniforms({u_texture: this.deckFbo}).draw();\n }\n );\n}\n\nexport function finalizeResources() {\n this.deckInstance?.finalize();\n this.deckInstance = null;\n\n this.model?.delete();\n this.buffer?.delete();\n this.deckFbo?.delete();\n}\n"],"file":"commons.js"}
1
+ {"version":3,"sources":["../../src/commons.ts"],"names":["Model","GL","withGLParameters","Deck","initializeResources","device","buffer","createBuffer","Int8Array","model","vs","fs","attributes","a_pos","vertexCount","drawMode","deckFbo","createFramebuffer","width","height","deckInstance","viewState","controller","gl","parameters","depthTest","_framebuffer","_customRender","redrawReason","_drawLayers","redraw","render","screenFbo","getParameter","dpr","window","devicePixelRatio","Math","round","resize","setProps","blend","blendFunc","framebuffer","viewport","setUniforms","u_texture","draw","context","renderPass","finalizeResources","finalize","delete"],"mappings":"AAGA,SAAQA,KAAR,QAAoB,iBAApB;AACA,SAAQC,EAAR,QAAiB,oBAAjB;AACA,SAAQC,gBAAR,QAA+B,gBAA/B;AAEA,SAAQC,IAAR,QAAmB,eAAnB;AAEA,OAAO,SAASC,mBAAT,CAA6BC,MAA7B,EAA6C;AAElD,OAAKC,MAAL,GAAcD,MAAM,CAACE,YAAP,CAAoB,IAAIC,SAAJ,CAAc,CAAC,CAAC,CAAF,EAAK,CAAC,CAAN,EAAS,CAAT,EAAY,CAAC,CAAb,EAAgB,CAAC,CAAjB,EAAoB,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,CAAd,CAApB,CAAd;AAEA,OAAKC,KAAL,GAAa,IAAIT,KAAJ,CAAUK,MAAV,EAAkB;AAC7BK,IAAAA,EAAE,EAAG;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KARiC;AAS7BC,IAAAA,EAAE,EAAG;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAlBiC;AAmB7BC,IAAAA,UAAU,EAAE;AAEVC,MAAAA,KAAK,EAAE,KAAKP;AAFF,KAnBiB;AAuB7BQ,IAAAA,WAAW,EAAE,C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AL,CAAkBoB,QAAlB,CAA2B;AAACnB,IAAAA;AAAD,GAA3B;AAEA,OAAKD,YAAL,CAAkBU,MAAlB,CAAyB,QAAzB;AAGA5B,EAAAA,gBAAgB,CACdqB,EADc,EAEd;AACEkB,IAAAA,KAAK,EAAE,IADT;AAEEC,IAAAA,SAAS,EAAE,QAFb;AAGEC,IAAAA,WAAW,EAAEX,SAHf;AAIEY,IAAAA,QAAQ,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO1B,KAAP,EAAcC,MAAd;AAJZ,GAFc,EAQd,MAAM;AAEJ,SAAKV,KAAL,CAAWoC,WAAX,CAAuB;AAACC,MAAAA,SAAS,EAAE,KAAK9B;AAAjB,KAAvB,EAAkD+B,IAAlD,CAAuD,KAAKC,OAAL,CAAaC,UAApE;AACD,GAXa,CAAhB;AAaD;AAED,OAAO,SAASC,iBAAT,GAA6B;AAAA;;AAClC,6BAAK9B,YAAL,0EAAmB+B,QAAnB;AACA,OAAK/B,YAAL,GAAoB,IAApB;AAEA,sBAAKX,KAAL,4DAAY2C,MAAZ;AACA,uBAAK9C,MAAL,8DAAa8C,MAAb;AACA,wBAAKpC,OAAL,gEAAcoC,MAAd;AACD","sourcesContent":["/* eslint-disable no-invalid-this */\n\nimport type {Device} from '@luma.gl/core';\nimport {Model} from '@luma.gl/engine';\nimport {GL} from '@luma.gl/constants';\nimport {withGLParameters} from '@luma.gl/webgl';\n\nimport {Deck} from '@deck.gl/core';\n\nexport function initializeResources(device: Device) {\n // What is `this` referring to this function???\n this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));\n\n this.model = new Model(device, {\n vs: `\n attribute vec2 a_pos;\n varying vec2 v_texcoord;\n void main(void) {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n v_texcoord = (a_pos + 1.0) / 2.0;\n }\n `,\n fs: `\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texcoord;\n void main(void) {\n vec4 rgba = texture2D(u_texture, v_texcoord);\n rgba.rgb *= rgba.a;\n gl_FragColor = rgba;\n }\n `,\n attributes: {\n // eslint-disable-next-line camelcase\n a_pos: this.buffer\n },\n vertexCount: 4,\n drawMode: GL.TRIANGLE_STRIP\n });\n\n this.deckFbo = device.createFramebuffer({width: 1, height: 1});\n\n this.deckInstance = new Deck({\n // The view state will be set dynamically to track the MapView current extent.\n viewState: {},\n\n // Input is handled by the ArcGIS API for JavaScript.\n controller: false,\n\n // We use the same WebGL context as the ArcGIS API for JavaScript.\n gl: device.gl,\n\n // We need depth testing in general; we don't know what layers might be added to the deck.\n parameters: {\n depthTest: true\n },\n\n // This deck renders into an auxiliary framebuffer.\n _framebuffer: this.deckFbo,\n\n // To disable canvas resizing, since the FBO is owned by the ArcGIS API for JavaScript.\n width: null,\n height: null,\n\n _customRender: redrawReason => {\n if (redrawReason === 'arcgis') {\n this.deckInstance._drawLayers(redrawReason);\n } else {\n this.redraw();\n }\n }\n });\n}\n\nexport function render({gl, width, height, viewState}) {\n const screenFbo = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n /* global window */\n const dpr = window.devicePixelRatio;\n width = Math.round(width * dpr);\n height = Math.round(height * dpr);\n\n this.deckFbo.resize({width, height});\n\n this.deckInstance.setProps({viewState});\n // redraw deck immediately into deckFbo\n this.deckInstance.redraw('arcgis');\n\n // We overlay the texture on top of the map using the full-screen quad.\n withGLParameters(\n gl,\n {\n blend: true,\n blendFunc: [gl.ONE, gl.ONE_MINUS_SRC_ALPHA],\n framebuffer: screenFbo,\n viewport: [0, 0, width, height]\n },\n () => {\n // eslint-disable-next-line camelcase\n this.model.setUniforms({u_texture: this.deckFbo}).draw(this.context.renderPass);\n }\n );\n}\n\nexport function finalizeResources() {\n this.deckInstance?.finalize();\n this.deckInstance = null;\n\n this.model?.delete();\n this.buffer?.delete();\n this.deckFbo?.delete();\n}\n"],"file":"commons.js"}