@pirireis/webglobeplugins 0.9.12 → 0.9.13
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.
- package/Math/angle-calculation.js +1 -3
- package/Math/arc.js +29 -32
- package/Math/bounds/line-bbox.js +1 -3
- package/Math/constants.js +1 -6
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +32 -35
- package/Math/juction/line-sphere.js +9 -12
- package/Math/juction/plane-plane.js +15 -18
- package/Math/line.js +30 -33
- package/Math/methods.js +6 -24
- package/Math/plane.js +22 -25
- package/Math/quaternion.js +6 -9
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +5 -8
- package/algorithms/search-binary.js +1 -4
- package/altitude-locator/draw-subset-obj.js +1 -3
- package/altitude-locator/plugin.js +34 -37
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +1 -4
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +3 -6
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +62 -66
- package/circle-line-chain/chain-list-map.js +1 -5
- package/circle-line-chain/plugin.js +46 -50
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +12 -16
- package/compass-rose/compass-text-writer.js +3 -7
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +6 -9
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +7 -9
- package/heatwave/isobar/plugin.js +14 -54
- package/heatwave/isobar/quadtreecontours.js +2 -4
- package/heatwave/plugins/heatwaveglobeshell.js +9 -12
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +2 -8
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +13 -20
- package/partialrings/program.js +23 -30
- package/pin/pin-object-array.js +8 -13
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +3 -6
- package/point-heat-map/plugin-webworker.js +11 -14
- package/point-heat-map/point-to-heat-map-flow.js +9 -12
- package/point-tracks/key-methods.js +1 -4
- package/point-tracks/plugin.js +15 -19
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +7 -10
- package/programs/arrowfield/object.js +7 -13
- package/programs/data2legend/density-to-legend.js +6 -9
- package/programs/data2legend/point-to-density-texture.js +13 -16
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +3 -6
- package/programs/float2legendwithratio/object.js +5 -11
- package/programs/globe-util/is-globe-moved.js +3 -5
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +3 -6
- package/programs/globeshell/wiggle/object.js +5 -11
- package/programs/helpers/blender/program.js +3 -6
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +3 -6
- package/programs/helpers/fadeaway/object.js +5 -11
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +19 -22
- package/programs/line-on-globe/circle-accurate-3d.js +21 -24
- package/programs/line-on-globe/circle-accurate-flat.js +18 -24
- package/programs/line-on-globe/circle-accurate.js +27 -30
- package/programs/line-on-globe/circle.js +26 -29
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +23 -26
- package/programs/line-on-globe/lines-color-instanced-flat.js +20 -24
- package/programs/line-on-globe/linestrip.js +28 -31
- package/programs/line-on-globe/naive-accurate-flexible.js +29 -32
- package/programs/line-on-globe/to-the-surface.js +15 -17
- package/programs/line-on-globe/util.js +1 -4
- package/programs/picking/pickable-renderer.js +25 -28
- package/programs/point-on-globe/element-globe-surface-glow.js +22 -25
- package/programs/point-on-globe/element-point-glow.js +26 -29
- package/programs/point-on-globe/square-pixel-point.js +13 -16
- package/programs/programcache.js +1 -6
- package/programs/rings/distancering/circleflatprogram.js +20 -56
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +21 -58
- package/programs/rings/distancering/circlepaddysharedbuffer.js +1 -4
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +21 -57
- package/programs/rings/distancering/paddyflatprogram2d.js +21 -57
- package/programs/rings/distancering/paddyflatprogram3d.js +21 -57
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +23 -25
- package/programs/totems/camerauniformblock.js +7 -11
- package/programs/totems/canvas-webglobe-info.js +6 -10
- package/programs/totems/gpu-selection-uniform-block.js +7 -11
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +10 -13
- package/programs/util.js +1 -3
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +9 -12
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +10 -13
- package/programs/vectorfields/logics/ubo.js +1 -7
- package/programs/vectorfields/pingpongbuffermanager.js +1 -4
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +61 -68
- package/rangerings/rangeringangletext.js +26 -29
- package/rangerings/ring-account.js +1 -6
- package/shaders/fragment-toy/firework.js +1 -4
- package/shaders/fragment-toy/singularity.js +1 -4
- package/timetracks/adaptors-line-strip.js +3 -9
- package/timetracks/adaptors.js +3 -8
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +6 -12
- package/timetracks/plugin.js +6 -12
- package/timetracks/program-line-strip.js +9 -12
- package/timetracks/program.js +10 -13
- package/timetracks/programpoint-line-strip.js +6 -9
- package/timetracks/programpoint.js +6 -9
- package/util/account/bufferoffsetmanager.js +1 -4
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +1 -5
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +1 -5
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +1 -5
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +1 -5
- package/util/algorithms/search-binary.js +1 -4
- package/util/check/get.js +1 -5
- package/util/check/typecheck.js +7 -16
- package/util/geometry/index.js +1 -7
- package/util/gl-util/buffer/attribute-loader.js +2 -6
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +2 -6
- package/util/gl-util/uniform-block/manager.js +2 -5
- package/util/heatwavedatamanager/datamanager.js +1 -4
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +3 -9
- package/util/heatwavedatamanager/pointcoordsmeta.js +1 -4
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +1 -4
- package/util/interpolation/timetrack/timetrack-interpolator.js +6 -10
- package/util/interpolation/timetrack/web-worker-str.js +1 -4
- package/util/interpolation/timetrack/web-worker.js +2 -4
- package/util/jshelpers/data-filler.js +1 -4
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +1 -3
- package/util/picking/fence.js +1 -4
- package/util/picking/picker-displayer.js +6 -9
- package/util/programs/draw-texture-on-canvas.js +6 -9
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +9 -13
- package/util/programs/supersampletotextures.js +3 -7
- package/util/programs/texturetoglobe.js +8 -11
- package/util/shaderfunctions/geometrytransformations.js +24 -31
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +1 -4
- package/util/shaderfunctions/noisefunctions.js +1 -3
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +1 -4
- package/util/webglobjectbuilders.js +16 -34
- package/util/webglobjectbuilders1.js +16 -34
- package/waveparticles/adaptor.js +1 -3
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +9 -12
- package/wind/imagetovectorfieldandmagnitude.js +1 -4
- package/wind/index.js +5 -14
- package/wind/plugin.js +6 -45
- package/wind/vectorfieldimage.js +1 -3
- package/write-text/attached-text-writer.js +6 -10
- package/write-text/context-text.js +4 -8
- package/write-text/context-text3.js +7 -11
- package/write-text/index.js +1 -5
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Z in kolometers
|
|
3
2
|
//
|
|
4
|
-
|
|
5
|
-
exports.circleOnSphere = exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = exports.circleLimpFromLongLatRadCenterMercatorCompass_accurate = exports.circleLimpFromLongLatRadCenterCartesian3D_accurate = exports.slerp = exports.realDistanceOnSphereR1 = exports.circleCircumferenceInterPolationOf2PointsRadian = exports.angleBetweenTwoPointsRadian = exports.cartesianToSpherical = exports.circleLimpFromLongLatRadCenterMercatorCompass = exports.circleLimpFromLongLatRadCenterMercatorRealDistancePadding = exports.circleLimpFromLongLatRadCenterMercatorRealDistance = exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew = exports.circleLimpFromLongLatRadCenterCartesian3D = exports.longLatRadToCartesian3DWithR = exports.longLatRadToCartesian3D = exports.longLatRadToMercator = exports.cartesian3DToGLPosition = exports.mercatorXYToGLPosition = exports.pixelXYToCartesian2DPoint = exports.pixelXYToCartesian3DPoint = exports.R_3D = exports.POLE_BY_PI = exports.PI = exports.R = exports.POLE = void 0;
|
|
6
|
-
exports.POLE = `
|
|
3
|
+
export const POLE = `
|
|
7
4
|
#ifndef POLE
|
|
8
5
|
#define POLE 20037508.34
|
|
9
6
|
#endif
|
|
10
7
|
`;
|
|
11
|
-
|
|
8
|
+
export const R = `
|
|
12
9
|
#ifndef R
|
|
13
10
|
#define R 6378137.0
|
|
14
11
|
#endif
|
|
15
12
|
`;
|
|
16
|
-
|
|
13
|
+
export const PI = `
|
|
17
14
|
#ifndef PI
|
|
18
15
|
#define PI 3.141592653589793
|
|
19
16
|
|
|
20
17
|
#endif
|
|
21
18
|
`;
|
|
22
|
-
|
|
19
|
+
export const POLE_BY_PI = `
|
|
23
20
|
#ifndef POLE_BY_PI
|
|
24
21
|
#define POLE_BY_PI 6378137.0
|
|
25
22
|
#endif
|
|
26
23
|
`;
|
|
27
|
-
|
|
24
|
+
export const R_3D = `
|
|
28
25
|
#ifndef R_3D
|
|
29
26
|
#define R_3D 6378.137
|
|
30
27
|
#endif
|
|
31
28
|
`;
|
|
32
|
-
|
|
29
|
+
export const pixelXYToCartesian3DPoint = R_3D + PI + `
|
|
33
30
|
vec3 pixelXYToCartesian3DPoint( vec3 position) {
|
|
34
31
|
float longRad = PI * (2.0 * position.x - 1.0);
|
|
35
32
|
float latRad = PI * position.y;
|
|
@@ -40,7 +37,7 @@ vec3 pixelXYToCartesian3DPoint( vec3 position) {
|
|
|
40
37
|
return vec3(x, y, z);
|
|
41
38
|
}
|
|
42
39
|
`;
|
|
43
|
-
|
|
40
|
+
export const pixelXYToCartesian2DPoint = PI + POLE + POLE_BY_PI + `
|
|
44
41
|
vec2 pixelXYToCartesian2DPoint( vec2 position, vec2 translate, vec2 mapWH, vec2 screenWH) {
|
|
45
42
|
float x = (2.0 * position.x - 1.0) * POLE;
|
|
46
43
|
x = ((x - translate.x) / mapWH.x) * screenWH.x;
|
|
@@ -50,20 +47,20 @@ vec2 pixelXYToCartesian2DPoint( vec2 position, vec2 translate, vec2 mapWH, vec2
|
|
|
50
47
|
}
|
|
51
48
|
`;
|
|
52
49
|
// TODO: rename it to mercatorXYToGLPosition
|
|
53
|
-
|
|
50
|
+
export const mercatorXYToGLPosition = `
|
|
54
51
|
vec4 mercatorXYToGLPosition( vec2 position) { // projection, translate, mapWH, screenWH comes from camera uniform block
|
|
55
52
|
float x = (( position.x - translate.x ) / mapWH.x) * screenWH.x;
|
|
56
53
|
float y = (1.0 - (position.y - translate.y) / mapWH.y) * screenWH.y;
|
|
57
54
|
return projection * vec4(x, y, 0.0, 1.0);
|
|
58
55
|
}
|
|
59
56
|
`;
|
|
60
|
-
|
|
57
|
+
export const cartesian3DToGLPosition = `
|
|
61
58
|
vec4 cartesian3DToGLPosition( vec3 position) {
|
|
62
59
|
return projection * view * vec4(position - translate, 1.0);
|
|
63
60
|
}
|
|
64
61
|
`;
|
|
65
62
|
// pi / pole = 2 / R
|
|
66
|
-
|
|
63
|
+
export const longLatRadToMercator = R + PI + `
|
|
67
64
|
vec2 longLatRadToMercator( vec2 longLatRad) {
|
|
68
65
|
float x = R * longLatRad.x;
|
|
69
66
|
float y = R * log( tan( PI / 4.0 + longLatRad.y / 2.0 ) );
|
|
@@ -71,7 +68,7 @@ vec2 longLatRadToMercator( vec2 longLatRad) {
|
|
|
71
68
|
return vec2(x, y);
|
|
72
69
|
}
|
|
73
70
|
`;
|
|
74
|
-
|
|
71
|
+
export const longLatRadToCartesian3D = R_3D + `
|
|
75
72
|
vec3 longLatRadToCartesian3D( vec2 longLat) {
|
|
76
73
|
float x = R_3D * cos(longLat.y) * cos(longLat.x);
|
|
77
74
|
float y = R_3D * cos(longLat.y) * sin(longLat.x);
|
|
@@ -79,7 +76,7 @@ vec3 longLatRadToCartesian3D( vec2 longLat) {
|
|
|
79
76
|
return vec3(x, y, z);
|
|
80
77
|
}
|
|
81
78
|
`;
|
|
82
|
-
|
|
79
|
+
export const longLatRadToCartesian3DWithR = `
|
|
83
80
|
vec3 longLatRadToCartesian3DWithR( vec2 longLat, float radius) {
|
|
84
81
|
float x = radius * cos(longLat.y) * cos(longLat.x);
|
|
85
82
|
float y = radius * cos(longLat.y) * sin(longLat.x);
|
|
@@ -88,7 +85,7 @@ vec3 longLatRadToCartesian3DWithR( vec2 longLat, float radius) {
|
|
|
88
85
|
}
|
|
89
86
|
`;
|
|
90
87
|
// TODO: Make it precise. It doesnt use haversine formula. If this changes, change the formmula which calculates text position.
|
|
91
|
-
|
|
88
|
+
export const circleLimpFromLongLatRadCenterCartesian3D = R + `
|
|
92
89
|
vec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float angle) {
|
|
93
90
|
vec3 geoW = longLatRadToCartesian3D(center);
|
|
94
91
|
vec3 normal = normalize(geoW);
|
|
@@ -103,7 +100,7 @@ vec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float
|
|
|
103
100
|
}
|
|
104
101
|
`;
|
|
105
102
|
// TODO: Make it precise. Y axis is not correct.
|
|
106
|
-
|
|
103
|
+
export const circleLimpFromLongLatRadCenterMercatorRealDistanceNew = PI + `
|
|
107
104
|
vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle) {
|
|
108
105
|
float ang = angle + PI / 2.0; // Shift angle to align with +x axis
|
|
109
106
|
float r = radius / R;
|
|
@@ -122,7 +119,7 @@ vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radiu
|
|
|
122
119
|
R * log(tan(PI / 4.0 + lat / 2.0))
|
|
123
120
|
);
|
|
124
121
|
}`;
|
|
125
|
-
|
|
122
|
+
export const circleLimpFromLongLatRadCenterMercatorRealDistance = PI + `
|
|
126
123
|
vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle){
|
|
127
124
|
float ang = angle + PI / 2.0; // this is there because the other methods are implemented in, angle 0 is +x axis orientatation
|
|
128
125
|
float r = radius / R;
|
|
@@ -133,7 +130,7 @@ vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radiu
|
|
|
133
130
|
}
|
|
134
131
|
`;
|
|
135
132
|
// TODO: reconstruct this function
|
|
136
|
-
|
|
133
|
+
export const circleLimpFromLongLatRadCenterMercatorRealDistancePadding = `
|
|
137
134
|
vec2 circleLimpFromLongLatRadCenterMercatorRealDistancePadding(vec2 center, float radius, float angle){
|
|
138
135
|
float radius_radian = radius / R;
|
|
139
136
|
float new_angle;
|
|
@@ -159,7 +156,7 @@ vec2 circleLimpFromLongLatRadCenterMercatorRealDistancePadding(vec2 center, floa
|
|
|
159
156
|
return vec2(x, y);
|
|
160
157
|
}
|
|
161
158
|
`;
|
|
162
|
-
|
|
159
|
+
export const circleLimpFromLongLatRadCenterMercatorCompass = `
|
|
163
160
|
vec2 circleLimpFromLongLatRadCenterMercatorCompass(vec2 center, float radius, float angle){
|
|
164
161
|
vec2 center_ = longLatRadToMercator(center);
|
|
165
162
|
float y = -sin(angle) * radius + center_.y;
|
|
@@ -167,7 +164,7 @@ vec2 circleLimpFromLongLatRadCenterMercatorCompass(vec2 center, float radius, fl
|
|
|
167
164
|
return vec2(x, y);
|
|
168
165
|
} `;
|
|
169
166
|
// Function to convert Cartesian coordinates back to spherical (latitude, longitude)
|
|
170
|
-
|
|
167
|
+
export const cartesianToSpherical = `
|
|
171
168
|
vec2 cartesianToSpherical(vec3 point) {
|
|
172
169
|
float lat = degrees(asin(point.z)); // Latitude
|
|
173
170
|
float lon = degrees(atan(point.y, point.x)); // Longitude
|
|
@@ -175,7 +172,7 @@ vec2 cartesianToSpherical(vec3 point) {
|
|
|
175
172
|
return vec2(lat, lon);
|
|
176
173
|
} `;
|
|
177
174
|
// Main function to calculate an intermediate point
|
|
178
|
-
|
|
175
|
+
export const angleBetweenTwoPointsRadian = `
|
|
179
176
|
float angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {
|
|
180
177
|
float start_lat = log(tan((1.0 - start_.y) * PI / 2.0));
|
|
181
178
|
float end_lat = log(tan((1.0 - end_.y) * PI / 2.0));
|
|
@@ -183,7 +180,7 @@ float angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {
|
|
|
183
180
|
return angle;
|
|
184
181
|
}
|
|
185
182
|
`;
|
|
186
|
-
|
|
183
|
+
export const circleCircumferenceInterPolationOf2PointsRadian = `
|
|
187
184
|
float circleCircumferenceInterPolationOf2PointsRadian(vec2 center, vec2 target, float bearing_angle, float ratio) {
|
|
188
185
|
vec2 t = target - center;
|
|
189
186
|
float mainAngle = atan(t.x, t.y);
|
|
@@ -191,7 +188,7 @@ float circleCircumferenceInterPolationOf2PointsRadian(vec2 center, vec2 target,
|
|
|
191
188
|
return angle;
|
|
192
189
|
}
|
|
193
190
|
`;
|
|
194
|
-
|
|
191
|
+
export const realDistanceOnSphereR1 = `
|
|
195
192
|
float realDistanceOnSphereR1(vec2 longLat1, vec2 longLat2) {
|
|
196
193
|
float dLat = longLat2.y - longLat1.y;
|
|
197
194
|
float dLong = longLat2.x - longLat1.x;
|
|
@@ -233,8 +230,7 @@ vec3 slerp(vec3 A, vec3 B, float t) {
|
|
|
233
230
|
return pointsOnSphereBetween(A, B, t) * mix(length(A), length(B), t);
|
|
234
231
|
}
|
|
235
232
|
`;
|
|
236
|
-
|
|
237
|
-
const circleLimpFromLongLatRadCenterCartesian3D_accurate = exports.R + `
|
|
233
|
+
const circleLimpFromLongLatRadCenterCartesian3D_accurate = R + `
|
|
238
234
|
vec3 circleLimpFromLongLatRadCenterCartesian3D_accurate( vec3 geoW, float radius, float angle) {
|
|
239
235
|
vec3 normal = normalize(geoW);
|
|
240
236
|
vec3 tangent1 = cross(normal, vec3(0.0, 0.0, -1.0));
|
|
@@ -246,7 +242,6 @@ vec3 circleLimpFromLongLatRadCenterCartesian3D_accurate( vec3 geoW, float radius
|
|
|
246
242
|
float projected_radius = sin(radius_in_angle) * R / 1000.0;
|
|
247
243
|
return (geoW * cos(radius_in_angle)) + tangent1 * projected_radius;
|
|
248
244
|
}`;
|
|
249
|
-
exports.circleLimpFromLongLatRadCenterCartesian3D_accurate = circleLimpFromLongLatRadCenterCartesian3D_accurate;
|
|
250
245
|
const circleOnSphere = `
|
|
251
246
|
vec3 rotateVectorAroundAxis(vec3 v, vec3 axis, float angle) {
|
|
252
247
|
float c = cos(angle);
|
|
@@ -304,16 +299,14 @@ vec3 circleOnSphere(vec3 M, vec3 H, float A) {
|
|
|
304
299
|
// For simplicity, returning the direct result of rotation. Assume M and H were perfectly on the sphere.
|
|
305
300
|
return rotatedPoint;
|
|
306
301
|
}`;
|
|
307
|
-
exports.circleOnSphere = circleOnSphere;
|
|
308
302
|
const circleLimpFromLongLatRadCenterMercatorCompass_accurate = `
|
|
309
303
|
vec2 circleLimpFromLongLatRadCenterMercatorCompass_accurate(vec2 center, float radius, float angle){
|
|
310
304
|
float y = -sin(angle) * radius + center.y;
|
|
311
305
|
float x = cos(angle) * radius + center.x;
|
|
312
306
|
return vec2(x, y);
|
|
313
307
|
} `;
|
|
314
|
-
exports.circleLimpFromLongLatRadCenterMercatorCompass_accurate = circleLimpFromLongLatRadCenterMercatorCompass_accurate;
|
|
315
308
|
//TODO make it work...
|
|
316
|
-
const circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate =
|
|
309
|
+
const circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = PI + `
|
|
317
310
|
vec2 circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate(vec2 mercator_center, float radius, float angle) {
|
|
318
311
|
vec2 center = vec2(mercator_center.x /6378137.0 , asin(tanh(mercator_center.y / 6378137.0 )));
|
|
319
312
|
float ang = angle + PI / 2.0; // Shift angle to align with +x axis
|
|
@@ -337,4 +330,4 @@ vec2 circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate(vec2 mercato
|
|
|
337
330
|
);
|
|
338
331
|
return mercator_center - center_mercator + limp;
|
|
339
332
|
}`;
|
|
340
|
-
|
|
333
|
+
export { slerp, circleLimpFromLongLatRadCenterCartesian3D_accurate, circleLimpFromLongLatRadCenterMercatorCompass_accurate, circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate, circleOnSphere, };
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./geometrytransformations"), exports);
|
|
18
|
-
__exportStar(require("./nodata"), exports);
|
|
1
|
+
export * from './geometrytransformations';
|
|
2
|
+
export * from './nodata';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vertexIDtoTextureCoordinate = void 0;
|
|
4
1
|
const vertexIDtoTextureCoordinate = `
|
|
5
2
|
vec2 vertexIDtoTextureCoordinate(float id, vec2 textureDimentions) {
|
|
6
3
|
float x = mod(id, textureDimentions.x);
|
|
@@ -8,4 +5,4 @@ vec2 vertexIDtoTextureCoordinate(float id, vec2 textureDimentions) {
|
|
|
8
5
|
return vec2( x / textureDimentions.x, y / textureDimentions.y);
|
|
9
6
|
}
|
|
10
7
|
`;
|
|
11
|
-
|
|
8
|
+
export { vertexIDtoTextureCoordinate };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const permute34 = `` `vec3 permute34(vec3 x) {
|
|
4
2
|
x = ((x * 34.0) + 1.0) * x;
|
|
5
3
|
return x - floor(x * (1.0 / 289.0)) * 289.0;
|
|
@@ -38,6 +36,6 @@ const waveNoice = `` `float waveNoice(vec2 v)
|
|
|
38
36
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
39
37
|
return 130.0 * dot(m, g);
|
|
40
38
|
}` ``;
|
|
41
|
-
|
|
39
|
+
export default {
|
|
42
40
|
permute34, waveNoice
|
|
43
41
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultblendfunction = defaultblendfunction;
|
|
4
|
-
function defaultblendfunction(gl) {
|
|
1
|
+
export function defaultblendfunction(gl) {
|
|
5
2
|
gl.blendEquation(gl.FUNC_ADD); // TODO: TESTING THIS
|
|
6
3
|
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
|
7
4
|
}
|
package/util/webglobe/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./rasteroverlay"), exports);
|
|
18
|
-
__exportStar(require("./gldefaultstates"), exports);
|
|
1
|
+
export * from './rasteroverlay';
|
|
2
|
+
export * from './gldefaultstates';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Iceride bir canvas uretir ve degisiklikler bu kanvasta yapilir
|
|
4
3
|
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RasterOverlayLoader = void 0;
|
|
7
4
|
// this class loads texture to raster overlay
|
|
8
5
|
class RasterOverlayLoader {
|
|
9
6
|
constructor(id, globe, { opacity = 1.0, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, beforeObject = null, canvas = null, callBack = null } = {}) {
|
|
@@ -75,4 +72,4 @@ class RasterOverlayLoader {
|
|
|
75
72
|
this.globe.api_DeleteImageOverlay(this.id);
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
|
|
75
|
+
export { RasterOverlayLoader };
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createShader = createShader;
|
|
4
|
-
exports.createProgram = createProgram;
|
|
5
|
-
exports.createProgramWrapper = createProgramWrapper;
|
|
6
|
-
exports.createTexture = createTexture;
|
|
7
|
-
exports.bindTexture = bindTexture;
|
|
8
|
-
exports.createBuffer = createBuffer;
|
|
9
|
-
exports.bindAttribute = bindAttribute;
|
|
10
|
-
exports.bindFramebuffer = bindFramebuffer;
|
|
11
|
-
exports.decodeBase64 = decodeBase64;
|
|
12
|
-
exports.createImageFromBase64 = createImageFromBase64;
|
|
13
|
-
exports.getColorRamp = getColorRamp;
|
|
14
|
-
exports.getColorRampDiscrate = getColorRampDiscrate;
|
|
15
|
-
exports.getColorRampInterpolated = getColorRampInterpolated;
|
|
16
|
-
exports.getColorRampModed = getColorRampModed;
|
|
17
|
-
exports.defaultColorRamp = defaultColorRamp;
|
|
18
|
-
exports.reloadCurrentGLProgram = reloadCurrentGLProgram;
|
|
19
1
|
/**
|
|
20
2
|
* Creates and compiles a WebGL shader.
|
|
21
3
|
* @param gl The WebGL2RenderingContext.
|
|
@@ -24,7 +6,7 @@ exports.reloadCurrentGLProgram = reloadCurrentGLProgram;
|
|
|
24
6
|
* @returns The compiled WebGLShader.
|
|
25
7
|
* @throws An error if shader compilation fails.
|
|
26
8
|
*/
|
|
27
|
-
function createShader(gl, type, source) {
|
|
9
|
+
export function createShader(gl, type, source) {
|
|
28
10
|
const shader = gl.createShader(type);
|
|
29
11
|
if (!shader) {
|
|
30
12
|
throw new Error("Failed to create WebGLShader.");
|
|
@@ -49,7 +31,7 @@ function createShader(gl, type, source) {
|
|
|
49
31
|
* @param fragmentSource The GLSL source code for the fragment shader.
|
|
50
32
|
* @returns The linked WebGLProgram, or `undefined` if compilation or linking fails.
|
|
51
33
|
*/
|
|
52
|
-
function createProgram(gl, vertexSource, fragmentSource) {
|
|
34
|
+
export function createProgram(gl, vertexSource, fragmentSource) {
|
|
53
35
|
const program = gl.createProgram();
|
|
54
36
|
if (!program) {
|
|
55
37
|
console.error("Failed to create WebGLProgram.");
|
|
@@ -92,7 +74,7 @@ function createProgram(gl, vertexSource, fragmentSource) {
|
|
|
92
74
|
* @returns A ProgramWrapper object containing the WebGLProgram and its active attribute/uniform locations.
|
|
93
75
|
* @throws An error if shader compilation or program linking fails.
|
|
94
76
|
*/
|
|
95
|
-
function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
77
|
+
export function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
96
78
|
const program = gl.createProgram();
|
|
97
79
|
if (!program) {
|
|
98
80
|
throw new Error("Failed to create WebGLProgram.");
|
|
@@ -142,7 +124,7 @@ function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
|
142
124
|
* @returns The created WebGLTexture.
|
|
143
125
|
* @throws An error if texture creation fails.
|
|
144
126
|
*/
|
|
145
|
-
function createTexture(gl, filter, data, width, height) {
|
|
127
|
+
export function createTexture(gl, filter, data, width, height) {
|
|
146
128
|
const texture = gl.createTexture();
|
|
147
129
|
if (!texture) {
|
|
148
130
|
throw new Error("Failed to create WebGLTexture.");
|
|
@@ -170,7 +152,7 @@ function createTexture(gl, filter, data, width, height) {
|
|
|
170
152
|
* @param texture The WebGLTexture to bind.
|
|
171
153
|
* @param unit The texture unit to activate (e.g., 0 for TEXTURE0, 1 for TEXTURE1).
|
|
172
154
|
*/
|
|
173
|
-
function bindTexture(gl, texture, unit) {
|
|
155
|
+
export function bindTexture(gl, texture, unit) {
|
|
174
156
|
gl.activeTexture(gl.TEXTURE0 + unit);
|
|
175
157
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
176
158
|
}
|
|
@@ -181,7 +163,7 @@ function bindTexture(gl, texture, unit) {
|
|
|
181
163
|
* @returns The created WebGLBuffer.
|
|
182
164
|
* @throws An error if buffer creation fails.
|
|
183
165
|
*/
|
|
184
|
-
function createBuffer(gl, data) {
|
|
166
|
+
export function createBuffer(gl, data) {
|
|
185
167
|
const buffer = gl.createBuffer();
|
|
186
168
|
if (!buffer) {
|
|
187
169
|
throw new Error("Failed to create WebGLBuffer.");
|
|
@@ -197,7 +179,7 @@ function createBuffer(gl, data) {
|
|
|
197
179
|
* @param attribute The attribute location (e.g., from `gl.getAttribLocation`).
|
|
198
180
|
* @param numComponents The number of components per vertex attribute (e.g., 2 for vec2, 3 for vec3).
|
|
199
181
|
*/
|
|
200
|
-
function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
182
|
+
export function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
201
183
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
202
184
|
gl.enableVertexAttribArray(attribute);
|
|
203
185
|
gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);
|
|
@@ -208,7 +190,7 @@ function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
|
208
190
|
* @param framebuffer The WebGLFramebuffer to bind.
|
|
209
191
|
* @param texture The WebGLTexture to attach to the framebuffer's COLOR_ATTACHMENT0, or `null` to unbind.
|
|
210
192
|
*/
|
|
211
|
-
function bindFramebuffer(gl, framebuffer, texture) {
|
|
193
|
+
export function bindFramebuffer(gl, framebuffer, texture) {
|
|
212
194
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
213
195
|
if (texture) {
|
|
214
196
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
|
|
@@ -219,7 +201,7 @@ function bindFramebuffer(gl, framebuffer, texture) {
|
|
|
219
201
|
* @param data The base64 encoded string.
|
|
220
202
|
* @returns A Uint8Array containing the decoded bytes.
|
|
221
203
|
*/
|
|
222
|
-
function decodeBase64(data) {
|
|
204
|
+
export function decodeBase64(data) {
|
|
223
205
|
const binary_string = atob(data);
|
|
224
206
|
const len = binary_string.length;
|
|
225
207
|
const bytes = new Uint8Array(len);
|
|
@@ -233,7 +215,7 @@ function decodeBase64(data) {
|
|
|
233
215
|
* @param encodedData The base64 encoded image data (e.g., "iVBORw0KGgo...").
|
|
234
216
|
* @returns An HTMLImageElement with the image data loaded.
|
|
235
217
|
*/
|
|
236
|
-
function createImageFromBase64(encodedData) {
|
|
218
|
+
export function createImageFromBase64(encodedData) {
|
|
237
219
|
const bytes = decodeBase64(encodedData);
|
|
238
220
|
const blob = new Blob([bytes.buffer], { type: "image/png" });
|
|
239
221
|
const urlCreator = window.URL || window.webkitURL;
|
|
@@ -249,7 +231,7 @@ function createImageFromBase64(encodedData) {
|
|
|
249
231
|
* @param colors An object where keys are stop positions (0.0-1.0) and values are CSS color strings (e.g., { "0.0": "#RRGGBB", "0.5": "rgba(R,G,B,A)" }).
|
|
250
232
|
* @returns A Uint8Array representing the RGBA pixel data of the 1x256 color ramp.
|
|
251
233
|
*/
|
|
252
|
-
function getColorRamp(colors) {
|
|
234
|
+
export function getColorRamp(colors) {
|
|
253
235
|
const canvas = document.createElement('canvas');
|
|
254
236
|
const ctx = canvas.getContext('2d');
|
|
255
237
|
if (!ctx) {
|
|
@@ -279,7 +261,7 @@ function getColorRamp(colors) {
|
|
|
279
261
|
* @param thresholds An array of stop positions (0.0-1.0) for the colors.
|
|
280
262
|
* @returns A Uint8Array representing the RGBA pixel data of the 1x256 discrete color ramp.
|
|
281
263
|
*/
|
|
282
|
-
function getColorRampDiscrate(values, thresholds) {
|
|
264
|
+
export function getColorRampDiscrate(values, thresholds) {
|
|
283
265
|
const canvas = document.createElement('canvas');
|
|
284
266
|
const ctx = canvas.getContext('2d');
|
|
285
267
|
if (!ctx) {
|
|
@@ -306,7 +288,7 @@ function getColorRampDiscrate(values, thresholds) {
|
|
|
306
288
|
* @param thresholds An array of stop positions (0.0-1.0) for the colors.
|
|
307
289
|
* @returns A Uint8Array representing the RGBA pixel data of the 1x256 interpolated color ramp.
|
|
308
290
|
*/
|
|
309
|
-
function getColorRampInterpolated(values, thresholds) {
|
|
291
|
+
export function getColorRampInterpolated(values, thresholds) {
|
|
310
292
|
const canvas = document.createElement('canvas');
|
|
311
293
|
const ctx = canvas.getContext('2d');
|
|
312
294
|
if (!ctx) {
|
|
@@ -330,7 +312,7 @@ function getColorRampInterpolated(values, thresholds) {
|
|
|
330
312
|
* @returns A Uint8Array representing the RGBA pixel data of the 1x256 color ramp.
|
|
331
313
|
* @throws An error if an invalid mode is provided.
|
|
332
314
|
*/
|
|
333
|
-
function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
315
|
+
export function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
334
316
|
if (mode === "discrete") {
|
|
335
317
|
return getColorRampDiscrate(values, thresholds);
|
|
336
318
|
}
|
|
@@ -345,7 +327,7 @@ function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
|
345
327
|
* Returns a default interpolated color ramp commonly used for visualizations.
|
|
346
328
|
* @returns A Uint8Array representing the RGBA pixel data of the default 1x256 color ramp.
|
|
347
329
|
*/
|
|
348
|
-
function defaultColorRamp() {
|
|
330
|
+
export function defaultColorRamp() {
|
|
349
331
|
const defaultRampColors = {
|
|
350
332
|
"0.0": '#5e4fa2',
|
|
351
333
|
"0.15": '#3288bd',
|
|
@@ -365,7 +347,7 @@ function defaultColorRamp() {
|
|
|
365
347
|
* This is useful for ensuring the correct program is active after a method might change it.
|
|
366
348
|
* @returns A method decorator function.
|
|
367
349
|
*/
|
|
368
|
-
function reloadCurrentGLProgram() {
|
|
350
|
+
export function reloadCurrentGLProgram() {
|
|
369
351
|
return function (target, key, descriptor) {
|
|
370
352
|
const originalMethod = descriptor.value;
|
|
371
353
|
// Ensure the target has a 'gl' property of type WebGL2RenderingContext
|
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// export function createShader(gl, type, source) {
|
|
3
2
|
// const shader = gl.createShader(type);
|
|
4
3
|
// gl.shaderSource(shader, source);
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createShader = createShader;
|
|
7
|
-
exports.createProgram = createProgram;
|
|
8
|
-
exports.createProgramWrapper = createProgramWrapper;
|
|
9
|
-
exports.createTexture = createTexture;
|
|
10
|
-
exports.bindTexture = bindTexture;
|
|
11
|
-
exports.createBuffer = createBuffer;
|
|
12
|
-
exports.bindAttribute = bindAttribute;
|
|
13
|
-
exports.bindFramebuffer = bindFramebuffer;
|
|
14
|
-
exports.decodeBase64 = decodeBase64;
|
|
15
|
-
exports.createImageFromBase64 = createImageFromBase64;
|
|
16
|
-
exports.getColorRamp = getColorRamp;
|
|
17
|
-
exports.getColorRampDiscrate = getColorRampDiscrate;
|
|
18
|
-
exports.getColorRampInterpolated = getColorRampInterpolated;
|
|
19
|
-
exports.getColorRampModed = getColorRampModed;
|
|
20
|
-
exports.defaultColorRamp = defaultColorRamp;
|
|
21
|
-
exports.reloadCurrentGLProgram = reloadCurrentGLProgram;
|
|
22
4
|
// gl.compileShader(shader);
|
|
23
5
|
// if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
24
6
|
// throw new Error(gl.getShaderInfoLog(shader));
|
|
25
7
|
// }
|
|
26
8
|
// return shader;
|
|
27
9
|
// }
|
|
28
|
-
function createShader(gl, type, source) {
|
|
10
|
+
export function createShader(gl, type, source) {
|
|
29
11
|
const shader = gl.createShader(type);
|
|
30
12
|
gl.shaderSource(shader, source);
|
|
31
13
|
gl.compileShader(shader);
|
|
@@ -37,7 +19,7 @@ function createShader(gl, type, source) {
|
|
|
37
19
|
}
|
|
38
20
|
return shader;
|
|
39
21
|
}
|
|
40
|
-
function createProgram(gl, vertexSource, fragmentSource) {
|
|
22
|
+
export function createProgram(gl, vertexSource, fragmentSource) {
|
|
41
23
|
const program = gl.createProgram();
|
|
42
24
|
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);
|
|
43
25
|
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
@@ -60,7 +42,7 @@ function createProgram(gl, vertexSource, fragmentSource) {
|
|
|
60
42
|
}
|
|
61
43
|
return program;
|
|
62
44
|
}
|
|
63
|
-
function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
45
|
+
export function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
64
46
|
const program = gl.createProgram();
|
|
65
47
|
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);
|
|
66
48
|
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
@@ -84,7 +66,7 @@ function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
|
84
66
|
}
|
|
85
67
|
return wrapper;
|
|
86
68
|
}
|
|
87
|
-
function createTexture(gl, filter, data, width, height) {
|
|
69
|
+
export function createTexture(gl, filter, data, width, height) {
|
|
88
70
|
const texture = gl.createTexture();
|
|
89
71
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
90
72
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
@@ -100,22 +82,22 @@ function createTexture(gl, filter, data, width, height) {
|
|
|
100
82
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
101
83
|
return texture;
|
|
102
84
|
}
|
|
103
|
-
function bindTexture(gl, texture, unit) {
|
|
85
|
+
export function bindTexture(gl, texture, unit) {
|
|
104
86
|
gl.activeTexture(gl.TEXTURE0 + unit);
|
|
105
87
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
106
88
|
}
|
|
107
|
-
function createBuffer(gl, data) {
|
|
89
|
+
export function createBuffer(gl, data) {
|
|
108
90
|
const buffer = gl.createBuffer();
|
|
109
91
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
110
92
|
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
111
93
|
return buffer;
|
|
112
94
|
}
|
|
113
|
-
function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
95
|
+
export function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
114
96
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
115
97
|
gl.enableVertexAttribArray(attribute);
|
|
116
98
|
gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);
|
|
117
99
|
}
|
|
118
|
-
function bindFramebuffer(gl, framebuffer, texture) {
|
|
100
|
+
export function bindFramebuffer(gl, framebuffer, texture) {
|
|
119
101
|
if (texture) {
|
|
120
102
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
121
103
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
|
|
@@ -124,7 +106,7 @@ function bindFramebuffer(gl, framebuffer, texture) {
|
|
|
124
106
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
125
107
|
}
|
|
126
108
|
}
|
|
127
|
-
function decodeBase64(data) {
|
|
109
|
+
export function decodeBase64(data) {
|
|
128
110
|
const binary_string = atob(data);
|
|
129
111
|
const len = binary_string.length;
|
|
130
112
|
const bytes = new Uint8Array(len);
|
|
@@ -133,7 +115,7 @@ function decodeBase64(data) {
|
|
|
133
115
|
}
|
|
134
116
|
return bytes;
|
|
135
117
|
}
|
|
136
|
-
function createImageFromBase64(encodedData) {
|
|
118
|
+
export function createImageFromBase64(encodedData) {
|
|
137
119
|
const bytes = decodeBase64(encodedData);
|
|
138
120
|
const blob = new Blob([bytes.buffer], { type: "image/png" });
|
|
139
121
|
const urlCreator = window.URL || window.webkitURL;
|
|
@@ -142,7 +124,7 @@ function createImageFromBase64(encodedData) {
|
|
|
142
124
|
image.src = imageUrl;
|
|
143
125
|
return image;
|
|
144
126
|
}
|
|
145
|
-
function getColorRamp(colors) {
|
|
127
|
+
export function getColorRamp(colors) {
|
|
146
128
|
// console.log("getColorRamp", colors)
|
|
147
129
|
const canvas = document.createElement('canvas');
|
|
148
130
|
const ctx = canvas.getContext('2d');
|
|
@@ -160,7 +142,7 @@ function getColorRamp(colors) {
|
|
|
160
142
|
ctx.fillRect(0, 0, 256, 1);
|
|
161
143
|
return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);
|
|
162
144
|
}
|
|
163
|
-
function getColorRampDiscrate(values, thresholds) {
|
|
145
|
+
export function getColorRampDiscrate(values, thresholds) {
|
|
164
146
|
const canvas = document.createElement('canvas');
|
|
165
147
|
const ctx = canvas.getContext('2d');
|
|
166
148
|
canvas.width = 256;
|
|
@@ -176,7 +158,7 @@ function getColorRampDiscrate(values, thresholds) {
|
|
|
176
158
|
ctx.fillRect(0, 0, 256, 1);
|
|
177
159
|
return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);
|
|
178
160
|
}
|
|
179
|
-
function getColorRampInterpolated(values, thresholds) {
|
|
161
|
+
export function getColorRampInterpolated(values, thresholds) {
|
|
180
162
|
const canvas = document.createElement('canvas');
|
|
181
163
|
const ctx = canvas.getContext('2d');
|
|
182
164
|
canvas.width = 256;
|
|
@@ -198,7 +180,7 @@ function getColorRampInterpolated(values, thresholds) {
|
|
|
198
180
|
* thresholds: n number of thresholds. Ex: [0, 10, 20]
|
|
199
181
|
* mode: [discrete, interpolated,]
|
|
200
182
|
*/
|
|
201
|
-
function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
183
|
+
export function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
202
184
|
if (mode === "discrete") {
|
|
203
185
|
return getColorRampDiscrate(values, thresholds);
|
|
204
186
|
}
|
|
@@ -209,7 +191,7 @@ function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
|
209
191
|
throw new Error("mode is not valid");
|
|
210
192
|
}
|
|
211
193
|
}
|
|
212
|
-
function defaultColorRamp() {
|
|
194
|
+
export function defaultColorRamp() {
|
|
213
195
|
const defaultRampColors = [
|
|
214
196
|
[0.0, '#5e4fa2'],
|
|
215
197
|
[0.15, '#3288bd'],
|
|
@@ -224,7 +206,7 @@ function defaultColorRamp() {
|
|
|
224
206
|
];
|
|
225
207
|
return getColorRamp(defaultRampColors);
|
|
226
208
|
}
|
|
227
|
-
function reloadCurrentGLProgram() {
|
|
209
|
+
export function reloadCurrentGLProgram() {
|
|
228
210
|
return function (target, key, descriptor) {
|
|
229
211
|
const originalMethod = descriptor.value;
|
|
230
212
|
descriptor.value = function () {
|
package/waveparticles/adaptor.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.centigradePlus90ToVectorArray = centigradePlus90ToVectorArray;
|
|
4
1
|
function centigradePlus90ToVectorArray(centigradeArray, noDataValue = -9999) {
|
|
5
2
|
const vectorArray = new Float32Array(centigradeArray.length * 2);
|
|
6
3
|
for (let i = 0; i < centigradeArray.length; i++) {
|
|
@@ -15,3 +12,4 @@ function centigradePlus90ToVectorArray(centigradeArray, noDataValue = -9999) {
|
|
|
15
12
|
}
|
|
16
13
|
return vectorArray;
|
|
17
14
|
}
|
|
15
|
+
export { centigradePlus90ToVectorArray };
|
package/waveparticles/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VectorFieldWaveParticle = exports.centigradePlus90ToVectorArray = void 0;
|
|
7
|
-
const plugin_1 = __importDefault(require("./plugin"));
|
|
8
|
-
exports.VectorFieldWaveParticle = plugin_1.default;
|
|
9
|
-
const adaptor_1 = require("./adaptor");
|
|
10
|
-
Object.defineProperty(exports, "centigradePlus90ToVectorArray", { enumerable: true, get: function () { return adaptor_1.centigradePlus90ToVectorArray; } });
|
|
1
|
+
import VectorFieldWaveParticle from "./plugin";
|
|
2
|
+
import { centigradePlus90ToVectorArray } from "./adaptor";
|
|
3
|
+
export { centigradePlus90ToVectorArray, VectorFieldWaveParticle };
|