@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,6 +1,6 @@
|
|
|
1
1
|
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
|
|
3
|
-
import { cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { cartesian3DToGLPosition, } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
4
|
import { isPointInBBox } from "../../util/shaderfunctions/geometrytransformations";
|
|
5
5
|
import { drawArrays } from "../../util/gl-util/draw-options/methods";
|
|
6
6
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
@@ -25,19 +25,14 @@ ${CameraUniformBlockString}
|
|
|
25
25
|
|
|
26
26
|
${cartesian3DToGLPosition}
|
|
27
27
|
in vec3 a_position;
|
|
28
|
-
in vec2
|
|
28
|
+
in vec2 a_xy;
|
|
29
29
|
uniform sampler2DArray u_demTexture; // <-- changed from array to single
|
|
30
30
|
uniform vec4 u_demTextureBBOX[6];
|
|
31
|
-
|
|
31
|
+
uniform vec2 u_textureDataCoverRatio[6];
|
|
32
|
+
uniform int u_breakLoopIndex;
|
|
32
33
|
|
|
33
34
|
${styleBlockManager.glslCode()}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// TODO: light directioni
|
|
37
|
-
// out vec3 v_position;
|
|
38
|
-
// out vec3 v_normal;
|
|
39
|
-
// out vec2 v_textureCoord;
|
|
40
|
-
|
|
35
|
+
// Todo: light direction.
|
|
41
36
|
out vec4 v_color;
|
|
42
37
|
|
|
43
38
|
|
|
@@ -46,23 +41,35 @@ ${isPointInBBox}
|
|
|
46
41
|
void main() {
|
|
47
42
|
|
|
48
43
|
float elevation = ${WORLD_RADIUS_3D}; // default elevation at sea level
|
|
44
|
+
float altitude = 0.0;
|
|
49
45
|
v_color = vec4(1.0, 1.0, 1.0, 1.0); // default color white
|
|
46
|
+
|
|
50
47
|
for (int i = 0; i < 6; i++) {
|
|
51
|
-
if (isPointInBBox(
|
|
52
|
-
vec2 uv = (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
if (isPointInBBox(a_xy, u_demTextureBBOX[i])) {
|
|
49
|
+
vec2 uv = (a_xy - u_demTextureBBOX[i].xy) / (u_demTextureBBOX[i].zw - u_demTextureBBOX[i].xy);
|
|
50
|
+
// uv.y = 1.0 - uv.y; // flip y coordinate
|
|
51
|
+
// rescale and transform uv to fit in the texture data cover bbox
|
|
52
|
+
uv *= u_textureDataCoverRatio[i];
|
|
53
|
+
altitude = texture(u_demTexture, vec3(uv, float(i))).r;
|
|
54
|
+
if (altitude != 0.0) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
58
|
}
|
|
59
59
|
if (u_color.a > 0.0) {
|
|
60
60
|
v_color = u_color;
|
|
61
|
+
} else {
|
|
62
|
+
if ( altitude > 0.00001 ) {
|
|
63
|
+
v_color = mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 0.2, 0.2, 1.0), altitude / 2.0); // color from white to red based on altitude
|
|
64
|
+
} else {
|
|
65
|
+
// white
|
|
66
|
+
v_color = vec4(1.0, 1.0, 1.0, 0.5);
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
v_color.a *= u_opacity;
|
|
63
|
-
vec3 position = a_position * elevation;
|
|
70
|
+
vec3 position = a_position * (elevation + altitude * 2.0);
|
|
64
71
|
gl_Position = cartesian3DToGLPosition(position);
|
|
65
|
-
gl_PointSize = u_pointSize;
|
|
72
|
+
gl_PointSize = 6.0; //u_pointSize;
|
|
66
73
|
}
|
|
67
74
|
`;
|
|
68
75
|
const fragmentShaderSource = `#version 300 es
|
|
@@ -75,6 +82,10 @@ void main() {
|
|
|
75
82
|
outColor = v_color;
|
|
76
83
|
}
|
|
77
84
|
`;
|
|
85
|
+
function resCalculation(sourceResolution, mergeCount) {
|
|
86
|
+
return sourceResolution + (mergeCount - 1) * (sourceResolution - 1);
|
|
87
|
+
}
|
|
88
|
+
const RESOLUTION = resCalculation(5, 12); // 5 is tile dimension length, 12 is merge count
|
|
78
89
|
export class TextureDemTriangles {
|
|
79
90
|
globe;
|
|
80
91
|
gl;
|
|
@@ -88,12 +99,14 @@ export class TextureDemTriangles {
|
|
|
88
99
|
locations = {
|
|
89
100
|
attributes: {
|
|
90
101
|
a_position: -1,
|
|
91
|
-
|
|
102
|
+
a_xy: -1,
|
|
92
103
|
},
|
|
93
104
|
uniforms: {
|
|
94
105
|
u_demTexture: -1,
|
|
95
106
|
u_demTextureBBOX: -1,
|
|
107
|
+
u_textureDataCoverRatio: -1,
|
|
96
108
|
u_style: -1,
|
|
109
|
+
u_breakLoopIndex: -1,
|
|
97
110
|
}
|
|
98
111
|
};
|
|
99
112
|
constructor(globe) {
|
|
@@ -104,19 +117,23 @@ export class TextureDemTriangles {
|
|
|
104
117
|
this.cameraUniformBlock.assignBindingPoint(this.program, uniformBindingPoints.camera);
|
|
105
118
|
// get attribute locations
|
|
106
119
|
this.locations.attributes.a_position = this.gl.getAttribLocation(this.program, 'a_position');
|
|
107
|
-
this.locations.attributes.
|
|
120
|
+
this.locations.attributes.a_xy = this.gl.getAttribLocation(this.program, 'a_xy');
|
|
108
121
|
// get uniform locations
|
|
109
122
|
this.locations.uniforms.u_demTexture = this.gl.getUniformLocation(this.program, 'u_demTexture');
|
|
110
123
|
this.locations.uniforms.u_demTextureBBOX = this.gl.getUniformLocation(this.program, 'u_demTextureBBOX');
|
|
124
|
+
this.locations.uniforms.u_textureDataCoverRatio = this.gl.getUniformLocation(this.program, 'u_textureDataCoverRatio');
|
|
125
|
+
this.locations.uniforms.u_breakLoopIndex = this.gl.getUniformLocation(this.program, 'u_breakLoopIndex');
|
|
111
126
|
this.locations.uniforms.u_style = this.gl.getUniformBlockIndex(this.program, 'Style');
|
|
112
127
|
this.gl.uniformBlockBinding(this.program, this.locations.uniforms.u_style, uniformBindingPoints.style);
|
|
113
128
|
// create 3d texture
|
|
114
129
|
const texture = this.gl.createTexture();
|
|
115
130
|
this.gl.bindTexture(this.gl.TEXTURE_2D_ARRAY, texture);
|
|
116
|
-
//
|
|
117
|
-
|
|
131
|
+
// Calculate correct size: tileDimensionLength + (mergeCount - 1) * (tileDimensionLength - 1)
|
|
132
|
+
// For tileDimensionLength=5, mergeCount=8: 5 + 7*4 = RESOLUTION
|
|
133
|
+
this.gl.texStorage3D(this.gl.TEXTURE_2D_ARRAY, 1, this.gl.R32F, RESOLUTION, RESOLUTION, 6);
|
|
118
134
|
// set texture parameters
|
|
119
135
|
const ext = this.gl.getExtension('OES_texture_float_linear');
|
|
136
|
+
console.log('OES_texture_float_linear extension:', ext);
|
|
120
137
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
|
|
121
138
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
|
|
122
139
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
|
|
@@ -128,11 +145,17 @@ export class TextureDemTriangles {
|
|
|
128
145
|
const vao = this.gl.createVertexArray();
|
|
129
146
|
this.gl.bindVertexArray(vao);
|
|
130
147
|
attributeLoader(this.gl, pos3dBufferInfo, this.locations.attributes.a_position, 3);
|
|
131
|
-
attributeLoader(this.gl, longLatBufferInfo, this.locations.attributes.
|
|
148
|
+
attributeLoader(this.gl, longLatBufferInfo, this.locations.attributes.a_xy, 2);
|
|
132
149
|
this.gl.bindVertexArray(null);
|
|
133
150
|
return vao;
|
|
134
151
|
}
|
|
135
|
-
setDemTextures(demTexturesData, demTextureBBOX) {
|
|
152
|
+
setDemTextures(demTexturesData, demTextureBBOX, coverRatio) {
|
|
153
|
+
// Add validation for maximum layers
|
|
154
|
+
const maxLayers = this.gl.getParameter(this.gl.MAX_ARRAY_TEXTURE_LAYERS);
|
|
155
|
+
if (demTexturesData.length > Math.min(maxLayers, 6)) {
|
|
156
|
+
console.error(`Too many DEM textures: ${demTexturesData.length}, max supported: ${Math.min(maxLayers, 6)}`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
136
159
|
// bind textures to texture units
|
|
137
160
|
const gl = this.gl;
|
|
138
161
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, this.texture);
|
|
@@ -142,23 +165,33 @@ export class TextureDemTriangles {
|
|
|
142
165
|
// bind and upload each texture to the 3D texture array
|
|
143
166
|
for (let i = 0; i < demTexturesData.length; i++) {
|
|
144
167
|
const data = demTexturesData[i];
|
|
145
|
-
if (data.length ===
|
|
146
|
-
gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, i,
|
|
168
|
+
if (data.length === RESOLUTION * RESOLUTION) { // <-- FIXED
|
|
169
|
+
gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, i, RESOLUTION, RESOLUTION, 1, gl.RED, gl.FLOAT, new Float32Array(data));
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
console.warn(`DEM texture ${i} has incorrect size: ${data.length}, expected: ${RESOLUTION * RESOLUTION}`);
|
|
147
173
|
}
|
|
148
174
|
}
|
|
149
175
|
// set uniform for texture units
|
|
150
176
|
const bboxVec4Array = new Float32Array(6 * 4);
|
|
151
177
|
for (let i = 0; i < demTextureBBOX.length; i++) {
|
|
152
178
|
const bbox = demTextureBBOX[i];
|
|
153
|
-
bboxVec4Array[i * 4 + 0] = bbox.
|
|
154
|
-
bboxVec4Array[i * 4 + 1] = bbox.
|
|
155
|
-
bboxVec4Array[i * 4 + 2] = bbox.
|
|
156
|
-
bboxVec4Array[i * 4 + 3] = bbox.
|
|
179
|
+
bboxVec4Array[i * 4 + 0] = bbox.ll[0];
|
|
180
|
+
bboxVec4Array[i * 4 + 1] = bbox.ll[1];
|
|
181
|
+
bboxVec4Array[i * 4 + 2] = bbox.ur[0];
|
|
182
|
+
bboxVec4Array[i * 4 + 3] = bbox.ur[1];
|
|
157
183
|
}
|
|
158
184
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
159
185
|
gl.useProgram(this.program);
|
|
160
186
|
gl.uniform4fv(this.locations.uniforms.u_demTextureBBOX, bboxVec4Array);
|
|
187
|
+
if (coverRatio) {
|
|
188
|
+
gl.uniform2fv(this.locations.uniforms.u_textureDataCoverRatio, new Float32Array(coverRatio.flatMap(ratio => [ratio.x, ratio.y])));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
gl.uniform2fv(this.locations.uniforms.u_textureDataCoverRatio, new Float32Array(12).fill(1.0));
|
|
192
|
+
}
|
|
161
193
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, null);
|
|
194
|
+
gl.uniform1i(this.locations.uniforms.u_breakLoopIndex, demTexturesData.length);
|
|
162
195
|
gl.useProgram(currentProgram);
|
|
163
196
|
}
|
|
164
197
|
createUBO(bufferReadType = "STATIC_DRAW") {
|
|
@@ -178,7 +211,11 @@ export class TextureDemTriangles {
|
|
|
178
211
|
gl.useProgram(this.program);
|
|
179
212
|
this.cameraUniformBlock.bind(uniformBindingPoints.camera);
|
|
180
213
|
// TURN OFF flip y for texture
|
|
181
|
-
gl.disable(gl.DEPTH_TEST);
|
|
214
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
215
|
+
// gl.depthMask(false);
|
|
216
|
+
// gl.depthRange(0.0, 0.01); // Use near 1% of depth range
|
|
217
|
+
// Step 3: Optionally: Set depth func to ALWAYS (to ignore previous depth)
|
|
218
|
+
// This ensures your new geometry passes depth test regardless of prior depth values
|
|
182
219
|
gl.activeTexture(gl.TEXTURE0);
|
|
183
220
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, this.texture);
|
|
184
221
|
gl.uniform1i(this.locations.uniforms.u_demTexture, 0); // texture unit 0
|
|
@@ -186,9 +223,9 @@ export class TextureDemTriangles {
|
|
|
186
223
|
gl.bindVertexArray(vao);
|
|
187
224
|
// bind UBO for style
|
|
188
225
|
ubo.bind();
|
|
226
|
+
drawOnTopBegin(gl);
|
|
189
227
|
drawArrays(gl, gl.POINTS, drawOptions);
|
|
190
|
-
|
|
191
|
-
// unbind everything
|
|
228
|
+
drawOnTopEnd(gl);
|
|
192
229
|
gl.bindVertexArray(null);
|
|
193
230
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, null);
|
|
194
231
|
gl.useProgram(null);
|
|
@@ -207,3 +244,25 @@ export class TextureDemTriangles {
|
|
|
207
244
|
return result;
|
|
208
245
|
}
|
|
209
246
|
}
|
|
247
|
+
function drawOnTopBegin(gl) {
|
|
248
|
+
gl.disable(gl.DEPTH_TEST);
|
|
249
|
+
// gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
250
|
+
// // Use an offset to "nudge" the depth value slightly closer or farther.
|
|
251
|
+
// // Common values are gl.polygonOffset(1.0, 1.0) or gl.polygonOffset(0.RESOLUTION, 0.RESOLUTION)
|
|
252
|
+
// gl.polygonOffset(1.0, 1.0);
|
|
253
|
+
// gl.depthRange(0.0, 0.0001); // Use near 0.01% of depth range
|
|
254
|
+
// gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
255
|
+
// You will need to experiment with these values!
|
|
256
|
+
// A good starting point is -1.0, -1.0.
|
|
257
|
+
// Negative values "pull" the fragments closer to the camera.
|
|
258
|
+
// gl.polygonOffset(-1.0, -1.0);
|
|
259
|
+
// gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
260
|
+
// gl.polygonOffset(-1.0, -2.0);
|
|
261
|
+
}
|
|
262
|
+
function drawOnTopEnd(gl) {
|
|
263
|
+
gl.enable(gl.DEPTH_TEST);
|
|
264
|
+
// gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
265
|
+
// gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
266
|
+
// gl.depthRange(0.0, 1.0); // Restore full depth range
|
|
267
|
+
// gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
268
|
+
}
|
|
@@ -147,34 +147,32 @@ export class Logic {
|
|
|
147
147
|
this._lastAlphaMultiplier = 1.0;
|
|
148
148
|
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
149
149
|
const { gl, program } = this;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
gl.useProgram(currentProgram);
|
|
177
|
-
}
|
|
150
|
+
// set attributes locations
|
|
151
|
+
gl.bindAttribLocation(program, 0, 'center2d');
|
|
152
|
+
gl.bindAttribLocation(program, 1, 'center3d');
|
|
153
|
+
gl.bindAttribLocation(program, 2, 'start_angle2d');
|
|
154
|
+
gl.bindAttribLocation(program, 3, 'tail_angle2d');
|
|
155
|
+
gl.bindAttribLocation(program, 4, 'start_angle3d');
|
|
156
|
+
gl.bindAttribLocation(program, 5, 'tail_angle3d');
|
|
157
|
+
gl.bindAttribLocation(program, 6, 'color');
|
|
158
|
+
gl.bindAttribLocation(program, 7, 'radius');
|
|
159
|
+
gl.bindAttribLocation(program, 8, 'filling_mode');
|
|
160
|
+
// vao
|
|
161
|
+
// instanced draw read 1
|
|
162
|
+
// Uniforms
|
|
163
|
+
this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
|
|
164
|
+
this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
|
|
165
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
166
|
+
gl.useProgram(program);
|
|
167
|
+
gl.uniform1i(this._draw_modeLocation, this._lastMode);
|
|
168
|
+
gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
|
|
169
|
+
this.cameraBlockBindingPoint = 0;
|
|
170
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
171
|
+
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
172
|
+
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
173
|
+
flexibleBlockManager.assignBindingPoint(gl, program);
|
|
174
|
+
this._defaultFlexibleUBO = flexibleBlockManager.createUBO(gl);
|
|
175
|
+
gl.useProgram(currentProgram);
|
|
178
176
|
}
|
|
179
177
|
draw(length, vao, edgeCount, drawMode, ubo = null) {
|
|
180
178
|
const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
@@ -240,7 +238,6 @@ export class Logic {
|
|
|
240
238
|
}
|
|
241
239
|
createUBO() {
|
|
242
240
|
const { gl } = this;
|
|
243
|
-
const bufferReadType = gl.DYNAMIC_DRAW;
|
|
244
241
|
const ubo = flexibleBlockManager.createUBO(gl, "STATIC_DRAW");
|
|
245
242
|
this._ubosPublished.push(ubo);
|
|
246
243
|
return ubo;
|
|
@@ -2,7 +2,6 @@ import { globeProgramCache } from "../programcache";
|
|
|
2
2
|
import { fromLongLatToUnitVector } from "../../Math/vec3";
|
|
3
3
|
import { RADIAN } from "../../Math/methods";
|
|
4
4
|
import { GlobeChangeObserver } from "./globe-changes";
|
|
5
|
-
// import { approximatedZoomLevel } from "../../util/geometry/index";
|
|
6
5
|
export const CameraUniformBlockString = `
|
|
7
6
|
layout(std140) uniform CameraUniformBlock {
|
|
8
7
|
mat4 view; // 64 bytes 0
|
|
@@ -93,49 +92,39 @@ export class CameraUniformBlockTotem {
|
|
|
93
92
|
const globe = this.globe;
|
|
94
93
|
this._globeChangeObserver?.checkChanges();
|
|
95
94
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// mapWH
|
|
109
|
-
if (globe.api_GetCurrentGeometry() === 1) {
|
|
110
|
-
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
111
|
-
mapWHFloat32.set([width, height]);
|
|
112
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
{
|
|
116
|
-
// float world_distance; // 4 bytes 164
|
|
117
|
-
// float world_tilt; // 4 bytes 168
|
|
118
|
-
// float world_north_angle; // 4 bytes 172
|
|
119
|
-
// vec2 world_center_radian; // 8 bytes 180
|
|
120
|
-
const { CenterLong, CenterLat, Distance, Tilt, NorthAng } = globe.api_GetCurrentLookInfo();
|
|
121
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 164, new Float32Array([
|
|
122
|
-
Distance,
|
|
123
|
-
Radian * Tilt,
|
|
124
|
-
Radian * NorthAng,
|
|
125
|
-
Radian * CenterLong,
|
|
126
|
-
Radian * CenterLat,
|
|
127
|
-
]));
|
|
95
|
+
// view, projection, translate
|
|
96
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
|
|
97
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
|
|
98
|
+
traslateFloat32.set([translate.x, translate.y, translate.z], 0);
|
|
99
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
|
|
100
|
+
// zoom level
|
|
101
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
|
|
102
|
+
// mapWH
|
|
103
|
+
if (globe.api_GetCurrentGeometry() === 1) {
|
|
104
|
+
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
105
|
+
mapWHFloat32.set([width, height]);
|
|
106
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
|
|
128
107
|
}
|
|
108
|
+
// float world_distance; // 4 bytes 164
|
|
109
|
+
// float world_tilt; // 4 bytes 168
|
|
110
|
+
// float world_north_angle; // 4 bytes 172
|
|
111
|
+
// vec2 world_center_radian; // 8 bytes 180
|
|
112
|
+
const { CenterLong, CenterLat, Distance, Tilt, NorthAng } = globe.api_GetCurrentLookInfo();
|
|
113
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 164, new Float32Array([
|
|
114
|
+
Distance,
|
|
115
|
+
Radian * Tilt,
|
|
116
|
+
Radian * NorthAng,
|
|
117
|
+
Radian * CenterLong,
|
|
118
|
+
Radian * CenterLat,
|
|
119
|
+
]));
|
|
129
120
|
// this._frustumPlanes = getFrustumPlanes(projection, translate);
|
|
130
121
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this._isMovedParams.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this._isMovedParams.lastLod = currentLOD;
|
|
138
|
-
}
|
|
122
|
+
// isMoved
|
|
123
|
+
const currentLOD = globe.api_GetCurrentLODWithDecimal();
|
|
124
|
+
this._isMovedParams.isMoved =
|
|
125
|
+
this._isMovedParams.lastLod !== currentLOD ||
|
|
126
|
+
globe.api_IsScreenMoving();
|
|
127
|
+
this._isMovedParams.lastLod = currentLOD;
|
|
139
128
|
this.__setCameraVectors();
|
|
140
129
|
// this._calculateAproximatedLOD();
|
|
141
130
|
}
|
|
@@ -146,7 +135,7 @@ export class CameraUniformBlockTotem {
|
|
|
146
135
|
const globe = this.globe;
|
|
147
136
|
const currentGeom = globe.api_GetCurrentGeometry();
|
|
148
137
|
if (currentGeom === 0) {
|
|
149
|
-
const { Fp
|
|
138
|
+
const { Fp } = globe; // FUPos
|
|
150
139
|
const cameraVector = [Fp.x, Fp.y, Fp.z];
|
|
151
140
|
const length = Math.sqrt(cameraVector.reduce((sum, val) => sum + val * val, 0));
|
|
152
141
|
this._normalizedCameraVector[0] = cameraVector[0] / length;
|
|
@@ -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 { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
4
|
const vertexCount = 720;
|
|
@@ -73,29 +73,19 @@ class Logic {
|
|
|
73
73
|
this._lastOpacity = 1;
|
|
74
74
|
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
75
75
|
const { gl, program } = this;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
gl.useProgram(program);
|
|
90
|
-
gl.uniform1f(this._opacityLocation, this._lastOpacity);
|
|
91
|
-
gl.useProgram(currentProgram);
|
|
92
|
-
}
|
|
93
|
-
{
|
|
94
|
-
this.cameraBlockBindingPoint = 0;
|
|
95
|
-
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
96
|
-
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
97
|
-
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
98
|
-
}
|
|
76
|
+
gl.bindAttribLocation(program, 0, "screen_coordinate");
|
|
77
|
+
gl.bindAttribLocation(program, 1, "pixel_radius_small_ratio");
|
|
78
|
+
gl.bindAttribLocation(program, 2, "pixel_radius_big_ratio");
|
|
79
|
+
gl.bindAttribLocation(program, 3, "rgba");
|
|
80
|
+
this._opacityLocation = gl.getUniformLocation(program, "plugin_opacity");
|
|
81
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
82
|
+
gl.useProgram(program);
|
|
83
|
+
gl.uniform1f(this._opacityLocation, this._lastOpacity);
|
|
84
|
+
gl.useProgram(currentProgram);
|
|
85
|
+
this.cameraBlockBindingPoint = 0;
|
|
86
|
+
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
87
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
88
|
+
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
99
89
|
}
|
|
100
90
|
draw(vao, length, opacity) {
|
|
101
91
|
const { globe, gl, program, cameraBlockTotem, cameraBlockBindingPoint, _opacityLocation } = this;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../../util";
|
|
2
|
-
import { UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
|
|
1
|
+
import { createProgram } from "../../../util/webglobjectbuilders";
|
|
3
2
|
import { glProgramCache } from "../../programcache";
|
|
4
3
|
import { SeaWaveUbo } from "./ubo-new";
|
|
5
4
|
/**
|
|
@@ -64,10 +63,12 @@ void main(){
|
|
|
64
63
|
outColor = vec4(base_color, 1.0);
|
|
65
64
|
}`;
|
|
66
65
|
class Logic {
|
|
66
|
+
gl;
|
|
67
|
+
program;
|
|
68
|
+
_vector_field_location;
|
|
67
69
|
constructor(gl) {
|
|
68
70
|
this.gl = gl;
|
|
69
|
-
[this.program,
|
|
70
|
-
this._vector_field_location] = this._createProgram();
|
|
71
|
+
[this.program, this._vector_field_location] = this._createProgram();
|
|
71
72
|
// this.decoyBuffer = new DecoyBufferManager(gl);
|
|
72
73
|
}
|
|
73
74
|
_createProgram() {
|
|
@@ -76,13 +77,13 @@ class Logic {
|
|
|
76
77
|
// ubo point
|
|
77
78
|
// const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
78
79
|
// gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
|
|
79
|
-
SeaWaveUbo.assignBindingPoint(gl, program
|
|
80
|
+
SeaWaveUbo.assignBindingPoint(gl, program);
|
|
80
81
|
return [program, gl.getUniformLocation(program, 'u_vector_field')];
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
84
|
+
* @param bufferManager | PingPongBufferManager
|
|
85
|
+
* @param vectorTexture | RG32F texture R: x, G: y
|
|
86
|
+
* @param uboManager | WaveParticalUboManager under ubo.js
|
|
86
87
|
*/
|
|
87
88
|
draw(bufferManager, vectorTexture, uboManager) {
|
|
88
89
|
const { gl, program } = this;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createProgram } from "../../../util/webglobjectbuilders";
|
|
2
|
+
import { glProgramCache } from "../../programcache";
|
|
3
|
+
import { SeaWaveUbo } from "./ubo-new";
|
|
4
|
+
/**
|
|
5
|
+
* [+] ubo
|
|
6
|
+
*/
|
|
7
|
+
const vertexShaderSource = `#version 300 es
|
|
8
|
+
precision highp float;
|
|
9
|
+
` + SeaWaveUbo.glslCode() + `
|
|
10
|
+
uniform sampler2D u_vector_field;
|
|
11
|
+
in vec2 in_position;
|
|
12
|
+
out vec3 base_color;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
vec2 read_value(const vec2 uv) {
|
|
16
|
+
vec2 value = texture(u_vector_field, uv).rg;
|
|
17
|
+
if ( value.x == escape_value || value.y == escape_value) {
|
|
18
|
+
return vec2(0.0);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
|
|
25
|
+
// return texture(u_vector_field, uv).rg; // lower-res hardware filtering
|
|
26
|
+
vec2 res = vec2(textureSize(u_vector_field, 0));
|
|
27
|
+
vec2 px = 1.0 / res;
|
|
28
|
+
vec2 vc = (floor(uv * res)) * px;
|
|
29
|
+
vec2 f = fract(uv * res);
|
|
30
|
+
vec2 tl = read_value(vc).rg;
|
|
31
|
+
vec2 tr = read_value(vc + vec2(px.x, 0)).rg;
|
|
32
|
+
vec2 bl = read_value(vc + vec2(0, px.y)).rg;
|
|
33
|
+
vec2 br = read_value(vc + px).rg;
|
|
34
|
+
|
|
35
|
+
return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
void main(){
|
|
40
|
+
vec2 direction_vector = lookup_wind(in_position);
|
|
41
|
+
if (direction_vector.r == 0.0 && direction_vector.g == 0.0) return;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
vec2 limp;
|
|
45
|
+
if ( 0 == gl_VertexID) { limp = -tail_wing_base_limp; }
|
|
46
|
+
else if ( 1 == gl_VertexID) { limp = vec2( tail_wing_base_limp.x, -tail_wing_base_limp.y); }
|
|
47
|
+
else if ( 2 == gl_VertexID) { limp = tail_wing_base_limp; }
|
|
48
|
+
else { limp = vec2(-tail_wing_base_limp.x, tail_wing_base_limp.y); } // if ( 3 == gl_VertexID)
|
|
49
|
+
|
|
50
|
+
limp = (limp * mat2(
|
|
51
|
+
direction_vector.x, -direction_vector.y,
|
|
52
|
+
direction_vector.y, direction_vector.x)) / draw_texture_size;
|
|
53
|
+
|
|
54
|
+
vec2 pos = in_position * 2.0 - 1.0;
|
|
55
|
+
gl_Position = vec4(pos + limp, 0.0, 1.0);
|
|
56
|
+
base_color = color;
|
|
57
|
+
}`;
|
|
58
|
+
const fragmentShaderSource = `#version 300 es
|
|
59
|
+
precision highp float;
|
|
60
|
+
out vec4 outColor;
|
|
61
|
+
in vec3 base_color;
|
|
62
|
+
void main(){
|
|
63
|
+
outColor = vec4(base_color, 1.0);
|
|
64
|
+
}`;
|
|
65
|
+
class Logic {
|
|
66
|
+
constructor(gl) {
|
|
67
|
+
this.gl = gl;
|
|
68
|
+
[this.program,
|
|
69
|
+
this._vector_field_location] = this._createProgram();
|
|
70
|
+
// this.decoyBuffer = new DecoyBufferManager(gl);
|
|
71
|
+
}
|
|
72
|
+
_createProgram() {
|
|
73
|
+
const gl = this.gl;
|
|
74
|
+
const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
75
|
+
// ubo point
|
|
76
|
+
// const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
77
|
+
// gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
|
|
78
|
+
SeaWaveUbo.assignBindingPoint(gl, program, 0);
|
|
79
|
+
return [program, gl.getUniformLocation(program, 'u_vector_field')];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @param {*} bufferManager | PingPongBufferManager
|
|
83
|
+
* @param {*} vectorTexture | RG32F texture R: x, G: y
|
|
84
|
+
* @param {*} uboManager | WaveParticalUboManager under ubo.js
|
|
85
|
+
*/
|
|
86
|
+
draw(bufferManager, vectorTexture, uboManager) {
|
|
87
|
+
const { gl, program } = this;
|
|
88
|
+
gl.useProgram(program);
|
|
89
|
+
gl.bindVertexArray(bufferManager.getSourceVao());
|
|
90
|
+
// gl.bindVertexArray(this.decoyBuffer.getSourceVao());
|
|
91
|
+
uboManager.bind();
|
|
92
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
93
|
+
gl.uniform1i(this._vector_field_location, 0);
|
|
94
|
+
gl.bindTexture(gl.TEXTURE_2D, vectorTexture);
|
|
95
|
+
gl.drawArraysInstanced(gl.TRIANGLE_FAN, 0, 4, bufferManager.length);
|
|
96
|
+
gl.drawArraysInstanced(gl.POINTS, 0, 4, bufferManager.length);
|
|
97
|
+
gl.bindVertexArray(null);
|
|
98
|
+
uboManager.unbind();
|
|
99
|
+
}
|
|
100
|
+
free() {
|
|
101
|
+
this.gl.deleteProgram(this.program);
|
|
102
|
+
this.program = null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export const drawRectangleParticlesProgramCache = Object.freeze({
|
|
106
|
+
getProgram: (gl) => {
|
|
107
|
+
return glProgramCache.getProgram(gl, Logic);
|
|
108
|
+
},
|
|
109
|
+
releaseProgram: (gl) => {
|
|
110
|
+
glProgramCache.releaseProgram(gl, Logic);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createShader } from "../../../util";
|
|
2
|
-
import { UBO_SIZE, UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
|
|
1
|
+
import { createShader } from "../../../util/webglobjectbuilders";
|
|
3
2
|
import { glProgramCache } from "../../programcache";
|
|
4
3
|
import { SeaWaveUbo } from "./ubo-new";
|
|
5
4
|
// program output is buffer
|
|
@@ -18,7 +18,7 @@ export const flatLinesInputAdapter = (bearingLine) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export const flatLinesBearingInputAdapter = (bearingLine) => {
|
|
21
|
-
const { long, lat, rgba, key, bearingLat = 0, bearingLong = 0
|
|
21
|
+
const { long, lat, rgba, key, bearingLat = 0, bearingLong = 0 } = bearingLine;
|
|
22
22
|
return {
|
|
23
23
|
key: key,
|
|
24
24
|
start: [long, lat],
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export const keyMethod = (chainKey, nodeKey) => `${chainKey}_${nodeKey}`;
|
|
2
|
-
const distance = (node1, node2) => {
|
|
3
|
-
const dx = node1.long - node2.long;
|
|
4
|
-
const dy = node1.lat - node2.lat;
|
|
5
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
6
|
-
};
|
|
7
2
|
export const circleDataAdaptor = (globe, chain) => {
|
|
8
3
|
const circleInputs = [];
|
|
9
4
|
const { chainKey, chainProperties, nodes } = chain;
|
|
@@ -102,7 +102,7 @@ export class CircleLineChainPlugin {
|
|
|
102
102
|
return;
|
|
103
103
|
const chainKeys = [];
|
|
104
104
|
const chainsToClean = [];
|
|
105
|
-
for (const { chainKey
|
|
105
|
+
for (const { chainKey } of chains) {
|
|
106
106
|
if (this._chainListMap.hasChain(chainKey)) {
|
|
107
107
|
chainsToClean.push(chainKey);
|
|
108
108
|
}
|