@pirireis/webglobeplugins 0.9.12 → 0.9.14
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 -3
- package/Math/arc.js +29 -32
- package/Math/bounds/line-bbox.js +1 -3
- package/Math/constants.js +1 -6
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +32 -35
- package/Math/juction/line-sphere.js +9 -12
- package/Math/juction/plane-plane.js +15 -18
- package/Math/line.js +30 -33
- package/Math/methods.js +6 -24
- package/Math/plane.js +22 -25
- package/Math/quaternion.js +6 -9
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +5 -8
- package/algorithms/search-binary.js +1 -4
- package/altitude-locator/draw-subset-obj.js +1 -3
- package/altitude-locator/plugin.js +34 -37
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +1 -4
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +3 -6
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +62 -66
- package/circle-line-chain/chain-list-map.js +1 -5
- package/circle-line-chain/plugin.js +46 -50
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +12 -16
- package/compass-rose/compass-text-writer.js +3 -7
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +6 -9
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +7 -9
- package/heatwave/isobar/plugin.js +14 -54
- package/heatwave/isobar/quadtreecontours.js +2 -4
- package/heatwave/plugins/heatwaveglobeshell.js +9 -12
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +2 -8
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +13 -20
- package/partialrings/program.js +23 -30
- package/pin/pin-object-array.js +8 -13
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +3 -6
- package/point-heat-map/plugin-webworker.js +11 -14
- package/point-heat-map/point-to-heat-map-flow.js +9 -12
- package/point-tracks/key-methods.js +1 -4
- package/point-tracks/plugin.js +15 -19
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +7 -10
- package/programs/arrowfield/object.js +7 -13
- package/programs/data2legend/density-to-legend.js +6 -9
- package/programs/data2legend/point-to-density-texture.js +13 -16
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +3 -6
- package/programs/float2legendwithratio/object.js +5 -11
- package/programs/globe-util/is-globe-moved.js +3 -5
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +3 -6
- package/programs/globeshell/wiggle/object.js +5 -11
- package/programs/helpers/blender/program.js +3 -6
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +3 -6
- package/programs/helpers/fadeaway/object.js +5 -11
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +19 -22
- package/programs/line-on-globe/circle-accurate-3d.js +21 -24
- package/programs/line-on-globe/circle-accurate-flat.js +18 -24
- package/programs/line-on-globe/circle-accurate.js +27 -30
- package/programs/line-on-globe/circle.js +26 -29
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +23 -26
- package/programs/line-on-globe/lines-color-instanced-flat.js +20 -24
- package/programs/line-on-globe/linestrip.js +28 -31
- package/programs/line-on-globe/naive-accurate-flexible.js +29 -32
- package/programs/line-on-globe/to-the-surface.js +15 -17
- package/programs/line-on-globe/util.js +1 -4
- package/programs/picking/pickable-renderer.js +25 -28
- package/programs/point-on-globe/element-globe-surface-glow.js +22 -25
- package/programs/point-on-globe/element-point-glow.js +26 -29
- package/programs/point-on-globe/square-pixel-point.js +13 -16
- package/programs/programcache.js +1 -6
- package/programs/rings/distancering/circleflatprogram.js +20 -56
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +21 -58
- package/programs/rings/distancering/circlepaddysharedbuffer.js +1 -4
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +21 -57
- package/programs/rings/distancering/paddyflatprogram2d.js +21 -57
- package/programs/rings/distancering/paddyflatprogram3d.js +21 -57
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +23 -25
- package/programs/totems/camerauniformblock.js +7 -11
- package/programs/totems/canvas-webglobe-info.js +6 -10
- package/programs/totems/gpu-selection-uniform-block.js +7 -11
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +10 -13
- package/programs/util.js +1 -3
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +9 -12
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +10 -13
- package/programs/vectorfields/logics/ubo.js +1 -7
- package/programs/vectorfields/pingpongbuffermanager.js +1 -4
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +61 -68
- package/rangerings/rangeringangletext.js +26 -29
- package/rangerings/ring-account.js +1 -6
- package/shaders/fragment-toy/firework.js +1 -4
- package/shaders/fragment-toy/singularity.js +1 -4
- package/timetracks/adaptors-line-strip.js +3 -9
- package/timetracks/adaptors.js +3 -8
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +6 -12
- package/timetracks/plugin.js +6 -12
- package/timetracks/program-line-strip.js +9 -12
- package/timetracks/program.js +10 -13
- package/timetracks/programpoint-line-strip.js +6 -9
- package/timetracks/programpoint.js +6 -9
- package/util/account/bufferoffsetmanager.js +1 -4
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +1 -5
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +1 -5
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +1 -5
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +1 -5
- package/util/algorithms/search-binary.js +1 -4
- package/util/check/get.js +1 -5
- package/util/check/typecheck.js +7 -16
- package/util/geometry/index.js +1 -7
- package/util/gl-util/buffer/attribute-loader.js +2 -6
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +2 -6
- package/util/gl-util/uniform-block/manager.js +2 -5
- package/util/heatwavedatamanager/datamanager.js +1 -4
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +3 -9
- package/util/heatwavedatamanager/pointcoordsmeta.js +1 -4
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +1 -4
- package/util/interpolation/timetrack/timetrack-interpolator.js +6 -10
- package/util/interpolation/timetrack/web-worker-str.js +1 -4
- package/util/interpolation/timetrack/web-worker.js +2 -4
- package/util/jshelpers/data-filler.js +1 -4
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +1 -3
- package/util/picking/fence.js +1 -4
- package/util/picking/picker-displayer.js +6 -9
- package/util/programs/draw-texture-on-canvas.js +6 -9
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +9 -13
- package/util/programs/supersampletotextures.js +3 -7
- package/util/programs/texturetoglobe.js +8 -11
- package/util/shaderfunctions/geometrytransformations.js +24 -31
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +1 -4
- package/util/shaderfunctions/noisefunctions.js +1 -3
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +1 -4
- package/util/webglobjectbuilders.js +16 -34
- package/util/webglobjectbuilders1.js +16 -34
- package/waveparticles/adaptor.js +1 -3
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +9 -12
- package/wind/imagetovectorfieldandmagnitude.js +1 -4
- package/wind/index.js +5 -14
- package/wind/plugin.js +6 -45
- package/wind/vectorfieldimage.js +1 -3
- package/write-text/attached-text-writer.js +6 -10
- package/write-text/context-text.js +4 -8
- package/write-text/context-text3.js +7 -11
- package/write-text/index.js +1 -5
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
10
|
-
require("../../util/gl-util/draw-options/types");
|
|
11
|
-
const methods_1 = require("../../util/gl-util/draw-options/methods");
|
|
1
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems";
|
|
2
|
+
import { slerp, POLE, R_3D, mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { createProgram } from "../../util";
|
|
4
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
5
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
7
|
+
import "../../util/gl-util/draw-options/types";
|
|
8
|
+
import { drawInstanced } from "../../util/gl-util/draw-options/methods";
|
|
12
9
|
const GLOBE_MIDPOINT_COUNT = 30;
|
|
13
10
|
const escapeValue = -1.0;
|
|
14
11
|
const uniformBindingPoints = {
|
|
15
12
|
camera: 0,
|
|
16
13
|
flexible: 1
|
|
17
14
|
};
|
|
18
|
-
const uniformBlockManager = new
|
|
15
|
+
const uniformBlockManager = new UniformBlockManager('FlexibleAttibutes', [
|
|
19
16
|
{ name: 'u_color', type: 'vec4' },
|
|
20
17
|
{ name: 'u_dash_ratio', type: 'float' },
|
|
21
18
|
{ name: 'u_dash_opacity', type: 'float' }
|
|
@@ -23,11 +20,11 @@ const uniformBlockManager = new manager_1.UniformBlockManager('FlexibleAttibutes
|
|
|
23
20
|
const vertexShader = `#version 300 es
|
|
24
21
|
precision highp float;
|
|
25
22
|
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
29
|
-
${
|
|
30
|
-
${
|
|
23
|
+
${R_3D}
|
|
24
|
+
${CameraUniformBlockString}
|
|
25
|
+
${slerp}
|
|
26
|
+
${mercatorXYToGLPosition}
|
|
27
|
+
${cartesian3DToGLPosition}
|
|
31
28
|
|
|
32
29
|
${uniformBlockManager.glslCode()}
|
|
33
30
|
|
|
@@ -73,7 +70,7 @@ void main() {
|
|
|
73
70
|
}
|
|
74
71
|
`;
|
|
75
72
|
const fragmentShader = `#version 300 es
|
|
76
|
-
${
|
|
73
|
+
${POLE}
|
|
77
74
|
precision highp float;
|
|
78
75
|
|
|
79
76
|
uniform float opacity;
|
|
@@ -102,7 +99,7 @@ class Logic {
|
|
|
102
99
|
constructor(globe) {
|
|
103
100
|
this.globe = globe;
|
|
104
101
|
this.gl = globe.gl;
|
|
105
|
-
this.program =
|
|
102
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
106
103
|
this._lastOpacity = 1.0;
|
|
107
104
|
const { gl, program } = this;
|
|
108
105
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
@@ -118,7 +115,7 @@ class Logic {
|
|
|
118
115
|
this._opacityLocation = gl.getUniformLocation(program, "opacity");
|
|
119
116
|
gl.uniform1f(this._opacityLocation, this._lastOpacity);
|
|
120
117
|
gl.useProgram(currentProgram);
|
|
121
|
-
this.cameraBlockTotem =
|
|
118
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
122
119
|
this.cameraBlockTotem.assignBindingPoint(program, uniformBindingPoints.camera);
|
|
123
120
|
this._ubosPublished = [];
|
|
124
121
|
uniformBlockManager.assignBindingPoint(this.gl, this.program);
|
|
@@ -147,7 +144,7 @@ class Logic {
|
|
|
147
144
|
const vertexCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
|
|
148
145
|
const ubo = flexibleUBO || _defaultFlexibleUBO;
|
|
149
146
|
ubo.bind();
|
|
150
|
-
|
|
147
|
+
drawInstanced(gl, gl.LINE_STRIP, drawOptions, vertexCount);
|
|
151
148
|
ubo.unbind();
|
|
152
149
|
gl.bindVertexArray(null);
|
|
153
150
|
cameraBlockTotem.unbind(uniformBindingPoints.camera);
|
|
@@ -167,13 +164,13 @@ class Logic {
|
|
|
167
164
|
const vao = gl.createVertexArray();
|
|
168
165
|
gl.bindVertexArray(vao);
|
|
169
166
|
const divisor = 1;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
attributeLoader(gl, startPotision2DBufferObj, 0, 2, { divisor });
|
|
168
|
+
attributeLoader(gl, startPotision3DBufferObj, 1, 3, { divisor });
|
|
169
|
+
attributeLoader(gl, endPosition2DBufferObj, 2, 2, { divisor });
|
|
170
|
+
attributeLoader(gl, endPosition3DBufferObj, 3, 3, { divisor });
|
|
171
|
+
attributeLoader(gl, dashRatioBufferObj, 4, 1, { divisor, escapeValues: [escapeValue] });
|
|
172
|
+
attributeLoader(gl, dashOpacityBufferObj, 5, 1, { divisor, escapeValues: [escapeValue] });
|
|
173
|
+
attributeLoader(gl, colorBufferObj, 6, 4, { divisor, escapeValues: [escapeValue, escapeValue, escapeValue, escapeValue] });
|
|
177
174
|
gl.bindVertexArray(null);
|
|
178
175
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
179
176
|
this.vaosPublished.push(vao);
|
|
@@ -182,14 +179,14 @@ class Logic {
|
|
|
182
179
|
free() {
|
|
183
180
|
if (this.isFreed)
|
|
184
181
|
return;
|
|
185
|
-
|
|
182
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
186
183
|
this.gl.deleteProgram(this.program);
|
|
187
184
|
this.vaosPublished.forEach(vao => this.gl.deleteVertexArray(vao));
|
|
188
185
|
this._ubosPublished.forEach(ubo => ubo.free());
|
|
189
186
|
this.isFreed = true;
|
|
190
187
|
}
|
|
191
188
|
}
|
|
192
|
-
|
|
193
|
-
get: (globe) => { return
|
|
194
|
-
release: (globe) => { return
|
|
189
|
+
export const LineOnGlobeCache = Object.freeze({
|
|
190
|
+
get: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
191
|
+
release: (globe) => { return noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
195
192
|
});
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
require("../draw-options/types");
|
|
9
|
-
const methods_1 = require("../draw-options/methods");
|
|
1
|
+
import { createProgram } from './util';
|
|
2
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from '../totems';
|
|
3
|
+
import { cartesian3DToGLPosition, R_3D } from '../../util/shaderfunctions/geometrytransformations';
|
|
4
|
+
import { noRegisterGlobeProgramCache } from '../programcache';
|
|
5
|
+
import { attributeLoader } from '../../util/gl-util/buffer/attribute-loader';
|
|
6
|
+
import '../draw-options/types';
|
|
7
|
+
import { drawInstanced } from '../draw-options/methods';
|
|
10
8
|
const vs = `#version 300 es
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
${
|
|
9
|
+
${R_3D}
|
|
10
|
+
${CameraUniformBlockString}
|
|
11
|
+
${cartesian3DToGLPosition}
|
|
14
12
|
in vec3 pos3D
|
|
15
13
|
in vec4 color;
|
|
16
14
|
out float ratio;
|
|
@@ -44,7 +42,7 @@ class Logic {
|
|
|
44
42
|
constructor(globe) {
|
|
45
43
|
this.globe = globe;
|
|
46
44
|
this.gl = globe.gl;
|
|
47
|
-
this.program =
|
|
45
|
+
this.program = createProgram(this.gl, vs, fs);
|
|
48
46
|
const { gl, program } = this;
|
|
49
47
|
this._opacity = {
|
|
50
48
|
lastValue: 1.0,
|
|
@@ -65,7 +63,7 @@ class Logic {
|
|
|
65
63
|
gl.useProgram(program);
|
|
66
64
|
gl.bindAttribLocation(program, 0, 'pos3D');
|
|
67
65
|
gl.bindAttribLocation(program, 1, 'color');
|
|
68
|
-
this.cameraUniformBlockTotem = new
|
|
66
|
+
this.cameraUniformBlockTotem = new CameraUniformBlockTotemCache.get(globe);
|
|
69
67
|
this.cameraBlockBindingPoint = 0;
|
|
70
68
|
const cameraBlockIndex = gl.getUniformBlockLocation(program, 'CameraUniformBlock');
|
|
71
69
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
@@ -75,8 +73,8 @@ class Logic {
|
|
|
75
73
|
const vao = gl.createVertexArray();
|
|
76
74
|
const divisor = 1;
|
|
77
75
|
gl.bindVertexArray(vao);
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
attributeLoader(gl, pos3DObj, 0, 3, { divisor });
|
|
77
|
+
attributeLoader(gl, colorObj, 1, 4, { divisor, escapeValue: [-1, -1, -1, -1] });
|
|
80
78
|
gl.bindVertexArray(null);
|
|
81
79
|
this._vaoCache.push(vao);
|
|
82
80
|
return vao;
|
|
@@ -102,7 +100,7 @@ class Logic {
|
|
|
102
100
|
_opacity.lastValue = opacity;
|
|
103
101
|
gl.uniform1f(_opacity.location, opacity);
|
|
104
102
|
}
|
|
105
|
-
|
|
103
|
+
drawInstanced(gl, gl.TRIANGLE_FAN, drawOptions);
|
|
106
104
|
}
|
|
107
105
|
_updatePhase() {
|
|
108
106
|
this._phase.lastValue = (Date.now() / 3.0) % 1000;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const methods_1 = require("../../util/gl-util/draw-options/methods");
|
|
10
|
-
const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
|
|
11
|
-
const manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
1
|
+
import { createProgram } from "../../util";
|
|
2
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
|
+
import { mercatorXYToGLPosition, cartesian3DToGLPosition, R_3D, R } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
5
|
+
import "../../util/gl-util/draw-options/types";
|
|
6
|
+
import { drawArrays } from "../../util/gl-util/draw-options/methods";
|
|
7
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
8
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
12
9
|
const uniformBindingPoints = {
|
|
13
10
|
camera: 0,
|
|
14
11
|
flexible: 1
|
|
15
12
|
};
|
|
16
|
-
const uniformBlockManager = new
|
|
13
|
+
const uniformBlockManager = new UniformBlockManager("FlexibleBlock", [
|
|
17
14
|
{ name: "u_rgba", type: "vec4", value: new Float32Array([1, 1, 1, 1]) },
|
|
18
15
|
{ name: "u_opacity", type: "float", value: new Float32Array([1.0]) },
|
|
19
16
|
{ name: "u_size_multiplier", type: "float", value: new Float32Array([1.0]) },
|
|
@@ -26,11 +23,11 @@ const uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
|
26
23
|
{ name: "u_dash_phase", type: "float", value: new Float32Array([0.0]) },
|
|
27
24
|
], uniformBindingPoints.flexible);
|
|
28
25
|
const vs = `#version 300 es
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
26
|
+
${R}
|
|
27
|
+
${R_3D}
|
|
28
|
+
${CameraUniformBlockString}
|
|
29
|
+
${mercatorXYToGLPosition}
|
|
30
|
+
${cartesian3DToGLPosition}
|
|
34
31
|
|
|
35
32
|
${uniformBlockManager.glslCode()}
|
|
36
33
|
|
|
@@ -118,7 +115,7 @@ class PointOnGlobeProgram {
|
|
|
118
115
|
this.globe = globe;
|
|
119
116
|
this.gl = globe.gl;
|
|
120
117
|
this._isFreed = false;
|
|
121
|
-
this.program =
|
|
118
|
+
this.program = createProgram(this.gl, vs, fs);
|
|
122
119
|
const { gl, program } = this;
|
|
123
120
|
// assign opacity
|
|
124
121
|
// assign attribute locations
|
|
@@ -127,7 +124,7 @@ class PointOnGlobeProgram {
|
|
|
127
124
|
gl.bindAttribLocation(program, 2, "rgba");
|
|
128
125
|
gl.bindAttribLocation(program, 3, "size");
|
|
129
126
|
// arrange camera uniform block
|
|
130
|
-
this.cameraBlockTotem =
|
|
127
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
131
128
|
this.cameraBlockTotem.assignBindingPoint(program, uniformBindingPoints.camera);
|
|
132
129
|
uniformBlockManager.assignBindingPoint(this.gl, this.program);
|
|
133
130
|
this._defaultUBO = uniformBlockManager.createUBO(this.gl);
|
|
@@ -147,10 +144,10 @@ class PointOnGlobeProgram {
|
|
|
147
144
|
const { gl } = this;
|
|
148
145
|
const vao = gl.createVertexArray();
|
|
149
146
|
gl.bindVertexArray(vao);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
attributeLoader(gl, pos3DBufferObj, 0, 3);
|
|
148
|
+
attributeLoader(gl, pos2DBufferObj, 1, 2);
|
|
149
|
+
attributeLoader(gl, rgbaBufferObj, 2, 4, { escapeValues: [-1, -1, -1, -1] });
|
|
150
|
+
attributeLoader(gl, sizeBufferObj, 3, 1, { escapeValues: [-1] });
|
|
154
151
|
gl.bindVertexArray(null);
|
|
155
152
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
156
153
|
return vao;
|
|
@@ -167,7 +164,7 @@ class PointOnGlobeProgram {
|
|
|
167
164
|
this.cameraBlockTotem.bind(uniformBindingPoints.camera);
|
|
168
165
|
ubo = ubo || this._defaultUBO;
|
|
169
166
|
ubo.bind();
|
|
170
|
-
|
|
167
|
+
drawArrays(gl, gl.POINTS, drawOptions);
|
|
171
168
|
ubo.unbind();
|
|
172
169
|
this.cameraBlockTotem.unbind(uniformBindingPoints.camera);
|
|
173
170
|
gl.bindVertexArray(null);
|
|
@@ -176,13 +173,13 @@ class PointOnGlobeProgram {
|
|
|
176
173
|
if (this._isFreed)
|
|
177
174
|
return;
|
|
178
175
|
const { gl, globe } = this;
|
|
179
|
-
|
|
176
|
+
CameraUniformBlockTotemCache.release(globe);
|
|
180
177
|
gl.deleteProgram(this.program);
|
|
181
178
|
this._isFreed = true;
|
|
182
179
|
}
|
|
183
180
|
}
|
|
184
181
|
const PickableRendererProgramCache = Object.freeze({
|
|
185
|
-
get: (globe) =>
|
|
186
|
-
release: (globe) =>
|
|
182
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, PointOnGlobeProgram),
|
|
183
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, PointOnGlobeProgram)
|
|
187
184
|
});
|
|
188
|
-
|
|
185
|
+
export { PickableRendererProgramCache };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* *
|
|
4
3
|
* * *
|
|
@@ -6,24 +5,22 @@
|
|
|
6
5
|
* * *
|
|
7
6
|
* *
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
18
|
-
const uboBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
8
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
9
|
+
import { PI, mercatorXYToGLPosition, cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate } from "../../util/shaderfunctions/geometrytransformations";
|
|
10
|
+
import { createProgram } from "../../util";
|
|
11
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
12
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
13
|
+
import { drawInstanced } from "../../util/gl-util/draw-options/methods";
|
|
14
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
15
|
+
const uboBlockManager = new UniformBlockManager("FlexibleBlock", [
|
|
19
16
|
{ name: "u_color", type: "vec4" },
|
|
20
17
|
{ name: "u_radius", type: "float" }
|
|
21
18
|
], 1);
|
|
22
19
|
const vs = `#version 300 es
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
20
|
+
${PI}
|
|
21
|
+
${CameraUniformBlockString}
|
|
22
|
+
${cartesian3DToGLPosition}
|
|
23
|
+
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
27
24
|
|
|
28
25
|
uniform float edge_count;
|
|
29
26
|
|
|
@@ -71,7 +68,7 @@ class Logic {
|
|
|
71
68
|
this.globe = globe;
|
|
72
69
|
this.gl = globe.gl;
|
|
73
70
|
this._vaoCache = [];
|
|
74
|
-
this.program =
|
|
71
|
+
this.program = createProgram(this.gl, vs, fs);
|
|
75
72
|
const { gl, program } = this;
|
|
76
73
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
77
74
|
gl.useProgram(program);
|
|
@@ -91,7 +88,7 @@ class Logic {
|
|
|
91
88
|
gl.bindAttribLocation(program, 1, "radius");
|
|
92
89
|
gl.bindAttribLocation(program, 2, "color");
|
|
93
90
|
// camera uniform block
|
|
94
|
-
this.cameraUniformBlockTotem =
|
|
91
|
+
this.cameraUniformBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
95
92
|
this.cameraBlockBindingPoint = 0;
|
|
96
93
|
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
97
94
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
@@ -104,9 +101,9 @@ class Logic {
|
|
|
104
101
|
const divisor = 1;
|
|
105
102
|
gl.bindVertexArray(vao);
|
|
106
103
|
// TODO constants to escape values
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
attributeLoader(gl, pos3DObj, 0, 3, { divisor });
|
|
105
|
+
attributeLoader(gl, radiusObj, 1, 1, { divisor, escapeValues: [-1] });
|
|
106
|
+
attributeLoader(gl, colorObj, 2, 4, { divisor, escapeValues: [-1, -1, -1, -1] });
|
|
110
107
|
gl.bindVertexArray(null);
|
|
111
108
|
this._vaoCache.push(vao);
|
|
112
109
|
return vao;
|
|
@@ -121,14 +118,14 @@ class Logic {
|
|
|
121
118
|
}
|
|
122
119
|
ubo = ubo || this._defaultUBO;
|
|
123
120
|
ubo.bind();
|
|
124
|
-
|
|
121
|
+
drawInstanced(gl, gl.TRIANGLE_FAN, drawOptions);
|
|
125
122
|
ubo.unbind();
|
|
126
123
|
gl.bindVertexArray(null);
|
|
127
124
|
}
|
|
128
125
|
free() {
|
|
129
126
|
if (this._isFreed)
|
|
130
127
|
return;
|
|
131
|
-
|
|
128
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
132
129
|
this.gl.deleteProgram(this.program);
|
|
133
130
|
for (const vao of this._vaoCache)
|
|
134
131
|
this.gl.deleteVertexArray(vao);
|
|
@@ -136,7 +133,7 @@ class Logic {
|
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
const ElementGlobeSufaceGlowCache = Object.freeze({
|
|
139
|
-
get: (globe) =>
|
|
140
|
-
release: (globe) =>
|
|
136
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
137
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe)
|
|
141
138
|
});
|
|
142
|
-
|
|
139
|
+
export { ElementGlobeSufaceGlowCache };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const manager_1 = require("../../util/gl-util/uniform-block/manager");
|
|
11
|
-
const singularity_1 = require("../../shaders/fragment-toy/singularity");
|
|
12
|
-
const firework_1 = require("../../shaders/fragment-toy/firework");
|
|
1
|
+
import { createProgram } from "../../util";
|
|
2
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
|
+
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
5
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
+
import { drawArrays } from "../../util/gl-util/draw-options/methods";
|
|
7
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
8
|
+
import { singularity } from "../../shaders/fragment-toy/singularity";
|
|
9
|
+
import { firework } from "../../shaders/fragment-toy/firework";
|
|
13
10
|
const cameraBlockBindingPoint = 0;
|
|
14
11
|
const flexibleBlockBindingPoint = 1;
|
|
15
|
-
const uniformBlockManager = new
|
|
12
|
+
const uniformBlockManager = new UniformBlockManager("FlexibleBlock", [
|
|
16
13
|
{ name: "u_rgba", type: "vec4", value: new Float32Array([1, 1, 1, 1]) },
|
|
17
14
|
{ name: "u_size_multiplier", type: "float", value: new Float32Array([1.0]) },
|
|
18
15
|
{ name: "u_opacity", type: "float", value: new Float32Array([1.0]) },
|
|
@@ -23,9 +20,9 @@ const uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
|
|
|
23
20
|
const vs = `#version 300 es
|
|
24
21
|
precision highp float;
|
|
25
22
|
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
23
|
+
${CameraUniformBlockString}
|
|
24
|
+
${mercatorXYToGLPosition}
|
|
25
|
+
${cartesian3DToGLPosition}
|
|
29
26
|
|
|
30
27
|
${uniformBlockManager.glslCode()}
|
|
31
28
|
|
|
@@ -67,8 +64,8 @@ out vec4 fragColor;
|
|
|
67
64
|
|
|
68
65
|
flat in float v_size;
|
|
69
66
|
|
|
70
|
-
${
|
|
71
|
-
${
|
|
67
|
+
${firework}
|
|
68
|
+
${singularity}
|
|
72
69
|
|
|
73
70
|
void main() {
|
|
74
71
|
fragColor = vColor;
|
|
@@ -96,14 +93,14 @@ class Logic {
|
|
|
96
93
|
constructor(globe) {
|
|
97
94
|
this.globe = globe;
|
|
98
95
|
this.gl = globe.gl;
|
|
99
|
-
this.program =
|
|
96
|
+
this.program = createProgram(this.gl, vs, fs);
|
|
100
97
|
const { gl, program } = this;
|
|
101
98
|
gl.bindAttribLocation(program, 0, "pos3D");
|
|
102
99
|
gl.bindAttribLocation(program, 1, "pos2D");
|
|
103
100
|
gl.bindAttribLocation(program, 2, "color");
|
|
104
101
|
gl.bindAttribLocation(program, 3, "size");
|
|
105
102
|
// assign uniform block
|
|
106
|
-
this.cameraBlockTotem =
|
|
103
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
107
104
|
this.cameraBlockTotem.assignBindingPoint(program, cameraBlockBindingPoint);
|
|
108
105
|
uniformBlockManager.assignBindingPoint(this.gl, this.program);
|
|
109
106
|
this._defaultUBO = uniformBlockManager.createUBO(this.gl);
|
|
@@ -112,10 +109,10 @@ class Logic {
|
|
|
112
109
|
const { gl } = this;
|
|
113
110
|
const vao = gl.createVertexArray();
|
|
114
111
|
gl.bindVertexArray(vao);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
attributeLoader(gl, pos3DBuffer, 0, 3);
|
|
113
|
+
attributeLoader(gl, pos2DBuffer, 1, 2);
|
|
114
|
+
attributeLoader(gl, colorBuffer, 2, 4, { escapeValues: [-1, -1, -1, -1] });
|
|
115
|
+
attributeLoader(gl, sizeBuffer, 3, 1, { escapeValues: [-1] });
|
|
119
116
|
gl.bindVertexArray(null);
|
|
120
117
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
121
118
|
return vao;
|
|
@@ -131,7 +128,7 @@ class Logic {
|
|
|
131
128
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
132
129
|
ubo = ubo || this._defaultUBO;
|
|
133
130
|
ubo.bind();
|
|
134
|
-
|
|
131
|
+
drawArrays(gl, gl.POINTS, drawOptions);
|
|
135
132
|
ubo.unbind();
|
|
136
133
|
gl.bindVertexArray(null);
|
|
137
134
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
@@ -141,13 +138,13 @@ class Logic {
|
|
|
141
138
|
free() {
|
|
142
139
|
if (this._isFreed)
|
|
143
140
|
return;
|
|
144
|
-
|
|
141
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
145
142
|
this.gl.deleteProgram(this.program);
|
|
146
143
|
this._isFreed = true;
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
const ElementPointGlowProgramCache = Object.freeze({
|
|
150
|
-
get: (globe) =>
|
|
151
|
-
release: globe =>
|
|
147
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
148
|
+
release: globe => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
152
149
|
});
|
|
153
|
-
|
|
150
|
+
export { ElementPointGlowProgramCache };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const totems_1 = require("../totems");
|
|
6
|
-
const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
7
|
-
const programcache_1 = require("../programcache");
|
|
1
|
+
import { createProgram } from "../../util";
|
|
2
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
|
+
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
8
5
|
const vs = `#version 300 es
|
|
9
|
-
${
|
|
10
|
-
${
|
|
11
|
-
${
|
|
6
|
+
${CameraUniformBlockString}
|
|
7
|
+
${mercatorXYToGLPosition}
|
|
8
|
+
${cartesian3DToGLPosition}
|
|
12
9
|
precision highp float;
|
|
13
10
|
precision highp int;
|
|
14
11
|
|
|
@@ -62,7 +59,7 @@ class PointOnGlobeProgram {
|
|
|
62
59
|
constructor(globe) {
|
|
63
60
|
this.globe = globe;
|
|
64
61
|
this.gl = globe.gl;
|
|
65
|
-
this.program =
|
|
62
|
+
this.program = createProgram(this.gl, vs, fs);
|
|
66
63
|
const { gl, program } = this;
|
|
67
64
|
this.uniforms = {
|
|
68
65
|
opacity: gl.getUniformLocation(program, "opacity"),
|
|
@@ -93,7 +90,7 @@ class PointOnGlobeProgram {
|
|
|
93
90
|
// eslint-disable-next-line
|
|
94
91
|
{ // arrange camera uniform block
|
|
95
92
|
this.cameraBlockBingingPoint = 0;
|
|
96
|
-
this.cameraBlockTotem =
|
|
93
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
97
94
|
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
98
95
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
|
|
99
96
|
}
|
|
@@ -162,13 +159,13 @@ class PointOnGlobeProgram {
|
|
|
162
159
|
if (this._isFreed)
|
|
163
160
|
return;
|
|
164
161
|
const { gl, globe } = this;
|
|
165
|
-
|
|
162
|
+
CameraUniformBlockTotemCache.release(globe);
|
|
166
163
|
gl.deleteProgram(this.program);
|
|
167
164
|
this._isFreed = true;
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
const PointOnGlobeProgramCache = Object.freeze({
|
|
171
|
-
get: (globe) =>
|
|
172
|
-
release: (globe) =>
|
|
168
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, PointOnGlobeProgram),
|
|
169
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, PointOnGlobeProgram)
|
|
173
170
|
});
|
|
174
|
-
|
|
171
|
+
export { PointOnGlobeProgramCache };
|
package/programs/programcache.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @module programcache
|
|
4
3
|
* @description This module provides a cache for programs. It is used to avoid creating the same program multiple times.
|
|
@@ -12,8 +11,6 @@
|
|
|
12
11
|
* The programs created by are lightweight absraction of program logic with `constructer(gl)`.
|
|
13
12
|
* These programs are generally wrapped by another class with more functionality.
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.noRegisterGlobeProgramCache = exports.glProgramCache = exports.globeProgramCache = void 0;
|
|
17
14
|
const globeProgramCache = (function () {
|
|
18
15
|
const cache = new Map();
|
|
19
16
|
function getProgram(globe, ProgramClass) {
|
|
@@ -53,7 +50,6 @@ const globeProgramCache = (function () {
|
|
|
53
50
|
releaseProgram
|
|
54
51
|
});
|
|
55
52
|
})();
|
|
56
|
-
exports.globeProgramCache = globeProgramCache;
|
|
57
53
|
const glProgramCache = (function () {
|
|
58
54
|
const cache = new Map();
|
|
59
55
|
function getProgram(gl, ProgramClass) {
|
|
@@ -91,7 +87,6 @@ const glProgramCache = (function () {
|
|
|
91
87
|
releaseProgram
|
|
92
88
|
});
|
|
93
89
|
})();
|
|
94
|
-
exports.glProgramCache = glProgramCache;
|
|
95
90
|
const noRegisterGlobeProgramCache = (function () {
|
|
96
91
|
const cache = new Map();
|
|
97
92
|
function getProgram(globe, ProgramClass) {
|
|
@@ -128,4 +123,4 @@ const noRegisterGlobeProgramCache = (function () {
|
|
|
128
123
|
releaseProgram
|
|
129
124
|
});
|
|
130
125
|
})();
|
|
131
|
-
|
|
126
|
+
export { globeProgramCache, glProgramCache, noRegisterGlobeProgramCache };
|