@pirireis/webglobeplugins 1.6.3 → 1.6.5

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.
@@ -195,6 +195,7 @@ class PointGlowLineToEarthPlugin {
195
195
  draw3D() {
196
196
  const { _pickableWrapper, _bufferOrchestrator, _drawRange, _pickerDisplayer } = this;
197
197
  const { globe, gl } = this;
198
+ const globeFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
198
199
  this._hoverAgent();
199
200
  this.resize();
200
201
  const is3D = globe.api_GetCurrentGeometry() == 0;
@@ -203,7 +204,7 @@ class PointGlowLineToEarthPlugin {
203
204
  drawRange,
204
205
  };
205
206
  this._doDraw(drawOptionsPoint, is3D, drawRange);
206
- _pickerDisplayer.drawColorTexture();
207
+ _pickerDisplayer.drawColorTexture(globeFBO);
207
208
  if (this._hoveredObjectId === -1) {
208
209
  return;
209
210
  }
@@ -242,6 +243,7 @@ class PointGlowLineToEarthPlugin {
242
243
  _doDraw(drawOptionsPoint, is3D, drawRange) {
243
244
  const { gl, _pickableWrapper, _pickerDisplayer } = this;
244
245
  const { program, vao, ubo, uboLine, vaoLine } = _pickableWrapper;
246
+ const globeFBO = this.gl.getParameter(gl.FRAMEBUFFER_BINDING);
245
247
  if (this._doesChanged()) {
246
248
  _pickerDisplayer.bindFBO();
247
249
  _pickerDisplayer.clearTextures();
@@ -262,7 +264,7 @@ class PointGlowLineToEarthPlugin {
262
264
  ]));
263
265
  program.draw(vaoLine, drawOptionsLine, uboLine);
264
266
  }
265
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
267
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
266
268
  uboLine.update(new Map([
267
269
  ["u_opacity", [this._opacity]]
268
270
  ]));
@@ -36,6 +36,7 @@ export class HeatWavePlugin {
36
36
  }
37
37
  drawHeat() {
38
38
  const gl = this.gl;
39
+ const globeFBO = this.gl.getParameter(gl.FRAMEBUFFER_BINDING);
39
40
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
40
41
  gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._coloredHeatTexture, 0);
41
42
  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
@@ -45,7 +46,7 @@ export class HeatWavePlugin {
45
46
  gl.viewport(0, 0, ...this._resolution);
46
47
  this.heatProgram.draw();
47
48
  gl.viewport(0, 0, currentWidth, currentHeight);
48
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
49
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
49
50
  gl.useProgram(currentProgram);
50
51
  this.globe.DrawRender();
51
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -447,9 +447,11 @@ export class TerrainPolygonSemiPlugin {
447
447
  // --- FIX END ---
448
448
  gl.frontFace(gl.CCW);
449
449
  if (this._pickerDisplayer && !this._options.pickablePause && !useDepth) {
450
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
451
450
  this._pickerDisplayer.drawColorTexture(globeFBO);
452
451
  this._selfSelect();
452
+ // Restore the globe FBO so edges (and any later globe rendering) draw to the
453
+ // visible target. drawColorTexture restores to the picker FBO internally.
454
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
453
455
  }
454
456
  if (this._options.drawEdges) {
455
457
  this._program.draw(this._attributeLoader, this._drawRealEdgeArcs, this._uboForRealEdgeArcs);
@@ -24,20 +24,22 @@ class PointHeatmapFlow {
24
24
  this._bindTextureToFramebuffer();
25
25
  }
26
26
  _bindTextureToFramebuffer() {
27
- const { gl, densityTexture, framebuffer } = this;
27
+ const { gl, densityTexture, framebuffer, globe } = this;
28
+ const globeFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
28
29
  gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
29
30
  gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, densityTexture, 0);
30
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
31
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
31
32
  }
32
33
  draw(legendTexture, pointSize, opacity = 1.0) {
33
34
  const { gl, globe, framebuffer } = this;
35
+ const globeFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
34
36
  if (this._drawDensityRequired || this._isVisionChanged()) {
35
37
  gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
36
38
  gl.clearColor(0, 0, 0, 0);
37
39
  gl.viewport(0, 0, Math.floor(globe.api_ScrW()), Math.floor(globe.api_ScrH()));
38
40
  gl.clear(gl.COLOR_BUFFER_BIT);
39
41
  this._drawDensity(pointSize);
40
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
42
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
41
43
  }
42
44
  defaultblendfunction(gl);
43
45
  this._drawLegend(legendTexture, opacity);
@@ -310,6 +310,7 @@ class PointTracksPlugin {
310
310
  }
311
311
  _pickerDisplayer.drawColorTexture(globeFBO);
312
312
  this._selfSelect();
313
+ gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
313
314
  }
314
315
  resize() {
315
316
  const w = this.globe.api_ScrW();
@@ -136,6 +136,7 @@ class PickerDisplayer {
136
136
  clearTextures() {
137
137
  const gl = this.gl;
138
138
  const saved = this._saveState();
139
+ const currentFrameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
139
140
  try {
140
141
  this.bindFBO();
141
142
  // Clear Index Attachment (Attachment 1)
@@ -160,6 +161,7 @@ class PickerDisplayer {
160
161
  finally {
161
162
  this._restoreState(saved);
162
163
  }
164
+ gl.bindFramebuffer(gl.FRAMEBUFFER, currentFrameBuffer);
163
165
  }
164
166
  // call before drawing the scene with gl picker shader
165
167
  bindFBO() {
@@ -277,7 +279,7 @@ class PickerDisplayer {
277
279
  const { gl } = this;
278
280
  const pbo = gl.createBuffer();
279
281
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pbo);
280
- gl.bufferData(gl.PIXEL_PACK_BUFFER, sizeInBytes, gl.STREAM_READ);
282
+ gl.bufferData(gl.PIXEL_PACK_BUFFER, sizeInBytes, gl.STREAM_DRAW);
281
283
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
282
284
  this._pboSize = sizeInBytes;
283
285
  if (this._pbo !== undefined) {
@@ -372,7 +372,6 @@ export default class WindPlugin {
372
372
  // Holds the framebuffer the globe was rendering into when draw3D was called.
373
373
  // The globe may render to its own FBO (e.g. for depth-buffered 3D mode), so the
374
374
  // wind plugin must restore it instead of forcing the default framebuffer (null).
375
- this._prevFBO = null;
376
375
  }
377
376
  // Uniforms are loaded once, on initiation and when they are changed.
378
377
  set height(value) {
@@ -630,16 +629,17 @@ export default class WindPlugin {
630
629
  return true;
631
630
  }
632
631
  }
633
- _draw() {
632
+ _draw(targetFBO) {
634
633
  const gl = this.gl;
635
634
  this._drawScreen();
636
635
  this._updateParticles();
637
- gl.bindFramebuffer(gl.FRAMEBUFFER, this._prevFBO);
636
+ gl.bindFramebuffer(gl.FRAMEBUFFER, targetFBO);
638
637
  }
639
638
  // globe calls `draw3D` method on each frame
640
639
  draw3D(projMatrix, modelviewMatrix, transPos) {
641
640
  const gl = this.gl;
642
641
  if (this._doDraw()) {
642
+ const currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
643
643
  // Save the framebuffer the globe is currently rendering into and restore it
644
644
  // when we are done. The globe may render to its own FBO (3D depth-buffered
645
645
  // mode), so we must not force the default framebuffer (null).
@@ -652,7 +652,7 @@ export default class WindPlugin {
652
652
  if (depthTest)
653
653
  gl.disable(gl.DEPTH_TEST);
654
654
  // if (gl.disable(gl.STENCIL_TEST); //
655
- this._draw();
655
+ this._draw(currentFBO);
656
656
  if (depthTest)
657
657
  gl.enable(gl.DEPTH_TEST);
658
658
  // test visuals