@pirireis/webglobeplugins 0.9.10 → 0.9.11
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 +8 -8
- package/Math/arc.js +18 -18
- package/Math/bounds/line-bbox.js +80 -78
- package/Math/constants.js +3 -3
- package/Math/juction/arc-plane.js +23 -23
- package/Math/juction/line-sphere.js +11 -11
- package/Math/juction/plane-plane.js +11 -11
- package/Math/line.js +16 -14
- package/Math/methods.js +72 -67
- package/Math/plane.js +18 -16
- package/Math/quaternion.js +49 -45
- package/Math/utils.js +2 -2
- package/Math/vec3.js +45 -42
- package/algorithms/search-binary.js +4 -4
- package/altitude-locator/draw-subset-obj.js +8 -7
- package/altitude-locator/plugin.js +113 -97
- package/arrowfield/adaptor.js +4 -3
- package/arrowfield/index.js +2 -2
- package/arrowfield/plugin.js +65 -62
- package/bearing-line/index.js +1 -1
- package/bearing-line/plugin.js +225 -200
- package/circle-line-chain/chain-list-map.js +88 -82
- package/circle-line-chain/plugin.js +154 -129
- package/circle-line-chain/util.js +1 -1
- package/compass-rose/compass-rose-padding-flat.js +126 -104
- package/compass-rose/compass-text-writer.js +70 -62
- package/compass-rose/index.js +2 -2
- package/compassrose/compassrose.js +50 -46
- package/compassrose/index.js +1 -1
- package/heatwave/index.js +2 -2
- package/heatwave/isobar/objectarraylabels.js +48 -44
- package/heatwave/isobar/plugin.js +123 -104
- package/heatwave/isobar/quadtreecontours.js +92 -76
- package/heatwave/plugins/heatwaveglobeshell.js +87 -69
- package/index.js +11 -11
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +64 -32
- package/partialrings/index.js +1 -1
- package/partialrings/plugin.js +84 -48
- package/partialrings/program.js +47 -136
- package/pin/pin-object-array.js +86 -83
- package/pin/pin-point-totem.js +22 -21
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
- package/point-heat-map/plugin-webworker.js +45 -40
- package/point-heat-map/point-to-heat-map-flow.js +42 -40
- package/point-tracks/key-methods.js +1 -1
- package/point-tracks/plugin.js +142 -127
- package/programs/arrowfield/index.js +1 -1
- package/programs/arrowfield/logic.js +62 -170
- package/programs/arrowfield/object.js +35 -33
- package/programs/data2legend/density-to-legend.js +21 -45
- package/programs/data2legend/point-to-density-texture.js +27 -52
- package/programs/float2legendwithratio/index.js +1 -1
- package/programs/float2legendwithratio/logic.js +42 -88
- package/programs/float2legendwithratio/object.js +46 -43
- package/programs/globe-util/is-globe-moved.js +11 -10
- package/programs/globeshell/index.js +1 -1
- package/programs/globeshell/wiggle/index.js +1 -1
- package/programs/globeshell/wiggle/logic.js +98 -191
- package/programs/globeshell/wiggle/object.js +35 -33
- package/programs/helpers/blender/program.js +19 -36
- package/programs/helpers/fadeaway/index.js +1 -1
- package/programs/helpers/fadeaway/logic.js +13 -35
- package/programs/helpers/fadeaway/object.js +10 -9
- package/programs/helpers/index.js +1 -1
- package/programs/index.js +8 -8
- package/programs/line-on-globe/angled-line.js +32 -91
- package/programs/line-on-globe/circle-accurate-3d.js +32 -82
- package/programs/line-on-globe/circle-accurate-flat.js +50 -108
- package/programs/line-on-globe/circle-accurate.js +33 -103
- package/programs/line-on-globe/circle.js +32 -97
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
- package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
- package/programs/line-on-globe/linestrip.js +39 -100
- package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
- package/programs/line-on-globe/to-the-surface.js +29 -58
- package/programs/line-on-globe/util.js +1 -1
- package/programs/picking/pickable-renderer.js +33 -117
- package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
- package/programs/point-on-globe/element-point-glow.js +35 -103
- package/programs/point-on-globe/square-pixel-point.js +27 -76
- package/programs/programcache.js +13 -13
- package/programs/rings/distancering/circleflatprogram.js +21 -63
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
- package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
- package/programs/rings/distancering/index.js +4 -4
- package/programs/rings/distancering/paddyflatprogram.js +20 -73
- package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
- package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
- package/programs/rings/partial-ring/piece-of-pie.js +35 -137
- package/programs/totems/camerauniformblock.js +51 -64
- package/programs/totems/canvas-webglobe-info.js +40 -48
- package/programs/totems/gpu-selection-uniform-block.js +40 -44
- package/programs/totems/index.js +1 -1
- package/programs/two-d/pixel-padding-for-compass.js +29 -90
- package/programs/util.js +7 -6
- package/programs/vectorfields/index.js +1 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
- package/programs/vectorfields/logics/index.js +3 -3
- package/programs/vectorfields/logics/pixelbased.js +35 -91
- package/programs/vectorfields/logics/ubo.js +25 -31
- package/programs/vectorfields/pingpongbuffermanager.js +34 -30
- package/rangerings/index.js +4 -4
- package/rangerings/plugin.js +252 -202
- package/rangerings/rangeringangletext.js +120 -108
- package/rangerings/ring-account.js +69 -52
- package/shaders/fragment-toy/firework.js +1 -55
- package/shaders/fragment-toy/singularity.js +1 -55
- package/timetracks/adaptors-line-strip.js +37 -26
- package/timetracks/adaptors.js +61 -47
- package/timetracks/index.js +4 -4
- package/timetracks/plugin-line-strip.js +63 -59
- package/timetracks/plugin.js +69 -65
- package/timetracks/program-line-strip.js +103 -296
- package/timetracks/program.js +113 -419
- package/timetracks/programpoint-line-strip.js +44 -97
- package/timetracks/programpoint.js +44 -90
- package/util/account/bufferoffsetmanager.js +95 -72
- package/util/account/index.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
- package/util/account/single-attribute-buffer-management/index.js +3 -3
- package/util/account/single-attribute-buffer-management/object-store.js +30 -28
- package/util/account/util.js +4 -2
- package/util/algorithms/search-binary.js +4 -4
- package/util/check/get.js +5 -5
- package/util/check/typecheck.js +15 -13
- package/util/geometry/index.js +11 -9
- package/util/gl-util/buffer/attribute-loader.js +20 -8
- package/util/gl-util/buffer/index.js +1 -1
- package/util/gl-util/draw-options/methods.js +7 -7
- package/util/gl-util/uniform-block/manager.js +67 -55
- package/util/heatwavedatamanager/datamanager.js +116 -56
- package/util/heatwavedatamanager/index.js +2 -2
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
- package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
- package/util/index.js +6 -6
- package/util/interpolation/timetrack/index.js +1 -1
- package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
- package/util/interpolation/timetrack/web-worker-str.js +1 -179
- package/util/interpolation/timetrack/web-worker.js +4 -4
- package/util/jshelpers/data-filler.js +7 -7
- package/util/jshelpers/timefilters.js +7 -7
- package/util/picking/fence.js +7 -7
- package/util/picking/picker-displayer.js +52 -46
- package/util/programs/draw-texture-on-canvas.js +21 -39
- package/util/programs/shapesonglobe.js +64 -104
- package/util/programs/supersampletotextures.js +39 -45
- package/util/programs/texturetoglobe.js +48 -98
- package/util/shaderfunctions/geometrytransformations.js +27 -322
- package/util/shaderfunctions/nodata.js +1 -7
- package/util/shaderfunctions/noisefunctions.js +9 -39
- package/util/surface-line-data/arcs-to-cuts.js +23 -20
- package/util/webglobe/rasteroverlay.js +37 -35
- package/util/webglobjectbuilders.js +60 -55
- package/util/webglobjectbuilders1.js +49 -48
- package/waveparticles/adaptor.js +7 -6
- package/waveparticles/index.js +2 -2
- package/waveparticles/plugin.js +84 -79
- package/wind/imagetovectorfieldandmagnitude.js +15 -15
- package/wind/index.js +4 -4
- package/wind/plugin.js +251 -453
- package/wind/vectorfieldimage.js +5 -5
- package/write-text/attached-text-writer.js +48 -46
- package/write-text/context-text.js +58 -51
- package/write-text/context-text3.js +74 -69
|
@@ -1,125 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
#define POLE_BY_PI 6366198.2
|
|
11
|
-
#define HALF_PI 1.5707963267948966192313216916398
|
|
12
|
-
|
|
13
|
-
uniform sampler2D rotation; // rotation of arrow
|
|
14
|
-
|
|
15
|
-
out vec4 v_color;
|
|
16
|
-
|
|
17
|
-
layout(std140) uniform CameraBlock {
|
|
18
|
-
mat4 u_view;
|
|
19
|
-
mat4 u_projection;
|
|
20
|
-
vec3 u_translate;
|
|
21
|
-
bool u_is3D;
|
|
22
|
-
vec2 u_mapWH;
|
|
23
|
-
vec2 u_scrWH;
|
|
24
|
-
float u_zlevel;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
layout(std140) uniform ArrowBlock {
|
|
28
|
-
vec4 u_color;
|
|
29
|
-
vec2 u_bbox_offset_rad;
|
|
30
|
-
vec2 u_bbox_size_rad;
|
|
31
|
-
vec2 u_resolution;
|
|
32
|
-
float u_length_ratio;
|
|
33
|
-
float u_width_ratio;
|
|
34
|
-
float u_height;
|
|
35
|
-
float u_no_data_value;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
vec2 f_texCoord(){
|
|
39
|
-
float fID = float(gl_InstanceID);
|
|
40
|
-
float x = mod( fID, u_resolution.x ) / ( u_resolution.x - 1.0);
|
|
41
|
-
float y = 1.0 - floor( fID / u_resolution.x ) / ( u_resolution.y - 1.0);
|
|
42
|
-
return vec2(x, y);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
vec2 f_radCoord(vec2 texCoord){
|
|
46
|
-
float x = (texCoord.x * u_bbox_size_rad.x ) + u_bbox_offset_rad.x;
|
|
47
|
-
float y = (texCoord.y * u_bbox_size_rad.y ) + u_bbox_offset_rad.y;
|
|
48
|
-
return vec2(x, y);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
vec3 f_onSphere(vec2 radCoord){
|
|
52
|
-
float x = sin(radCoord.y) * cos(radCoord.x);
|
|
53
|
-
float y = sin(radCoord.y) * sin(radCoord.x);
|
|
54
|
-
float z = cos(radCoord.y);
|
|
55
|
-
return vec3(x, y, z) * (R + u_height);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
vec2 f_onFlat(vec2 radCoord){
|
|
60
|
-
float mercX = radCoord.x * POLE_BY_PI;
|
|
61
|
-
float mercY = log(tan(HALF_PI - radCoord.y * 0.5)) * POLE_BY_PI;
|
|
62
|
-
float normX = ( mercX - u_translate.x ) / u_mapWH.x;
|
|
63
|
-
float normY = ( mercY - u_translate.y ) / u_mapWH.y;
|
|
64
|
-
return vec2(normX, normY);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
void main() {
|
|
68
|
-
// escape if no data
|
|
69
|
-
vec2 texCoord = f_texCoord();
|
|
70
|
-
vec2 geoCoord = vec2( texCoord.x , 1.0 - texCoord.y );
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
float angle = texture(rotation, texCoord).r;
|
|
74
|
-
|
|
75
|
-
if ( angle == u_no_data_value ) {
|
|
76
|
-
gl_Position = vec4(-2.0, -2.0, 0.0, 1.0);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
vec2 arrowLimb;
|
|
80
|
-
if (0.0 == mod(float(gl_VertexID), 2.0)) {
|
|
81
|
-
arrowLimb = vec2(0.0, 0.0);
|
|
82
|
-
} else if (gl_VertexID == 1) {
|
|
83
|
-
// tail
|
|
84
|
-
arrowLimb = vec2( cos(angle), sin(angle)) * u_length_ratio / (170.0 );
|
|
85
|
-
} else if (gl_VertexID == 3) {
|
|
86
|
-
// right wing
|
|
87
|
-
arrowLimb = vec2( cos(angle + 0.45), sin(angle + 0.45)) * u_width_ratio / (170.0 );
|
|
88
|
-
} else if (gl_VertexID == 5) {
|
|
89
|
-
// left wing
|
|
90
|
-
arrowLimb = vec2( cos(angle - 0.45), sin(angle - 0.45)) * u_width_ratio / (170.0 );
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
vec2 radCoord = f_radCoord(geoCoord + arrowLimb);
|
|
95
|
-
if ( u_is3D ) {
|
|
96
|
-
vec3 spherePos = f_onSphere(radCoord);
|
|
97
|
-
gl_Position = u_projection * u_view * vec4(spherePos - u_translate, 1.0);
|
|
98
|
-
} else {
|
|
99
|
-
vec2 flatPos = f_onFlat(radCoord);
|
|
100
|
-
gl_Position = u_projection * vec4(
|
|
101
|
-
flatPos.x * u_scrWH.x,
|
|
102
|
-
(1.0 - flatPos.y) * u_scrWH.y,
|
|
103
|
-
0.0, 1.0
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
v_color = u_color;
|
|
109
|
-
gl_PointSize = 4.0;
|
|
110
|
-
}
|
|
111
|
-
`;
|
|
112
|
-
const arrowFragmentShader = `#version 300 es
|
|
113
|
-
precision highp float;
|
|
114
|
-
in vec4 v_color;
|
|
115
|
-
out vec4 outColor;
|
|
116
|
-
|
|
117
|
-
void main() {
|
|
118
|
-
outColor = v_color;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
class ArrowFieldLogic {
|
|
122
|
-
constructor() {
|
|
3
|
+
var util_1 = require("../../util");
|
|
4
|
+
var programcache_1 = require("../programcache");
|
|
5
|
+
var totems_1 = require("../totems");
|
|
6
|
+
var arrowVertexShader = "#version 300 es\n#define R 6378.137\n#define PI 3.1415926535897932384626433832795\n#define POLE 20037508.34\n#define POLE_BY_PI 6366198.2\n#define HALF_PI 1.5707963267948966192313216916398\n\nuniform sampler2D rotation; // rotation of arrow\n\nout vec4 v_color;\n\nlayout(std140) uniform CameraBlock {\n mat4 u_view;\n mat4 u_projection;\n vec3 u_translate;\n bool u_is3D;\n vec2 u_mapWH;\n vec2 u_scrWH;\n float u_zlevel;\n};\n\nlayout(std140) uniform ArrowBlock {\n vec4 u_color;\n vec2 u_bbox_offset_rad;\n vec2 u_bbox_size_rad;\n vec2 u_resolution;\n float u_length_ratio;\n float u_width_ratio;\n float u_height;\n float u_no_data_value;\n};\n\nvec2 f_texCoord(){\n float fID = float(gl_InstanceID);\n float x = mod( fID, u_resolution.x ) / ( u_resolution.x - 1.0);\n float y = 1.0 - floor( fID / u_resolution.x ) / ( u_resolution.y - 1.0);\n return vec2(x, y);\n}\n\nvec2 f_radCoord(vec2 texCoord){\n float x = (texCoord.x * u_bbox_size_rad.x ) + u_bbox_offset_rad.x;\n float y = (texCoord.y * u_bbox_size_rad.y ) + u_bbox_offset_rad.y;\n return vec2(x, y);\n}\n\nvec3 f_onSphere(vec2 radCoord){\n float x = sin(radCoord.y) * cos(radCoord.x);\n float y = sin(radCoord.y) * sin(radCoord.x);\n float z = cos(radCoord.y);\n return vec3(x, y, z) * (R + u_height);\n}\n\n\nvec2 f_onFlat(vec2 radCoord){\n float mercX = radCoord.x * POLE_BY_PI;\n float mercY = log(tan(HALF_PI - radCoord.y * 0.5)) * POLE_BY_PI;\n float normX = ( mercX - u_translate.x ) / u_mapWH.x;\n float normY = ( mercY - u_translate.y ) / u_mapWH.y;\n return vec2(normX, normY);\n}\n\nvoid main() {\n // escape if no data\n vec2 texCoord = f_texCoord();\n vec2 geoCoord = vec2( texCoord.x , 1.0 - texCoord.y );\n\n\n float angle = texture(rotation, texCoord).r;\n\n if ( angle == u_no_data_value ) {\n gl_Position = vec4(-2.0, -2.0, 0.0, 1.0);\n return;\n }\n vec2 arrowLimb;\n if (0.0 == mod(float(gl_VertexID), 2.0)) {\n arrowLimb = vec2(0.0, 0.0);\n } else if (gl_VertexID == 1) {\n // tail\n arrowLimb = vec2( cos(angle), sin(angle)) * u_length_ratio / (170.0 );\n } else if (gl_VertexID == 3) {\n // right wing\n arrowLimb = vec2( cos(angle + 0.45), sin(angle + 0.45)) * u_width_ratio / (170.0 );\n } else if (gl_VertexID == 5) {\n // left wing\n arrowLimb = vec2( cos(angle - 0.45), sin(angle - 0.45)) * u_width_ratio / (170.0 );\n }\n\n\n vec2 radCoord = f_radCoord(geoCoord + arrowLimb);\n if ( u_is3D ) {\n vec3 spherePos = f_onSphere(radCoord);\n gl_Position = u_projection * u_view * vec4(spherePos - u_translate, 1.0);\n } else {\n vec2 flatPos = f_onFlat(radCoord);\n gl_Position = u_projection * vec4(\n flatPos.x * u_scrWH.x, \n (1.0 - flatPos.y) * u_scrWH.y,\n 0.0, 1.0\n );\n }\n\n\n v_color = u_color;\n gl_PointSize = 4.0;\n}\n";
|
|
7
|
+
var arrowFragmentShader = "#version 300 es\nprecision highp float;\nin vec4 v_color;\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n}\n";
|
|
8
|
+
var ArrowFieldLogic = /** @class */ (function () {
|
|
9
|
+
function ArrowFieldLogic() {
|
|
123
10
|
this.gl = null;
|
|
124
11
|
this.globe = null;
|
|
125
12
|
this.cameraUniformBlockTotem = null;
|
|
@@ -127,34 +14,34 @@ class ArrowFieldLogic {
|
|
|
127
14
|
this.cameraBlockBindingPoint = 0;
|
|
128
15
|
this.arrayBlockBindingPoint = 1;
|
|
129
16
|
}
|
|
130
|
-
init(globe, gl) {
|
|
17
|
+
ArrowFieldLogic.prototype.init = function (globe, gl) {
|
|
131
18
|
this.gl = gl;
|
|
132
19
|
this.globe = globe;
|
|
133
20
|
this.cameraUniformBlockTotem = programcache_1.globeProgramCache.getProgram(globe, totems_1.CameraUniformBlockTotem);
|
|
134
21
|
this.program = this._createProgram();
|
|
135
|
-
}
|
|
136
|
-
_createProgram() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
22
|
+
};
|
|
23
|
+
ArrowFieldLogic.prototype._createProgram = function () {
|
|
24
|
+
var gl = this.gl;
|
|
25
|
+
var program = (0, util_1.createProgram)(gl, arrowVertexShader, arrowFragmentShader);
|
|
26
|
+
var cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraBlock");
|
|
140
27
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
141
|
-
|
|
28
|
+
var arrowBlockIndex = gl.getUniformBlockIndex(program, "ArrowBlock");
|
|
142
29
|
gl.uniformBlockBinding(program, arrowBlockIndex, this.arrayBlockBindingPoint);
|
|
143
30
|
this.textureLocations = {
|
|
144
31
|
rotationLocation: gl.getUniformLocation(program, "rotation"),
|
|
145
32
|
};
|
|
146
33
|
return program;
|
|
147
|
-
}
|
|
148
|
-
getArrowBlockBufferManager() {
|
|
34
|
+
};
|
|
35
|
+
ArrowFieldLogic.prototype.getArrowBlockBufferManager = function () {
|
|
149
36
|
return new ArrowBlockBufferManager(this.gl, this.arrayBlockBindingPoint);
|
|
150
|
-
}
|
|
37
|
+
};
|
|
151
38
|
// initial load type is static.
|
|
152
39
|
// after that, it is dynamic.
|
|
153
|
-
getTextureManager(width, height) {
|
|
40
|
+
ArrowFieldLogic.prototype.getTextureManager = function (width, height) {
|
|
154
41
|
return new TextureManager(this.gl, width, height, this.textureLocations);
|
|
155
|
-
}
|
|
156
|
-
draw(arrowBlockManager, textureManager, instanceCount) {
|
|
157
|
-
|
|
42
|
+
};
|
|
43
|
+
ArrowFieldLogic.prototype.draw = function (arrowBlockManager, textureManager, instanceCount) {
|
|
44
|
+
var _a = this, gl = _a.gl, cameraBlockBindingPoint = _a.cameraBlockBindingPoint, cameraUniformBlockTotem = _a.cameraUniformBlockTotem;
|
|
158
45
|
gl.useProgram(this.program);
|
|
159
46
|
arrowBlockManager.bind();
|
|
160
47
|
textureManager.activate();
|
|
@@ -163,16 +50,17 @@ class ArrowFieldLogic {
|
|
|
163
50
|
// gl.drawArraysInstanced(gl.POINTS, 0, 4, instanceCount);
|
|
164
51
|
cameraUniformBlockTotem.unbind(cameraBlockBindingPoint);
|
|
165
52
|
arrowBlockManager.unbind();
|
|
166
|
-
}
|
|
167
|
-
free() {
|
|
168
|
-
|
|
53
|
+
};
|
|
54
|
+
ArrowFieldLogic.prototype.free = function () {
|
|
55
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
169
56
|
gl.deleteProgram(program);
|
|
170
57
|
programcache_1.globeProgramCache.releaseProgram(this.globe, totems_1.CameraUniformBlockTotem);
|
|
171
|
-
}
|
|
172
|
-
|
|
58
|
+
};
|
|
59
|
+
return ArrowFieldLogic;
|
|
60
|
+
}());
|
|
173
61
|
exports.default = ArrowFieldLogic;
|
|
174
|
-
|
|
175
|
-
|
|
62
|
+
var ArrowBlockBufferManager = /** @class */ (function () {
|
|
63
|
+
function ArrowBlockBufferManager(gl, bindingPoint) {
|
|
176
64
|
this.gl = gl;
|
|
177
65
|
this.bindingPoint = bindingPoint;
|
|
178
66
|
this.ubo = gl.createBuffer();
|
|
@@ -181,8 +69,9 @@ class ArrowBlockBufferManager {
|
|
|
181
69
|
gl.bufferData(gl.UNIFORM_BUFFER, 56, gl.DYNAMIC_DRAW);
|
|
182
70
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
183
71
|
}
|
|
184
|
-
update
|
|
185
|
-
|
|
72
|
+
ArrowBlockBufferManager.prototype.update = function (_a) {
|
|
73
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.color, color = _c === void 0 ? null : _c, _d = _b.bboxOffsetRad, bboxOffsetRad = _d === void 0 ? null : _d, _e = _b.bboxSizeRad, bboxSizeRad = _e === void 0 ? null : _e, _f = _b.resolution, resolution = _f === void 0 ? null : _f, _g = _b.tailLengthRatio, tailLengthRatio = _g === void 0 ? null : _g, _h = _b.wingLengthRatio, wingLengthRatio = _h === void 0 ? null : _h, _j = _b.height, height = _j === void 0 ? null : _j, _k = _b.opacity, opacity = _k === void 0 ? null : _k, _l = _b.noDataValue, noDataValue = _l === void 0 ? null : _l;
|
|
74
|
+
var _m = this, gl = _m.gl, ubo = _m.ubo;
|
|
186
75
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
187
76
|
if (color !== null)
|
|
188
77
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array(color));
|
|
@@ -203,55 +92,58 @@ class ArrowBlockBufferManager {
|
|
|
203
92
|
if (noDataValue !== null)
|
|
204
93
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 52, new Float32Array([noDataValue]));
|
|
205
94
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
206
|
-
}
|
|
207
|
-
bind() {
|
|
208
|
-
|
|
95
|
+
};
|
|
96
|
+
ArrowBlockBufferManager.prototype.bind = function () {
|
|
97
|
+
var _a = this, gl = _a.gl, ubo = _a.ubo, bindingPoint = _a.bindingPoint;
|
|
209
98
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
|
|
210
|
-
}
|
|
211
|
-
unbind() {
|
|
212
|
-
|
|
99
|
+
};
|
|
100
|
+
ArrowBlockBufferManager.prototype.unbind = function () {
|
|
101
|
+
var _a = this, gl = _a.gl, bindingPoint = _a.bindingPoint;
|
|
213
102
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
|
|
214
|
-
}
|
|
215
|
-
free() {
|
|
216
|
-
|
|
103
|
+
};
|
|
104
|
+
ArrowBlockBufferManager.prototype.free = function () {
|
|
105
|
+
var _a = this, gl = _a.gl, ubo = _a.ubo;
|
|
217
106
|
gl.deleteBuffer(ubo);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
107
|
+
};
|
|
108
|
+
return ArrowBlockBufferManager;
|
|
109
|
+
}());
|
|
110
|
+
var TextureManager = /** @class */ (function () {
|
|
111
|
+
function TextureManager(gl, width, height, _a) {
|
|
112
|
+
var rotationLocation = _a.rotationLocation;
|
|
222
113
|
this.gl = gl;
|
|
223
114
|
this.width = width;
|
|
224
115
|
this.height = height;
|
|
225
116
|
this.rotationLocation = rotationLocation;
|
|
226
117
|
this.rotationTexture = this._createFloatTexture();
|
|
227
118
|
}
|
|
228
|
-
_createFloatTexture() {
|
|
229
|
-
|
|
230
|
-
|
|
119
|
+
TextureManager.prototype._createFloatTexture = function () {
|
|
120
|
+
var _a = this, gl = _a.gl, width = _a.width, height = _a.height;
|
|
121
|
+
var texture = gl.createTexture();
|
|
231
122
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
232
123
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
233
124
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
234
125
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R32F, width, height, 0, gl.RED, gl.FLOAT, null);
|
|
235
126
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
236
127
|
return texture;
|
|
237
|
-
}
|
|
238
|
-
setData(rotation) {
|
|
239
|
-
|
|
128
|
+
};
|
|
129
|
+
TextureManager.prototype.setData = function (rotation) {
|
|
130
|
+
var _a = this, gl = _a.gl, rotationTexture = _a.rotationTexture, width = _a.width, height = _a.height;
|
|
240
131
|
// gl flip y axis
|
|
241
132
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
242
133
|
gl.bindTexture(gl.TEXTURE_2D, rotationTexture);
|
|
243
134
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R32F, width, height, 0, gl.RED, gl.FLOAT, rotation);
|
|
244
135
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
245
136
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
246
|
-
}
|
|
247
|
-
activate() {
|
|
248
|
-
|
|
137
|
+
};
|
|
138
|
+
TextureManager.prototype.activate = function () {
|
|
139
|
+
var _a = this, gl = _a.gl, rotationTexture = _a.rotationTexture;
|
|
249
140
|
gl.activeTexture(gl.TEXTURE0);
|
|
250
141
|
gl.bindTexture(gl.TEXTURE_2D, rotationTexture);
|
|
251
142
|
gl.uniform1i(this.rotationLocation, 0);
|
|
252
|
-
}
|
|
253
|
-
free() {
|
|
254
|
-
|
|
143
|
+
};
|
|
144
|
+
TextureManager.prototype.free = function () {
|
|
145
|
+
var _a = this, gl = _a.gl, rotationTexture = _a.rotationTexture;
|
|
255
146
|
gl.deleteTexture(rotationTexture);
|
|
256
|
-
}
|
|
257
|
-
|
|
147
|
+
};
|
|
148
|
+
return TextureManager;
|
|
149
|
+
}());
|
|
@@ -6,13 +6,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = {}) {
|
|
9
|
+
var logic_1 = __importDefault(require("./logic"));
|
|
10
|
+
var programcache_1 = require("../programcache");
|
|
11
|
+
var util_1 = require("../util");
|
|
12
|
+
var ArrowField = /** @class */ (function () {
|
|
13
|
+
function ArrowField(gl, globe, _a) {
|
|
14
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.minLon, minLon = _c === void 0 ? -180 : _c, _d = _b.maxLon, maxLon = _d === void 0 ? 180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLat, maxLat = _f === void 0 ? 90 : _f, _g = _b.height, height = _g === void 0 ? 0 : _g, _h = _b.opacity, opacity = _h === void 0 ? 1 : _h, _j = _b.color, color = _j === void 0 ? [0.04, 0.2, 0.8] : _j, _k = _b.targetWidth, targetWidth = _k === void 0 ? 100 : _k, _l = _b.targetHeight, targetHeight = _l === void 0 ? 100 : _l, _m = _b.dataWidth, dataWidth = _m === void 0 ? null : _m, _o = _b.dataHeight, dataHeight = _o === void 0 ? null : _o, _p = _b.tailLengthRatio, tailLengthRatio = _p === void 0 ? 1 : _p, _q = _b.wingLengthRatio, wingLengthRatio = _q === void 0 ? 0.5 : _q, _r = _b.noDataValue, noDataValue = _r === void 0 ? null : _r;
|
|
16
15
|
this.gl = gl;
|
|
17
16
|
this.globe = globe;
|
|
18
17
|
this.program = programcache_1.globeProgramCache.getProgram(globe, logic_1.default);
|
|
@@ -20,47 +19,50 @@ class ArrowField {
|
|
|
20
19
|
this.instanceCount = targetWidth * targetHeight;
|
|
21
20
|
this.arrowBlockManager.update({ resolution: [targetWidth, targetHeight] });
|
|
22
21
|
this.textureManager = this.program.getTextureManager(dataWidth, dataHeight);
|
|
23
|
-
this.setBBox({ minLon, maxLon, minLat, maxLat });
|
|
24
|
-
this.update({ height, opacity, color, tailLengthRatio, wingLengthRatio, noDataValue });
|
|
22
|
+
this.setBBox({ minLon: minLon, maxLon: maxLon, minLat: minLat, maxLat: maxLat });
|
|
23
|
+
this.update({ height: height, opacity: opacity, color: color, tailLengthRatio: tailLengthRatio, wingLengthRatio: wingLengthRatio, noDataValue: noDataValue });
|
|
25
24
|
}
|
|
26
|
-
setBBox
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
25
|
+
ArrowField.prototype.setBBox = function (_a) {
|
|
26
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.minLon, minLon = _c === void 0 ? -180 : _c, _d = _b.maxLon, maxLon = _d === void 0 ? 180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLat, maxLat = _f === void 0 ? 90 : _f;
|
|
27
|
+
this.bbox = { minLon: minLon, maxLon: maxLon, minLat: minLat, maxLat: maxLat };
|
|
28
|
+
var _g = (0, util_1.longlatbbox2normalbbox)(this.bbox), bboxSizeRad = _g.bboxSizeRad, bboxOffsetRad = _g.bboxOffsetRad;
|
|
29
|
+
this.arrowBlockManager.update({ bboxSizeRad: bboxSizeRad, bboxOffsetRad: bboxOffsetRad });
|
|
30
30
|
this.globe.DrawRender();
|
|
31
|
-
}
|
|
32
|
-
update
|
|
31
|
+
};
|
|
32
|
+
ArrowField.prototype.update = function (_a) {
|
|
33
|
+
var _b = _a === void 0 ? {} : _a, height = _b.height, opacity = _b.opacity, color = _b.color, resolution = _b.resolution, tailLengthRatio = _b.tailLengthRatio, wingLengthRatio = _b.wingLengthRatio, noDataValue = _b.noDataValue;
|
|
33
34
|
if (resolution) {
|
|
34
35
|
this.instanceCount = resolution[0] * resolution[1];
|
|
35
36
|
}
|
|
36
37
|
this.arrowBlockManager.update({
|
|
37
|
-
color,
|
|
38
|
-
resolution,
|
|
39
|
-
height,
|
|
40
|
-
opacity,
|
|
41
|
-
tailLengthRatio,
|
|
42
|
-
wingLengthRatio,
|
|
43
|
-
noDataValue,
|
|
38
|
+
color: color,
|
|
39
|
+
resolution: resolution,
|
|
40
|
+
height: height,
|
|
41
|
+
opacity: opacity,
|
|
42
|
+
tailLengthRatio: tailLengthRatio,
|
|
43
|
+
wingLengthRatio: wingLengthRatio,
|
|
44
|
+
noDataValue: noDataValue,
|
|
44
45
|
});
|
|
45
46
|
this.globe.DrawRender();
|
|
46
|
-
}
|
|
47
|
-
setTargetResolution(width, height) {
|
|
47
|
+
};
|
|
48
|
+
ArrowField.prototype.setTargetResolution = function (width, height) {
|
|
48
49
|
this.instanceCount = width * height;
|
|
49
50
|
this.arrowBlockManager.update({ resolution: [width, height] });
|
|
50
51
|
this.globe.DrawRender();
|
|
51
|
-
}
|
|
52
|
-
draw() {
|
|
53
|
-
|
|
52
|
+
};
|
|
53
|
+
ArrowField.prototype.draw = function () {
|
|
54
|
+
var _a = this, program = _a.program, arrowBlockManager = _a.arrowBlockManager, textureManager = _a.textureManager, instanceCount = _a.instanceCount;
|
|
54
55
|
program.draw(arrowBlockManager, textureManager, instanceCount);
|
|
55
|
-
}
|
|
56
|
-
setData(rotation) {
|
|
56
|
+
};
|
|
57
|
+
ArrowField.prototype.setData = function (rotation) {
|
|
57
58
|
this.textureManager.setData(rotation);
|
|
58
59
|
this.globe.DrawRender();
|
|
59
|
-
}
|
|
60
|
-
free() {
|
|
60
|
+
};
|
|
61
|
+
ArrowField.prototype.free = function () {
|
|
61
62
|
this.arrowBlockManager.free();
|
|
62
63
|
this.textureManager.free();
|
|
63
64
|
programcache_1.globeProgramCache.releaseProgram(this.gl, logic_1.default);
|
|
64
|
-
}
|
|
65
|
-
|
|
65
|
+
};
|
|
66
|
+
return ArrowField;
|
|
67
|
+
}());
|
|
66
68
|
exports.default = ArrowField;
|
|
@@ -1,41 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.densityToLegendProgramCache = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
in vec2 a_position;
|
|
11
|
-
|
|
12
|
-
out vec2 v_texcoord;
|
|
13
|
-
|
|
14
|
-
void main() {
|
|
15
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
16
|
-
v_texcoord = a_position * 0.5 + 0.5;
|
|
17
|
-
}`;
|
|
18
|
-
const fs = `#version 300 es
|
|
19
|
-
precision highp float;
|
|
20
|
-
|
|
21
|
-
uniform sampler2D u_legend_texture;
|
|
22
|
-
uniform sampler2D u_density_texture;
|
|
23
|
-
|
|
24
|
-
uniform float u_opacity;
|
|
25
|
-
in vec2 v_texcoord;
|
|
26
|
-
out vec4 fragColor;
|
|
27
|
-
|
|
28
|
-
void main() {
|
|
29
|
-
float density = texture(u_density_texture, v_texcoord).r;
|
|
30
|
-
fragColor = texture(u_legend_texture, vec2(density, 0.5));
|
|
31
|
-
fragColor.a *= u_opacity * sqrt(density);
|
|
32
|
-
}`;
|
|
33
|
-
class DensityToLegendProgram {
|
|
34
|
-
constructor(globe) {
|
|
4
|
+
var util_1 = require("../../util/");
|
|
5
|
+
var programcache_1 = require("../programcache");
|
|
6
|
+
var vs = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_density_texture;\nin vec2 a_position;\n\nout vec2 v_texcoord;\n\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texcoord = a_position * 0.5 + 0.5;\n}";
|
|
7
|
+
var fs = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_legend_texture;\nuniform sampler2D u_density_texture;\n\nuniform float u_opacity;\nin vec2 v_texcoord;\nout vec4 fragColor;\n\nvoid main() {\n float density = texture(u_density_texture, v_texcoord).r;\n fragColor = texture(u_legend_texture, vec2(density, 0.5));\n fragColor.a *= u_opacity * sqrt(density);\n}";
|
|
8
|
+
var DensityToLegendProgram = /** @class */ (function () {
|
|
9
|
+
function DensityToLegendProgram(globe) {
|
|
35
10
|
this.globe = globe;
|
|
36
11
|
this.gl = globe.gl;
|
|
37
12
|
this.program = (0, util_1.createProgram)(globe.gl, vs, fs);
|
|
38
|
-
|
|
13
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
39
14
|
this.uniforms = {
|
|
40
15
|
densityTexture: gl.getUniformLocation(program, "u_density_texture"),
|
|
41
16
|
legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
|
|
@@ -46,9 +21,9 @@ class DensityToLegendProgram {
|
|
|
46
21
|
}
|
|
47
22
|
{
|
|
48
23
|
this.vao = gl.createVertexArray();
|
|
49
|
-
|
|
24
|
+
var a_positionLocation = gl.getAttribLocation(program, "a_position");
|
|
50
25
|
gl.bindVertexArray(this.vao);
|
|
51
|
-
|
|
26
|
+
var buffer = gl.createBuffer();
|
|
52
27
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
53
28
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
54
29
|
-1, -1,
|
|
@@ -64,14 +39,14 @@ class DensityToLegendProgram {
|
|
|
64
39
|
}
|
|
65
40
|
{
|
|
66
41
|
this._lastOpacity = 1;
|
|
67
|
-
|
|
42
|
+
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
68
43
|
gl.useProgram(program);
|
|
69
44
|
gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
70
45
|
gl.useProgram(currentProgram);
|
|
71
46
|
}
|
|
72
47
|
}
|
|
73
|
-
draw(densityTexture, legendTexture, opacity) {
|
|
74
|
-
|
|
48
|
+
DensityToLegendProgram.prototype.draw = function (densityTexture, legendTexture, opacity) {
|
|
49
|
+
var _a = this, gl = _a.gl, program = _a.program, uniforms = _a.uniforms;
|
|
75
50
|
gl.useProgram(program);
|
|
76
51
|
gl.bindVertexArray(this.vao);
|
|
77
52
|
gl.activeTexture(gl.TEXTURE1);
|
|
@@ -86,16 +61,17 @@ class DensityToLegendProgram {
|
|
|
86
61
|
}
|
|
87
62
|
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
88
63
|
gl.bindVertexArray(null);
|
|
89
|
-
}
|
|
90
|
-
free() {
|
|
91
|
-
|
|
64
|
+
};
|
|
65
|
+
DensityToLegendProgram.prototype.free = function () {
|
|
66
|
+
var gl = this.gl;
|
|
92
67
|
gl.deleteVertexArray(this.vao);
|
|
93
68
|
gl.deleteBuffer(this._buffer);
|
|
94
69
|
gl.deleteProgram(this.program);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
};
|
|
71
|
+
return DensityToLegendProgram;
|
|
72
|
+
}());
|
|
73
|
+
var densityToLegendProgramCache = {
|
|
74
|
+
get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, DensityToLegendProgram); },
|
|
75
|
+
release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, DensityToLegendProgram); }
|
|
100
76
|
};
|
|
101
77
|
exports.densityToLegendProgramCache = densityToLegendProgramCache;
|
|
@@ -1,46 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pointToDensityTextureCache = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
${geometrytransformations_1.mercatorXYToGLPosition}
|
|
13
|
-
${geometrytransformations_1.cartesian3DToGLPosition}
|
|
14
|
-
|
|
15
|
-
in vec3 position;
|
|
16
|
-
uniform float pointSize;
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
if (is3D) {
|
|
20
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
21
|
-
} else {
|
|
22
|
-
gl_Position = mercatorXYToGLPosition(position.xy);
|
|
23
|
-
}
|
|
24
|
-
gl_PointSize = pointSize;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
const fs = `#version 300 es
|
|
28
|
-
precision highp float;
|
|
29
|
-
out vec4 fragColor;
|
|
30
|
-
|
|
31
|
-
void main() {
|
|
32
|
-
float r = length(gl_PointCoord - 0.5) * 2.0;
|
|
33
|
-
if (r > 1.0) discard;
|
|
34
|
-
// float density = smoothstep(0.1, 1.0, 1.0 - r);
|
|
35
|
-
fragColor = vec4((15.0/16.0)*sqrt(1.0-sqrt(r)));
|
|
36
|
-
}`;
|
|
37
|
-
class PointHeatmapProgram {
|
|
38
|
-
constructor(globe) {
|
|
4
|
+
var util_1 = require("../../util/");
|
|
5
|
+
var programcache_1 = require("../programcache");
|
|
6
|
+
var camerauniformblock_1 = require("../totems/camerauniformblock");
|
|
7
|
+
var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
8
|
+
var vs = "#version 300 es\nprecision highp float;\n\n".concat(camerauniformblock_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n\nin vec3 position;\nuniform float pointSize;\n\nvoid main() {\n if (is3D) {\n gl_Position = cartesian3DToGLPosition(position);\n } else {\n gl_Position = mercatorXYToGLPosition(position.xy);\n }\n gl_PointSize = pointSize;\n}\n");
|
|
9
|
+
var fs = "#version 300 es\nprecision highp float;\nout vec4 fragColor;\n\nvoid main() {\n float r = length(gl_PointCoord - 0.5) * 2.0;\n if (r > 1.0) discard;\n // float density = smoothstep(0.1, 1.0, 1.0 - r);\n fragColor = vec4((15.0/16.0)*sqrt(1.0-sqrt(r)));\n}";
|
|
10
|
+
var PointHeatmapProgram = /** @class */ (function () {
|
|
11
|
+
function PointHeatmapProgram(globe) {
|
|
39
12
|
this.globe = globe;
|
|
40
13
|
this.gl = globe.gl;
|
|
41
14
|
this._isFreed = false;
|
|
42
15
|
this.program = (0, util_1.createProgram)(globe.gl, vs, fs);
|
|
43
|
-
|
|
16
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
44
17
|
this.uniforms = {
|
|
45
18
|
pointSize: gl.getUniformLocation(this.program, "pointSize"),
|
|
46
19
|
};
|
|
@@ -50,29 +23,30 @@ class PointHeatmapProgram {
|
|
|
50
23
|
{ // arrange camera uniform block
|
|
51
24
|
this.cameraBlockBingingPoint = 0;
|
|
52
25
|
this.cameraBlockTotem = camerauniformblock_1.CameraUniformBlockTotemCache.get(globe);
|
|
53
|
-
|
|
26
|
+
var cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
54
27
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
|
|
55
28
|
}
|
|
56
29
|
{ // last values
|
|
57
30
|
this._lastPointSize = 0;
|
|
58
|
-
|
|
31
|
+
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
59
32
|
gl.useProgram(program);
|
|
60
33
|
gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
|
|
61
34
|
gl.useProgram(currentProgram);
|
|
62
35
|
}
|
|
63
36
|
}
|
|
64
|
-
createVAO(positionBuffer, vectorSize) {
|
|
65
|
-
|
|
66
|
-
|
|
37
|
+
PointHeatmapProgram.prototype.createVAO = function (positionBuffer, vectorSize) {
|
|
38
|
+
var gl = this.gl;
|
|
39
|
+
var vao = gl.createVertexArray();
|
|
67
40
|
gl.bindVertexArray(vao);
|
|
68
41
|
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
69
42
|
gl.enableVertexAttribArray(0);
|
|
70
43
|
gl.vertexAttribPointer(0, vectorSize, gl.FLOAT, false, 0, 0);
|
|
71
44
|
gl.bindVertexArray(null);
|
|
72
45
|
return vao;
|
|
73
|
-
}
|
|
74
|
-
draw(vao, length, pointSize
|
|
75
|
-
|
|
46
|
+
};
|
|
47
|
+
PointHeatmapProgram.prototype.draw = function (vao, length, pointSize) {
|
|
48
|
+
if (pointSize === void 0) { pointSize = 5.0; }
|
|
49
|
+
var gl = this.gl;
|
|
76
50
|
gl.useProgram(this.program);
|
|
77
51
|
if (pointSize !== this._lastPointSize) {
|
|
78
52
|
gl.uniform1f(this.uniforms.pointSize, pointSize);
|
|
@@ -83,18 +57,19 @@ class PointHeatmapProgram {
|
|
|
83
57
|
gl.drawArrays(gl.POINTS, 0, length);
|
|
84
58
|
this.cameraBlockTotem.unbind(this.cameraBlockBingingPoint);
|
|
85
59
|
gl.bindVertexArray(null);
|
|
86
|
-
}
|
|
87
|
-
free() {
|
|
60
|
+
};
|
|
61
|
+
PointHeatmapProgram.prototype.free = function () {
|
|
88
62
|
if (this._isFreed)
|
|
89
63
|
return;
|
|
90
|
-
|
|
64
|
+
var _a = this, gl = _a.gl, globe = _a.globe;
|
|
91
65
|
camerauniformblock_1.CameraUniformBlockTotemCache.release(globe);
|
|
92
66
|
gl.deleteProgram(this.program);
|
|
93
67
|
this._isFreed = true;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
};
|
|
69
|
+
return PointHeatmapProgram;
|
|
70
|
+
}());
|
|
71
|
+
var pointToDensityTextureCache = {
|
|
72
|
+
get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, PointHeatmapProgram); },
|
|
73
|
+
release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, PointHeatmapProgram); }
|
|
99
74
|
};
|
|
100
75
|
exports.pointToDensityTextureCache = pointToDensityTextureCache;
|
|
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Float2LegendWithRatio = void 0;
|
|
7
|
-
|
|
7
|
+
var object_1 = __importDefault(require("./object"));
|
|
8
8
|
exports.Float2LegendWithRatio = object_1.default;
|