@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
|
@@ -8,72 +8,27 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ElementGlobeSufaceGlowCache = void 0;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
var totems_1 = require("../totems");
|
|
12
|
+
var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
13
|
+
var util_1 = require("../../util");
|
|
14
|
+
var programcache_1 = require("../programcache");
|
|
15
|
+
var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
|
|
16
|
+
var methods_1 = require("../../util/gl-util/draw-options/methods");
|
|
17
|
+
var manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
18
|
+
var uboBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
19
19
|
{ name: "u_color", type: "vec4" },
|
|
20
20
|
{ name: "u_radius", type: "float" }
|
|
21
21
|
], 1);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
${geometrytransformations_1.circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
27
|
-
|
|
28
|
-
uniform float edge_count;
|
|
29
|
-
|
|
30
|
-
in vec3 pos3D;
|
|
31
|
-
in float radius;
|
|
32
|
-
in vec4 color;
|
|
33
|
-
|
|
34
|
-
${uboBlockManager.glslCode()}
|
|
35
|
-
|
|
36
|
-
out vec4 vColor;
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
|
|
40
|
-
float radius_ = ( radius == -1.0 ) ? u_radius : radius;
|
|
41
|
-
vec4 color = ( color.r == -1.0 ) ? u_color : color;
|
|
42
|
-
|
|
43
|
-
if ( gl_VertexID == 0 ) {
|
|
44
|
-
gl_Position = cartesian3DToGLPosition(pos3D);
|
|
45
|
-
vColor = vColor;
|
|
46
|
-
} else {
|
|
47
|
-
float angle = PI * 2.0 * float( gl_VertexID - 1 ) / edge_count;
|
|
48
|
-
vec3 position = circleLimpFromLongLatRadCenterCartesian3D_accurate(pos3D, radius, angle);
|
|
49
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
50
|
-
float distance = distance(position, pos3D);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
vColor = vec4(color.rgb, color.a * (1.0 - distance / radius));
|
|
55
|
-
}
|
|
56
|
-
}`;
|
|
57
|
-
const fs = `#version 300 es
|
|
58
|
-
precision highp float;
|
|
59
|
-
|
|
60
|
-
uniform float opacity;
|
|
61
|
-
in vec4 vColor;
|
|
62
|
-
|
|
63
|
-
out vec4 fragColor;
|
|
64
|
-
|
|
65
|
-
void main() {
|
|
66
|
-
fragColor = vColor;
|
|
67
|
-
fragColor.a *= opacity;
|
|
68
|
-
}`;
|
|
69
|
-
class Logic {
|
|
70
|
-
constructor(globe) {
|
|
22
|
+
var vs = "#version 300 es\n".concat(geometrytransformations_1.PI, "\n").concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n").concat(geometrytransformations_1.circleLimpFromLongLatRadCenterCartesian3D_accurate, "\n\nuniform float edge_count;\n\nin vec3 pos3D;\nin float radius;\nin vec4 color;\n\n").concat(uboBlockManager.glslCode(), "\n\nout vec4 vColor;\n\nvoid main() {\n\n float radius_ = ( radius == -1.0 ) ? u_radius : radius;\n vec4 color = ( color.r == -1.0 ) ? u_color : color;\n\n if ( gl_VertexID == 0 ) {\n gl_Position = cartesian3DToGLPosition(pos3D);\n vColor = vColor;\n } else {\n float angle = PI * 2.0 * float( gl_VertexID - 1 ) / edge_count;\n vec3 position = circleLimpFromLongLatRadCenterCartesian3D_accurate(pos3D, radius, angle);\n gl_Position = cartesian3DToGLPosition(position);\n float distance = distance(position, pos3D);\n\n \n\n vColor = vec4(color.rgb, color.a * (1.0 - distance / radius));\n }\n}");
|
|
23
|
+
var fs = "#version 300 es\nprecision highp float;\n\nuniform float opacity;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main() {\n fragColor = vColor;\n fragColor.a *= opacity;\n}";
|
|
24
|
+
var Logic = /** @class */ (function () {
|
|
25
|
+
function Logic(globe) {
|
|
71
26
|
this.globe = globe;
|
|
72
27
|
this.gl = globe.gl;
|
|
73
28
|
this._vaoCache = [];
|
|
74
29
|
this.program = (0, util_1.createProgram)(this.gl, vs, fs);
|
|
75
|
-
|
|
76
|
-
|
|
30
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
31
|
+
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
77
32
|
gl.useProgram(program);
|
|
78
33
|
// set uniform locations
|
|
79
34
|
this._uniforms = {
|
|
@@ -93,26 +48,28 @@ class Logic {
|
|
|
93
48
|
// camera uniform block
|
|
94
49
|
this.cameraUniformBlockTotem = totems_1.CameraUniformBlockTotemCache.get(globe);
|
|
95
50
|
this.cameraBlockBindingPoint = 0;
|
|
96
|
-
|
|
51
|
+
var cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
97
52
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
98
53
|
uboBlockManager.assignBindingPoint(this.gl, this.program);
|
|
99
54
|
this._defaultUBO = uboBlockManager.createUBO(this.gl);
|
|
100
55
|
}
|
|
101
|
-
createVAO(pos3DObj, radiusObj, colorObj) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
56
|
+
Logic.prototype.createVAO = function (pos3DObj, radiusObj, colorObj) {
|
|
57
|
+
var gl = this.gl;
|
|
58
|
+
var vao = gl.createVertexArray();
|
|
59
|
+
var divisor = 1;
|
|
105
60
|
gl.bindVertexArray(vao);
|
|
106
61
|
// TODO constants to escape values
|
|
107
|
-
(0, attribute_loader_1.attributeLoader)(gl, pos3DObj, 0, 3, { divisor });
|
|
108
|
-
(0, attribute_loader_1.attributeLoader)(gl, radiusObj, 1, 1, { divisor, escapeValues: [-1] });
|
|
109
|
-
(0, attribute_loader_1.attributeLoader)(gl, colorObj, 2, 4, { divisor, escapeValues: [-1, -1, -1, -1] });
|
|
62
|
+
(0, attribute_loader_1.attributeLoader)(gl, pos3DObj, 0, 3, { divisor: divisor });
|
|
63
|
+
(0, attribute_loader_1.attributeLoader)(gl, radiusObj, 1, 1, { divisor: divisor, escapeValues: [-1] });
|
|
64
|
+
(0, attribute_loader_1.attributeLoader)(gl, colorObj, 2, 4, { divisor: divisor, escapeValues: [-1, -1, -1, -1] });
|
|
110
65
|
gl.bindVertexArray(null);
|
|
111
66
|
this._vaoCache.push(vao);
|
|
112
67
|
return vao;
|
|
113
|
-
}
|
|
114
|
-
draw(vao, drawOptions, opacity
|
|
115
|
-
|
|
68
|
+
};
|
|
69
|
+
Logic.prototype.draw = function (vao, drawOptions, opacity, ubo) {
|
|
70
|
+
if (opacity === void 0) { opacity = 1.0; }
|
|
71
|
+
if (ubo === void 0) { ubo = null; }
|
|
72
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
116
73
|
gl.useProgram(program);
|
|
117
74
|
gl.bindVertexArray(vao);
|
|
118
75
|
if (opacity !== this._uniforms.opacity) {
|
|
@@ -124,19 +81,22 @@ class Logic {
|
|
|
124
81
|
(0, methods_1.drawInstanced)(gl, gl.TRIANGLE_FAN, drawOptions);
|
|
125
82
|
ubo.unbind();
|
|
126
83
|
gl.bindVertexArray(null);
|
|
127
|
-
}
|
|
128
|
-
free() {
|
|
84
|
+
};
|
|
85
|
+
Logic.prototype.free = function () {
|
|
129
86
|
if (this._isFreed)
|
|
130
87
|
return;
|
|
131
88
|
totems_1.CameraUniformBlockTotemCache.release(this.globe);
|
|
132
89
|
this.gl.deleteProgram(this.program);
|
|
133
|
-
for (
|
|
90
|
+
for (var _i = 0, _a = this._vaoCache; _i < _a.length; _i++) {
|
|
91
|
+
var vao = _a[_i];
|
|
134
92
|
this.gl.deleteVertexArray(vao);
|
|
93
|
+
}
|
|
135
94
|
this._isFreed = true;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
95
|
+
};
|
|
96
|
+
return Logic;
|
|
97
|
+
}());
|
|
98
|
+
var ElementGlobeSufaceGlowCache = Object.freeze({
|
|
99
|
+
get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
100
|
+
release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe); }
|
|
141
101
|
});
|
|
142
102
|
exports.ElementGlobeSufaceGlowCache = ElementGlobeSufaceGlowCache;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ElementPointGlowProgramCache = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
var util_1 = require("../../util");
|
|
5
|
+
var totems_1 = require("../totems");
|
|
6
|
+
var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
7
|
+
var programcache_1 = require("../programcache");
|
|
8
|
+
var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
|
|
9
|
+
var methods_1 = require("../../util/gl-util/draw-options/methods");
|
|
10
|
+
var manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
11
|
+
var singularity_1 = require("../../shaders/fragment-toy/singularity");
|
|
12
|
+
var firework_1 = require("../../shaders/fragment-toy/firework");
|
|
13
|
+
var cameraBlockBindingPoint = 0;
|
|
14
|
+
var flexibleBlockBindingPoint = 1;
|
|
15
|
+
var uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
16
16
|
{ name: "u_rgba", type: "vec4", value: new Float32Array([1, 1, 1, 1]) },
|
|
17
17
|
{ name: "u_size_multiplier", type: "float", value: new Float32Array([1.0]) },
|
|
18
18
|
{ name: "u_opacity", type: "float", value: new Float32Array([1.0]) },
|
|
@@ -20,84 +20,14 @@ const uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
|
20
20
|
{ name: "u_minimumSize", type: "float", value: new Float32Array([25.0]) },
|
|
21
21
|
{ name: "u_phase", type: "float", value: new Float32Array([1.0]) },
|
|
22
22
|
], flexibleBlockBindingPoint);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
${geometrytransformations_1.mercatorXYToGLPosition}
|
|
28
|
-
${geometrytransformations_1.cartesian3DToGLPosition}
|
|
29
|
-
|
|
30
|
-
${uniformBlockManager.glslCode()}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
in vec3 pos3D;
|
|
34
|
-
in vec2 pos2D;
|
|
35
|
-
in vec4 color;
|
|
36
|
-
in float size;
|
|
37
|
-
|
|
38
|
-
out vec4 vColor;
|
|
39
|
-
flat out float v_size;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
void main() {
|
|
44
|
-
|
|
45
|
-
if(is3D){
|
|
46
|
-
gl_Position = cartesian3DToGLPosition(pos3D);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
gl_Position = mercatorXYToGLPosition(pos2D);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
gl_PointSize = max(
|
|
53
|
-
((size == -1.0) ? u_size : size ) * u_size_multiplier,
|
|
54
|
-
u_minimumSize);
|
|
55
|
-
v_size = gl_PointSize;
|
|
56
|
-
vColor = (color.r == -1.0) ? u_rgba : color;
|
|
57
|
-
vColor.a *= u_opacity;
|
|
58
|
-
|
|
59
|
-
}`;
|
|
60
|
-
const fs = `#version 300 es
|
|
61
|
-
precision highp float;
|
|
62
|
-
|
|
63
|
-
${uniformBlockManager.glslCode()}
|
|
64
|
-
|
|
65
|
-
in vec4 vColor;
|
|
66
|
-
out vec4 fragColor;
|
|
67
|
-
|
|
68
|
-
flat in float v_size;
|
|
69
|
-
|
|
70
|
-
${firework_1.firework}
|
|
71
|
-
${singularity_1.singularity}
|
|
72
|
-
|
|
73
|
-
void main() {
|
|
74
|
-
fragColor = vColor;
|
|
75
|
-
|
|
76
|
-
float dist = distance(gl_PointCoord, vec2(0.5, 0.5)) * 2.0;
|
|
77
|
-
if ( dist > 1.0) discard;
|
|
78
|
-
|
|
79
|
-
// center glow
|
|
80
|
-
float center_alpha = smoothstep(0.5, 0.0, dist) * 0.3;
|
|
81
|
-
// center_alpha = smoothstep(0.0, 1.0, center_alpha);
|
|
82
|
-
|
|
83
|
-
// circle pattern
|
|
84
|
-
float threshold = fract(( - dist + u_phase - 0.5));
|
|
85
|
-
float circle_alpha = sin( threshold * 1.57 );
|
|
86
|
-
circle_alpha = smoothstep((v_size / (v_size + .5)), 1.0, circle_alpha);
|
|
87
|
-
|
|
88
|
-
float outer_circle_alpha = sin(dist * 1.57 );
|
|
89
|
-
outer_circle_alpha = smoothstep((v_size / (v_size + .5)), 1.0, outer_circle_alpha);
|
|
90
|
-
|
|
91
|
-
// fragColor = singularity(gl_PointCoord, u_phase);
|
|
92
|
-
|
|
93
|
-
fragColor.a *= smoothstep(0.0, 1.1, ( 0.4 * u_opacity + center_alpha + circle_alpha+ outer_circle_alpha));
|
|
94
|
-
}`;
|
|
95
|
-
class Logic {
|
|
96
|
-
constructor(globe) {
|
|
23
|
+
var vs = "#version 300 es\nprecision highp float;\n\n".concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n\n").concat(uniformBlockManager.glslCode(), "\n\n\nin vec3 pos3D;\nin vec2 pos2D;\nin vec4 color;\nin float size;\n\nout vec4 vColor;\nflat out float v_size;\n\n\n\nvoid main() {\n\n if(is3D){\n gl_Position = cartesian3DToGLPosition(pos3D);\n }\n else {\n gl_Position = mercatorXYToGLPosition(pos2D);\n }\n\n gl_PointSize = max(\n ((size == -1.0) ? u_size : size ) * u_size_multiplier,\n u_minimumSize);\n v_size = gl_PointSize;\n vColor = (color.r == -1.0) ? u_rgba : color;\n vColor.a *= u_opacity;\n\n}");
|
|
24
|
+
var fs = "#version 300 es\nprecision highp float;\n\n".concat(uniformBlockManager.glslCode(), "\n\nin vec4 vColor;\nout vec4 fragColor;\n\nflat in float v_size;\n\n").concat(firework_1.firework, "\n").concat(singularity_1.singularity, " \n\nvoid main() {\n fragColor = vColor;\n\n float dist = distance(gl_PointCoord, vec2(0.5, 0.5)) * 2.0;\n if ( dist > 1.0) discard;\n\n // center glow\n float center_alpha = smoothstep(0.5, 0.0, dist) * 0.3;\n // center_alpha = smoothstep(0.0, 1.0, center_alpha);\n\n // circle pattern\n float threshold = fract(( - dist + u_phase - 0.5));\n float circle_alpha = sin( threshold * 1.57 );\n circle_alpha = smoothstep((v_size / (v_size + .5)), 1.0, circle_alpha);\n\n float outer_circle_alpha = sin(dist * 1.57 );\n outer_circle_alpha = smoothstep((v_size / (v_size + .5)), 1.0, outer_circle_alpha);\n\n // fragColor = singularity(gl_PointCoord, u_phase);\n\n fragColor.a *= smoothstep(0.0, 1.1, ( 0.4 * u_opacity + center_alpha + circle_alpha+ outer_circle_alpha)); \n}");
|
|
25
|
+
var Logic = /** @class */ (function () {
|
|
26
|
+
function Logic(globe) {
|
|
97
27
|
this.globe = globe;
|
|
98
28
|
this.gl = globe.gl;
|
|
99
29
|
this.program = (0, util_1.createProgram)(this.gl, vs, fs);
|
|
100
|
-
|
|
30
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
101
31
|
gl.bindAttribLocation(program, 0, "pos3D");
|
|
102
32
|
gl.bindAttribLocation(program, 1, "pos2D");
|
|
103
33
|
gl.bindAttribLocation(program, 2, "color");
|
|
@@ -108,9 +38,9 @@ class Logic {
|
|
|
108
38
|
uniformBlockManager.assignBindingPoint(this.gl, this.program);
|
|
109
39
|
this._defaultUBO = uniformBlockManager.createUBO(this.gl);
|
|
110
40
|
}
|
|
111
|
-
createVAO(pos3DBuffer, pos2DBuffer, colorBuffer, sizeBuffer) {
|
|
112
|
-
|
|
113
|
-
|
|
41
|
+
Logic.prototype.createVAO = function (pos3DBuffer, pos2DBuffer, colorBuffer, sizeBuffer) {
|
|
42
|
+
var gl = this.gl;
|
|
43
|
+
var vao = gl.createVertexArray();
|
|
114
44
|
gl.bindVertexArray(vao);
|
|
115
45
|
(0, attribute_loader_1.attributeLoader)(gl, pos3DBuffer, 0, 3);
|
|
116
46
|
(0, attribute_loader_1.attributeLoader)(gl, pos2DBuffer, 1, 2);
|
|
@@ -119,13 +49,14 @@ class Logic {
|
|
|
119
49
|
gl.bindVertexArray(null);
|
|
120
50
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
121
51
|
return vao;
|
|
122
|
-
}
|
|
123
|
-
createUBO() {
|
|
124
|
-
|
|
52
|
+
};
|
|
53
|
+
Logic.prototype.createUBO = function () {
|
|
54
|
+
var ubo = uniformBlockManager.createUBO(this.gl);
|
|
125
55
|
return ubo;
|
|
126
|
-
}
|
|
127
|
-
draw(vao, drawOptions, ubo
|
|
128
|
-
|
|
56
|
+
};
|
|
57
|
+
Logic.prototype.draw = function (vao, drawOptions, ubo) {
|
|
58
|
+
if (ubo === void 0) { ubo = null; }
|
|
59
|
+
var _a = this, gl = _a.gl, program = _a.program, cameraBlockTotem = _a.cameraBlockTotem;
|
|
129
60
|
gl.useProgram(program);
|
|
130
61
|
gl.bindVertexArray(vao);
|
|
131
62
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -136,18 +67,19 @@ class Logic {
|
|
|
136
67
|
gl.bindVertexArray(null);
|
|
137
68
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
138
69
|
this.globe.DrawRender();
|
|
139
|
-
}
|
|
70
|
+
};
|
|
140
71
|
// for singleton cache interation
|
|
141
|
-
free() {
|
|
72
|
+
Logic.prototype.free = function () {
|
|
142
73
|
if (this._isFreed)
|
|
143
74
|
return;
|
|
144
75
|
totems_1.CameraUniformBlockTotemCache.release(this.globe);
|
|
145
76
|
this.gl.deleteProgram(this.program);
|
|
146
77
|
this._isFreed = true;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
78
|
+
};
|
|
79
|
+
return Logic;
|
|
80
|
+
}());
|
|
81
|
+
var ElementPointGlowProgramCache = Object.freeze({
|
|
82
|
+
get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
83
|
+
release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
152
84
|
});
|
|
153
85
|
exports.ElementPointGlowProgramCache = ElementPointGlowProgramCache;
|
|
@@ -1,69 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PointOnGlobeProgramCache = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
precision highp float;
|
|
13
|
-
precision highp int;
|
|
14
|
-
|
|
15
|
-
uniform int hovered_vertexID; // can be removed
|
|
16
|
-
|
|
17
|
-
in vec3 pos3D;
|
|
18
|
-
in vec2 pos2D;
|
|
19
|
-
in vec4 rgba;
|
|
20
|
-
|
|
21
|
-
uniform float pointSize;
|
|
22
|
-
uniform float hoveredPointSize;
|
|
23
|
-
|
|
24
|
-
flat out highp int vVertexID;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
out vec4 v_rgba;
|
|
28
|
-
|
|
29
|
-
void main() {
|
|
30
|
-
|
|
31
|
-
if(is3D){
|
|
32
|
-
gl_Position = cartesian3DToGLPosition(pos3D);
|
|
33
|
-
}
|
|
34
|
-
else{
|
|
35
|
-
gl_Position = mercatorXYToGLPosition(pos2D);
|
|
36
|
-
}
|
|
37
|
-
if (hovered_vertexID == gl_VertexID) {
|
|
38
|
-
gl_PointSize = hoveredPointSize;
|
|
39
|
-
} else {
|
|
40
|
-
gl_PointSize = pointSize;
|
|
41
|
-
}
|
|
42
|
-
v_rgba = rgba;
|
|
43
|
-
vVertexID = gl_VertexID;
|
|
44
|
-
}`;
|
|
45
|
-
const fs = `#version 300 es
|
|
46
|
-
precision highp float;
|
|
47
|
-
|
|
48
|
-
uniform float opacity;
|
|
49
|
-
|
|
50
|
-
flat in highp int vVertexID;
|
|
51
|
-
in vec4 v_rgba;
|
|
52
|
-
|
|
53
|
-
layout(location = 0) out vec4 fragColor;
|
|
54
|
-
layout(location = 1) out int vertexID;
|
|
55
|
-
|
|
56
|
-
void main() {
|
|
57
|
-
vertexID = vVertexID;
|
|
58
|
-
fragColor = v_rgba;
|
|
59
|
-
fragColor.a *= opacity;
|
|
60
|
-
}`;
|
|
61
|
-
class PointOnGlobeProgram {
|
|
62
|
-
constructor(globe) {
|
|
4
|
+
var util_1 = require("../../util");
|
|
5
|
+
var totems_1 = require("../totems");
|
|
6
|
+
var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
7
|
+
var programcache_1 = require("../programcache");
|
|
8
|
+
var vs = "#version 300 es\n".concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\nprecision highp float;\nprecision highp int;\n\nuniform int hovered_vertexID; // can be removed\n\nin vec3 pos3D;\nin vec2 pos2D;\nin vec4 rgba;\n\nuniform float pointSize;\nuniform float hoveredPointSize;\n\nflat out highp int vVertexID;\n\n\nout vec4 v_rgba;\n\nvoid main() {\n\n if(is3D){\n gl_Position = cartesian3DToGLPosition(pos3D);\n }\n else{\n gl_Position = mercatorXYToGLPosition(pos2D);\n }\n if (hovered_vertexID == gl_VertexID) {\n gl_PointSize = hoveredPointSize;\n } else {\n gl_PointSize = pointSize;\n }\n v_rgba = rgba;\n vVertexID = gl_VertexID;\n}");
|
|
9
|
+
var fs = "#version 300 es\nprecision highp float;\n\nuniform float opacity;\n\nflat in highp int vVertexID;\nin vec4 v_rgba;\n\nlayout(location = 0) out vec4 fragColor;\nlayout(location = 1) out int vertexID;\n\nvoid main() {\n vertexID = vVertexID; \n fragColor = v_rgba;\n fragColor.a *= opacity;\n}";
|
|
10
|
+
var PointOnGlobeProgram = /** @class */ (function () {
|
|
11
|
+
function PointOnGlobeProgram(globe) {
|
|
63
12
|
this.globe = globe;
|
|
64
13
|
this.gl = globe.gl;
|
|
65
14
|
this.program = (0, util_1.createProgram)(this.gl, vs, fs);
|
|
66
|
-
|
|
15
|
+
var _a = this, gl = _a.gl, program = _a.program;
|
|
67
16
|
this.uniforms = {
|
|
68
17
|
opacity: gl.getUniformLocation(program, "opacity"),
|
|
69
18
|
hovered_vertexID: gl.getUniformLocation(program, "hovered_vertexID"),
|
|
@@ -76,7 +25,7 @@ class PointOnGlobeProgram {
|
|
|
76
25
|
this._lastPointSize = 2.0;
|
|
77
26
|
this._lastHoveredPointSize = 4.0;
|
|
78
27
|
this._lastHoveredID = -1;
|
|
79
|
-
|
|
28
|
+
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
80
29
|
gl.useProgram(program);
|
|
81
30
|
gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
82
31
|
gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
|
|
@@ -94,13 +43,13 @@ class PointOnGlobeProgram {
|
|
|
94
43
|
{ // arrange camera uniform block
|
|
95
44
|
this.cameraBlockBingingPoint = 0;
|
|
96
45
|
this.cameraBlockTotem = totems_1.CameraUniformBlockTotemCache.get(globe);
|
|
97
|
-
|
|
46
|
+
var cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
98
47
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
|
|
99
48
|
}
|
|
100
49
|
}
|
|
101
|
-
createVAO(pos3DBuffer, pos2DBuffer, rgbaBuffer) {
|
|
102
|
-
|
|
103
|
-
|
|
50
|
+
PointOnGlobeProgram.prototype.createVAO = function (pos3DBuffer, pos2DBuffer, rgbaBuffer) {
|
|
51
|
+
var gl = this.gl;
|
|
52
|
+
var vao = gl.createVertexArray();
|
|
104
53
|
gl.bindVertexArray(vao);
|
|
105
54
|
// eslint-disable-next-line
|
|
106
55
|
{
|
|
@@ -123,11 +72,12 @@ class PointOnGlobeProgram {
|
|
|
123
72
|
gl.bindVertexArray(null);
|
|
124
73
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
125
74
|
return vao;
|
|
126
|
-
}
|
|
127
|
-
draw
|
|
75
|
+
};
|
|
76
|
+
PointOnGlobeProgram.prototype.draw = function (vao, length, _a) {
|
|
77
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.hoveredID, hoveredID = _d === void 0 ? -1 : _d, _e = _b.pointSize, pointSize = _e === void 0 ? 2.0 : _e, _f = _b.hoveredPointSize, hoveredPointSize = _f === void 0 ? 4.0 : _f, _g = _b.elementBuffer, elementBuffer = _g === void 0 ? null : _g;
|
|
128
78
|
if (length === 0 || opacity === 0)
|
|
129
79
|
return;
|
|
130
|
-
|
|
80
|
+
var _h = this, gl = _h.gl, program = _h.program, uniforms = _h.uniforms;
|
|
131
81
|
gl.useProgram(program);
|
|
132
82
|
if (this._lastOpacity !== opacity) {
|
|
133
83
|
gl.uniform1f(uniforms.opacity, opacity);
|
|
@@ -157,18 +107,19 @@ class PointOnGlobeProgram {
|
|
|
157
107
|
}
|
|
158
108
|
this.cameraBlockTotem.unbind(this.cameraBlockBingingPoint);
|
|
159
109
|
gl.bindVertexArray(null);
|
|
160
|
-
}
|
|
161
|
-
free() {
|
|
110
|
+
};
|
|
111
|
+
PointOnGlobeProgram.prototype.free = function () {
|
|
162
112
|
if (this._isFreed)
|
|
163
113
|
return;
|
|
164
|
-
|
|
114
|
+
var _a = this, gl = _a.gl, globe = _a.globe;
|
|
165
115
|
totems_1.CameraUniformBlockTotemCache.release(globe);
|
|
166
116
|
gl.deleteProgram(this.program);
|
|
167
117
|
this._isFreed = true;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
118
|
+
};
|
|
119
|
+
return PointOnGlobeProgram;
|
|
120
|
+
}());
|
|
121
|
+
var PointOnGlobeProgramCache = Object.freeze({
|
|
122
|
+
get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, PointOnGlobeProgram); },
|
|
123
|
+
release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, PointOnGlobeProgram); }
|
|
173
124
|
});
|
|
174
125
|
exports.PointOnGlobeProgramCache = PointOnGlobeProgramCache;
|
package/programs/programcache.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.noRegisterGlobeProgramCache = exports.glProgramCache = exports.globeProgramCache = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var globeProgramCache = (function () {
|
|
18
|
+
var cache = new Map();
|
|
19
19
|
function getProgram(globe, ProgramClass) {
|
|
20
20
|
if (!cache.has(globe)) {
|
|
21
21
|
cache.set(globe, new Map());
|
|
@@ -26,7 +26,7 @@ const globeProgramCache = (function () {
|
|
|
26
26
|
program: new ProgramClass(),
|
|
27
27
|
count: 1
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
var firstObject = globe.DrawOrder.GetObj(0);
|
|
30
30
|
globe.api_RegisterPlugin(cache.get(globe).get(ProgramClass).program, firstObject);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -49,13 +49,13 @@ const globeProgramCache = (function () {
|
|
|
49
49
|
}
|
|
50
50
|
;
|
|
51
51
|
return Object.freeze({
|
|
52
|
-
getProgram,
|
|
53
|
-
releaseProgram
|
|
52
|
+
getProgram: getProgram,
|
|
53
|
+
releaseProgram: releaseProgram
|
|
54
54
|
});
|
|
55
55
|
})();
|
|
56
56
|
exports.globeProgramCache = globeProgramCache;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
var glProgramCache = (function () {
|
|
58
|
+
var cache = new Map();
|
|
59
59
|
function getProgram(gl, ProgramClass) {
|
|
60
60
|
if (!cache.has(gl)) {
|
|
61
61
|
cache.set(gl, new Map());
|
|
@@ -87,13 +87,13 @@ const glProgramCache = (function () {
|
|
|
87
87
|
}
|
|
88
88
|
;
|
|
89
89
|
return Object.freeze({
|
|
90
|
-
getProgram,
|
|
91
|
-
releaseProgram
|
|
90
|
+
getProgram: getProgram,
|
|
91
|
+
releaseProgram: releaseProgram
|
|
92
92
|
});
|
|
93
93
|
})();
|
|
94
94
|
exports.glProgramCache = glProgramCache;
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
var noRegisterGlobeProgramCache = (function () {
|
|
96
|
+
var cache = new Map();
|
|
97
97
|
function getProgram(globe, ProgramClass) {
|
|
98
98
|
if (!cache.has(globe)) {
|
|
99
99
|
cache.set(globe, new Map());
|
|
@@ -124,8 +124,8 @@ const noRegisterGlobeProgramCache = (function () {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
return Object.freeze({
|
|
127
|
-
getProgram,
|
|
128
|
-
releaseProgram
|
|
127
|
+
getProgram: getProgram,
|
|
128
|
+
releaseProgram: releaseProgram
|
|
129
129
|
});
|
|
130
130
|
})();
|
|
131
131
|
exports.noRegisterGlobeProgramCache = noRegisterGlobeProgramCache;
|