@pirireis/webglobeplugins 0.9.6 → 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 +5 -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 -22
- 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,89 +0,0 @@
|
|
|
1
|
-
// this contains vao, drawCount, ArrowBufferBlock, vao,
|
|
2
|
-
// how to, where to set instanced parameters
|
|
3
|
-
// the vectorfield buffer should be managed outside, since it can be static or dynamic.
|
|
4
|
-
|
|
5
|
-
import Logic from './logic';
|
|
6
|
-
import { globeProgramCache } from '../programcache';
|
|
7
|
-
import { longlatbbox2normalbbox } from "../util";
|
|
8
|
-
|
|
9
|
-
export default class ArrowField {
|
|
10
|
-
constructor(gl, globe, {
|
|
11
|
-
minLon = -180,
|
|
12
|
-
maxLon = 180,
|
|
13
|
-
minLat = -90,
|
|
14
|
-
maxLat = 90,
|
|
15
|
-
height = 0,
|
|
16
|
-
opacity = 1,
|
|
17
|
-
color = [0.04, 0.2, 0.8],
|
|
18
|
-
targetWidth = 100,
|
|
19
|
-
targetHeight = 100,
|
|
20
|
-
dataWidth = null,
|
|
21
|
-
dataHeight = null,
|
|
22
|
-
tailLengthRatio = 1,
|
|
23
|
-
wingLengthRatio = 0.5,
|
|
24
|
-
noDataValue = null,
|
|
25
|
-
// maxMagnitude = null
|
|
26
|
-
} = {}) {
|
|
27
|
-
this.gl = gl;
|
|
28
|
-
this.globe = globe;
|
|
29
|
-
|
|
30
|
-
this.program = globeProgramCache.getProgram(globe, Logic);
|
|
31
|
-
this.arrowBlockManager = this.program.getArrowBlockBufferManager();
|
|
32
|
-
this.instanceCount = targetWidth * targetHeight;
|
|
33
|
-
this.arrowBlockManager.update({ resolution: [targetWidth, targetHeight] });
|
|
34
|
-
this.textureManager = this.program.getTextureManager(dataWidth, dataHeight);
|
|
35
|
-
this.setBBox({ minLon, maxLon, minLat, maxLat });
|
|
36
|
-
this.update({ height, opacity, color, tailLengthRatio, wingLengthRatio, noDataValue });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setBBox({ minLon = -180, maxLon = 180, minLat = -90, maxLat = 90 } = {}) {
|
|
41
|
-
this.bbox = { minLon, maxLon, minLat, maxLat };
|
|
42
|
-
const { bboxSizeRad, bboxOffsetRad } = longlatbbox2normalbbox(this.bbox);
|
|
43
|
-
this.arrowBlockManager.update({ bboxSizeRad, bboxOffsetRad });
|
|
44
|
-
this.globe.DrawRender();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
update({ height, opacity, color, resolution, tailLengthRatio, wingLengthRatio, noDataValue } = {}) {
|
|
49
|
-
if (resolution) {
|
|
50
|
-
this.instanceCount = resolution[0] * resolution[1];
|
|
51
|
-
}
|
|
52
|
-
this.arrowBlockManager.update({
|
|
53
|
-
color,
|
|
54
|
-
resolution,
|
|
55
|
-
height,
|
|
56
|
-
opacity,
|
|
57
|
-
tailLengthRatio,
|
|
58
|
-
wingLengthRatio,
|
|
59
|
-
noDataValue,
|
|
60
|
-
});
|
|
61
|
-
this.globe.DrawRender();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
setTargetResolution(width, height) {
|
|
65
|
-
this.instanceCount = width * height;
|
|
66
|
-
this.arrowBlockManager.update({ resolution: [width, height] });
|
|
67
|
-
|
|
68
|
-
this.globe.DrawRender();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
draw() {
|
|
72
|
-
const { program, arrowBlockManager, textureManager, instanceCount } = this;
|
|
73
|
-
program.draw(arrowBlockManager, textureManager, instanceCount);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setData(rotation) {
|
|
78
|
-
this.textureManager.setData(rotation);
|
|
79
|
-
this.globe.DrawRender();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
free() {
|
|
84
|
-
this.arrowBlockManager.free();
|
|
85
|
-
this.textureManager.free();
|
|
86
|
-
globeProgramCache.releaseProgram(this.gl, Logic);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../../util/";
|
|
2
|
-
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const vs = `#version 300 es
|
|
6
|
-
precision highp float;
|
|
7
|
-
|
|
8
|
-
uniform sampler2D u_density_texture;
|
|
9
|
-
in vec2 a_position;
|
|
10
|
-
|
|
11
|
-
out vec2 v_texcoord;
|
|
12
|
-
|
|
13
|
-
void main() {
|
|
14
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
15
|
-
v_texcoord = a_position * 0.5 + 0.5;
|
|
16
|
-
}`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const fs = `#version 300 es
|
|
20
|
-
precision highp float;
|
|
21
|
-
|
|
22
|
-
uniform sampler2D u_legend_texture;
|
|
23
|
-
uniform sampler2D u_density_texture;
|
|
24
|
-
|
|
25
|
-
uniform float u_opacity;
|
|
26
|
-
in vec2 v_texcoord;
|
|
27
|
-
out vec4 fragColor;
|
|
28
|
-
|
|
29
|
-
void main() {
|
|
30
|
-
float density = texture(u_density_texture, v_texcoord).r;
|
|
31
|
-
fragColor = texture(u_legend_texture, vec2(density, 0.5));
|
|
32
|
-
fragColor.a *= u_opacity * sqrt(density);
|
|
33
|
-
}`;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class DensityToLegendProgram {
|
|
39
|
-
constructor(globe) {
|
|
40
|
-
this.globe = globe;
|
|
41
|
-
this.gl = globe.gl;
|
|
42
|
-
this.program = createProgram(globe.gl, vs, fs);
|
|
43
|
-
const { gl, program } = this;
|
|
44
|
-
this.uniforms = {
|
|
45
|
-
densityTexture: gl.getUniformLocation(program, "u_density_texture"),
|
|
46
|
-
legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
|
|
47
|
-
opacity: gl.getUniformLocation(program, "u_opacity"),
|
|
48
|
-
}
|
|
49
|
-
{ // assign attribute locations
|
|
50
|
-
gl.bindAttribLocation(program, 0, "a_position");
|
|
51
|
-
}
|
|
52
|
-
{
|
|
53
|
-
this.vao = gl.createVertexArray();
|
|
54
|
-
const a_positionLocation = gl.getAttribLocation(program, "a_position");
|
|
55
|
-
gl.bindVertexArray(this.vao);
|
|
56
|
-
|
|
57
|
-
const buffer = gl.createBuffer();
|
|
58
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
59
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
60
|
-
-1, -1,
|
|
61
|
-
1, -1,
|
|
62
|
-
1, 1,
|
|
63
|
-
-1, 1,
|
|
64
|
-
]), gl.STATIC_DRAW);
|
|
65
|
-
gl.enableVertexAttribArray(a_positionLocation);
|
|
66
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
|
|
67
|
-
gl.bindVertexArray(null);
|
|
68
|
-
// gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
69
|
-
this._buffer = buffer;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
this._lastOpacity = 1;
|
|
74
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
75
|
-
gl.useProgram(program);
|
|
76
|
-
gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
77
|
-
gl.useProgram(currentProgram);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
draw(densityTexture, legendTexture, opacity) {
|
|
83
|
-
const { gl, program, uniforms } = this;
|
|
84
|
-
gl.useProgram(program);
|
|
85
|
-
gl.bindVertexArray(this.vao);
|
|
86
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
87
|
-
gl.bindTexture(gl.TEXTURE_2D, legendTexture);
|
|
88
|
-
gl.uniform1i(uniforms.legendTexture, 1);
|
|
89
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
90
|
-
gl.bindTexture(gl.TEXTURE_2D, densityTexture);
|
|
91
|
-
gl.uniform1i(uniforms.densityTexture, 0);
|
|
92
|
-
if (this._lastOpacity !== opacity) {
|
|
93
|
-
gl.uniform1f(uniforms.opacity, opacity);
|
|
94
|
-
this._lastOpacity = opacity;
|
|
95
|
-
}
|
|
96
|
-
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
97
|
-
gl.bindVertexArray(null);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
free() {
|
|
102
|
-
const gl = this.gl;
|
|
103
|
-
gl.deleteVertexArray(this.vao);
|
|
104
|
-
gl.deleteBuffer(this._buffer);
|
|
105
|
-
gl.deleteProgram(this.program);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const densityToLegendProgramCache = {
|
|
111
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, DensityToLegendProgram),
|
|
112
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, DensityToLegendProgram)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { densityToLegendProgramCache };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../../util/";
|
|
2
|
-
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
3
|
-
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
|
|
4
|
-
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const vs = `#version 300 es
|
|
8
|
-
precision highp float;
|
|
9
|
-
|
|
10
|
-
${CameraUniformBlockString}
|
|
11
|
-
${mercatorXYToGLPosition}
|
|
12
|
-
${cartesian3DToGLPosition}
|
|
13
|
-
|
|
14
|
-
in vec3 position;
|
|
15
|
-
uniform float pointSize;
|
|
16
|
-
|
|
17
|
-
void main() {
|
|
18
|
-
if (is3D) {
|
|
19
|
-
gl_Position = cartesian3DToGLPosition(position);
|
|
20
|
-
} else {
|
|
21
|
-
gl_Position = mercatorXYToGLPosition(position.xy);
|
|
22
|
-
}
|
|
23
|
-
gl_PointSize = pointSize;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const fs = `#version 300 es
|
|
29
|
-
precision highp float;
|
|
30
|
-
out vec4 fragColor;
|
|
31
|
-
|
|
32
|
-
void main() {
|
|
33
|
-
float r = length(gl_PointCoord - 0.5) * 2.0;
|
|
34
|
-
if (r > 1.0) discard;
|
|
35
|
-
// float density = smoothstep(0.1, 1.0, 1.0 - r);
|
|
36
|
-
fragColor = vec4((15.0/16.0)*sqrt(1.0-sqrt(r)));
|
|
37
|
-
}`;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class PointHeatmapProgram {
|
|
42
|
-
|
|
43
|
-
constructor(globe) {
|
|
44
|
-
this.globe = globe;
|
|
45
|
-
this.gl = globe.gl;
|
|
46
|
-
this._isFreed = false;
|
|
47
|
-
this.program = createProgram(globe.gl, vs, fs);
|
|
48
|
-
|
|
49
|
-
const { gl, program } = this;
|
|
50
|
-
this.uniforms = {
|
|
51
|
-
pointSize: gl.getUniformLocation(this.program, "pointSize"),
|
|
52
|
-
}
|
|
53
|
-
{ // assign attribute locations
|
|
54
|
-
gl.bindAttribLocation(program, 0, "position");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
{ // arrange camera uniform block
|
|
58
|
-
this.cameraBlockBingingPoint = 0;
|
|
59
|
-
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
60
|
-
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
61
|
-
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
{ // last values
|
|
65
|
-
this._lastPointSize = 0;
|
|
66
|
-
|
|
67
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
68
|
-
gl.useProgram(program);
|
|
69
|
-
gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
|
|
70
|
-
gl.useProgram(currentProgram);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
createVAO(positionBuffer, vectorSize) {
|
|
76
|
-
const gl = this.gl;
|
|
77
|
-
const vao = gl.createVertexArray();
|
|
78
|
-
gl.bindVertexArray(vao);
|
|
79
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
80
|
-
gl.enableVertexAttribArray(0);
|
|
81
|
-
gl.vertexAttribPointer(0, vectorSize, gl.FLOAT, false, 0, 0);
|
|
82
|
-
gl.bindVertexArray(null);
|
|
83
|
-
return vao;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
draw(vao, length, pointSize = 5.0) {
|
|
87
|
-
const gl = this.gl;
|
|
88
|
-
gl.useProgram(this.program);
|
|
89
|
-
if (pointSize !== this._lastPointSize) {
|
|
90
|
-
gl.uniform1f(this.uniforms.pointSize, pointSize);
|
|
91
|
-
this._lastPointSize = pointSize;
|
|
92
|
-
}
|
|
93
|
-
gl.bindVertexArray(vao);
|
|
94
|
-
this.cameraBlockTotem.bind(this.cameraBlockBingingPoint);
|
|
95
|
-
gl.drawArrays(gl.POINTS, 0, length);
|
|
96
|
-
this.cameraBlockTotem.unbind(this.cameraBlockBingingPoint);
|
|
97
|
-
gl.bindVertexArray(null);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
free() {
|
|
101
|
-
if (this._isFreed) return;
|
|
102
|
-
const { gl, globe } = this;
|
|
103
|
-
CameraUniformBlockTotemCache.release(globe);
|
|
104
|
-
gl.deleteProgram(this.program);
|
|
105
|
-
this._isFreed = true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const pointToDensityTextureCache = {
|
|
110
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, PointHeatmapProgram),
|
|
111
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, PointHeatmapProgram)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { pointToDensityTextureCache };
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../../util";
|
|
2
|
-
|
|
3
|
-
export default class {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(gl) {
|
|
7
|
-
this.gl = gl;
|
|
8
|
-
// console.log("Float2LegendWithRatioProgram gl:", gl);
|
|
9
|
-
this._width = 1;
|
|
10
|
-
this._height = 1;
|
|
11
|
-
|
|
12
|
-
this._blendRatio = 0.0;
|
|
13
|
-
this.programWrapper = this._createProgramWrapper();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_createProgramWrapper() {
|
|
18
|
-
const vertexShaderSource = `#version 300 es
|
|
19
|
-
precision highp float;
|
|
20
|
-
|
|
21
|
-
in vec2 a_position;
|
|
22
|
-
out vec2 v_texcoord;
|
|
23
|
-
|
|
24
|
-
void main() {
|
|
25
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
26
|
-
v_texcoord = a_position * 0.5 + 0.5;
|
|
27
|
-
v_texcoord.y = 1.0 - v_texcoord.y;
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const fragmentShaderSource = `#version 300 es
|
|
32
|
-
precision highp float;
|
|
33
|
-
|
|
34
|
-
in vec2 v_texcoord;
|
|
35
|
-
uniform sampler2D u_float_texture0;
|
|
36
|
-
uniform sampler2D u_float_texture1;
|
|
37
|
-
uniform sampler2D u_color_texture;
|
|
38
|
-
|
|
39
|
-
layout(std140) uniform HeatParametersBlock {
|
|
40
|
-
vec2 u_color_ramp_range; // x is min, y is range ( max - min)
|
|
41
|
-
vec2 u_min_max;
|
|
42
|
-
float u_escape_value;
|
|
43
|
-
float u_blend_ratio;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
out vec4 outColor;
|
|
47
|
-
|
|
48
|
-
void main() {
|
|
49
|
-
if ( u_blend_ratio < 0.0) {
|
|
50
|
-
outColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
float f0 = texture(u_float_texture0, v_texcoord).r;
|
|
54
|
-
float f1 = texture(u_float_texture1, v_texcoord).r;
|
|
55
|
-
// outColor = vec4(
|
|
56
|
-
|
|
57
|
-
if (f0 == u_escape_value || f1 == u_escape_value) {
|
|
58
|
-
outColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
float x = mix(f0, f1, u_blend_ratio);
|
|
62
|
-
if ( x < u_min_max.x || x > u_min_max.y) {
|
|
63
|
-
outColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
x = (x - u_color_ramp_range.x) / u_color_ramp_range.y;
|
|
67
|
-
outColor = texture(u_color_texture, vec2(x, 0.5));
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const gl = this.gl;
|
|
72
|
-
const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
73
|
-
const vao = gl.createVertexArray();
|
|
74
|
-
gl.bindVertexArray(vao);
|
|
75
|
-
const buffer = gl.createBuffer();
|
|
76
|
-
this._buffer = buffer;
|
|
77
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
78
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
79
|
-
-1, -1,
|
|
80
|
-
1, -1,
|
|
81
|
-
1, 1,
|
|
82
|
-
-1, 1
|
|
83
|
-
]), gl.STATIC_DRAW);
|
|
84
|
-
const positionLocation = gl.getAttribLocation(program, "a_position");
|
|
85
|
-
gl.enableVertexAttribArray(positionLocation);
|
|
86
|
-
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
|
|
87
|
-
gl.bindVertexArray(null);
|
|
88
|
-
|
|
89
|
-
this.heatParametersBlockBindingPoint = 0;
|
|
90
|
-
|
|
91
|
-
const heatParametersBlockIndex = gl.getUniformBlockIndex(program, "HeatParametersBlock");
|
|
92
|
-
gl.uniformBlockBinding(program, heatParametersBlockIndex, this.heatParametersBlockBindingPoint);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
program,
|
|
97
|
-
vao,
|
|
98
|
-
u_float_texture0: gl.getUniformLocation(program, "u_float_texture0"),
|
|
99
|
-
u_float_texture1: gl.getUniformLocation(program, "u_float_texture1"),
|
|
100
|
-
u_color_texture: gl.getUniformLocation(program, "u_color_texture"),
|
|
101
|
-
u_blend_ratio: gl.getUniformLocation(program, "u_blend_ratio"),
|
|
102
|
-
u_color_ramp_range: gl.getUniformLocation(program, "u_color_ramp_range"),
|
|
103
|
-
u_min_max: gl.getUniformLocation(program, "u_min_max"),
|
|
104
|
-
u_escape_value: gl.getUniformLocation(program, "u_escape_value")
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
getUniformBlockManager() {
|
|
110
|
-
return new HeatParametersBlockManager(this.gl);
|
|
111
|
-
}
|
|
112
|
-
draw(texture0, texture1, colorRampTexture, heatParametersBlockManager) {
|
|
113
|
-
const { gl, programWrapper } = this;
|
|
114
|
-
const { program, u_float_texture0, u_float_texture1, u_color_texture } = programWrapper;
|
|
115
|
-
|
|
116
|
-
gl.useProgram(program);
|
|
117
|
-
gl.bindVertexArray(programWrapper.vao);
|
|
118
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
119
|
-
gl.bindTexture(gl.TEXTURE_2D, texture1);
|
|
120
|
-
gl.uniform1i(u_float_texture1, 1);
|
|
121
|
-
gl.activeTexture(gl.TEXTURE2);
|
|
122
|
-
gl.bindTexture(gl.TEXTURE_2D, colorRampTexture);
|
|
123
|
-
gl.uniform1i(u_color_texture, 2);
|
|
124
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
125
|
-
gl.bindTexture(gl.TEXTURE_2D, texture0);
|
|
126
|
-
gl.uniform1i(u_float_texture0, 0);
|
|
127
|
-
heatParametersBlockManager.bind();
|
|
128
|
-
// clear output texture
|
|
129
|
-
gl.clearColor(0, 0, 0, 0);
|
|
130
|
-
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
131
|
-
gl.bindVertexArray(null);
|
|
132
|
-
heatParametersBlockManager.unbind();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
free() {
|
|
137
|
-
const gl = this.gl;
|
|
138
|
-
gl.deleteBuffer(this._buffer);
|
|
139
|
-
gl.deleteProgram(this.programWrapper.program);
|
|
140
|
-
gl.deleteVertexArray(this.programWrapper.vao);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
class HeatParametersBlockManager {
|
|
147
|
-
constructor(gl) {
|
|
148
|
-
this.gl = gl;
|
|
149
|
-
this.buffer = gl.createBuffer();
|
|
150
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, this.buffer);
|
|
151
|
-
gl.bufferData(gl.UNIFORM_BUFFER, 24, gl.DYNAMIC_DRAW);
|
|
152
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/*
|
|
157
|
-
* @param {Array<number>} color_ramp_range [minValue,( maxValue - minValue)]
|
|
158
|
-
* @param {Array<number>} min_max [minEdge, maxEdge]
|
|
159
|
-
* @param {number} escape_value // value that will be ignored
|
|
160
|
-
* @param {number} blend_ratio // ratio of blending between two textures
|
|
161
|
-
* */
|
|
162
|
-
update({ color_ramp_range = null, min_max = null, escape_value = null, blend_ratio = null }) {
|
|
163
|
-
const { gl, buffer } = this;
|
|
164
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
165
|
-
if (color_ramp_range) {
|
|
166
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array(color_ramp_range));
|
|
167
|
-
}
|
|
168
|
-
if (min_max) {
|
|
169
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array(min_max));
|
|
170
|
-
}
|
|
171
|
-
if (escape_value) {
|
|
172
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 16, new Float32Array([escape_value]));
|
|
173
|
-
}
|
|
174
|
-
if (blend_ratio) {
|
|
175
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 20, new Float32Array([blend_ratio]));
|
|
176
|
-
}
|
|
177
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
bind() {
|
|
181
|
-
const { gl, buffer } = this;
|
|
182
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, this.heatParametersBlockBindingPoint, buffer);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
free() {
|
|
186
|
-
this.gl.deleteBuffer(this.buffer);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
unbind() {
|
|
190
|
-
const { gl } = this;
|
|
191
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, this.heatParametersBlockBindingPoint, null);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import Float2LegentWithRatioProgram from './logic';
|
|
2
|
-
import { glProgramCache } from '../programcache';
|
|
3
|
-
|
|
4
|
-
// Uniform Buffer Objects use this
|
|
5
|
-
|
|
6
|
-
export default class DataObject {
|
|
7
|
-
constructor(gl, {
|
|
8
|
-
width = 1,
|
|
9
|
-
height = 1,
|
|
10
|
-
texture0 = null,
|
|
11
|
-
texture1 = null,
|
|
12
|
-
colorRampTexture = null,
|
|
13
|
-
colorRampRange = null,
|
|
14
|
-
escapeValue = 99999,
|
|
15
|
-
blendRatio = 0.0,
|
|
16
|
-
minMaxEdges = null,
|
|
17
|
-
} = {}) {
|
|
18
|
-
this.gl = gl;
|
|
19
|
-
this.programlogic = glProgramCache.getProgram(gl, Float2LegentWithRatioProgram);
|
|
20
|
-
this.heatParametersBlockManager = this.programlogic.getUniformBlockManager();
|
|
21
|
-
this.width = width;
|
|
22
|
-
this.height = height;
|
|
23
|
-
this.texture0 = texture0 || this._createColorRampTexture(width, height);
|
|
24
|
-
this.texture1 = texture1 || this._createColorRampTexture(width, height);
|
|
25
|
-
this.colorRampTexture = colorRampTexture || this._createColorRampTexture();
|
|
26
|
-
this.minMaxEdges = minMaxEdges || new Float32Array([-99999, 99999]);
|
|
27
|
-
this.heatParametersBlockManager.update({
|
|
28
|
-
escape_value: escapeValue,
|
|
29
|
-
blend_ratio: blendRatio,
|
|
30
|
-
min_max: minMaxEdges,
|
|
31
|
-
color_ramp_range: colorRampRange
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_bindBlock() {
|
|
39
|
-
const gl = this.gl;
|
|
40
|
-
const program = this.programlogic.programWrapper.program;
|
|
41
|
-
gl.uniformBlockBinding(program, gl.getUniformBlockIndex(program, 'Block'), 0);
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_createColorRampTexture() {
|
|
47
|
-
const { gl } = this;
|
|
48
|
-
const texture = gl.createTexture();
|
|
49
|
-
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
50
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
51
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
52
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
53
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
54
|
-
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
55
|
-
return texture;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setBlendRatio(ratio) {
|
|
59
|
-
if (ratio < 0 || ratio > 1) {
|
|
60
|
-
console.warn('Invalid blend ratio');
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
this.heatParametersBlockManager.update({ blend_ratio: ratio });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
setEscapeValue(value) {
|
|
67
|
-
this.heatParametersBlockManager.update({ escape_value: value });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setTexture0(texture) {
|
|
72
|
-
this.texture0 = texture;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
setTexture1(texture) {
|
|
76
|
-
this.texture1 = texture;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
setColorRampTexture(texture) {
|
|
80
|
-
this.colorRampTexture = texture;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
setDataWidthHeight(width, height) {
|
|
85
|
-
this.width = width;
|
|
86
|
-
this.height = height;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
setFloatTextureData(data0, data1, width, height, yFlip = false) {
|
|
91
|
-
const { texture0, texture1, gl } = this;
|
|
92
|
-
|
|
93
|
-
gl.bindTexture(gl.TEXTURE_2D, texture0);
|
|
94
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, yFlip);
|
|
95
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data0);
|
|
96
|
-
gl.bindTexture(gl.TEXTURE_2D, texture1);
|
|
97
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data1);
|
|
98
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
discard() {
|
|
103
|
-
this.heatParametersBlockManager.update({ blend_ratio: -1 });
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
setColorRampTextureData(data, size) {
|
|
108
|
-
const { gl, colorRampTexture } = this;
|
|
109
|
-
gl.bindTexture(gl.TEXTURE_2D, colorRampTexture);
|
|
110
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
setColorRampRange(min, max) {
|
|
114
|
-
if (min > max) {
|
|
115
|
-
console.warn('Invalid min max values');
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const range = max - min;
|
|
119
|
-
this.heatParametersBlockManager.update({ color_ramp_range: new Float32Array([min, range]) });
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
setMinMaxEdges(min, max) {
|
|
123
|
-
if (min) this.minMaxEdges[0] = min;
|
|
124
|
-
if (max) this.minMaxEdges[1] = max;
|
|
125
|
-
this.heatParametersBlockManager.update({ min_max: this.minMaxEdges });
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
draw() {
|
|
129
|
-
this.programlogic.draw(this.texture0, this.texture1, this.colorRampTexture, this.heatParametersBlockManager);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
free() {
|
|
133
|
-
const { gl, texture0, texture1, colorRampTexture } = this;
|
|
134
|
-
gl.deleteTexture(texture0);
|
|
135
|
-
gl.deleteTexture(texture1);
|
|
136
|
-
gl.deleteTexture(colorRampTexture);
|
|
137
|
-
glProgramCache.releaseProgram(this.gl, Float2LegentWithRatioProgram);
|
|
138
|
-
this.heatParametersBlockManager.free();
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
2
|
-
|
|
3
|
-
class IsGlobeMoved {
|
|
4
|
-
constructor(globe) {
|
|
5
|
-
this.globe = globe;
|
|
6
|
-
|
|
7
|
-
this._lastLOD = globe.api_GetCurrentLODWithDecimal();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
isMoved() {
|
|
11
|
-
const globe = this.globe;
|
|
12
|
-
if (globe.api_IsScreenMoving() || this._lastLOD != globe.api_GetCurrentLODWithDecimal()) {
|
|
13
|
-
this._lastLOD = globe.api_GetCurrentLODWithDecimal();
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const IsGlobeMovedCache = Object.freeze({
|
|
25
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, IsGlobeMoved),
|
|
26
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, IsGlobeMoved)
|
|
27
|
-
});
|
|
File without changes
|