@pirireis/webglobeplugins 0.16.7 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Math/angle-calculation.js +1 -0
  2. package/Math/contour/quadtreecontours.js +300 -0
  3. package/Math/finite-line-2d.js +58 -0
  4. package/Math/methods.js +6 -0
  5. package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
  6. package/Math/tessellation/tile-merger.js +298 -0
  7. package/Math/tessellation/triangle-tessellation-meta.js +195 -42
  8. package/Math/tessellation/triangle-tessellation.js +5 -1
  9. package/compass-rose/compass-text-writer.js +39 -33
  10. package/constants.js +3 -0
  11. package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
  12. package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
  13. package/heatwave/index.js +5 -3
  14. package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
  15. package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
  16. package/investigation-tools/draw/tiles/adapters.js +67 -0
  17. package/investigation-tools/draw/tiles/tiles.js +128 -0
  18. package/package.json +4 -2
  19. package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
  20. package/programs/arrowfield/logic.js +1 -1
  21. package/programs/data2legend/density-to-legend.js +24 -29
  22. package/programs/data2legend/point-to-density-texture.js +14 -17
  23. package/programs/float2legendwithratio/logic.js +2 -2
  24. package/programs/float2legendwithratio/object.js +1 -1
  25. package/programs/helpers/{blender/program.js → blender.js} +1 -1
  26. package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
  27. package/programs/index.js +20 -9
  28. package/programs/line-on-globe/circle-accurate-3d.js +12 -14
  29. package/programs/line-on-globe/circle-accurate-flat.js +0 -1
  30. package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
  31. package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
  32. package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
  33. package/programs/picking/pickable-polygon-renderer.js +1 -1
  34. package/programs/picking/pickable-renderer.js +2 -2
  35. package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
  36. package/programs/point-on-globe/element-point-glow.js +1 -1
  37. package/programs/point-on-globe/square-pixel-point.js +1 -1
  38. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +180 -30
  39. package/programs/polygon-on-globe/texture-dem-triangles.js +93 -34
  40. package/programs/rings/partial-ring/piece-of-pie.js +26 -29
  41. package/programs/totems/camerauniformblock.js +31 -42
  42. package/programs/two-d/pixel-padding-for-compass.js +14 -24
  43. package/programs/vectorfields/logics/drawrectangleparticles.js +9 -8
  44. package/programs/vectorfields/logics/drawrectangleparticles1.js +112 -0
  45. package/programs/vectorfields/logics/pixelbased.js +1 -2
  46. package/programs/vectorfields/pingpongbuffermanager.js +1 -1
  47. package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
  48. package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
  49. package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
  50. package/range-tools-on-terrain/range-ring/plugin.js +4 -6
  51. package/semiplugins/lightweight/line-plugin.js +0 -1
  52. package/semiplugins/shape-on-terrain/arc-plugin.js +9 -2
  53. package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
  54. package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
  55. package/semiplugins/shell/bbox-renderer/index.js +2 -0
  56. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
  57. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
  58. package/semiplugins/utility/container-plugin.js +94 -0
  59. package/semiplugins/utility/object-pass-container-plugin.js +80 -0
  60. package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
  61. package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
  62. package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
  63. package/{point-tracks → tracks/point-tracks}/plugin.js +6 -5
  64. package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
  65. package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
  66. package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
  67. package/types.js +6 -0
  68. package/util/account/bufferoffsetmanager.js +1 -1
  69. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
  70. package/util/gl-util/uniform-block/manager.js +0 -1
  71. package/util/gl-util/uniform-block/types.js +0 -7
  72. package/util/index.js +10 -13
  73. package/util/picking/fence.js +16 -18
  74. package/util/picking/picker-displayer.js +6 -8
  75. package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
  76. package/util/programs/draw-texture-on-canvas.js +1 -1
  77. package/util/programs/texturetoglobe.js +3 -3
  78. package/util/shaderfunctions/geometrytransformations.js +1 -1
  79. package/vectorfield/arrowfield/index.js +3 -0
  80. package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
  81. package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
  82. package/{wind → vectorfield/wind}/index.js +1 -1
  83. package/{wind → vectorfield/wind}/plugin.js +65 -51
  84. package/write-text/context-text3.js +0 -1
  85. package/write-text/context-text4.js +2 -1
  86. package/write-text/objectarraylabels/index.js +2 -0
  87. package/Math/tessellation/tessellation-algorithm.js +0 -67
  88. package/arrowfield/index.js +0 -3
  89. package/bearing-line/index.js +0 -2
  90. package/bearing-line/plugin.js +0 -444
  91. package/circle-line-chain/chain-list-map.js +0 -201
  92. package/circle-line-chain/init.js +0 -1
  93. package/circle-line-chain/plugin.js +0 -411
  94. package/circle-line-chain/util.js +0 -1
  95. package/compassrose/compassrose.js +0 -293
  96. package/compassrose/index.js +0 -2
  97. package/index.js +0 -12
  98. package/partialrings/buffer-manager.js +0 -75
  99. package/partialrings/index.js +0 -2
  100. package/partialrings/plugin.js +0 -128
  101. package/partialrings/program.js +0 -279
  102. package/programs/arrowfield/index.js +0 -2
  103. package/programs/globe-util/is-globe-moved.js +0 -19
  104. package/programs/globeshell/index.js +0 -2
  105. package/programs/globeshell/wiggle/index.js +0 -2
  106. package/programs/helpers/blender/index.js +0 -1
  107. package/programs/helpers/fadeaway/index.js +0 -2
  108. package/programs/helpers/fadeaway/object.js +0 -14
  109. package/programs/helpers/index.js +0 -2
  110. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +0 -118
  111. package/programs/rings/distancering/circleflatprogram.js +0 -116
  112. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
  113. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
  114. package/programs/rings/distancering/index.js +0 -6
  115. package/programs/rings/distancering/paddyflatprogram.js +0 -127
  116. package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
  117. package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
  118. package/programs/two-d/pixel-circle.js +0 -1
  119. package/programs/vectorfields/index.js +0 -3
  120. package/rangerings/enum.js +0 -2
  121. package/rangerings/index.js +0 -5
  122. package/rangerings/plugin.js +0 -543
  123. package/rangerings/rangeringangletext.js +0 -326
  124. package/rangerings/ring-account.js +0 -112
  125. package/timetracks/index.js +0 -1
  126. package/util/build-strategy/general-strategy.js +0 -62
  127. package/util/gl-util/uniform-block/shader.js +0 -1
  128. package/util/heatwavedatamanager/index.js +0 -2
  129. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  130. package/util/jshelpers/data-filler.js +0 -17
  131. package/util/jshelpers/equality.js +0 -18
  132. package/util/jshelpers/index.js +0 -2
  133. package/util/jshelpers/timefilters.js +0 -30
  134. package/util/programs/index.js +0 -1
  135. package/util/surface-line-data/arc-bboxes.js +0 -25
  136. package/util/surface-line-data/arcs-to-cuts.js +0 -50
  137. package/util/surface-line-data/cut-arc.js +0 -1
  138. package/util/surface-line-data/flow.js +0 -28
  139. package/util/surface-line-data/rbush-manager.js +0 -1
  140. package/util/surface-line-data/types.js +0 -1
  141. package/util/surface-line-data/web-worker.js +0 -1
  142. package/util/webglobe/rasteroverlay.js +0 -75
  143. package/write-text/attached-text-writer.js +0 -87
  144. package/write-text/context-text3old.js +0 -152
  145. package/write-text/index.js +0 -1
  146. package/write-text/writer-plugin.js +0 -8
  147. /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
  148. /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
  149. /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
  150. /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
  151. /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
  152. /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
  153. /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
  154. /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
  155. /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
  156. /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
  157. /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
  158. /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
  159. /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
@@ -1,279 +0,0 @@
1
- import { createProgram, shaderfunctions } from "../util";
2
- import { CameraUniformBlockTotem, CameraUniformBlockString, noRegisterGlobeProgramCache, globeProgramCache } from "../programs";
3
- import BufferManager from "./buffer-manager";
4
- import { POLE, PI, longLatRadToMercator, mercatorXYToGLPosition, longLatRadToCartesian3D, circleLimpFromLongLatRadCenterCartesian3D, circleLimpFromLongLatRadCenterMercatorRealDistance, cartesian3DToGLPosition } from "../util/shaderfunctions/geometrytransformations";
5
- /**
6
- * TODO:
7
- * 1. Triangle face looks at screen. if rotation angle is positive the last vertex must be the faintest.
8
- *
9
- */
10
- const drawModeMap = Object.freeze({
11
- LINE_STRIP: 0,
12
- TRIANGLE_FAN: 1,
13
- });
14
- const vertexShaderSource = `#version 300 es
15
-
16
- ${CameraUniformBlockString}
17
- ${PI}
18
- ${longLatRadToMercator}
19
- ${mercatorXYToGLPosition}
20
- ${longLatRadToCartesian3D}
21
- ${circleLimpFromLongLatRadCenterCartesian3D}
22
- ${circleLimpFromLongLatRadCenterMercatorRealDistance}
23
- ${cartesian3DToGLPosition}
24
-
25
- uniform float edge_count;
26
- uniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN
27
- uniform float plugin_alpha_multiplier;
28
- //, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
29
- in vec2 center; // long, lat in radian
30
- in float start_angle; // the start of partial circle from bearing point
31
- in float tail_angle; // the rotation of the partial circle
32
- in vec4 color;
33
- in float radius; // in meter
34
- in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
35
- // flat out int vid;
36
- // flat out float v_phase;
37
- out vec2 v_pos;
38
- out vec4 v_color;
39
- // flat out float v_angle;
40
-
41
- void main() {
42
- // vid = gl_VertexID;
43
- if (color_mode == 2.0 || radius == 0.0) { return; }
44
- float color_mode_ = color_mode;
45
- if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
46
- float vertexID = float(gl_VertexID);
47
- float radius_ = radius;
48
- float alpha = plugin_alpha_multiplier;
49
- if (draw_mode == 1) { // TRIANGLE_FAN
50
- if (gl_VertexID == 0) {
51
- radius_ = 0.0;
52
- if ( color_mode == 1.0 ) { alpha = 0.0; }
53
- }
54
- vertexID -= 1.0;
55
- }
56
- float phase = ( vertexID / (edge_count - 1.0) );
57
- // v_angle = tail_angle;
58
-
59
- if ( color_mode_ == 1.0 ) {
60
- if ( tail_angle < 0.0 ) {
61
- v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );
62
- } else {
63
- v_color = vec4( color.rgb , color.a * phase * alpha );
64
- }
65
- } else {
66
- v_color = vec4( color.rgb , color.a * alpha );
67
- }
68
- if ( color_mode == 0.0 && draw_mode == 1 ) {
69
- v_color.a /= 2.0;
70
- }
71
- float angle;
72
- if ( tail_angle > 0.0 ) {
73
- angle = tail_angle * (-phase + 1.0) + start_angle;
74
- } else {
75
- angle = tail_angle * phase + start_angle;
76
- }
77
- if (is3D) {
78
-
79
- vec3 pos = circleLimpFromLongLatRadCenterCartesian3D(center, radius_, angle);
80
- v_pos = vec2(0.0, 0.0);
81
- gl_Position = cartesian3DToGLPosition(pos);
82
- }
83
- else {
84
-
85
- vec2 pos = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
86
- v_pos = pos;
87
- gl_Position = mercatorXYToGLPosition(pos);
88
- }
89
-
90
- gl_PointSize = 10.0;
91
- }`;
92
- const fragmentShaderSource = `#version 300 es` + POLE + PI + `
93
- precision highp float;
94
- // flat in int vid;
95
- in vec4 v_color;
96
- in vec2 v_pos;
97
- // flat in float v_phase;
98
- // in float v_angle;
99
- out vec4 outColor;
100
- void main() {
101
- // if( vid % 2 == 0 ) { discard; }
102
- // if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }
103
- // if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }
104
- if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }
105
- outColor = v_color;
106
- }`;
107
- export const ITEM_SIZE = 10;
108
- export class Logic {
109
- constructor(globe) {
110
- this.globe = globe;
111
- this.gl = globe.gl;
112
- this._lastMode = 0;
113
- this._lastEdgeCount = 64;
114
- this._lastAlphaMultiplier = 1.0;
115
- this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
116
- const { gl, program } = this;
117
- { // set attributes locations
118
- gl.bindAttribLocation(program, 0, 'center');
119
- gl.bindAttribLocation(program, 1, 'start_angle');
120
- gl.bindAttribLocation(program, 2, 'tail_angle');
121
- gl.bindAttribLocation(program, 3, 'color');
122
- gl.bindAttribLocation(program, 4, 'radius');
123
- gl.bindAttribLocation(program, 5, 'color_mode');
124
- // vao
125
- // instanced draw read 1
126
- }
127
- { // Uniforms
128
- this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
129
- this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
130
- this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
131
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
132
- gl.useProgram(program);
133
- gl.uniform1i(this._draw_modeLocation, this._lastMode);
134
- gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
135
- gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
136
- this.cameraBlockBindingPoint = 0;
137
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
138
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
139
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
140
- gl.useProgram(currentProgram);
141
- }
142
- }
143
- draw(length, vao, edgeCount, alphaMultiplier, drawMode) {
144
- const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
145
- // gl.disable(gl.DEPTH_TEST);
146
- gl.useProgram(program);
147
- if (drawMode !== this._lastMode) {
148
- gl.uniform1i(this._draw_modeLocation, drawModeMap[drawMode]);
149
- this._lastMode = drawMode;
150
- }
151
- if (edgeCount !== this._lastEdgeCount) {
152
- gl.uniform1f(this._edgeCountLocation, edgeCount);
153
- this._lastEdgeCount = edgeCount;
154
- }
155
- if (alphaMultiplier !== this._lastAlphaMultiplier) {
156
- gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
157
- this._lastAlphaMultiplier = alphaMultiplier;
158
- }
159
- const overdraw = drawModeMap[drawMode];
160
- cameraBlockTotem.bind(cameraBlockBindingPoint);
161
- gl.bindVertexArray(vao);
162
- gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
163
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
164
- gl.bindVertexArray(null);
165
- // gl.enable(gl.DEPTH_TEST);
166
- }
167
- free() {
168
- noRegisterGlobeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
169
- this.gl.deleteProgram(this.program);
170
- this.program = null;
171
- }
172
- getVaoBuffer() {
173
- const { gl } = this;
174
- const vao = gl.createVertexArray();
175
- const buffer = gl.createBuffer();
176
- gl.bindVertexArray(vao);
177
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
178
- const stride = ITEM_SIZE * 4;
179
- let offset = 0;
180
- gl.enableVertexAttribArray(0);
181
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
182
- offset += 2 * 4;
183
- gl.enableVertexAttribArray(1);
184
- gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
185
- offset += 1 * 4;
186
- gl.enableVertexAttribArray(2);
187
- gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
188
- offset += 1 * 4;
189
- gl.enableVertexAttribArray(3);
190
- gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
191
- offset += 4 * 4;
192
- gl.enableVertexAttribArray(4);
193
- gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
194
- offset += 1 * 4;
195
- gl.enableVertexAttribArray(5);
196
- gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
197
- gl.vertexAttribDivisor(0, 1);
198
- gl.vertexAttribDivisor(1, 1);
199
- gl.vertexAttribDivisor(2, 1);
200
- gl.vertexAttribDivisor(3, 1);
201
- gl.vertexAttribDivisor(4, 1);
202
- gl.vertexAttribDivisor(5, 1);
203
- gl.bindVertexArray(null);
204
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
205
- return {
206
- vao,
207
- buffer,
208
- };
209
- }
210
- /**
211
- * in vec2 center; // long, lat in radian
212
- in float start_angle; // the start of partial circle from bearing point
213
- in float tail_angle; // the rotation of the partial circle
214
- in vec4 color;
215
- in float radius; // in meter
216
- in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
217
- */
218
- createVAO(centerObj, startAngleObj, tailAngleObj, colorObj, radiusObj, colorModeObj) {
219
- const { gl } = this;
220
- const vao = gl.createVertexArray();
221
- gl.bindVertexArray(vao);
222
- {
223
- const { buffer, stride, offset } = centerObj;
224
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
225
- gl.enableVertexAttribArray(0);
226
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
227
- gl.vertexAttribDivisor(0, 1);
228
- }
229
- {
230
- const { buffer, stride, offset } = startAngleObj;
231
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
232
- gl.enableVertexAttribArray(1);
233
- gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
234
- gl.vertexAttribDivisor(1, 1);
235
- }
236
- {
237
- const { buffer, stride, offset } = tailAngleObj;
238
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
239
- gl.enableVertexAttribArray(2);
240
- gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
241
- gl.vertexAttribDivisor(2, 1);
242
- }
243
- {
244
- const { buffer, stride, offset } = colorObj;
245
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
246
- gl.enableVertexAttribArray(3);
247
- gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
248
- gl.vertexAttribDivisor(3, 1);
249
- }
250
- {
251
- const { buffer, stride, offset } = radiusObj;
252
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
253
- gl.enableVertexAttribArray(4);
254
- gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
255
- gl.vertexAttribDivisor(4, 1);
256
- }
257
- {
258
- const { buffer, stride, offset } = colorModeObj;
259
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
260
- gl.enableVertexAttribArray(5);
261
- gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
262
- gl.vertexAttribDivisor(5, 1);
263
- }
264
- gl.bindVertexArray(null);
265
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
266
- return vao;
267
- }
268
- getBufferManagerAndVao({ capacity = 10, bufferType = "DYNAMIC_DRAW" } = {}) {
269
- const { vao, buffer } = this.getVaoBuffer();
270
- return {
271
- bufferManager: new BufferManager(this.globe, this.gl, buffer, { capacity, bufferType }),
272
- vao
273
- };
274
- }
275
- }
276
- export const programCache = Object.freeze({
277
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
278
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
279
- });
@@ -1,2 +0,0 @@
1
- import ArrowField from './object';
2
- export default ArrowField;
@@ -1,19 +0,0 @@
1
- import { noRegisterGlobeProgramCache } from "../programcache";
2
- class IsGlobeMoved {
3
- constructor(globe) {
4
- this.globe = globe;
5
- this._lastLOD = globe.api_GetCurrentLODWithDecimal();
6
- }
7
- isMoved() {
8
- const globe = this.globe;
9
- if (globe.api_IsScreenMoving() || this._lastLOD != globe.api_GetCurrentLODWithDecimal()) {
10
- this._lastLOD = globe.api_GetCurrentLODWithDecimal();
11
- return true;
12
- }
13
- return false;
14
- }
15
- }
16
- const IsGlobeMovedCache = Object.freeze({
17
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, IsGlobeMoved),
18
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, IsGlobeMoved)
19
- });
@@ -1,2 +0,0 @@
1
- import GlobeShellWiggle from "./globeshell/wiggle";
2
- export { GlobeShellWiggle };
@@ -1,2 +0,0 @@
1
- import GlobeShellWiggle from './object';
2
- export { GlobeShellWiggle };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- import FadeAway from './object';
2
- export default FadeAway;
@@ -1,14 +0,0 @@
1
- import { glProgramCache } from "../../programcache";
2
- import FadeAwayProgram from "./logic";
3
- export default class FadeAway {
4
- constructor(gl) {
5
- this.gl = gl;
6
- this.program = glProgramCache.getProgram(gl, FadeAwayProgram);
7
- }
8
- draw(sourceTexture, opacity) {
9
- this.program.draw(sourceTexture, opacity);
10
- }
11
- free() {
12
- glProgramCache.releaseProgram(FadeAwayProgram);
13
- }
14
- }
@@ -1,2 +0,0 @@
1
- import FadeAway from './fadeaway';
2
- export { FadeAway };
@@ -1,118 +0,0 @@
1
- import { TextureDemTriangles } from "./texture-dem-triangles";
2
- /**
3
- * Loads a plugin with test data for TextureDemTriangles
4
- */
5
- const TEST_ITEM_COUNT = 1000000;
6
- function createTestLongLatArray() {
7
- const arr = new Float32Array(TEST_ITEM_COUNT * 2);
8
- for (let i = 0; i < TEST_ITEM_COUNT; i++) {
9
- arr[i * 2 + 0] = (Math.random() - 0.5) * Math.PI * 2; // longitude
10
- arr[i * 2 + 1] = (Math.random() - 0.5) * Math.PI; // latitude
11
- }
12
- return arr;
13
- }
14
- function createTestPos3dArray(longLatArray) {
15
- const arr = new Float32Array(TEST_ITEM_COUNT * 3);
16
- for (let i = 0; i < TEST_ITEM_COUNT; i++) {
17
- const long = longLatArray[i * 2 + 0];
18
- const lat = longLatArray[i * 2 + 1];
19
- // Convert long/lat to 3D position (simplified)
20
- arr[i * 3 + 0] = Math.cos(lat) * Math.cos(long);
21
- arr[i * 3 + 1] = Math.cos(lat) * Math.sin(long);
22
- arr[i * 3 + 2] = Math.sin(lat);
23
- }
24
- return arr;
25
- }
26
- const createTestBBOXES = () => {
27
- const bboxes = [];
28
- for (let i = 0; i < 6; i++) {
29
- const north = Math.random(); // random latitude
30
- const west = Math.random() * -1; // random longitude
31
- const south = north - Math.PI / 6; // random latitude
32
- const east = west + Math.PI / 6; // random longitude
33
- const nw = [west, north]; // random northWest
34
- const se = [east, south]; // random southEast
35
- bboxes.push({ northWest: nw, southEast: se });
36
- }
37
- return bboxes;
38
- };
39
- const createTestDemTextures = () => {
40
- const textures = [];
41
- for (let i = 0; i < 6; i++) {
42
- const texture = [];
43
- for (let j = 0; j < 5 * 5; j++) {
44
- const value = 1000 * Math.random(); // random elevation value
45
- texture.push(value);
46
- }
47
- textures.push(texture);
48
- }
49
- return textures;
50
- };
51
- export function createBuffersAndFill(gl, vec3s, longLats, indices) {
52
- const positionBuffer = gl.createBuffer();
53
- const longLatBuffer = gl.createBuffer();
54
- const indexBuffer = gl.createBuffer();
55
- gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
56
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vec3s), gl.STATIC_DRAW);
57
- gl.bindBuffer(gl.ARRAY_BUFFER, longLatBuffer);
58
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(longLats), gl.STATIC_DRAW);
59
- gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
60
- gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
61
- return {
62
- buffers: {
63
- positionBuffer,
64
- longLatBuffer,
65
- indexBuffer
66
- }
67
- };
68
- }
69
- export class TextureDemTrianglesTestPlugin {
70
- globe = null;
71
- textureDemTriangles = null;
72
- vao = null;
73
- drawOptions = null;
74
- bufferInfo = null;
75
- ubo = null;
76
- id;
77
- constructor(id) {
78
- this.id = id;
79
- }
80
- init(globe) {
81
- this.globe = globe;
82
- this.textureDemTriangles = new TextureDemTriangles(globe);
83
- // set bboxes and dem textures
84
- const demTextures = createTestDemTextures();
85
- const demTextureBBOX = createTestBBOXES();
86
- this.textureDemTriangles.setDemTextures(demTextures, demTextureBBOX);
87
- //
88
- this.ubo = this.textureDemTriangles.createUBO();
89
- this.ubo.updateSingle("u_color", new Float32Array([1.0, 0.0, 0.0, 0.0]));
90
- const bufferInfo = {
91
- pos3dBufferInfo: {
92
- buffer: globe.gl.createBuffer(),
93
- stride: 0,
94
- offset: 0,
95
- },
96
- longLatBufferInfo: {
97
- buffer: globe.gl.createBuffer(),
98
- stride: 0,
99
- offset: 0,
100
- },
101
- drawOptions: { drawRange: { count: TEST_ITEM_COUNT, first: 0 } }
102
- };
103
- this.vao = this.textureDemTriangles.createVAO(bufferInfo.pos3dBufferInfo, bufferInfo.longLatBufferInfo);
104
- const gl = globe.gl;
105
- const longLatArray = createTestLongLatArray();
106
- const pos3dArray = createTestPos3dArray(longLatArray);
107
- gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.pos3dBufferInfo.buffer);
108
- gl.bufferData(gl.ARRAY_BUFFER, pos3dArray, gl.STATIC_DRAW);
109
- gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.longLatBufferInfo.buffer);
110
- gl.bufferData(gl.ARRAY_BUFFER, longLatArray, gl.STATIC_DRAW);
111
- this.bufferInfo = bufferInfo;
112
- }
113
- draw3D() {
114
- if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo || !this.ubo)
115
- return;
116
- this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions, this.ubo);
117
- }
118
- }
@@ -1,116 +0,0 @@
1
- "use strict";
2
- // TODO: Delete this file if it is not needed anymore.
3
- // import { createProgram, shaderfunctions } from "../../../util";
4
- // import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
5
- // import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
6
- // const CIRCLE_EDGE_COUNT = 360;
7
- // const vertexShader = `#version 300 es ` +
8
- // shaderfunctions.PI +
9
- // shaderfunctions.R +
10
- // shaderfunctions.POLE +
11
- // CameraUniformBlockString +
12
- // shaderfunctions.mercatorXYToGLPosition +
13
- // shaderfunctions.longLatRadToMercator +
14
- // shaderfunctions.longLatRadToCartesian3D +
15
- // shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
16
- // shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
17
- // shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
18
- // uniform int compass;
19
- // uniform float circle_edge_count;
20
- // uniform float opacity;
21
- // in vec2 center;
22
- // in float radius;
23
- // in vec4 color;
24
- // in float flag;
25
- // out vec4 v_color;
26
- // out vec2 v_limp;
27
- // void main() {
28
- // if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
29
- // v_color = vec4(color.rgb, color.a * opacity);
30
- // if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
31
- // float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
32
- // if ( is3D ){
33
- // gl_Position = projection * view * vec4(
34
- // circleLimpFromLongLatRadCenterCartesian3D( center, radius, angle) - translate, 1.0);
35
- // v_limp = vec2(0.0, 0.0);
36
- // return;
37
- // }
38
- // vec2 limp;
39
- // if ( compass == 1 ){
40
- // limp = circleLimpFromLongLatRadCenterMercatorCompass(center, radius, angle);
41
- // } else {
42
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius, angle);
43
- // }
44
- // v_limp = limp;
45
- // gl_Position = mercatorXYToGLPosition(limp);
46
- // }`;
47
- // const fragmentShader = `#version 300 es
48
- // precision highp float;` +
49
- // shaderfunctions.POLE + `
50
- // in vec4 v_color;
51
- // in vec2 v_limp;
52
- // out vec4 outColor;
53
- // void main() {
54
- // if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
55
- // outColor = v_color;
56
- // }`;
57
- // class Logic {
58
- // constructor(globe) {
59
- // this.globe = globe;
60
- // this.gl = globe.gl;
61
- // this.program = createProgram(this.gl, vertexShader, fragmentShader);
62
- // { // bind positions so bufferManager can use them
63
- // this.gl.bindAttribLocation(this.program, 0, "center");
64
- // this.gl.bindAttribLocation(this.program, 1, "radius");
65
- // this.gl.bindAttribLocation(this.program, 2, "color");
66
- // this.gl.bindAttribLocation(this.program, 3, "flag");
67
- // }
68
- // this.cameraBlockBindingPoint = 0;
69
- // this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
70
- // const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
71
- // this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
72
- // this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
73
- // this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
74
- // this._circleEdgeCountLocation = this.gl.getUniformLocation(this.program, "circle_edge_count");
75
- // this._circleEdgeCount = CIRCLE_EDGE_COUNT;
76
- // this._compassmode = 1;
77
- // this._opacity = 1.0;
78
- // {
79
- // const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
80
- // this.gl.useProgram(this.program);
81
- // this.gl.uniform1i(this._compassLocation, 1);
82
- // this.gl.uniform1f(this._circleEdgeCountLocation, CIRCLE_EDGE_COUNT);
83
- // this.gl.uniform1f(this._opacityLocation, 1.0);
84
- // this.gl.useProgram(currentProgram);
85
- // }
86
- // }
87
- // draw(attrBufferManager, compass, circleEdgeCount, opacity) {
88
- // const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
89
- // gl.useProgram(program);
90
- // cameraBlockTotem.bind(cameraBlockBindingPoint);
91
- // attrBufferManager.bindCircleVAO();
92
- // if (compass !== this._compassmode) {
93
- // gl.uniform1i(this._compassLocation, compass);
94
- // this._compassmode = compass;
95
- // }
96
- // if (opacity !== this._opacity) {
97
- // gl.uniform1f(this._opacityLocation, opacity);
98
- // this._opacity = opacity;
99
- // }
100
- // if (circleEdgeCount !== this._circleEdgeCount) {
101
- // gl.uniform1f(this._circleEdgeCountLocation, circleEdgeCount);
102
- // this._circleEdgeCount = circleEdgeCount;
103
- // }
104
- // gl.drawArraysInstanced(gl.LINE_LOOP, 0, circleEdgeCount, attrBufferManager.length);
105
- // gl.bindVertexArray(null);
106
- // cameraBlockTotem.unbind(cameraBlockBindingPoint);
107
- // }
108
- // free() {
109
- // this.gl.deleteProgram(this.program);
110
- // globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
111
- // }
112
- // }
113
- // export const programCache = Object.freeze({
114
- // getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
115
- // releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
116
- // });