@pirireis/webglobeplugins 0.8.6 → 0.8.8

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 (61) hide show
  1. package/bearing-line/plugin.js +51 -43
  2. package/circle-line-chain/plugin.js +52 -44
  3. package/compass-rose/compass-rose-padding-flat.js +3 -0
  4. package/compassrose/compassrose.js +1 -8
  5. package/heatwave/isobar/plugin.js +4 -1
  6. package/heatwave/isobar/quadtreecontours.js +0 -2
  7. package/heatwave/plugins/heatwaveglobeshell.js +2 -0
  8. package/package.json +1 -1
  9. package/partialrings/goals.md +2 -0
  10. package/partialrings/plugin.js +2 -1
  11. package/point-glow-line-to-earth/draw-subset-obj.js +27 -0
  12. package/point-glow-line-to-earth/keymethod.js +0 -0
  13. package/point-glow-line-to-earth/plugin.js +439 -0
  14. package/point-glow-line-to-earth/types.js +26 -0
  15. package/point-heat-map/index.js +0 -3
  16. package/point-heat-map/plugin-webworker.js +4 -9
  17. package/point-heat-map/point-to-heat-map-flow.js +0 -6
  18. package/point-tracks/plugin.js +4 -4
  19. package/programs/arrowfield/logic.js +6 -4
  20. package/programs/arrowfield/object.js +1 -1
  21. package/programs/float2legendwithratio/object.js +5 -4
  22. package/programs/globe-util/is-globe-moved.js +27 -0
  23. package/programs/globeshell/wiggle/logic.js +3 -7
  24. package/programs/globeshell/wiggle/object.js +1 -2
  25. package/programs/line-on-globe/circle-accurate-3d.js +16 -23
  26. package/programs/line-on-globe/circle-accurate-flat.js +21 -21
  27. package/programs/line-on-globe/lines-color-instanced-flat.js +6 -7
  28. package/programs/line-on-globe/naive-accurate-flexible.js +239 -0
  29. package/programs/line-on-globe/to-the-surface.js +129 -0
  30. package/programs/picking/pickable-renderer.js +216 -0
  31. package/programs/point-on-globe/element-globe-surface-glow.js +168 -0
  32. package/programs/point-on-globe/element-point-glow.js +184 -0
  33. package/programs/point-on-globe/square-pixel-point.js +2 -4
  34. package/programs/programcache.js +9 -0
  35. package/programs/rings/partial-ring/piece-of-pie.js +1 -1
  36. package/programs/totems/camerauniformblock.js +23 -2
  37. package/rangerings/plugin.js +9 -6
  38. package/shaders/fragment-toy/firework.js +55 -0
  39. package/shaders/fragment-toy/singularity.js +59 -0
  40. package/types.js +16 -0
  41. package/util/account/single-attribute-buffer-management/buffer-manager.js +1 -5
  42. package/util/account/util.js +17 -7
  43. package/util/check/typecheck.js +11 -0
  44. package/util/gl-util/buffer/integrate-buffer.js +74 -0
  45. package/util/gl-util/draw-options/client.js +59 -0
  46. package/util/gl-util/draw-options/methods.js +46 -0
  47. package/util/gl-util/draw-options/types.js +18 -0
  48. package/util/gl-util/uniform-block/manager.js +176 -0
  49. package/util/gl-util/uniform-block/roadmap.md +70 -0
  50. package/util/gl-util/uniform-block/shader.js +0 -0
  51. package/util/gl-util/uniform-block/types.js +7 -0
  52. package/util/jshelpers/equality.js +17 -0
  53. package/util/picking/picker-displayer.js +1 -1
  54. package/util/programs/shapesonglobe.js +17 -19
  55. package/util/shaderfunctions/geometrytransformations.js +27 -63
  56. package/bearing-line/roadmap.md +0 -15
  57. package/point-heat-map/plugin.js +0 -132
  58. package/programs/line-on-globe/naive-accurate.js +0 -221
  59. package/programs/line-on-globe/to-the-origin.js +0 -164
  60. package/util/jshelpers/timemethods.js +0 -19
  61. /package/{programs/point-on-globe/element-draw-glow.js → point-glow-line-to-earth/adaptors.js} +0 -0
@@ -1,164 +0,0 @@
1
- import { createProgram } from "../../util";
2
- import { longLatRadToCartesian3DWithR, cartesian3DToGLPosition, R_3D } from "../../util/shaderfunctions/geometrytransformations";
3
- import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems";
4
- import { noRegisterGlobeProgramCache } from "../programcache";
5
-
6
- /**
7
- * Creates beams from long, lat, radian coordinates to origin on global view.
8
- * Ojects with hight, float over terrain and does not propose information of their actual coordinates.
9
- * You start drawing after zoom level 9-10
10
- * Does not work on mercator.
11
- */
12
-
13
-
14
- const vertexShaderSource = `#version 300 es
15
- precision highp float;
16
- ${CameraUniformBlockString}
17
- ${R_3D}
18
- ${longLatRadToCartesian3DWithR}
19
- ${cartesian3DToGLPosition}
20
-
21
- in vec3 position3d;
22
- in vec4 rgba;
23
- uniform float origin_r;
24
- flat out vec4 v_rgba;
25
- out float interpolation_value;
26
-
27
- void main() {
28
- if (!is3D) {return;}
29
- vec3 cartesian;
30
- if(gl_VertexID == 0) {
31
- cartesian = normalize( position3d) * R_3D;
32
- interpolation_value = 1.0;
33
- } else {
34
- cartesian = position3d;
35
- interpolation_value = 0.0;
36
- }
37
- gl_Position = cartesian3DToGLPosition(cartesian);
38
- v_rgba = rgba;
39
- gl_PointSize = 10.0; // for testing
40
- }
41
- `;
42
-
43
- const fragmentShaderSource = `#version 300 es
44
- precision highp float;
45
-
46
- uniform float plugin_opacity;
47
- in float interpolation_value;
48
- flat in vec4 v_rgba;
49
- out vec4 color;
50
- void main(){
51
- if ( fract( interpolation_value * 30.0) < 0.5) {discard;}
52
- color = vec4(
53
- v_rgba.rgb * 1.2,
54
- v_rgba.a * plugin_opacity
55
- );
56
-
57
- }`;
58
-
59
-
60
- class Logic {
61
- constructor(globe) {
62
- this.globe = globe;
63
- this.gl = globe.gl;
64
- this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
65
- this._lastOpacity = 1.0;
66
- this._lastOriginR = 6378.137 - 1;
67
- const { gl, program } = this;
68
- {
69
- gl.bindAttribLocation(program, 0, "position3d");
70
- gl.bindAttribLocation(program, 1, "rgba");
71
-
72
- }
73
- {
74
- this._opacityLocation = gl.getUniformLocation(program, "plugin_opacity");
75
- this._originRLocation = gl.getUniformLocation(program, "origin_r")
76
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
77
- gl.useProgram(program);
78
- gl.uniform1f(this._opacityLocation, this._lastOpacity);
79
- gl.uniform1f(this._originRLocation, this._lastOriginR);
80
- gl.useProgram(currentProgram);
81
- }
82
- {
83
- this.cameraBlockBindingPoint = 0;
84
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
85
- this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
86
- gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
87
- }
88
- }
89
-
90
- draw(vao, length, opacity, originR = null) {
91
- const { gl, program, globe, cameraBlockTotem, cameraBlockBindingPoint } = this;
92
- const is3D = globe.api_GetCurrentGeometry() == 0;
93
- if (!is3D) return;
94
- const lod = globe.api_GetCurrentLODWithDecimal()
95
- if (lod < 12) return;
96
- gl.useProgram(program);
97
- cameraBlockTotem.bind(cameraBlockBindingPoint);
98
- gl.bindVertexArray(vao);
99
- if (opacity !== this._lastOpacity) {
100
- gl.uniform1f(this._opacityLocation, opacity);
101
- this._checkOpacity(opacity);
102
- this._lastOpacity = opacity;
103
- }
104
- if (originR !== null && originR !== this._lastOriginR) {
105
- this._checkOriginR(originR);
106
- gl.uniform1f(this._originRLocation, originR);
107
- this._lastOriginR = originR;
108
- }
109
- gl.drawArraysInstanced(gl.LINE_STRIP, 0, 2, length);
110
- gl.drawArraysInstanced(gl.POINTS, 0, 2, length);
111
- gl.bindVertexArray(null);
112
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
113
- }
114
-
115
- _checkOpacity(opacity) {
116
- if (opacity < 0.0 || opacity > 1) throw RangeError("Opacity should be between 0 and 1");
117
-
118
- }
119
-
120
- _checkOriginR(r) {
121
- if (r < 0.0 || r > 6378.137 - 0.3) throw RangeError("r should be between 0 and 6378.137 - 0.3");
122
- }
123
-
124
- createVAO(potision3dBufferObj, colorBufferObj) {
125
- const { gl } = this;
126
- const vao = gl.createVertexArray();
127
- gl.bindVertexArray(vao);
128
- {
129
- const { buffer, stride = 0, offset = 0 } = potision3dBufferObj;
130
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
131
- gl.enableVertexAttribArray(0);
132
- gl.vertexAttribPointer(0, 3, gl.FLOAT, false, stride, offset);
133
- gl.vertexAttribDivisor(0, 1);
134
- }
135
- {
136
- const { buffer, stride = 0, offset = 0 } = colorBufferObj;
137
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
138
- gl.enableVertexAttribArray(1);
139
- gl.vertexAttribPointer(1, 4, gl.FLOAT, false, stride, offset);
140
- gl.vertexAttribDivisor(1, 1);
141
- }
142
-
143
- gl.bindVertexArray(null);
144
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
145
- return vao;
146
-
147
- }
148
-
149
-
150
- free() {
151
- if (this.isFreed) return;
152
- CameraUniformBlockTotemCache.release(this.globe);
153
- this.isFreed = true;
154
- }
155
- }
156
-
157
- const LineToTheOriginCache = Object.freeze({
158
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
159
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
160
- })
161
-
162
- export {
163
- LineToTheOriginCache
164
- }
@@ -1,19 +0,0 @@
1
- function instantDebounce(func, delay) {
2
- let timeout = null;
3
- let lastArgs = null;
4
- return function (arguments) {
5
- if (timeout) {
6
- lastArgs = arguments;
7
- return;
8
- } else {
9
- func(...arguments);
10
- timeout = setTimeout(() => {
11
- if (lastArgs) {
12
- func(...lastArgs);
13
- lastArgs = null;
14
- }
15
- timeout = null;
16
- }, delay);
17
- }
18
- }
19
- }