@pirireis/webglobeplugins 0.6.22 → 0.6.24-a
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 +3 -5
- package/package.json +1 -1
- package/programs/line-on-globe/circle-accurate-3d.js +2 -5
- package/programs/line-on-globe/circle-accurate-flat.js +24 -5
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +189 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +145 -0
- package/programs/line-on-globe/naive-accurate.js +0 -2
- package/programs/rings/distancering/paddyflatprogram2d.js +6 -7
- package/programs/rings/distancering/paddyflatprogram3d.js +2 -7
- package/rangerings/rangerings.js +9 -6
- package/rangerings-2/enum.js +7 -0
- package/rangerings-2/index.js +4 -0
- package/rangerings-2/plugin.js +546 -7
- package/rangerings-2/rangeringangletext.js +486 -0
- package/rangerings-2/ring-account.js +111 -0
- package/util/account/util.js +5 -2
package/bearing-line/plugin.js
CHANGED
|
@@ -66,7 +66,7 @@ export default class Plugin {
|
|
|
66
66
|
|
|
67
67
|
this.drawText = drawText;
|
|
68
68
|
|
|
69
|
-
this.circleFlatEdgeCount = circleFlatEdgeCount + 2
|
|
69
|
+
this.circleFlatEdgeCount = circleFlatEdgeCount + 2; //circleFlatEdgeCount;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
setDoDrawVRM(bool) {
|
|
@@ -230,8 +230,8 @@ export default class Plugin {
|
|
|
230
230
|
|
|
231
231
|
// normal circle
|
|
232
232
|
["circleDashAngle", {
|
|
233
|
-
'bufferManager': new BufferManager(gl,
|
|
234
|
-
'adaptor': (item) => new Float32Array(item.
|
|
233
|
+
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
234
|
+
'adaptor': (item) => new Float32Array([item.circleDashAngle / 360]),
|
|
235
235
|
}],
|
|
236
236
|
// CIRCLE Mercator
|
|
237
237
|
["rgbaMercator", {
|
|
@@ -476,9 +476,7 @@ export default class Plugin {
|
|
|
476
476
|
const result = []
|
|
477
477
|
for (const item of propertyIDs) {
|
|
478
478
|
result.push(item);
|
|
479
|
-
console.log(item + " is processing")
|
|
480
479
|
if (s.has(item)) {
|
|
481
|
-
console.log(item + "Mercator is added")
|
|
482
480
|
result.push(item + "Mercator");
|
|
483
481
|
}
|
|
484
482
|
}
|
package/package.json
CHANGED
|
@@ -45,14 +45,12 @@ out float interpolation;
|
|
|
45
45
|
out vec4 v_color;
|
|
46
46
|
out float v_dash_ratio;
|
|
47
47
|
out float v_dash_opacity;
|
|
48
|
-
out vec2 v_limp;
|
|
49
48
|
void main() {
|
|
50
49
|
interpolation = float( gl_VertexID ) / ${EDGE_COUNT_ON_SPHERE}.0;
|
|
51
50
|
if ( is3D ) {
|
|
52
51
|
float angle = PI * 2.0 * interpolation;
|
|
53
52
|
vec3 position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, radius, angle);
|
|
54
53
|
gl_Position = cartesian3DToGLPosition(position);
|
|
55
|
-
v_limp = vec2(0.0, 0.0);
|
|
56
54
|
} else {
|
|
57
55
|
return;
|
|
58
56
|
}
|
|
@@ -73,7 +71,6 @@ in float interpolation;
|
|
|
73
71
|
in vec2 v_limp;
|
|
74
72
|
out vec4 color;
|
|
75
73
|
void main() {
|
|
76
|
-
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ color = vec4(0.0,0.0,0.0,0.0); return; }
|
|
77
74
|
color = v_color;
|
|
78
75
|
color.a *= opacity;
|
|
79
76
|
if ( v_dash_ratio == 1.0 || v_dash_ratio == 0.0 ) return;
|
|
@@ -110,8 +107,8 @@ class Logic {
|
|
|
110
107
|
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
111
108
|
gl.bindAttribLocation(program, 1, "radius");
|
|
112
109
|
gl.bindAttribLocation(program, 2, "color");
|
|
113
|
-
gl.bindAttribLocation(program,
|
|
114
|
-
gl.bindAttribLocation(program,
|
|
110
|
+
gl.bindAttribLocation(program, 3, "dash_ratio");
|
|
111
|
+
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
this.cameraBindingPoint = 0;
|
|
@@ -69,8 +69,7 @@ void main() {
|
|
|
69
69
|
if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5 ) {
|
|
70
70
|
color.a *= v_dash_opacity;
|
|
71
71
|
}
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
72
|
+
}`;
|
|
74
73
|
|
|
75
74
|
|
|
76
75
|
|
|
@@ -180,9 +179,9 @@ const CircleCache = Object.freeze({
|
|
|
180
179
|
});
|
|
181
180
|
|
|
182
181
|
|
|
183
|
-
function centerCoords2dflatDataCreator(globe, centerLong, centerLat, targetLong, targetLat, { startAngleOfCircle = null, edgeCount = EDGE_COUNT } = {}) {
|
|
182
|
+
function centerCoords2dflatDataCreator(globe, centerLong, centerLat, targetLong, targetLat, { startAngleOfCircle = null, edgeCount = EDGE_COUNT, radiusOffset = 0 } = {}) {
|
|
184
183
|
const centerCoords2dflat = new Float32Array(edgeCount * 2);
|
|
185
|
-
const radius2d = globe.Math.GetDist2D(centerLong, centerLat, targetLong, targetLat);
|
|
184
|
+
const radius2d = globe.Math.GetDist2D(centerLong, centerLat, targetLong, targetLat) + radiusOffset;
|
|
186
185
|
let angle;
|
|
187
186
|
if (startAngleOfCircle === null) {
|
|
188
187
|
angle = globe.Math.GetAzimuthAngle(centerLong, centerLat, targetLong, targetLat);
|
|
@@ -205,6 +204,26 @@ function centerCoords2dflatDataCreator(globe, centerLong, centerLat, targetLong,
|
|
|
205
204
|
return centerCoords2dflat;
|
|
206
205
|
}
|
|
207
206
|
|
|
207
|
+
|
|
208
|
+
function centerCoords2dflatDataCreatorWithRadius(globe, centerLong, centerLat, radius2d, { startAngleOfCircle = null, edgeCount = EDGE_COUNT } = {}) {
|
|
209
|
+
const centerCoords2dflat = new Float32Array(edgeCount * 2);
|
|
210
|
+
const pointsLongLat = globe.Math.GetEllipseGeo(
|
|
211
|
+
centerLong,
|
|
212
|
+
centerLat,
|
|
213
|
+
radius2d,
|
|
214
|
+
radius2d,
|
|
215
|
+
0,
|
|
216
|
+
360 / (edgeCount - 2), // 1 for return to start point, 1 for cutting circles
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
for (let i = 1; i < edgeCount; i++) {
|
|
220
|
+
const { long: lg, lat: lt } = pointsLongLat[i - 1];
|
|
221
|
+
centerCoords2dflat.set(globe.api_GetMercator2DPoint(lg, lt), i * 2);
|
|
222
|
+
}
|
|
223
|
+
return centerCoords2dflat;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
208
227
|
export {
|
|
209
|
-
CircleCache, EDGE_COUNT, centerCoords2dflatDataCreator
|
|
228
|
+
CircleCache, EDGE_COUNT, centerCoords2dflatDataCreator, centerCoords2dflatDataCreatorWithRadius
|
|
210
229
|
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/camerauniformblock";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
+
import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
|
+
import {
|
|
6
|
+
longLatRadToMercator, longLatRadToCartesian3D, cartesian3DToGLPosition, mercatorXYToGLPosition, realDistanceOnSphereR1,
|
|
7
|
+
circleLimpFromLongLatRadCenterCartesian3D_accurate,
|
|
8
|
+
circleLimpFromLongLatRadCenterMercatorCompass_accurate,
|
|
9
|
+
circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
|
|
10
|
+
POLE
|
|
11
|
+
} from "../../util/shaderfunctions/geometrytransformations";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* TODO:
|
|
16
|
+
* 1. integrate geometry functions for radius angle and center
|
|
17
|
+
* 2. integrate attributes
|
|
18
|
+
*
|
|
19
|
+
* TODO:
|
|
20
|
+
* center_position is too small or doenst loaded as expected.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const INITIAL_EDGE_COUNT = 360;
|
|
24
|
+
|
|
25
|
+
const vertexShaderSource = `#version 300 es
|
|
26
|
+
precision highp float;
|
|
27
|
+
${CameraUniformBlockString}
|
|
28
|
+
${longLatRadToMercator}
|
|
29
|
+
${longLatRadToCartesian3D}
|
|
30
|
+
${cartesian3DToGLPosition}
|
|
31
|
+
${mercatorXYToGLPosition}
|
|
32
|
+
${realDistanceOnSphereR1}
|
|
33
|
+
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
34
|
+
${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
|
|
35
|
+
${circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
in vec3 center_position3d;
|
|
39
|
+
in float big_radius;
|
|
40
|
+
in float small_radius;
|
|
41
|
+
in vec4 color;
|
|
42
|
+
|
|
43
|
+
uniform float edge_count;
|
|
44
|
+
uniform float step_angle;
|
|
45
|
+
|
|
46
|
+
out float interpolation;
|
|
47
|
+
out vec4 v_color;
|
|
48
|
+
void main() {
|
|
49
|
+
if( !is3D) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
int pad_phase = gl_VertexID % 2; // 0 or 1
|
|
53
|
+
interpolation = float( gl_VertexID - pad_phase) / edge_count;
|
|
54
|
+
float angle = float( gl_VertexID - pad_phase) * step_angle;
|
|
55
|
+
vec3 position;
|
|
56
|
+
if ( pad_phase == 0 ) {
|
|
57
|
+
position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, big_radius, angle);
|
|
58
|
+
} else {
|
|
59
|
+
position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, small_radius, angle);
|
|
60
|
+
}
|
|
61
|
+
gl_Position = cartesian3DToGLPosition(position);
|
|
62
|
+
v_color = color;
|
|
63
|
+
gl_PointSize = 5.0;
|
|
64
|
+
}`
|
|
65
|
+
|
|
66
|
+
const fragmentShaderSource = `#version 300 es
|
|
67
|
+
${POLE}
|
|
68
|
+
precision highp float;
|
|
69
|
+
uniform float opacity;
|
|
70
|
+
in vec4 v_color;
|
|
71
|
+
in float interpolation;
|
|
72
|
+
in vec2 v_limp;
|
|
73
|
+
out vec4 color;
|
|
74
|
+
void main() {
|
|
75
|
+
color = v_color;
|
|
76
|
+
color.a *= opacity;
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class Logic {
|
|
83
|
+
|
|
84
|
+
constructor(globe) {
|
|
85
|
+
this.globe = globe;
|
|
86
|
+
this.gl = globe.gl;
|
|
87
|
+
this._lastOpacity = 1.0;
|
|
88
|
+
this._lastEdgeCount = INITIAL_EDGE_COUNT;
|
|
89
|
+
this._lastStepAngle = 360 / INITIAL_EDGE_COUNT;
|
|
90
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
91
|
+
|
|
92
|
+
const { gl, program } = this;
|
|
93
|
+
this.program.uniforms = {
|
|
94
|
+
opacity: gl.getUniformLocation(program, "opacity"),
|
|
95
|
+
edgeCount: gl.getUniformLocation(program, "edge_count"),
|
|
96
|
+
stepAngle: gl.getUniformLocation(program, "step_angle")
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
{ // initial uniform values
|
|
100
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
101
|
+
gl.useProgram(program);
|
|
102
|
+
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
103
|
+
gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
|
|
104
|
+
gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 180);
|
|
105
|
+
gl.useProgram(currentProgram);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
{ // assign attribute locations
|
|
109
|
+
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
110
|
+
gl.bindAttribLocation(program, 1, "big_radius");
|
|
111
|
+
gl.bindAttribLocation(program, 2, "small_radius");
|
|
112
|
+
gl.bindAttribLocation(program, 3, "color");
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.cameraBindingPoint = 0;
|
|
117
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
118
|
+
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
119
|
+
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
createVAO(center3dObj, bigRadiusObj, smallRadiusObj, colorObj) {
|
|
123
|
+
const { gl } = this;
|
|
124
|
+
const vao = gl.createVertexArray();
|
|
125
|
+
const divisor = 1;
|
|
126
|
+
gl.bindVertexArray(vao);
|
|
127
|
+
{ // make this a function end import from account module.
|
|
128
|
+
const { buffer, stride = 0, offset = 0 } = center3dObj;
|
|
129
|
+
vaoAttributeLoader(gl, buffer, 0, 3, stride, offset, divisor);
|
|
130
|
+
}
|
|
131
|
+
{
|
|
132
|
+
console.log("bigRadiusObj", bigRadiusObj);
|
|
133
|
+
const { buffer, stride = 0, offset = 0 } = bigRadiusObj;
|
|
134
|
+
vaoAttributeLoader(gl, buffer, 1, 1, stride, offset, divisor);
|
|
135
|
+
}
|
|
136
|
+
{
|
|
137
|
+
const { buffer, stride = 0, offset = 0 } = smallRadiusObj;
|
|
138
|
+
vaoAttributeLoader(gl, buffer, 2, 1, stride, offset, divisor);
|
|
139
|
+
}
|
|
140
|
+
{
|
|
141
|
+
const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
142
|
+
vaoAttributeLoader(gl, buffer, 3, 4, stride, offset, divisor);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
gl.bindVertexArray(null);
|
|
146
|
+
gl.bindVertexArray(null);
|
|
147
|
+
return vao;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
draw(vao, length, edgeCount, stepAngle, opacity) {
|
|
151
|
+
const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
152
|
+
gl.useProgram(program);
|
|
153
|
+
|
|
154
|
+
if (this._lastOpacity !== opacity) {
|
|
155
|
+
gl.uniform1f(program.uniforms.opacity, opacity);
|
|
156
|
+
this._lastOpacity = opacity;
|
|
157
|
+
}
|
|
158
|
+
if (this._lastEdgeCount !== edgeCount) {
|
|
159
|
+
gl.uniform1f(program.uniforms.edgeCount, 2 * edgeCount);
|
|
160
|
+
this._lastEdgeCount = edgeCount;
|
|
161
|
+
}
|
|
162
|
+
if (this._lastStepAngle !== stepAngle) {
|
|
163
|
+
gl.uniform1f(program.uniforms.stepAngle, stepAngle * Math.PI / 180);
|
|
164
|
+
this._lastStepAngle = stepAngle;
|
|
165
|
+
}
|
|
166
|
+
gl.bindVertexArray(vao);
|
|
167
|
+
cameraBlockTotem.bind(cameraBindingPoint);
|
|
168
|
+
gl.drawArraysInstanced(gl.LINES, 0, edgeCount * 2, length);
|
|
169
|
+
// gl.drawArraysInstanced(gl.POINTS, 0, edgeCount, length);
|
|
170
|
+
cameraBlockTotem.unbind(cameraBindingPoint);
|
|
171
|
+
gl.bindVertexArray(null);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
free() {
|
|
177
|
+
if (this.isFreed) return;
|
|
178
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
179
|
+
this.gl.deleteProgram(this.program);
|
|
180
|
+
this.isFreed = true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
export const CirclePadding3DCache = Object.freeze({
|
|
187
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
188
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
189
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
2
|
+
import { mercatorXYToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
+
import { createProgram } from "../../util";
|
|
5
|
+
import { vaoAttributeLoader } from "../../util/account/util";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This program draws line between points provided from the first and second buffer.
|
|
9
|
+
* draw method gl.drawArraysInstanced( gl.POINTS, 0,2, lineCount);
|
|
10
|
+
* */
|
|
11
|
+
|
|
12
|
+
const Z_ALPHA_MODE = Object.freeze({
|
|
13
|
+
ON: 1,
|
|
14
|
+
OFF: 0
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const vertexShaderSource = `#version 300 es
|
|
18
|
+
precision highp float;
|
|
19
|
+
${CameraUniformBlockString}
|
|
20
|
+
${mercatorXYToGLPosition}
|
|
21
|
+
uniform float opacity;
|
|
22
|
+
uniform int z_alpha_on;
|
|
23
|
+
|
|
24
|
+
in vec2 posA;
|
|
25
|
+
in vec2 posB;
|
|
26
|
+
in vec4 color;
|
|
27
|
+
|
|
28
|
+
out vec4 v_color;
|
|
29
|
+
|
|
30
|
+
void main() {
|
|
31
|
+
if ( is3D ) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
float z_alpha;
|
|
35
|
+
if ( z_alpha_on == 1){
|
|
36
|
+
z_alpha = z_level * z_level / (distance(posA, posB) / 100.0 );
|
|
37
|
+
if( z_alpha < 0.1 ) {return;}
|
|
38
|
+
if( z_alpha > 1.0 ) {z_alpha = 1.0;}
|
|
39
|
+
} else {
|
|
40
|
+
z_alpha = 1.0;
|
|
41
|
+
}
|
|
42
|
+
vec2 pos;
|
|
43
|
+
if ( gl_VertexID == 0 ) {
|
|
44
|
+
pos = posA;
|
|
45
|
+
} else {
|
|
46
|
+
pos = posB;
|
|
47
|
+
}
|
|
48
|
+
gl_Position = mercatorXYToGLPosition( pos );
|
|
49
|
+
v_color = color;
|
|
50
|
+
v_color.a *= z_alpha * opacity;
|
|
51
|
+
gl_PointSize = 4.0;
|
|
52
|
+
}`;
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const fragmentShaderSource = `#version 300 es
|
|
56
|
+
precision highp float;
|
|
57
|
+
in vec4 v_color;
|
|
58
|
+
out vec4 outColor;
|
|
59
|
+
void main() {
|
|
60
|
+
outColor = v_color;
|
|
61
|
+
}`;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class Logic {
|
|
65
|
+
constructor(globe) {
|
|
66
|
+
this.globe = globe;
|
|
67
|
+
this.gl = globe.gl;
|
|
68
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
69
|
+
this._lastOpicity = 1.0;
|
|
70
|
+
this._lastZAlphaOn = Z_ALPHA_MODE.OFF;
|
|
71
|
+
|
|
72
|
+
const { gl, program } = this;
|
|
73
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
74
|
+
gl.useProgram(program);
|
|
75
|
+
{ // assign attribute locations
|
|
76
|
+
gl.bindAttribLocation(program, 0, 'posA');
|
|
77
|
+
gl.bindAttribLocation(program, 1, 'posB');
|
|
78
|
+
gl.bindAttribLocation(program, 2, 'color');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
{ // uniform locations
|
|
82
|
+
this._opacityLocation = gl.getUniformLocation(program, 'opacity');
|
|
83
|
+
this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
|
|
84
|
+
gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
|
|
85
|
+
gl.uniform1f(this._opacityLocation, this._lastOpicity);
|
|
86
|
+
}
|
|
87
|
+
{ // uniform block
|
|
88
|
+
this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
89
|
+
this._cameraBindingPoint = 0;
|
|
90
|
+
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
91
|
+
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
92
|
+
}
|
|
93
|
+
gl.useProgram(currentProgram);
|
|
94
|
+
}
|
|
95
|
+
createVAO(posAObj, posBObj, colorObj) {
|
|
96
|
+
|
|
97
|
+
const { gl } = this;
|
|
98
|
+
const vao = gl.createVertexArray();
|
|
99
|
+
const type = gl.Float;
|
|
100
|
+
const divisor = 1;
|
|
101
|
+
gl.bindVertexArray(vao);
|
|
102
|
+
[posAObj, posBObj, colorObj].forEach((obj, index) => {
|
|
103
|
+
const { buffer, size, stride, offset } = obj;
|
|
104
|
+
vaoAttributeLoader(gl, buffer, index, size, stride, offset, divisor, type);
|
|
105
|
+
});
|
|
106
|
+
gl.bindVertexArray(null);
|
|
107
|
+
return vao;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
draw(vao, lineCount, opacity = 1.0, zAlphaOn = Z_ALPHA_MODE.OFF) {
|
|
112
|
+
const { gl, program, _cameraBindingPoint, _cameraUniformBlock } = this;
|
|
113
|
+
gl.useProgram(program);
|
|
114
|
+
_cameraUniformBlock.bind(_cameraBindingPoint);
|
|
115
|
+
gl.bindVertexArray(vao);
|
|
116
|
+
if (this._lastOpicity !== opacity) {
|
|
117
|
+
this._lastOpicity = opacity;
|
|
118
|
+
gl.uniform1f(this._opacityLocation, opacity);
|
|
119
|
+
}
|
|
120
|
+
if (this._lastZAlphaOn !== zAlphaOn) {
|
|
121
|
+
this._lastZAlphaOn = zAlphaOn;
|
|
122
|
+
gl.uniform1i(this._zAlphaOnLocation, zAlphaOn);
|
|
123
|
+
}
|
|
124
|
+
gl.drawArraysInstanced(gl.LINES, 0, 2, lineCount);
|
|
125
|
+
_cameraUniformBlock.unbind(_cameraBindingPoint);
|
|
126
|
+
gl.bindVertexArray(null);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
free() {
|
|
131
|
+
if (this.isFreed) return;
|
|
132
|
+
const { gl, program, globe } = this;
|
|
133
|
+
CameraUniformBlockTotemCache.release(globe);
|
|
134
|
+
gl.deleteProgram(program);
|
|
135
|
+
this.isFreed = true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const LinesColorInstancedFlatCache = Object.freeze({
|
|
141
|
+
get: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
142
|
+
release: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export { LinesColorInstancedFlatCache, Z_ALPHA_MODE };
|
|
@@ -2,11 +2,9 @@ import { CameraUniformBlockString, CameraUniformBlockTotem } from "../totems";
|
|
|
2
2
|
import { pointsOnSphereBetween, POLE, R_3D, mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
3
|
import { createProgram } from "../../util";
|
|
4
4
|
import { noRegisterGlobeProgramCache, globeProgramCache } from "../programcache";
|
|
5
|
-
import BufferOffsetManger from "../../util/account/bufferoffsetmanager";
|
|
6
5
|
import { programCache } from "../rings/distancering/circleflatprogram";
|
|
7
6
|
|
|
8
7
|
const GLOBE_MIDPOINT_COUNT = 30;
|
|
9
|
-
const ITEM_SIZE = 9;
|
|
10
8
|
|
|
11
9
|
const vertexShader = `#version 300 es
|
|
12
10
|
precision highp float;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
-
import {
|
|
3
|
-
circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
|
|
4
|
-
circleLimpFromLongLatRadCenterCartesian3D_accurate_accurate
|
|
5
|
-
} from "../../../util/shaderfunctions/geometrytransformations";
|
|
6
2
|
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
7
3
|
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
8
4
|
|
|
@@ -14,12 +10,11 @@ const vertexShader = `#version 300 es ` +
|
|
|
14
10
|
shaderfunctions.mercatorXYToGLPosition +
|
|
15
11
|
shaderfunctions.longLatRadToMercator +
|
|
16
12
|
shaderfunctions.longLatRadToCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
17
14
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
18
15
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
19
16
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
20
17
|
|
|
21
|
-
${circleLimpFromLongLatRadCenterCartesian3D_accurate_accurate}
|
|
22
|
-
|
|
23
18
|
in vec2 center;
|
|
24
19
|
in float radius;
|
|
25
20
|
in float pad_range;
|
|
@@ -51,7 +46,7 @@ void main() {
|
|
|
51
46
|
|
|
52
47
|
if ( is3D){
|
|
53
48
|
gl_Position = projection * view * vec4(
|
|
54
|
-
|
|
49
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
55
50
|
v_limp = vec2(0.0, 0.0);
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
@@ -111,6 +106,10 @@ class Logic {
|
|
|
111
106
|
}
|
|
112
107
|
|
|
113
108
|
|
|
109
|
+
draw(vao, length, opaity) {
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
114
113
|
draw(attrBufferManager, padCount, compass, opacity) {
|
|
115
114
|
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
116
115
|
gl.useProgram(program);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
-
import {
|
|
3
|
-
circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
|
|
4
|
-
circleLimpFromLongLatRadCenterCartesian3D_accurate_accurate
|
|
5
|
-
} from "../../../util/shaderfunctions/geometrytransformations";
|
|
6
2
|
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
7
3
|
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
8
4
|
|
|
@@ -14,12 +10,11 @@ const vertexShader = `#version 300 es ` +
|
|
|
14
10
|
shaderfunctions.mercatorXYToGLPosition +
|
|
15
11
|
shaderfunctions.longLatRadToMercator +
|
|
16
12
|
shaderfunctions.longLatRadToCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
17
14
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
18
15
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
19
16
|
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
20
17
|
|
|
21
|
-
${circleLimpFromLongLatRadCenterCartesian3D_accurate_accurate}
|
|
22
|
-
|
|
23
18
|
in vec2 center;
|
|
24
19
|
in float radius;
|
|
25
20
|
in float pad_range;
|
|
@@ -51,7 +46,7 @@ void main() {
|
|
|
51
46
|
|
|
52
47
|
if ( is3D){
|
|
53
48
|
gl_Position = projection * view * vec4(
|
|
54
|
-
|
|
49
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
55
50
|
v_limp = vec2(0.0, 0.0);
|
|
56
51
|
return;
|
|
57
52
|
}
|
package/rangerings/rangerings.js
CHANGED
|
@@ -19,7 +19,6 @@ const { circleProgramCache, PaddingProgramCache, CirclePaddySharedBuffer } = rin
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
export default class {
|
|
24
23
|
|
|
25
24
|
constructor(id, { oneDegreePadding = true, compass = COMPASS_MODES.REAL, showNumbers = true, numbersStyle = null, opacity = 1 } = {}) {
|
|
@@ -73,11 +72,7 @@ export default class {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
this._opacity = opacity;
|
|
78
|
-
this.textPlugin?.setOpacity(opacity); // TODO impolement this
|
|
79
|
-
this.globe.DrawRender();
|
|
80
|
-
}
|
|
75
|
+
|
|
81
76
|
|
|
82
77
|
setGeometry() {
|
|
83
78
|
this.textPlugin?.setGeometry();
|
|
@@ -97,6 +92,14 @@ export default class {
|
|
|
97
92
|
|
|
98
93
|
|
|
99
94
|
|
|
95
|
+
|
|
96
|
+
setOpacity(opacity) {
|
|
97
|
+
this._opacity = opacity;
|
|
98
|
+
this.textPlugin?.setOpacity(opacity); // TODO impolement this
|
|
99
|
+
this.globe.DrawRender();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
100
103
|
/**
|
|
101
104
|
* @param {RangeRingData} rangeRingData
|
|
102
105
|
* 0 compass limps
|