@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
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util/";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { noRegisterGlobeProgramCache } from "../programcache";
3
3
  const vs = `#version 300 es
4
4
  precision highp float;
@@ -38,34 +38,29 @@ class DensityToLegendProgram {
38
38
  legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
39
39
  opacity: gl.getUniformLocation(program, "u_opacity"),
40
40
  };
41
- { // assign attribute locations
42
- gl.bindAttribLocation(program, 0, "a_position");
43
- }
44
- {
45
- this.vao = gl.createVertexArray();
46
- const a_positionLocation = gl.getAttribLocation(program, "a_position");
47
- gl.bindVertexArray(this.vao);
48
- const buffer = gl.createBuffer();
49
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
50
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
51
- -1, -1,
52
- 1, -1,
53
- 1, 1,
54
- -1, 1,
55
- ]), gl.STATIC_DRAW);
56
- gl.enableVertexAttribArray(a_positionLocation);
57
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
58
- gl.bindVertexArray(null);
59
- // gl.bindBuffer(gl.ARRAY_BUFFER, null);
60
- this._buffer = buffer;
61
- }
62
- {
63
- this._lastOpacity = 1;
64
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
65
- gl.useProgram(program);
66
- gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
67
- gl.useProgram(currentProgram);
68
- }
41
+ // assign attribute locations
42
+ gl.bindAttribLocation(program, 0, "a_position");
43
+ this.vao = gl.createVertexArray();
44
+ const a_positionLocation = gl.getAttribLocation(program, "a_position");
45
+ gl.bindVertexArray(this.vao);
46
+ const buffer = gl.createBuffer();
47
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
48
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
49
+ -1, -1,
50
+ 1, -1,
51
+ 1, 1,
52
+ -1, 1,
53
+ ]), gl.STATIC_DRAW);
54
+ gl.enableVertexAttribArray(a_positionLocation);
55
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
56
+ gl.bindVertexArray(null);
57
+ // gl.bindBuffer(gl.ARRAY_BUFFER, null);
58
+ this._buffer = buffer;
59
+ this._lastOpacity = 1;
60
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
61
+ gl.useProgram(program);
62
+ gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
63
+ gl.useProgram(currentProgram);
69
64
  }
70
65
  draw(densityTexture, legendTexture, opacity) {
71
66
  const { gl, program, uniforms } = this;
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util/";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { noRegisterGlobeProgramCache } from "../programcache";
3
3
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
4
4
  import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
@@ -41,22 +41,19 @@ class PointHeatmapProgram {
41
41
  this.uniforms = {
42
42
  pointSize: gl.getUniformLocation(this.program, "pointSize"),
43
43
  };
44
- { // assign attribute locations
45
- gl.bindAttribLocation(program, 0, "position");
46
- }
47
- { // arrange camera uniform block
48
- this.cameraBlockBingingPoint = 0;
49
- this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
50
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
51
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
52
- }
53
- { // last values
54
- this._lastPointSize = 0;
55
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
56
- gl.useProgram(program);
57
- gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
58
- gl.useProgram(currentProgram);
59
- }
44
+ // assign attribute locations
45
+ gl.bindAttribLocation(program, 0, "position");
46
+ // arrange camera uniform block
47
+ this.cameraBlockBingingPoint = 0;
48
+ this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
49
+ const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
50
+ gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
51
+ // last values
52
+ this._lastPointSize = 0;
53
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
54
+ gl.useProgram(program);
55
+ gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
56
+ gl.useProgram(currentProgram);
60
57
  }
61
58
  createVAO(positionBuffer, vectorSize) {
62
59
  const gl = this.gl;
@@ -1,5 +1,5 @@
1
- import { createProgram } from "../../util";
2
- export default class {
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
+ export class Float2LegentWithRatioProgram {
3
3
  constructor(gl) {
4
4
  this.gl = gl;
5
5
  this._width = 1;
@@ -1,4 +1,4 @@
1
- import Float2LegentWithRatioProgram from './logic';
1
+ import { Float2LegentWithRatioProgram } from './logic';
2
2
  import { glProgramCache } from '../programcache';
3
3
  // Uniform Buffer Objects use this
4
4
  export default class DataObject {
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../util";
1
+ import { createProgram } from "../util/webglobeplugins";
2
2
  /**
3
3
  * Blends two float32textures with given ratio.
4
4
  */
@@ -1,4 +1,5 @@
1
- import { createProgram } from "../../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
+ import { glProgramCache } from "../programcache";
2
3
  const vertexShaderSource = `#version 300 es
3
4
  precision highp float;
4
5
  in vec2 a_position;
@@ -24,7 +25,7 @@ void main() {
24
25
  outColor = vec4(color.rgb, color.a * opacity);
25
26
  }
26
27
  `;
27
- export default class FadeAwayProgram {
28
+ class FadeAwayProgram {
28
29
  constructor(gl) {
29
30
  this.gl = gl;
30
31
  this.program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
@@ -67,3 +68,11 @@ export default class FadeAwayProgram {
67
68
  gl.deleteBuffer(_buffer);
68
69
  }
69
70
  }
71
+ export const FadeAwayProgramCache = Object.freeze({
72
+ get: (gl) => {
73
+ return glProgramCache.getProgram(gl, FadeAwayProgram);
74
+ },
75
+ release: (gl) => {
76
+ return glProgramCache.releaseProgram(gl, FadeAwayProgram);
77
+ }
78
+ });
package/programs/index.js CHANGED
@@ -1,9 +1,20 @@
1
- import { Float2LegendWithRatio } from "./float2legendwithratio";
2
- import { GlobeShellWiggle } from "./globeshell/wiggle";
3
- import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
4
- import ArrowField from "./arrowfield";
5
- import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
6
- import * as vectorfield from "./vectorfields/index";
7
- import { FadeAway } from "./helpers";
8
- import * as rings from "./rings";
9
- export { Float2LegendWithRatio, GlobeShellWiggle, ArrowField, CameraUniformBlockTotem, CameraUniformBlockString, glProgramCache, globeProgramCache, noRegisterGlobeProgramCache, vectorfield, FadeAway, rings };
1
+ "use strict";
2
+ // import { Float2LegendWithRatio } from "./float2legendwithratio";
3
+ // import { GlobeShellWiggle } from "./globeshell/wiggle";
4
+ // import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
5
+ // import ArrowField from "./arrowfield";
6
+ // import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
7
+ // import { FadeAway } from "./helpers";
8
+ // import * as rings from "./rings";
9
+ // export {
10
+ // Float2LegendWithRatio,
11
+ // GlobeShellWiggle,
12
+ // ArrowField,
13
+ // CameraUniformBlockTotem,
14
+ // CameraUniformBlockString,
15
+ // glProgramCache,
16
+ // globeProgramCache,
17
+ // noRegisterGlobeProgramCache,
18
+ // FadeAway,
19
+ // rings
20
+ // };
@@ -3,7 +3,7 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
4
  // import { vaoAttributeLoader } from "../../util/account/util";
5
5
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
6
- import { cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
6
+ import { cartesian3DToGLPosition, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
7
7
  /**
8
8
  * TODO:
9
9
  * 1. integrate geometry functions for radius angle and center
@@ -77,19 +77,17 @@ class Logic {
77
77
  this.program.uniforms = {
78
78
  opacity: gl.getUniformLocation(program, "opacity")
79
79
  };
80
- { // initial uniform values
81
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
82
- gl.useProgram(program);
83
- gl.uniform1f(program.uniforms.opacity, 1.0);
84
- gl.useProgram(currentProgram);
85
- }
86
- { // assign attribute locations
87
- gl.bindAttribLocation(program, 0, "center_position3d");
88
- gl.bindAttribLocation(program, 1, "target_position3d");
89
- gl.bindAttribLocation(program, 2, "color");
90
- gl.bindAttribLocation(program, 3, "dash_ratio");
91
- gl.bindAttribLocation(program, 4, "dash_opacity");
92
- }
80
+ // initial uniform values
81
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
82
+ gl.useProgram(program);
83
+ gl.uniform1f(program.uniforms.opacity, 1.0);
84
+ gl.useProgram(currentProgram);
85
+ // assign attribute locations
86
+ gl.bindAttribLocation(program, 0, "center_position3d");
87
+ gl.bindAttribLocation(program, 1, "target_position3d");
88
+ gl.bindAttribLocation(program, 2, "color");
89
+ gl.bindAttribLocation(program, 3, "dash_ratio");
90
+ gl.bindAttribLocation(program, 4, "dash_opacity");
93
91
  this.cameraBindingPoint = 0;
94
92
  this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
95
93
  const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
@@ -3,7 +3,6 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
4
  import { vaoAttributeLoader } from "../../util/account/util";
5
5
  import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
6
- const Pole = 20037508.34;
7
6
  /**
8
7
  * Warning:
9
8
  * Insert the points from the second index and skip 1 point as you placed 361 points
@@ -84,21 +84,19 @@ class Logic {
84
84
  stepAngle: gl.getUniformLocation(program, "step_angle"),
85
85
  zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
86
86
  };
87
- { // initial uniform values
88
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
89
- gl.useProgram(program);
90
- gl.uniform1f(program.uniforms.opacity, 1.0);
91
- gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
92
- gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
93
- gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
94
- gl.useProgram(currentProgram);
95
- }
96
- { // assign attribute locations
97
- gl.bindAttribLocation(program, 0, "center_position3d");
98
- gl.bindAttribLocation(program, 1, "big_radius");
99
- gl.bindAttribLocation(program, 2, "small_radius");
100
- gl.bindAttribLocation(program, 3, "color");
101
- }
87
+ // initial uniform values
88
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
89
+ gl.useProgram(program);
90
+ gl.uniform1f(program.uniforms.opacity, 1.0);
91
+ gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
92
+ gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
93
+ gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
94
+ gl.useProgram(currentProgram);
95
+ // assign attribute locations
96
+ gl.bindAttribLocation(program, 0, "center_position3d");
97
+ gl.bindAttribLocation(program, 1, "big_radius");
98
+ gl.bindAttribLocation(program, 2, "small_radius");
99
+ gl.bindAttribLocation(program, 3, "color");
102
100
  this.cameraBindingPoint = 0;
103
101
  this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
104
102
  const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
@@ -1,7 +1,7 @@
1
1
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
2
2
  import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
- import { createProgram } from "../../util";
4
+ import { createProgram } from "../../util/webglobjectbuilders";
5
5
  import { Z_ALPHA_MODE } from "./util";
6
6
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
7
7
  /**
@@ -68,23 +68,20 @@ class Logic {
68
68
  const { gl, program } = this;
69
69
  const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
70
70
  gl.useProgram(program);
71
- { // assign attribute locations
72
- gl.bindAttribLocation(program, 0, 'posA');
73
- gl.bindAttribLocation(program, 1, 'posB');
74
- gl.bindAttribLocation(program, 2, 'color');
75
- }
76
- { // uniform locations
77
- this._opacityLocation = gl.getUniformLocation(program, 'opacity');
78
- this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
79
- gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
80
- gl.uniform1f(this._opacityLocation, this._lastOpicity);
81
- }
82
- { // uniform block
83
- this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
84
- this._cameraBindingPoint = 0;
85
- const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
86
- gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
87
- }
71
+ // assign attribute locations
72
+ gl.bindAttribLocation(program, 0, 'posA');
73
+ gl.bindAttribLocation(program, 1, 'posB');
74
+ gl.bindAttribLocation(program, 2, 'color');
75
+ // uniform locations
76
+ this._opacityLocation = gl.getUniformLocation(program, 'opacity');
77
+ this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
78
+ gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
79
+ gl.uniform1f(this._opacityLocation, this._lastOpicity);
80
+ // uniform block
81
+ this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
82
+ this._cameraBindingPoint = 0;
83
+ const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
84
+ gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
88
85
  gl.useProgram(currentProgram);
89
86
  }
90
87
  createVAO(posAObj, posBObj, colorObj) {
@@ -144,7 +144,6 @@ class Logic {
144
144
  gl.uniform1f(this._opacityLocation, opacity);
145
145
  this._lastOpacity = opacity;
146
146
  }
147
- // this._setFlexibleUniforms(flexibleOptions);
148
147
  const vertexCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
149
148
  const ubo = flexibleUBO || _defaultFlexibleUBO;
150
149
  ubo.bind();
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
3
3
  import { mercatorXYToGLPosition, cartesian3DToGLPosition, R_3D, R } from "../../util/shaderfunctions/geometrytransformations";
4
4
  import { noRegisterGlobeProgramCache } from "../programcache";
@@ -1,8 +1,8 @@
1
- import { createProgram } from "../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
3
3
  import { mercatorXYToGLPosition, cartesian3DToGLPosition, R_3D, R } from "../../util/shaderfunctions/geometrytransformations";
4
4
  import { noRegisterGlobeProgramCache } from "../programcache";
5
- import { drawArrays, DrawRangeIndexParams } from "../../util/gl-util/draw-options/methods";
5
+ import { drawArrays } from "../../util/gl-util/draw-options/methods"; //DrawRangeIndexParams
6
6
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
7
7
  import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
8
8
  const uniformBindingPoints = {
@@ -6,8 +6,8 @@
6
6
  * *
7
7
  */
8
8
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
9
- import { PI, mercatorXYToGLPosition, cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate } from "../../util/shaderfunctions/geometrytransformations";
10
- import { createProgram } from "../../util";
9
+ import { PI, cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate } from "../../util/shaderfunctions/geometrytransformations";
10
+ import { createProgram } from "../../util/webglobjectbuilders";
11
11
  import { noRegisterGlobeProgramCache } from "../programcache";
12
12
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
13
13
  import { drawInstanced } from "../../util/gl-util/draw-options/methods";
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
3
3
  import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
4
4
  import { noRegisterGlobeProgramCache } from "../programcache";
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
3
3
  import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
4
4
  import { noRegisterGlobeProgramCache } from "../programcache";
@@ -1,5 +1,5 @@
1
1
  import { TextureDemTriangles } from "./texture-dem-triangles";
2
- import { test1 } from "../../Math/tessellation/triangle-tessellation";
2
+ import { partialTest } from "../../Math/tessellation/triangle-tessellation";
3
3
  /**
4
4
  * Loads a plugin with test data for TextureDemTriangles
5
5
  */
@@ -16,6 +16,7 @@ const createTestBBOXES = () => {
16
16
  }
17
17
  return bboxes;
18
18
  };
19
+ const demTextureBBOX = createTestBBOXES();
19
20
  function showTextureBBoxes(bboxes, demData = []) {
20
21
  for (let i = 0; i < bboxes.length; i++) {
21
22
  const bbox = bboxes[i];
@@ -74,17 +75,20 @@ export class TextureDemTrianglesTestPlugin {
74
75
  uboTriangleStyle = null;
75
76
  uboStringStyle = null;
76
77
  showDemPoints = false;
78
+ bboxZooms = [];
77
79
  constructor(id) {
78
80
  this.id = id;
81
+ this.bboxZooms = [];
79
82
  }
80
83
  init(globe) {
81
84
  this.globe = globe;
82
85
  this.textureDemTriangles = new TextureDemTriangles(globe);
83
86
  // set bboxes and dem textures
84
87
  const demTextures = createTestDemTextures();
85
- const demTextureBBOX = createTestBBOXES();
88
+ // const demTextureBBOX = createTestBBOXES();
86
89
  this.textureDemTriangles.setDemTextures(demTextures, demTextureBBOX);
87
90
  //
91
+ // const baseZoom = 5;
88
92
  showTextureBBoxes(demTextureBBOX, demTextures);
89
93
  this.uboTriangleStyle = this.textureDemTriangles.createUBO();
90
94
  this.uboStringStyle = this.textureDemTriangles.createUBO();
@@ -132,16 +136,35 @@ export class TextureDemTrianglesTestPlugin {
132
136
  this.globe?.DrawRender();
133
137
  }
134
138
  setZoom(zoomLevel) {
139
+ this.bboxZooms = demTextureBBOX.map((bbox, index) => {
140
+ return {
141
+ bbox: {
142
+ min: [bbox.northWest[0], bbox.southEast[1]], max: [bbox.southEast[0], bbox.northWest[1]]
143
+ }, zoom: index + zoomLevel + 1
144
+ };
145
+ });
146
+ // all world
147
+ this.bboxZooms.push({
148
+ bbox: {
149
+ min: [-180, -90],
150
+ max: [180, 90]
151
+ },
152
+ zoom: zoomLevel
153
+ });
135
154
  if (!this.globe || !this.textureDemTriangles || !this.bufferInfo)
136
155
  return;
137
- const p1 = [-20 * Math.PI / 180, 50 * Math.PI / 180];
138
- const p2 = [20 * Math.PI / 180, 50 * Math.PI / 180];
139
- const p3 = [0, -10 * Math.PI / 180];
156
+ // const p1: LongLatRadian = [-20 * Math.PI / 180, 50 * Math.PI / 180];
157
+ // const p2: LongLatRadian = [20 * Math.PI / 180, 50 * Math.PI / 180];
158
+ // const p3: LongLatRadian = [0, -10 * Math.PI / 180];
159
+ const p1 = [-60 * Math.PI / 180, 60 * Math.PI / 180];
160
+ const p2 = [60 * Math.PI / 180, 60 * Math.PI / 180];
161
+ const p3 = [0, -60 * Math.PI / 180];
140
162
  // const p1_1: LongLatRadian = [-20 * Math.PI / 180, 30 * Math.PI / 180];
141
163
  // const p2_2: LongLatRadian = [20 * Math.PI / 180, 20 * Math.PI / 180];
142
164
  // const p3_3: LongLatRadian = [5, -20 * Math.PI / 180];
143
- const { vec3s, longLats, indices } = test1(zoomLevel, p1, p2, p3);
165
+ // const { vec3s, longLats, indices } = test1(zoomLevel, p1, p2, p3);
144
166
  // const {vec3s, longLats, indices} = test1(5, p1_1, p2_2, p3_3);
167
+ const { vec3s, longLats, indices } = partialTest(this.bboxZooms, p1, p2, p3);
145
168
  const bufferInfo = this.bufferInfo;
146
169
  bufferInfo.drawOptions.drawRange.first = 0;
147
170
  bufferInfo.drawOptions.drawRange.count = indices.length;
@@ -168,11 +191,14 @@ export class TextureDemTrianglesTestPlugin {
168
191
  draw3D() {
169
192
  if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo)
170
193
  return;
194
+ const gl = this.globe.gl;
195
+ gl.frontFace(gl.CW);
171
196
  // @ts-ignore
172
197
  this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions, this.uboTriangleStyle);
173
198
  if (this.showDemPoints) {
174
199
  // @ts-ignore
175
200
  this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptionsPoint, this.uboStringStyle);
176
201
  }
202
+ gl.frontFace(gl.CCW);
177
203
  }
178
204
  }
@@ -1,6 +1,6 @@
1
1
  import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
3
- import { cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
3
+ import { cartesian3DToGLPosition, } from "../../util/shaderfunctions/geometrytransformations";
4
4
  import { isPointInBBox } from "../../util/shaderfunctions/geometrytransformations";
5
5
  import { drawArrays } from "../../util/gl-util/draw-options/methods";
6
6
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
@@ -62,7 +62,7 @@ void main() {
62
62
  v_color.a *= u_opacity;
63
63
  vec3 position = a_position * elevation;
64
64
  gl_Position = cartesian3DToGLPosition(position);
65
- gl_PointSize = u_pointSize;
65
+ gl_PointSize = 5.0; //u_pointSize;
66
66
  }
67
67
  `;
68
68
  const fragmentShaderSource = `#version 300 es
@@ -117,6 +117,7 @@ export class TextureDemTriangles {
117
117
  this.gl.texStorage3D(this.gl.TEXTURE_2D_ARRAY, 1, this.gl.R32F, 5, 5, 6);
118
118
  // set texture parameters
119
119
  const ext = this.gl.getExtension('OES_texture_float_linear');
120
+ console.log('OES_texture_float_linear extension:', ext);
120
121
  this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
121
122
  this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
122
123
  this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
@@ -178,7 +179,11 @@ export class TextureDemTriangles {
178
179
  gl.useProgram(this.program);
179
180
  this.cameraUniformBlock.bind(uniformBindingPoints.camera);
180
181
  // TURN OFF flip y for texture
181
- gl.disable(gl.DEPTH_TEST);
182
+ // gl.disable(gl.DEPTH_TEST);
183
+ // gl.depthMask(false);
184
+ // gl.depthRange(0.0, 0.01); // Use near 1% of depth range
185
+ // Step 3: Optionally: Set depth func to ALWAYS (to ignore previous depth)
186
+ // This ensures your new geometry passes depth test regardless of prior depth values
182
187
  gl.activeTexture(gl.TEXTURE0);
183
188
  gl.bindTexture(gl.TEXTURE_2D_ARRAY, this.texture);
184
189
  gl.uniform1i(this.locations.uniforms.u_demTexture, 0); // texture unit 0
@@ -186,9 +191,9 @@ export class TextureDemTriangles {
186
191
  gl.bindVertexArray(vao);
187
192
  // bind UBO for style
188
193
  ubo.bind();
194
+ drawOnTopBegin(gl);
189
195
  drawArrays(gl, gl.POINTS, drawOptions);
190
- gl.enable(gl.DEPTH_TEST);
191
- // unbind everything
196
+ drawOnTopEnd(gl);
192
197
  gl.bindVertexArray(null);
193
198
  gl.bindTexture(gl.TEXTURE_2D_ARRAY, null);
194
199
  gl.useProgram(null);
@@ -207,3 +212,25 @@ export class TextureDemTriangles {
207
212
  return result;
208
213
  }
209
214
  }
215
+ function drawOnTopBegin(gl) {
216
+ // gl.disable(gl.DEPTH_TEST);
217
+ // gl.enable(gl.POLYGON_OFFSET_FILL);
218
+ // // Use an offset to "nudge" the depth value slightly closer or farther.
219
+ // // Common values are gl.polygonOffset(1.0, 1.0) or gl.polygonOffset(0.5, 0.5)
220
+ // gl.polygonOffset(1.0, 1.0);
221
+ // gl.depthRange(0.0, 0.0001); // Use near 0.01% of depth range
222
+ // gl.enable(gl.POLYGON_OFFSET_FILL);
223
+ // You will need to experiment with these values!
224
+ // A good starting point is -1.0, -1.0.
225
+ // Negative values "pull" the fragments closer to the camera.
226
+ // gl.polygonOffset(-1.0, -1.0);
227
+ gl.enable(gl.POLYGON_OFFSET_FILL);
228
+ gl.polygonOffset(-1.0, -2.0);
229
+ }
230
+ function drawOnTopEnd(gl) {
231
+ // gl.enable(gl.DEPTH_TEST);
232
+ // gl.disable(gl.POLYGON_OFFSET_FILL);
233
+ // gl.disable(gl.POLYGON_OFFSET_FILL);
234
+ // gl.depthRange(0.0, 1.0); // Restore full depth range
235
+ gl.disable(gl.POLYGON_OFFSET_FILL);
236
+ }
@@ -147,34 +147,32 @@ export class Logic {
147
147
  this._lastAlphaMultiplier = 1.0;
148
148
  this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
149
149
  const { gl, program } = this;
150
- { // set attributes locations
151
- gl.bindAttribLocation(program, 0, 'center2d');
152
- gl.bindAttribLocation(program, 1, 'center3d');
153
- gl.bindAttribLocation(program, 2, 'start_angle2d');
154
- gl.bindAttribLocation(program, 3, 'tail_angle2d');
155
- gl.bindAttribLocation(program, 4, 'start_angle3d');
156
- gl.bindAttribLocation(program, 5, 'tail_angle3d');
157
- gl.bindAttribLocation(program, 6, 'color');
158
- gl.bindAttribLocation(program, 7, 'radius');
159
- gl.bindAttribLocation(program, 8, 'filling_mode');
160
- // vao
161
- // instanced draw read 1
162
- }
163
- { // Uniforms
164
- this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
165
- this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
166
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
167
- gl.useProgram(program);
168
- gl.uniform1i(this._draw_modeLocation, this._lastMode);
169
- gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
170
- this.cameraBlockBindingPoint = 0;
171
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
172
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
173
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
174
- flexibleBlockManager.assignBindingPoint(gl, program);
175
- this._defaultFlexibleUBO = flexibleBlockManager.createUBO(gl);
176
- gl.useProgram(currentProgram);
177
- }
150
+ // set attributes locations
151
+ gl.bindAttribLocation(program, 0, 'center2d');
152
+ gl.bindAttribLocation(program, 1, 'center3d');
153
+ gl.bindAttribLocation(program, 2, 'start_angle2d');
154
+ gl.bindAttribLocation(program, 3, 'tail_angle2d');
155
+ gl.bindAttribLocation(program, 4, 'start_angle3d');
156
+ gl.bindAttribLocation(program, 5, 'tail_angle3d');
157
+ gl.bindAttribLocation(program, 6, 'color');
158
+ gl.bindAttribLocation(program, 7, 'radius');
159
+ gl.bindAttribLocation(program, 8, 'filling_mode');
160
+ // vao
161
+ // instanced draw read 1
162
+ // Uniforms
163
+ this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
164
+ this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
165
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
166
+ gl.useProgram(program);
167
+ gl.uniform1i(this._draw_modeLocation, this._lastMode);
168
+ gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
169
+ this.cameraBlockBindingPoint = 0;
170
+ this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
171
+ const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
172
+ gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
173
+ flexibleBlockManager.assignBindingPoint(gl, program);
174
+ this._defaultFlexibleUBO = flexibleBlockManager.createUBO(gl);
175
+ gl.useProgram(currentProgram);
178
176
  }
179
177
  draw(length, vao, edgeCount, drawMode, ubo = null) {
180
178
  const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
@@ -240,7 +238,6 @@ export class Logic {
240
238
  }
241
239
  createUBO() {
242
240
  const { gl } = this;
243
- const bufferReadType = gl.DYNAMIC_DRAW;
244
241
  const ubo = flexibleBlockManager.createUBO(gl, "STATIC_DRAW");
245
242
  this._ubosPublished.push(ubo);
246
243
  return ubo;