@pirireis/webglobeplugins 0.9.11 → 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 +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
|
@@ -1,13 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const permute34 = `` `vec3 permute34(vec3 x) {
|
|
2
|
+
x = ((x * 34.0) + 1.0) * x;
|
|
3
|
+
return x - floor(x * (1.0 / 289.0)) * 289.0;
|
|
4
|
+
}` ``;
|
|
5
|
+
const waveNoice = `` `float waveNoice(vec2 v)
|
|
6
|
+
{
|
|
7
|
+
const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);
|
|
8
|
+
|
|
9
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
10
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
11
|
+
|
|
12
|
+
vec2 i1;
|
|
13
|
+
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
14
|
+
|
|
15
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
16
|
+
x12.xy -= i1;
|
|
17
|
+
|
|
18
|
+
i = i - floor(i * (1.0 / 289.0)) * 289.0;
|
|
19
|
+
|
|
20
|
+
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))
|
|
21
|
+
+ i.x + vec3(0.0, i1.x, 1.0));
|
|
22
|
+
|
|
23
|
+
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
|
|
24
|
+
m = m * m;
|
|
25
|
+
m = m * m;
|
|
26
|
+
|
|
27
|
+
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
28
|
+
vec3 h = abs(x) - 0.5;
|
|
29
|
+
vec3 ox = floor(x + 0.5);
|
|
30
|
+
vec3 a0 = x - ox;
|
|
31
|
+
|
|
32
|
+
m *= inversesqrt(a0 * a0 + h * h);
|
|
33
|
+
|
|
34
|
+
vec3 g;
|
|
35
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
36
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
37
|
+
return 130.0 * dot(m, g);
|
|
38
|
+
}` ``;
|
|
39
|
+
export default {
|
|
40
|
+
permute34, waveNoice
|
|
5
41
|
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var permute34 = ""(templateObject_1 || (templateObject_1 = __makeTemplateObject(["vec3 permute34(vec3 x) {\n x = ((x * 34.0) + 1.0) * x;\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}"], ["vec3 permute34(vec3 x) {\n x = ((x * 34.0) + 1.0) * x;\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}"])))(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
8
|
-
var waveNoice = ""(templateObject_3 || (templateObject_3 = __makeTemplateObject(["float waveNoice(vec2 v)\n{\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439); \n\n\t vec2 i = floor(v + dot(v, C.yy));\n\t vec2 x0 = v - i + dot(i, C.xx);\n\n\t vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\n\t vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n i = i - floor(i * (1.0 / 289.0)) * 289.0;\n\n\t vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n\n\t vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n\n\t vec3 x = 2.0 * fract(p * C.www) - 1.0;\n\t vec3 h = abs(x) - 0.5;\n\t vec3 ox = floor(x + 0.5);\n\t vec3 a0 = x - ox;\n\n m *= inversesqrt(a0 * a0 + h * h);\n\n\t vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}"], ["float waveNoice(vec2 v)\n{\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439); \n\n\t vec2 i = floor(v + dot(v, C.yy));\n\t vec2 x0 = v - i + dot(i, C.xx);\n\n\t vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\n\t vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n i = i - floor(i * (1.0 / 289.0)) * 289.0;\n\n\t vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n\n\t vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n\n\t vec3 x = 2.0 * fract(p * C.www) - 1.0;\n\t vec3 h = abs(x) - 0.5;\n\t vec3 ox = floor(x + 0.5);\n\t vec3 a0 = x - ox;\n\n m *= inversesqrt(a0 * a0 + h * h);\n\n\t vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}"])))(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""])));
|
|
9
|
-
exports.default = {
|
|
10
|
-
permute34: permute34,
|
|
11
|
-
waveNoice: waveNoice
|
|
12
|
-
};
|
|
13
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _b = _a.dotDistanceOfArcCuts, dotDistanceOfArcCuts = _b === void 0 ? 0.01 : _b;
|
|
2
|
+
class ArcsToCutsManager {
|
|
3
|
+
constructor(rbush, { dotDistanceOfArcCuts = 0.01 }) {
|
|
5
4
|
this._map = new Map();
|
|
6
5
|
this._dotDistanceOfArcCuts = dotDistanceOfArcCuts;
|
|
7
6
|
this._rbush = rbush;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
insertArcs(arc) {
|
|
10
9
|
if (this._map.has(arc.id)) {
|
|
11
10
|
this._deleteCuts(arc.id);
|
|
12
11
|
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}
|
|
13
|
+
_deleteCuts(id) {
|
|
14
|
+
const cuts = this._map.get(id);
|
|
16
15
|
if (cuts) {
|
|
17
|
-
cuts.forEach(
|
|
16
|
+
cuts.forEach(cut => cut.remove());
|
|
18
17
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_this._rbush.insert(cut);
|
|
18
|
+
}
|
|
19
|
+
_cutArcAndAddToRBush(arc) {
|
|
20
|
+
const cuts = this._cutArcToBBoxs(arc);
|
|
21
|
+
cuts.forEach(cut => {
|
|
22
|
+
this._rbush.insert(cut);
|
|
25
23
|
});
|
|
26
24
|
this._map.set(arc.id, cuts);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
}
|
|
26
|
+
_cutArcToBBoxs(arc) {
|
|
27
|
+
const cuts = [];
|
|
30
28
|
// Calculate the bounding box of the arc
|
|
31
29
|
// Create a cut object and add it to the cuts array
|
|
32
|
-
|
|
30
|
+
const cut = {
|
|
33
31
|
minX: bbox.minX,
|
|
34
32
|
minY: bbox.minY,
|
|
35
33
|
maxX: bbox.maxX,
|
|
@@ -38,16 +36,15 @@ var ArcsToCutsManager = /** @class */ (function () {
|
|
|
38
36
|
};
|
|
39
37
|
cuts.push(cut);
|
|
40
38
|
return cuts;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
44
41
|
function sphericalLinearInterpolation(phi1, lambda1, phi2, lambda2, t) {
|
|
45
42
|
// Spherical linear interpolation between two points on a sphere
|
|
46
43
|
// Args: phi1, lambda1: starting point (in radians)
|
|
47
44
|
// phi2, lambda2: ending point (in radians)
|
|
48
45
|
// t: interpolation parameter (0 <= t <= 1)
|
|
49
46
|
// Returns: [phi, lambda] in radians
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const phi = phi1 + t * (phi2 - phi1);
|
|
48
|
+
const lambda = lambda1 + t * (lambda2 - lambda1);
|
|
52
49
|
return [phi, lambda];
|
|
53
50
|
}
|
|
@@ -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,13 +1,9 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.minLon, minLon = _d === void 0 ? -180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLon, maxLon = _f === void 0 ? 180 : _f, _g = _b.maxLat, maxLat = _g === void 0 ? 90 : _g, _h = _b.beforeObject, beforeObject = _h === void 0 ? null : _h, _j = _b.canvas, canvas = _j === void 0 ? null : _j, _k = _b.callBack, callBack = _k === void 0 ? null : _k;
|
|
5
|
+
class RasterOverlayLoader {
|
|
6
|
+
constructor(id, globe, { opacity = 1.0, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, beforeObject = null, canvas = null, callBack = null } = {}) {
|
|
11
7
|
this.canvas = canvas || document.createElement('canvas');
|
|
12
8
|
this.gl = this.canvas.getContext('webgl2');
|
|
13
9
|
this.globe = globe;
|
|
@@ -18,63 +14,62 @@ var RasterOverlayLoader = /** @class */ (function () {
|
|
|
18
14
|
this._isProcessing = false;
|
|
19
15
|
this._callBack = callBack;
|
|
20
16
|
}
|
|
21
|
-
|
|
17
|
+
getGL() {
|
|
22
18
|
return this.gl;
|
|
23
|
-
}
|
|
24
|
-
|
|
19
|
+
}
|
|
20
|
+
getCanvasURL() {
|
|
25
21
|
return this.canvas.toDataURL();
|
|
26
|
-
}
|
|
27
|
-
|
|
22
|
+
}
|
|
23
|
+
setBBox(minLon, minLat, maxLon, maxLat) {
|
|
28
24
|
this.bbox = { ll: { x: minLon, y: minLat }, ur: { x: maxLon, y: maxLat } };
|
|
29
25
|
this.draw();
|
|
30
|
-
}
|
|
31
|
-
|
|
26
|
+
}
|
|
27
|
+
setCanvasWidthHeight(width, height) {
|
|
32
28
|
this.canvas.width = width;
|
|
33
29
|
this.canvas.height = height;
|
|
34
30
|
this.gl.viewport(0, 0, width, height);
|
|
35
|
-
}
|
|
36
|
-
|
|
31
|
+
}
|
|
32
|
+
draw() {
|
|
37
33
|
if (!this._isProcessing) {
|
|
38
34
|
requestAnimationFrame(this._draw.bind(this));
|
|
39
35
|
this._isProcessing = true;
|
|
40
36
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
37
|
+
}
|
|
38
|
+
_draw() {
|
|
43
39
|
this.globe.api_DeleteImageOverlay(this.id);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const id = this.id;
|
|
41
|
+
const imgUrl = this.getCanvasURL();
|
|
42
|
+
const bbox = this.bbox;
|
|
43
|
+
const opacity = this._opacity;
|
|
44
|
+
const rotDeg = 0;
|
|
45
|
+
const color = null;
|
|
46
|
+
const beforeObject = this._beforeObject;
|
|
47
|
+
const callback = this._callBack || function () { };
|
|
52
48
|
this.globe.api_AddImageOverlay(id, imgUrl, bbox, color, opacity, rotDeg, beforeObject, callback);
|
|
53
49
|
this._isProcessing = false;
|
|
54
|
-
}
|
|
55
|
-
|
|
50
|
+
}
|
|
51
|
+
setBeforeObject(beforeObject) {
|
|
56
52
|
this._beforeObject = beforeObject;
|
|
57
53
|
this.draw();
|
|
58
|
-
}
|
|
59
|
-
|
|
54
|
+
}
|
|
55
|
+
setCallback(callback) {
|
|
60
56
|
this._callBack = callback;
|
|
61
|
-
}
|
|
62
|
-
|
|
57
|
+
}
|
|
58
|
+
setOpacity(opacity) {
|
|
63
59
|
if (opacity < 0 || opacity > 1) {
|
|
64
60
|
return;
|
|
65
61
|
}
|
|
66
62
|
this._opacity = opacity;
|
|
67
63
|
this.globe.api_SetImageOverlayColor(this.id, null, opacity);
|
|
68
|
-
}
|
|
69
|
-
|
|
64
|
+
}
|
|
65
|
+
free() {
|
|
70
66
|
this.globe.api_DeleteImageOverlay(this.id);
|
|
71
|
-
}
|
|
72
|
-
|
|
67
|
+
}
|
|
68
|
+
on() {
|
|
73
69
|
this.draw();
|
|
74
|
-
}
|
|
75
|
-
|
|
70
|
+
}
|
|
71
|
+
off() {
|
|
76
72
|
this.globe.api_DeleteImageOverlay(this.id);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
exports.RasterOverlayLoader = RasterOverlayLoader;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
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,19 +6,19 @@ 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) {
|
|
28
|
-
|
|
9
|
+
export function createShader(gl, type, source) {
|
|
10
|
+
const shader = gl.createShader(type);
|
|
29
11
|
if (!shader) {
|
|
30
12
|
throw new Error("Failed to create WebGLShader.");
|
|
31
13
|
}
|
|
32
14
|
gl.shaderSource(shader, source);
|
|
33
15
|
gl.compileShader(shader);
|
|
34
16
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
17
|
+
const errorLog = gl.getShaderInfoLog(shader);
|
|
18
|
+
const shaderType = type === gl.VERTEX_SHADER ? 'VERTEX_SHADER' : 'FRAGMENT_SHADER';
|
|
19
|
+
const sourceWithLineNumbers = source.split('\n').map((line, i) => `${i + 1}: ${line}`).join('\n');
|
|
38
20
|
gl.deleteShader(shader); // Clean up the failed shader
|
|
39
|
-
throw new Error(
|
|
21
|
+
throw new Error(`Error compiling ${shaderType}:\n${errorLog}\nSource:\n${sourceWithLineNumbers}`);
|
|
40
22
|
}
|
|
41
23
|
return shader;
|
|
42
24
|
}
|
|
@@ -49,14 +31,14 @@ 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) {
|
|
53
|
-
|
|
34
|
+
export function createProgram(gl, vertexSource, fragmentSource) {
|
|
35
|
+
const program = gl.createProgram();
|
|
54
36
|
if (!program) {
|
|
55
37
|
console.error("Failed to create WebGLProgram.");
|
|
56
38
|
return undefined;
|
|
57
39
|
}
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
let vertexShader;
|
|
41
|
+
let fragmentShader;
|
|
60
42
|
try {
|
|
61
43
|
vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);
|
|
62
44
|
fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
@@ -92,22 +74,22 @@ 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) {
|
|
96
|
-
|
|
77
|
+
export function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
78
|
+
const program = gl.createProgram();
|
|
97
79
|
if (!program) {
|
|
98
80
|
throw new Error("Failed to create WebGLProgram.");
|
|
99
81
|
}
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);
|
|
83
|
+
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
102
84
|
gl.attachShader(program, vertexShader);
|
|
103
85
|
gl.attachShader(program, fragmentShader);
|
|
104
86
|
gl.linkProgram(program);
|
|
105
87
|
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
106
|
-
|
|
88
|
+
const errorLog = gl.getProgramInfoLog(program);
|
|
107
89
|
gl.deleteProgram(program);
|
|
108
90
|
gl.deleteShader(vertexShader);
|
|
109
91
|
gl.deleteShader(fragmentShader);
|
|
110
|
-
throw new Error(
|
|
92
|
+
throw new Error(`Error linking program:\n${errorLog}`);
|
|
111
93
|
}
|
|
112
94
|
// Detach and delete shaders after linking
|
|
113
95
|
gl.detachShader(program, vertexShader);
|
|
@@ -115,17 +97,17 @@ function createProgramWrapper(gl, vertexSource, fragmentSource) {
|
|
|
115
97
|
gl.deleteShader(vertexShader);
|
|
116
98
|
gl.deleteShader(fragmentShader);
|
|
117
99
|
// Using an object literal for dynamic properties
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (
|
|
121
|
-
|
|
100
|
+
const wrapper = { program: program };
|
|
101
|
+
const numAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
|
|
102
|
+
for (let i = 0; i < numAttributes; i++) {
|
|
103
|
+
const attribute = gl.getActiveAttrib(program, i);
|
|
122
104
|
if (attribute) {
|
|
123
105
|
wrapper[attribute.name] = gl.getAttribLocation(program, attribute.name);
|
|
124
106
|
}
|
|
125
107
|
}
|
|
126
|
-
|
|
127
|
-
for (
|
|
128
|
-
|
|
108
|
+
const numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
|
|
109
|
+
for (let i = 0; i < numUniforms; i++) {
|
|
110
|
+
const uniform = gl.getActiveUniform(program, i);
|
|
129
111
|
if (uniform) {
|
|
130
112
|
wrapper[uniform.name] = gl.getUniformLocation(program, uniform.name);
|
|
131
113
|
}
|
|
@@ -142,8 +124,8 @@ 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) {
|
|
146
|
-
|
|
127
|
+
export function createTexture(gl, filter, data, width, height) {
|
|
128
|
+
const texture = gl.createTexture();
|
|
147
129
|
if (!texture) {
|
|
148
130
|
throw new Error("Failed to create WebGLTexture.");
|
|
149
131
|
}
|
|
@@ -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,8 +163,8 @@ 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) {
|
|
185
|
-
|
|
166
|
+
export function createBuffer(gl, data) {
|
|
167
|
+
const buffer = gl.createBuffer();
|
|
186
168
|
if (!buffer) {
|
|
187
169
|
throw new Error("Failed to create WebGLBuffer.");
|
|
188
170
|
}
|
|
@@ -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,11 +201,11 @@ 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) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for (
|
|
204
|
+
export function decodeBase64(data) {
|
|
205
|
+
const binary_string = atob(data);
|
|
206
|
+
const len = binary_string.length;
|
|
207
|
+
const bytes = new Uint8Array(len);
|
|
208
|
+
for (let i = 0; i < len; i++) {
|
|
227
209
|
bytes[i] = binary_string.charCodeAt(i);
|
|
228
210
|
}
|
|
229
211
|
return bytes;
|
|
@@ -233,15 +215,15 @@ 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) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
218
|
+
export function createImageFromBase64(encodedData) {
|
|
219
|
+
const bytes = decodeBase64(encodedData);
|
|
220
|
+
const blob = new Blob([bytes.buffer], { type: "image/png" });
|
|
221
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
222
|
+
const imageUrl = urlCreator.createObjectURL(blob);
|
|
223
|
+
const image = new Image();
|
|
242
224
|
image.src = imageUrl;
|
|
243
225
|
// Revoke the object URL after the image has loaded to free up memory
|
|
244
|
-
image.onload =
|
|
226
|
+
image.onload = () => urlCreator.revokeObjectURL(imageUrl);
|
|
245
227
|
return image;
|
|
246
228
|
}
|
|
247
229
|
/**
|
|
@@ -249,24 +231,24 @@ 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) {
|
|
253
|
-
|
|
254
|
-
|
|
234
|
+
export function getColorRamp(colors) {
|
|
235
|
+
const canvas = document.createElement('canvas');
|
|
236
|
+
const ctx = canvas.getContext('2d');
|
|
255
237
|
if (!ctx) {
|
|
256
238
|
throw new Error("Failed to get 2D rendering context for canvas.");
|
|
257
239
|
}
|
|
258
240
|
canvas.width = 256;
|
|
259
241
|
canvas.height = 1;
|
|
260
|
-
|
|
261
|
-
for (
|
|
242
|
+
const gradient = ctx.createLinearGradient(0, 0, 256, 0);
|
|
243
|
+
for (const stop in colors) {
|
|
262
244
|
// Ensure the stop is a valid number, although `addColorStop` can parse strings,
|
|
263
245
|
// explicit conversion is safer for object keys if they come from arbitrary sources.
|
|
264
|
-
|
|
246
|
+
const stopValue = parseFloat(stop);
|
|
265
247
|
if (isNaN(stopValue)) {
|
|
266
|
-
console.warn(
|
|
248
|
+
console.warn(`Invalid stop value for color ramp: ${stop}. Skipping.`);
|
|
267
249
|
continue;
|
|
268
250
|
}
|
|
269
|
-
gradient.addColorStop(stopValue, colors[
|
|
251
|
+
gradient.addColorStop(stopValue, colors[stop]);
|
|
270
252
|
}
|
|
271
253
|
ctx.fillStyle = gradient;
|
|
272
254
|
ctx.fillRect(0, 0, 256, 1);
|
|
@@ -279,17 +261,17 @@ 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) {
|
|
283
|
-
|
|
284
|
-
|
|
264
|
+
export function getColorRampDiscrate(values, thresholds) {
|
|
265
|
+
const canvas = document.createElement('canvas');
|
|
266
|
+
const ctx = canvas.getContext('2d');
|
|
285
267
|
if (!ctx) {
|
|
286
268
|
throw new Error("Failed to get 2D rendering context for canvas.");
|
|
287
269
|
}
|
|
288
270
|
canvas.width = 256;
|
|
289
271
|
canvas.height = 1;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
for (
|
|
272
|
+
const gap = 1.0 / 256; // Represents one pixel width in normalized coordinates
|
|
273
|
+
const gradient = ctx.createLinearGradient(0, 0, 256, 0);
|
|
274
|
+
for (let i = 0; i < thresholds.length - 1; i++) {
|
|
293
275
|
gradient.addColorStop(thresholds[i], values[i]);
|
|
294
276
|
// Create a sharp transition by setting the next stop just before the next threshold
|
|
295
277
|
gradient.addColorStop(Math.max(0, thresholds[i + 1] - gap), values[i]);
|
|
@@ -306,16 +288,16 @@ 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) {
|
|
310
|
-
|
|
311
|
-
|
|
291
|
+
export function getColorRampInterpolated(values, thresholds) {
|
|
292
|
+
const canvas = document.createElement('canvas');
|
|
293
|
+
const ctx = canvas.getContext('2d');
|
|
312
294
|
if (!ctx) {
|
|
313
295
|
throw new Error("Failed to get 2D rendering context for canvas.");
|
|
314
296
|
}
|
|
315
297
|
canvas.width = 256;
|
|
316
298
|
canvas.height = 1;
|
|
317
|
-
|
|
318
|
-
for (
|
|
299
|
+
const gradient = ctx.createLinearGradient(0, 0, 256, 0);
|
|
300
|
+
for (let i = 0; i < thresholds.length; i++) {
|
|
319
301
|
gradient.addColorStop(thresholds[i], values[i]);
|
|
320
302
|
}
|
|
321
303
|
ctx.fillStyle = gradient;
|
|
@@ -330,8 +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) {
|
|
334
|
-
if (mode === void 0) { mode = "interpolated"; }
|
|
315
|
+
export function getColorRampModed(values, thresholds, mode = "interpolated") {
|
|
335
316
|
if (mode === "discrete") {
|
|
336
317
|
return getColorRampDiscrate(values, thresholds);
|
|
337
318
|
}
|
|
@@ -346,8 +327,8 @@ function getColorRampModed(values, thresholds, mode) {
|
|
|
346
327
|
* Returns a default interpolated color ramp commonly used for visualizations.
|
|
347
328
|
* @returns A Uint8Array representing the RGBA pixel data of the default 1x256 color ramp.
|
|
348
329
|
*/
|
|
349
|
-
function defaultColorRamp() {
|
|
350
|
-
|
|
330
|
+
export function defaultColorRamp() {
|
|
331
|
+
const defaultRampColors = {
|
|
351
332
|
"0.0": '#5e4fa2',
|
|
352
333
|
"0.15": '#3288bd',
|
|
353
334
|
"0.20": '#66c2a5',
|
|
@@ -366,25 +347,21 @@ function defaultColorRamp() {
|
|
|
366
347
|
* This is useful for ensuring the correct program is active after a method might change it.
|
|
367
348
|
* @returns A method decorator function.
|
|
368
349
|
*/
|
|
369
|
-
function reloadCurrentGLProgram() {
|
|
350
|
+
export function reloadCurrentGLProgram() {
|
|
370
351
|
return function (target, key, descriptor) {
|
|
371
|
-
|
|
352
|
+
const originalMethod = descriptor.value;
|
|
372
353
|
// Ensure the target has a 'gl' property of type WebGL2RenderingContext
|
|
373
354
|
if (!('gl' in target) || !(target.gl instanceof WebGL2RenderingContext)) {
|
|
374
|
-
console.warn(
|
|
355
|
+
console.warn(`Decorator 'reloadCurrentGLProgram' applied to a method where 'this.gl' is not a WebGL2RenderingContext. This may not function as expected.`);
|
|
375
356
|
// Optionally, throw an error here if strictness is desired
|
|
376
357
|
}
|
|
377
|
-
descriptor.value = function () {
|
|
378
|
-
|
|
379
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
380
|
-
args[_i] = arguments[_i];
|
|
381
|
-
}
|
|
382
|
-
var gl = this.gl;
|
|
358
|
+
descriptor.value = function (...args) {
|
|
359
|
+
const gl = this.gl;
|
|
383
360
|
if (!gl) {
|
|
384
361
|
console.error("reloadCurrentGLProgram decorator: 'gl' context not found on 'this'.");
|
|
385
362
|
return originalMethod.apply(this, args);
|
|
386
363
|
}
|
|
387
|
-
|
|
364
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
388
365
|
originalMethod.apply(this, args);
|
|
389
366
|
gl.useProgram(currentProgram);
|
|
390
367
|
};
|