@pirireis/webglobeplugins 0.16.7 → 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/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/triangle-tessellation-meta.js +178 -32
- package/Math/tessellation/triangle-tessellation.js +5 -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 +4 -2
- 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 +32 -6
- package/programs/polygon-on-globe/texture-dem-triangles.js +32 -5
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +31 -42
- 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 +0 -2
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
- 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 +0 -1
- 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/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/tessellation/tessellation-algorithm.js +0 -67
- 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/types.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/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
|
@@ -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++;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Author: Toprak Nihat Deniz Ozturk
|
|
3
3
|
*/
|
|
4
|
-
import { createProgram, defaultblendfunction, shaderfunctions } from "
|
|
4
|
+
// import { createProgram, defaultblendfunction, shaderfunctions } from "../../util";
|
|
5
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
6
|
+
import { defaultblendfunction } from "../../util/webglobe/gldefaultstates";
|
|
7
|
+
import { pixelXYToCartesian2DPoint, pixelXYToCartesian3DPoint, } from "../../util/shaderfunctions";
|
|
5
8
|
export default class TrackGlowLineProgram {
|
|
6
9
|
/**
|
|
7
10
|
* @param {WebGL2RenderingContext} gl
|
|
@@ -398,8 +401,8 @@ out float v_time;
|
|
|
398
401
|
out vec3 v_color;
|
|
399
402
|
out float v_track_start_time;
|
|
400
403
|
out float v_track_end_time;
|
|
401
|
-
${
|
|
402
|
-
${
|
|
404
|
+
${pixelXYToCartesian3DPoint}
|
|
405
|
+
${pixelXYToCartesian2DPoint}
|
|
403
406
|
|
|
404
407
|
void main() {
|
|
405
408
|
|
|
@@ -535,56 +538,53 @@ void main() {
|
|
|
535
538
|
this._resetTexture();
|
|
536
539
|
gl.enable(gl.BLEND);
|
|
537
540
|
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
gl.uniformMatrix4fv(_lineProgram.uModelViewMatrix, false, uModelViewMatrix);
|
|
555
|
-
}
|
|
556
|
-
gl.uniform3fv(_lineProgram.uTranslate, uTranslate);
|
|
557
|
-
gl.bindVertexArray(_lineProgram.vao);
|
|
558
|
-
gl.drawArrays(gl.LINE_STRIP, 0, this._totalLength);
|
|
559
|
-
gl.drawBuffers([
|
|
560
|
-
gl.COLOR_ATTACHMENT0,
|
|
561
|
-
gl.NONE
|
|
562
|
-
]);
|
|
541
|
+
// draw lines
|
|
542
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
543
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._middleTexture, 0);
|
|
544
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this._blurTextures[0], 0);
|
|
545
|
+
gl.drawBuffers([
|
|
546
|
+
gl.COLOR_ATTACHMENT0,
|
|
547
|
+
gl.COLOR_ATTACHMENT1,
|
|
548
|
+
]);
|
|
549
|
+
gl.useProgram(_lineProgram.program);
|
|
550
|
+
gl.uniform1f(_lineProgram.u_head_time, u_head_time);
|
|
551
|
+
gl.uniform1f(_lineProgram.u_tail_time, u_tail_time);
|
|
552
|
+
gl.uniformMatrix4fv(_lineProgram.uProjectionMatrix, false, uProjectionMatrix);
|
|
553
|
+
if (u_mapWH) {
|
|
554
|
+
gl.uniform2fv(_lineProgram.u_mapWH, u_mapWH);
|
|
563
555
|
}
|
|
564
|
-
{
|
|
565
|
-
gl.
|
|
566
|
-
gl.bindVertexArray(_blurProgram.vao);
|
|
567
|
-
for (let i = 0; i < _blurRepetition * 2; i++) {
|
|
568
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, this._blurFrameBuffers[i % 2]);
|
|
569
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._blurTextures[(i + 1) % 2], 0);
|
|
570
|
-
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[i % 2]);
|
|
571
|
-
gl.uniform1i(_blurProgram.u_texture, 0);
|
|
572
|
-
gl.uniform1f(_blurProgram.u_horizontal, i % 2 == 0);
|
|
573
|
-
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
574
|
-
}
|
|
556
|
+
else {
|
|
557
|
+
gl.uniformMatrix4fv(_lineProgram.uModelViewMatrix, false, uModelViewMatrix);
|
|
575
558
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
gl.
|
|
581
|
-
gl.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
559
|
+
gl.uniform3fv(_lineProgram.uTranslate, uTranslate);
|
|
560
|
+
gl.bindVertexArray(_lineProgram.vao);
|
|
561
|
+
gl.drawArrays(gl.LINE_STRIP, 0, this._totalLength);
|
|
562
|
+
gl.drawBuffers([
|
|
563
|
+
gl.COLOR_ATTACHMENT0,
|
|
564
|
+
gl.NONE
|
|
565
|
+
]);
|
|
566
|
+
// blur ping pong
|
|
567
|
+
gl.useProgram(_blurProgram.program);
|
|
568
|
+
gl.bindVertexArray(_blurProgram.vao);
|
|
569
|
+
for (let i = 0; i < _blurRepetition * 2; i++) {
|
|
570
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._blurFrameBuffers[i % 2]);
|
|
571
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._blurTextures[(i + 1) % 2], 0);
|
|
572
|
+
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[i % 2]);
|
|
573
|
+
gl.uniform1i(_blurProgram.u_texture, 0);
|
|
574
|
+
gl.uniform1f(_blurProgram.u_horizontal, i % 2 === 0);
|
|
586
575
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
587
576
|
}
|
|
577
|
+
// combine
|
|
578
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
579
|
+
gl.useProgram(this._combineProgram.program);
|
|
580
|
+
gl.bindVertexArray(this._combineProgram.vao);
|
|
581
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
582
|
+
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[1]);
|
|
583
|
+
gl.uniform1i(this._combineProgram.u_bloom_texture, 1);
|
|
584
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
585
|
+
gl.bindTexture(gl.TEXTURE_2D, this._middleTexture);
|
|
586
|
+
gl.uniform1i(this._combineProgram.u_main_texture, 0);
|
|
587
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
588
588
|
gl.bindVertexArray(null);
|
|
589
589
|
defaultblendfunction(gl);
|
|
590
590
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { createProgram
|
|
2
|
-
import {
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { pixelXYToCartesian2DPoint, pixelXYToCartesian3DPoint } from "../../util/shaderfunctions";
|
|
3
|
+
import { CameraUniformBlockTotem, globeProgramCache } from "../../programs";
|
|
4
|
+
import { CameraUniformBlockString } from "../../programs/totems/camerauniformblock";
|
|
5
|
+
// layout(std140) uniform GlobeCamera {
|
|
6
|
+
// mat4 view; // 64 bytes 0
|
|
7
|
+
// mat4 projection; // 64 bytes 64
|
|
8
|
+
// vec3 translate; // 12 bytes 128
|
|
9
|
+
// bool is3D; // 4 bytes 140
|
|
10
|
+
// vec2 mapWH; // 8 bytes 144
|
|
11
|
+
// vec2 screenWH; // 8 bytes 152
|
|
12
|
+
// float z_level; // 4 bytes 160
|
|
13
|
+
// };
|
|
3
14
|
const vertexShader = `#version 300 es
|
|
4
15
|
|
|
5
|
-
|
|
6
|
-
mat4 view; // 64 bytes 0
|
|
7
|
-
mat4 projection; // 64 bytes 64
|
|
8
|
-
vec3 translate; // 12 bytes 128
|
|
9
|
-
bool is3D; // 4 bytes 140
|
|
10
|
-
vec2 mapWH; // 8 bytes 144
|
|
11
|
-
vec2 screenWH; // 8 bytes 152
|
|
12
|
-
float z_level; // 4 bytes 160
|
|
13
|
-
};
|
|
16
|
+
${CameraUniformBlockString}
|
|
14
17
|
|
|
15
18
|
layout(std140) uniform Globals {
|
|
16
19
|
float head_time;
|
|
@@ -26,7 +29,7 @@ in float end_time;
|
|
|
26
29
|
in vec3 end_color;
|
|
27
30
|
out vec4 v_color;
|
|
28
31
|
|
|
29
|
-
` +
|
|
32
|
+
` + pixelXYToCartesian3DPoint + pixelXYToCartesian2DPoint + `
|
|
30
33
|
|
|
31
34
|
void main() {
|
|
32
35
|
if (head_time < start_time || head_time > end_time) { return; }
|
|
@@ -56,7 +59,7 @@ void main() {
|
|
|
56
59
|
outColor.a = 0.0;
|
|
57
60
|
}
|
|
58
61
|
}`;
|
|
59
|
-
export default class {
|
|
62
|
+
export default class ProgramPointLineStrip {
|
|
60
63
|
constructor(gl, globe, attrBuffer, options) {
|
|
61
64
|
this.gl = gl;
|
|
62
65
|
this._cameraBlockBindingPoint = 0;
|
package/types.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export var CSRenderPass;
|
|
2
|
+
(function (CSRenderPass) {
|
|
3
|
+
CSRenderPass[CSRenderPass["NORMAL"] = 0] = "NORMAL";
|
|
4
|
+
CSRenderPass[CSRenderPass["SELECTED"] = 1] = "SELECTED";
|
|
5
|
+
CSRenderPass[CSRenderPass["EDITING"] = 2] = "EDITING";
|
|
6
|
+
})(CSRenderPass || (CSRenderPass = {}));
|
|
1
7
|
export var CSMeasureTextPositionTypes;
|
|
2
8
|
(function (CSMeasureTextPositionTypes) {
|
|
3
9
|
CSMeasureTextPositionTypes["CENTER"] = "center";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* READ, most of the time is not needed to be read, unless for defraging.
|
|
18
18
|
* This unpredicatable behavior is not handled by this class.
|
|
19
19
|
*/
|
|
20
|
-
export default class {
|
|
20
|
+
export default class BufferOffsetManager {
|
|
21
21
|
constructor(itemSize, { capacity = 10, bufferType = "STATIC_DRAW" } = {}) {
|
|
22
22
|
this.itemSize = itemSize;
|
|
23
23
|
this.bufferType = bufferType;
|
|
@@ -12,99 +12,13 @@ export class BufferOrchestrator {
|
|
|
12
12
|
}
|
|
13
13
|
resetWithCapacity(bufferManagersMap, capacity = null) {
|
|
14
14
|
this._capacity = capacity !== null ? capacity : this._capacity;
|
|
15
|
-
for (const [
|
|
15
|
+
for (const [, { bufferManager }] of bufferManagersMap) {
|
|
16
16
|
bufferManager.resetWithCapacity(this._capacity);
|
|
17
17
|
}
|
|
18
18
|
this.offsetMap.clear();
|
|
19
19
|
this.tombstoneOffsets = [];
|
|
20
20
|
this._length = 0;
|
|
21
21
|
}
|
|
22
|
-
// ...existing code...
|
|
23
|
-
// TODO: CLEAN THIS
|
|
24
|
-
// insertBulk2(items: any[], bufferManagersMap: BufferManagersMap, bufferKeys: string[] | null = null) {
|
|
25
|
-
// this.ensureSpace(items.length, bufferManagersMap);
|
|
26
|
-
// const { offsetMap } = this;
|
|
27
|
-
// // For block insert (truly new, consecutive offsets)
|
|
28
|
-
// const blockItems: any[] = [];
|
|
29
|
-
// let blockStart: number | null = null;
|
|
30
|
-
// let lastBlockOffset: number | null = null;
|
|
31
|
-
// // For single insert (existing or tombstone-assigned)
|
|
32
|
-
// const singleItems: any[] = [];
|
|
33
|
-
// const singleOffsets: number[] = [];
|
|
34
|
-
// for (const item of items) {
|
|
35
|
-
// let offset = offsetMap.get(item.key);
|
|
36
|
-
// if (offset !== undefined) {
|
|
37
|
-
// // Already present, update in place
|
|
38
|
-
// singleItems.push(item);
|
|
39
|
-
// singleOffsets.push(offset);
|
|
40
|
-
// } else {
|
|
41
|
-
// // Assign offset (tombstone or new)
|
|
42
|
-
// if (this.tombstoneOffsets.length > 0) {
|
|
43
|
-
// offset = this.tombstoneOffsets.pop() as number;
|
|
44
|
-
// offsetMap.set(item.key, offset);
|
|
45
|
-
// singleItems.push(item);
|
|
46
|
-
// singleOffsets.push(offset);
|
|
47
|
-
// } else {
|
|
48
|
-
// offset = this._length++;
|
|
49
|
-
// if (offset >= this._capacity) throw new Error("The Size Should Be Increased!!");
|
|
50
|
-
// offsetMap.set(item.key, offset);
|
|
51
|
-
// // Check for consecutive block
|
|
52
|
-
// if (blockStart === null) {
|
|
53
|
-
// blockStart = offset;
|
|
54
|
-
// lastBlockOffset = offset;
|
|
55
|
-
// blockItems.push(item);
|
|
56
|
-
// } else if (lastBlockOffset !== null && offset === lastBlockOffset + 1) {
|
|
57
|
-
// lastBlockOffset = offset;
|
|
58
|
-
// blockItems.push(item);
|
|
59
|
-
// } else {
|
|
60
|
-
// // Not consecutive, flush current block
|
|
61
|
-
// if (blockItems.length > 0) {
|
|
62
|
-
// this._insertBlock(blockItems, blockStart, bufferManagersMap, bufferKeys);
|
|
63
|
-
// blockItems.length = 0;
|
|
64
|
-
// }
|
|
65
|
-
// blockStart = offset;
|
|
66
|
-
// lastBlockOffset = offset;
|
|
67
|
-
// blockItems.push(item);
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
// // Flush any remaining block
|
|
73
|
-
// if (blockItems.length > 0 && blockStart !== null) {
|
|
74
|
-
// this._insertBlock(blockItems, blockStart, bufferManagersMap, bufferKeys);
|
|
75
|
-
// }
|
|
76
|
-
// // Insert singles
|
|
77
|
-
// if (singleItems.length > 0) {
|
|
78
|
-
// if (bufferKeys) {
|
|
79
|
-
// for (const key of bufferKeys) {
|
|
80
|
-
// const bufferManagerComp = bufferManagersMap.get(key);
|
|
81
|
-
// if (!bufferManagerComp) throw new Error("insertBulk bufferKey does not exist");
|
|
82
|
-
// const { bufferManager, adaptor } = bufferManagerComp;
|
|
83
|
-
// bufferManager.insertBulk(singleItems.map(adaptor), singleOffsets);
|
|
84
|
-
// }
|
|
85
|
-
// } else {
|
|
86
|
-
// for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
87
|
-
// bufferManager.insertBulk(singleItems.map(adaptor), singleOffsets);
|
|
88
|
-
// }
|
|
89
|
-
// }
|
|
90
|
-
// }
|
|
91
|
-
// }
|
|
92
|
-
// // Helper for block insert
|
|
93
|
-
// private _insertBlock(blockItems: any[], blockStart: number, bufferManagersMap: BufferManagersMap, bufferKeys: string[] | null) {
|
|
94
|
-
// if (bufferKeys) {
|
|
95
|
-
// for (const key of bufferKeys) {
|
|
96
|
-
// const bufferManagerComp = bufferManagersMap.get(key);
|
|
97
|
-
// if (!bufferManagerComp) throw new Error("insertBulk bufferKey does not exist");
|
|
98
|
-
// const { bufferManager, adaptor } = bufferManagerComp;
|
|
99
|
-
// bufferManager.insertBlock(blockItems, blockStart, adaptor, Float32Array);
|
|
100
|
-
// }
|
|
101
|
-
// } else {
|
|
102
|
-
// for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
103
|
-
// bufferManager.insertBlock(blockItems, blockStart, adaptor, Float32Array);
|
|
104
|
-
// }
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
// ...existing code...
|
|
108
22
|
// want to add stack load to this method
|
|
109
23
|
// if offsetMap.has(item.key) === false get next offset, add the item to stack
|
|
110
24
|
// create a single big float32array and fill it with the items
|
|
@@ -135,7 +49,7 @@ export class BufferOrchestrator {
|
|
|
135
49
|
}
|
|
136
50
|
}
|
|
137
51
|
else {
|
|
138
|
-
for (const [
|
|
52
|
+
for (const [, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
139
53
|
bufferManager.insertBulk([adaptor(item)], [o]);
|
|
140
54
|
}
|
|
141
55
|
}
|
|
@@ -173,7 +87,7 @@ export class BufferOrchestrator {
|
|
|
173
87
|
}
|
|
174
88
|
}
|
|
175
89
|
else {
|
|
176
|
-
for (const [
|
|
90
|
+
for (const [, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
177
91
|
bufferManager.insertBlock(blockLoad, offsetStart, adaptor, Float32Array);
|
|
178
92
|
}
|
|
179
93
|
}
|
|
@@ -201,7 +115,7 @@ export class BufferOrchestrator {
|
|
|
201
115
|
}
|
|
202
116
|
}
|
|
203
117
|
else {
|
|
204
|
-
for (const [
|
|
118
|
+
for (const [, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
205
119
|
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
206
120
|
}
|
|
207
121
|
}
|
|
@@ -216,7 +130,7 @@ export class BufferOrchestrator {
|
|
|
216
130
|
this.tombstoneOffsets.push(offset);
|
|
217
131
|
}
|
|
218
132
|
}
|
|
219
|
-
for (const [
|
|
133
|
+
for (const [, { bufferManager }] of bufferManagersMap) {
|
|
220
134
|
bufferManager.deleteBulk(offsets);
|
|
221
135
|
}
|
|
222
136
|
}
|
|
@@ -240,7 +154,7 @@ export class BufferOrchestrator {
|
|
|
240
154
|
if (itemsLength <= this.emptySpace)
|
|
241
155
|
return;
|
|
242
156
|
const newCapacity = this.length + itemsLength;
|
|
243
|
-
for (const [
|
|
157
|
+
for (const [, { bufferManager }] of bufferManagersMap) {
|
|
244
158
|
bufferManager.extendBuffer(this.length, newCapacity);
|
|
245
159
|
}
|
|
246
160
|
this._capacity = newCapacity;
|
|
@@ -252,14 +166,14 @@ export class BufferOrchestrator {
|
|
|
252
166
|
for (const key of bufferKeys) {
|
|
253
167
|
const offset = offsetMap.get(key);
|
|
254
168
|
if (offset !== undefined) {
|
|
255
|
-
for (const [
|
|
169
|
+
for (const [, { bufferManager }] of bufferManagers) {
|
|
256
170
|
bufferManager.defrag([offset], this.length, newCapacity);
|
|
257
171
|
}
|
|
258
172
|
}
|
|
259
173
|
}
|
|
260
174
|
}
|
|
261
175
|
else {
|
|
262
|
-
for (const [
|
|
176
|
+
for (const [, { bufferManager }] of bufferManagers) {
|
|
263
177
|
bufferManager.defrag(offsetMap.values(), this.length, newCapacity);
|
|
264
178
|
}
|
|
265
179
|
}
|
|
@@ -281,7 +195,7 @@ export class BufferOrchestrator {
|
|
|
281
195
|
_defrag() {
|
|
282
196
|
const newOffsetMap = new Map();
|
|
283
197
|
let newOffset = 0;
|
|
284
|
-
for (const [key,
|
|
198
|
+
for (const [key,] of this.offsetMap) {
|
|
285
199
|
newOffsetMap.set(key, newOffset++);
|
|
286
200
|
}
|
|
287
201
|
this.offsetMap = newOffsetMap;
|