@pirireis/webglobeplugins 0.9.6 → 0.9.7

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 (226) hide show
  1. package/package.json +5 -2
  2. package/Math/angle-calculation.js +0 -14
  3. package/Math/arc.ts +0 -76
  4. package/Math/bounds/line-bbox.js +0 -225
  5. package/Math/constants.ts +0 -11
  6. package/Math/frustum/camera.ts +0 -32
  7. package/Math/frustum/from-globeinfo.ts +0 -63
  8. package/Math/frustum/types.ts +0 -11
  9. package/Math/globe-util/horizon-plane.ts +0 -137
  10. package/Math/index.js +0 -0
  11. package/Math/juction/arc-plane.ts +0 -114
  12. package/Math/juction/line-sphere.ts +0 -30
  13. package/Math/juction/plane-plane.ts +0 -66
  14. package/Math/line.ts +0 -70
  15. package/Math/matrix4.ts +0 -0
  16. package/Math/methods.js +0 -237
  17. package/Math/plane.ts +0 -86
  18. package/Math/quaternion.ts +0 -120
  19. package/Math/roadmap.md +0 -10
  20. package/Math/types.ts +0 -45
  21. package/Math/utils.js +0 -3
  22. package/Math/vec3.ts +0 -155
  23. package/algorithms/search-binary.js +0 -14
  24. package/altitude-locator/adaptors.js +0 -0
  25. package/altitude-locator/draw-subset-obj.js +0 -27
  26. package/altitude-locator/keymethod.js +0 -0
  27. package/altitude-locator/plugin.js +0 -439
  28. package/altitude-locator/types.js +0 -26
  29. package/arrowfield/adaptor.js +0 -11
  30. package/arrowfield/index.js +0 -3
  31. package/arrowfield/plugin.js +0 -128
  32. package/bearing-line/index.js +0 -2
  33. package/bearing-line/plugin.js +0 -512
  34. package/circle-line-chain/chain-list-map.js +0 -221
  35. package/circle-line-chain/init.js +0 -0
  36. package/circle-line-chain/plugin.js +0 -469
  37. package/circle-line-chain/readme.md +0 -57
  38. package/circle-line-chain/util.js +0 -1
  39. package/compass-rose/compass-rose-padding-flat.js +0 -266
  40. package/compass-rose/compass-text-writer.js +0 -173
  41. package/compass-rose/index.js +0 -3
  42. package/compassrose/compassrose.js +0 -341
  43. package/compassrose/index.js +0 -2
  44. package/depth-locator/readme.md +0 -26
  45. package/globe-types.ts +0 -13
  46. package/heatwave/index.js +0 -4
  47. package/heatwave/isobar/objectarraylabels.js +0 -247
  48. package/heatwave/isobar/plugin.js +0 -340
  49. package/heatwave/isobar/quadtreecontours.js +0 -336
  50. package/heatwave/plugins/heatwaveglobeshell.js +0 -258
  51. package/jest.config.js +0 -6
  52. package/partialrings/buffer-manager.js +0 -89
  53. package/partialrings/goals.md +0 -17
  54. package/partialrings/index.js +0 -3
  55. package/partialrings/plugin.js +0 -160
  56. package/partialrings/program.js +0 -324
  57. package/pin/pin-object-array.js +0 -381
  58. package/pin/pin-point-totem.js +0 -77
  59. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
  60. package/point-heat-map/index.js +0 -0
  61. package/point-heat-map/plugin-webworker.js +0 -151
  62. package/point-heat-map/point-to-heat-map-flow.js +0 -150
  63. package/point-heat-map/readme.md +0 -15
  64. package/point-tracks/key-methods.js +0 -3
  65. package/point-tracks/plugin.js +0 -394
  66. package/programs/arrowfield/index.js +0 -2
  67. package/programs/arrowfield/logic.js +0 -286
  68. package/programs/arrowfield/object.js +0 -89
  69. package/programs/data2legend/density-to-legend.js +0 -115
  70. package/programs/data2legend/point-to-density-texture.js +0 -114
  71. package/programs/float2legendwithratio/index.js +0 -3
  72. package/programs/float2legendwithratio/logic.js +0 -194
  73. package/programs/float2legendwithratio/object.js +0 -141
  74. package/programs/globe-util/is-globe-moved.js +0 -27
  75. package/programs/globeshell/index.js +0 -2
  76. package/programs/globeshell/noise/noises.js +0 -0
  77. package/programs/globeshell/wiggle/index.js +0 -6
  78. package/programs/globeshell/wiggle/logic.js +0 -371
  79. package/programs/globeshell/wiggle/object.js +0 -93
  80. package/programs/helpers/blender/index.js +0 -0
  81. package/programs/helpers/blender/program.js +0 -91
  82. package/programs/helpers/fadeaway/index.js +0 -3
  83. package/programs/helpers/fadeaway/logic.js +0 -76
  84. package/programs/helpers/fadeaway/object.js +0 -20
  85. package/programs/helpers/index.js +0 -2
  86. package/programs/index.js +0 -21
  87. package/programs/interface.ts +0 -7
  88. package/programs/line-on-globe/angled-line.js +0 -206
  89. package/programs/line-on-globe/circle-accurate-3d.js +0 -167
  90. package/programs/line-on-globe/circle-accurate-flat.js +0 -262
  91. package/programs/line-on-globe/circle-accurate.js +0 -202
  92. package/programs/line-on-globe/circle.js +0 -191
  93. package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
  94. package/programs/line-on-globe/index.js +0 -0
  95. package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
  96. package/programs/line-on-globe/linestrip.ts +0 -228
  97. package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
  98. package/programs/line-on-globe/to-the-surface.js +0 -129
  99. package/programs/line-on-globe/util.js +0 -8
  100. package/programs/picking/pickable-renderer.js +0 -216
  101. package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
  102. package/programs/point-on-globe/element-point-glow.js +0 -184
  103. package/programs/point-on-globe/square-pixel-point.js +0 -189
  104. package/programs/programcache.ts +0 -131
  105. package/programs/rings/distancering/circleflatprogram.js +0 -136
  106. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
  107. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
  108. package/programs/rings/distancering/index.js +0 -5
  109. package/programs/rings/distancering/paddyflatprogram.js +0 -146
  110. package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
  111. package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
  112. package/programs/rings/distancering/shader.js +0 -0
  113. package/programs/rings/index.js +0 -1
  114. package/programs/rings/partial-ring/piece-of-pie.js +0 -315
  115. package/programs/totems/camerauniformblock.d.ts +0 -48
  116. package/programs/totems/camerauniformblock.js +0 -197
  117. package/programs/totems/canvas-webglobe-info.js +0 -136
  118. package/programs/totems/gpu-selection-uniform-block.js +0 -132
  119. package/programs/totems/index.ts +0 -2
  120. package/programs/two-d/pixel-circle.js +0 -0
  121. package/programs/two-d/pixel-padding-for-compass.js +0 -174
  122. package/programs/util.js +0 -20
  123. package/programs/vectorfields/index.js +0 -3
  124. package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
  125. package/programs/vectorfields/logics/index.js +0 -5
  126. package/programs/vectorfields/logics/pixelbased.js +0 -161
  127. package/programs/vectorfields/logics/ubo.js +0 -64
  128. package/programs/vectorfields/pingpongbuffermanager.js +0 -80
  129. package/publish.bat +0 -60
  130. package/rangerings/enum.js +0 -3
  131. package/rangerings/index.js +0 -5
  132. package/rangerings/plugin.js +0 -649
  133. package/rangerings/rangeringangletext.js +0 -368
  134. package/rangerings/ring-account.js +0 -129
  135. package/shaders/fragment-toy/firework.js +0 -55
  136. package/shaders/fragment-toy/singularity.js +0 -59
  137. package/shape-on-terrain/arc/naive/plugin.ts +0 -304
  138. package/shape-on-terrain/goal.md +0 -12
  139. package/tests/Math/junction/arc-plane.test.ts +0 -133
  140. package/tests/Math/junction/plane-plane.test.ts +0 -82
  141. package/tests/Math/plane.test.ts +0 -43
  142. package/tests/Math/vec3.test.ts +0 -14
  143. package/timetracks/adaptors-line-strip.js +0 -80
  144. package/timetracks/adaptors.js +0 -133
  145. package/timetracks/index.js +0 -6
  146. package/timetracks/plugin-line-strip.js +0 -295
  147. package/timetracks/plugin.js +0 -304
  148. package/timetracks/program-line-strip.js +0 -688
  149. package/timetracks/program.js +0 -850
  150. package/timetracks/programpoint-line-strip.js +0 -175
  151. package/timetracks/programpoint.js +0 -168
  152. package/timetracks/readme.md +0 -1
  153. package/tsconfig.json +0 -22
  154. package/types.ts +0 -17
  155. package/util/account/bufferoffsetmanager.js +0 -209
  156. package/util/account/index.js +0 -6
  157. package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
  158. package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
  159. package/util/account/single-attribute-buffer-management/index.ts +0 -13
  160. package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
  161. package/util/account/single-attribute-buffer-management/types.ts +0 -39
  162. package/util/account/util.js +0 -22
  163. package/util/algorithms/index.js +0 -0
  164. package/util/algorithms/search-binary.js +0 -26
  165. package/util/check/get.js +0 -13
  166. package/util/check/index.js +0 -0
  167. package/util/check/typecheck.js +0 -39
  168. package/util/geometry/index.js +0 -53
  169. package/util/gl-util/buffer/attribute-loader.ts +0 -85
  170. package/util/gl-util/buffer/index.ts +0 -6
  171. package/util/gl-util/buffer/types.ts +0 -13
  172. package/util/gl-util/draw-options/methods.ts +0 -66
  173. package/util/gl-util/draw-options/types.ts +0 -28
  174. package/util/gl-util/uniform-block/manager.ts +0 -187
  175. package/util/gl-util/uniform-block/roadmap.md +0 -70
  176. package/util/gl-util/uniform-block/shader.js +0 -0
  177. package/util/gl-util/uniform-block/types.ts +0 -27
  178. package/util/heatwavedatamanager/datamanager.js +0 -168
  179. package/util/heatwavedatamanager/index.js +0 -3
  180. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
  181. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  182. package/util/index.js +0 -13
  183. package/util/interpolation/index.js +0 -0
  184. package/util/interpolation/timetrack/index.js +0 -9
  185. package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
  186. package/util/interpolation/timetrack/web-worker-str.js +0 -180
  187. package/util/interpolation/timetrack/web-worker.js +0 -51
  188. package/util/jshelpers/data-filler.js +0 -19
  189. package/util/jshelpers/equality.js +0 -17
  190. package/util/jshelpers/index.js +0 -1
  191. package/util/jshelpers/timefilters.js +0 -32
  192. package/util/picking/fence.js +0 -46
  193. package/util/picking/picker-displayer.js +0 -177
  194. package/util/programs/draw-texture-on-canvas.js +0 -102
  195. package/util/programs/index.js +0 -1
  196. package/util/programs/shapesonglobe.js +0 -246
  197. package/util/programs/supersampletotextures.js +0 -142
  198. package/util/programs/texturetoglobe.js +0 -203
  199. package/util/shaderfunctions/geometrytransformations.ts +0 -388
  200. package/util/shaderfunctions/index.js +0 -2
  201. package/util/shaderfunctions/nodata.js +0 -10
  202. package/util/shaderfunctions/noisefunctions.js +0 -44
  203. package/util/surface-line-data/arc-bboxes.ts +0 -42
  204. package/util/surface-line-data/arcs-to-cuts.js +0 -74
  205. package/util/surface-line-data/cut-arc.js +0 -0
  206. package/util/surface-line-data/flow.ts +0 -52
  207. package/util/surface-line-data/rbush-manager.js +0 -0
  208. package/util/surface-line-data/types.ts +0 -27
  209. package/util/surface-line-data/web-worker.js +0 -0
  210. package/util/webglobe/gldefaultstates.js +0 -5
  211. package/util/webglobe/index.js +0 -2
  212. package/util/webglobe/rasteroverlay.js +0 -96
  213. package/util/webglobjectbuilders.ts +0 -456
  214. package/util/webglobjectbuilders1.js +0 -271
  215. package/waveparticles/adaptor.js +0 -16
  216. package/waveparticles/index.js +0 -3
  217. package/waveparticles/plugin.js +0 -313
  218. package/wind/imagetovectorfieldandmagnitude.js +0 -39
  219. package/wind/index.js +0 -5
  220. package/wind/plugin.js +0 -1057
  221. package/wind/vectorfieldimage.js +0 -27
  222. package/write-text/attached-text-writer.js +0 -105
  223. package/write-text/context-text.js +0 -125
  224. package/write-text/context-text3.js +0 -178
  225. package/write-text/index.js +0 -1
  226. package/write-text/writer-plugin.js +0 -7
@@ -1,150 +0,0 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
3
- import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
4
-
5
- const vertexShader = `#version 300 es ` +
6
- shaderfunctions.PI +
7
- shaderfunctions.R +
8
- shaderfunctions.POLE +
9
- CameraUniformBlockString +
10
- shaderfunctions.mercatorXYToGLPosition +
11
- shaderfunctions.longLatRadToMercator +
12
- shaderfunctions.longLatRadToCartesian3D +
13
- shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
14
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
15
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
16
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
17
-
18
- in vec2 center;
19
- in float radius;
20
- in float pad_range;
21
- in vec4 color;
22
- in float flag;
23
-
24
- uniform int compass;
25
- uniform float pad_count;
26
-
27
- uniform float opacity;
28
-
29
-
30
- out vec2 v_limp;
31
- out vec4 v_color;
32
-
33
-
34
- void main() {
35
-
36
- float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
37
- if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
38
- v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
39
-
40
- gl_PointSize = 2.0;
41
-
42
- float odd = mod(float(gl_VertexID), 2.0);
43
- float index = (float(gl_VertexID)- odd ) / 2.0;
44
- float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
45
- float radius_ = radius - (pad_range * odd);
46
-
47
- if ( is3D){
48
- gl_Position = projection * view * vec4(
49
- circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
50
- v_limp = vec2(0.0, 0.0);
51
- return;
52
- }
53
- vec2 limp;
54
- if ( compass == 1 ){
55
- limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
56
- } else {
57
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
58
- limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
59
- }
60
- v_limp = limp;
61
- gl_Position = mercatorXYToGLPosition(limp);
62
- }`;
63
-
64
- const fragmentShader = `#version 300 es
65
- precision highp float; `+
66
- shaderfunctions.POLE + `
67
- in vec4 v_color;
68
- in vec2 v_limp;
69
- out vec4 outColor;
70
- void main() {
71
- if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
72
- outColor = v_color;
73
- }`;
74
-
75
- class Logic {
76
- constructor(globe) {
77
- this.globe = globe;
78
- this.gl = globe.gl;
79
- this.program = createProgram(this.gl, vertexShader, fragmentShader);
80
- { // bind positions so bufferManager can use them
81
- this.gl.bindAttribLocation(this.program, 0, "center");
82
- this.gl.bindAttribLocation(this.program, 1, "radius");
83
- this.gl.bindAttribLocation(this.program, 2, "pad_range");
84
- this.gl.bindAttribLocation(this.program, 3, "color");
85
- this.gl.bindAttribLocation(this.program, 4, "flag");
86
- }
87
- this.cameraBlockBindingPoint = 0;
88
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
89
- this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
90
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
91
- this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
92
- this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
93
- this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
94
- this._compassMode = 1;
95
- this._opacity = 1.0;
96
- this._padCount = 360;
97
- {
98
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
99
- this.gl.useProgram(this.program);
100
- this.gl.uniform1i(this._compassLocation, 1);
101
- this.gl.uniform1f(this._opacityLocation, 1.0);
102
- this.gl.uniform1f(this._padCountLocation, 360)
103
- this.gl.useProgram(currentProgram);
104
- }
105
-
106
- }
107
-
108
-
109
- draw(vao, length, opaity) {
110
-
111
- }
112
-
113
- draw(attrBufferManager, padCount, compass, opacity) {
114
- const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
115
- gl.useProgram(program);
116
- attrBufferManager.bindPaddingVAO();
117
- cameraBlockTotem.bind(cameraBlockBindingPoint);
118
- // draw instanced
119
- if (padCount !== this._padCount) {
120
- this._padCount = padCount;
121
- // console.log("padCount", padCount);
122
- gl.uniform1f(_padCountLocation, padCount);
123
- }
124
- if (compass !== this._compassMode) {
125
- // console.log("compass", compass);
126
- gl.uniform1i(_compassLocation, compass);
127
- this._compassMode = compass;
128
- }
129
- if (opacity !== this._opacity) {
130
- // console.log("opacity", opacity);
131
- this._opacity = opacity;
132
- gl.uniform1f(this._opacityLocation, opacity);
133
- }
134
- gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
135
- gl.bindVertexArray(null);
136
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
137
- }
138
-
139
- free() {
140
- this.gl.deleteProgram(this.program);
141
- globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
142
- }
143
- }
144
-
145
-
146
-
147
- export const PaddingProgramCache = Object.freeze({
148
- getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
149
- releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
150
- })
@@ -1,146 +0,0 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
3
- import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
4
-
5
- const vertexShader = `#version 300 es ` +
6
- shaderfunctions.PI +
7
- shaderfunctions.R +
8
- shaderfunctions.POLE +
9
- CameraUniformBlockString +
10
- shaderfunctions.mercatorXYToGLPosition +
11
- shaderfunctions.longLatRadToMercator +
12
- shaderfunctions.longLatRadToCartesian3D +
13
- shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
14
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
15
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
16
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
17
-
18
- in vec2 center;
19
- in float radius;
20
- in float pad_range;
21
- in vec4 color;
22
- in float flag;
23
-
24
- uniform int compass;
25
- uniform float pad_count;
26
-
27
- uniform float opacity;
28
-
29
-
30
- out vec2 v_limp;
31
- out vec4 v_color;
32
-
33
-
34
- void main() {
35
-
36
- float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
37
- if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
38
- v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
39
-
40
- gl_PointSize = 2.0;
41
-
42
- float odd = mod(float(gl_VertexID), 2.0);
43
- float index = (float(gl_VertexID)- odd ) / 2.0;
44
- float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
45
- float radius_ = radius - (pad_range * odd);
46
-
47
- if ( is3D){
48
- gl_Position = projection * view * vec4(
49
- circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
50
- v_limp = vec2(0.0, 0.0);
51
- return;
52
- }
53
- vec2 limp;
54
- if ( compass == 1 ){
55
- limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
56
- } else {
57
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
58
- limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
59
- }
60
- v_limp = limp;
61
- gl_Position = mercatorXYToGLPosition(limp);
62
- }`;
63
-
64
- const fragmentShader = `#version 300 es
65
- precision highp float; `+
66
- shaderfunctions.POLE + `
67
- in vec4 v_color;
68
- in vec2 v_limp;
69
- out vec4 outColor;
70
- void main() {
71
- if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
72
- outColor = v_color;
73
- }`;
74
-
75
- class Logic {
76
- constructor(globe) {
77
- this.globe = globe;
78
- this.gl = globe.gl;
79
- this.program = createProgram(this.gl, vertexShader, fragmentShader);
80
- { // bind positions so bufferManager can use them
81
- this.gl.bindAttribLocation(this.program, 0, "center");
82
- this.gl.bindAttribLocation(this.program, 1, "radius");
83
- this.gl.bindAttribLocation(this.program, 2, "pad_range");
84
- this.gl.bindAttribLocation(this.program, 3, "color");
85
- this.gl.bindAttribLocation(this.program, 4, "flag");
86
- }
87
- this.cameraBlockBindingPoint = 0;
88
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
89
- this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
90
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
91
- this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
92
- this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
93
- this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
94
- this._compassMode = 1;
95
- this._opacity = 1.0;
96
- this._padCount = 360;
97
- {
98
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
99
- this.gl.useProgram(this.program);
100
- this.gl.uniform1i(this._compassLocation, 1);
101
- this.gl.uniform1f(this._opacityLocation, 1.0);
102
- this.gl.uniform1f(this._padCountLocation, 360)
103
- this.gl.useProgram(currentProgram);
104
- }
105
-
106
- }
107
-
108
-
109
- draw(attrBufferManager, padCount, compass, opacity) {
110
- const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
111
- gl.useProgram(program);
112
- attrBufferManager.bindPaddingVAO();
113
- cameraBlockTotem.bind(cameraBlockBindingPoint);
114
- // draw instanced
115
- if (padCount !== this._padCount) {
116
- this._padCount = padCount;
117
- // console.log("padCount", padCount);
118
- gl.uniform1f(_padCountLocation, padCount);
119
- }
120
- if (compass !== this._compassMode) {
121
- // console.log("compass", compass);
122
- gl.uniform1i(_compassLocation, compass);
123
- this._compassMode = compass;
124
- }
125
- if (opacity !== this._opacity) {
126
- // console.log("opacity", opacity);
127
- this._opacity = opacity;
128
- gl.uniform1f(this._opacityLocation, opacity);
129
- }
130
- gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
131
- gl.bindVertexArray(null);
132
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
133
- }
134
-
135
- free() {
136
- this.gl.deleteProgram(this.program);
137
- globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
138
- }
139
- }
140
-
141
-
142
-
143
- export const PaddingProgramCache = Object.freeze({
144
- getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
145
- releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
146
- })
File without changes
@@ -1 +0,0 @@
1
- export * from "./distancering";
@@ -1,315 +0,0 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import { CameraUniformBlockTotem, CameraUniformBlockString } from "../../totems";
3
- import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
4
- import {
5
- POLE,
6
- PI,
7
- longLatRadToMercator,
8
- mercatorXYToGLPosition,
9
- longLatRadToCartesian3D,
10
- circleLimpFromLongLatRadCenterCartesian3D_accurate,
11
- circleLimpFromLongLatRadCenterMercatorCompass_accurate,
12
- //circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
13
- cartesian3DToGLPosition
14
-
15
-
16
- } from "../../../util/shaderfunctions/geometrytransformations";
17
-
18
-
19
- /**
20
- * TODO:
21
- * 1. Triangle face looks at screen. if rotation angle is positive the last vertex must be the faintest.
22
- *
23
- */
24
-
25
- const drawModeMap = Object.freeze({
26
- LINE_STRIP: 0,
27
- TRIANGLE_FAN: 1,
28
- });
29
-
30
-
31
- //${ circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate }
32
-
33
- const vertexShaderSource = `#version 300 es
34
-
35
- ${CameraUniformBlockString}
36
- ${PI}
37
- ${longLatRadToMercator}
38
- ${mercatorXYToGLPosition}
39
- ${longLatRadToCartesian3D}
40
- ${circleLimpFromLongLatRadCenterCartesian3D_accurate}
41
- ${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
42
- ${cartesian3DToGLPosition}
43
-
44
- uniform float edge_count;
45
- uniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN
46
- uniform float plugin_alpha_multiplier;
47
- //, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
48
- // in vec2 center; // long, lat in radian
49
- in vec2 center2d;
50
- in vec3 center3d;
51
- in float start_angle2d;
52
- in float tail_angle2d;
53
-
54
- in float start_angle3d;
55
- in float tail_angle3d;
56
-
57
- in vec4 color;
58
- in float radius; // in meter
59
- in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
60
- // flat out int vid;
61
- // flat out float v_phase;
62
- out vec2 v_pos;
63
- out vec4 v_color;
64
- // flat out float v_angle;
65
-
66
- void main() {
67
- // vid = gl_VertexID;
68
- if (color_mode == 2.0 || radius == 0.0) { return; }
69
- float start_angle, tail_angle;
70
- if (is3D) {
71
- start_angle = start_angle3d;
72
- tail_angle = tail_angle3d;
73
- } else {
74
- start_angle = start_angle2d;
75
- tail_angle = tail_angle2d;
76
- }
77
- float color_mode_ = color_mode;
78
- if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
79
- float vertexID = float(gl_VertexID);
80
- float radius_ = radius;
81
- float alpha = plugin_alpha_multiplier;
82
- if (draw_mode == 1) { // TRIANGLE_FAN
83
- if (gl_VertexID == 0) {
84
- radius_ = 0.0;
85
- if ( color_mode == 1.0 ) { alpha = 0.0; }
86
- }
87
- vertexID -= 1.0;
88
- }
89
- float phase = ( vertexID / (edge_count - 1.0) );
90
- // v_angle = tail_angle;
91
-
92
- if ( color_mode_ == 1.0 ) {
93
- if ( tail_angle < 0.0 ) {
94
- v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );
95
- } else {
96
- v_color = vec4( color.rgb , color.a * phase * alpha );
97
- }
98
- } else {
99
- v_color = vec4( color.rgb , color.a * alpha );
100
- }
101
- if ( color_mode == 0.0 && draw_mode == 1 ) {
102
- v_color.a /= 2.0;
103
- }
104
- float angle;
105
- if ( tail_angle > 0.0 ) {
106
- angle = tail_angle * (-phase + 1.0) + start_angle;
107
- } else {
108
- angle = tail_angle * phase + start_angle;
109
- }
110
- if (is3D) {
111
- vec3 pos = circleLimpFromLongLatRadCenterCartesian3D_accurate(center3d, radius_, angle);
112
- v_pos = vec2(0.0, 0.0);
113
- gl_Position = cartesian3DToGLPosition(pos);
114
- }
115
- else {
116
- vec2 pos2 = circleLimpFromLongLatRadCenterMercatorCompass_accurate(center2d, radius_, angle);
117
- v_pos = pos2;
118
- gl_Position = mercatorXYToGLPosition(pos2);
119
- }
120
-
121
- gl_PointSize = 10.0;
122
- }`;
123
-
124
-
125
- const fragmentShaderSource = `#version 300 es` + POLE + PI + `
126
- precision highp float;
127
- // flat in int vid;
128
- in vec4 v_color;
129
- in vec2 v_pos;
130
- // flat in float v_phase;
131
- // in float v_angle;
132
- out vec4 outColor;
133
- void main() {
134
- // if( vid % 2 == 0 ) { discard; }
135
- // if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }
136
- // if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }
137
- if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }
138
- outColor = v_color;
139
- }`;
140
-
141
- export const ITEM_SIZE = 10;
142
-
143
- export class Logic {
144
-
145
- constructor(globe) {
146
- this.globe = globe;
147
- this.gl = globe.gl;
148
- this._lastMode = 0;
149
- this._lastEdgeCount = 64;
150
- this._lastAlphaMultiplier = 1.0;
151
-
152
- this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
153
- const { gl, program } = this;
154
- { // set attributes locations
155
- gl.bindAttribLocation(program, 0, 'center2d');
156
- gl.bindAttribLocation(program, 1, 'center3d')
157
- gl.bindAttribLocation(program, 2, 'start_angle2d');
158
- gl.bindAttribLocation(program, 3, 'tail_angle2d');
159
- gl.bindAttribLocation(program, 4, 'start_angle3d');
160
- gl.bindAttribLocation(program, 5, 'tail_angle3d');
161
- gl.bindAttribLocation(program, 6, 'color');
162
- gl.bindAttribLocation(program, 7, 'radius');
163
- gl.bindAttribLocation(program, 8, 'color_mode');
164
- // vao
165
- // instanced draw read 1
166
- }
167
- { // Uniforms
168
- this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
169
- this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
170
- this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
171
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
172
- gl.useProgram(program);
173
- gl.uniform1i(this._draw_modeLocation, this._lastMode);
174
- gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
175
- gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
176
-
177
- this.cameraBlockBindingPoint = 0;
178
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
179
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
180
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
181
-
182
- gl.useProgram(currentProgram);
183
- }
184
-
185
- }
186
-
187
-
188
-
189
- draw(length, vao, edgeCount, alphaMultiplier, drawMode) {
190
- const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this
191
-
192
- // gl.disable(gl.DEPTH_TEST);
193
- gl.useProgram(program);
194
- if (drawMode !== this._lastMode) {
195
- gl.uniform1i(this._draw_modeLocation, drawModeMap[drawMode]);
196
- this._lastMode = drawMode;
197
- }
198
- if (edgeCount !== this._lastEdgeCount) {
199
- gl.uniform1f(this._edgeCountLocation, edgeCount);
200
- this._lastEdgeCount = edgeCount;
201
- }
202
- if (alphaMultiplier !== this._lastAlphaMultiplier) {
203
- gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
204
- this._lastAlphaMultiplier = alphaMultiplier;
205
- }
206
- const overdraw = drawModeMap[drawMode];
207
- cameraBlockTotem.bind(cameraBlockBindingPoint);
208
- gl.bindVertexArray(vao);
209
- gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
210
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
211
- gl.bindVertexArray(null);
212
- // gl.enable(gl.DEPTH_TEST);
213
- }
214
-
215
-
216
- free() {
217
- noRegisterGlobeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
218
- this.gl.deleteProgram(this.program);
219
- this.program = null;
220
- }
221
-
222
-
223
- /**
224
- * in vec2 center; // long, lat in radian
225
- in float start_angle; // the start of partial circle from bearing point
226
- in float tail_angle; // the rotation of the partial circle
227
- in vec4 color;
228
- in float radius; // in meter
229
- in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
230
- */
231
-
232
- createVAO(center2dObj, center3dObj, startAngle2DObj, tailAngle2DObj, startAngle3DObj, tailAngle3DObj, colorObj, radiusObj, colorModeObj) {
233
-
234
- const { gl } = this;
235
- const vao = gl.createVertexArray();
236
- gl.bindVertexArray(vao);
237
-
238
- {
239
- const { buffer, stride, offset } = center2dObj;
240
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
241
- gl.enableVertexAttribArray(0);
242
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
243
- gl.vertexAttribDivisor(0, 1);
244
- }
245
-
246
- {
247
- const { buffer, stride, offset } = center3dObj;
248
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
249
- gl.enableVertexAttribArray(1);
250
- gl.vertexAttribPointer(1, 3, gl.FLOAT, false, stride, offset);
251
- gl.vertexAttribDivisor(1, 1);
252
- }
253
-
254
- {
255
- const { buffer, stride, offset } = startAngle2DObj;
256
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
257
- gl.enableVertexAttribArray(2);
258
- gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
259
- gl.vertexAttribDivisor(2, 1);
260
- }
261
- {
262
- const { buffer, stride, offset } = tailAngle2DObj;
263
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
264
- gl.enableVertexAttribArray(3);
265
- gl.vertexAttribPointer(3, 1, gl.FLOAT, false, stride, offset);
266
- gl.vertexAttribDivisor(3, 1);
267
- }
268
- {
269
- const { buffer, stride, offset } = startAngle3DObj;
270
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
271
- gl.enableVertexAttribArray(4);
272
- gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
273
- gl.vertexAttribDivisor(4, 1);
274
- }
275
- {
276
- const { buffer, stride, offset } = tailAngle3DObj;
277
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
278
- gl.enableVertexAttribArray(5);
279
- gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
280
- gl.vertexAttribDivisor(5, 1);
281
- }
282
- {
283
- const { buffer, stride, offset } = colorObj;
284
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
285
- gl.enableVertexAttribArray(6);
286
- gl.vertexAttribPointer(6, 4, gl.FLOAT, false, stride, offset);
287
- gl.vertexAttribDivisor(6, 1);
288
- }
289
- {
290
- const { buffer, stride, offset } = radiusObj;
291
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
292
- gl.enableVertexAttribArray(7);
293
- gl.vertexAttribPointer(7, 1, gl.FLOAT, false, stride, offset);
294
- gl.vertexAttribDivisor(7, 1);
295
- }
296
- {
297
- const { buffer, stride, offset } = colorModeObj;
298
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
299
- gl.enableVertexAttribArray(8);
300
- gl.vertexAttribPointer(8, 1, gl.FLOAT, false, stride, offset);
301
- gl.vertexAttribDivisor(8, 1);
302
- }
303
- gl.bindVertexArray(null);
304
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
305
- return vao;
306
- }
307
-
308
-
309
-
310
- }
311
-
312
- export const PieceOfPieProgramCache = Object.freeze({
313
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
314
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
315
- });
@@ -1,48 +0,0 @@
1
- export declare const CameraUniformBlockString: string;
2
-
3
- export default class CameraUniformBlockTotem {
4
- id: string;
5
- description: string;
6
- gl: WebGL2RenderingContext | null;
7
- globe: any;
8
- ubo: WebGLBuffer | null;
9
- // _frustumPlanes: any; // Uncomment and type if used
10
- _isMovedParams: {
11
- lastLod: number | null;
12
- isMoved: boolean;
13
- };
14
- traslateFloat32: Float32Array;
15
- mapWHFloat32: Float32Array;
16
-
17
- constructor();
18
-
19
- init(globe: any, gl: WebGL2RenderingContext): void;
20
- resize(): void;
21
- setGeometry(): void;
22
- draw3D(
23
- projection: Float32Array,
24
- modelView: Float32Array,
25
- translate: { x: number; y: number; z: number }
26
- ): void;
27
- assignBindingPoint(program: WebGLProgram, bindingPoint: number): void;
28
- getUBO(): WebGLBuffer | null;
29
- getFrustumPlanes(): any; // Update type if needed
30
- bind(bindingPoint: number): void;
31
- unbind(bindingPoint: number): void;
32
- isMoved(): boolean;
33
- free(): void;
34
- readBuffer(): {
35
- view: Float32Array;
36
- projection: Float32Array;
37
- translate: Float32Array;
38
- is3D: number;
39
- mapWH: Float32Array;
40
- screenWH: Float32Array;
41
- z_level: number;
42
- };
43
- }
44
-
45
- export declare const CameraUniformBlockTotemCache: Readonly<{
46
- get: (globe: any) => any;
47
- release: (globe: any) => void;
48
- }>;