@pirireis/webglobeplugins 1.6.2 → 1.6.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.
- package/altitude-locator/plugin.js +4 -2
- package/heatwave/heatwave.js +2 -1
- package/package.json +1 -1
- package/semiplugins/shape-on-terrain/terrain-polygon/terrain-polygon.js +5 -2
- package/tracks/point-heat-map/point-to-heat-map-flow.js +5 -3
- package/tracks/point-tracks/plugin.js +6 -2
- package/util/picking/picker-displayer.js +5 -3
- package/vectorfield/wind/plugin-persistant.js +0 -2
- package/vectorfield/wind/plugin.js +4 -4
|
@@ -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,
|
|
267
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
|
|
266
268
|
uboLine.update(new Map([
|
|
267
269
|
["u_opacity", [this._opacity]]
|
|
268
270
|
]));
|
package/heatwave/heatwave.js
CHANGED
|
@@ -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,
|
|
49
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
|
|
49
50
|
gl.useProgram(currentProgram);
|
|
50
51
|
this.globe.DrawRender();
|
|
51
52
|
}
|
package/package.json
CHANGED
|
@@ -404,6 +404,7 @@ export class TerrainPolygonSemiPlugin {
|
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
const gl = this.globe.gl;
|
|
407
|
+
const globeFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
|
|
407
408
|
const useDepth = this._useDepth();
|
|
408
409
|
gl.enable(gl.BLEND);
|
|
409
410
|
defaultblendfunction(gl);
|
|
@@ -446,9 +447,11 @@ export class TerrainPolygonSemiPlugin {
|
|
|
446
447
|
// --- FIX END ---
|
|
447
448
|
gl.frontFace(gl.CCW);
|
|
448
449
|
if (this._pickerDisplayer && !this._options.pickablePause && !useDepth) {
|
|
449
|
-
|
|
450
|
-
this._pickerDisplayer.drawColorTexture();
|
|
450
|
+
this._pickerDisplayer.drawColorTexture(globeFBO);
|
|
451
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);
|
|
452
455
|
}
|
|
453
456
|
if (this._options.drawEdges) {
|
|
454
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,
|
|
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,
|
|
42
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, globeFBO);
|
|
41
43
|
}
|
|
42
44
|
defaultblendfunction(gl);
|
|
43
45
|
this._drawLegend(legendTexture, opacity);
|
|
@@ -295,6 +295,11 @@ class PointTracksPlugin {
|
|
|
295
295
|
throw new Error("Plugin is unregistered, PointTracks Plugin");
|
|
296
296
|
}
|
|
297
297
|
this.resize();
|
|
298
|
+
// Save the framebuffer the globe is currently rendering into and pass it to the
|
|
299
|
+
// program so the final composite lands in the globe's render target. The globe may
|
|
300
|
+
// render to its own FBO (3D depth-buffered mode); forcing null would discard the
|
|
301
|
+
// output and break subsequent plugins.
|
|
302
|
+
const globeFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
|
|
298
303
|
_pickerDisplayer.bindFBO();
|
|
299
304
|
_pickerDisplayer.clearTextures();
|
|
300
305
|
if (this._focusParams.on) {
|
|
@@ -303,8 +308,7 @@ class PointTracksPlugin {
|
|
|
303
308
|
else {
|
|
304
309
|
_pointProgram.draw(_vao, _bufferOrchestrator.length, this._drawOptionsUBO, null);
|
|
305
310
|
}
|
|
306
|
-
|
|
307
|
-
_pickerDisplayer.drawColorTexture();
|
|
311
|
+
_pickerDisplayer.drawColorTexture(globeFBO);
|
|
308
312
|
this._selfSelect();
|
|
309
313
|
}
|
|
310
314
|
resize() {
|
|
@@ -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() {
|
|
@@ -175,11 +177,11 @@ class PickerDisplayer {
|
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
// call after drawing the scene with gl picker shader
|
|
178
|
-
drawColorTexture() {
|
|
180
|
+
drawColorTexture(targetFBO) {
|
|
179
181
|
const gl = this.gl;
|
|
180
182
|
const saved = this._saveState();
|
|
181
183
|
try {
|
|
182
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER,
|
|
184
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, targetFBO);
|
|
183
185
|
gl.disable(gl.DEPTH_TEST);
|
|
184
186
|
this.displayer.draw(this.colorTexture);
|
|
185
187
|
}
|
|
@@ -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.
|
|
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) {
|
|
@@ -206,7 +206,6 @@ export default class WindPlugin {
|
|
|
206
206
|
}
|
|
207
207
|
setUseSpeedField(use) {
|
|
208
208
|
if (this.particlePlugin) {
|
|
209
|
-
console.log("use speed field set to ", use);
|
|
210
209
|
this.particlePlugin.setUseSpeedField(use);
|
|
211
210
|
}
|
|
212
211
|
}
|
|
@@ -228,7 +227,6 @@ export default class WindPlugin {
|
|
|
228
227
|
set minSpeed(value) {
|
|
229
228
|
this.options.minSpeed = value;
|
|
230
229
|
if (this.particlePlugin) {
|
|
231
|
-
console.log("value", value);
|
|
232
230
|
this.particlePlugin.setMinSpeedThreshold(value);
|
|
233
231
|
}
|
|
234
232
|
}
|
|
@@ -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,
|
|
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
|