@pirireis/webglobeplugins 0.16.7 → 0.17.0

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 (152) 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/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
  5. package/Math/tessellation/tile-merger.js +56 -0
  6. package/Math/tessellation/triangle-tessellation-meta.js +178 -32
  7. package/Math/tessellation/triangle-tessellation.js +5 -1
  8. package/compass-rose/compass-text-writer.js +39 -33
  9. package/constants.js +3 -0
  10. package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
  11. package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
  12. package/heatwave/index.js +5 -3
  13. package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
  14. package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
  15. package/package.json +4 -2
  16. package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
  17. package/programs/arrowfield/logic.js +1 -1
  18. package/programs/data2legend/density-to-legend.js +24 -29
  19. package/programs/data2legend/point-to-density-texture.js +14 -17
  20. package/programs/float2legendwithratio/logic.js +2 -2
  21. package/programs/float2legendwithratio/object.js +1 -1
  22. package/programs/helpers/{blender/program.js → blender.js} +1 -1
  23. package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
  24. package/programs/index.js +20 -9
  25. package/programs/line-on-globe/circle-accurate-3d.js +12 -14
  26. package/programs/line-on-globe/circle-accurate-flat.js +0 -1
  27. package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
  28. package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
  29. package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
  30. package/programs/picking/pickable-polygon-renderer.js +1 -1
  31. package/programs/picking/pickable-renderer.js +2 -2
  32. package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
  33. package/programs/point-on-globe/element-point-glow.js +1 -1
  34. package/programs/point-on-globe/square-pixel-point.js +1 -1
  35. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +32 -6
  36. package/programs/polygon-on-globe/texture-dem-triangles.js +32 -5
  37. package/programs/rings/partial-ring/piece-of-pie.js +26 -29
  38. package/programs/totems/camerauniformblock.js +31 -42
  39. package/programs/two-d/pixel-padding-for-compass.js +14 -24
  40. package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
  41. package/programs/vectorfields/logics/pixelbased.js +1 -2
  42. package/programs/vectorfields/pingpongbuffermanager.js +1 -1
  43. package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
  44. package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
  45. package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
  46. package/range-tools-on-terrain/range-ring/plugin.js +4 -6
  47. package/semiplugins/lightweight/line-plugin.js +0 -1
  48. package/semiplugins/shape-on-terrain/arc-plugin.js +0 -2
  49. package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
  50. package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
  51. package/semiplugins/shell/bbox-renderer/index.js +2 -0
  52. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
  53. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
  54. package/semiplugins/utility/container-plugin.js +94 -0
  55. package/semiplugins/utility/object-pass-container-plugin.js +80 -0
  56. package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
  57. package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
  58. package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
  59. package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
  60. package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
  61. package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
  62. package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
  63. package/types.js +6 -0
  64. package/util/account/bufferoffsetmanager.js +1 -1
  65. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
  66. package/util/gl-util/uniform-block/manager.js +0 -1
  67. package/util/gl-util/uniform-block/types.js +0 -7
  68. package/util/index.js +10 -13
  69. package/util/picking/fence.js +16 -18
  70. package/util/picking/picker-displayer.js +4 -6
  71. package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
  72. package/util/programs/draw-texture-on-canvas.js +1 -1
  73. package/util/programs/texturetoglobe.js +3 -3
  74. package/util/webglobe/rasteroverlay.js +1 -0
  75. package/vectorfield/arrowfield/index.js +3 -0
  76. package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
  77. package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
  78. package/{wind → vectorfield/wind}/index.js +1 -1
  79. package/{wind → vectorfield/wind}/plugin.js +32 -32
  80. package/write-text/attached-text-writer.js +9 -1
  81. package/write-text/context-text3.js +0 -1
  82. package/write-text/objectarraylabels/index.js +2 -0
  83. package/Math/tessellation/tessellation-algorithm.js +0 -67
  84. package/arrowfield/index.js +0 -3
  85. package/bearing-line/index.js +0 -2
  86. package/bearing-line/plugin.js +0 -444
  87. package/circle-line-chain/chain-list-map.js +0 -201
  88. package/circle-line-chain/plugin.js +0 -411
  89. package/circle-line-chain/util.js +0 -1
  90. package/compassrose/compassrose.js +0 -293
  91. package/compassrose/index.js +0 -2
  92. package/index.js +0 -12
  93. package/partialrings/buffer-manager.js +0 -75
  94. package/partialrings/index.js +0 -2
  95. package/partialrings/plugin.js +0 -128
  96. package/partialrings/program.js +0 -279
  97. package/programs/arrowfield/index.js +0 -2
  98. package/programs/globe-util/is-globe-moved.js +0 -19
  99. package/programs/globeshell/index.js +0 -2
  100. package/programs/globeshell/wiggle/index.js +0 -2
  101. package/programs/helpers/blender/index.js +0 -1
  102. package/programs/helpers/fadeaway/index.js +0 -2
  103. package/programs/helpers/fadeaway/object.js +0 -14
  104. package/programs/helpers/index.js +0 -2
  105. package/programs/rings/distancering/circleflatprogram.js +0 -116
  106. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
  107. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
  108. package/programs/rings/distancering/index.js +0 -6
  109. package/programs/rings/distancering/paddyflatprogram.js +0 -127
  110. package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
  111. package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
  112. package/programs/two-d/pixel-circle.js +0 -1
  113. package/programs/vectorfields/index.js +0 -3
  114. package/rangerings/enum.js +0 -2
  115. package/rangerings/index.js +0 -5
  116. package/rangerings/plugin.js +0 -543
  117. package/rangerings/rangeringangletext.js +0 -326
  118. package/rangerings/ring-account.js +0 -112
  119. package/timetracks/index.js +0 -1
  120. package/util/build-strategy/general-strategy.js +0 -62
  121. package/util/gl-util/uniform-block/shader.js +0 -1
  122. package/util/heatwavedatamanager/index.js +0 -2
  123. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  124. package/util/jshelpers/data-filler.js +0 -17
  125. package/util/jshelpers/equality.js +0 -18
  126. package/util/jshelpers/index.js +0 -2
  127. package/util/jshelpers/timefilters.js +0 -30
  128. package/util/programs/index.js +0 -1
  129. package/util/surface-line-data/arc-bboxes.js +0 -25
  130. package/util/surface-line-data/arcs-to-cuts.js +0 -50
  131. package/util/surface-line-data/cut-arc.js +0 -1
  132. package/util/surface-line-data/flow.js +0 -28
  133. package/util/surface-line-data/rbush-manager.js +0 -1
  134. package/util/surface-line-data/types.js +0 -1
  135. package/util/surface-line-data/web-worker.js +0 -1
  136. package/write-text/context-text3old.js +0 -152
  137. package/write-text/index.js +0 -1
  138. package/write-text/writer-plugin.js +0 -8
  139. /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
  140. /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
  141. /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
  142. /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
  143. /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
  144. /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
  145. /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
  146. /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
  147. /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
  148. /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
  149. /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
  150. /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
  151. /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
  152. /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
package/util/index.js CHANGED
@@ -1,13 +1,10 @@
1
- import * as webglobjectbuilders from './webglobjectbuilders';
2
- import * as shaderfunctions from './shaderfunctions';
3
- import * as geometry from './geometry';
4
- import * as webglobe from './webglobe';
5
- import * as programs from './programs';
6
- import * as heatwavedatamanager from './heatwavedatamanager';
7
- export { webglobjectbuilders, shaderfunctions, geometry, webglobe, programs, heatwavedatamanager };
8
- export * from './webglobe';
9
- export * from './webglobjectbuilders';
10
- export * from './shaderfunctions';
11
- export * from './geometry';
12
- export * from './programs';
13
- export * from './heatwavedatamanager';
1
+ "use strict";
2
+ // import * as webglobjectbuilders from './webglobjectbuilders';
3
+ // import * as shaderfunctions from './shaderfunctions';
4
+ // import * as geometry from './geometry';
5
+ // import * as webglobe from './webglobe';
6
+ // export { webglobjectbuilders, shaderfunctions, geometry, webglobe };
7
+ // export * from './webglobe';
8
+ // export * from './webglobjectbuilders';
9
+ // export * from './shaderfunctions';
10
+ // export * from './geometry';
@@ -7,24 +7,22 @@ const fence = (gl) => new Promise((resolve, reject) => {
7
7
  gl.flush();
8
8
  // There are TWO possible ways to check on the status of a WebGLSync object.
9
9
  // 1. This will check it using clientWaitSync()
10
- const checkStatus_v1 = () => {
11
- const status = gl.clientWaitSync(sync, 0, 0);
12
- // There are four possible values for status:
13
- // a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
14
- // b. TIMEOUT_EXPIRED (check again later)
15
- // c. WAIT_FAILED (there was an error)
16
- if (status === gl.TIMEOUT_EXPIRED) {
17
- setTimeout(checkStatus_v1, 1);
18
- }
19
- else if (status === gl.ALREADY_SIGNALED || status === gl.CONDITION_SATISFIED) {
20
- gl.deleteSync(sync);
21
- resolve();
22
- }
23
- else {
24
- gl.deleteSync(sync);
25
- reject(new Error('Fence did not resolve normally for some reason'));
26
- }
27
- };
10
+ // const checkStatus_v1 = () => {
11
+ // const status = gl.clientWaitSync(sync, 0, 0);
12
+ // // There are four possible values for status:
13
+ // // a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
14
+ // // b. TIMEOUT_EXPIRED (check again later)
15
+ // // c. WAIT_FAILED (there was an error)
16
+ // if (status === gl.TIMEOUT_EXPIRED) {
17
+ // setTimeout(checkStatus_v1, 1);
18
+ // } else if (status === gl.ALREADY_SIGNALED || status === gl.CONDITION_SATISFIED) {
19
+ // gl.deleteSync(sync);
20
+ // resolve();
21
+ // } else {
22
+ // gl.deleteSync(sync);
23
+ // reject(new Error('Fence did not resolve normally for some reason'));
24
+ // }
25
+ // };
28
26
  // 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
29
27
  const checkStatus_v2 = () => {
30
28
  const status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
@@ -53,12 +53,10 @@ class PickerDisplayer {
53
53
  gl.bindTexture(gl.TEXTURE_2D, indexTexture);
54
54
  gl.activeTexture(gl.TEXTURE0);
55
55
  gl.bindTexture(gl.TEXTURE_2D, colorTexture);
56
- { // bind framebuffer
57
- gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
58
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.colorTexture, 0);
59
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this.indexTexture, 0);
60
- gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
61
- }
56
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
57
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.colorTexture, 0);
58
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this.indexTexture, 0);
59
+ gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
62
60
  }
63
61
  // call after drawing the scene with gl picker shader
64
62
  drawColorTexture() {
@@ -1,9 +1,6 @@
1
1
  import { createProgram } from "../webglobjectbuilders";
2
2
  import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../../programs/totems/camerauniformblock";
3
- import { shaderfunctions } from "..";
4
- /** TODO:
5
- * 3d icin calistir
6
- */
3
+ import { pixelXYToCartesian2DPoint, pixelXYToCartesian3DPoint } from "../shaderfunctions";
7
4
  const drawModeFunc = (gl) => {
8
5
  return (mode) => {
9
6
  return {
@@ -17,7 +14,7 @@ const drawModeFunc = (gl) => {
17
14
  }[mode];
18
15
  };
19
16
  };
20
- export class ShapesOnGlobeProgram {
17
+ export class DrawFromPixelCoords {
21
18
  constructor(gl, globe, drawMode = 'point') {
22
19
  this.globe = globe;
23
20
  this.gl = gl;
@@ -57,8 +54,8 @@ export class ShapesOnGlobeProgram {
57
54
 
58
55
  out vec4 v_color;
59
56
 
60
- ` + shaderfunctions.pixelXYToCartesian3DPoint + `
61
- ` + shaderfunctions.pixelXYToCartesian2DPoint + `
57
+ ` + pixelXYToCartesian3DPoint + `
58
+ ` + pixelXYToCartesian2DPoint + `
62
59
 
63
60
 
64
61
  void main() {
@@ -1,5 +1,5 @@
1
1
  import { createProgram } from "../webglobjectbuilders";
2
- import { glProgramCache } from "../../programs";
2
+ import { glProgramCache } from "../../programs/programcache";
3
3
  // import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../../programs/totems";
4
4
  const vs = `#version 300 es
5
5
  precision highp float;
@@ -1,5 +1,5 @@
1
1
  import { createProgram } from "../webglobjectbuilders";
2
- import { shaderfunctions } from "..";
2
+ import { pixelXYToCartesian2DPoint, pixelXYToCartesian3DPoint } from "../shaderfunctions";
3
3
  import { latLongBboxtoPixelXYBbox } from "..";
4
4
  /** TODO:
5
5
  * 3d icin calistir
@@ -51,8 +51,8 @@ class TextureToGlobeProgram {
51
51
  out vec2 v_texcoord;
52
52
 
53
53
 
54
- ` + shaderfunctions.pixelXYToCartesian3DPoint + `
55
- ` + shaderfunctions.pixelXYToCartesian2DPoint + `
54
+ ` + pixelXYToCartesian3DPoint + `
55
+ ` + pixelXYToCartesian2DPoint + `
56
56
 
57
57
 
58
58
  void main() {
@@ -2,6 +2,7 @@
2
2
  * Iceride bir canvas uretir ve degisiklikler bu kanvasta yapilir
3
3
  */
4
4
  // this class loads texture to raster overlay
5
+ // TODO: IS DEADCODE?
5
6
  class RasterOverlayLoader {
6
7
  constructor(id, globe, { opacity = 1.0, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, beforeObject = null, canvas = null, callBack = null } = {}) {
7
8
  this.canvas = canvas || document.createElement('canvas');
@@ -0,0 +1,3 @@
1
+ import { ArrowFieldPlugin } from "./plugin";
2
+ import { centigradePlus90ToRadians } from "./adaptor";
3
+ export { ArrowFieldPlugin as ArrowField, centigradePlus90ToRadians };
@@ -1,5 +1,5 @@
1
- import { ArrowField } from '../programs';
2
- export default class ArrowFieldPlugin {
1
+ import { ArrowField } from '../../programs/arrowfield/arrow-field';
2
+ export class ArrowFieldPlugin {
3
3
  constructor(id, { minLon = -180, maxLon = 180, minLat = -90, maxLat = 90, height = 0, opacity = 1, tailLengthRatio = 1, wingLengthRatio = 0.5, color = [0.04, 0.2, 0.8], targetWidth = 100, targetHeight = 100, data = null, dataWidth = null, dataHeight = null, maxMagnitude = null, noDataValue = null } = {}) {
4
4
  this.id = id;
5
5
  this.options = {
@@ -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,9 @@
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
5
  import imageToMagnitude, { imageToRadianAngle } from "./imagetovectorfieldandmagnitude";
6
- import { TexturePointSampler } from "../util/heatwavedatamanager/texture-point-sampler";
6
+ import { TexturePointSampler } from "../../heatwave/texture-point-sampler";
7
7
  /**
8
8
  * Shader Dökümanı:
9
9
  * * Vektör alan haritasında kaçış değeri
@@ -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();
@@ -665,16 +665,16 @@ export default class WindPlugin {
665
665
  }
666
666
  _drawScreen() {
667
667
  const { gl, globe } = this;
668
- util.bindTexture(gl, this.windTexture, 0);
669
- util.bindTexture(gl, this.particleStateTexture0, 1);
668
+ bindTexture(gl, this.windTexture, 0);
669
+ bindTexture(gl, this.particleStateTexture0, 1);
670
670
  // 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);
671
+ bindFramebuffer(gl, this.framebuffer, this.screenTexture);
672
672
  gl.viewport(0, 0, globe.api_ScrW(), globe.api_ScrH());
673
673
  gl.enable(gl.BLEND);
674
674
  gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); // non-premultiplied alpha
675
675
  this._drawTexture(this.backgroundTexture, this._fadeOpacity);
676
676
  this._drawParticles();
677
- util.bindFramebuffer(gl, null);
677
+ bindFramebuffer(gl, null);
678
678
  this._drawTexture(this.screenTexture, 1.0);
679
679
  gl.disable(gl.BLEND);
680
680
  // save the current screen as the background for the next frame
@@ -686,8 +686,8 @@ export default class WindPlugin {
686
686
  const gl = this.gl;
687
687
  const program = this.screenProgram;
688
688
  gl.useProgram(program.program);
689
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
690
- util.bindTexture(gl, texture, 2);
689
+ bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
690
+ bindTexture(gl, texture, 2);
691
691
  gl.uniform1i(program.u_screen, 2);
692
692
  gl.uniform1f(program.u_opacity, opacity);
693
693
  gl.drawArrays(gl.TRIANGLES, 0, 6);
@@ -706,8 +706,8 @@ export default class WindPlugin {
706
706
  const { gl, projMatrix, modelviewMatrix, transPos } = this;
707
707
  const program = this.drawSphereProgram;
708
708
  gl.useProgram(program.program);
709
- util.bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
710
- util.bindTexture(gl, this.colorRampTexture, 2);
709
+ bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
710
+ bindTexture(gl, this.colorRampTexture, 2);
711
711
  gl.uniform1i(program.u_wind, 0);
712
712
  gl.uniform1i(program.u_particles, 1);
713
713
  gl.uniform1i(program.u_color_ramp, 2);
@@ -720,8 +720,8 @@ export default class WindPlugin {
720
720
  const { gl, transPos, projMatrix, globe } = this;
721
721
  const program = this.drawFlatProgram;
722
722
  gl.useProgram(program.program);
723
- util.bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
724
- util.bindTexture(gl, this.colorRampTexture, 2);
723
+ bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
724
+ bindTexture(gl, this.colorRampTexture, 2);
725
725
  gl.uniform1i(program.u_wind, 0);
726
726
  gl.uniform1i(program.u_particles, 1);
727
727
  gl.uniform1i(program.u_color_ramp, 2);
@@ -763,12 +763,12 @@ export default class WindPlugin {
763
763
  const program = this.updateProgram;
764
764
  gl.useProgram(program.program);
765
765
  gl.viewport(0, 0, this.particleStateResolution, this.particleStateResolution);
766
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
766
+ bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
767
767
  gl.uniform1i(program.u_wind, 0);
768
768
  gl.uniform1i(program.u_particles, 1);
769
- util.bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
769
+ bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
770
770
  gl.uniform1f(program.u_rand_seed, Math.random());
771
- util.bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);
771
+ bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);
772
772
  gl.drawArrays(gl.TRIANGLES, 0, 6);
773
773
  // swap the particle state textures so the new one becomes the current one
774
774
  const temp = this.particleStateTexture0;
@@ -873,11 +873,11 @@ export default class WindPlugin {
873
873
  // console.log("init wind plugin")
874
874
  this.globe = globe;
875
875
  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]));
876
+ this.drawSphereProgram = createProgramWrapper(gl, drawSphereVert, drawFrag);
877
+ this.screenProgram = createProgramWrapper(gl, quadVert, screenFrag);
878
+ this.updateProgram = createProgramWrapper(gl, quadVert, updateFrag);
879
+ this.drawFlatProgram = createProgramWrapper(gl, drawFlatVert, drawFrag);
880
+ this.quadBuffer = createBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]));
881
881
  this.framebuffer = gl.createFramebuffer();
882
882
  this._loadFadeOpacity();
883
883
  this._loadSpeedFactor();
@@ -897,8 +897,8 @@ export default class WindPlugin {
897
897
  const { gl, globe } = this;
898
898
  const emptyPixels = new Uint8Array(globe.api_ScrW() * globe.api_ScrH() * 4);
899
899
  // 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());
900
+ this.backgroundTexture = createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
901
+ this.screenTexture = createTexture(gl, gl.LINEAR, emptyPixels, globe.api_ScrW(), globe.api_ScrH());
902
902
  gl.viewport(0, 0, globe.api_ScrW(), globe.api_ScrH());
903
903
  }
904
904
  // globe calls this `free` on plugin object unregistration
@@ -9,7 +9,7 @@ import { isTextFont, opacityCheck } from "../util/check/typecheck";
9
9
  * This makes the code more readable and maintainable.
10
10
  *
11
11
  * With AttachedTextWriter the glue is created by user.
12
- * I observed that the users generally uses a wrapper around the plugin logic anyway. This wrapper can be used as the glue for plugin and attacked writer.
12
+ * I observed that the users generally uses a wrapper around the plugin logic anyway. This wrapper can be used as the glue for plugin and attached writer.
13
13
  */
14
14
  export class AttachedTextWriter {
15
15
  constructor(globe, { style = {
@@ -57,6 +57,14 @@ export class AttachedTextWriter {
57
57
  this._itemMap.set(key, item);
58
58
  this.globe.DrawRender();
59
59
  }
60
+ removeItem(item) {
61
+ const key = this.keyAdaptor ? this.keyAdaptor(item) : item;
62
+ if (this._itemMap.delete(key)) {
63
+ this.globe.DrawRender();
64
+ return true;
65
+ }
66
+ return false;
67
+ }
60
68
  // TODO: use item style
61
69
  draw() {
62
70
  if (!this.doDraw) {
@@ -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
  /**
@@ -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 };