@pirireis/webglobeplugins 0.16.4 → 0.17.0
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/angle-calculation.js +1 -0
- package/Math/arc.js +92 -2
- package/Math/circle-cdf-points.js +2 -2
- package/Math/circle.js +2 -2
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/juction/arc-plane.js +67 -12
- package/Math/juction/line-sphere.js +6 -6
- package/Math/juction/plane-plane.js +4 -6
- package/Math/methods.js +5 -5
- package/Math/templete-shapes/grid-visually-equal.js +0 -1
- package/Math/tessellation/earcut/adapters.js +37 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/methods.js +46 -0
- package/Math/tessellation/shred-input.js +18 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/tiler.js +50 -0
- package/Math/tessellation/triangle-tessellation-meta.js +516 -0
- package/Math/tessellation/triangle-tessellation.js +14 -0
- package/Math/tessellation/zoom-catch.js +1 -0
- package/Math/vec3.js +26 -1
- package/compass-rose/compass-text-writer.js +39 -33
- package/constants.js +3 -0
- package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
- package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
- package/heatwave/index.js +5 -3
- package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
- package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
- package/package.json +7 -3
- package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
- package/programs/arrowfield/logic.js +1 -1
- package/programs/data2legend/density-to-legend.js +24 -29
- package/programs/data2legend/point-to-density-texture.js +14 -17
- package/programs/float2legendwithratio/logic.js +2 -2
- package/programs/float2legendwithratio/object.js +1 -1
- package/programs/helpers/{blender/program.js → blender.js} +1 -1
- package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
- package/programs/index.js +20 -9
- package/programs/line-on-globe/circle-accurate-3d.js +12 -14
- package/programs/line-on-globe/circle-accurate-flat.js +0 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
- package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
- package/programs/picking/pickable-polygon-renderer.js +1 -1
- package/programs/picking/pickable-renderer.js +2 -2
- package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/point-on-globe/square-pixel-point.js +1 -1
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +204 -0
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +31 -10
- package/programs/polygon-on-globe/texture-dem-triangles.js +81 -12
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +34 -45
- package/programs/two-d/pixel-padding-for-compass.js +14 -24
- package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
- package/programs/vectorfields/logics/pixelbased.js +1 -2
- package/programs/vectorfields/pingpongbuffermanager.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
- package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
- package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
- package/range-tools-on-terrain/range-ring/plugin.js +4 -6
- package/semiplugins/lightweight/line-plugin.js +0 -1
- package/semiplugins/shape-on-terrain/arc-plugin.js +5 -7
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -2
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
- package/semiplugins/utility/container-plugin.js +94 -0
- package/semiplugins/utility/object-pass-container-plugin.js +80 -0
- package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
- package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
- package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
- package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
- package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
- package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
- package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
- package/types.js +6 -0
- package/util/account/bufferoffsetmanager.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
- package/util/gl-util/uniform-block/manager.js +4 -5
- package/util/gl-util/uniform-block/types.js +0 -7
- package/util/index.js +10 -13
- package/util/picking/fence.js +16 -18
- package/util/picking/picker-displayer.js +4 -6
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/shaderfunctions/geometrytransformations.js +6 -0
- package/util/webglobe/rasteroverlay.js +1 -0
- package/vectorfield/arrowfield/index.js +3 -0
- package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
- package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
- package/{wind → vectorfield/wind}/index.js +1 -1
- package/{wind → vectorfield/wind}/plugin.js +32 -32
- package/write-text/attached-text-writer.js +9 -1
- package/write-text/context-text3.js +0 -1
- package/write-text/objectarraylabels/index.js +2 -0
- package/Math/mesh/mapbox-delaunay.js +0 -544
- package/arrowfield/index.js +0 -3
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -444
- package/circle-line-chain/chain-list-map.js +0 -201
- package/circle-line-chain/plugin.js +0 -411
- package/circle-line-chain/util.js +0 -1
- package/compassrose/compassrose.js +0 -293
- package/compassrose/index.js +0 -2
- package/index.js +0 -12
- package/partialrings/buffer-manager.js +0 -75
- package/partialrings/index.js +0 -2
- package/partialrings/plugin.js +0 -128
- package/partialrings/program.js +0 -279
- package/programs/arrowfield/index.js +0 -2
- package/programs/globe-util/is-globe-moved.js +0 -19
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/wiggle/index.js +0 -2
- package/programs/helpers/blender/index.js +0 -1
- package/programs/helpers/fadeaway/index.js +0 -2
- package/programs/helpers/fadeaway/object.js +0 -14
- package/programs/helpers/index.js +0 -2
- package/programs/rings/distancering/circleflatprogram.js +0 -116
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
- package/programs/rings/distancering/index.js +0 -6
- package/programs/rings/distancering/paddyflatprogram.js +0 -127
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
- package/programs/two-d/pixel-circle.js +0 -1
- package/programs/vectorfields/index.js +0 -3
- package/rangerings/enum.js +0 -2
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -543
- package/rangerings/rangeringangletext.js +0 -326
- package/rangerings/ring-account.js +0 -112
- package/timetracks/index.js +0 -1
- package/util/build-strategy/general-strategy.js +0 -62
- package/util/gl-util/uniform-block/shader.js +0 -1
- package/util/heatwavedatamanager/index.js +0 -2
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/jshelpers/data-filler.js +0 -17
- package/util/jshelpers/equality.js +0 -18
- package/util/jshelpers/index.js +0 -2
- package/util/jshelpers/timefilters.js +0 -30
- package/util/programs/index.js +0 -1
- package/util/surface-line-data/arc-bboxes.js +0 -25
- package/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/util/surface-line-data/cut-arc.js +0 -1
- package/util/surface-line-data/flow.js +0 -28
- package/util/surface-line-data/rbush-manager.js +0 -1
- package/util/surface-line-data/web-worker.js +0 -1
- package/write-text/context-text3old.js +0 -152
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -8
- /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
- /package/{util/surface-line-data → Math/tessellation}/types.js +0 -0
- /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
- /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
- /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
- /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import { createProgram } from '../../../util';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
init(globe, gl) {
|
|
10
|
-
this.gl = gl;
|
|
11
|
-
this.globe = globe;
|
|
12
|
-
this.programWrapper = this._createProgramWrapper();
|
|
13
|
-
this._transformArray = new Float32Array(3);
|
|
14
|
-
this.setGeometry();
|
|
15
|
-
this.resize();
|
|
16
|
-
this.updateTime(0);
|
|
17
|
-
this.setMesh({ xRes: 64, yRes: 64, eastWestTied: false });
|
|
18
|
-
}
|
|
19
|
-
_createProgramWrapper() {
|
|
20
|
-
const vertexShader = `#version 300 es
|
|
1
|
+
import { createProgram } from '../../../util/webglobjectbuilders';
|
|
2
|
+
import { noRegisterGlobeProgramCache } from '../../../programs/programcache';
|
|
3
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache, CameraUniformBlockTotem } from "../../../programs/totems/camerauniformblock";
|
|
4
|
+
const UniformBlockBindingPoints = {
|
|
5
|
+
ShellBlock: 0,
|
|
6
|
+
CameraBlock: 1,
|
|
7
|
+
};
|
|
8
|
+
const vertexShader = `#version 300 es
|
|
21
9
|
#define R 6378.137
|
|
22
10
|
#define PI 3.1415926535897932384626433832795
|
|
23
11
|
#define POLE 20037508.34
|
|
@@ -35,14 +23,7 @@ export default class Logic {
|
|
|
35
23
|
float u_opacity;
|
|
36
24
|
};
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
uniform mat4 u_projection_matrix;
|
|
40
|
-
uniform vec3 u_translate;
|
|
41
|
-
|
|
42
|
-
uniform vec2 u_mapWH;
|
|
43
|
-
uniform vec2 u_scrWH;
|
|
44
|
-
|
|
45
|
-
uniform bool u_is3D;
|
|
26
|
+
${CameraUniformBlockString}
|
|
46
27
|
|
|
47
28
|
out float v_opacity;
|
|
48
29
|
out vec2 v_texture_coordinate;
|
|
@@ -72,8 +53,8 @@ export default class Logic {
|
|
|
72
53
|
float mercX = x * POLE_BY_PI;
|
|
73
54
|
float mercY = log(tan(HALF_PI - y / 2.0 )) * POLE_BY_PI;
|
|
74
55
|
|
|
75
|
-
float normX = ( mercX -
|
|
76
|
-
float normY = ( mercY -
|
|
56
|
+
float normX = ( mercX - translate.x ) / mapWH.x;
|
|
57
|
+
float normY = ( mercY - translate.y ) / mapWH.y;
|
|
77
58
|
return vec2(normX, normY);
|
|
78
59
|
}
|
|
79
60
|
|
|
@@ -89,16 +70,16 @@ export default class Logic {
|
|
|
89
70
|
|
|
90
71
|
void main() {
|
|
91
72
|
vec2 texCoord = f_texCoord();
|
|
92
|
-
if (
|
|
73
|
+
if (is3D){
|
|
93
74
|
vec3 unit_sphere_pos = f_onSphere(texCoord);
|
|
94
75
|
float wiggle = f_wiggle(texCoord);
|
|
95
76
|
vec3 position = f_position(unit_sphere_pos, wiggle);
|
|
96
|
-
gl_Position =
|
|
77
|
+
gl_Position = projection * view * vec4(position - translate, 1.0);
|
|
97
78
|
} else {
|
|
98
79
|
vec2 position = f_onFlat(texCoord);
|
|
99
|
-
gl_Position =
|
|
100
|
-
position.x *
|
|
101
|
-
(1.0 - position.y) *
|
|
80
|
+
gl_Position = projection * vec4(
|
|
81
|
+
position.x * screenWH.x,
|
|
82
|
+
(1.0 - position.y) * screenWH.y,
|
|
102
83
|
0.0,
|
|
103
84
|
1.0);
|
|
104
85
|
}
|
|
@@ -106,7 +87,7 @@ export default class Logic {
|
|
|
106
87
|
v_opacity = u_opacity;
|
|
107
88
|
}
|
|
108
89
|
`;
|
|
109
|
-
|
|
90
|
+
const fragmentShader = `#version 300 es
|
|
110
91
|
precision lowp float;
|
|
111
92
|
in vec2 v_texture_coordinate;
|
|
112
93
|
in float v_opacity;
|
|
@@ -118,22 +99,33 @@ export default class Logic {
|
|
|
118
99
|
outColor = texture(u_texture, v_texture_coordinate);
|
|
119
100
|
outColor.a *= v_opacity;
|
|
120
101
|
}`;
|
|
102
|
+
class BBOXGlobeShellProgram {
|
|
103
|
+
constructor(globe) {
|
|
104
|
+
this.id = "BBOXGlobeShellProgram";
|
|
105
|
+
this.description = "This program implements flyweight pattern for globe." +
|
|
106
|
+
"At globes draw3D call stack, this program should be prior to any program that uses it." +
|
|
107
|
+
"draw3D method of this object only sets Projetion, ModelView and Translate matrices and if the mode is 2D mapWH .";
|
|
108
|
+
this.gl = globe.gl;
|
|
109
|
+
this.globe = globe;
|
|
110
|
+
this.programWrapper = this._createProgramWrapper();
|
|
111
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
112
|
+
this.cameraBlockTotem.assignBindingPoint(this.programWrapper.program, UniformBlockBindingPoints.CameraBlock);
|
|
113
|
+
this._transformArray = new Float32Array(3);
|
|
114
|
+
// this.setGeometry();
|
|
115
|
+
// this.resize();
|
|
116
|
+
this.updateTime(0);
|
|
117
|
+
this.setMesh({ xRes: 64, yRes: 64, eastWestTied: false });
|
|
118
|
+
}
|
|
119
|
+
_createProgramWrapper() {
|
|
121
120
|
const gl = this.gl;
|
|
122
121
|
const program = createProgram(gl, vertexShader, fragmentShader);
|
|
123
122
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
124
123
|
gl.useProgram(program);
|
|
125
|
-
this.shellBlockBindingPoint = 0;
|
|
126
124
|
const shellBlockIndex = gl.getUniformBlockIndex(program, "ShellBlock");
|
|
127
|
-
gl.uniformBlockBinding(program, shellBlockIndex,
|
|
125
|
+
gl.uniformBlockBinding(program, shellBlockIndex, UniformBlockBindingPoints.ShellBlock);
|
|
128
126
|
gl.useProgram(currentProgram);
|
|
129
127
|
return {
|
|
130
128
|
program,
|
|
131
|
-
u_model_view_matrix: gl.getUniformLocation(program, "u_model_view_matrix"),
|
|
132
|
-
u_projection_matrix: gl.getUniformLocation(program, "u_projection_matrix"),
|
|
133
|
-
u_translate: gl.getUniformLocation(program, "u_translate"),
|
|
134
|
-
u_is3D: gl.getUniformLocation(program, "u_is3D"),
|
|
135
|
-
u_scrWH: gl.getUniformLocation(program, "u_scrWH"),
|
|
136
|
-
u_mapWH: gl.getUniformLocation(program, "u_mapWH"),
|
|
137
129
|
u_texture: gl.getUniformLocation(program, "u_texture"),
|
|
138
130
|
u_mesh_resolution: gl.getUniformLocation(program, "u_mesh_resolution"),
|
|
139
131
|
};
|
|
@@ -149,62 +141,58 @@ export default class Logic {
|
|
|
149
141
|
gl.uniform1f(this.programWrapper.u_time, time);
|
|
150
142
|
gl.useProgram(currentProgram);
|
|
151
143
|
}
|
|
152
|
-
setRotationAndTranslation(uProjectionMatrix, uModelViewMatrix, uTranslate, resetCurrentProgram = false) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
gl.enable(gl.DEPTH_TEST);
|
|
206
|
-
}
|
|
207
|
-
draw(texture, shellBlockDataManager, drawLines = false) {
|
|
144
|
+
// setRotationAndTranslation(uProjectionMatrix, uModelViewMatrix, uTranslate, resetCurrentProgram = false) {
|
|
145
|
+
// const gl = this.gl;
|
|
146
|
+
// let currentProgram = null;
|
|
147
|
+
// if (resetCurrentProgram) { currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) };
|
|
148
|
+
// gl.useProgram(this.programWrapper.program);
|
|
149
|
+
// gl.uniformMatrix4fv(this.programWrapper.projection, false, uProjectionMatrix);
|
|
150
|
+
// gl.uniformMatrix4fv(this.programWrapper.view, false, uModelViewMatrix);
|
|
151
|
+
// this._transformArray.set([uTranslate.x, uTranslate.y, uTranslate.z], 0);
|
|
152
|
+
// gl.uniform3fv(this.programWrapper.translate, this._transformArray);
|
|
153
|
+
// if (resetCurrentProgram) gl.useProgram(currentProgram);
|
|
154
|
+
// }
|
|
155
|
+
// setGeometry() {
|
|
156
|
+
// const { globe, gl } = this;
|
|
157
|
+
// const { is3D, screenWH, program } = this.programWrapper;
|
|
158
|
+
// const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
159
|
+
// const is3D = this.globe.api_GetCurrentGeometry() === 0;
|
|
160
|
+
// gl.useProgram(program);
|
|
161
|
+
// if (globe.api_GetCurrentGeometry() === globe.api_GeometryTypes().FLAT) {
|
|
162
|
+
// gl.uniform2f(screenWH, globe.api_ScrW(), globe.api_ScrH());
|
|
163
|
+
// }
|
|
164
|
+
// gl.uniform1i(is3D, is3D);
|
|
165
|
+
// gl.useProgram(currentProgram);
|
|
166
|
+
// }
|
|
167
|
+
// resize() {
|
|
168
|
+
// const { gl, globe } = this;
|
|
169
|
+
// if (!globe) return;
|
|
170
|
+
// const { program, screenWH } = this.programWrapper;
|
|
171
|
+
// const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
172
|
+
// gl.useProgram(program);
|
|
173
|
+
// if (globe.api_GetCurrentGeometry() === globe.api_GeometryTypes().FLAT) {
|
|
174
|
+
// gl.uniform2f(screenWH, globe.api_ScrW(), globe.api_ScrH());
|
|
175
|
+
// }
|
|
176
|
+
// gl.useProgram(currentProgram);
|
|
177
|
+
// }
|
|
178
|
+
// only sets
|
|
179
|
+
// data does not draw
|
|
180
|
+
// draw3D(csRenderPass) {
|
|
181
|
+
// const { gl, globe } = this;
|
|
182
|
+
// const { program } = this.programWrapper; //view, projection, translate
|
|
183
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
184
|
+
// gl.useProgram(program);
|
|
185
|
+
// // gl.uniformMatrix4fv(projection, false, uProjectionMatrix);
|
|
186
|
+
// // gl.uniformMatrix4fv(view, false, uModelViewMatrix);
|
|
187
|
+
// // // this._transformArray.set([], 0);
|
|
188
|
+
// // gl.uniform3f(translate, uTranslate.x, uTranslate.y, uTranslate.z);
|
|
189
|
+
// if (globe.api_GetCurrentGeometry() === 1) {
|
|
190
|
+
// const { width, height } = globe.api_GetCurrentWorldWH();
|
|
191
|
+
// gl.uniform2fv(this.programWrapper.mapWH, [width, height]);
|
|
192
|
+
// }
|
|
193
|
+
// gl.enable(gl.DEPTH_TEST);
|
|
194
|
+
// }
|
|
195
|
+
draw(texture, shellBlockDataManager, drawLines = false, csRenderPass) {
|
|
208
196
|
const { gl, programWrapper, _vao, _drawCount } = this;
|
|
209
197
|
const { program, u_texture } = programWrapper;
|
|
210
198
|
gl.useProgram(program);
|
|
@@ -213,15 +201,18 @@ export default class Logic {
|
|
|
213
201
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
214
202
|
gl.uniform1i(u_texture, 0);
|
|
215
203
|
shellBlockDataManager.bind();
|
|
204
|
+
this.cameraBlockTotem.bind(UniformBlockBindingPoints.CameraBlock);
|
|
216
205
|
if (drawLines)
|
|
217
206
|
gl.drawElements(gl.LINES, _drawCount, gl.UNSIGNED_SHORT, 0);
|
|
218
207
|
gl.clearColor(0, 0, 0, 0);
|
|
219
208
|
gl.drawElements(gl.TRIANGLES, _drawCount, gl.UNSIGNED_SHORT, 0);
|
|
220
209
|
shellBlockDataManager.unbind();
|
|
210
|
+
this.cameraBlockTotem.unbind(UniformBlockBindingPoints.CameraBlock);
|
|
221
211
|
gl.bindVertexArray(null);
|
|
222
212
|
}
|
|
223
213
|
free() {
|
|
224
214
|
const { gl, programWrapper, _vao, _indexBuffer } = this;
|
|
215
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
225
216
|
gl.deleteBuffer(_indexBuffer);
|
|
226
217
|
gl.deleteVertexArray(_vao);
|
|
227
218
|
gl.deleteProgram(programWrapper.program);
|
|
@@ -329,7 +320,7 @@ class ShellBlockManager {
|
|
|
329
320
|
}
|
|
330
321
|
bind() {
|
|
331
322
|
const { gl, buffer } = this;
|
|
332
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER,
|
|
323
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, UniformBlockBindingPoints.ShellBlock, buffer);
|
|
333
324
|
}
|
|
334
325
|
free() {
|
|
335
326
|
const { gl, buffer } = this;
|
|
@@ -337,6 +328,14 @@ class ShellBlockManager {
|
|
|
337
328
|
}
|
|
338
329
|
unbind() {
|
|
339
330
|
const { gl } = this;
|
|
340
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER,
|
|
331
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, UniformBlockBindingPoints.ShellBlock, null);
|
|
341
332
|
}
|
|
342
333
|
}
|
|
334
|
+
export const BBOXGlobeShellProgramCache = Object.freeze({
|
|
335
|
+
get: function (globe) {
|
|
336
|
+
return noRegisterGlobeProgramCache.getProgram(globe, BBOXGlobeShellProgram);
|
|
337
|
+
},
|
|
338
|
+
release: function (globe) {
|
|
339
|
+
noRegisterGlobeProgramCache.releaseProgram(globe, BBOXGlobeShellProgram);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class GlobeShell {
|
|
1
|
+
import { BBOXGlobeShellProgramCache } from './logic';
|
|
2
|
+
export class BBOXGlobeShell {
|
|
4
3
|
constructor(gl, globe, { minLon = -180, maxLon = 180, minLat = -90, maxLat = 90, height = 0, u_opacity = 1, wiggleInKM = 0, wiggleSpeed = 0,
|
|
5
4
|
// eastWestTied, Not implemented yet
|
|
6
5
|
} = {}) {
|
|
7
6
|
this.gl = gl;
|
|
8
7
|
this.globe = globe;
|
|
9
|
-
this.program =
|
|
8
|
+
this.program = BBOXGlobeShellProgramCache.get(globe);
|
|
10
9
|
this.shellBlockManager = this.program.getShellBlockBufferManager();
|
|
11
10
|
this.update = this.shellBlockManager.update.bind(this.shellBlockManager);
|
|
12
11
|
this.innerTime = 0;
|
|
@@ -51,8 +50,8 @@ export default class GlobeShell {
|
|
|
51
50
|
*
|
|
52
51
|
* @param {*} program modelView, projection, translate, mapWH, scrWH, should be set before calling this function
|
|
53
52
|
*/
|
|
54
|
-
draw() {
|
|
55
|
-
this.program.draw(this.texture, this.shellBlockManager);
|
|
53
|
+
draw(csRenderPass) {
|
|
54
|
+
this.program.draw(this.texture, this.shellBlockManager, csRenderPass);
|
|
56
55
|
if (this.wiggleInKM > 0 && this.wiggleSpeed > 0) {
|
|
57
56
|
this.innerTime += this.wiggleSpeed;
|
|
58
57
|
this.shellBlockManager.update({ innerTime: this.innerTime });
|
|
@@ -60,7 +59,7 @@ export default class GlobeShell {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
free() {
|
|
63
|
-
|
|
62
|
+
BBOXGlobeShellProgramCache.release(this.globe);
|
|
64
63
|
this.shellBlockManager.free();
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CSRenderPassPluginKeys } from "../../constants";
|
|
2
|
+
export class ContainerPlugin {
|
|
3
|
+
id;
|
|
4
|
+
container = new Map();
|
|
5
|
+
active = true;
|
|
6
|
+
globe = null;
|
|
7
|
+
/**
|
|
8
|
+
* Asagidaki degerleri false yapmak ufak performans kazanclari saglar.
|
|
9
|
+
* Örneğin containera atılan pluginlerin sadece normal passda cizim yapmasi isteniyorsa
|
|
10
|
+
* supportSelectedPass ve supportEditingPass false yapilabilir.
|
|
11
|
+
*/
|
|
12
|
+
supportNormalPass = true;
|
|
13
|
+
supportSelectedPass = true;
|
|
14
|
+
supportEditingPass = true;
|
|
15
|
+
constructor(id, container) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.container = container;
|
|
18
|
+
}
|
|
19
|
+
init(globe, gl) {
|
|
20
|
+
this.globe = globe;
|
|
21
|
+
this.container.forEach((plugin) => {
|
|
22
|
+
plugin.init(globe, gl);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
setActive(active) {
|
|
26
|
+
this.active = active;
|
|
27
|
+
this.globe?.DrawRender();
|
|
28
|
+
}
|
|
29
|
+
draw3D(projectionMatrix, modelViewMatrix, transPosition, csRenderPass) {
|
|
30
|
+
if (!this.active)
|
|
31
|
+
return;
|
|
32
|
+
const passSupportKey = CSRenderPassPluginKeys[csRenderPass];
|
|
33
|
+
for (const plugin of this.container.values()) {
|
|
34
|
+
if (plugin[passSupportKey] === false) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (plugin.draw3D) {
|
|
38
|
+
plugin.draw3D(projectionMatrix, modelViewMatrix, transPosition, csRenderPass);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
draw2D(csRenderPass) {
|
|
43
|
+
if (!this.active)
|
|
44
|
+
return;
|
|
45
|
+
const passSupportKey = CSRenderPassPluginKeys[csRenderPass];
|
|
46
|
+
for (const plugin of this.container.values()) {
|
|
47
|
+
if (plugin[passSupportKey] === false) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (plugin.draw2D) {
|
|
51
|
+
plugin.draw2D(csRenderPass);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
free() {
|
|
56
|
+
for (const plugin of this.container.values()) {
|
|
57
|
+
plugin.free();
|
|
58
|
+
}
|
|
59
|
+
this.container.clear();
|
|
60
|
+
}
|
|
61
|
+
_forwardMouseEvent(eventName, x, y, event, csRenderPass) {
|
|
62
|
+
if (!this.active)
|
|
63
|
+
return false;
|
|
64
|
+
const passSupportKey = CSRenderPassPluginKeys[csRenderPass];
|
|
65
|
+
for (const plugin of this.container.values()) {
|
|
66
|
+
if (plugin[passSupportKey] === false) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const handler = plugin[eventName];
|
|
70
|
+
if (handler) {
|
|
71
|
+
const result = handler.call(plugin, x, y, event, csRenderPass);
|
|
72
|
+
if (result === true) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
mouseClick(x, y, event, csRenderPass) {
|
|
80
|
+
return this._forwardMouseEvent('mouseClick', x, y, event, csRenderPass);
|
|
81
|
+
}
|
|
82
|
+
mouseDblClick(x, y, event, csRenderPass) {
|
|
83
|
+
return this._forwardMouseEvent('mouseDblClick', x, y, event, csRenderPass);
|
|
84
|
+
}
|
|
85
|
+
mouseDown(x, y, event, csRenderPass) {
|
|
86
|
+
return this._forwardMouseEvent('mouseDown', x, y, event, csRenderPass);
|
|
87
|
+
}
|
|
88
|
+
mouseMove(x, y, event, csRenderPass) {
|
|
89
|
+
return this._forwardMouseEvent('mouseMove', x, y, event, csRenderPass);
|
|
90
|
+
}
|
|
91
|
+
mouseUp(x, y, event, csRenderPass) {
|
|
92
|
+
return this._forwardMouseEvent('mouseUp', x, y, event, csRenderPass);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* object-pass-plugin.ts
|
|
3
|
+
* Manages object pass between instances of same plugin with different configurations
|
|
4
|
+
*/
|
|
5
|
+
import { ContainerPlugin } from "./container-plugin";
|
|
6
|
+
export class ObjectPassContainerPlugin extends ContainerPlugin {
|
|
7
|
+
keyMethod;
|
|
8
|
+
insertMethod;
|
|
9
|
+
removeMethod;
|
|
10
|
+
objectContainer;
|
|
11
|
+
constructor(id, container, keyMethod, insertMethod, removeMethod) {
|
|
12
|
+
super(id, container);
|
|
13
|
+
this.keyMethod = keyMethod;
|
|
14
|
+
this.insertMethod = insertMethod;
|
|
15
|
+
this.removeMethod = removeMethod;
|
|
16
|
+
this.objectContainer = new Map();
|
|
17
|
+
}
|
|
18
|
+
passObjects(keys, extraParameters, toPluginId) {
|
|
19
|
+
const toPlugin = this.container.get(toPluginId);
|
|
20
|
+
if (!toPlugin) {
|
|
21
|
+
throw new Error(`Plugin with id ${toPluginId} not found in plugin container`);
|
|
22
|
+
}
|
|
23
|
+
const itemsToPass = [];
|
|
24
|
+
for (const key of keys) {
|
|
25
|
+
const entry = this.objectContainer.get(key);
|
|
26
|
+
if (!entry) {
|
|
27
|
+
console.warn(`Object with key ${key} not found in object container`);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const [pluginId, item] = entry;
|
|
31
|
+
if (pluginId === toPluginId) {
|
|
32
|
+
console.warn(`Object with key ${key} is already in the target plugin ${toPluginId}`);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
itemsToPass.push(item);
|
|
36
|
+
const fromPlugin = this.container.get(pluginId);
|
|
37
|
+
if (!fromPlugin) {
|
|
38
|
+
throw new Error(`Plugin with id ${pluginId} not found in plugin container`);
|
|
39
|
+
}
|
|
40
|
+
entry[0] = toPluginId; // update plugin id in the container
|
|
41
|
+
this.removeMethod(key, extraParameters, fromPlugin);
|
|
42
|
+
}
|
|
43
|
+
if (this.insertMethod) {
|
|
44
|
+
this.insertMethod(itemsToPass, extraParameters, toPlugin);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
insertObjects(items, extraParameters, toPluginId) {
|
|
48
|
+
const toPlugin = this.container.get(toPluginId);
|
|
49
|
+
if (!toPlugin) {
|
|
50
|
+
throw new Error(`Plugin with id ${toPluginId} not found in plugin container`);
|
|
51
|
+
}
|
|
52
|
+
for (const item of items) {
|
|
53
|
+
const key = this.keyMethod(item);
|
|
54
|
+
this.objectContainer.set(key, [toPluginId, item]);
|
|
55
|
+
}
|
|
56
|
+
if (this.insertMethod) {
|
|
57
|
+
this.insertMethod(items, extraParameters, toPlugin);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
removeObjects(keys, extraParameters) {
|
|
61
|
+
for (const key of keys) {
|
|
62
|
+
const entry = this.objectContainer.get(key);
|
|
63
|
+
if (!entry) {
|
|
64
|
+
console.warn(`Object with key ${key} not found in object container`);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const [pluginId, item] = entry;
|
|
68
|
+
const fromPlugin = this.container.get(pluginId);
|
|
69
|
+
if (!fromPlugin) {
|
|
70
|
+
throw new Error(`Plugin with id ${pluginId} not found in plugin container`);
|
|
71
|
+
}
|
|
72
|
+
this.removeMethod(key, extraParameters, fromPlugin);
|
|
73
|
+
this.objectContainer.delete(key);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
passAllObjects(extraParameters, toPluginId) {
|
|
77
|
+
const keys = Array.from(this.objectContainer.keys());
|
|
78
|
+
this.passObjects(keys, extraParameters, toPluginId);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js
RENAMED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @property {Array<Number>} times
|
|
30
30
|
* @param {Array<Timetrack>} timeTracks
|
|
31
31
|
*/
|
|
32
|
-
import { pixelXYLenghtToUnitVectorWithHeight } from "
|
|
32
|
+
import { pixelXYLenghtToUnitVectorWithHeight } from "../../../Math/methods";
|
|
33
33
|
const processACut = (array, offset) => {
|
|
34
34
|
// first 3 values of array
|
|
35
35
|
const v3 = array.slice(offset, offset + 3);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PointHeatmapFlow } from "./point-to-heat-map-flow";
|
|
2
|
-
import { createWorker } from "
|
|
3
|
-
import { createTexture, getColorRampModed } from "
|
|
4
|
-
import { opacityCheck, constraintFloat } from "
|
|
2
|
+
import { createWorker } from "../../util/interpolation/timetrack/index";
|
|
3
|
+
import { createTexture, getColorRampModed } from "../../util/webglobjectbuilders";
|
|
4
|
+
import { opacityCheck, constraintFloat } from "../../util/check/typecheck";
|
|
5
5
|
class PointHeatmapPlugin {
|
|
6
6
|
constructor(id, { opacity = 1.0, pointSize = 5.0, onInterpolationComplete = () => { } } = {}) {
|
|
7
7
|
this.id = id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { densityToLegendProgramCache } from "
|
|
2
|
-
import { pointToDensityTextureCache } from "
|
|
3
|
-
// import { textureOnCanvasProgramCache } from "
|
|
4
|
-
import { defaultblendfunction } from "
|
|
1
|
+
import { densityToLegendProgramCache } from "../../programs/data2legend/density-to-legend";
|
|
2
|
+
import { pointToDensityTextureCache } from "../../programs/data2legend/point-to-density-texture";
|
|
3
|
+
// import { textureOnCanvasProgramCache } from "../../util/programs/draw-texture-on-canvas";
|
|
4
|
+
import { defaultblendfunction } from "../../util/webglobe/gldefaultstates";
|
|
5
5
|
class PointHeatmapFlow {
|
|
6
6
|
constructor(globe) {
|
|
7
7
|
this.globe = null;
|
|
@@ -15,16 +15,13 @@ class PointHeatmapFlow {
|
|
|
15
15
|
// this.testTextureProgram = textureOnCanvasProgramCache.get(globe.gl);
|
|
16
16
|
this._lookInfo = globe.api_GetCurrentLookInfo();
|
|
17
17
|
const { gl } = this;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.densityTexture = this._createDensityTexture();
|
|
26
|
-
this._bindTextureToFramebuffer();
|
|
27
|
-
}
|
|
18
|
+
this.buffer = gl.createBuffer();
|
|
19
|
+
this.vao2D = this.pointToDensityProgram.createVAO(this.buffer, 2);
|
|
20
|
+
this.vao3D = this.pointToDensityProgram.createVAO(this.buffer, 3);
|
|
21
|
+
// framebuffer and texture
|
|
22
|
+
this.framebuffer = gl.createFramebuffer();
|
|
23
|
+
this.densityTexture = this._createDensityTexture();
|
|
24
|
+
this._bindTextureToFramebuffer();
|
|
28
25
|
}
|
|
29
26
|
_bindTextureToFramebuffer() {
|
|
30
27
|
const { gl, densityTexture, framebuffer } = this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BufferOrchestrator, BufferManager, ObjectStore } from "
|
|
2
|
-
import { PickerDisplayer } from "
|
|
3
|
-
import { PointOnGlobeProgramCache } from "
|
|
4
|
-
import { wgs84ToCartesian3d, wgs84ToMercator } from "
|
|
1
|
+
import { BufferOrchestrator, BufferManager, ObjectStore } from "../../util/account/index";
|
|
2
|
+
import { PickerDisplayer } from "../../util/picking/picker-displayer";
|
|
3
|
+
import { PointOnGlobeProgramCache } from "../../programs/point-on-globe/square-pixel-point";
|
|
4
|
+
import { wgs84ToCartesian3d, wgs84ToMercator } from "../../Math/methods";
|
|
5
5
|
const _0vec3 = /* @__PURE__ */ [0, 0, 0];
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {number} long
|
|
@@ -347,7 +347,7 @@ class PointTracksPlugin {
|
|
|
347
347
|
const key = keyMethod(trackID, pointID);
|
|
348
348
|
const index = this._bufferOrchestrator.offsetMap.get(key);
|
|
349
349
|
if (index === undefined) {
|
|
350
|
-
throw new Error;
|
|
350
|
+
throw new Error(`Point with key ${key} not found in buffer orchestrator.`);
|
|
351
351
|
}
|
|
352
352
|
indexes.push(index);
|
|
353
353
|
length++;
|