@pirireis/webglobeplugins 0.1.6 → 0.1.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/compassrose/compassrose-2d.js +29 -0
- package/compassrose/compassrose.js +9 -3
- package/package.json +1 -1
- package/programs/index.js +1 -1
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/program.js +115 -0
- package/programs/rings/distancering/circleflatprogram.js +28 -24
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +21 -12
- package/programs/rings/distancering/index.js +2 -2
- package/programs/rings/distancering/paddyflatprogram.js +22 -6
- package/programs/rings/index.js +1 -9
- package/rangerings/index.js +2 -1
- package/rangerings/rangeringangletext.js +2 -2
- package/rangerings/rangerings.js +29 -13
- package/util/account/bufferoffsetmanager.js +4 -2
- package/waveparticles/index.js +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// TODO: Implement compass rose in 2D
|
|
2
|
+
// TODO: enrich cameraBlockTotem with globe tile and more...
|
|
3
|
+
|
|
4
|
+
const vertexShader = `#version 300 es
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
in vec2 center;
|
|
8
|
+
in float pixel_radius;
|
|
9
|
+
in vec4 color;
|
|
10
|
+
out vec4 v_color;
|
|
11
|
+
void main() {
|
|
12
|
+
const float PI = 3.14159265359;
|
|
13
|
+
float angle = float(gl_VertexID) / 180.0 * PI;
|
|
14
|
+
vec2 limp = vec2(
|
|
15
|
+
|
|
16
|
+
)
|
|
17
|
+
vec2 position =
|
|
18
|
+
v_color = color;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const fragmentShader = `#version 300 es
|
|
23
|
+
precision mediump float;
|
|
24
|
+
in vec4 v_color;
|
|
25
|
+
out vec4 outColor;
|
|
26
|
+
void main() {
|
|
27
|
+
outColor = v_color;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -132,8 +132,8 @@ const object = {
|
|
|
132
132
|
"x": 16,
|
|
133
133
|
"y": -16
|
|
134
134
|
},
|
|
135
|
-
"vAlignment":
|
|
136
|
-
"hAlignment":
|
|
135
|
+
"vAlignment": 2,
|
|
136
|
+
"hAlignment": 2,
|
|
137
137
|
"size": 20,
|
|
138
138
|
"hollowColor": "#000",
|
|
139
139
|
"textColor": "#FFF",
|
|
@@ -219,7 +219,8 @@ export default class CompassRose {
|
|
|
219
219
|
|
|
220
220
|
this.primaryKey = primaryKey;
|
|
221
221
|
|
|
222
|
-
this.object =
|
|
222
|
+
this.object = structuredClone(object);
|
|
223
|
+
this.object.id = id;
|
|
223
224
|
|
|
224
225
|
setIconSize(this.object, size);
|
|
225
226
|
if (imageURL) {
|
|
@@ -320,6 +321,10 @@ export default class CompassRose {
|
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
323
|
|
|
324
|
+
removeFromMap() {
|
|
325
|
+
this.globe.ObjectArray.Delete(this.id);
|
|
326
|
+
}
|
|
327
|
+
|
|
323
328
|
|
|
324
329
|
// private
|
|
325
330
|
_setData(data) {
|
|
@@ -337,6 +342,7 @@ export default class CompassRose {
|
|
|
337
342
|
globe.ObjectArray.UpdateData(object, operation, [data], canChange);
|
|
338
343
|
}
|
|
339
344
|
|
|
345
|
+
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
const getID = (data, primaryKey) => data.attribs[primaryKey];
|
package/package.json
CHANGED
package/programs/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import ArrowField from "./arrowfield";
|
|
|
5
5
|
import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
|
|
6
6
|
import * as vectorfield from "./vectorfields";
|
|
7
7
|
import { FadeAway } from "./helpers";
|
|
8
|
-
import rings from "./rings";
|
|
8
|
+
import * as rings from "./rings";
|
|
9
9
|
export {
|
|
10
10
|
Float2LegendWithRatio,
|
|
11
11
|
GlobeShellWiggle,
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { CameraUniformBlockString, CameraUniformBlockTotem } from "../totems";
|
|
2
|
+
import { longLatRadToMercator, longLatRadToCartesian3D, cartesian3DToGLPosition, mercatorXYTo2DPoint } from "../shaderfunctions/geometrytransformations";
|
|
3
|
+
import { createProgram } from "../webgl/program";
|
|
4
|
+
import { noRegisterGlobeProgramCache, globeProgramCache } from "../programcache";
|
|
5
|
+
import { BufferOffsetManger } from "../../util/account";
|
|
6
|
+
|
|
7
|
+
const GLOBE_MIDPOINT_COUNT = 100;
|
|
8
|
+
const ITEM_SIZE = 8;
|
|
9
|
+
|
|
10
|
+
const vertexShader = `#version 300 es
|
|
11
|
+
precision highp float;
|
|
12
|
+
${CameraUniformBlockString}
|
|
13
|
+
${longLatRadToMercator}
|
|
14
|
+
${longLatRadToCartesian3D}
|
|
15
|
+
${cartesian3DToGLPosition}
|
|
16
|
+
${mercatorXYTo2DPoint}
|
|
17
|
+
|
|
18
|
+
in vec2 start_position;
|
|
19
|
+
in vec2 end_position;
|
|
20
|
+
in vec4 color;
|
|
21
|
+
out vec4 v_color;
|
|
22
|
+
|
|
23
|
+
void main() {
|
|
24
|
+
|
|
25
|
+
vec2 longLat;
|
|
26
|
+
if (is3D) {
|
|
27
|
+
float interpolation = float(gl_VertexID) / ${GLOBE_MIDPOINT_COUNT}.0;
|
|
28
|
+
longLat = mix(start_position, end_position, interpolation)
|
|
29
|
+
vec3 cartesian = longLatRadToMercator(longLat);
|
|
30
|
+
gl_Position = cartesian3DToGLPosition(cartesian);
|
|
31
|
+
} else {
|
|
32
|
+
if ( gl_VertexID == 0 ) {
|
|
33
|
+
longLat = start_position;
|
|
34
|
+
} else {
|
|
35
|
+
longLat = end_position;
|
|
36
|
+
}
|
|
37
|
+
vec2 mercator = longLatRadToMercator(longLat);
|
|
38
|
+
gl_Position = mercatorXYTo2DPoint(mercator);
|
|
39
|
+
}
|
|
40
|
+
v_color = color;
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
|
|
44
|
+
const fragmentShader = `#version 300 es
|
|
45
|
+
precision highp float;
|
|
46
|
+
in vec4 v_color;
|
|
47
|
+
out vec4 color;
|
|
48
|
+
void main() {
|
|
49
|
+
color = v_color;
|
|
50
|
+
}
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Logic {
|
|
55
|
+
|
|
56
|
+
constructor(globe) {
|
|
57
|
+
this.globe = globe;
|
|
58
|
+
this.gl = gl;
|
|
59
|
+
this.program = createProgram(gl, vertexShader, fragmentShader);
|
|
60
|
+
const { gl, program } = this;
|
|
61
|
+
{
|
|
62
|
+
// assign attribute locations
|
|
63
|
+
gl.bindAttribLocation(program, 0, "start_position");
|
|
64
|
+
gl.bindAttribLocation(program, 1, "end_position");
|
|
65
|
+
gl.bindAttribLocation(program, 2, "color");
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
this.cameraBlockBindingPoint = 0;
|
|
71
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
72
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
draw(bufferManager) {
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class BufferManager extends BufferOffsetManger {
|
|
87
|
+
|
|
88
|
+
constructor(gl, { capacity = 10, bufferType = "DYNAMIC_DRAW" } = {}) {
|
|
89
|
+
super(ITEM_SIZE, { capacity, bufferType });
|
|
90
|
+
this.gl = gl;
|
|
91
|
+
this.buffer = gl.createBuffer();
|
|
92
|
+
|
|
93
|
+
const { gl, buffer } = this;
|
|
94
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
95
|
+
gl.bufferData(gl.ARRAY_BUFFER, _capacity * ITEM_SIZE * 4, gl[bufferType]);
|
|
96
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
97
|
+
|
|
98
|
+
this.vao = gl.createVertexArray();
|
|
99
|
+
{
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
insertBulk(items) {
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export const programCache = Object.freeze({
|
|
112
|
+
get: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
113
|
+
release: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
114
|
+
});
|
|
115
|
+
|
|
@@ -2,7 +2,7 @@ import { createProgram, shaderfunctions } from "../../../util";
|
|
|
2
2
|
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
3
3
|
import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
|
|
4
4
|
|
|
5
|
-
const CIRCLE_EDGE_COUNT =
|
|
5
|
+
const CIRCLE_EDGE_COUNT = 360;
|
|
6
6
|
|
|
7
7
|
const vertexShader = `#version 300 es ` +
|
|
8
8
|
shaderfunctions.PI +
|
|
@@ -19,6 +19,8 @@ const vertexShader = `#version 300 es ` +
|
|
|
19
19
|
uniform int compass;
|
|
20
20
|
uniform float circle_edge_count;
|
|
21
21
|
|
|
22
|
+
uniform float opacity;
|
|
23
|
+
|
|
22
24
|
in vec2 center;
|
|
23
25
|
in float radius;
|
|
24
26
|
in vec4 color;
|
|
@@ -28,7 +30,7 @@ out vec2 v_limp;
|
|
|
28
30
|
|
|
29
31
|
void main() {
|
|
30
32
|
if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
|
|
31
|
-
v_color = color;
|
|
33
|
+
v_color = vec4(color.rgb, color.a * opacity);
|
|
32
34
|
if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
|
|
33
35
|
float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
|
|
34
36
|
if ( is3D ){
|
|
@@ -76,36 +78,49 @@ class Logic {
|
|
|
76
78
|
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
77
79
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
78
80
|
|
|
81
|
+
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
79
82
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
80
83
|
this._circleEdgeCountLocation = this.gl.getUniformLocation(this.program, "circle_edge_count");
|
|
81
|
-
this.
|
|
84
|
+
this._circleEdgeCount = CIRCLE_EDGE_COUNT;
|
|
82
85
|
this._compassmode = 1;
|
|
86
|
+
this._opacity = 1.0;
|
|
83
87
|
{
|
|
84
88
|
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
85
89
|
this.gl.useProgram(this.program);
|
|
86
90
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
87
91
|
this.gl.uniform1f(this._circleEdgeCountLocation, CIRCLE_EDGE_COUNT);
|
|
92
|
+
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
93
|
+
|
|
88
94
|
this.gl.useProgram(currentProgram);
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
|
|
94
|
-
draw(attrBufferManager, compass,
|
|
100
|
+
draw(attrBufferManager, compass, circleEdgeCount, opacity) {
|
|
95
101
|
const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
96
102
|
gl.useProgram(program);
|
|
97
103
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
98
104
|
attrBufferManager.bindCircleVAO();
|
|
99
105
|
|
|
100
|
-
if (compass !== this.
|
|
106
|
+
if (compass !== this._compassmode) {
|
|
101
107
|
gl.uniform1i(this._compassLocation, compass);
|
|
108
|
+
console.log("compass", compass);
|
|
102
109
|
this._compassmode = compass;
|
|
103
110
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.
|
|
111
|
+
|
|
112
|
+
if (opacity !== this._opacity) {
|
|
113
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
114
|
+
console.log("opacity", opacity);
|
|
115
|
+
this._opacity = opacity;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (circleEdgeCount !== this._circleEdgeCount) {
|
|
119
|
+
gl.uniform1f(this._circleEdgeCountLocation, circleEdgeCount);
|
|
120
|
+
console.log("circleEdgeCount", circleEdgeCount);
|
|
121
|
+
this._circleEdgeCount = circleEdgeCount;
|
|
107
122
|
}
|
|
108
|
-
gl.drawArraysInstanced(gl.LINE_LOOP, 0,
|
|
123
|
+
gl.drawArraysInstanced(gl.LINE_LOOP, 0, circleEdgeCount, attrBufferManager.length);
|
|
109
124
|
gl.bindVertexArray(null);
|
|
110
125
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
111
126
|
}
|
|
@@ -118,18 +133,7 @@ class Logic {
|
|
|
118
133
|
}
|
|
119
134
|
|
|
120
135
|
|
|
121
|
-
export
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.logic = noRegisterGlobeProgramCache.getProgram(globe, Logic);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
draw(attrBufferManager, compass, circle_edge_count) {
|
|
129
|
-
this.logic.draw(attrBufferManager, compass, circle_edge_count);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
free() {
|
|
133
|
-
noRegisterGlobeProgramCache.releaseProgram(this.gl, Logic);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
+
export const programCache = Object.freeze({
|
|
137
|
+
getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
138
|
+
releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
139
|
+
});
|
|
@@ -25,13 +25,16 @@ in float pad_angle;
|
|
|
25
25
|
|
|
26
26
|
uniform int compass;
|
|
27
27
|
|
|
28
|
+
uniform float opacity;
|
|
29
|
+
|
|
28
30
|
out vec2 v_limp;
|
|
29
31
|
out vec4 v_color;
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
void main() {
|
|
33
35
|
if( flag == 1.0 || radius == 0.0 ) return; // 1.0 is hide
|
|
34
|
-
v_color = color;
|
|
36
|
+
v_color = vec4(color.rgb, color.a * opacity);
|
|
37
|
+
|
|
35
38
|
if ( pad_angle == 0.0 ) v_color.rgb -= 0.2;
|
|
36
39
|
gl_PointSize = 2.0;
|
|
37
40
|
|
|
@@ -80,12 +83,13 @@ class Logic {
|
|
|
80
83
|
|
|
81
84
|
{
|
|
82
85
|
const gl = this.gl;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
// assign attribute locations
|
|
87
|
+
gl.bindAttribLocation(this.program, 0, "center");
|
|
88
|
+
gl.bindAttribLocation(this.program, 1, "radius");
|
|
89
|
+
gl.bindAttribLocation(this.program, 2, "pad_range");
|
|
90
|
+
gl.bindAttribLocation(this.program, 3, "color");
|
|
91
|
+
gl.bindAttribLocation(this.program, 4, "flag");
|
|
92
|
+
gl.bindAttribLocation(this.program, 5, "pad_angle");
|
|
89
93
|
|
|
90
94
|
}
|
|
91
95
|
|
|
@@ -94,19 +98,20 @@ class Logic {
|
|
|
94
98
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
95
99
|
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
96
100
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
102
|
+
this._opacity = 1.0;
|
|
99
103
|
{
|
|
100
104
|
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
101
105
|
this.gl.useProgram(this.program);
|
|
102
106
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
107
|
+
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
103
108
|
this._lastCompass = 1;
|
|
104
109
|
this.gl.useProgram(currentProgram);
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
|
|
109
|
-
draw(attrBufferManager, compass) {
|
|
114
|
+
draw(attrBufferManager, compass, opacity) {
|
|
110
115
|
|
|
111
116
|
const { gl, program, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
112
117
|
|
|
@@ -117,6 +122,10 @@ class Logic {
|
|
|
117
122
|
gl.uniform1i(_compassLocation, compass);
|
|
118
123
|
this._lastCompass = compass;
|
|
119
124
|
}
|
|
125
|
+
if (opacity !== this._opacity) {
|
|
126
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
127
|
+
this._opacity = opacity;
|
|
128
|
+
}
|
|
120
129
|
gl.disable(gl.DEPTH_TEST);
|
|
121
130
|
gl.drawArraysInstanced(gl.LINES, 0, 2, attrBufferManager.length);
|
|
122
131
|
gl.enable(gl.DEPTH_TEST);
|
|
@@ -124,7 +133,7 @@ class Logic {
|
|
|
124
133
|
gl.bindVertexArray(null);
|
|
125
134
|
|
|
126
135
|
}
|
|
127
|
-
|
|
136
|
+
createBuffer({ bufferType = "DYNAMIC_DRAW", initialRingCapacity = 10 } = {}) {
|
|
128
137
|
return new BufferManager(this.gl, bufferType, initialRingCapacity);
|
|
129
138
|
|
|
130
139
|
}
|
|
@@ -214,7 +223,7 @@ export class BufferManager extends BufferOffsetManager {
|
|
|
214
223
|
console.log("space left:", spaceLeft, "required space:", requiredSpace);
|
|
215
224
|
if (requiredSpace > spaceLeft) {
|
|
216
225
|
console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
|
|
217
|
-
this.extendBuffer(
|
|
226
|
+
this.extendBuffer(this.capacity + requiredSpace - spaceLeft);
|
|
218
227
|
}
|
|
219
228
|
|
|
220
229
|
const items = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { programCache as circleProgramCache } from './circleflatprogram';
|
|
2
2
|
import PaddyFlatProgram from './paddyflatprogram';
|
|
3
3
|
import CirclePaddySharedBuffer from './circlepaddysharedbuffer';
|
|
4
4
|
import { PaddingFreeAngleCache } from './circlepaddingfreeangleprogram';
|
|
5
|
-
export {
|
|
5
|
+
export { circleProgramCache, PaddyFlatProgram, CirclePaddySharedBuffer, PaddingFreeAngleCache };
|
|
@@ -24,6 +24,9 @@ in float flag;
|
|
|
24
24
|
uniform int compass;
|
|
25
25
|
uniform float pad_count;
|
|
26
26
|
|
|
27
|
+
uniform float opacity;
|
|
28
|
+
|
|
29
|
+
|
|
27
30
|
out vec2 v_limp;
|
|
28
31
|
out vec4 v_color;
|
|
29
32
|
|
|
@@ -32,7 +35,7 @@ void main() {
|
|
|
32
35
|
|
|
33
36
|
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
34
37
|
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
35
|
-
v_color = vec4(color.rgb, alpha_padding);
|
|
38
|
+
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
36
39
|
|
|
37
40
|
gl_PointSize = 2.0;
|
|
38
41
|
|
|
@@ -86,27 +89,40 @@ class Logic {
|
|
|
86
89
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
87
90
|
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
88
91
|
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
89
|
-
|
|
92
|
+
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
90
93
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
91
|
-
|
|
94
|
+
this._compassMode = 1;
|
|
95
|
+
this._opacity = 1.0;
|
|
96
|
+
this._padCount = 360;
|
|
92
97
|
{
|
|
93
98
|
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
94
99
|
this.gl.useProgram(this.program);
|
|
95
100
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
96
101
|
this.gl.useProgram(currentProgram);
|
|
102
|
+
this.gl.uniform1f(this._padCountLocation, 360)
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
|
|
102
|
-
draw(attrBufferManager, padCount, compass) {
|
|
108
|
+
draw(attrBufferManager, padCount, compass, opacity) {
|
|
103
109
|
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
104
110
|
gl.useProgram(program);
|
|
105
111
|
attrBufferManager.bindPaddingVAO();
|
|
106
112
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
107
113
|
// draw instanced
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
if (padCount !== this._padCount) {
|
|
115
|
+
this._padCount = padCount;
|
|
116
|
+
gl.uniform1f(_padCountLocation, padCount);
|
|
117
|
+
}
|
|
118
|
+
if (compass !== this._compassMode) {
|
|
119
|
+
gl.uniform1i(_compassLocation, compass);
|
|
120
|
+
this._compassMode = compass;
|
|
121
|
+
}
|
|
122
|
+
if (opacity !== this._opacity) {
|
|
123
|
+
this._opacity = opacity;
|
|
124
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
125
|
+
}
|
|
110
126
|
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
111
127
|
gl.bindVertexArray(null);
|
|
112
128
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
package/programs/rings/index.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import CircleFlatProgram from './distancering/circleflatprogram';
|
|
3
|
-
import PaddyFlatProgram from './distancering/paddyflatprogram';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
CirclePaddySharedBuffer,
|
|
7
|
-
CircleFlatProgram,
|
|
8
|
-
PaddyFlatProgram,
|
|
9
|
-
};
|
|
1
|
+
export * from "./distancering";
|
package/rangerings/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import RangeRings from './rangerings';
|
|
2
|
+
import RangeRingAngleText from './rangeringangletext';
|
|
2
3
|
import { ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES } from './enum';
|
|
3
|
-
export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES };
|
|
4
|
+
export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES, RangeRingAngleText };
|
|
@@ -66,10 +66,10 @@ export default class RangeRingAngleText {
|
|
|
66
66
|
label.text = "`${aci}`"
|
|
67
67
|
// this.style.filter = [
|
|
68
68
|
// {
|
|
69
|
-
// rule: ["any", ["
|
|
69
|
+
// rule: ["any", ["===", "aci", "K"]],
|
|
70
70
|
// name: "startLODRule",
|
|
71
71
|
// style: {
|
|
72
|
-
//
|
|
72
|
+
// ...
|
|
73
73
|
// }
|
|
74
74
|
|
|
75
75
|
// }
|
package/rangerings/rangerings.js
CHANGED
|
@@ -3,7 +3,7 @@ import { COMPASS_MODES } from "./enum";
|
|
|
3
3
|
import { PaddingFreeAngleCache } from "../programs/rings/distancering";
|
|
4
4
|
|
|
5
5
|
import RangeRingAngleText from "./rangeringangletext";
|
|
6
|
-
const {
|
|
6
|
+
const { circleProgramCache, PaddyFlatProgram, CirclePaddySharedBuffer } = rings;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef RangeRingData
|
|
@@ -22,11 +22,12 @@ const { CircleFlatProgram, PaddyFlatProgram, CirclePaddySharedBuffer } = rings;
|
|
|
22
22
|
|
|
23
23
|
export default class {
|
|
24
24
|
|
|
25
|
-
constructor(id, { oneDegreePadding = true, compass = COMPASS_MODES.REAL, showNumbers = true, numbersStyle = null } = {}) {
|
|
25
|
+
constructor(id, { oneDegreePadding = true, compass = COMPASS_MODES.REAL, showNumbers = true, numbersStyle = null, opacity = 1 } = {}) {
|
|
26
26
|
this.id = id;
|
|
27
27
|
this.compass = compass;
|
|
28
28
|
this._showNumbers = showNumbers;
|
|
29
29
|
this._numbersStyle = numbersStyle;
|
|
30
|
+
this._opacity = opacity;
|
|
30
31
|
this.circleEdgeCount = 360;
|
|
31
32
|
this._onedegreepaddingOn = oneDegreePadding;
|
|
32
33
|
this.bufferManager = null;
|
|
@@ -40,7 +41,7 @@ export default class {
|
|
|
40
41
|
init(globe, gl) {
|
|
41
42
|
this.gl = gl;
|
|
42
43
|
this.globe = globe;
|
|
43
|
-
this.circleFlatProgram =
|
|
44
|
+
this.circleFlatProgram = circleProgramCache.getProgram(globe);
|
|
44
45
|
this.paddyFlatProgram = new PaddyFlatProgram(globe, gl);
|
|
45
46
|
this.paddingFreeAngleProgram = PaddingFreeAngleCache.getProgram(globe);
|
|
46
47
|
if (this._showNumbers) {
|
|
@@ -58,7 +59,10 @@ export default class {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
setOpacity(opacity) {
|
|
63
|
+
this._opacity = opacity;
|
|
64
|
+
this.globe.DrawRender();
|
|
65
|
+
}
|
|
62
66
|
|
|
63
67
|
setGeometry() {
|
|
64
68
|
this.textPlugin?.setGeometry();
|
|
@@ -66,16 +70,14 @@ export default class {
|
|
|
66
70
|
|
|
67
71
|
|
|
68
72
|
draw3D() {
|
|
69
|
-
const { circleFlatProgram, paddyFlatProgram, paddingFreeAngleProgram, bufferManager, compass, gl, circleEdgeCount, paddingBufferManager } = this;
|
|
70
|
-
// if (globe.api_GetCurrentGeometry() === 0) return; // do not draw in 3D mode
|
|
73
|
+
const { circleFlatProgram, paddyFlatProgram, paddingFreeAngleProgram, bufferManager, compass, gl, circleEdgeCount, paddingBufferManager, _opacity } = this;
|
|
71
74
|
if (this.bufferManager !== null && bufferManager.length > 0) {
|
|
72
75
|
gl.disable(gl.DEPTH_TEST);
|
|
73
76
|
// gl.enable(gl.BLEND);
|
|
74
77
|
// gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
75
|
-
circleFlatProgram.draw(bufferManager, compass, circleEdgeCount);
|
|
76
|
-
if (this._onedegreepaddingOn) paddyFlatProgram.draw(bufferManager, 360, compass);
|
|
77
|
-
paddingFreeAngleProgram.draw(paddingBufferManager, compass);
|
|
78
|
-
|
|
78
|
+
circleFlatProgram.draw(bufferManager, compass, circleEdgeCount, _opacity);
|
|
79
|
+
if (this._onedegreepaddingOn) paddyFlatProgram.draw(bufferManager, 360, compass, _opacity);
|
|
80
|
+
paddingFreeAngleProgram.draw(paddingBufferManager, compass, _opacity);
|
|
79
81
|
gl.enable(gl.DEPTH_TEST);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -96,7 +98,7 @@ export default class {
|
|
|
96
98
|
const { gl, globe } = this
|
|
97
99
|
this.bufferDrawType = bufferDrawType;
|
|
98
100
|
this.bufferManager = new CirclePaddySharedBuffer(gl, globe, { bufferType: bufferDrawType, initialRingCapacity: initialRingCapacity });
|
|
99
|
-
this.paddingBufferManager = this.paddingFreeAngleProgram.
|
|
101
|
+
this.paddingBufferManager = this.paddingFreeAngleProgram.createBuffer({ bufferType: bufferDrawType, initialRingCapacity });
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
|
|
@@ -117,6 +119,10 @@ export default class {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param {Array<{centerID, x, y}>} items
|
|
125
|
+
*/
|
|
120
126
|
updateCentersXY(items) {
|
|
121
127
|
this.bufferManager.updateCentersXY(items);
|
|
122
128
|
this.paddingBufferManager.updateCentersXY(items);
|
|
@@ -125,6 +131,9 @@ export default class {
|
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
|
|
134
|
+
/**
|
|
135
|
+
* @param {Array<{centerID, rgba:[4 numbers]}>} centerColors
|
|
136
|
+
*/
|
|
128
137
|
updateCentersColor(centerColors) {
|
|
129
138
|
this.bufferManager.updateCentersColor(centerColors);
|
|
130
139
|
this.paddingBufferManager.updateCentersColor(centerColors);
|
|
@@ -132,7 +141,9 @@ export default class {
|
|
|
132
141
|
}
|
|
133
142
|
|
|
134
143
|
|
|
135
|
-
|
|
144
|
+
/**
|
|
145
|
+
* @param {Array<{centerID}>} centerIds
|
|
146
|
+
*/
|
|
136
147
|
removeCenters(centerIds) {
|
|
137
148
|
this.bufferManager.removeCenters(centerIds);
|
|
138
149
|
this.paddingBufferManager.removeCenters(centerIds);
|
|
@@ -143,7 +154,10 @@ export default class {
|
|
|
143
154
|
|
|
144
155
|
}
|
|
145
156
|
|
|
146
|
-
|
|
157
|
+
/**
|
|
158
|
+
*
|
|
159
|
+
* @param {Array<{centerID, hide, textHide}>} centerHides
|
|
160
|
+
*/
|
|
147
161
|
updateCentersHide(centerHides) {
|
|
148
162
|
this.bufferManager.updateCentersHide(centerHides);
|
|
149
163
|
this.paddingBufferManager.updateCentersHide(centerHides);
|
|
@@ -153,6 +167,8 @@ export default class {
|
|
|
153
167
|
}
|
|
154
168
|
|
|
155
169
|
|
|
170
|
+
|
|
171
|
+
|
|
156
172
|
const ringItemsToCircleBufferInsertDataAdaptor = (ringItems) => {
|
|
157
173
|
|
|
158
174
|
const result = [];
|
|
@@ -116,7 +116,8 @@ export default class {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
extendBuffer(
|
|
119
|
+
extendBuffer(newCapacity) {
|
|
120
|
+
const { gl, buffer, bufferType } = this;
|
|
120
121
|
const itemSize = this.itemSize;
|
|
121
122
|
const bufferData = this._getBufferData();
|
|
122
123
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
@@ -136,7 +137,8 @@ export default class {
|
|
|
136
137
|
* @param {number} partOffset
|
|
137
138
|
* @returns
|
|
138
139
|
*/
|
|
139
|
-
_updatePartial(items, partOffset
|
|
140
|
+
_updatePartial(items, partOffset) {
|
|
141
|
+
const { gl, buffer } = this;
|
|
140
142
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
141
143
|
const partStart = partOffset * 4;
|
|
142
144
|
for (let { key, payload } of items) {
|
package/waveparticles/index.js
CHANGED