@pirireis/webglobeplugins 0.12.0-alpha → 0.13.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/circle-cdf-points.js +0 -2
- package/package.json +1 -1
- package/programs/line-on-globe/circle-accurate.js +176 -175
- package/programs/line-on-globe/circle.js +166 -164
- package/programs/line-on-globe/linestrip/data.js +4 -0
- package/programs/line-on-globe/{linestrip.js → linestrip/linestrip.js} +34 -34
- package/programs/line-on-globe/to-the-surface.js +111 -109
- package/programs/rings/distancering/circleflatprogram.js +116 -120
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +1 -1
- package/programs/rings/distancering/circlepaddysharedbuffer.js +368 -354
- package/programs/rings/distancering/index.js +6 -5
- package/programs/rings/distancering/paddyflatprogram.js +127 -136
- package/programs/rings/distancering/paddyflatprogram2d.js +129 -138
- package/programs/rings/distancering/paddyflatprogram3d.js +128 -136
- package/programs/vectorfields/logics/pixelbased.js +5 -21
- package/shape-on-terrain/arc/naive/plugin.js +111 -66
- package/shape-on-terrain/circle/plugin.js +94 -62
- package/shape-on-terrain/type.js +1 -0
- package/util/account/index.js +2 -2
- package/util/account/single-attribute-buffer-management/buffer-manager.js +2 -3
- package/util/build-strategy/static-dynamic.js +1 -1
- package/programs/rings/distancering/shader.js +0 -1
|
@@ -1,109 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import '../
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
${
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
uniform float
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// TODO: Delete this file if it is not needed anymore.
|
|
3
|
+
// import { createProgram } from './util'
|
|
4
|
+
// import { CameraUniformBlockTotemCache, CameraUniformBlockString } from '../totems';
|
|
5
|
+
// import { cartesian3DToGLPosition, R_3D } from '../../util/shaderfunctions/geometrytransformations';
|
|
6
|
+
// import { noRegisterGlobeProgramCache } from '../programcache';
|
|
7
|
+
// import { attributeLoader } from '../../util/gl-util/buffer/attribute-loader';
|
|
8
|
+
// import '../draw-options/types';
|
|
9
|
+
// import { drawInstanced } from '../draw-options/methods';
|
|
10
|
+
// const vs = `#version 300 es
|
|
11
|
+
// ${R_3D}
|
|
12
|
+
// ${CameraUniformBlockString}
|
|
13
|
+
// ${cartesian3DToGLPosition}
|
|
14
|
+
// in vec3 pos3D
|
|
15
|
+
// in vec4 color;
|
|
16
|
+
// out float ratio;
|
|
17
|
+
// out flat vec4 vColor;
|
|
18
|
+
// void main(){
|
|
19
|
+
// if ( gl_VertexID == 0) {
|
|
20
|
+
// gl_Position = cartesian3DToGLPosition(pos3D);
|
|
21
|
+
// ratio =0.0;
|
|
22
|
+
// } else {
|
|
23
|
+
// vec3 sea_level_pos3D = norm(pos3D) * R_3D;
|
|
24
|
+
// gl_Position = cartesian3DToGLPosition(pos3D);
|
|
25
|
+
// ratio = 1.0;
|
|
26
|
+
// }
|
|
27
|
+
// vColor = color;
|
|
28
|
+
// }`;
|
|
29
|
+
// const fs = `#version 300 es
|
|
30
|
+
// uniform float opacity;
|
|
31
|
+
// uniform float phase;
|
|
32
|
+
// uniform float fadeOpacity;
|
|
33
|
+
// in flat vec4 vColor;
|
|
34
|
+
// in float ratio;
|
|
35
|
+
// out vec4 fragColor;
|
|
36
|
+
// void main(){
|
|
37
|
+
// fragColor = vec4( vColor.rgb, vColor.a * opacity);
|
|
38
|
+
// if (fadeOpacity < 1.0) {
|
|
39
|
+
// float alpha= mix( fadeOpacity, vColor.a, fract( ratio + phase ));
|
|
40
|
+
// fragColor.a *= alpha;
|
|
41
|
+
// }
|
|
42
|
+
// }`;
|
|
43
|
+
// class Logic {
|
|
44
|
+
// constructor(globe) {
|
|
45
|
+
// this.globe = globe;
|
|
46
|
+
// this.gl = globe.gl;
|
|
47
|
+
// this.program = createProgram(this.gl, vs, fs);
|
|
48
|
+
// const { gl, program } = this;
|
|
49
|
+
// this._opacity = {
|
|
50
|
+
// lastValue: 1.0,
|
|
51
|
+
// location: gl.getUniformLocation(program, 'opacity')
|
|
52
|
+
// }
|
|
53
|
+
// this._phase = {
|
|
54
|
+
// lastValue: 1.0,
|
|
55
|
+
// location: gl.getUniformLocation(program, 'phase')
|
|
56
|
+
// }
|
|
57
|
+
// this._fadeOpacity = {
|
|
58
|
+
// lastValue: 1.0,
|
|
59
|
+
// location: gl.getUniformBlockLocation(program, 'fadeOpacity')
|
|
60
|
+
// }
|
|
61
|
+
// const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
62
|
+
// gl.useProgram(program);
|
|
63
|
+
// [this._opacity, this._phase, this._fadeOpacity].forEach((wrapper) => gl.uniform1f(wrapper.location, wrapper.lastValue))
|
|
64
|
+
// gl.useProgram(currentProgram)
|
|
65
|
+
// gl.useProgram(program);
|
|
66
|
+
// gl.bindAttribLocation(program, 0, 'pos3D');
|
|
67
|
+
// gl.bindAttribLocation(program, 1, 'color');
|
|
68
|
+
// this.cameraUniformBlockTotem = new CameraUniformBlockTotemCache.get(globe);
|
|
69
|
+
// this.cameraBlockBindingPoint = 0;
|
|
70
|
+
// const cameraBlockIndex = gl.getUniformBlockLocation(program, 'CameraUniformBlock');
|
|
71
|
+
// gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint)
|
|
72
|
+
// }
|
|
73
|
+
// createVao(pos3DObj, colorObj) {
|
|
74
|
+
// const { gl } = this;
|
|
75
|
+
// const vao = gl.createVertexArray();
|
|
76
|
+
// const divisor = 1;
|
|
77
|
+
// gl.bindVertexArray(vao);
|
|
78
|
+
// attributeLoader(gl, pos3DObj, 0, 3, { divisor });
|
|
79
|
+
// attributeLoader(gl, colorObj, 1, 4, { divisor, escapeValue: [-1, -1, -1, -1] });
|
|
80
|
+
// gl.bindVertexArray(null);
|
|
81
|
+
// this._vaoCache.push(vao);
|
|
82
|
+
// return vao;
|
|
83
|
+
// }
|
|
84
|
+
// /**
|
|
85
|
+
// *
|
|
86
|
+
// * @param {WebGL2RenderingContext.vertexArrayObject} vao
|
|
87
|
+
// * @param {Render} drawOptions
|
|
88
|
+
// */
|
|
89
|
+
// draw(vao, drawOptions, { opacity = 1.0, fadeOpacity = 1.0, }) {
|
|
90
|
+
// const { globe, gl, program, _opacity, _fadeOpacity } = this;
|
|
91
|
+
// gl.useProgram(program);
|
|
92
|
+
// gl.bindVertexArray(vao);
|
|
93
|
+
// if (fadeOpacity < 1.0) {
|
|
94
|
+
// this._updatePhase();
|
|
95
|
+
// globe.drawRender();
|
|
96
|
+
// }
|
|
97
|
+
// if (fadeOpacity !== _fadeOpacity.lastValue) {
|
|
98
|
+
// _fadeOpacity.lastValue = fadeOpacity;
|
|
99
|
+
// gl.uniform1f(_fadeOpacity.location, fadeOpacity);
|
|
100
|
+
// }
|
|
101
|
+
// if (opacity !== _opacity.lastValue) {
|
|
102
|
+
// _opacity.lastValue = opacity;
|
|
103
|
+
// gl.uniform1f(_opacity.location, opacity);
|
|
104
|
+
// }
|
|
105
|
+
// drawInstanced(gl, gl.TRIANGLE_FAN, drawOptions)
|
|
106
|
+
// }
|
|
107
|
+
// _updatePhase() {
|
|
108
|
+
// this._phase.lastValue = (Date.now() / 3.0) % 1000;
|
|
109
|
+
// gl.uniform1f(_phase.location, _phase.lastValue);
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
@@ -1,120 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
uniform
|
|
19
|
-
|
|
20
|
-
uniform float opacity;
|
|
21
|
-
|
|
22
|
-
in
|
|
23
|
-
in
|
|
24
|
-
in
|
|
25
|
-
|
|
26
|
-
out
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
export const programCache = Object.freeze({
|
|
118
|
-
getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
119
|
-
releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
120
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
// TODO: Delete this file if it is not needed anymore.
|
|
3
|
+
// import { createProgram, shaderfunctions } from "../../../util";
|
|
4
|
+
// import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
5
|
+
// import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
|
|
6
|
+
// const CIRCLE_EDGE_COUNT = 360;
|
|
7
|
+
// const vertexShader = `#version 300 es ` +
|
|
8
|
+
// shaderfunctions.PI +
|
|
9
|
+
// shaderfunctions.R +
|
|
10
|
+
// shaderfunctions.POLE +
|
|
11
|
+
// CameraUniformBlockString +
|
|
12
|
+
// shaderfunctions.mercatorXYToGLPosition +
|
|
13
|
+
// shaderfunctions.longLatRadToMercator +
|
|
14
|
+
// shaderfunctions.longLatRadToCartesian3D +
|
|
15
|
+
// shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
16
|
+
// shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
17
|
+
// shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
18
|
+
// uniform int compass;
|
|
19
|
+
// uniform float circle_edge_count;
|
|
20
|
+
// uniform float opacity;
|
|
21
|
+
// in vec2 center;
|
|
22
|
+
// in float radius;
|
|
23
|
+
// in vec4 color;
|
|
24
|
+
// in float flag;
|
|
25
|
+
// out vec4 v_color;
|
|
26
|
+
// out vec2 v_limp;
|
|
27
|
+
// void main() {
|
|
28
|
+
// if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
|
|
29
|
+
// v_color = vec4(color.rgb, color.a * opacity);
|
|
30
|
+
// if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
|
|
31
|
+
// float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
|
|
32
|
+
// if ( is3D ){
|
|
33
|
+
// gl_Position = projection * view * vec4(
|
|
34
|
+
// circleLimpFromLongLatRadCenterCartesian3D( center, radius, angle) - translate, 1.0);
|
|
35
|
+
// v_limp = vec2(0.0, 0.0);
|
|
36
|
+
// return;
|
|
37
|
+
// }
|
|
38
|
+
// vec2 limp;
|
|
39
|
+
// if ( compass == 1 ){
|
|
40
|
+
// limp = circleLimpFromLongLatRadCenterMercatorCompass(center, radius, angle);
|
|
41
|
+
// } else {
|
|
42
|
+
// limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius, angle);
|
|
43
|
+
// }
|
|
44
|
+
// v_limp = limp;
|
|
45
|
+
// gl_Position = mercatorXYToGLPosition(limp);
|
|
46
|
+
// }`;
|
|
47
|
+
// const fragmentShader = `#version 300 es
|
|
48
|
+
// precision highp float;` +
|
|
49
|
+
// shaderfunctions.POLE + `
|
|
50
|
+
// in vec4 v_color;
|
|
51
|
+
// in vec2 v_limp;
|
|
52
|
+
// out vec4 outColor;
|
|
53
|
+
// void main() {
|
|
54
|
+
// if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
55
|
+
// outColor = v_color;
|
|
56
|
+
// }`;
|
|
57
|
+
// class Logic {
|
|
58
|
+
// constructor(globe) {
|
|
59
|
+
// this.globe = globe;
|
|
60
|
+
// this.gl = globe.gl;
|
|
61
|
+
// this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
62
|
+
// { // bind positions so bufferManager can use them
|
|
63
|
+
// this.gl.bindAttribLocation(this.program, 0, "center");
|
|
64
|
+
// this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
65
|
+
// this.gl.bindAttribLocation(this.program, 2, "color");
|
|
66
|
+
// this.gl.bindAttribLocation(this.program, 3, "flag");
|
|
67
|
+
// }
|
|
68
|
+
// this.cameraBlockBindingPoint = 0;
|
|
69
|
+
// this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
70
|
+
// const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
71
|
+
// this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
72
|
+
// this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
73
|
+
// this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
74
|
+
// this._circleEdgeCountLocation = this.gl.getUniformLocation(this.program, "circle_edge_count");
|
|
75
|
+
// this._circleEdgeCount = CIRCLE_EDGE_COUNT;
|
|
76
|
+
// this._compassmode = 1;
|
|
77
|
+
// this._opacity = 1.0;
|
|
78
|
+
// {
|
|
79
|
+
// const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
80
|
+
// this.gl.useProgram(this.program);
|
|
81
|
+
// this.gl.uniform1i(this._compassLocation, 1);
|
|
82
|
+
// this.gl.uniform1f(this._circleEdgeCountLocation, CIRCLE_EDGE_COUNT);
|
|
83
|
+
// this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
84
|
+
// this.gl.useProgram(currentProgram);
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// draw(attrBufferManager, compass, circleEdgeCount, opacity) {
|
|
88
|
+
// const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
89
|
+
// gl.useProgram(program);
|
|
90
|
+
// cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
91
|
+
// attrBufferManager.bindCircleVAO();
|
|
92
|
+
// if (compass !== this._compassmode) {
|
|
93
|
+
// gl.uniform1i(this._compassLocation, compass);
|
|
94
|
+
// this._compassmode = compass;
|
|
95
|
+
// }
|
|
96
|
+
// if (opacity !== this._opacity) {
|
|
97
|
+
// gl.uniform1f(this._opacityLocation, opacity);
|
|
98
|
+
// this._opacity = opacity;
|
|
99
|
+
// }
|
|
100
|
+
// if (circleEdgeCount !== this._circleEdgeCount) {
|
|
101
|
+
// gl.uniform1f(this._circleEdgeCountLocation, circleEdgeCount);
|
|
102
|
+
// this._circleEdgeCount = circleEdgeCount;
|
|
103
|
+
// }
|
|
104
|
+
// gl.drawArraysInstanced(gl.LINE_LOOP, 0, circleEdgeCount, attrBufferManager.length);
|
|
105
|
+
// gl.bindVertexArray(null);
|
|
106
|
+
// cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
107
|
+
// }
|
|
108
|
+
// free() {
|
|
109
|
+
// this.gl.deleteProgram(this.program);
|
|
110
|
+
// globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// export const programCache = Object.freeze({
|
|
114
|
+
// getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
115
|
+
// releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
116
|
+
// });
|
|
@@ -120,7 +120,7 @@ class Logic {
|
|
|
120
120
|
return new BufferManager(this.gl, bufferType, initialRingCapacity);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
const PaddingFreeAngleCache = Object.freeze({
|
|
124
124
|
getProgram: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
125
125
|
releaseProgram: (globe) => globeProgramCache.releaseProgram(globe, Logic)
|
|
126
126
|
});
|