@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.
Files changed (159) hide show
  1. package/Math/angle-calculation.js +1 -0
  2. package/Math/contour/quadtreecontours.js +300 -0
  3. package/Math/finite-line-2d.js +58 -0
  4. package/Math/methods.js +6 -0
  5. package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
  6. package/Math/tessellation/tile-merger.js +298 -0
  7. package/Math/tessellation/triangle-tessellation-meta.js +195 -42
  8. package/Math/tessellation/triangle-tessellation.js +5 -1
  9. package/compass-rose/compass-text-writer.js +39 -33
  10. package/constants.js +3 -0
  11. package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
  12. package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
  13. package/heatwave/index.js +5 -3
  14. package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
  15. package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
  16. package/investigation-tools/draw/tiles/adapters.js +67 -0
  17. package/investigation-tools/draw/tiles/tiles.js +128 -0
  18. package/package.json +4 -2
  19. package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
  20. package/programs/arrowfield/logic.js +1 -1
  21. package/programs/data2legend/density-to-legend.js +24 -29
  22. package/programs/data2legend/point-to-density-texture.js +14 -17
  23. package/programs/float2legendwithratio/logic.js +2 -2
  24. package/programs/float2legendwithratio/object.js +1 -1
  25. package/programs/helpers/{blender/program.js → blender.js} +1 -1
  26. package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
  27. package/programs/index.js +20 -9
  28. package/programs/line-on-globe/circle-accurate-3d.js +12 -14
  29. package/programs/line-on-globe/circle-accurate-flat.js +0 -1
  30. package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
  31. package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
  32. package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
  33. package/programs/picking/pickable-polygon-renderer.js +1 -1
  34. package/programs/picking/pickable-renderer.js +2 -2
  35. package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
  36. package/programs/point-on-globe/element-point-glow.js +1 -1
  37. package/programs/point-on-globe/square-pixel-point.js +1 -1
  38. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +180 -30
  39. package/programs/polygon-on-globe/texture-dem-triangles.js +93 -34
  40. package/programs/rings/partial-ring/piece-of-pie.js +26 -29
  41. package/programs/totems/camerauniformblock.js +31 -42
  42. package/programs/two-d/pixel-padding-for-compass.js +14 -24
  43. package/programs/vectorfields/logics/drawrectangleparticles.js +9 -8
  44. package/programs/vectorfields/logics/drawrectangleparticles1.js +112 -0
  45. package/programs/vectorfields/logics/pixelbased.js +1 -2
  46. package/programs/vectorfields/pingpongbuffermanager.js +1 -1
  47. package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
  48. package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
  49. package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
  50. package/range-tools-on-terrain/range-ring/plugin.js +4 -6
  51. package/semiplugins/lightweight/line-plugin.js +0 -1
  52. package/semiplugins/shape-on-terrain/arc-plugin.js +9 -2
  53. package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
  54. package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
  55. package/semiplugins/shell/bbox-renderer/index.js +2 -0
  56. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
  57. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
  58. package/semiplugins/utility/container-plugin.js +94 -0
  59. package/semiplugins/utility/object-pass-container-plugin.js +80 -0
  60. package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
  61. package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
  62. package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
  63. package/{point-tracks → tracks/point-tracks}/plugin.js +6 -5
  64. package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
  65. package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
  66. package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
  67. package/types.js +6 -0
  68. package/util/account/bufferoffsetmanager.js +1 -1
  69. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
  70. package/util/gl-util/uniform-block/manager.js +0 -1
  71. package/util/gl-util/uniform-block/types.js +0 -7
  72. package/util/index.js +10 -13
  73. package/util/picking/fence.js +16 -18
  74. package/util/picking/picker-displayer.js +6 -8
  75. package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
  76. package/util/programs/draw-texture-on-canvas.js +1 -1
  77. package/util/programs/texturetoglobe.js +3 -3
  78. package/util/shaderfunctions/geometrytransformations.js +1 -1
  79. package/vectorfield/arrowfield/index.js +3 -0
  80. package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
  81. package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
  82. package/{wind → vectorfield/wind}/index.js +1 -1
  83. package/{wind → vectorfield/wind}/plugin.js +65 -51
  84. package/write-text/context-text3.js +0 -1
  85. package/write-text/context-text4.js +2 -1
  86. package/write-text/objectarraylabels/index.js +2 -0
  87. package/Math/tessellation/tessellation-algorithm.js +0 -67
  88. package/arrowfield/index.js +0 -3
  89. package/bearing-line/index.js +0 -2
  90. package/bearing-line/plugin.js +0 -444
  91. package/circle-line-chain/chain-list-map.js +0 -201
  92. package/circle-line-chain/init.js +0 -1
  93. package/circle-line-chain/plugin.js +0 -411
  94. package/circle-line-chain/util.js +0 -1
  95. package/compassrose/compassrose.js +0 -293
  96. package/compassrose/index.js +0 -2
  97. package/index.js +0 -12
  98. package/partialrings/buffer-manager.js +0 -75
  99. package/partialrings/index.js +0 -2
  100. package/partialrings/plugin.js +0 -128
  101. package/partialrings/program.js +0 -279
  102. package/programs/arrowfield/index.js +0 -2
  103. package/programs/globe-util/is-globe-moved.js +0 -19
  104. package/programs/globeshell/index.js +0 -2
  105. package/programs/globeshell/wiggle/index.js +0 -2
  106. package/programs/helpers/blender/index.js +0 -1
  107. package/programs/helpers/fadeaway/index.js +0 -2
  108. package/programs/helpers/fadeaway/object.js +0 -14
  109. package/programs/helpers/index.js +0 -2
  110. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +0 -118
  111. package/programs/rings/distancering/circleflatprogram.js +0 -116
  112. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
  113. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
  114. package/programs/rings/distancering/index.js +0 -6
  115. package/programs/rings/distancering/paddyflatprogram.js +0 -127
  116. package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
  117. package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
  118. package/programs/two-d/pixel-circle.js +0 -1
  119. package/programs/vectorfields/index.js +0 -3
  120. package/rangerings/enum.js +0 -2
  121. package/rangerings/index.js +0 -5
  122. package/rangerings/plugin.js +0 -543
  123. package/rangerings/rangeringangletext.js +0 -326
  124. package/rangerings/ring-account.js +0 -112
  125. package/timetracks/index.js +0 -1
  126. package/util/build-strategy/general-strategy.js +0 -62
  127. package/util/gl-util/uniform-block/shader.js +0 -1
  128. package/util/heatwavedatamanager/index.js +0 -2
  129. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  130. package/util/jshelpers/data-filler.js +0 -17
  131. package/util/jshelpers/equality.js +0 -18
  132. package/util/jshelpers/index.js +0 -2
  133. package/util/jshelpers/timefilters.js +0 -30
  134. package/util/programs/index.js +0 -1
  135. package/util/surface-line-data/arc-bboxes.js +0 -25
  136. package/util/surface-line-data/arcs-to-cuts.js +0 -50
  137. package/util/surface-line-data/cut-arc.js +0 -1
  138. package/util/surface-line-data/flow.js +0 -28
  139. package/util/surface-line-data/rbush-manager.js +0 -1
  140. package/util/surface-line-data/types.js +0 -1
  141. package/util/surface-line-data/web-worker.js +0 -1
  142. package/util/webglobe/rasteroverlay.js +0 -75
  143. package/write-text/attached-text-writer.js +0 -87
  144. package/write-text/context-text3old.js +0 -152
  145. package/write-text/index.js +0 -1
  146. package/write-text/writer-plugin.js +0 -8
  147. /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
  148. /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
  149. /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
  150. /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
  151. /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
  152. /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
  153. /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
  154. /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
  155. /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
  156. /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
  157. /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
  158. /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
  159. /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
@@ -1,11 +1,10 @@
1
- import { GlobeShellWiggle } from "../programs";
2
- import { defaultblendfunction } from "../util";
3
- import { vectorfield } from "../programs/index";
4
- import { pixelBasedMoveProgramCache } from "../programs/vectorfields/logics/pixelbased";
5
- import { drawRectangleParticlesProgramCache } from "../programs/vectorfields/logics/drawrectangleparticles";
6
- import { FadeAway } from "../programs";
7
- import { SeaWaveUbo } from "../programs/vectorfields/logics/ubo-new";
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 = new FadeAway(gl);
54
- this.globeShellWiggle = new GlobeShellWiggle(gl, globe, this._globeshellparameters);
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, fadeAway, globeShellWiggle, _rgVectorFieldTexture, bufferManager, waveUbo, _drawTextures, _frameBuffer } = this;
126
- fadeAway.free();
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 "../util/webglobjectbuilders";
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 * as util from "../util";
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 "../util/heatwavedatamanager/texture-point-sampler";
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 = util.createTexture(this.gl, this.gl.LINEAR, util.getColorRamp(colors), 16, 16);
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 = util.getColorRamp(colors);
456
- this.colorRampTexture = util.createTexture(gl, gl.LINEAR, colorRamp, 16, 16);
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 = util.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
472
- this.particleStateTexture1 = util.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
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 = util.createBuffer(gl, particleIndices);
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 = util.createTexture(gl, gl.LINEAR, windData.image);
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 = util.createImageFromBase64(windData.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 == `magnitude`) {
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 == `angle`) {
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
- util.bindTexture(gl, this.windTexture, 0);
669
- util.bindTexture(gl, this.particleStateTexture0, 1);
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
- util.bindFramebuffer(gl, this.framebuffer, this.screenTexture);
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
- util.bindFramebuffer(gl, null);
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
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
690
- util.bindTexture(gl, texture, 2);
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
- util.bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
710
- util.bindTexture(gl, this.colorRampTexture, 2);
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
- util.bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
724
- util.bindTexture(gl, this.colorRampTexture, 2);
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
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
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
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
771
+ bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
770
772
  gl.uniform1f(program.u_rand_seed, Math.random());
771
- util.bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);
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
- // gl.disable(gl.DEPTH_TEST);
781
- // gl.disable(gl.STENCIL_TEST);
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 = util.createProgramWrapper(gl, drawSphereVert, drawFrag);
877
- this.screenProgram = util.createProgramWrapper(gl, quadVert, screenFrag);
878
- this.updateProgram = util.createProgramWrapper(gl, quadVert, updateFrag);
879
- this.drawFlatProgram = util.createProgramWrapper(gl, drawFlatVert, drawFrag);
880
- this.quadBuffer = util.createBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]));
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 = util.createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
901
- this.screenTexture = util.createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
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
@@ -1,4 +1,3 @@
1
- // @ts-ignore
2
1
  import { CSZMode } from "@pirireis/webglobe";
3
2
  import { isTextFont, opacityCheck } from "../util/check/typecheck";
4
3
  /**
@@ -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
  }
@@ -0,0 +1,2 @@
1
+ import ObjectArrayLabels from "./objectarraylabels";
2
+ export default ObjectArrayLabels;
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import ArrowField from "./plugin";
2
- import { centigradePlus90ToRadians } from "./adaptor";
3
- export { ArrowField, centigradePlus90ToRadians };
@@ -1,2 +0,0 @@
1
- import BearingLinePlugin from "./plugin";
2
- export { BearingLinePlugin };