@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,61 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
+
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
3
|
+
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
4
|
+
const vertexShader = `#version 300 es ` +
|
|
5
|
+
shaderfunctions.PI +
|
|
6
|
+
shaderfunctions.R +
|
|
7
|
+
shaderfunctions.POLE +
|
|
8
|
+
CameraUniformBlockString +
|
|
9
|
+
shaderfunctions.mercatorXYToGLPosition +
|
|
10
|
+
shaderfunctions.longLatRadToMercator +
|
|
11
|
+
shaderfunctions.longLatRadToCartesian3D +
|
|
12
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
14
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
15
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
16
|
+
|
|
17
|
+
in vec2 center;
|
|
18
|
+
in float radius;
|
|
19
|
+
in float pad_range;
|
|
20
|
+
in vec4 color;
|
|
21
|
+
in float flag;
|
|
22
|
+
|
|
23
|
+
uniform int compass;
|
|
24
|
+
uniform float pad_count;
|
|
25
|
+
|
|
26
|
+
uniform float opacity;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
out vec2 v_limp;
|
|
30
|
+
out vec4 v_color;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
|
|
35
|
+
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
36
|
+
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
37
|
+
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
38
|
+
|
|
39
|
+
gl_PointSize = 2.0;
|
|
40
|
+
|
|
41
|
+
float odd = mod(float(gl_VertexID), 2.0);
|
|
42
|
+
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
43
|
+
float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
|
|
44
|
+
float radius_ = radius - (pad_range * odd);
|
|
45
|
+
|
|
46
|
+
if ( is3D){
|
|
47
|
+
gl_Position = projection * view * vec4(
|
|
48
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
49
|
+
v_limp = vec2(0.0, 0.0);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
vec2 limp;
|
|
53
|
+
if ( compass == 1 ){
|
|
54
|
+
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
55
|
+
} else {
|
|
56
|
+
// limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
|
|
57
|
+
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
58
|
+
}
|
|
59
|
+
v_limp = limp;
|
|
60
|
+
gl_Position = mercatorXYToGLPosition(limp);
|
|
61
|
+
}`;
|
|
62
|
+
const fragmentShader = `#version 300 es
|
|
63
|
+
precision highp float; ` +
|
|
64
|
+
shaderfunctions.POLE + `
|
|
65
|
+
in vec4 v_color;
|
|
66
|
+
in vec2 v_limp;
|
|
67
|
+
out vec4 outColor;
|
|
68
|
+
void main() {
|
|
69
|
+
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
70
|
+
outColor = v_color;
|
|
71
|
+
}`;
|
|
72
|
+
class Logic {
|
|
73
|
+
constructor(globe) {
|
|
56
74
|
this.globe = globe;
|
|
57
75
|
this.gl = globe.gl;
|
|
58
|
-
this.program =
|
|
76
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
59
77
|
{ // bind positions so bufferManager can use them
|
|
60
78
|
this.gl.bindAttribLocation(this.program, 0, "center");
|
|
61
79
|
this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
@@ -64,9 +82,9 @@ var Logic = /** @class */ (function () {
|
|
|
64
82
|
this.gl.bindAttribLocation(this.program, 4, "flag");
|
|
65
83
|
}
|
|
66
84
|
this.cameraBlockBindingPoint = 0;
|
|
67
|
-
|
|
85
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
68
86
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
69
|
-
this.cameraBlockTotem =
|
|
87
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
70
88
|
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
71
89
|
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
72
90
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
@@ -74,7 +92,7 @@ var Logic = /** @class */ (function () {
|
|
|
74
92
|
this._opacity = 1.0;
|
|
75
93
|
this._padCount = 360;
|
|
76
94
|
{
|
|
77
|
-
|
|
95
|
+
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
78
96
|
this.gl.useProgram(this.program);
|
|
79
97
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
80
98
|
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
@@ -82,8 +100,8 @@ var Logic = /** @class */ (function () {
|
|
|
82
100
|
this.gl.useProgram(currentProgram);
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
draw(attrBufferManager, padCount, compass, opacity) {
|
|
104
|
+
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
87
105
|
gl.useProgram(program);
|
|
88
106
|
attrBufferManager.bindPaddingVAO();
|
|
89
107
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -106,14 +124,13 @@ var Logic = /** @class */ (function () {
|
|
|
106
124
|
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
107
125
|
gl.bindVertexArray(null);
|
|
108
126
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
109
|
-
}
|
|
110
|
-
|
|
127
|
+
}
|
|
128
|
+
free() {
|
|
111
129
|
this.gl.deleteProgram(this.program);
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
releaseProgram: function (globe) { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
130
|
+
globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export const PaddingProgramCache = Object.freeze({
|
|
134
|
+
getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
135
|
+
releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
119
136
|
});
|
|
@@ -1,61 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
+
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
3
|
+
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
4
|
+
const vertexShader = `#version 300 es ` +
|
|
5
|
+
shaderfunctions.PI +
|
|
6
|
+
shaderfunctions.R +
|
|
7
|
+
shaderfunctions.POLE +
|
|
8
|
+
CameraUniformBlockString +
|
|
9
|
+
shaderfunctions.mercatorXYToGLPosition +
|
|
10
|
+
shaderfunctions.longLatRadToMercator +
|
|
11
|
+
shaderfunctions.longLatRadToCartesian3D +
|
|
12
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
14
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
15
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
16
|
+
|
|
17
|
+
in vec2 center;
|
|
18
|
+
in float radius;
|
|
19
|
+
in float pad_range;
|
|
20
|
+
in vec4 color;
|
|
21
|
+
in float flag;
|
|
22
|
+
|
|
23
|
+
uniform int compass;
|
|
24
|
+
uniform float pad_count;
|
|
25
|
+
|
|
26
|
+
uniform float opacity;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
out vec2 v_limp;
|
|
30
|
+
out vec4 v_color;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
|
|
35
|
+
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
36
|
+
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
37
|
+
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
38
|
+
|
|
39
|
+
gl_PointSize = 2.0;
|
|
40
|
+
|
|
41
|
+
float odd = mod(float(gl_VertexID), 2.0);
|
|
42
|
+
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
43
|
+
float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
|
|
44
|
+
float radius_ = radius - (pad_range * odd);
|
|
45
|
+
|
|
46
|
+
if ( is3D){
|
|
47
|
+
gl_Position = projection * view * vec4(
|
|
48
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
49
|
+
v_limp = vec2(0.0, 0.0);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
vec2 limp;
|
|
53
|
+
if ( compass == 1 ){
|
|
54
|
+
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
55
|
+
} else {
|
|
56
|
+
// limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
|
|
57
|
+
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
58
|
+
}
|
|
59
|
+
v_limp = limp;
|
|
60
|
+
gl_Position = mercatorXYToGLPosition(limp);
|
|
61
|
+
}`;
|
|
62
|
+
const fragmentShader = `#version 300 es
|
|
63
|
+
precision highp float; ` +
|
|
64
|
+
shaderfunctions.POLE + `
|
|
65
|
+
in vec4 v_color;
|
|
66
|
+
in vec2 v_limp;
|
|
67
|
+
out vec4 outColor;
|
|
68
|
+
void main() {
|
|
69
|
+
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
70
|
+
outColor = v_color;
|
|
71
|
+
}`;
|
|
72
|
+
class Logic {
|
|
73
|
+
constructor(globe) {
|
|
56
74
|
this.globe = globe;
|
|
57
75
|
this.gl = globe.gl;
|
|
58
|
-
this.program =
|
|
76
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
59
77
|
{ // bind positions so bufferManager can use them
|
|
60
78
|
this.gl.bindAttribLocation(this.program, 0, "center");
|
|
61
79
|
this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
@@ -64,9 +82,9 @@ var Logic = /** @class */ (function () {
|
|
|
64
82
|
this.gl.bindAttribLocation(this.program, 4, "flag");
|
|
65
83
|
}
|
|
66
84
|
this.cameraBlockBindingPoint = 0;
|
|
67
|
-
|
|
85
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
68
86
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
69
|
-
this.cameraBlockTotem =
|
|
87
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
70
88
|
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
71
89
|
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
72
90
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
@@ -74,7 +92,7 @@ var Logic = /** @class */ (function () {
|
|
|
74
92
|
this._opacity = 1.0;
|
|
75
93
|
this._padCount = 360;
|
|
76
94
|
{
|
|
77
|
-
|
|
95
|
+
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
78
96
|
this.gl.useProgram(this.program);
|
|
79
97
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
80
98
|
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
@@ -82,10 +100,10 @@ var Logic = /** @class */ (function () {
|
|
|
82
100
|
this.gl.useProgram(currentProgram);
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
draw(vao, length, opaity) {
|
|
104
|
+
}
|
|
105
|
+
draw(attrBufferManager, padCount, compass, opacity) {
|
|
106
|
+
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
89
107
|
gl.useProgram(program);
|
|
90
108
|
attrBufferManager.bindPaddingVAO();
|
|
91
109
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -108,14 +126,13 @@ var Logic = /** @class */ (function () {
|
|
|
108
126
|
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
109
127
|
gl.bindVertexArray(null);
|
|
110
128
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
111
|
-
}
|
|
112
|
-
|
|
129
|
+
}
|
|
130
|
+
free() {
|
|
113
131
|
this.gl.deleteProgram(this.program);
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
releaseProgram: function (globe) { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
132
|
+
globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export const PaddingProgramCache = Object.freeze({
|
|
136
|
+
getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
137
|
+
releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
121
138
|
});
|
|
@@ -1,61 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
+
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
3
|
+
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
4
|
+
const vertexShader = `#version 300 es ` +
|
|
5
|
+
shaderfunctions.PI +
|
|
6
|
+
shaderfunctions.R +
|
|
7
|
+
shaderfunctions.POLE +
|
|
8
|
+
CameraUniformBlockString +
|
|
9
|
+
shaderfunctions.mercatorXYToGLPosition +
|
|
10
|
+
shaderfunctions.longLatRadToMercator +
|
|
11
|
+
shaderfunctions.longLatRadToCartesian3D +
|
|
12
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
14
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
15
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
16
|
+
|
|
17
|
+
in vec2 center;
|
|
18
|
+
in float radius;
|
|
19
|
+
in float pad_range;
|
|
20
|
+
in vec4 color;
|
|
21
|
+
in float flag;
|
|
22
|
+
|
|
23
|
+
uniform int compass;
|
|
24
|
+
uniform float pad_count;
|
|
25
|
+
|
|
26
|
+
uniform float opacity;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
out vec2 v_limp;
|
|
30
|
+
out vec4 v_color;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
|
|
35
|
+
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
36
|
+
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
37
|
+
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
38
|
+
|
|
39
|
+
gl_PointSize = 2.0;
|
|
40
|
+
|
|
41
|
+
float odd = mod(float(gl_VertexID), 2.0);
|
|
42
|
+
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
43
|
+
float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
|
|
44
|
+
float radius_ = radius - (pad_range * odd);
|
|
45
|
+
|
|
46
|
+
if ( is3D){
|
|
47
|
+
gl_Position = projection * view * vec4(
|
|
48
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
49
|
+
v_limp = vec2(0.0, 0.0);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
vec2 limp;
|
|
53
|
+
if ( compass == 1 ){
|
|
54
|
+
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
55
|
+
} else {
|
|
56
|
+
// limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
|
|
57
|
+
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
58
|
+
}
|
|
59
|
+
v_limp = limp;
|
|
60
|
+
gl_Position = mercatorXYToGLPosition(limp);
|
|
61
|
+
}`;
|
|
62
|
+
const fragmentShader = `#version 300 es
|
|
63
|
+
precision highp float; ` +
|
|
64
|
+
shaderfunctions.POLE + `
|
|
65
|
+
in vec4 v_color;
|
|
66
|
+
in vec2 v_limp;
|
|
67
|
+
out vec4 outColor;
|
|
68
|
+
void main() {
|
|
69
|
+
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
70
|
+
outColor = v_color;
|
|
71
|
+
}`;
|
|
72
|
+
class Logic {
|
|
73
|
+
constructor(globe) {
|
|
56
74
|
this.globe = globe;
|
|
57
75
|
this.gl = globe.gl;
|
|
58
|
-
this.program =
|
|
76
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
59
77
|
{ // bind positions so bufferManager can use them
|
|
60
78
|
this.gl.bindAttribLocation(this.program, 0, "center");
|
|
61
79
|
this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
@@ -64,9 +82,9 @@ var Logic = /** @class */ (function () {
|
|
|
64
82
|
this.gl.bindAttribLocation(this.program, 4, "flag");
|
|
65
83
|
}
|
|
66
84
|
this.cameraBlockBindingPoint = 0;
|
|
67
|
-
|
|
85
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
68
86
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
69
|
-
this.cameraBlockTotem =
|
|
87
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
70
88
|
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
71
89
|
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
72
90
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
@@ -74,7 +92,7 @@ var Logic = /** @class */ (function () {
|
|
|
74
92
|
this._opacity = 1.0;
|
|
75
93
|
this._padCount = 360;
|
|
76
94
|
{
|
|
77
|
-
|
|
95
|
+
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
78
96
|
this.gl.useProgram(this.program);
|
|
79
97
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
80
98
|
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
@@ -82,8 +100,8 @@ var Logic = /** @class */ (function () {
|
|
|
82
100
|
this.gl.useProgram(currentProgram);
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
draw(attrBufferManager, padCount, compass, opacity) {
|
|
104
|
+
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
87
105
|
gl.useProgram(program);
|
|
88
106
|
attrBufferManager.bindPaddingVAO();
|
|
89
107
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -106,14 +124,13 @@ var Logic = /** @class */ (function () {
|
|
|
106
124
|
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
107
125
|
gl.bindVertexArray(null);
|
|
108
126
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
109
|
-
}
|
|
110
|
-
|
|
127
|
+
}
|
|
128
|
+
free() {
|
|
111
129
|
this.gl.deleteProgram(this.program);
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
releaseProgram: function (globe) { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
130
|
+
globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export const PaddingProgramCache = Object.freeze({
|
|
134
|
+
getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
135
|
+
releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
119
136
|
});
|
package/programs/rings/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./distancering"), exports);
|
|
1
|
+
export * from "./distancering";
|