@pirireis/webglobeplugins 0.9.8 → 0.9.9

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 (213) hide show
  1. package/index.js +58 -15
  2. package/package.json +1 -1
  3. package/dist/Math/angle-calculation.js +0 -15
  4. package/dist/Math/arc.js +0 -65
  5. package/dist/Math/bounds/line-bbox.js +0 -188
  6. package/dist/Math/constants.js +0 -9
  7. package/dist/Math/frustum/camera.js +0 -24
  8. package/dist/Math/frustum/from-globeinfo.js +0 -48
  9. package/dist/Math/frustum/types.js +0 -2
  10. package/dist/Math/globe-util/horizon-plane.js +0 -112
  11. package/dist/Math/index.js +0 -1
  12. package/dist/Math/juction/arc-plane.js +0 -83
  13. package/dist/Math/juction/line-sphere.js +0 -25
  14. package/dist/Math/juction/plane-plane.js +0 -58
  15. package/dist/Math/line.js +0 -56
  16. package/dist/Math/matrix4.js +0 -1
  17. package/dist/Math/methods.js +0 -201
  18. package/dist/Math/plane.js +0 -60
  19. package/dist/Math/quaternion.js +0 -104
  20. package/dist/Math/types.js +0 -2
  21. package/dist/Math/utils.js +0 -4
  22. package/dist/Math/vec3.js +0 -126
  23. package/dist/algorithms/search-binary.js +0 -19
  24. package/dist/altitude-locator/adaptors.js +0 -1
  25. package/dist/altitude-locator/draw-subset-obj.js +0 -18
  26. package/dist/altitude-locator/keymethod.js +0 -1
  27. package/dist/altitude-locator/plugin.js +0 -341
  28. package/dist/altitude-locator/types.js +0 -23
  29. package/dist/arrowfield/adaptor.js +0 -14
  30. package/dist/arrowfield/index.js +0 -10
  31. package/dist/arrowfield/plugin.js +0 -86
  32. package/dist/bearing-line/index.js +0 -8
  33. package/dist/bearing-line/plugin.js +0 -449
  34. package/dist/circle-line-chain/chain-list-map.js +0 -205
  35. package/dist/circle-line-chain/init.js +0 -1
  36. package/dist/circle-line-chain/plugin.js +0 -424
  37. package/dist/circle-line-chain/util.js +0 -5
  38. package/dist/compass-rose/compass-rose-padding-flat.js +0 -225
  39. package/dist/compass-rose/compass-text-writer.js +0 -153
  40. package/dist/compass-rose/index.js +0 -7
  41. package/dist/compassrose/compassrose.js +0 -296
  42. package/dist/compassrose/index.js +0 -8
  43. package/dist/globe-types.js +0 -1
  44. package/dist/heatwave/index.js +0 -10
  45. package/dist/heatwave/isobar/objectarraylabels.js +0 -202
  46. package/dist/heatwave/isobar/plugin.js +0 -343
  47. package/dist/heatwave/isobar/quadtreecontours.js +0 -300
  48. package/dist/heatwave/plugins/heatwaveglobeshell.js +0 -206
  49. package/dist/index.js +0 -58
  50. package/dist/jest.config.js +0 -7
  51. package/dist/partialrings/buffer-manager.js +0 -81
  52. package/dist/partialrings/index.js +0 -41
  53. package/dist/partialrings/plugin.js +0 -135
  54. package/dist/partialrings/program.js +0 -286
  55. package/dist/pin/pin-object-array.js +0 -305
  56. package/dist/pin/pin-point-totem.js +0 -60
  57. package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -66
  58. package/dist/point-heat-map/index.js +0 -1
  59. package/dist/point-heat-map/plugin-webworker.js +0 -126
  60. package/dist/point-heat-map/point-to-heat-map-flow.js +0 -127
  61. package/dist/point-tracks/key-methods.js +0 -5
  62. package/dist/point-tracks/plugin.js +0 -338
  63. package/dist/programs/arrowfield/index.js +0 -7
  64. package/dist/programs/arrowfield/logic.js +0 -257
  65. package/dist/programs/arrowfield/object.js +0 -66
  66. package/dist/programs/data2legend/density-to-legend.js +0 -101
  67. package/dist/programs/data2legend/point-to-density-texture.js +0 -100
  68. package/dist/programs/float2legendwithratio/index.js +0 -8
  69. package/dist/programs/float2legendwithratio/logic.js +0 -171
  70. package/dist/programs/float2legendwithratio/object.js +0 -110
  71. package/dist/programs/globe-util/is-globe-moved.js +0 -21
  72. package/dist/programs/globeshell/index.js +0 -8
  73. package/dist/programs/globeshell/noise/noises.js +0 -1
  74. package/dist/programs/globeshell/wiggle/index.js +0 -8
  75. package/dist/programs/globeshell/wiggle/logic.js +0 -345
  76. package/dist/programs/globeshell/wiggle/object.js +0 -72
  77. package/dist/programs/helpers/blender/index.js +0 -1
  78. package/dist/programs/helpers/blender/program.js +0 -79
  79. package/dist/programs/helpers/fadeaway/index.js +0 -7
  80. package/dist/programs/helpers/fadeaway/logic.js +0 -72
  81. package/dist/programs/helpers/fadeaway/object.js +0 -20
  82. package/dist/programs/helpers/index.js +0 -8
  83. package/dist/programs/index.js +0 -58
  84. package/dist/programs/interface.js +0 -1
  85. package/dist/programs/line-on-globe/angled-line.js +0 -176
  86. package/dist/programs/line-on-globe/circle-accurate-3d.js +0 -141
  87. package/dist/programs/line-on-globe/circle-accurate-flat.js +0 -216
  88. package/dist/programs/line-on-globe/circle-accurate.js +0 -178
  89. package/dist/programs/line-on-globe/circle.js +0 -167
  90. package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -159
  91. package/dist/programs/line-on-globe/index.js +0 -1
  92. package/dist/programs/line-on-globe/lines-color-instanced-flat.js +0 -136
  93. package/dist/programs/line-on-globe/linestrip.js +0 -171
  94. package/dist/programs/line-on-globe/naive-accurate-flexible.js +0 -195
  95. package/dist/programs/line-on-globe/to-the-surface.js +0 -111
  96. package/dist/programs/line-on-globe/util.js +0 -8
  97. package/dist/programs/picking/pickable-renderer.js +0 -188
  98. package/dist/programs/point-on-globe/element-globe-surface-glow.js +0 -142
  99. package/dist/programs/point-on-globe/element-point-glow.js +0 -153
  100. package/dist/programs/point-on-globe/square-pixel-point.js +0 -174
  101. package/dist/programs/programcache.js +0 -131
  102. package/dist/programs/rings/distancering/circleflatprogram.js +0 -156
  103. package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -369
  104. package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +0 -357
  105. package/dist/programs/rings/distancering/index.js +0 -14
  106. package/dist/programs/rings/distancering/paddyflatprogram.js +0 -172
  107. package/dist/programs/rings/distancering/paddyflatprogram2d.js +0 -174
  108. package/dist/programs/rings/distancering/paddyflatprogram3d.js +0 -172
  109. package/dist/programs/rings/distancering/shader.js +0 -1
  110. package/dist/programs/rings/index.js +0 -17
  111. package/dist/programs/rings/partial-ring/piece-of-pie.js +0 -275
  112. package/dist/programs/totems/camerauniformblock.js +0 -160
  113. package/dist/programs/totems/canvas-webglobe-info.js +0 -110
  114. package/dist/programs/totems/gpu-selection-uniform-block.js +0 -108
  115. package/dist/programs/totems/index.js +0 -40
  116. package/dist/programs/two-d/pixel-circle.js +0 -1
  117. package/dist/programs/two-d/pixel-padding-for-compass.js +0 -162
  118. package/dist/programs/util.js +0 -17
  119. package/dist/programs/vectorfields/index.js +0 -23
  120. package/dist/programs/vectorfields/logics/drawrectangleparticles.js +0 -107
  121. package/dist/programs/vectorfields/logics/index.js +0 -12
  122. package/dist/programs/vectorfields/logics/pixelbased.js +0 -142
  123. package/dist/programs/vectorfields/logics/ubo.js +0 -63
  124. package/dist/programs/vectorfields/pingpongbuffermanager.js +0 -76
  125. package/dist/rangerings/enum.js +0 -5
  126. package/dist/rangerings/index.js +0 -15
  127. package/dist/rangerings/plugin.js +0 -560
  128. package/dist/rangerings/rangeringangletext.js +0 -329
  129. package/dist/rangerings/ring-account.js +0 -117
  130. package/dist/shaders/fragment-toy/firework.js +0 -58
  131. package/dist/shaders/fragment-toy/singularity.js +0 -59
  132. package/dist/shape-on-terrain/arc/naive/plugin.js +0 -252
  133. package/dist/timetracks/adaptors-line-strip.js +0 -71
  134. package/dist/timetracks/adaptors.js +0 -122
  135. package/dist/timetracks/index.js +0 -19
  136. package/dist/timetracks/plugin-line-strip.js +0 -250
  137. package/dist/timetracks/plugin.js +0 -258
  138. package/dist/timetracks/program-line-strip.js +0 -611
  139. package/dist/timetracks/program.js +0 -772
  140. package/dist/timetracks/programpoint-line-strip.js +0 -154
  141. package/dist/timetracks/programpoint.js +0 -147
  142. package/dist/types.js +0 -15
  143. package/dist/util/account/bufferoffsetmanager.js +0 -179
  144. package/dist/util/account/index.js +0 -23
  145. package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +0 -108
  146. package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -150
  147. package/dist/util/account/single-attribute-buffer-management/index.js +0 -9
  148. package/dist/util/account/single-attribute-buffer-management/object-store.js +0 -51
  149. package/dist/util/account/single-attribute-buffer-management/types.js +0 -2
  150. package/dist/util/account/util.js +0 -22
  151. package/dist/util/algorithms/index.js +0 -1
  152. package/dist/util/algorithms/search-binary.js +0 -28
  153. package/dist/util/check/get.js +0 -18
  154. package/dist/util/check/index.js +0 -1
  155. package/dist/util/check/typecheck.js +0 -49
  156. package/dist/util/geometry/index.js +0 -51
  157. package/dist/util/gl-util/buffer/attribute-loader.js +0 -69
  158. package/dist/util/gl-util/buffer/index.js +0 -6
  159. package/dist/util/gl-util/buffer/types.js +0 -1
  160. package/dist/util/gl-util/draw-options/methods.js +0 -38
  161. package/dist/util/gl-util/draw-options/types.js +0 -15
  162. package/dist/util/gl-util/uniform-block/manager.js +0 -156
  163. package/dist/util/gl-util/uniform-block/shader.js +0 -1
  164. package/dist/util/gl-util/uniform-block/types.js +0 -8
  165. package/dist/util/heatwavedatamanager/datamanager.js +0 -152
  166. package/dist/util/heatwavedatamanager/index.js +0 -10
  167. package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -122
  168. package/dist/util/heatwavedatamanager/pointcoordsmeta.js +0 -20
  169. package/dist/util/index.js +0 -57
  170. package/dist/util/interpolation/index.js +0 -1
  171. package/dist/util/interpolation/timetrack/index.js +0 -5
  172. package/dist/util/interpolation/timetrack/timetrack-interpolator.js +0 -79
  173. package/dist/util/interpolation/timetrack/web-worker-str.js +0 -183
  174. package/dist/util/interpolation/timetrack/web-worker.js +0 -48
  175. package/dist/util/jshelpers/data-filler.js +0 -20
  176. package/dist/util/jshelpers/equality.js +0 -20
  177. package/dist/util/jshelpers/index.js +0 -37
  178. package/dist/util/jshelpers/timefilters.js +0 -32
  179. package/dist/util/picking/fence.js +0 -46
  180. package/dist/util/picking/picker-displayer.js +0 -139
  181. package/dist/util/programs/draw-texture-on-canvas.js +0 -89
  182. package/dist/util/programs/index.js +0 -17
  183. package/dist/util/programs/shapesonglobe.js +0 -214
  184. package/dist/util/programs/supersampletotextures.js +0 -113
  185. package/dist/util/programs/texturetoglobe.js +0 -182
  186. package/dist/util/shaderfunctions/geometrytransformations.js +0 -340
  187. package/dist/util/shaderfunctions/index.js +0 -18
  188. package/dist/util/shaderfunctions/nodata.js +0 -11
  189. package/dist/util/shaderfunctions/noisefunctions.js +0 -43
  190. package/dist/util/surface-line-data/arc-bboxes.js +0 -25
  191. package/dist/util/surface-line-data/arcs-to-cuts.js +0 -50
  192. package/dist/util/surface-line-data/cut-arc.js +0 -1
  193. package/dist/util/surface-line-data/flow.js +0 -28
  194. package/dist/util/surface-line-data/rbush-manager.js +0 -1
  195. package/dist/util/surface-line-data/types.js +0 -1
  196. package/dist/util/surface-line-data/web-worker.js +0 -1
  197. package/dist/util/webglobe/gldefaultstates.js +0 -7
  198. package/dist/util/webglobe/index.js +0 -18
  199. package/dist/util/webglobe/rasteroverlay.js +0 -78
  200. package/dist/util/webglobjectbuilders.js +0 -388
  201. package/dist/util/webglobjectbuilders1.js +0 -237
  202. package/dist/waveparticles/adaptor.js +0 -17
  203. package/dist/waveparticles/index.js +0 -10
  204. package/dist/waveparticles/plugin.js +0 -266
  205. package/dist/wind/imagetovectorfieldandmagnitude.js +0 -35
  206. package/dist/wind/index.js +0 -14
  207. package/dist/wind/plugin.js +0 -926
  208. package/dist/wind/vectorfieldimage.js +0 -25
  209. package/dist/write-text/attached-text-writer.js +0 -91
  210. package/dist/write-text/context-text.js +0 -98
  211. package/dist/write-text/context-text3.js +0 -155
  212. package/dist/write-text/index.js +0 -5
  213. package/dist/write-text/writer-plugin.js +0 -8
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CameraUniformBlockTotemCache = exports.CameraUniformBlockString = void 0;
4
- const programcache_1 = require("../programcache");
5
- // import { getFrustumPlanes } from "../../Math/frustum/from-projection-matrix";
6
- // import { getFrustum } from "../../Math/frustum/from-globeinfo"
7
- // import { Plane } from "../../Math/";
8
- exports.CameraUniformBlockString = `
9
- layout(std140) uniform CameraUniformBlock {
10
- mat4 view; // 64 bytes 0
11
- mat4 projection; // 64 bytes 64
12
- vec3 translate; // 12 bytes 128
13
- bool is3D; // 4 bytes 140
14
- vec2 mapWH; // 8 bytes 144
15
- vec2 screenWH; // 8 bytes 152
16
- float z_level; // 4 bytes 160 | 164
17
- float world_distance; // 4 bytes 164
18
- float world_tilt; // 4 bytes 168
19
- float world_north_angle; // 4 bytes 172
20
- vec2 world_center_radian; // 8 bytes 176 | 184
21
- }; // 14 lines
22
- `;
23
- const Radian = Math.PI / 180.0;
24
- class CameraUniformBlockTotem {
25
- constructor() {
26
- this.id = "CameraUniformBlockTotem";
27
- this.description = `Sets a uniform block and provides buffer for it. The following is the glsl uniform block:` + exports.CameraUniformBlockString;
28
- this.gl = null;
29
- this.globe = null;
30
- this.ubo = null;
31
- // this._frustumPlanes = {
32
- // left: new Plane(),
33
- // right: new Plane(),
34
- // top: new Plane(),
35
- // bottom: new Plane(),
36
- // near: new Plane(),
37
- // far: new Plane()
38
- // }
39
- this._isMovedParams = {
40
- lastLod: null,
41
- isMoved: false,
42
- };
43
- }
44
- init(globe, gl) {
45
- this.gl = gl;
46
- this.globe = globe;
47
- this.ubo = this._createUBO();
48
- this.traslateFloat32 = new Float32Array(3);
49
- this.mapWHFloat32 = new Float32Array(2);
50
- this.setGeometry();
51
- this.resize();
52
- }
53
- _createUBO() {
54
- const { gl } = this;
55
- const ubo = gl.createBuffer();
56
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
57
- // 184 bytes in reality. Overflow on linux for some reason. So, 200 bytes.
58
- gl.bufferData(gl.UNIFORM_BUFFER, 200, gl.STREAM_DRAW);
59
- gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
60
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
61
- return ubo;
62
- }
63
- resize() {
64
- const { gl, globe, ubo } = this;
65
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
66
- gl.bufferSubData(gl.UNIFORM_BUFFER, 152, new Float32Array([globe.api_ScrW(), globe.api_ScrH()]));
67
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
68
- }
69
- setGeometry() {
70
- const { gl, globe, ubo } = this;
71
- const is3D = globe.api_GetCurrentGeometry() === 0;
72
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
73
- gl.bufferSubData(gl.UNIFORM_BUFFER, 140, new Float32Array([is3D]));
74
- }
75
- draw3D(projection, modelView, translate) {
76
- const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
77
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
78
- { // view, projection, translat
79
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
80
- gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
81
- traslateFloat32.set([translate.x, translate.y, translate.z], 0);
82
- gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
83
- }
84
- {
85
- // zoom level
86
- gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
87
- }
88
- { // mapWH
89
- if (globe.api_GetCurrentGeometry() === 1) {
90
- const { width, height } = globe.api_GetCurrentWorldWH();
91
- mapWHFloat32.set([width, height]);
92
- gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
93
- }
94
- }
95
- {
96
- // float world_distance; // 4 bytes 164
97
- // float world_tilt; // 4 bytes 168
98
- // float world_north_angle; // 4 bytes 172
99
- // vec2 world_center_radian; // 8 bytes 180
100
- const { CenterLong, CenterLat, Distance, Tilt, NorthAng } = globe.api_GetCurrentLookInfo();
101
- gl.bufferSubData(gl.UNIFORM_BUFFER, 164, new Float32Array([
102
- Distance, Radian * Tilt, Radian * NorthAng, Radian * CenterLong, Radian * CenterLat
103
- ]));
104
- }
105
- // this._frustumPlanes = getFrustumPlanes(projection, translate);
106
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
107
- { // isMoved
108
- const currentLOD = globe.api_GetCurrentLODWithDecimal();
109
- this._isMovedParams.isMoved = this._isMovedParams.lastLod !== currentLOD || globe.api_IsScreenMoving();
110
- this._isMovedParams.lastLod = currentLOD;
111
- }
112
- // getFrustum(globe, 50, this._frustumPlanes);
113
- }
114
- assignBindingPoint(program, bindingPoint) {
115
- const { gl } = this;
116
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
117
- gl.uniformBlockBinding(program, cameraBlockIndex, bindingPoint);
118
- }
119
- getUBO() {
120
- return this.ubo;
121
- }
122
- getFrustumPlanes() {
123
- return this._frustumPlanes;
124
- }
125
- bind(bindingPoint) {
126
- const { gl, ubo } = this;
127
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
128
- }
129
- unbind(bindingPoint) {
130
- const { gl } = this;
131
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
132
- }
133
- isMoved() {
134
- return this._isMovedParams.isMoved;
135
- }
136
- free() {
137
- const { gl, ubo } = this;
138
- gl.deleteBuffer(ubo);
139
- }
140
- readBuffer() {
141
- const result = new Float32Array(41);
142
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, this.ubo);
143
- this.gl.getBufferSubData(this.gl.UNIFORM_BUFFER, 0, result);
144
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, null);
145
- return {
146
- view: result.slice(0, 16),
147
- projection: result.slice(16, 32),
148
- translate: result.slice(32, 35),
149
- is3D: result[35],
150
- mapWH: result.slice(36, 38),
151
- screenWH: result.slice(38, 40),
152
- z_level: result[40]
153
- };
154
- }
155
- }
156
- exports.default = CameraUniformBlockTotem;
157
- exports.CameraUniformBlockTotemCache = Object.freeze({
158
- get: (globe) => { return programcache_1.globeProgramCache.getProgram(globe, CameraUniformBlockTotem); },
159
- release: (globe) => { return programcache_1.globeProgramCache.releaseProgram(globe, CameraUniformBlockTotem); }
160
- });
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CameraUniformBlockTotemCache = exports.WebglobeInfoUniformBlockString = void 0;
4
- const programcache_1 = require("../programcache");
5
- exports.WebglobeInfoUniformBlockString = `
6
- layout(std140) uniform WebglobeInfo {
7
- vec2 canvas_resolution;
8
- vec2 mouse_radian_long_lat;
9
- vec2 mouse_pixel_xy;
10
- float north_angle;
11
- float world_tilt;
12
- float earth_distance;
13
- };
14
- `;
15
- class CameraUniformBlockTotem {
16
- constructor() {
17
- this.id = "CameraUniformBlockTotem";
18
- this.description = `Sets a uniform block and provides buffer for it. The following is the glsl uniform block:` + CameraUniformBlockString;
19
- this.gl = null;
20
- this.globe = null;
21
- this.ubo = null;
22
- }
23
- init(globe, gl) {
24
- this.gl = gl;
25
- this.globe = globe;
26
- this.ubo = this._createUBO();
27
- this.traslateFloat32 = new Float32Array(3);
28
- this.mapWHFloat32 = new Float32Array(2);
29
- this.setGeometry();
30
- this.resize();
31
- }
32
- _createUBO() {
33
- const { gl } = this;
34
- const ubo = gl.createBuffer();
35
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
36
- gl.bufferData(gl.UNIFORM_BUFFER, 164, gl.STREAM_DRAW);
37
- gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
38
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
39
- return ubo;
40
- }
41
- resize() {
42
- const { gl, globe, ubo } = this;
43
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
44
- gl.bufferSubData(gl.UNIFORM_BUFFER, 152, new Float32Array([globe.api_ScrW(), globe.api_ScrH()]));
45
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
46
- }
47
- setGeometry() {
48
- const { gl, globe, ubo } = this;
49
- const is3D = globe.api_GetCurrentGeometry() === 0;
50
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
51
- gl.bufferSubData(gl.UNIFORM_BUFFER, 140, new Float32Array([is3D]));
52
- }
53
- draw3D(projection, modelView, translate) {
54
- const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
55
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
56
- { // view, projection, translate
57
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
58
- gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
59
- traslateFloat32.set([translate.x, translate.y, translate.z], 0);
60
- gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
61
- }
62
- {
63
- // zoom level
64
- gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
65
- }
66
- { // mapWH
67
- if (globe.api_GetCurrentGeometry() === 1) {
68
- const { width, height } = globe.api_GetCurrentWorldWH();
69
- mapWHFloat32.set([width, height]);
70
- gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
71
- }
72
- }
73
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
74
- }
75
- getUBO() {
76
- return this.ubo;
77
- }
78
- bind(bindingPoint) {
79
- const { gl, ubo } = this;
80
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
81
- }
82
- unbind(bindingPoint) {
83
- const { gl } = this;
84
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
85
- }
86
- free() {
87
- const { gl, ubo } = this;
88
- gl.deleteBuffer(ubo);
89
- }
90
- readBuffer() {
91
- const result = new Float32Array(41);
92
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, this.ubo);
93
- this.gl.getBufferSubData(this.gl.UNIFORM_BUFFER, 0, result);
94
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, null);
95
- return {
96
- view: result.slice(0, 16),
97
- projection: result.slice(16, 32),
98
- translate: result.slice(32, 35),
99
- is3D: result[35],
100
- mapWH: result.slice(36, 38),
101
- screenWH: result.slice(38, 40),
102
- z_level: result[40]
103
- };
104
- }
105
- }
106
- exports.default = CameraUniformBlockTotem;
107
- exports.CameraUniformBlockTotemCache = Object.freeze({
108
- get: (globe) => { return programcache_1.globeProgramCache.getProgram(globe, CameraUniformBlockTotem); },
109
- release: (globe) => { return programcache_1.globeProgramCache.releaseProgram(globe, CameraUniformBlockTotem); }
110
- });
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CameraUniformBlockTotemCache = exports.CameraUniformBlockString = void 0;
4
- const programcache_1 = require("../programcache");
5
- // Loads mouse position to buffer
6
- // TODO implement it
7
- exports.CameraUniformBlockString = `
8
- layout(std140) uniform GpuSelectionUniformBlock {
9
- vec2 mouse_pixel_position;
10
- vec2 mouse_radian_long_lat;
11
- }; // 11 lines
12
- `;
13
- class CameraUniformBlockTotem {
14
- constructor() {
15
- this.id = "CameraUniformBlockTotem";
16
- this.description = `Sets a uniform block and provides buffer for it. The following is the glsl uniform block:` + exports.CameraUniformBlockString;
17
- this.gl = null;
18
- this.globe = null;
19
- this.ubo = null;
20
- }
21
- init(globe, gl) {
22
- this.gl = gl;
23
- this.globe = globe;
24
- this.ubo = this._createUBO();
25
- this.traslateFloat32 = new Float32Array(3);
26
- this.mapWHFloat32 = new Float32Array(2);
27
- this.setGeometry();
28
- this.resize();
29
- }
30
- _createUBO() {
31
- const { gl } = this;
32
- const ubo = gl.createBuffer();
33
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
34
- gl.bufferData(gl.UNIFORM_BUFFER, 164, gl.STREAM_DRAW);
35
- gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
36
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
37
- return ubo;
38
- }
39
- resize() {
40
- const { gl, globe, ubo } = this;
41
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
42
- gl.bufferSubData(gl.UNIFORM_BUFFER, 152, new Float32Array([globe.api_ScrW(), globe.api_ScrH()]));
43
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
44
- }
45
- setGeometry() {
46
- const { gl, globe, ubo } = this;
47
- const is3D = globe.api_GetCurrentGeometry() === 0;
48
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
49
- gl.bufferSubData(gl.UNIFORM_BUFFER, 140, new Float32Array([is3D]));
50
- }
51
- draw3D(projection, modelView, translate) {
52
- const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
53
- gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
54
- { // view, projection, translate
55
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
56
- gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
57
- traslateFloat32.set([translate.x, translate.y, translate.z], 0);
58
- gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
59
- }
60
- {
61
- // zoom level
62
- gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
63
- }
64
- { // mapWH
65
- if (globe.api_GetCurrentGeometry() === 1) {
66
- const { width, height } = globe.api_GetCurrentWorldWH();
67
- mapWHFloat32.set([width, height]);
68
- gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
69
- }
70
- }
71
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
72
- }
73
- getUBO() {
74
- return this.ubo;
75
- }
76
- bind(bindingPoint) {
77
- const { gl, ubo } = this;
78
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
79
- }
80
- unbind(bindingPoint) {
81
- const { gl } = this;
82
- gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
83
- }
84
- free() {
85
- const { gl, ubo } = this;
86
- gl.deleteBuffer(ubo);
87
- }
88
- readBuffer() {
89
- const result = new Float32Array(41);
90
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, this.ubo);
91
- this.gl.getBufferSubData(this.gl.UNIFORM_BUFFER, 0, result);
92
- this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, null);
93
- return {
94
- view: result.slice(0, 16),
95
- projection: result.slice(16, 32),
96
- translate: result.slice(32, 35),
97
- is3D: result[35],
98
- mapWH: result.slice(36, 38),
99
- screenWH: result.slice(38, 40),
100
- z_level: result[40]
101
- };
102
- }
103
- }
104
- exports.default = CameraUniformBlockTotem;
105
- exports.CameraUniformBlockTotemCache = Object.freeze({
106
- get: (globe) => { return programcache_1.globeProgramCache.getProgram(globe, CameraUniformBlockTotem); },
107
- release: (globe) => { return programcache_1.globeProgramCache.releaseProgram(globe, CameraUniformBlockTotem); }
108
- });
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.CameraUniformBlockTotemCache = exports.CameraUniformBlockString = exports.CameraUniformBlockTotem = void 0;
37
- const camerauniformblock_1 = __importStar(require("./camerauniformblock"));
38
- exports.CameraUniformBlockTotem = camerauniformblock_1.default;
39
- Object.defineProperty(exports, "CameraUniformBlockString", { enumerable: true, get: function () { return camerauniformblock_1.CameraUniformBlockString; } });
40
- Object.defineProperty(exports, "CameraUniformBlockTotemCache", { enumerable: true, get: function () { return camerauniformblock_1.CameraUniformBlockTotemCache; } });
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PixelPaddingForFlatCompassCache = void 0;
4
- const util_1 = require("../../util");
5
- const totems_1 = require("../totems");
6
- const programcache_1 = require("../programcache");
7
- const vertexCount = 720;
8
- const vertexShaderSource = `#version 300 es
9
- ${totems_1.CameraUniformBlockString}
10
-
11
- in vec2 screen_coordinate;
12
- in float pixel_radius_small_ratio;
13
- in float pixel_radius_big_ratio;
14
- in vec4 rgba;
15
- out vec4 v_rgba;
16
- uniform float plugin_opacity;
17
-
18
- vec3 coord_opacity(){
19
- float radius;
20
- float angle;
21
- float gap = (pixel_radius_big_ratio - pixel_radius_small_ratio);
22
- if( gl_VertexID % 2 == 0){
23
- // if( gl_VertexID % 180 == 0){
24
- // radius = pixel_radius_small_ratio ;
25
- // } else
26
- if ( gl_VertexID % 60 == 0){
27
- radius = pixel_radius_small_ratio;
28
- } else if( gl_VertexID % 10 == 0) {
29
- radius = pixel_radius_small_ratio + gap * 0.5;
30
- } else {
31
- radius = pixel_radius_small_ratio + gap* 0.75;
32
- }
33
- angle = (float(gl_VertexID) / (${vertexCount}.0));
34
- } else {
35
- if ( gl_VertexID % 180 == 1){
36
- radius = pixel_radius_big_ratio + gap * 0.1;
37
-
38
- } else {
39
- radius = pixel_radius_big_ratio;
40
- }
41
- angle = (float(gl_VertexID - 1) / (${vertexCount}.0));
42
- }
43
- float opacity = fract(angle + 0.2475) / 1.5 + 0.33;
44
- angle = angle * ${Math.PI * 2.0} + world_north_angle;
45
- radius = radius * min(screenWH.x, screenWH.y) / 2.0;;
46
- return vec3( screen_coordinate + vec2( cos(angle), sin(angle)) * radius, opacity);
47
- }
48
-
49
- vec2 adjust_pos(vec2 pos) {
50
- return vec2(
51
- (pos.x / screenWH.x - 0.5) * 2.0,
52
- (0.5 - pos.y / screenWH.y) * 2.0
53
- );
54
- }
55
-
56
- void main(){
57
- vec3 c = coord_opacity();
58
- gl_Position = vec4( adjust_pos(c.xy), 0.0, 1.0);
59
- v_rgba = rgba;
60
- v_rgba.a *= plugin_opacity;
61
- gl_PointSize = 10.0;
62
- }
63
- `;
64
- const fragmentShaderSource = `#version 300 es
65
- precision highp float;
66
- in vec4 v_rgba;
67
- out vec4 color;
68
- void main(){
69
- color = v_rgba;
70
- }
71
- `;
72
- class Logic {
73
- constructor(globe) {
74
- this.globe = globe;
75
- this.gl = globe.gl;
76
- this._lastOpacity = 1;
77
- this.program = (0, util_1.createProgram)(this.gl, vertexShaderSource, fragmentShaderSource);
78
- const { gl, program } = this;
79
- { // assign attribute locations
80
- // in vec2 screen_coordinate;
81
- // in float pixel_radius_small_ratio;
82
- // in float pixel_radius_big_ratio;
83
- // in vec4 rgba;
84
- gl.bindAttribLocation(program, 0, "screen_coordinate");
85
- gl.bindAttribLocation(program, 1, "pixel_radius_small_ratio");
86
- gl.bindAttribLocation(program, 2, "pixel_radius_big_ratio");
87
- gl.bindAttribLocation(program, 3, "rgba");
88
- }
89
- {
90
- this._opacityLocation = gl.getUniformLocation(program, "plugin_opacity");
91
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
92
- gl.useProgram(program);
93
- gl.uniform1f(this._opacityLocation, this._lastOpacity);
94
- gl.useProgram(currentProgram);
95
- }
96
- {
97
- this.cameraBlockBindingPoint = 0;
98
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
99
- this.cameraBlockTotem = totems_1.CameraUniformBlockTotemCache.get(globe);
100
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
101
- }
102
- }
103
- draw(vao, length, opacity) {
104
- const { globe, gl, program, cameraBlockTotem, cameraBlockBindingPoint, _opacityLocation } = this;
105
- if (globe.api_GetCurrentGeometry() === 0)
106
- return;
107
- gl.useProgram(program);
108
- cameraBlockTotem.bind(cameraBlockBindingPoint);
109
- if (opacity !== this._lastOpacity) {
110
- this._lastOpacity = opacity;
111
- gl.uniform1f(_opacityLocation, opacity);
112
- }
113
- gl.bindVertexArray(vao);
114
- gl.drawArraysInstanced(gl.LINES, 0, vertexCount, length);
115
- gl.bindVertexArray(null);
116
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
117
- }
118
- createVAO(screenCoordsBufferObj, pixelRadiusRatioSmallBufferObj, pixelRadiusRatioBigBufferObj, rgbaBufferObj) {
119
- const { gl } = this;
120
- const vao = gl.createVertexArray();
121
- gl.bindVertexArray(vao);
122
- {
123
- const { buffer, stride = 0, offset = 0 } = screenCoordsBufferObj;
124
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
125
- gl.enableVertexAttribArray(0);
126
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
127
- gl.vertexAttribDivisor(0, 1);
128
- }
129
- {
130
- const { buffer, stride = 0, offset = 0 } = pixelRadiusRatioSmallBufferObj;
131
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
132
- gl.enableVertexAttribArray(1);
133
- gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
134
- gl.vertexAttribDivisor(1, 1);
135
- }
136
- {
137
- const { buffer, stride = 0, offset = 0 } = pixelRadiusRatioBigBufferObj;
138
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
139
- gl.enableVertexAttribArray(2);
140
- gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
141
- gl.vertexAttribDivisor(2, 1);
142
- }
143
- {
144
- const { buffer, stride = 0, offset = 0 } = rgbaBufferObj;
145
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
146
- gl.enableVertexAttribArray(3);
147
- gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
148
- gl.vertexAttribDivisor(3, 1);
149
- }
150
- gl.bindVertexArray(null);
151
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
152
- return vao;
153
- }
154
- free() {
155
- const { globe } = this;
156
- totems_1.CameraUniformBlockTotemCache.release(globe);
157
- }
158
- }
159
- exports.PixelPaddingForFlatCompassCache = Object.freeze({
160
- get: (globe) => programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic),
161
- release: (globe) => programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
162
- });
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.longlatbbox2normalbbox = longlatbbox2normalbbox;
4
- function longlatbbox2normalbbox({ minLon = -180, maxLon = 180, minLat = -90, maxLat = 90 } = {}) {
5
- // x
6
- const horOffset = (minLon) * Math.PI / 180;
7
- const horSize = (maxLon - minLon) * Math.PI / 180;
8
- // y
9
- const vertOffset = (90 - maxLat) * Math.PI / 180;
10
- const vertSize = (maxLat - minLat) * Math.PI / 180;
11
- const result = {
12
- bboxOffsetRad: new Float32Array([horOffset, vertOffset]),
13
- bboxSizeRad: new Float32Array([horSize, vertSize])
14
- };
15
- console.log("longlatbbox2normalbbox", result);
16
- return result;
17
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.PingPongBufferManager = void 0;
21
- const pingpongbuffermanager_1 = __importDefault(require("./pingpongbuffermanager"));
22
- exports.PingPongBufferManager = pingpongbuffermanager_1.default;
23
- __exportStar(require("./logics"), exports);