@pirireis/webglobeplugins 0.3.5 → 0.3.7
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/bearing-line/plugin.js +0 -1
- package/circle-lines/init.js +0 -0
- package/circle-lines/plugin.js +17 -0
- package/circle-lines/readme.md +57 -0
- package/package.json +1 -1
- package/partialrings/plugin.js +0 -1
- package/partialrings/program.js +8 -10
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +2 -2
- package/programs/rings/distancering/paddyflatprogram.js +3 -3
- package/rangerings/rangerings.js +0 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +5 -5
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +10 -8
- package/util/geometry/geodatafromtexture.js +3 -3
- package/util/jshelpers/timefilters.js +2 -2
- package/util/programs/texturetoglobe.js +17 -17
- package/util/shaderfunctions/geometrytransformations.js +11 -11
package/bearing-line/plugin.js
CHANGED
|
@@ -147,7 +147,6 @@ export default class Plugin {
|
|
|
147
147
|
'adaptor': (item) => new Float32Array([item.dashOpacity])
|
|
148
148
|
}],
|
|
149
149
|
["circleDashAngle", {
|
|
150
|
-
|
|
151
150
|
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
152
151
|
'adaptor': (item) => new Float32Array([item.circleDashAngle / 360])
|
|
153
152
|
}]
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* import programs, buffer orchestrator
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* import dext managers
|
|
6
|
+
*
|
|
7
|
+
* Entities:
|
|
8
|
+
* AcircleLine
|
|
9
|
+
* - circle
|
|
10
|
+
* - line
|
|
11
|
+
*
|
|
12
|
+
* Chain
|
|
13
|
+
* - multiple circlelines connected
|
|
14
|
+
* - a wrapper around buffer orchester to hold one to many relationship
|
|
15
|
+
*
|
|
16
|
+
* # Mouse interations
|
|
17
|
+
*/
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Road Map
|
|
2
|
+
|
|
3
|
+
## CircleLine
|
|
4
|
+
Atomic unit is the circle-line constructed from a circle and a line with start and end point which indicates the radius.
|
|
5
|
+
|
|
6
|
+
### Attributes
|
|
7
|
+
Main attributes: StartPoint, EndPoint, Radius
|
|
8
|
+
Other attributes: Color, opacity, dash opacity, dash ratio
|
|
9
|
+
|
|
10
|
+
### API
|
|
11
|
+
API is the manipulation of above attributes
|
|
12
|
+
|
|
13
|
+
### Implementation
|
|
14
|
+
|
|
15
|
+
Buffer Orchestrater is enough.
|
|
16
|
+
|
|
17
|
+
## ChainOfCircleLines
|
|
18
|
+
Composit unit is a chain of circle-lines.
|
|
19
|
+
|
|
20
|
+
### Attributes
|
|
21
|
+
|
|
22
|
+
Main attributes: one to many relation of a chain and its circle-lines
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# API
|
|
26
|
+
- startChain(chainID) //
|
|
27
|
+
- addPointToChain(chainID)
|
|
28
|
+
- editPointOfChain(chainID, pointID) //
|
|
29
|
+
- divideChain(chainID, )
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Concept Formation
|
|
34
|
+
|
|
35
|
+
Circle-Line has ( startPoint, endPoint )
|
|
36
|
+
|
|
37
|
+
Chain Has [...circle-line] -> [ c0, c1, c2 ...] -> c0.endPoint == c1.startPoint, c1.endPoint == c2.startPoint
|
|
38
|
+
|
|
39
|
+
## Modes
|
|
40
|
+
|
|
41
|
+
Focus Mod
|
|
42
|
+
- mouse icon hides and edge point icon is displayed
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## interaction points ( this can be a new module)
|
|
46
|
+
changes the mouse icon
|
|
47
|
+
plugin creates them.
|
|
48
|
+
interaction points carryin carries information about how to interact with the plugin.
|
|
49
|
+
|
|
50
|
+
- On Edges
|
|
51
|
+
Updates coordinates on right click and carry
|
|
52
|
+
deletes on right
|
|
53
|
+
- on mid point of a radius line (+)
|
|
54
|
+
Addes an edge to mid points. ( deletes the old one and inserts 2)
|
|
55
|
+
|
|
56
|
+
UserInterface
|
|
57
|
+
- drawNewMethod
|
package/package.json
CHANGED
package/partialrings/plugin.js
CHANGED
|
@@ -115,7 +115,6 @@ class BufferManager extends BufferOffsetManager {
|
|
|
115
115
|
*/
|
|
116
116
|
insertBulk(items) {
|
|
117
117
|
if (items.length === 0) return;
|
|
118
|
-
console.log(items)
|
|
119
118
|
this.autoExtendBuffer(items.length);
|
|
120
119
|
const { gl, buffer } = this;
|
|
121
120
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
package/partialrings/program.js
CHANGED
|
@@ -49,14 +49,14 @@ in float tail_angle; // the rotation of the partial circle
|
|
|
49
49
|
in vec4 color;
|
|
50
50
|
in float radius; // in meter
|
|
51
51
|
in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
52
|
-
flat out int vid;
|
|
53
|
-
out float v_phase;
|
|
52
|
+
// flat out int vid;
|
|
53
|
+
// flat out float v_phase;
|
|
54
54
|
out vec2 v_pos;
|
|
55
55
|
out vec4 v_color;
|
|
56
|
-
flat out float v_angle;
|
|
56
|
+
// flat out float v_angle;
|
|
57
57
|
|
|
58
58
|
void main() {
|
|
59
|
-
vid = gl_VertexID;
|
|
59
|
+
// vid = gl_VertexID;
|
|
60
60
|
if (color_mode == 2.0 || radius == 0.0) { return; }
|
|
61
61
|
float color_mode_ = color_mode;
|
|
62
62
|
if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
|
|
@@ -71,8 +71,7 @@ void main() {
|
|
|
71
71
|
vertexID -= 1.0;
|
|
72
72
|
}
|
|
73
73
|
float phase = ( vertexID / (edge_count - 1.0) );
|
|
74
|
-
v_angle = tail_angle;
|
|
75
|
-
|
|
74
|
+
// v_angle = tail_angle;
|
|
76
75
|
|
|
77
76
|
if ( color_mode_ == 1.0 ) {
|
|
78
77
|
if ( tail_angle < 0.0 ) {
|
|
@@ -111,11 +110,11 @@ void main() {
|
|
|
111
110
|
|
|
112
111
|
const fragmentShaderSource = `#version 300 es` + POLE + PI + `
|
|
113
112
|
precision highp float;
|
|
114
|
-
flat in int vid;
|
|
113
|
+
// flat in int vid;
|
|
115
114
|
in vec4 v_color;
|
|
116
115
|
in vec2 v_pos;
|
|
117
|
-
flat in float v_phase;
|
|
118
|
-
in float v_angle;
|
|
116
|
+
// flat in float v_phase;
|
|
117
|
+
// in float v_angle;
|
|
119
118
|
out vec4 outColor;
|
|
120
119
|
void main() {
|
|
121
120
|
// if( vid % 2 == 0 ) { discard; }
|
|
@@ -137,7 +136,6 @@ export class Logic {
|
|
|
137
136
|
this._lastAlphaMultiplier = 1.0;
|
|
138
137
|
|
|
139
138
|
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
140
|
-
|
|
141
139
|
const { gl, program } = this;
|
|
142
140
|
{ // set attributes locations
|
|
143
141
|
gl.bindAttribLocation(program, 0, 'center');
|
|
@@ -220,9 +220,9 @@ export class BufferManager extends BufferOffsetManager {
|
|
|
220
220
|
}
|
|
221
221
|
const requiredSpace = this.__requiredSpaceForBulk(data);
|
|
222
222
|
const spaceLeft = this.spaceLeft;
|
|
223
|
-
console.log("space left:", spaceLeft, "required space:", requiredSpace);
|
|
223
|
+
// console.log("space left:", spaceLeft, "required space:", requiredSpace);
|
|
224
224
|
if (requiredSpace > spaceLeft) {
|
|
225
|
-
console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
|
|
225
|
+
// console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
|
|
226
226
|
this.extendBuffer(this.capacity + requiredSpace - spaceLeft);
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -114,16 +114,16 @@ class Logic {
|
|
|
114
114
|
// draw instanced
|
|
115
115
|
if (padCount !== this._padCount) {
|
|
116
116
|
this._padCount = padCount;
|
|
117
|
-
console.log("padCount", padCount);
|
|
117
|
+
// console.log("padCount", padCount);
|
|
118
118
|
gl.uniform1f(_padCountLocation, padCount);
|
|
119
119
|
}
|
|
120
120
|
if (compass !== this._compassMode) {
|
|
121
|
-
console.log("compass", compass);
|
|
121
|
+
// console.log("compass", compass);
|
|
122
122
|
gl.uniform1i(_compassLocation, compass);
|
|
123
123
|
this._compassMode = compass;
|
|
124
124
|
}
|
|
125
125
|
if (opacity !== this._opacity) {
|
|
126
|
-
console.log("opacity", opacity);
|
|
126
|
+
// console.log("opacity", opacity);
|
|
127
127
|
this._opacity = opacity;
|
|
128
128
|
gl.uniform1f(this._opacityLocation, opacity);
|
|
129
129
|
}
|
package/rangerings/rangerings.js
CHANGED
|
@@ -87,7 +87,6 @@ export default class {
|
|
|
87
87
|
const { circleFlatProgram, paddyFlatProgram, paddingFreeAngleProgram, bufferManager, compass, gl, circleEdgeCount, paddingBufferManager, _opacity } = this;
|
|
88
88
|
if (this.bufferManager !== null && bufferManager.length > 0) {
|
|
89
89
|
gl.disable(gl.DEPTH_TEST);
|
|
90
|
-
console.log("the opacity", _opacity);
|
|
91
90
|
circleFlatProgram.draw(bufferManager, compass, circleEdgeCount, _opacity);
|
|
92
91
|
if (this._onedegreepaddingOn) paddyFlatProgram.draw(bufferManager, 360, compass, _opacity);
|
|
93
92
|
paddingFreeAngleProgram.draw(paddingBufferManager, compass, _opacity);
|
|
@@ -67,12 +67,12 @@ export class BufferManager {
|
|
|
67
67
|
|
|
68
68
|
const newArray = new Float32Array(newCapacity * itemSize);
|
|
69
69
|
const bufferData = this._getBufferData(occupiedCapacity);
|
|
70
|
-
console.log("bufferData", bufferData);
|
|
70
|
+
// console.log("bufferData", bufferData);
|
|
71
71
|
let newOffset = 0;
|
|
72
72
|
for (const offset of offsetValues) {
|
|
73
73
|
const itemOffset = offset * itemSize;
|
|
74
74
|
newArray.set(bufferData.slice(itemOffset, itemOffset + itemSize), newOffset);
|
|
75
|
-
console.log("oldOffset", itemOffset, "newOffset", newOffset);
|
|
75
|
+
// console.log("oldOffset", itemOffset, "newOffset", newOffset);
|
|
76
76
|
newOffset += itemSize;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -87,7 +87,7 @@ export class BufferManager {
|
|
|
87
87
|
const { gl, buffer, bufferType } = this;
|
|
88
88
|
const itemSize = this.itemSize;
|
|
89
89
|
const bufferData = this._getBufferData(occupiedCapacity);
|
|
90
|
-
console.log("extending buffer from", occupiedCapacity, "to", newCapacity, 'item size', itemSize);
|
|
90
|
+
// console.log("extending buffer from", occupiedCapacity, "to", newCapacity, 'item size', itemSize);
|
|
91
91
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
92
92
|
gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
|
|
93
93
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
@@ -96,9 +96,9 @@ export class BufferManager {
|
|
|
96
96
|
|
|
97
97
|
_getBufferData(occupiedCapacity) {
|
|
98
98
|
const { gl, buffer } = this;
|
|
99
|
-
console.log(occupiedCapacity, this.itemSize)
|
|
99
|
+
// console.log(occupiedCapacity, this.itemSize)
|
|
100
100
|
const size = occupiedCapacity * this.itemSize;
|
|
101
|
-
console.log("size", size);
|
|
101
|
+
// console.log("size", size);
|
|
102
102
|
const bufferData = new Float32Array(size);
|
|
103
103
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
104
104
|
gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
@@ -102,6 +102,8 @@
|
|
|
102
102
|
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
|
+
const EXTRA_SIZE = 10;
|
|
106
|
+
|
|
105
107
|
export class BufferOrchestrator {
|
|
106
108
|
|
|
107
109
|
constructor({ capacity = 10 } = {}) {
|
|
@@ -172,7 +174,7 @@ export class BufferOrchestrator {
|
|
|
172
174
|
for (const [key, { bufferManager }] of bufferManagersMap) {
|
|
173
175
|
bufferManager.deleteBulk(offsets);
|
|
174
176
|
}
|
|
175
|
-
console.log("deleteBulk after item size", this.offsetMap.size);
|
|
177
|
+
//console.log("deleteBulk after item size", this.offsetMap.size);
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
|
|
@@ -196,9 +198,9 @@ export class BufferOrchestrator {
|
|
|
196
198
|
autoExtendBuffers(itemsLength, bufferManagersMap) {
|
|
197
199
|
if (itemsLength <= this.emptySpace) return;
|
|
198
200
|
const newCapacity = this.length + itemsLength;
|
|
199
|
-
console.log("autoExtendBuffers", "item L", itemsLength, "E space", this.emptySpace, "cap", this.capacity, "length", this.length, 'new Cap', newCapacity);
|
|
201
|
+
//console.log("autoExtendBuffers", "item L", itemsLength, "E space", this.emptySpace, "cap", this.capacity, "length", this.length, 'new Cap', newCapacity);
|
|
200
202
|
for (const [key, { bufferManager }] of bufferManagersMap) {
|
|
201
|
-
console.log("length", this.length, "newCapacity", newCapacity);
|
|
203
|
+
//console.log("length", this.length, "newCapacity", newCapacity);
|
|
202
204
|
bufferManager.extendBuffer(this.length, newCapacity);
|
|
203
205
|
}
|
|
204
206
|
this._capacity = newCapacity;
|
|
@@ -207,23 +209,23 @@ export class BufferOrchestrator {
|
|
|
207
209
|
|
|
208
210
|
defrag(bufferManagers, bufferKeys) { // TODO defrag and leave some empty space
|
|
209
211
|
const offsetMap = this.offsetMap;
|
|
210
|
-
|
|
212
|
+
const newCapacity = offsetMap.size + EXTRA_SIZE;
|
|
211
213
|
if (bufferKeys) {
|
|
212
214
|
for (const key of bufferKeys) {
|
|
213
215
|
const offset = offsetMap.get(key);
|
|
214
216
|
if (offset !== undefined) {
|
|
215
217
|
for (const [key, { bufferManager }] of bufferManagers) {
|
|
216
|
-
bufferManager.defrag([offset], this.length,
|
|
218
|
+
bufferManager.defrag([offset], this.length, newCapacity);
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
} else {
|
|
221
223
|
for (const [key, { bufferManager }] of bufferManagers) {
|
|
222
|
-
bufferManager.defrag(offsetMap.values(), this.length,
|
|
224
|
+
bufferManager.defrag(offsetMap.values(), this.length, newCapacity);
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
this._defrag();
|
|
226
|
-
this._length = this._capacity =
|
|
228
|
+
this._length = this._capacity = newCapacity;
|
|
227
229
|
this.tombstoneOffsets = [];
|
|
228
230
|
}
|
|
229
231
|
|
|
@@ -233,7 +235,7 @@ export class BufferOrchestrator {
|
|
|
233
235
|
const newOffsetMap = new Map();
|
|
234
236
|
let newOffset = 0;
|
|
235
237
|
for (const [key, offset] of this.offsetMap) {
|
|
236
|
-
console.log("defrag", key, offset, newOffset);
|
|
238
|
+
//console.log("defrag", key, offset, newOffset);
|
|
237
239
|
newOffsetMap.set(key, newOffset++);
|
|
238
240
|
}
|
|
239
241
|
this.offsetMap = newOffsetMap
|
|
@@ -27,10 +27,10 @@ export class GeoDataFromTexture {
|
|
|
27
27
|
getFloored(lat, long) {
|
|
28
28
|
const x = (long - this.bbox[0]) / this._longRatio;
|
|
29
29
|
const y = (lat - this.bbox[1]) / this._latRatio;
|
|
30
|
-
console.log(x + " = (" + long + " - " + this.bbox[0] + ") / " + this._longRatio);
|
|
31
|
-
console.log(y + " = (" + lat + " - " + this.bbox[1] + ") / " + this._latRatio);
|
|
30
|
+
//console.log(x + " = (" + long + " - " + this.bbox[0] + ") / " + this._longRatio);
|
|
31
|
+
//console.log(y + " = (" + lat + " - " + this.bbox[1] + ") / " + this._latRatio);
|
|
32
32
|
const index = Math.floor(y) * this.width + Math.floor(x);
|
|
33
|
-
console.log({ index, x, y, w: this.width, h: this.height, "total": this.width * this.height });
|
|
33
|
+
//console.log({ index, x, y, w: this.width, h: this.height, "total": this.width * this.height });
|
|
34
34
|
return this.textureData[index];
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -9,7 +9,7 @@ function instantDebounce(func, delay) {
|
|
|
9
9
|
if (runAtEnd) {
|
|
10
10
|
func(...lastArgs);
|
|
11
11
|
lastArgs = null;
|
|
12
|
-
console.log("processed with delay")
|
|
12
|
+
// console.log("processed with delay")
|
|
13
13
|
runAtEnd = false;
|
|
14
14
|
}
|
|
15
15
|
timeout = null;
|
|
@@ -23,7 +23,7 @@ function instantDebounce(func, delay) {
|
|
|
23
23
|
return;
|
|
24
24
|
} else {
|
|
25
25
|
func(...args);
|
|
26
|
-
console.log("processed instantly")
|
|
26
|
+
// console.log("processed instantly")
|
|
27
27
|
timeout = timeoutMethod();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -7,7 +7,7 @@ import { latLongBboxtoPixelXYBbox } from "..";
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TextureToGlobeProgram {
|
|
10
|
-
constructor
|
|
10
|
+
constructor(gl, globe) {
|
|
11
11
|
this.globe = globe;
|
|
12
12
|
this.gl = gl;
|
|
13
13
|
this._is3D = true;
|
|
@@ -19,7 +19,7 @@ class TextureToGlobeProgram {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
_initUniforms() {
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
const { gl, _programWrapper } = this;
|
|
24
24
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
25
25
|
gl.useProgram(_programWrapper.program);
|
|
@@ -32,7 +32,7 @@ class TextureToGlobeProgram {
|
|
|
32
32
|
gl.uniform1f(_programWrapper.u_is3D, 1.0);
|
|
33
33
|
gl.uniform1f(_programWrapper.height, 0.0);
|
|
34
34
|
gl.useProgram(currentProgram);
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
_createProgramWrapper() {
|
|
@@ -94,7 +94,7 @@ class TextureToGlobeProgram {
|
|
|
94
94
|
|
|
95
95
|
const program = createProgram(gl, vertexSource, fragmentSource);
|
|
96
96
|
const vao = gl.createVertexArray();
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
const buffer = gl.createBuffer();
|
|
99
99
|
gl.bindVertexArray(vao);
|
|
100
100
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
@@ -104,7 +104,7 @@ class TextureToGlobeProgram {
|
|
|
104
104
|
1, 1,
|
|
105
105
|
0, 1
|
|
106
106
|
]), gl.STATIC_DRAW);
|
|
107
|
-
const a_position
|
|
107
|
+
const a_position = - gl.getAttribLocation(program, 'a_position');
|
|
108
108
|
gl.enableVertexAttribArray(a_position);
|
|
109
109
|
gl.vertexAttribPointer(a_position, 2, gl.FLOAT, false, 0, 0);
|
|
110
110
|
gl.bindVertexArray(null);
|
|
@@ -123,8 +123,8 @@ class TextureToGlobeProgram {
|
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
draw(
|
|
127
|
-
console.log('draw')
|
|
126
|
+
draw(modelViewMatrix, projectionMatrix, transPos, texture) {
|
|
127
|
+
// console.log('draw')
|
|
128
128
|
const { gl, _programWrapper, _is3D } = this;
|
|
129
129
|
gl.useProgram(_programWrapper.program);
|
|
130
130
|
gl.bindVertexArray(_programWrapper.vao);
|
|
@@ -138,12 +138,12 @@ class TextureToGlobeProgram {
|
|
|
138
138
|
const mapWH = this.globe.api_GetCurrentWorldWH();
|
|
139
139
|
gl.uniform2f(_programWrapper.u_mapWH, mapWH.width, mapWH.height);
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
143
143
|
gl.drawArrays(gl.POINTS, 0, 4);
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
setBBox(
|
|
145
|
+
|
|
146
|
+
setBBox(minx, maxx, miny, maxy) {
|
|
147
147
|
const { gl, _programWrapper } = this;
|
|
148
148
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
149
149
|
gl.useProgram(_programWrapper.program);
|
|
@@ -155,7 +155,7 @@ class TextureToGlobeProgram {
|
|
|
155
155
|
gl.useProgram(currentProgram);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
setLatLongBBox(minx, maxx, miny, maxy){
|
|
158
|
+
setLatLongBBox(minx, maxx, miny, maxy) {
|
|
159
159
|
const bboxMatrix = latLongBboxtoPixelXYBbox(minx, miny, maxx, maxy);
|
|
160
160
|
const { gl, _programWrapper } = this;
|
|
161
161
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
@@ -165,7 +165,7 @@ class TextureToGlobeProgram {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
setScreenWH(){
|
|
168
|
+
setScreenWH() {
|
|
169
169
|
const { gl, _programWrapper, globe } = this;
|
|
170
170
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
171
171
|
gl.useProgram(_programWrapper.program);
|
|
@@ -179,7 +179,7 @@ class TextureToGlobeProgram {
|
|
|
179
179
|
this.setScreenWH();
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
setGeometry(
|
|
182
|
+
setGeometry() {
|
|
183
183
|
const { gl, globe, _programWrapper } = this;
|
|
184
184
|
this._is3D = globe.api_GetCurrentGeometry() === 0;
|
|
185
185
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
@@ -189,15 +189,15 @@ class TextureToGlobeProgram {
|
|
|
189
189
|
this.resize();
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
free(){
|
|
192
|
+
free() {
|
|
193
193
|
window.removeEventListener('resize',
|
|
194
|
-
|
|
194
|
+
this._resizeHandler, true);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
_resizeEventHandler(){
|
|
197
|
+
_resizeEventHandler() {
|
|
198
198
|
this.resize();
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
export {TextureToGlobeProgram};
|
|
203
|
+
export { TextureToGlobeProgram };
|
|
@@ -102,22 +102,22 @@ vec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float
|
|
|
102
102
|
tangent1 = normalize(tangent1);
|
|
103
103
|
// rotate tangent with given angle
|
|
104
104
|
tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);
|
|
105
|
-
|
|
105
|
+
float radius_in_angle = radius/R;
|
|
106
|
+
float projected_radius = sin(radius_in_angle) * R / 1000.0;
|
|
107
|
+
return (geoW * cos(radius_in_angle))+ tangent1 * projected_radius;
|
|
106
108
|
}
|
|
107
109
|
`;
|
|
108
110
|
|
|
109
111
|
// TODO: Make it precise. Y axis is not correct.
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
export const circleLimpFromLongLatRadCenterMercatorRealDistance = `
|
|
113
|
+
export const circleLimpFromLongLatRadCenterMercatorRealDistance = PI + `
|
|
113
114
|
vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle){
|
|
114
|
-
float
|
|
115
|
-
float
|
|
116
|
-
float
|
|
117
|
-
float
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return vec2(x, y);
|
|
115
|
+
float ang = angle + PI / 2.0; // this is there because the other methods are implemented in, angle 0 is +x axis orientatation
|
|
116
|
+
float r = radius / R;
|
|
117
|
+
float sin_lat = sin( center.y) * cos(r) + cos(center.y)*sin(r)* cos(ang);
|
|
118
|
+
float lat = asin(sin_lat);
|
|
119
|
+
float longi = center.x + atan( sin(ang) * sin(r) * cos(center.y), cos(r) - sin(center.y) * sin_lat);
|
|
120
|
+
return longLatRadToMercator(vec2(longi, lat));
|
|
121
121
|
}
|
|
122
122
|
`;
|
|
123
123
|
|
|
@@ -206,7 +206,7 @@ export const angleBetweenTwoPointsRadian = `
|
|
|
206
206
|
float angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {
|
|
207
207
|
float start_lat = log( tan( ( 1.0 - start_.y ) * PI / 2.0 ) );
|
|
208
208
|
float end_lat = log( tan( ( 1.0 - end_.y ) * PI / 2.0 ) );
|
|
209
|
-
float angle = atan( (end_lat - start_lat )/ (end_.x - start_.x));
|
|
209
|
+
float angle = atan( (end_lat - start_lat ) / (end_.x - start_.x));
|
|
210
210
|
return angle;
|
|
211
211
|
}
|
|
212
212
|
`
|