@pirireis/webglobeplugins 0.9.5 → 0.9.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/package.json +8 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -21
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,202 +0,0 @@
|
|
|
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
|
-
const EDGE_COUNT_ON_SPHERE = 360;
|
|
23
|
-
|
|
24
|
-
const vertexShaderSource = `#version 300 es
|
|
25
|
-
precision highp float;
|
|
26
|
-
${CameraUniformBlockString}
|
|
27
|
-
${longLatRadToMercator}
|
|
28
|
-
${longLatRadToCartesian3D}
|
|
29
|
-
${cartesian3DToGLPosition}
|
|
30
|
-
${mercatorXYToGLPosition}
|
|
31
|
-
${realDistanceOnSphereR1}
|
|
32
|
-
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
33
|
-
${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
|
|
34
|
-
${circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate}
|
|
35
|
-
|
|
36
|
-
uniform float edge_count;
|
|
37
|
-
|
|
38
|
-
in vec2 center_position;
|
|
39
|
-
in vec3 center_position3d;
|
|
40
|
-
in float radius;
|
|
41
|
-
in vec4 color;
|
|
42
|
-
in float dash_ratio;
|
|
43
|
-
in float dash_opacity;
|
|
44
|
-
|
|
45
|
-
out float interpolation;
|
|
46
|
-
out vec4 v_color;
|
|
47
|
-
out float v_dash_ratio;
|
|
48
|
-
out float v_dash_opacity;
|
|
49
|
-
out vec2 v_limp;
|
|
50
|
-
void main() {
|
|
51
|
-
interpolation = float( gl_VertexID ) / ${EDGE_COUNT_ON_SPHERE}.0;
|
|
52
|
-
float angle = PI * 2.0 * interpolation;
|
|
53
|
-
if ( is3D ) {
|
|
54
|
-
|
|
55
|
-
vec3 position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, radius, angle);
|
|
56
|
-
|
|
57
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
58
|
-
v_limp = vec2(0.0, 0.0);
|
|
59
|
-
} else {
|
|
60
|
-
vec2 position;
|
|
61
|
-
if ( radius < 0.0) {
|
|
62
|
-
float cosine1 = cos(asin(tanh(center_position.y / 6378137.0)));
|
|
63
|
-
position = circleLimpFromLongLatRadCenterMercatorCompass_accurate(center_position, radius / cosine1 , angle);
|
|
64
|
-
} else {
|
|
65
|
-
position = circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate( center_position, radius, angle);
|
|
66
|
-
}
|
|
67
|
-
v_limp = position;
|
|
68
|
-
gl_Position = mercatorXYToGLPosition( position);
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
v_dash_ratio = dash_ratio;
|
|
72
|
-
v_dash_opacity = dash_opacity;
|
|
73
|
-
v_color = color;
|
|
74
|
-
gl_PointSize = 3.0;
|
|
75
|
-
|
|
76
|
-
}`
|
|
77
|
-
|
|
78
|
-
const fragmentShaderSource = `#version 300 es
|
|
79
|
-
${POLE}
|
|
80
|
-
precision highp float;
|
|
81
|
-
uniform float opacity;
|
|
82
|
-
in vec4 v_color;
|
|
83
|
-
in float v_dash_ratio;
|
|
84
|
-
in float v_dash_opacity;
|
|
85
|
-
in float interpolation;
|
|
86
|
-
in vec2 v_limp;
|
|
87
|
-
out vec4 color;
|
|
88
|
-
void main() {
|
|
89
|
-
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; }
|
|
90
|
-
color = v_color;
|
|
91
|
-
color.a *= opacity;
|
|
92
|
-
if ( v_dash_ratio == 1.0 || v_dash_ratio == 0.0 ) return;
|
|
93
|
-
if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5 ) {
|
|
94
|
-
color.a *= v_dash_opacity;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class Logic {
|
|
102
|
-
|
|
103
|
-
constructor(globe) {
|
|
104
|
-
this.globe = globe;
|
|
105
|
-
this.gl = globe.gl;
|
|
106
|
-
this._lastOpacity = 1.0;
|
|
107
|
-
|
|
108
|
-
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
109
|
-
|
|
110
|
-
const { gl, program } = this;
|
|
111
|
-
this.program.uniforms = {
|
|
112
|
-
opacity: gl.getUniformLocation(program, "opacity")
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
{ // initial uniform values
|
|
116
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
117
|
-
gl.useProgram(program);
|
|
118
|
-
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
119
|
-
gl.useProgram(currentProgram);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
{ // assign attribute locations
|
|
123
|
-
gl.bindAttribLocation(program, 0, "center_position");
|
|
124
|
-
gl.bindAttribLocation(program, 1, "center_position3d");
|
|
125
|
-
gl.bindAttribLocation(program, 2, "radius");
|
|
126
|
-
gl.bindAttribLocation(program, 3, "color");
|
|
127
|
-
gl.bindAttribLocation(program, 4, "dash_ratio");
|
|
128
|
-
gl.bindAttribLocation(program, 5, "dash_opacity");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this.cameraBindingPoint = 0;
|
|
132
|
-
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
133
|
-
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
134
|
-
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
createVAO(centerObj, center3dObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj) {
|
|
138
|
-
const { gl } = this;
|
|
139
|
-
const vao = gl.createVertexArray();
|
|
140
|
-
const divisor = 1;
|
|
141
|
-
gl.bindVertexArray(vao);
|
|
142
|
-
{ // make this a function end import from account module.
|
|
143
|
-
const { buffer, stride = 0, offset = 0 } = centerObj;
|
|
144
|
-
vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
|
|
145
|
-
}
|
|
146
|
-
{ // make this a function end import from account module.
|
|
147
|
-
const { buffer, stride = 0, offset = 0 } = center3dObj;
|
|
148
|
-
vaoAttributeLoader(gl, buffer, 1, 3, stride, offset, divisor);
|
|
149
|
-
}
|
|
150
|
-
{
|
|
151
|
-
const { buffer, stride = 0, offset = 0 } = radiusObj;
|
|
152
|
-
vaoAttributeLoader(gl, buffer, 2, 1, stride, offset, divisor);
|
|
153
|
-
}
|
|
154
|
-
{
|
|
155
|
-
const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
156
|
-
vaoAttributeLoader(gl, buffer, 3, 4, stride, offset, divisor);
|
|
157
|
-
}
|
|
158
|
-
{
|
|
159
|
-
const { buffer, stride = 0, offset = 0 } = dashRatioObj;
|
|
160
|
-
vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
|
|
161
|
-
}
|
|
162
|
-
{
|
|
163
|
-
const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
|
|
164
|
-
vaoAttributeLoader(gl, buffer, 5, 1, stride, offset, divisor);
|
|
165
|
-
}
|
|
166
|
-
gl.bindVertexArray(null);
|
|
167
|
-
gl.bindVertexArray(null);
|
|
168
|
-
return vao;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
draw(vao, length, opacity) {
|
|
172
|
-
const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
173
|
-
gl.useProgram(program);
|
|
174
|
-
|
|
175
|
-
if (this._lastOpacity !== opacity) {
|
|
176
|
-
gl.uniform1f(program.uniforms.opacity, opacity);
|
|
177
|
-
this._lastOpacity = opacity;
|
|
178
|
-
}
|
|
179
|
-
gl.bindVertexArray(vao);
|
|
180
|
-
cameraBlockTotem.bind(cameraBindingPoint);
|
|
181
|
-
gl.drawArraysInstanced(gl.LINE_STRIP, 0, EDGE_COUNT_ON_SPHERE + 1, length);
|
|
182
|
-
gl.drawArraysInstanced(gl.POINTS, 0, EDGE_COUNT_ON_SPHERE + 1, length);
|
|
183
|
-
cameraBlockTotem.unbind(cameraBindingPoint);
|
|
184
|
-
gl.bindVertexArray(null);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
free() {
|
|
190
|
-
if (this.isFreed) return;
|
|
191
|
-
CameraUniformBlockTotemCache.release(this.globe);
|
|
192
|
-
this.gl.deleteProgram(this.program);
|
|
193
|
-
this.isFreed = true;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
export const CircleCache = Object.freeze({
|
|
200
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
201
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
202
|
-
});
|
|
@@ -1,191 +0,0 @@
|
|
|
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,
|
|
8
|
-
circleLimpFromLongLatRadCenterMercatorCompass,
|
|
9
|
-
circleLimpFromLongLatRadCenterMercatorRealDistance,
|
|
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
|
-
const EDGE_COUNT_ON_SPHERE = 360;
|
|
23
|
-
|
|
24
|
-
const vertexShaderSource = `#version 300 es
|
|
25
|
-
precision highp float;
|
|
26
|
-
${CameraUniformBlockString}
|
|
27
|
-
${longLatRadToMercator}
|
|
28
|
-
${longLatRadToCartesian3D}
|
|
29
|
-
${cartesian3DToGLPosition}
|
|
30
|
-
${mercatorXYToGLPosition}
|
|
31
|
-
${realDistanceOnSphereR1}
|
|
32
|
-
${circleLimpFromLongLatRadCenterCartesian3D}
|
|
33
|
-
${circleLimpFromLongLatRadCenterMercatorCompass}
|
|
34
|
-
${circleLimpFromLongLatRadCenterMercatorRealDistance}
|
|
35
|
-
|
|
36
|
-
uniform float edge_count;
|
|
37
|
-
|
|
38
|
-
in vec2 center_position;
|
|
39
|
-
in float radius;
|
|
40
|
-
in vec4 color;
|
|
41
|
-
in float dash_ratio;
|
|
42
|
-
in float dash_opacity;
|
|
43
|
-
|
|
44
|
-
out float interpolation;
|
|
45
|
-
out vec4 v_color;
|
|
46
|
-
out float v_dash_ratio;
|
|
47
|
-
out float v_dash_opacity;
|
|
48
|
-
out vec2 v_limp;
|
|
49
|
-
void main() {
|
|
50
|
-
interpolation = float( gl_VertexID ) / ${EDGE_COUNT_ON_SPHERE}.0;
|
|
51
|
-
float angle = PI * 2.0 * interpolation;
|
|
52
|
-
if ( is3D ) {
|
|
53
|
-
vec3 position = circleLimpFromLongLatRadCenterCartesian3D( center_position, radius, angle);
|
|
54
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
55
|
-
v_limp = vec2(0.0, 0.0);
|
|
56
|
-
} else {
|
|
57
|
-
vec2 position;
|
|
58
|
-
if (radius < 1400.0) {
|
|
59
|
-
position = circleLimpFromLongLatRadCenterMercatorCompass( center_position, radius/ cos(center_position.y), angle);
|
|
60
|
-
} else {
|
|
61
|
-
position = circleLimpFromLongLatRadCenterMercatorRealDistance( center_position, radius, angle);
|
|
62
|
-
}
|
|
63
|
-
v_limp = position;
|
|
64
|
-
gl_Position = mercatorXYToGLPosition( position);
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
v_dash_ratio = dash_ratio;
|
|
68
|
-
v_dash_opacity = dash_opacity;
|
|
69
|
-
v_color = color;
|
|
70
|
-
|
|
71
|
-
}`
|
|
72
|
-
|
|
73
|
-
const fragmentShaderSource = `#version 300 es
|
|
74
|
-
${POLE}
|
|
75
|
-
precision highp float;
|
|
76
|
-
uniform float opacity;
|
|
77
|
-
in vec4 v_color;
|
|
78
|
-
in float v_dash_ratio;
|
|
79
|
-
in float v_dash_opacity;
|
|
80
|
-
in float interpolation;
|
|
81
|
-
in vec2 v_limp;
|
|
82
|
-
out vec4 color;
|
|
83
|
-
void main() {
|
|
84
|
-
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; }
|
|
85
|
-
color = v_color;
|
|
86
|
-
color.a *= opacity;
|
|
87
|
-
if ( v_dash_ratio == 1.0 || v_dash_ratio == 0.0 ) return;
|
|
88
|
-
if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5 ) {
|
|
89
|
-
color.a *= v_dash_opacity;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
class Logic {
|
|
97
|
-
|
|
98
|
-
constructor(globe) {
|
|
99
|
-
this.globe = globe;
|
|
100
|
-
this.gl = globe.gl;
|
|
101
|
-
this._lastOpacity = 1.0;
|
|
102
|
-
|
|
103
|
-
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
104
|
-
|
|
105
|
-
const { gl, program } = this;
|
|
106
|
-
this.program.uniforms = {
|
|
107
|
-
opacity: gl.getUniformLocation(program, "opacity")
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
{ // initial uniform values
|
|
111
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
112
|
-
gl.useProgram(program);
|
|
113
|
-
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
114
|
-
gl.useProgram(currentProgram);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
{ // assign attribute locations
|
|
118
|
-
gl.bindAttribLocation(program, 0, "center_position");
|
|
119
|
-
gl.bindAttribLocation(program, 1, "radius");
|
|
120
|
-
gl.bindAttribLocation(program, 2, "color");
|
|
121
|
-
gl.bindAttribLocation(program, 3, "dash_ratio");
|
|
122
|
-
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.cameraBindingPoint = 0;
|
|
126
|
-
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
127
|
-
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
128
|
-
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
createVAO(centerObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj) {
|
|
132
|
-
const { gl } = this;
|
|
133
|
-
const vao = gl.createVertexArray();
|
|
134
|
-
const divisor = 1;
|
|
135
|
-
gl.bindVertexArray(vao);
|
|
136
|
-
{ // make this a function end import from account module.
|
|
137
|
-
const { buffer, stride = 0, offset = 0 } = centerObj;
|
|
138
|
-
vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
|
|
139
|
-
}
|
|
140
|
-
{
|
|
141
|
-
const { buffer, stride = 0, offset = 0 } = radiusObj;
|
|
142
|
-
vaoAttributeLoader(gl, buffer, 1, 1, stride, offset, divisor);
|
|
143
|
-
}
|
|
144
|
-
{
|
|
145
|
-
const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
146
|
-
vaoAttributeLoader(gl, buffer, 2, 4, stride, offset, divisor);
|
|
147
|
-
}
|
|
148
|
-
{
|
|
149
|
-
const { buffer, stride = 0, offset = 0 } = dashRatioObj;
|
|
150
|
-
vaoAttributeLoader(gl, buffer, 3, 1, stride, offset, divisor);
|
|
151
|
-
}
|
|
152
|
-
{
|
|
153
|
-
const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
|
|
154
|
-
vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
|
|
155
|
-
}
|
|
156
|
-
gl.bindVertexArray(null);
|
|
157
|
-
gl.bindVertexArray(null);
|
|
158
|
-
return vao;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
draw(vao, length, opacity) {
|
|
162
|
-
const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
163
|
-
gl.useProgram(program);
|
|
164
|
-
|
|
165
|
-
if (this._lastOpacity !== opacity) {
|
|
166
|
-
gl.uniform1f(program.uniforms.opacity, opacity);
|
|
167
|
-
this._lastOpacity = opacity;
|
|
168
|
-
}
|
|
169
|
-
gl.bindVertexArray(vao);
|
|
170
|
-
cameraBlockTotem.bind(cameraBindingPoint);
|
|
171
|
-
gl.drawArraysInstanced(gl.LINE_STRIP, 0, EDGE_COUNT_ON_SPHERE + 1, length);
|
|
172
|
-
cameraBlockTotem.unbind(cameraBindingPoint);
|
|
173
|
-
gl.bindVertexArray(null);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
free() {
|
|
179
|
-
if (this.isFreed) return;
|
|
180
|
-
CameraUniformBlockTotemCache.release(this.globe);
|
|
181
|
-
this.gl.deleteProgram(this.program);
|
|
182
|
-
this.isFreed = true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
export const CircleCache = Object.freeze({
|
|
189
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
190
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
191
|
-
});
|
|
@@ -1,188 +0,0 @@
|
|
|
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 { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
-
import { Z_ALPHA_MODE } from "./util";
|
|
7
|
-
import {
|
|
8
|
-
cartesian3DToGLPosition,
|
|
9
|
-
circleLimpFromLongLatRadCenterCartesian3D_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 = 720;
|
|
24
|
-
|
|
25
|
-
const vertexShaderSource = `#version 300 es
|
|
26
|
-
precision highp float;
|
|
27
|
-
${CameraUniformBlockString}
|
|
28
|
-
${cartesian3DToGLPosition}
|
|
29
|
-
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
in vec3 center_position3d;
|
|
33
|
-
in float big_radius;
|
|
34
|
-
in float small_radius;
|
|
35
|
-
in vec4 color;
|
|
36
|
-
|
|
37
|
-
uniform float edge_count;
|
|
38
|
-
uniform float step_angle;
|
|
39
|
-
uniform int z_alpha_on;
|
|
40
|
-
|
|
41
|
-
out float interpolation;
|
|
42
|
-
out vec4 v_color;
|
|
43
|
-
void main() {
|
|
44
|
-
if( !is3D) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
v_color = color;
|
|
48
|
-
if ( z_alpha_on == 1 ){
|
|
49
|
-
float z_alpha = pow(z_level * 0.75, 3.0) * distance(big_radius, small_radius) / (R * 2.0);
|
|
50
|
-
if ( z_alpha < 0.1 ) { return; }
|
|
51
|
-
v_color.a *= z_alpha;
|
|
52
|
-
}
|
|
53
|
-
int pad_phase = gl_VertexID % 2; // 0 or 1
|
|
54
|
-
interpolation = float( gl_VertexID - pad_phase) / edge_count;
|
|
55
|
-
float angle = float( gl_VertexID - pad_phase) * step_angle;
|
|
56
|
-
vec3 position;
|
|
57
|
-
if ( pad_phase == 0 ) {
|
|
58
|
-
position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, big_radius, angle);
|
|
59
|
-
} else {
|
|
60
|
-
position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, small_radius, angle);
|
|
61
|
-
}
|
|
62
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
63
|
-
|
|
64
|
-
gl_PointSize = 5.0;
|
|
65
|
-
}`
|
|
66
|
-
|
|
67
|
-
const fragmentShaderSource = `#version 300 es
|
|
68
|
-
${POLE}
|
|
69
|
-
precision highp float;
|
|
70
|
-
uniform float opacity;
|
|
71
|
-
in vec4 v_color;
|
|
72
|
-
in float interpolation;
|
|
73
|
-
in vec2 v_limp;
|
|
74
|
-
out vec4 color;
|
|
75
|
-
void main() {
|
|
76
|
-
color = v_color;
|
|
77
|
-
color.a *= opacity;
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class Logic {
|
|
84
|
-
|
|
85
|
-
constructor(globe) {
|
|
86
|
-
this.globe = globe;
|
|
87
|
-
this.gl = globe.gl;
|
|
88
|
-
this._lastOpacity = 1.0;
|
|
89
|
-
this._lastEdgeCount = INITIAL_EDGE_COUNT;
|
|
90
|
-
this._lastStepAngle = 720 / INITIAL_EDGE_COUNT;
|
|
91
|
-
this._lastZAlphaMode = Z_ALPHA_MODE.ON;
|
|
92
|
-
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
93
|
-
|
|
94
|
-
const { gl, program } = this;
|
|
95
|
-
this.program.uniforms = {
|
|
96
|
-
opacity: gl.getUniformLocation(program, "opacity"),
|
|
97
|
-
edgeCount: gl.getUniformLocation(program, "edge_count"),
|
|
98
|
-
stepAngle: gl.getUniformLocation(program, "step_angle"),
|
|
99
|
-
zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
{ // initial uniform values
|
|
103
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
104
|
-
gl.useProgram(program);
|
|
105
|
-
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
106
|
-
gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
|
|
107
|
-
gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
|
|
108
|
-
gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
|
|
109
|
-
gl.useProgram(currentProgram);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
{ // assign attribute locations
|
|
113
|
-
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
114
|
-
gl.bindAttribLocation(program, 1, "big_radius");
|
|
115
|
-
gl.bindAttribLocation(program, 2, "small_radius");
|
|
116
|
-
gl.bindAttribLocation(program, 3, "color");
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.cameraBindingPoint = 0;
|
|
121
|
-
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
122
|
-
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
123
|
-
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
createVAO(center3dObj, bigRadiusObj, smallRadiusObj, colorObj) {
|
|
127
|
-
const { gl } = this;
|
|
128
|
-
const vao = gl.createVertexArray();
|
|
129
|
-
const divisor = 1;
|
|
130
|
-
gl.bindVertexArray(vao);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
attributeLoader(gl, center3dObj, 0, 3, { divisor });
|
|
134
|
-
|
|
135
|
-
attributeLoader(gl, bigRadiusObj, 1, 1, { divisor });
|
|
136
|
-
|
|
137
|
-
attributeLoader(gl, smallRadiusObj, 2, 1, { divisor });
|
|
138
|
-
|
|
139
|
-
attributeLoader(gl, colorObj, 3, 4, { divisor });
|
|
140
|
-
|
|
141
|
-
gl.bindVertexArray(null);
|
|
142
|
-
return vao;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
draw(vao, length, edgeCount, stepAngle, opacity, zAlphaMode = Z_ALPHA_MODE.ON) {
|
|
146
|
-
const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
147
|
-
gl.useProgram(program);
|
|
148
|
-
|
|
149
|
-
if (this._lastOpacity !== opacity) {
|
|
150
|
-
gl.uniform1f(program.uniforms.opacity, opacity);
|
|
151
|
-
this._lastOpacity = opacity;
|
|
152
|
-
}
|
|
153
|
-
if (this._lastEdgeCount !== edgeCount) {
|
|
154
|
-
gl.uniform1f(program.uniforms.edgeCount, 2 * edgeCount);
|
|
155
|
-
this._lastEdgeCount = edgeCount;
|
|
156
|
-
}
|
|
157
|
-
if (this._lastStepAngle !== stepAngle) {
|
|
158
|
-
gl.uniform1f(program.uniforms.stepAngle, stepAngle * Math.PI / 360);
|
|
159
|
-
this._lastStepAngle = stepAngle;
|
|
160
|
-
}
|
|
161
|
-
if (this._lastZAlphaMode !== zAlphaMode) {
|
|
162
|
-
gl.uniform1i(program.uniforms.zAlphaMode, zAlphaMode);
|
|
163
|
-
this._lastZAlphaMode = zAlphaMode;
|
|
164
|
-
}
|
|
165
|
-
gl.bindVertexArray(vao);
|
|
166
|
-
cameraBlockTotem.bind(cameraBindingPoint);
|
|
167
|
-
gl.drawArraysInstanced(gl.LINES, 0, edgeCount * 2, length);
|
|
168
|
-
// gl.drawArraysInstanced(gl.POINTS, 0, edgeCount, length);
|
|
169
|
-
cameraBlockTotem.unbind(cameraBindingPoint);
|
|
170
|
-
gl.bindVertexArray(null);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
free() {
|
|
176
|
-
if (this.isFreed) return;
|
|
177
|
-
CameraUniformBlockTotemCache.release(this.globe);
|
|
178
|
-
this.gl.deleteProgram(this.program);
|
|
179
|
-
this.isFreed = true;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
export const CirclePadding3DCache = Object.freeze({
|
|
186
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
187
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
188
|
-
});
|
|
File without changes
|