@pirireis/webglobeplugins 0.16.7 → 0.17.1
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/methods.js +6 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/tile-merger.js +298 -0
- package/Math/tessellation/triangle-tessellation-meta.js +195 -42
- 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/investigation-tools/draw/tiles/adapters.js +67 -0
- package/investigation-tools/draw/tiles/tiles.js +128 -0
- 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 +180 -30
- package/programs/polygon-on-globe/texture-dem-triangles.js +93 -34
- 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 +9 -8
- package/programs/vectorfields/logics/drawrectangleparticles1.js +112 -0
- 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 +9 -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 +6 -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 +6 -8
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/shaderfunctions/geometrytransformations.js +1 -1
- 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 +65 -51
- package/write-text/context-text3.js +0 -1
- package/write-text/context-text4.js +2 -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/init.js +0 -1
- 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/polygon-on-globe/texture-dem-triangle-test-plugin.js +0 -118
- 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/util/webglobe/rasteroverlay.js +0 -75
- package/write-text/attached-text-writer.js +0 -87
- 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/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createProgram } from "
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { glProgramCache } from "../programcache";
|
|
2
3
|
const vertexShaderSource = `#version 300 es
|
|
3
4
|
precision highp float;
|
|
4
5
|
in vec2 a_position;
|
|
@@ -24,7 +25,7 @@ void main() {
|
|
|
24
25
|
outColor = vec4(color.rgb, color.a * opacity);
|
|
25
26
|
}
|
|
26
27
|
`;
|
|
27
|
-
|
|
28
|
+
class FadeAwayProgram {
|
|
28
29
|
constructor(gl) {
|
|
29
30
|
this.gl = gl;
|
|
30
31
|
this.program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
@@ -67,3 +68,11 @@ export default class FadeAwayProgram {
|
|
|
67
68
|
gl.deleteBuffer(_buffer);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
71
|
+
export const FadeAwayProgramCache = Object.freeze({
|
|
72
|
+
get: (gl) => {
|
|
73
|
+
return glProgramCache.getProgram(gl, FadeAwayProgram);
|
|
74
|
+
},
|
|
75
|
+
release: (gl) => {
|
|
76
|
+
return glProgramCache.releaseProgram(gl, FadeAwayProgram);
|
|
77
|
+
}
|
|
78
|
+
});
|
package/programs/index.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { FadeAway } from "./helpers";
|
|
8
|
-
import * as rings from "./rings";
|
|
9
|
-
export {
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Float2LegendWithRatio } from "./float2legendwithratio";
|
|
3
|
+
// import { GlobeShellWiggle } from "./globeshell/wiggle";
|
|
4
|
+
// import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
|
|
5
|
+
// import ArrowField from "./arrowfield";
|
|
6
|
+
// import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
|
|
7
|
+
// import { FadeAway } from "./helpers";
|
|
8
|
+
// import * as rings from "./rings";
|
|
9
|
+
// export {
|
|
10
|
+
// Float2LegendWithRatio,
|
|
11
|
+
// GlobeShellWiggle,
|
|
12
|
+
// ArrowField,
|
|
13
|
+
// CameraUniformBlockTotem,
|
|
14
|
+
// CameraUniformBlockString,
|
|
15
|
+
// glProgramCache,
|
|
16
|
+
// globeProgramCache,
|
|
17
|
+
// noRegisterGlobeProgramCache,
|
|
18
|
+
// FadeAway,
|
|
19
|
+
// rings
|
|
20
|
+
// };
|
|
@@ -3,7 +3,7 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
|
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
4
|
// import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
5
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
-
import { cartesian3DToGLPosition,
|
|
6
|
+
import { cartesian3DToGLPosition, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
|
|
7
7
|
/**
|
|
8
8
|
* TODO:
|
|
9
9
|
* 1. integrate geometry functions for radius angle and center
|
|
@@ -77,19 +77,17 @@ class Logic {
|
|
|
77
77
|
this.program.uniforms = {
|
|
78
78
|
opacity: gl.getUniformLocation(program, "opacity")
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
92
|
-
}
|
|
80
|
+
// initial uniform values
|
|
81
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
82
|
+
gl.useProgram(program);
|
|
83
|
+
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
84
|
+
gl.useProgram(currentProgram);
|
|
85
|
+
// assign attribute locations
|
|
86
|
+
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
87
|
+
gl.bindAttribLocation(program, 1, "target_position3d");
|
|
88
|
+
gl.bindAttribLocation(program, 2, "color");
|
|
89
|
+
gl.bindAttribLocation(program, 3, "dash_ratio");
|
|
90
|
+
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
93
91
|
this.cameraBindingPoint = 0;
|
|
94
92
|
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
95
93
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
@@ -3,7 +3,6 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
|
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
4
|
import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
5
|
import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
6
|
-
const Pole = 20037508.34;
|
|
7
6
|
/**
|
|
8
7
|
* Warning:
|
|
9
8
|
* Insert the points from the second index and skip 1 point as you placed 361 points
|
|
@@ -84,21 +84,19 @@ class Logic {
|
|
|
84
84
|
stepAngle: gl.getUniformLocation(program, "step_angle"),
|
|
85
85
|
zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
gl.bindAttribLocation(program, 3, "color");
|
|
101
|
-
}
|
|
87
|
+
// initial uniform values
|
|
88
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
89
|
+
gl.useProgram(program);
|
|
90
|
+
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
91
|
+
gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
|
|
92
|
+
gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
|
|
93
|
+
gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
|
|
94
|
+
gl.useProgram(currentProgram);
|
|
95
|
+
// assign attribute locations
|
|
96
|
+
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
97
|
+
gl.bindAttribLocation(program, 1, "big_radius");
|
|
98
|
+
gl.bindAttribLocation(program, 2, "small_radius");
|
|
99
|
+
gl.bindAttribLocation(program, 3, "color");
|
|
102
100
|
this.cameraBindingPoint = 0;
|
|
103
101
|
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
104
102
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
2
2
|
import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
-
import { createProgram } from "../../util";
|
|
4
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
5
5
|
import { Z_ALPHA_MODE } from "./util";
|
|
6
6
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
7
7
|
/**
|
|
@@ -68,23 +68,20 @@ class Logic {
|
|
|
68
68
|
const { gl, program } = this;
|
|
69
69
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
70
70
|
gl.useProgram(program);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
86
|
-
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
87
|
-
}
|
|
71
|
+
// assign attribute locations
|
|
72
|
+
gl.bindAttribLocation(program, 0, 'posA');
|
|
73
|
+
gl.bindAttribLocation(program, 1, 'posB');
|
|
74
|
+
gl.bindAttribLocation(program, 2, 'color');
|
|
75
|
+
// uniform locations
|
|
76
|
+
this._opacityLocation = gl.getUniformLocation(program, 'opacity');
|
|
77
|
+
this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
|
|
78
|
+
gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
|
|
79
|
+
gl.uniform1f(this._opacityLocation, this._lastOpicity);
|
|
80
|
+
// uniform block
|
|
81
|
+
this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
82
|
+
this._cameraBindingPoint = 0;
|
|
83
|
+
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
84
|
+
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
88
85
|
gl.useProgram(currentProgram);
|
|
89
86
|
}
|
|
90
87
|
createVAO(posAObj, posBObj, colorObj) {
|
|
@@ -144,7 +144,6 @@ class Logic {
|
|
|
144
144
|
gl.uniform1f(this._opacityLocation, opacity);
|
|
145
145
|
this._lastOpacity = opacity;
|
|
146
146
|
}
|
|
147
|
-
// this._setFlexibleUniforms(flexibleOptions);
|
|
148
147
|
const vertexCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
|
|
149
148
|
const ubo = flexibleUBO || _defaultFlexibleUBO;
|
|
150
149
|
ubo.bind();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../util";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
3
|
import { mercatorXYToGLPosition, cartesian3DToGLPosition, R_3D, R } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
4
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createProgram } from "../../util";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
3
|
import { mercatorXYToGLPosition, cartesian3DToGLPosition, R_3D, R } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
4
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
5
|
-
import { drawArrays
|
|
5
|
+
import { drawArrays } from "../../util/gl-util/draw-options/methods"; //DrawRangeIndexParams
|
|
6
6
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
7
7
|
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
8
8
|
const uniformBindingPoints = {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* *
|
|
7
7
|
*/
|
|
8
8
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
9
|
-
import { PI,
|
|
10
|
-
import { createProgram } from "../../util";
|
|
9
|
+
import { PI, cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate } from "../../util/shaderfunctions/geometrytransformations";
|
|
10
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
11
11
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
12
12
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
13
13
|
import { drawInstanced } from "../../util/gl-util/draw-options/methods";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../util";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
3
|
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
4
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../util";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
3
3
|
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
4
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
@@ -1,8 +1,80 @@
|
|
|
1
1
|
import { TextureDemTriangles } from "./texture-dem-triangles";
|
|
2
|
-
import {
|
|
2
|
+
import { RADIAN, radianToMercatorXY } from "../../Math/methods";
|
|
3
|
+
import { mergeMeshes } from "../../Math/tessellation/tile-merger";
|
|
4
|
+
import { createTriangleTessellationMeta, getAllPoints, partialTessellation } from "../../Math/tessellation/triangle-tessellation-meta";
|
|
3
5
|
/**
|
|
4
6
|
* Loads a plugin with test data for TextureDemTriangles
|
|
5
7
|
*/
|
|
8
|
+
function test1(zoomLevel, p1, p2, p3) {
|
|
9
|
+
const triangleMeta = createTriangleTessellationMeta(p1, p2, p3);
|
|
10
|
+
const { vec3s, longLats, indices } = getAllPoints(triangleMeta, zoomLevel);
|
|
11
|
+
return { vec3s, longLats, indices };
|
|
12
|
+
}
|
|
13
|
+
function partialTest(bboxZooms, p1, p2, p3) {
|
|
14
|
+
const triangleMeta = createTriangleTessellationMeta(p1, p2, p3);
|
|
15
|
+
return partialTessellation(triangleMeta, bboxZooms, 5);
|
|
16
|
+
}
|
|
17
|
+
function antalyaTestTriangle() {
|
|
18
|
+
const p1 = [30.5391 * RADIAN, 36.9083 * RADIAN];
|
|
19
|
+
const p2 = [32.9271 * RADIAN, 36.9083 * RADIAN];
|
|
20
|
+
const p3 = [31.7331 * RADIAN, 35.8145 * RADIAN];
|
|
21
|
+
const bboxZooms = [
|
|
22
|
+
// 12 zoom level
|
|
23
|
+
{
|
|
24
|
+
bbox: {
|
|
25
|
+
min: [30.5391 * RADIAN, 35.8145 * RADIAN],
|
|
26
|
+
max: [32.9271 * RADIAN, 36.9083 * RADIAN]
|
|
27
|
+
}, zoom: 15
|
|
28
|
+
},
|
|
29
|
+
// 11 zoom level
|
|
30
|
+
// {
|
|
31
|
+
// bbox: {
|
|
32
|
+
// min: [30.5391 * RADIAN, 35.8145 * RADIAN],
|
|
33
|
+
// max: [32.9271 * RADIAN, 36.9083 * RADIAN]
|
|
34
|
+
// }, zoom: 11
|
|
35
|
+
// },
|
|
36
|
+
];
|
|
37
|
+
return partialTest(bboxZooms, p1, p2, p3);
|
|
38
|
+
}
|
|
39
|
+
function loadVec3sLongLatsIndices(gl, bufferInfo, data) {
|
|
40
|
+
// Calculate total sizes
|
|
41
|
+
let totalVec3s = 0;
|
|
42
|
+
let totalLongLats = 0;
|
|
43
|
+
let totalIndices = 0;
|
|
44
|
+
for (const item of data) {
|
|
45
|
+
totalVec3s += item.vec3s.length;
|
|
46
|
+
totalLongLats += item.longLats.length;
|
|
47
|
+
totalIndices += item.indices.length;
|
|
48
|
+
}
|
|
49
|
+
// Pre-allocate arrays
|
|
50
|
+
const vec3s = new Float32Array(totalVec3s);
|
|
51
|
+
const longLats = new Float32Array(totalLongLats);
|
|
52
|
+
const indices = new Uint32Array(totalIndices);
|
|
53
|
+
let vec3Offset = 0;
|
|
54
|
+
let longLatOffset = 0;
|
|
55
|
+
let indexOffset = 0;
|
|
56
|
+
let vertexOffset = 0;
|
|
57
|
+
for (const item of data) {
|
|
58
|
+
// Copy vec3s
|
|
59
|
+
vec3s.set(item.vec3s, vec3Offset);
|
|
60
|
+
vec3Offset += item.vec3s.length;
|
|
61
|
+
// Copy longLats
|
|
62
|
+
longLats.set(item.longLats, longLatOffset);
|
|
63
|
+
longLatOffset += item.longLats.length;
|
|
64
|
+
// Copy and adjust indices
|
|
65
|
+
for (let i = 0; i < item.indices.length; i++) {
|
|
66
|
+
indices[indexOffset + i] = item.indices[i] + vertexOffset;
|
|
67
|
+
}
|
|
68
|
+
indexOffset += item.indices.length;
|
|
69
|
+
vertexOffset += item.vec3s.length / 3; // Each vertex has 3 components
|
|
70
|
+
}
|
|
71
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.pos3dBufferInfo.buffer);
|
|
72
|
+
gl.bufferData(gl.ARRAY_BUFFER, vec3s, gl.STATIC_DRAW);
|
|
73
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.longLatBufferInfo.buffer);
|
|
74
|
+
gl.bufferData(gl.ARRAY_BUFFER, longLats, gl.STATIC_DRAW);
|
|
75
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferInfo.elementBufferInfo.buffer);
|
|
76
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
|
|
77
|
+
}
|
|
6
78
|
const createTestBBOXES = () => {
|
|
7
79
|
const bboxes = [];
|
|
8
80
|
for (let i = 0; i < 6; i++) {
|
|
@@ -10,16 +82,18 @@ const createTestBBOXES = () => {
|
|
|
10
82
|
const west = Math.random() * -1 * Math.PI / 10; // random longitude
|
|
11
83
|
const south = north - Math.PI / 30; // random latitude
|
|
12
84
|
const east = west + Math.PI / 30; // random longitude
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
85
|
+
const ll = [west, north]; // random northWest
|
|
86
|
+
const ur = [east, south]; // random southEast
|
|
87
|
+
//
|
|
88
|
+
bboxes.push({ ll, ur });
|
|
16
89
|
}
|
|
17
90
|
return bboxes;
|
|
18
91
|
};
|
|
92
|
+
const demTextureBBOX = createTestBBOXES();
|
|
19
93
|
function showTextureBBoxes(bboxes, demData = []) {
|
|
20
94
|
for (let i = 0; i < bboxes.length; i++) {
|
|
21
95
|
const bbox = bboxes[i];
|
|
22
|
-
console.log(`Texture BBOX ${i}:
|
|
96
|
+
console.log(`Texture BBOX ${i}: LL(${(bbox.ll[0] * 180 / Math.PI).toFixed(2)}, ${(bbox.ll[1] * 180 / Math.PI).toFixed(2)}) UR(${(bbox.ur[0] * 180 / Math.PI).toFixed(2)}, ${(bbox.ur[1] * 180 / Math.PI).toFixed(2)})`);
|
|
23
97
|
if (demData.length > i) {
|
|
24
98
|
const dem = demData[i];
|
|
25
99
|
let demStr = "DEM: \n";
|
|
@@ -69,22 +143,26 @@ export class TextureDemTrianglesTestPlugin {
|
|
|
69
143
|
textureDemTriangles = null;
|
|
70
144
|
vao = null;
|
|
71
145
|
drawOptions = null;
|
|
146
|
+
_lastTilesUniqueIdentifier = "";
|
|
72
147
|
bufferInfo = null;
|
|
73
148
|
id;
|
|
74
149
|
uboTriangleStyle = null;
|
|
75
150
|
uboStringStyle = null;
|
|
76
151
|
showDemPoints = false;
|
|
152
|
+
bboxZooms = [];
|
|
77
153
|
constructor(id) {
|
|
78
154
|
this.id = id;
|
|
155
|
+
this.bboxZooms = [];
|
|
79
156
|
}
|
|
80
157
|
init(globe) {
|
|
81
158
|
this.globe = globe;
|
|
82
159
|
this.textureDemTriangles = new TextureDemTriangles(globe);
|
|
83
160
|
// set bboxes and dem textures
|
|
84
161
|
const demTextures = createTestDemTextures();
|
|
85
|
-
const demTextureBBOX = createTestBBOXES();
|
|
162
|
+
// const demTextureBBOX = createTestBBOXES();
|
|
86
163
|
this.textureDemTriangles.setDemTextures(demTextures, demTextureBBOX);
|
|
87
164
|
//
|
|
165
|
+
// const baseZoom = 5;
|
|
88
166
|
showTextureBBoxes(demTextureBBOX, demTextures);
|
|
89
167
|
this.uboTriangleStyle = this.textureDemTriangles.createUBO();
|
|
90
168
|
this.uboStringStyle = this.textureDemTriangles.createUBO();
|
|
@@ -132,35 +210,41 @@ export class TextureDemTrianglesTestPlugin {
|
|
|
132
210
|
this.globe?.DrawRender();
|
|
133
211
|
}
|
|
134
212
|
setZoom(zoomLevel) {
|
|
213
|
+
this.bboxZooms = demTextureBBOX.map((bbox, index) => {
|
|
214
|
+
return {
|
|
215
|
+
bbox: {
|
|
216
|
+
min: bbox.ll,
|
|
217
|
+
max: bbox.ur,
|
|
218
|
+
}, zoom: index + zoomLevel + 1
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
// all world - FIX: Convert to radians
|
|
222
|
+
this.bboxZooms.push({
|
|
223
|
+
bbox: {
|
|
224
|
+
min: [-180 * RADIAN, -90 * RADIAN], // ✓ Now radians
|
|
225
|
+
max: [180 * RADIAN, 90 * RADIAN] // ✓ Now radians
|
|
226
|
+
},
|
|
227
|
+
zoom: zoomLevel
|
|
228
|
+
});
|
|
135
229
|
if (!this.globe || !this.textureDemTriangles || !this.bufferInfo)
|
|
136
230
|
return;
|
|
137
|
-
const p1 = [-20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
138
|
-
const p2 = [20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
139
|
-
const p3 = [0, -10 * Math.PI / 180];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
// const {vec3s, longLats, indices} = test1(5, p1_1, p2_2, p3_3);
|
|
231
|
+
// const p1: LongLatRadian = [-20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
232
|
+
// const p2: LongLatRadian = [20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
233
|
+
// const p3: LongLatRadian = [0, -10 * Math.PI / 180];
|
|
234
|
+
const p1 = [-60 * Math.PI / 180, 60 * Math.PI / 180];
|
|
235
|
+
const p2 = [60 * Math.PI / 180, 60 * Math.PI / 180];
|
|
236
|
+
const p3 = [0, -60 * Math.PI / 180];
|
|
237
|
+
const bigTriangle = partialTest(this.bboxZooms, p1, p2, p3);
|
|
145
238
|
const bufferInfo = this.bufferInfo;
|
|
239
|
+
const antalya = antalyaTestTriangle();
|
|
240
|
+
loadVec3sLongLatsIndices(this.globe.gl, bufferInfo, [
|
|
241
|
+
bigTriangle,
|
|
242
|
+
antalya
|
|
243
|
+
]);
|
|
146
244
|
bufferInfo.drawOptions.drawRange.first = 0;
|
|
147
|
-
bufferInfo.drawOptions.drawRange.count = indices.length;
|
|
245
|
+
bufferInfo.drawOptions.drawRange.count = antalya.indices.length + bigTriangle.indices.length;
|
|
148
246
|
bufferInfo.drawOptionsPoint.drawRange.first = 0;
|
|
149
|
-
bufferInfo.drawOptionsPoint.drawRange.count = longLats.length / 2;
|
|
150
|
-
const gl = this.globe.gl;
|
|
151
|
-
// const longLatArray = createTestLongLatArray();
|
|
152
|
-
// const pos3dArray = createTestPos3dArray(longLatArray);
|
|
153
|
-
// @ts-ignore
|
|
154
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.pos3dBufferInfo.buffer);
|
|
155
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vec3s), gl.STATIC_DRAW);
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.longLatBufferInfo.buffer);
|
|
158
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(longLats), gl.STATIC_DRAW);
|
|
159
|
-
// @ts-ignore
|
|
160
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferInfo.elementBufferInfo.buffer);
|
|
161
|
-
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(indices), gl.STATIC_DRAW);
|
|
162
|
-
this.globe.DrawRender();
|
|
163
|
-
console.log("DrawIInfo", this.bufferInfo);
|
|
247
|
+
bufferInfo.drawOptionsPoint.drawRange.count = (antalya.longLats.length + bigTriangle.longLats.length) / 2;
|
|
164
248
|
}
|
|
165
249
|
setShowDemPoints(show) {
|
|
166
250
|
this.showDemPoints = show;
|
|
@@ -168,11 +252,77 @@ export class TextureDemTrianglesTestPlugin {
|
|
|
168
252
|
draw3D() {
|
|
169
253
|
if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo)
|
|
170
254
|
return;
|
|
255
|
+
const gl = this.globe.gl;
|
|
256
|
+
this._prepareDem();
|
|
257
|
+
gl.frontFace(gl.CW);
|
|
171
258
|
// @ts-ignore
|
|
172
259
|
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions, this.uboTriangleStyle);
|
|
173
260
|
if (this.showDemPoints) {
|
|
174
261
|
// @ts-ignore
|
|
175
262
|
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptionsPoint, this.uboStringStyle);
|
|
176
263
|
}
|
|
264
|
+
gl.frontFace(gl.CCW);
|
|
265
|
+
}
|
|
266
|
+
_prepareDem() {
|
|
267
|
+
if (!this.globe || !this.textureDemTriangles)
|
|
268
|
+
return;
|
|
269
|
+
const drawnTiles = this.globe.api_GetDrawedTilesInfo();
|
|
270
|
+
if (this._checkTileChange(drawnTiles))
|
|
271
|
+
return;
|
|
272
|
+
const mergedTiles = mergeMeshes(drawnTiles, 12, 5, 4);
|
|
273
|
+
// let I = 6;
|
|
274
|
+
for (const tile of mergedTiles) {
|
|
275
|
+
const bbox = globeBBoxToXYBBOX(tile.bbox);
|
|
276
|
+
// Validation: Check if values are in expected radian range
|
|
277
|
+
// if (Math.abs(bbox.northWest[0]) > Math.PI * 2 || Math.abs(bbox.northWest[1]) > Math.PI) {
|
|
278
|
+
// console.error(`⚠️ BBOX out of radian range! Raw bbox:`, tile.bbox);
|
|
279
|
+
// }
|
|
280
|
+
if (bbox.ll[0] > bbox.ur[0]) {
|
|
281
|
+
console.warn(`⚠️ BBOX longitudes seem incorrect! ll longitude is greater than ur longitude. Raw bbox:`, bbox);
|
|
282
|
+
}
|
|
283
|
+
if (bbox.ll[1] > bbox.ur[1]) {
|
|
284
|
+
console.warn(`⚠️ BBOX latitudes seem incorrect! ll latitude is greater than ur latitude. Raw bbox:`, bbox);
|
|
285
|
+
}
|
|
286
|
+
// console.log(` BBox LL (${(bbox.ll[0]).toFixed(2)}°, ${(bbox.ll[1]).toFixed(2)}°) UR (${(bbox.ur[0]).toFixed(2)}°, ${(bbox.ur[1]).toFixed(2)}°), Cover: ${tile.coverRatio.x.toFixed(2)}x${tile.coverRatio.y.toFixed(2)}`);
|
|
287
|
+
// console.log(`${I} Cover: ${tile.coverRatio.x.toFixed(2)} ${tile.coverRatio.y.toFixed(2)}`);
|
|
288
|
+
// I--;
|
|
289
|
+
}
|
|
290
|
+
// console.log("...............................")
|
|
291
|
+
this.textureDemTriangles.setDemTextures(mergedTiles.map(t => Array.from(t.mesh)), mergedTiles.map(t => globeBBoxToXYBBOX(t.bbox)), mergedTiles.map(t => ({ x: t.coverRatio.x, y: t.coverRatio.y })));
|
|
292
|
+
}
|
|
293
|
+
_checkTileChange(drawnTiles) {
|
|
294
|
+
let maxLevel = 0;
|
|
295
|
+
let minLevel = Number.MAX_VALUE;
|
|
296
|
+
const tileMap = new Map();
|
|
297
|
+
for (const tile of drawnTiles) {
|
|
298
|
+
if (tile.level > maxLevel) {
|
|
299
|
+
maxLevel = tile.level;
|
|
300
|
+
}
|
|
301
|
+
if (tile.level < minLevel) {
|
|
302
|
+
minLevel = tile.level;
|
|
303
|
+
}
|
|
304
|
+
if (!tileMap.has(tile.level)) {
|
|
305
|
+
tileMap.set(tile.level, []);
|
|
306
|
+
}
|
|
307
|
+
tileMap.get(tile.level).push(tile);
|
|
308
|
+
}
|
|
309
|
+
let tilesUniqueId = "";
|
|
310
|
+
for (let level = minLevel; level <= maxLevel; level++) {
|
|
311
|
+
const tiles = tileMap.get(level);
|
|
312
|
+
if (!tiles)
|
|
313
|
+
continue;
|
|
314
|
+
tilesUniqueId += `L${level}_C${tiles.length}_`;
|
|
315
|
+
}
|
|
316
|
+
if (tilesUniqueId === this._lastTilesUniqueIdentifier)
|
|
317
|
+
return true;
|
|
318
|
+
this._lastTilesUniqueIdentifier = tilesUniqueId;
|
|
319
|
+
return false;
|
|
177
320
|
}
|
|
178
321
|
}
|
|
322
|
+
function globeBBoxToXYBBOX(t) {
|
|
323
|
+
// this code scales Y to linear integration
|
|
324
|
+
return {
|
|
325
|
+
ll: radianToMercatorXY([t.ll.x * RADIAN, t.ll.y * RADIAN]), // west longitude, north latitude
|
|
326
|
+
ur: radianToMercatorXY([t.ur.x * RADIAN, t.ur.y * RADIAN]) // east longitude, south latitude
|
|
327
|
+
};
|
|
328
|
+
}
|