@pirireis/webglobeplugins 0.11.1-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/arc-cdf-points.js +252 -0
- package/Math/{arc-generate-points.js → arc-generate-points copy.js } +4 -0
- package/Math/arc-generate-points-exponantial.js +254 -0
- package/Math/arc.js +5 -5
- package/Math/circle-cdf-points.js +247 -0
- package/Math/circle.js +39 -0
- package/Math/methods.js +13 -3
- package/Math/vec3.js +3 -3
- 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} +38 -39
- 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/totems/camerauniformblock.js +35 -8
- package/programs/totems/canvas-webglobe-info.js +55 -20
- package/programs/totems/{camerauniformblock copy.js → canvas-webglobe-info1.js} +11 -76
- package/programs/vectorfields/logics/pixelbased.js +4 -20
- package/shape-on-terrain/arc/naive/plugin.js +249 -288
- package/shape-on-terrain/circle/plugin.js +284 -0
- 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/account/single-attribute-buffer-management/buffer-orchestrator.js +2 -2
- package/util/build-strategy/general-strategy.js +62 -0
- package/util/build-strategy/static-dynamic.js +31 -0
- package/util/gl-util/draw-options/types.js +1 -1
- package/globe-types.js +0 -1
- package/programs/interface.js +0 -1
- package/programs/rings/distancering/shader.js +0 -1
- package/programs/totems/camerauniformblock1.js +0 -171
|
@@ -1,175 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
${
|
|
26
|
-
|
|
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
|
-
in
|
|
74
|
-
in float
|
|
75
|
-
in float
|
|
76
|
-
in
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// TODO: Delete this file if it is not needed anymore.
|
|
3
|
+
// import { createProgram } from "../../util/webglobjectbuilders";
|
|
4
|
+
// import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/camerauniformblock";
|
|
5
|
+
// import { noRegisterGlobeProgramCache } from "../programcache";
|
|
6
|
+
// import { vaoAttributeLoader } from "../../util/account/util";
|
|
7
|
+
// import {
|
|
8
|
+
// longLatRadToMercator, longLatRadToCartesian3D, cartesian3DToGLPosition, mercatorXYToGLPosition, realDistanceOnSphereR1,
|
|
9
|
+
// circleLimpFromLongLatRadCenterCartesian3D_accurate,
|
|
10
|
+
// circleLimpFromLongLatRadCenterMercatorCompass_accurate,
|
|
11
|
+
// circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
|
|
12
|
+
// POLE
|
|
13
|
+
// } from "../../util/shaderfunctions/geometrytransformations";
|
|
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
|
+
// const EDGE_COUNT_ON_SPHERE = 360;
|
|
23
|
+
// const vertexShaderSource = `#version 300 es
|
|
24
|
+
// precision highp float;
|
|
25
|
+
// ${CameraUniformBlockString}
|
|
26
|
+
// ${longLatRadToMercator}
|
|
27
|
+
// ${longLatRadToCartesian3D}
|
|
28
|
+
// ${cartesian3DToGLPosition}
|
|
29
|
+
// ${mercatorXYToGLPosition}
|
|
30
|
+
// ${realDistanceOnSphereR1}
|
|
31
|
+
// ${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
32
|
+
// ${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
|
|
33
|
+
// ${circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate}
|
|
34
|
+
// uniform float edge_count;
|
|
35
|
+
// in vec2 center_position;
|
|
36
|
+
// in vec3 center_position3d;
|
|
37
|
+
// in float radius;
|
|
38
|
+
// in vec4 color;
|
|
39
|
+
// in float dash_ratio;
|
|
40
|
+
// in float dash_opacity;
|
|
41
|
+
// out float interpolation;
|
|
42
|
+
// out vec4 v_color;
|
|
43
|
+
// out float v_dash_ratio;
|
|
44
|
+
// out float v_dash_opacity;
|
|
45
|
+
// out vec2 v_limp;
|
|
46
|
+
// void main() {
|
|
47
|
+
// interpolation = float( gl_VertexID ) / ${EDGE_COUNT_ON_SPHERE}.0;
|
|
48
|
+
// float angle = PI * 2.0 * interpolation;
|
|
49
|
+
// if ( is3D ) {
|
|
50
|
+
// vec3 position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, radius, angle);
|
|
51
|
+
// gl_Position = cartesian3DToGLPosition(position);
|
|
52
|
+
// v_limp = vec2(0.0, 0.0);
|
|
53
|
+
// } else {
|
|
54
|
+
// vec2 position;
|
|
55
|
+
// if ( radius < 0.0) {
|
|
56
|
+
// float cosine1 = cos(asin(tanh(center_position.y / 6378137.0)));
|
|
57
|
+
// position = circleLimpFromLongLatRadCenterMercatorCompass_accurate(center_position, radius / cosine1 , angle);
|
|
58
|
+
// } else {
|
|
59
|
+
// position = circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate( center_position, radius, angle);
|
|
60
|
+
// }
|
|
61
|
+
// v_limp = position;
|
|
62
|
+
// gl_Position = mercatorXYToGLPosition( position);
|
|
63
|
+
// }
|
|
64
|
+
// v_dash_ratio = dash_ratio;
|
|
65
|
+
// v_dash_opacity = dash_opacity;
|
|
66
|
+
// v_color = color;
|
|
67
|
+
// gl_PointSize = 3.0;
|
|
68
|
+
// }`
|
|
69
|
+
// const fragmentShaderSource = `#version 300 es
|
|
70
|
+
// ${POLE}
|
|
71
|
+
// precision highp float;
|
|
72
|
+
// uniform float opacity;
|
|
73
|
+
// in vec4 v_color;
|
|
74
|
+
// in float v_dash_ratio;
|
|
75
|
+
// in float v_dash_opacity;
|
|
76
|
+
// in float interpolation;
|
|
77
|
+
// in vec2 v_limp;
|
|
78
|
+
// out vec4 color;
|
|
79
|
+
// void main() {
|
|
80
|
+
// 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; }
|
|
81
|
+
// color = v_color;
|
|
82
|
+
// color.a *= opacity;
|
|
83
|
+
// if ( v_dash_ratio == 1.0 || v_dash_ratio == 0.0 ) return;
|
|
84
|
+
// if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5 ) {
|
|
85
|
+
// color.a *= v_dash_opacity;
|
|
86
|
+
// }
|
|
87
|
+
// }
|
|
88
|
+
// `;
|
|
89
|
+
// class Logic {
|
|
90
|
+
// constructor(globe) {
|
|
91
|
+
// this.globe = globe;
|
|
92
|
+
// this.gl = globe.gl;
|
|
93
|
+
// this._lastOpacity = 1.0;
|
|
94
|
+
// this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
95
|
+
// const { gl, program } = this;
|
|
96
|
+
// this.program.uniforms = {
|
|
97
|
+
// opacity: gl.getUniformLocation(program, "opacity")
|
|
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.useProgram(currentProgram);
|
|
104
|
+
// }
|
|
105
|
+
// //
|
|
106
|
+
// { // assign attribute locations
|
|
107
|
+
// gl.bindAttribLocation(program, 0, "center_position");
|
|
108
|
+
// gl.bindAttribLocation(program, 1, "center_position3d");
|
|
109
|
+
// gl.bindAttribLocation(program, 2, "radius");
|
|
110
|
+
// gl.bindAttribLocation(program, 3, "color");
|
|
111
|
+
// gl.bindAttribLocation(program, 4, "dash_ratio");
|
|
112
|
+
// gl.bindAttribLocation(program, 5, "dash_opacity");
|
|
113
|
+
// }
|
|
114
|
+
// this.cameraBindingPoint = 0;
|
|
115
|
+
// this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
116
|
+
// const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
117
|
+
// gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
118
|
+
// }
|
|
119
|
+
// createVAO(centerObj, center3dObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj) {
|
|
120
|
+
// const { gl } = this;
|
|
121
|
+
// const vao = gl.createVertexArray();
|
|
122
|
+
// const divisor = 1;
|
|
123
|
+
// gl.bindVertexArray(vao);
|
|
124
|
+
// { // make this a function end import from account module.
|
|
125
|
+
// const { buffer, stride = 0, offset = 0 } = centerObj;
|
|
126
|
+
// vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
|
|
127
|
+
// }
|
|
128
|
+
// { // make this a function end import from account module.
|
|
129
|
+
// const { buffer, stride = 0, offset = 0 } = center3dObj;
|
|
130
|
+
// vaoAttributeLoader(gl, buffer, 1, 3, stride, offset, divisor);
|
|
131
|
+
// }
|
|
132
|
+
// {
|
|
133
|
+
// const { buffer, stride = 0, offset = 0 } = radiusObj;
|
|
134
|
+
// vaoAttributeLoader(gl, buffer, 2, 1, stride, offset, divisor);
|
|
135
|
+
// }
|
|
136
|
+
// {
|
|
137
|
+
// const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
138
|
+
// vaoAttributeLoader(gl, buffer, 3, 4, stride, offset, divisor);
|
|
139
|
+
// }
|
|
140
|
+
// {
|
|
141
|
+
// const { buffer, stride = 0, offset = 0 } = dashRatioObj;
|
|
142
|
+
// vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
|
|
143
|
+
// }
|
|
144
|
+
// {
|
|
145
|
+
// const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
|
|
146
|
+
// vaoAttributeLoader(gl, buffer, 5, 1, stride, offset, divisor);
|
|
147
|
+
// }
|
|
148
|
+
// gl.bindVertexArray(null);
|
|
149
|
+
// gl.bindVertexArray(null);
|
|
150
|
+
// return vao;
|
|
151
|
+
// }
|
|
152
|
+
// draw(vao, length, opacity) {
|
|
153
|
+
// const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
154
|
+
// gl.useProgram(program);
|
|
155
|
+
// if (this._lastOpacity !== opacity) {
|
|
156
|
+
// gl.uniform1f(program.uniforms.opacity, opacity);
|
|
157
|
+
// this._lastOpacity = opacity;
|
|
158
|
+
// }
|
|
159
|
+
// gl.bindVertexArray(vao);
|
|
160
|
+
// cameraBlockTotem.bind(cameraBindingPoint);
|
|
161
|
+
// gl.drawArraysInstanced(gl.LINE_STRIP, 0, EDGE_COUNT_ON_SPHERE + 1, length);
|
|
162
|
+
// gl.drawArraysInstanced(gl.POINTS, 0, EDGE_COUNT_ON_SPHERE + 1, length);
|
|
163
|
+
// cameraBlockTotem.unbind(cameraBindingPoint);
|
|
164
|
+
// gl.bindVertexArray(null);
|
|
165
|
+
// }
|
|
166
|
+
// free() {
|
|
167
|
+
// if (this.isFreed) return;
|
|
168
|
+
// CameraUniformBlockTotemCache.release(this.globe);
|
|
169
|
+
// this.gl.deleteProgram(this.program);
|
|
170
|
+
// this.isFreed = true;
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
// export const CircleCache = Object.freeze({
|
|
174
|
+
// get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
175
|
+
// release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
176
|
+
// });
|