@pirireis/webglobeplugins 0.6.12 → 0.6.15
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/circle-line-chain/chain-list-map.js +1 -1
- package/circle-line-chain/plugin-accurate.js +406 -0
- package/circle-line-chain/plugin.js +6 -3
- package/compass-rose/compass-rose-padding-flat.js +25 -2
- package/heatwave/plugins/heatwaveglobeshell.js +0 -2
- package/package.json +1 -1
- package/{heatwavemaps/isobar/objectarraylabels.js → pin/pin-object-array.js} +135 -1
- package/programs/line-on-globe/naive-accurate.js +219 -0
- package/programs/line-on-globe/naive.js +1 -1
- package/programs/line-on-globe/to-the-origin.js +165 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -3
- package/util/shaderfunctions/geometrytransformations.js +29 -1
- package/heatwavemaps/index.js +0 -4
- package/heatwavemaps/isobar/plugin.js +0 -337
- package/heatwavemaps/isobar/quadtreecontours.js +0 -338
- package/heatwavemaps/plugins/heatwaveglobeshell.js +0 -257
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { CameraUniformBlockString, CameraUniformBlockTotem } from "../totems";
|
|
2
|
+
import { pointsOnSphereBetween, POLE, R_3D, mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { createProgram } from "../../util";
|
|
4
|
+
import { noRegisterGlobeProgramCache, globeProgramCache } from "../programcache";
|
|
5
|
+
import BufferOffsetManger from "../../util/account/bufferoffsetmanager";
|
|
6
|
+
import { programCache } from "../rings/distancering/circleflatprogram";
|
|
7
|
+
|
|
8
|
+
const GLOBE_MIDPOINT_COUNT = 100;
|
|
9
|
+
const ITEM_SIZE = 9;
|
|
10
|
+
|
|
11
|
+
const vertexShader = `#version 300 es
|
|
12
|
+
precision highp float;
|
|
13
|
+
${R_3D}
|
|
14
|
+
${CameraUniformBlockString}
|
|
15
|
+
${pointsOnSphereBetween}
|
|
16
|
+
${mercatorXYToGLPosition}
|
|
17
|
+
${cartesian3DToGLPosition}
|
|
18
|
+
|
|
19
|
+
in vec2 start_position;
|
|
20
|
+
in vec3 start_poisition3d;
|
|
21
|
+
in vec2 end_position;
|
|
22
|
+
in vec3 end_position3;
|
|
23
|
+
in float dash_ratio;
|
|
24
|
+
in vec4 color;
|
|
25
|
+
in float dash_opacity;
|
|
26
|
+
out vec4 v_color;
|
|
27
|
+
out vec2 v_limp;
|
|
28
|
+
out float interpolation;
|
|
29
|
+
out float v_dash_ratio;
|
|
30
|
+
out float v_dash_opacity;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
vec2 longLat;
|
|
35
|
+
if (is3D) {
|
|
36
|
+
interpolation = float(gl_VertexID) / ${GLOBE_MIDPOINT_COUNT - 1}.0;
|
|
37
|
+
vec3 cartesian = pointsOnSphereBetween(start_poisition3d, end_position3, interpolation) * R_3D;
|
|
38
|
+
gl_Position = cartesian3DToGLPosition(cartesian);
|
|
39
|
+
v_limp = vec2(0.0, 0.0);
|
|
40
|
+
} else {
|
|
41
|
+
interpolation = float(gl_VertexID);
|
|
42
|
+
if (gl_VertexID % 2 == 0) {
|
|
43
|
+
longLat = start_position;
|
|
44
|
+
} else {
|
|
45
|
+
longLat = end_position;
|
|
46
|
+
}
|
|
47
|
+
v_limp = longLat;
|
|
48
|
+
gl_Position = mercatorXYToGLPosition(longLat);
|
|
49
|
+
}
|
|
50
|
+
// if ( gl_VertexID % 2 == 0) {v_color = color;}
|
|
51
|
+
// else {v_color = vec4(0.0, 0.0, 0.0, 0.0);}
|
|
52
|
+
v_color = color;
|
|
53
|
+
v_dash_ratio = dash_ratio;
|
|
54
|
+
v_dash_opacity = dash_opacity;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const fragmentShader = `#version 300 es
|
|
59
|
+
${POLE}
|
|
60
|
+
precision highp float;
|
|
61
|
+
uniform float opacity;
|
|
62
|
+
in vec4 v_color;
|
|
63
|
+
out vec4 color;
|
|
64
|
+
in float interpolation;
|
|
65
|
+
in float v_dash_ratio;
|
|
66
|
+
in vec2 v_limp;
|
|
67
|
+
in float v_dash_opacity;
|
|
68
|
+
void main() {
|
|
69
|
+
if (v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE) { discard; }
|
|
70
|
+
color = v_color;
|
|
71
|
+
color.a *= opacity;
|
|
72
|
+
if ( v_dash_ratio >= 1.0 ) { return; }
|
|
73
|
+
if (interpolation > 0.95) { return; }
|
|
74
|
+
if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a *= v_dash_opacity; }
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class Logic {
|
|
81
|
+
|
|
82
|
+
constructor(globe) {
|
|
83
|
+
this.globe = globe;
|
|
84
|
+
this.gl = globe.gl;
|
|
85
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
86
|
+
this._lastOpacity = 1.0;
|
|
87
|
+
const { gl, program } = this;
|
|
88
|
+
{
|
|
89
|
+
// assign attribute locations
|
|
90
|
+
gl.bindAttribLocation(program, 0, "start_position");
|
|
91
|
+
gl.bindAttribLocation(program, 1, "start_position3d");
|
|
92
|
+
gl.bindAttribLocation(program, 2, "end_position");
|
|
93
|
+
gl.bindAttribLocation(program, 3, "end_position3d");
|
|
94
|
+
gl.bindAttribLocation(program, 4, "dash_ratio");
|
|
95
|
+
gl.bindAttribLocation(program, 5, "color");
|
|
96
|
+
gl.bindAttribLocation(program, 6, "dash_opacity");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
this._opacityLocation = gl.getUniformLocation(program, "opacity");
|
|
101
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
102
|
+
gl.useProgram(program);
|
|
103
|
+
gl.uniform1f(this._opacityLocation, this._lastOpacity);
|
|
104
|
+
gl.useProgram(currentProgram);
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.cameraBlockBindingPoint = 0;
|
|
109
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
110
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
111
|
+
gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
draw(vao, length, opacity) {
|
|
118
|
+
const { gl, program, globe, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
119
|
+
gl.useProgram(program);
|
|
120
|
+
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
121
|
+
gl.bindVertexArray(vao);
|
|
122
|
+
if (opacity !== this._lastOpacity) {
|
|
123
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
124
|
+
this._lastOpacity = opacity;
|
|
125
|
+
}
|
|
126
|
+
const drawCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
|
|
127
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
128
|
+
gl.drawArraysInstanced(gl.LINE_STRIP, 0, drawCount, length);
|
|
129
|
+
gl.bindVertexArray(null);
|
|
130
|
+
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
131
|
+
// gl.enable(gl.DEPTH_TEST);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//
|
|
135
|
+
createVAO(
|
|
136
|
+
startPotisionBufferObj, startPotision3DBufferObj,
|
|
137
|
+
endPositionBufferObj, endPosition3DBufferObj,
|
|
138
|
+
dashRatioBufferObj,
|
|
139
|
+
dashOpacityBufferObj,
|
|
140
|
+
colorBufferObj) {
|
|
141
|
+
const { gl } = this;
|
|
142
|
+
const vao = gl.createVertexArray();
|
|
143
|
+
gl.bindVertexArray(vao);
|
|
144
|
+
{
|
|
145
|
+
const { buffer, stride = 0, offset = 0 } = startPotisionBufferObj;
|
|
146
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
147
|
+
gl.enableVertexAttribArray(0);
|
|
148
|
+
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
149
|
+
gl.vertexAttribDivisor(0, 1);
|
|
150
|
+
}
|
|
151
|
+
{
|
|
152
|
+
const { buffer, stride = 0, offset = 0 } = startPotision3DBufferObj;
|
|
153
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
154
|
+
gl.enableVertexAttribArray(1);
|
|
155
|
+
gl.vertexAttribPointer(1, 3, gl.FLOAT, false, stride, offset);
|
|
156
|
+
gl.vertexAttribDivisor(1, 1);
|
|
157
|
+
}
|
|
158
|
+
{
|
|
159
|
+
|
|
160
|
+
const { buffer, stride = 0, offset = 0 } = endPositionBufferObj;
|
|
161
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
162
|
+
gl.enableVertexAttribArray(2);
|
|
163
|
+
gl.vertexAttribPointer(2, 2, gl.FLOAT, false, stride, offset);
|
|
164
|
+
gl.vertexAttribDivisor(2, 1);
|
|
165
|
+
}
|
|
166
|
+
{
|
|
167
|
+
|
|
168
|
+
const { buffer, stride = 0, offset = 0 } = endPosition3DBufferObj;
|
|
169
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
170
|
+
gl.enableVertexAttribArray(3);
|
|
171
|
+
gl.vertexAttribPointer(3, 3, gl.FLOAT, false, stride, offset);
|
|
172
|
+
gl.vertexAttribDivisor(3, 1);
|
|
173
|
+
}
|
|
174
|
+
{
|
|
175
|
+
const { buffer, stride = 0, offset = 0 } = dashRatioBufferObj;
|
|
176
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
177
|
+
gl.enableVertexAttribArray(4);
|
|
178
|
+
gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
|
|
179
|
+
gl.vertexAttribDivisor(4, 1);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
const { buffer, stride = 0, offset = 0 } = colorBufferObj;
|
|
184
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
185
|
+
gl.enableVertexAttribArray(5);
|
|
186
|
+
gl.vertexAttribPointer(5, 4, gl.FLOAT, false, stride, offset);
|
|
187
|
+
gl.vertexAttribDivisor(5, 1);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
{
|
|
191
|
+
const { buffer, stride = 0, offset = 0 } = dashOpacityBufferObj;
|
|
192
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
193
|
+
gl.enableVertexAttribArray(6);
|
|
194
|
+
gl.vertexAttribPointer(6, 1, gl.FLOAT, false, stride, offset);
|
|
195
|
+
gl.vertexAttribDivisor(6, 1);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
gl.bindVertexArray(null);
|
|
199
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
200
|
+
return vao;
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
free() {
|
|
206
|
+
if (this.isFreed) return;
|
|
207
|
+
programCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
208
|
+
this.gl.deleteProgram(this.program);
|
|
209
|
+
this.isFreed = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
export const LineOnGlobeCache = Object.freeze({
|
|
216
|
+
get: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
217
|
+
release: (globe) => { return noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
218
|
+
});
|
|
219
|
+
|
|
@@ -4,7 +4,7 @@ import { createProgram } from "../../util";
|
|
|
4
4
|
import { noRegisterGlobeProgramCache, globeProgramCache } from "../programcache";
|
|
5
5
|
import BufferOffsetManger from "../../util/account/bufferoffsetmanager";
|
|
6
6
|
import { programCache } from "../rings/distancering/circleflatprogram";
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
const GLOBE_MIDPOINT_COUNT = 100;
|
|
9
9
|
const ITEM_SIZE = 9;
|
|
10
10
|
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createProgram } from "../../util";
|
|
2
|
+
import { longLatRadToCartesian3DWithR, cartesian3DToGLPosition, R_3D } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems";
|
|
4
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates beams from long, lat, radian coordinates to origin on global view.
|
|
8
|
+
* Ojects with hight, float over terrain and does not propose information of their actual coordinates.
|
|
9
|
+
* You start drawing after zoom level 9-10
|
|
10
|
+
* Does not work on mercator.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const vertexShaderSource = `#version 300 es
|
|
15
|
+
precision highp float;
|
|
16
|
+
${CameraUniformBlockString}
|
|
17
|
+
${R_3D}
|
|
18
|
+
${longLatRadToCartesian3DWithR}
|
|
19
|
+
${cartesian3DToGLPosition}
|
|
20
|
+
|
|
21
|
+
in vec2 position2d;
|
|
22
|
+
in vec4 rgba;
|
|
23
|
+
uniform float origin_r;
|
|
24
|
+
flat out vec4 v_rgba;
|
|
25
|
+
out float interpolation_value;
|
|
26
|
+
|
|
27
|
+
void main() {
|
|
28
|
+
if (!is3D) {return;}
|
|
29
|
+
vec3 cartesian;
|
|
30
|
+
if(gl_VertexID == 0) {
|
|
31
|
+
cartesian = longLatRadToCartesian3DWithR(position2d, R_3D);
|
|
32
|
+
interpolation_value = 1.0;
|
|
33
|
+
} else {
|
|
34
|
+
cartesian = longLatRadToCartesian3DWithR(position2d, origin_r);
|
|
35
|
+
interpolation_value = 0.0;
|
|
36
|
+
}
|
|
37
|
+
gl_Position = cartesian3DToGLPosition(cartesian);
|
|
38
|
+
v_rgba = rgba;
|
|
39
|
+
gl_PointSize = 10.0; // for testing
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const fragmentShaderSource = `#version 300 es
|
|
44
|
+
precision highp float;
|
|
45
|
+
|
|
46
|
+
uniform float plugin_opacity;
|
|
47
|
+
in float interpolation_value;
|
|
48
|
+
flat in vec4 v_rgba;
|
|
49
|
+
out vec4 color;
|
|
50
|
+
void main(){
|
|
51
|
+
if ( fract( interpolation_value * 100.0) < 0.5) {discard;}
|
|
52
|
+
color = vec4(
|
|
53
|
+
v_rgba.rgb,
|
|
54
|
+
v_rgba.a * plugin_opacity * interpolation_value * 0.9
|
|
55
|
+
);
|
|
56
|
+
}`;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class Logic {
|
|
60
|
+
constructor(globe) {
|
|
61
|
+
this.globe = globe;
|
|
62
|
+
this.gl = globe.gl;
|
|
63
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
64
|
+
this._lastOpacity = 1.0;
|
|
65
|
+
this._lastOriginR = 6378.137 - 1;
|
|
66
|
+
const { gl, program } = this;
|
|
67
|
+
{
|
|
68
|
+
gl.bindAttribLocation(program, 0, "position2d");
|
|
69
|
+
gl.bindAttribLocation(program, 1, "rgba");
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
{
|
|
73
|
+
this._opacityLocation = gl.getUniformLocation(program, "plugin_opacity");
|
|
74
|
+
this._originRLocation = gl.getUniformLocation(program, "origin_r")
|
|
75
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
76
|
+
gl.useProgram(program);
|
|
77
|
+
gl.uniform1f(this._opacityLocation, this._lastOpacity);
|
|
78
|
+
gl.uniform1f(this._originRLocation, this._lastOriginR);
|
|
79
|
+
gl.useProgram(currentProgram);
|
|
80
|
+
}
|
|
81
|
+
{
|
|
82
|
+
this.cameraBlockBindingPoint = 0;
|
|
83
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
84
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
85
|
+
gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
draw(vao, length, opacity, originR = null) {
|
|
90
|
+
const { gl, program, globe, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
91
|
+
const is3D = globe.api_GetCurrentGeometry() == 0;
|
|
92
|
+
if (!is3D) return;
|
|
93
|
+
const lod = globe.api_GetCurrentLODWithDecimal()
|
|
94
|
+
if (lod < 12) return;
|
|
95
|
+
gl.useProgram(program);
|
|
96
|
+
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
97
|
+
gl.bindVertexArray(vao);
|
|
98
|
+
if (opacity !== this._lastOpacity) {
|
|
99
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
100
|
+
this._checkOpacity(opacity);
|
|
101
|
+
this._lastOpacity = opacity;
|
|
102
|
+
}
|
|
103
|
+
if (originR !== null && originR !== this._lastOriginR) {
|
|
104
|
+
this._checkOriginR(originR);
|
|
105
|
+
gl.uniform1f(this._originRLocation, originR);
|
|
106
|
+
this._lastOriginR = originR;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
110
|
+
gl.drawArraysInstanced(gl.LINE_STRIP, 0, 2, length);
|
|
111
|
+
gl.bindVertexArray(null);
|
|
112
|
+
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
113
|
+
// gl.enable(gl.DEPTH_TEST);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_checkOpacity(opacity) {
|
|
117
|
+
if (opacity < 0.0 || opacity > 1) throw RangeError("Opacity should be between 0 and 1");
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
_checkOriginR(r) {
|
|
122
|
+
if (r < 0.0 || r > 6378.137 - 0.3) throw RangeError("r should be between 0 and 6378.137 - 0.3");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
createVAO(potisionBufferObj, colorBufferObj) {
|
|
126
|
+
const { gl } = this;
|
|
127
|
+
const vao = gl.createVertexArray();
|
|
128
|
+
gl.bindVertexArray(vao);
|
|
129
|
+
{
|
|
130
|
+
const { buffer, stride = 0, offset = 0 } = potisionBufferObj;
|
|
131
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
132
|
+
gl.enableVertexAttribArray(0);
|
|
133
|
+
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
134
|
+
gl.vertexAttribDivisor(0, 1);
|
|
135
|
+
}
|
|
136
|
+
{
|
|
137
|
+
const { buffer, stride = 0, offset = 0 } = colorBufferObj;
|
|
138
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
139
|
+
gl.enableVertexAttribArray(1);
|
|
140
|
+
gl.vertexAttribPointer(1, 4, gl.FLOAT, false, stride, offset);
|
|
141
|
+
gl.vertexAttribDivisor(1, 1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
gl.bindVertexArray(null);
|
|
145
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
146
|
+
return vao;
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
free() {
|
|
152
|
+
if (this.isFreed) return;
|
|
153
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
154
|
+
this.isFreed = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const LineToTheOriginCache = Object.freeze({
|
|
159
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
160
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
LineToTheOriginCache
|
|
165
|
+
}
|
|
@@ -53,11 +53,8 @@ vec2 adjust_pos(vec2 pos) {
|
|
|
53
53
|
void main(){
|
|
54
54
|
vec3 c = coord_opacity();
|
|
55
55
|
gl_Position = vec4( adjust_pos(c.xy), 0.0, 1.0);
|
|
56
|
-
// gl_Position = vec4( 0.0, 0.0, 0.0, 1.0);
|
|
57
56
|
v_rgba = rgba;
|
|
58
57
|
v_rgba.a *= plugin_opacity;
|
|
59
|
-
// float opacity = (float((gl_VertexID + 179) % 720 ) / (${vertexCount}.0)) / 1.5 + 0.5;
|
|
60
|
-
v_rgba.a *= c.z;
|
|
61
58
|
gl_PointSize = 10.0;
|
|
62
59
|
}
|
|
63
60
|
`
|
|
@@ -93,6 +93,14 @@ vec3 longLatRadToCartesian3D( vec2 longLat) {
|
|
|
93
93
|
}
|
|
94
94
|
`;
|
|
95
95
|
|
|
96
|
+
export const longLatRadToCartesian3DWithR = `
|
|
97
|
+
vec3 longLatRadToCartesian3DWithR( vec2 longLat, float radius) {
|
|
98
|
+
float x = radius * cos(longLat.y) * cos(longLat.x);
|
|
99
|
+
float y = radius * cos(longLat.y) * sin(longLat.x);
|
|
100
|
+
float z = radius * sin(longLat.y);
|
|
101
|
+
return vec3(x, y, z);
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
96
104
|
|
|
97
105
|
// TODO: Make it precise. It doesnt use haversine formula. If this changes, change the formmula which calculates text position.
|
|
98
106
|
export const circleLimpFromLongLatRadCenterCartesian3D = R + `
|
|
@@ -281,4 +289,24 @@ float realDistanceOnSphereR1(vec2 longLat1, vec2 longLat2) {
|
|
|
281
289
|
float c = 2.0 * atan(sqrt(a), sqrt(1.0 - a));
|
|
282
290
|
return c;
|
|
283
291
|
}
|
|
284
|
-
`;
|
|
292
|
+
`;
|
|
293
|
+
|
|
294
|
+
const pointsOnSphereBetween = `vec3 pointsOnSphereBetween(vec3 a, vec3 b, float ratio) {
|
|
295
|
+
// Normalize the input points to ensure they are on the unit sphere
|
|
296
|
+
a = normalize(a);
|
|
297
|
+
b = normalize(b);
|
|
298
|
+
|
|
299
|
+
// Compute the angle between the points
|
|
300
|
+
float theta = acos(dot(a, b));
|
|
301
|
+
|
|
302
|
+
// Compute the interpolated point using spherical linear interpolation (slerp)
|
|
303
|
+
vec3 result = (sin((1.0 - ratio) * theta) * a + sin(ratio * theta) * b) / sin(theta);
|
|
304
|
+
|
|
305
|
+
// Return the normalized result to ensure it lies on the sphere
|
|
306
|
+
return normalize(result);
|
|
307
|
+
}`
|
|
308
|
+
|
|
309
|
+
export {
|
|
310
|
+
pointsOnSphereBetween
|
|
311
|
+
|
|
312
|
+
}
|
package/heatwavemaps/index.js
DELETED