@pirireis/webglobeplugins 0.16.7 → 0.17.1
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/Math/angle-calculation.js +1 -0
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/methods.js +6 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/tile-merger.js +298 -0
- package/Math/tessellation/triangle-tessellation-meta.js +195 -42
- package/Math/tessellation/triangle-tessellation.js +5 -1
- package/compass-rose/compass-text-writer.js +39 -33
- package/constants.js +3 -0
- package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
- package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
- package/heatwave/index.js +5 -3
- package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
- package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
- package/investigation-tools/draw/tiles/adapters.js +67 -0
- package/investigation-tools/draw/tiles/tiles.js +128 -0
- package/package.json +4 -2
- package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
- package/programs/arrowfield/logic.js +1 -1
- package/programs/data2legend/density-to-legend.js +24 -29
- package/programs/data2legend/point-to-density-texture.js +14 -17
- package/programs/float2legendwithratio/logic.js +2 -2
- package/programs/float2legendwithratio/object.js +1 -1
- package/programs/helpers/{blender/program.js → blender.js} +1 -1
- package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
- package/programs/index.js +20 -9
- package/programs/line-on-globe/circle-accurate-3d.js +12 -14
- package/programs/line-on-globe/circle-accurate-flat.js +0 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
- package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
- package/programs/picking/pickable-polygon-renderer.js +1 -1
- package/programs/picking/pickable-renderer.js +2 -2
- package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/point-on-globe/square-pixel-point.js +1 -1
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +180 -30
- package/programs/polygon-on-globe/texture-dem-triangles.js +93 -34
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +31 -42
- package/programs/two-d/pixel-padding-for-compass.js +14 -24
- package/programs/vectorfields/logics/drawrectangleparticles.js +9 -8
- package/programs/vectorfields/logics/drawrectangleparticles1.js +112 -0
- package/programs/vectorfields/logics/pixelbased.js +1 -2
- package/programs/vectorfields/pingpongbuffermanager.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
- package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
- package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
- package/range-tools-on-terrain/range-ring/plugin.js +4 -6
- package/semiplugins/lightweight/line-plugin.js +0 -1
- package/semiplugins/shape-on-terrain/arc-plugin.js +9 -2
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
- package/semiplugins/utility/container-plugin.js +94 -0
- package/semiplugins/utility/object-pass-container-plugin.js +80 -0
- package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
- package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
- package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
- package/{point-tracks → tracks/point-tracks}/plugin.js +6 -5
- package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
- package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
- package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
- package/types.js +6 -0
- package/util/account/bufferoffsetmanager.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
- package/util/gl-util/uniform-block/manager.js +0 -1
- package/util/gl-util/uniform-block/types.js +0 -7
- package/util/index.js +10 -13
- package/util/picking/fence.js +16 -18
- package/util/picking/picker-displayer.js +6 -8
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/shaderfunctions/geometrytransformations.js +1 -1
- package/vectorfield/arrowfield/index.js +3 -0
- package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
- package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
- package/{wind → vectorfield/wind}/index.js +1 -1
- package/{wind → vectorfield/wind}/plugin.js +65 -51
- package/write-text/context-text3.js +0 -1
- package/write-text/context-text4.js +2 -1
- package/write-text/objectarraylabels/index.js +2 -0
- package/Math/tessellation/tessellation-algorithm.js +0 -67
- package/arrowfield/index.js +0 -3
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -444
- package/circle-line-chain/chain-list-map.js +0 -201
- package/circle-line-chain/init.js +0 -1
- package/circle-line-chain/plugin.js +0 -411
- package/circle-line-chain/util.js +0 -1
- package/compassrose/compassrose.js +0 -293
- package/compassrose/index.js +0 -2
- package/index.js +0 -12
- package/partialrings/buffer-manager.js +0 -75
- package/partialrings/index.js +0 -2
- package/partialrings/plugin.js +0 -128
- package/partialrings/program.js +0 -279
- package/programs/arrowfield/index.js +0 -2
- package/programs/globe-util/is-globe-moved.js +0 -19
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/wiggle/index.js +0 -2
- package/programs/helpers/blender/index.js +0 -1
- package/programs/helpers/fadeaway/index.js +0 -2
- package/programs/helpers/fadeaway/object.js +0 -14
- package/programs/helpers/index.js +0 -2
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +0 -118
- package/programs/rings/distancering/circleflatprogram.js +0 -116
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
- package/programs/rings/distancering/index.js +0 -6
- package/programs/rings/distancering/paddyflatprogram.js +0 -127
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
- package/programs/two-d/pixel-circle.js +0 -1
- package/programs/vectorfields/index.js +0 -3
- package/rangerings/enum.js +0 -2
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -543
- package/rangerings/rangeringangletext.js +0 -326
- package/rangerings/ring-account.js +0 -112
- package/timetracks/index.js +0 -1
- package/util/build-strategy/general-strategy.js +0 -62
- package/util/gl-util/uniform-block/shader.js +0 -1
- package/util/heatwavedatamanager/index.js +0 -2
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/jshelpers/data-filler.js +0 -17
- package/util/jshelpers/equality.js +0 -18
- package/util/jshelpers/index.js +0 -2
- package/util/jshelpers/timefilters.js +0 -30
- package/util/programs/index.js +0 -1
- package/util/surface-line-data/arc-bboxes.js +0 -25
- package/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/util/surface-line-data/cut-arc.js +0 -1
- package/util/surface-line-data/flow.js +0 -28
- package/util/surface-line-data/rbush-manager.js +0 -1
- package/util/surface-line-data/types.js +0 -1
- package/util/surface-line-data/web-worker.js +0 -1
- package/util/webglobe/rasteroverlay.js +0 -75
- package/write-text/attached-text-writer.js +0 -87
- package/write-text/context-text3old.js +0 -152
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -8
- /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
- /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
- /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
- /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultblendfunction } from "
|
|
3
|
-
import {
|
|
4
|
-
import { pixelBasedMoveProgramCache } from "
|
|
5
|
-
import { drawRectangleParticlesProgramCache } from "
|
|
6
|
-
import {
|
|
7
|
-
import { SeaWaveUbo } from "
|
|
8
|
-
const { PingPongBufferManager, WaveParticalUboManager } = vectorfield;
|
|
1
|
+
import { BBOXGlobeShell } from "../../semiplugins/shell/bbox-renderer";
|
|
2
|
+
import { defaultblendfunction } from "../../util/webglobe/gldefaultstates";
|
|
3
|
+
import { PingPongBufferManager } from "../../programs/vectorfields/pingpongbuffermanager";
|
|
4
|
+
import { pixelBasedMoveProgramCache } from "../../programs/vectorfields/logics/pixelbased";
|
|
5
|
+
import { drawRectangleParticlesProgramCache } from "../../programs/vectorfields/logics/drawrectangleparticles";
|
|
6
|
+
import { FadeAwayProgramCache } from "../../programs/helpers/fadeaway";
|
|
7
|
+
import { SeaWaveUbo } from "../../programs/vectorfields/logics/ubo-new";
|
|
9
8
|
/**
|
|
10
9
|
* STEPS:
|
|
11
10
|
* 1. move particle | buffers: read b1 write b2 | swap buffers b1 <-> b2
|
|
@@ -50,8 +49,8 @@ export default class Plugin {
|
|
|
50
49
|
this.gl = gl;
|
|
51
50
|
this.moveParticle = pixelBasedMoveProgramCache.getProgram(gl);
|
|
52
51
|
this.drawParticle = drawRectangleParticlesProgramCache.getProgram(gl);
|
|
53
|
-
this.fadeAway =
|
|
54
|
-
this.globeShellWiggle = new
|
|
52
|
+
this.fadeAway = FadeAwayProgramCache.get(gl);
|
|
53
|
+
this.globeShellWiggle = new BBOXGlobeShell(gl, globe, this._globeshellparameters);
|
|
55
54
|
const inPositionLocation = this.moveParticle.getInPositionLocation();
|
|
56
55
|
this.bufferManager = new PingPongBufferManager(gl, this._particleCount, inPositionLocation);
|
|
57
56
|
this._rgVectorFieldTexture = this._createRGTexture();
|
|
@@ -122,8 +121,9 @@ export default class Plugin {
|
|
|
122
121
|
}
|
|
123
122
|
;
|
|
124
123
|
this._isFreed = true;
|
|
125
|
-
const { gl,
|
|
126
|
-
fadeAway
|
|
124
|
+
const { gl, globeShellWiggle, _rgVectorFieldTexture, bufferManager, waveUbo, _drawTextures, _frameBuffer } = this;
|
|
125
|
+
this.fadeAway = null;
|
|
126
|
+
FadeAwayProgramCache.release(gl);
|
|
127
127
|
globeShellWiggle.free();
|
|
128
128
|
gl.deleteTexture(_rgVectorFieldTexture);
|
|
129
129
|
// glProgramCache.releaseProgram(gl, MoveParticle);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import WindPlugin from "./plugin";
|
|
2
2
|
import createVectorFieldImage from "./vectorfieldimage";
|
|
3
3
|
import imageToMagnitude, { imageToRadianAngle } from "./imagetovectorfieldandmagnitude";
|
|
4
|
-
import { createImageFromBase64 } from "
|
|
4
|
+
import { createImageFromBase64 } from "../../util/webglobjectbuilders";
|
|
5
5
|
export { createVectorFieldImage, imageToMagnitude, WindPlugin, createImageFromBase64, imageToRadianAngle };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Author: Toprak Nihat Deniz Ozturk
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { createImageFromBase64, createProgramWrapper, createTexture, createBuffer, bindAttribute, bindFramebuffer, bindTexture, getColorRamp } from "../../util/webglobjectbuilders";
|
|
5
|
+
import { defaultblendfunction } from "../../util/webglobe/gldefaultstates";
|
|
5
6
|
import imageToMagnitude, { imageToRadianAngle } from "./imagetovectorfieldandmagnitude";
|
|
6
|
-
import { TexturePointSampler } from "
|
|
7
|
+
import { TexturePointSampler } from "../../heatwave/texture-point-sampler";
|
|
7
8
|
/**
|
|
8
9
|
* Shader Dökümanı:
|
|
9
10
|
* * Vektör alan haritasında kaçış değeri
|
|
@@ -111,7 +112,6 @@ void main() {
|
|
|
111
112
|
|
|
112
113
|
// take EPSG:4236 distortion into account for calculating where the particle moved
|
|
113
114
|
// float distortion = 1.0; //cos(radians(pos.y * 180.0 - 90.0));
|
|
114
|
-
// vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;
|
|
115
115
|
vec2 offset = vec2(velocity.x, velocity.y) * 0.0001 * u_speed_factor;
|
|
116
116
|
|
|
117
117
|
// update particle position, wrapping around the date line
|
|
@@ -415,7 +415,7 @@ export default class WindPlugin {
|
|
|
415
415
|
if (this.gl == null) {
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
this.colorRampTexture =
|
|
418
|
+
this.colorRampTexture = createTexture(this.gl, this.gl.LINEAR, getColorRamp(colors), 16, 16);
|
|
419
419
|
}
|
|
420
420
|
setColorRampDefault() {
|
|
421
421
|
const { uMax, uMin, vMax, vMin } = this.windData;
|
|
@@ -452,8 +452,8 @@ export default class WindPlugin {
|
|
|
452
452
|
values[i]
|
|
453
453
|
]);
|
|
454
454
|
}
|
|
455
|
-
const colorRamp =
|
|
456
|
-
this.colorRampTexture =
|
|
455
|
+
const colorRamp = getColorRamp(colors);
|
|
456
|
+
this.colorRampTexture = createTexture(gl, gl.LINEAR, colorRamp, 16, 16);
|
|
457
457
|
this._rampMax = maxVelocity;
|
|
458
458
|
this._loadRampMax();
|
|
459
459
|
}
|
|
@@ -468,8 +468,8 @@ export default class WindPlugin {
|
|
|
468
468
|
particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions
|
|
469
469
|
}
|
|
470
470
|
// textures to hold the particle state for the current and the next frame
|
|
471
|
-
this.particleStateTexture0 =
|
|
472
|
-
this.particleStateTexture1 =
|
|
471
|
+
this.particleStateTexture0 = createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
472
|
+
this.particleStateTexture1 = createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
473
473
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
474
474
|
gl.useProgram(this.updateProgram.program);
|
|
475
475
|
gl.uniform1f(this.updateProgram.u_wind_res, this.particleStateResolution);
|
|
@@ -482,7 +482,7 @@ export default class WindPlugin {
|
|
|
482
482
|
const particleIndices = new Float32Array(this._numParticles);
|
|
483
483
|
for (let i = 0; i < this._numParticles; i++)
|
|
484
484
|
particleIndices[i] = i;
|
|
485
|
-
this.particleIndexBuffer =
|
|
485
|
+
this.particleIndexBuffer = createBuffer(gl, particleIndices);
|
|
486
486
|
}
|
|
487
487
|
get numParticles() {
|
|
488
488
|
return this._numParticles;
|
|
@@ -504,7 +504,7 @@ export default class WindPlugin {
|
|
|
504
504
|
const windDataMeta = this._windDataMeta;
|
|
505
505
|
const gl = this.gl;
|
|
506
506
|
this.windData = windData;
|
|
507
|
-
this.windTexture =
|
|
507
|
+
this.windTexture = createTexture(gl, gl.LINEAR, windData.image);
|
|
508
508
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
509
509
|
gl.useProgram(this.updateProgram.program);
|
|
510
510
|
gl.uniform2f(this.updateProgram.u_wind_res, windDataMeta.width, windDataMeta.height);
|
|
@@ -532,7 +532,7 @@ export default class WindPlugin {
|
|
|
532
532
|
* @param {Array} windData.bbox - bounding box [minLon, minLat, maxLon, maxLat]
|
|
533
533
|
*/
|
|
534
534
|
setWindDataWithImageBase64(windData) {
|
|
535
|
-
const image =
|
|
535
|
+
const image = createImageFromBase64(windData.image);
|
|
536
536
|
image.onload = () => {
|
|
537
537
|
windData.image = image;
|
|
538
538
|
this.setWind(windData);
|
|
@@ -543,14 +543,14 @@ export default class WindPlugin {
|
|
|
543
543
|
* @returns
|
|
544
544
|
*/
|
|
545
545
|
getTexturePointSampler(type = `magnitude`) {
|
|
546
|
-
if (type
|
|
546
|
+
if (type === `magnitude`) {
|
|
547
547
|
if (!this.texturePointSampler) {
|
|
548
548
|
this._createTexturePointSampler();
|
|
549
549
|
this._setCoorcinatesDataCalculatorData();
|
|
550
550
|
}
|
|
551
551
|
return this.texturePointSampler;
|
|
552
552
|
}
|
|
553
|
-
else if (type
|
|
553
|
+
else if (type === `angle`) {
|
|
554
554
|
if (!this.texturePointSamplerAngle) {
|
|
555
555
|
this._createTexturePointSamplerAngle();
|
|
556
556
|
this._setCoorcinatesDataCalculatorData();
|
|
@@ -638,12 +638,12 @@ export default class WindPlugin {
|
|
|
638
638
|
// globe calls `draw3D` method on each frame
|
|
639
639
|
draw3D(projMatrix, modelviewMatrix, transPos) {
|
|
640
640
|
const gl = this.gl;
|
|
641
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
642
|
-
this.transPos.set([transPos.x, transPos.y, transPos.z], 0);
|
|
643
|
-
this.projMatrix = projMatrix;
|
|
644
|
-
this.modelviewMatrix = modelviewMatrix;
|
|
645
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
646
641
|
if (this._doDraw()) {
|
|
642
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
643
|
+
this.transPos.set([transPos.x, transPos.y, transPos.z], 0);
|
|
644
|
+
this.projMatrix = projMatrix;
|
|
645
|
+
this.modelviewMatrix = modelviewMatrix;
|
|
646
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
647
647
|
const depthTest = gl.isEnabled(gl.DEPTH_TEST);
|
|
648
648
|
if (depthTest)
|
|
649
649
|
gl.disable(gl.DEPTH_TEST);
|
|
@@ -651,32 +651,31 @@ export default class WindPlugin {
|
|
|
651
651
|
this._draw();
|
|
652
652
|
if (depthTest)
|
|
653
653
|
gl.enable(gl.DEPTH_TEST);
|
|
654
|
+
// test visuals
|
|
655
|
+
// gl.viewport(0, 0, 100, 100);
|
|
656
|
+
// this._drawTexture(this.windTexture, 1.0);
|
|
657
|
+
// gl.viewport(0, 100, 100, 100);
|
|
658
|
+
// this._drawTexture(this.particleStateTexture0, 1.0);
|
|
659
|
+
// gl.viewport(0, 200, 100, 100);
|
|
660
|
+
// this._drawTexture(this.colorRampTexture, 1.0);
|
|
661
|
+
this._resetMachineStates();
|
|
662
|
+
this.globe.DrawRender();
|
|
654
663
|
}
|
|
655
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
656
|
-
// test visuals
|
|
657
|
-
// gl.viewport(0, 0, 100, 100);
|
|
658
|
-
// this._drawTexture(this.windTexture, 1.0);
|
|
659
|
-
// gl.viewport(0, 100, 100, 100);
|
|
660
|
-
// this._drawTexture(this.particleStateTexture0, 1.0);
|
|
661
|
-
// gl.viewport(0, 200, 100, 100);
|
|
662
|
-
// this._drawTexture(this.colorRampTexture, 1.0);
|
|
663
|
-
this._resetMachineStates();
|
|
664
|
-
this.globe.DrawRender();
|
|
665
664
|
}
|
|
666
665
|
_drawScreen() {
|
|
667
666
|
const { gl, globe } = this;
|
|
668
|
-
|
|
669
|
-
|
|
667
|
+
bindTexture(gl, this.windTexture, 0);
|
|
668
|
+
bindTexture(gl, this.particleStateTexture0, 1);
|
|
670
669
|
// draw the screen into a temporary framebuffer to retain it as the background on the next frame
|
|
671
|
-
|
|
670
|
+
bindFramebuffer(gl, this.framebuffer, this.screenTexture);
|
|
672
671
|
gl.viewport(0, 0, globe.api_ScrW(), globe.api_ScrH());
|
|
673
672
|
gl.enable(gl.BLEND);
|
|
674
673
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); // non-premultiplied alpha
|
|
675
674
|
this._drawTexture(this.backgroundTexture, this._fadeOpacity);
|
|
676
675
|
this._drawParticles();
|
|
677
|
-
|
|
676
|
+
bindFramebuffer(gl, null);
|
|
678
677
|
this._drawTexture(this.screenTexture, 1.0);
|
|
679
|
-
gl.disable(gl.BLEND);
|
|
678
|
+
// gl.disable(gl.BLEND);
|
|
680
679
|
// save the current screen as the background for the next frame
|
|
681
680
|
const temp = this.backgroundTexture;
|
|
682
681
|
this.backgroundTexture = this.screenTexture;
|
|
@@ -686,11 +685,13 @@ export default class WindPlugin {
|
|
|
686
685
|
const gl = this.gl;
|
|
687
686
|
const program = this.screenProgram;
|
|
688
687
|
gl.useProgram(program.program);
|
|
689
|
-
|
|
690
|
-
|
|
688
|
+
bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
|
|
689
|
+
bindTexture(gl, texture, 2);
|
|
691
690
|
gl.uniform1i(program.u_screen, 2);
|
|
692
691
|
gl.uniform1f(program.u_opacity, opacity);
|
|
693
692
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
693
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
694
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
694
695
|
}
|
|
695
696
|
_loadRampMax() {
|
|
696
697
|
const { gl } = this;
|
|
@@ -706,8 +707,8 @@ export default class WindPlugin {
|
|
|
706
707
|
const { gl, projMatrix, modelviewMatrix, transPos } = this;
|
|
707
708
|
const program = this.drawSphereProgram;
|
|
708
709
|
gl.useProgram(program.program);
|
|
709
|
-
|
|
710
|
-
|
|
710
|
+
bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
|
|
711
|
+
bindTexture(gl, this.colorRampTexture, 2);
|
|
711
712
|
gl.uniform1i(program.u_wind, 0);
|
|
712
713
|
gl.uniform1i(program.u_particles, 1);
|
|
713
714
|
gl.uniform1i(program.u_color_ramp, 2);
|
|
@@ -720,8 +721,8 @@ export default class WindPlugin {
|
|
|
720
721
|
const { gl, transPos, projMatrix, globe } = this;
|
|
721
722
|
const program = this.drawFlatProgram;
|
|
722
723
|
gl.useProgram(program.program);
|
|
723
|
-
|
|
724
|
-
|
|
724
|
+
bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
|
|
725
|
+
bindTexture(gl, this.colorRampTexture, 2);
|
|
725
726
|
gl.uniform1i(program.u_wind, 0);
|
|
726
727
|
gl.uniform1i(program.u_particles, 1);
|
|
727
728
|
gl.uniform1i(program.u_color_ramp, 2);
|
|
@@ -761,25 +762,38 @@ export default class WindPlugin {
|
|
|
761
762
|
_updateParticles() {
|
|
762
763
|
const gl = this.gl;
|
|
763
764
|
const program = this.updateProgram;
|
|
765
|
+
gl.disable(gl.BLEND);
|
|
764
766
|
gl.useProgram(program.program);
|
|
765
767
|
gl.viewport(0, 0, this.particleStateResolution, this.particleStateResolution);
|
|
766
|
-
|
|
768
|
+
bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
|
|
767
769
|
gl.uniform1i(program.u_wind, 0);
|
|
768
770
|
gl.uniform1i(program.u_particles, 1);
|
|
769
|
-
|
|
771
|
+
bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
|
|
770
772
|
gl.uniform1f(program.u_rand_seed, Math.random());
|
|
771
|
-
|
|
773
|
+
bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);
|
|
772
774
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
773
775
|
// swap the particle state textures so the new one becomes the current one
|
|
774
776
|
const temp = this.particleStateTexture0;
|
|
775
777
|
this.particleStateTexture0 = this.particleStateTexture1;
|
|
776
778
|
this.particleStateTexture1 = temp;
|
|
779
|
+
// Add this line to restore the viewport
|
|
780
|
+
gl.viewport(0, 0, this.globe.api_ScrW(), this.globe.api_ScrH());
|
|
777
781
|
}
|
|
778
782
|
_resetMachineStates() {
|
|
779
783
|
const { gl, globe } = this;
|
|
780
|
-
//
|
|
781
|
-
|
|
784
|
+
// Unbind all textures
|
|
785
|
+
for (let i = 0; i < 3; i++) {
|
|
786
|
+
gl.activeTexture(gl.TEXTURE0 + i);
|
|
787
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
788
|
+
}
|
|
782
789
|
gl.activeTexture(gl.TEXTURE0);
|
|
790
|
+
// Unbind buffers
|
|
791
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
792
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
793
|
+
gl.bindVertexArray(null); // Add this line
|
|
794
|
+
gl.enable(gl.BLEND);
|
|
795
|
+
defaultblendfunction(gl);
|
|
796
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
783
797
|
gl.viewport(0, 0, globe.api_ScrW(), globe.api_ScrH());
|
|
784
798
|
}
|
|
785
799
|
_loadHeight() {
|
|
@@ -873,11 +887,11 @@ export default class WindPlugin {
|
|
|
873
887
|
// console.log("init wind plugin")
|
|
874
888
|
this.globe = globe;
|
|
875
889
|
this.gl = gl;
|
|
876
|
-
this.drawSphereProgram =
|
|
877
|
-
this.screenProgram =
|
|
878
|
-
this.updateProgram =
|
|
879
|
-
this.drawFlatProgram =
|
|
880
|
-
this.quadBuffer =
|
|
890
|
+
this.drawSphereProgram = createProgramWrapper(gl, drawSphereVert, drawFrag);
|
|
891
|
+
this.screenProgram = createProgramWrapper(gl, quadVert, screenFrag);
|
|
892
|
+
this.updateProgram = createProgramWrapper(gl, quadVert, updateFrag);
|
|
893
|
+
this.drawFlatProgram = createProgramWrapper(gl, drawFlatVert, drawFrag);
|
|
894
|
+
this.quadBuffer = createBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]));
|
|
881
895
|
this.framebuffer = gl.createFramebuffer();
|
|
882
896
|
this._loadFadeOpacity();
|
|
883
897
|
this._loadSpeedFactor();
|
|
@@ -897,8 +911,8 @@ export default class WindPlugin {
|
|
|
897
911
|
const { gl, globe } = this;
|
|
898
912
|
const emptyPixels = new Uint8Array(globe.api_ScrW() * globe.api_ScrH() * 4);
|
|
899
913
|
// screen textures to hold the drawn screen for the previous and the current frame
|
|
900
|
-
this.backgroundTexture =
|
|
901
|
-
this.screenTexture =
|
|
914
|
+
this.backgroundTexture = createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
|
|
915
|
+
this.screenTexture = createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
|
|
902
916
|
gl.viewport(0, 0, globe.api_ScrW(), globe.api_ScrH());
|
|
903
917
|
}
|
|
904
918
|
// globe calls this `free` on plugin object unregistration
|
|
@@ -103,8 +103,9 @@ export class ContextTextWriter4 {
|
|
|
103
103
|
}, style.zMode === CSZMode.Z_MSL);
|
|
104
104
|
textFont.size = sizeMultiplier * textSize;
|
|
105
105
|
textFont.position = position;
|
|
106
|
-
if (x !== null && y !== null)
|
|
106
|
+
if (x !== null && y !== null) {
|
|
107
107
|
globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffset, y: y - yOffset }, angleIsOn, angle);
|
|
108
|
+
}
|
|
108
109
|
}
|
|
109
110
|
textFont.size = textSize;
|
|
110
111
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @input
|
|
4
|
-
* A series of points defining a polygon
|
|
5
|
-
* @output
|
|
6
|
-
* A series of triangles that fill the polygon
|
|
7
|
-
*
|
|
8
|
-
* @steps
|
|
9
|
-
* @1. cut
|
|
10
|
-
* @2. sort
|
|
11
|
-
* @3. connect
|
|
12
|
-
*
|
|
13
|
-
* @cut
|
|
14
|
-
* @1. find tile cuts on the arcs, tag: enum vertex {pillar, corner},
|
|
15
|
-
* @2. find inner cuts on the arcs
|
|
16
|
-
*
|
|
17
|
-
* @sorter
|
|
18
|
-
* sort by
|
|
19
|
-
* @1 y coordinate, then x coordinate
|
|
20
|
-
* @2
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @connect
|
|
24
|
-
*
|
|
25
|
-
* 1. Pick two rows from the top
|
|
26
|
-
* 2. Go left to right
|
|
27
|
-
* 3. Compeare x values to connect point closest to it
|
|
28
|
-
*
|
|
29
|
-
* @smartConnect
|
|
30
|
-
*
|
|
31
|
-
* if hit from left to right, take a break
|
|
32
|
-
* if hit a concave edge, fonnect all the points until jump over to the following point of the concave
|
|
33
|
-
*
|
|
34
|
-
* that way I can calculate polygons with holes
|
|
35
|
-
*
|
|
36
|
-
* That raises a division
|
|
37
|
-
*
|
|
38
|
-
* instead of dividing into triangles
|
|
39
|
-
* divide into convex polygons
|
|
40
|
-
*
|
|
41
|
-
* convex save points and zoom level of convex shape.
|
|
42
|
-
* populate middle points when on zoom level increase
|
|
43
|
-
*
|
|
44
|
-
* @Future
|
|
45
|
-
*
|
|
46
|
-
* 1. cut is ready.
|
|
47
|
-
* WEBMercator(DEM data) to globe:
|
|
48
|
-
* cutting with tileXY coordinates base and convert back to longlat and vector3
|
|
49
|
-
* solves
|
|
50
|
-
* 2. connect looks promising. Can run on triangle approach as well
|
|
51
|
-
*
|
|
52
|
-
* Solving a polygon
|
|
53
|
-
* in a single shot
|
|
54
|
-
* without dividing into triangles
|
|
55
|
-
* takes all the arcs to be cut in single go.
|
|
56
|
-
* To continue following questions arise:
|
|
57
|
-
* how to match points in a row?
|
|
58
|
-
* Cut arcs in two if they have Z limits
|
|
59
|
-
* cut by parallel lines,
|
|
60
|
-
* sort by x
|
|
61
|
-
* if 2
|
|
62
|
-
* How to handle points in between rows?
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
class PartialTesselation {
|
|
67
|
-
}
|
package/arrowfield/index.js
DELETED
package/bearing-line/index.js
DELETED