@pirireis/webglobeplugins 0.16.4 → 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/arc.js +92 -2
- package/Math/circle-cdf-points.js +2 -2
- package/Math/circle.js +2 -2
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/juction/arc-plane.js +67 -12
- package/Math/juction/line-sphere.js +6 -6
- package/Math/juction/plane-plane.js +4 -6
- package/Math/methods.js +5 -5
- package/Math/templete-shapes/grid-visually-equal.js +0 -1
- package/Math/tessellation/earcut/adapters.js +37 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/methods.js +46 -0
- package/Math/tessellation/shred-input.js +18 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/tiler.js +50 -0
- package/Math/tessellation/triangle-tessellation-meta.js +516 -0
- package/Math/tessellation/triangle-tessellation.js +14 -0
- package/Math/tessellation/zoom-catch.js +1 -0
- package/Math/vec3.js +26 -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 +7 -3
- 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 +204 -0
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +31 -10
- package/programs/polygon-on-globe/texture-dem-triangles.js +81 -12
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +34 -45
- 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 +5 -7
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -2
- 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 +4 -5
- 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/shaderfunctions/geometrytransformations.js +6 -0
- 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/mesh/mapbox-delaunay.js +0 -544
- 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/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/{util/surface-line-data → Math/tessellation}/types.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
|
@@ -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";
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { TextureDemTriangles } from "./texture-dem-triangles";
|
|
2
|
+
import { partialTest } from "../../Math/tessellation/triangle-tessellation";
|
|
3
|
+
/**
|
|
4
|
+
* Loads a plugin with test data for TextureDemTriangles
|
|
5
|
+
*/
|
|
6
|
+
const createTestBBOXES = () => {
|
|
7
|
+
const bboxes = [];
|
|
8
|
+
for (let i = 0; i < 6; i++) {
|
|
9
|
+
const north = Math.random() * Math.PI / 2 / 1.4; // random latitude
|
|
10
|
+
const west = Math.random() * -1 * Math.PI / 10; // random longitude
|
|
11
|
+
const south = north - Math.PI / 30; // random latitude
|
|
12
|
+
const east = west + Math.PI / 30; // random longitude
|
|
13
|
+
const nw = [west, north]; // random northWest
|
|
14
|
+
const se = [east, south]; // random southEast
|
|
15
|
+
bboxes.push({ northWest: nw, southEast: se });
|
|
16
|
+
}
|
|
17
|
+
return bboxes;
|
|
18
|
+
};
|
|
19
|
+
const demTextureBBOX = createTestBBOXES();
|
|
20
|
+
function showTextureBBoxes(bboxes, demData = []) {
|
|
21
|
+
for (let i = 0; i < bboxes.length; i++) {
|
|
22
|
+
const bbox = bboxes[i];
|
|
23
|
+
console.log(`Texture BBOX ${i}: NW(${(bbox.northWest[0] * 180 / Math.PI).toFixed(2)}, ${(bbox.northWest[1] * 180 / Math.PI).toFixed(2)}) SE(${(bbox.southEast[0] * 180 / Math.PI).toFixed(2)}, ${(bbox.southEast[1] * 180 / Math.PI).toFixed(2)})`);
|
|
24
|
+
if (demData.length > i) {
|
|
25
|
+
const dem = demData[i];
|
|
26
|
+
let demStr = "DEM: \n";
|
|
27
|
+
for (let j = 0; j < dem.length; j++) {
|
|
28
|
+
demStr += dem[j].toFixed(1) + " ";
|
|
29
|
+
if ((j + 1) % 5 === 0) {
|
|
30
|
+
demStr += "\n";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
console.log(demStr);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const createTestDemTextures = () => {
|
|
38
|
+
const textures = [];
|
|
39
|
+
for (let i = 0; i < 6; i++) {
|
|
40
|
+
const texture = [];
|
|
41
|
+
for (let j = 0; j < 5 * 5; j++) {
|
|
42
|
+
const value = 100 * Math.random(); // random elevation value
|
|
43
|
+
texture.push(value);
|
|
44
|
+
}
|
|
45
|
+
textures.push(texture);
|
|
46
|
+
}
|
|
47
|
+
return textures;
|
|
48
|
+
};
|
|
49
|
+
// TODO: NAME IT longlat degree or radian
|
|
50
|
+
export function createBuffersAndFill(gl, vec3s, longLats, indices) {
|
|
51
|
+
const positionBuffer = gl.createBuffer();
|
|
52
|
+
const longLatBuffer = gl.createBuffer();
|
|
53
|
+
const indexBuffer = gl.createBuffer();
|
|
54
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
55
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vec3s), gl.STATIC_DRAW);
|
|
56
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, longLatBuffer);
|
|
57
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(longLats), gl.STATIC_DRAW);
|
|
58
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
|
|
59
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
|
60
|
+
return {
|
|
61
|
+
buffers: {
|
|
62
|
+
positionBuffer,
|
|
63
|
+
longLatBuffer,
|
|
64
|
+
indexBuffer
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export class TextureDemTrianglesTestPlugin {
|
|
69
|
+
globe = null;
|
|
70
|
+
textureDemTriangles = null;
|
|
71
|
+
vao = null;
|
|
72
|
+
drawOptions = null;
|
|
73
|
+
bufferInfo = null;
|
|
74
|
+
id;
|
|
75
|
+
uboTriangleStyle = null;
|
|
76
|
+
uboStringStyle = null;
|
|
77
|
+
showDemPoints = false;
|
|
78
|
+
bboxZooms = [];
|
|
79
|
+
constructor(id) {
|
|
80
|
+
this.id = id;
|
|
81
|
+
this.bboxZooms = [];
|
|
82
|
+
}
|
|
83
|
+
init(globe) {
|
|
84
|
+
this.globe = globe;
|
|
85
|
+
this.textureDemTriangles = new TextureDemTriangles(globe);
|
|
86
|
+
// set bboxes and dem textures
|
|
87
|
+
const demTextures = createTestDemTextures();
|
|
88
|
+
// const demTextureBBOX = createTestBBOXES();
|
|
89
|
+
this.textureDemTriangles.setDemTextures(demTextures, demTextureBBOX);
|
|
90
|
+
//
|
|
91
|
+
// const baseZoom = 5;
|
|
92
|
+
showTextureBBoxes(demTextureBBOX, demTextures);
|
|
93
|
+
this.uboTriangleStyle = this.textureDemTriangles.createUBO();
|
|
94
|
+
this.uboStringStyle = this.textureDemTriangles.createUBO();
|
|
95
|
+
this.uboTriangleStyle.updateSingle("u_color", new Float32Array([1.0, 0.0, 0.0, 0.0]));
|
|
96
|
+
this.uboStringStyle.updateSingle("u_color", new Float32Array([.3, .3, .0, 1.0]));
|
|
97
|
+
const elementBuffer = globe.gl.createBuffer();
|
|
98
|
+
const bufferInfo = {
|
|
99
|
+
pos3dBufferInfo: {
|
|
100
|
+
buffer: globe.gl.createBuffer(),
|
|
101
|
+
stride: 0,
|
|
102
|
+
offset: 0,
|
|
103
|
+
},
|
|
104
|
+
longLatBufferInfo: {
|
|
105
|
+
buffer: globe.gl.createBuffer(),
|
|
106
|
+
stride: 0,
|
|
107
|
+
offset: 0,
|
|
108
|
+
},
|
|
109
|
+
elementBufferInfo: {
|
|
110
|
+
buffer: elementBuffer,
|
|
111
|
+
stride: 0,
|
|
112
|
+
offset: 0,
|
|
113
|
+
},
|
|
114
|
+
drawOptions: {
|
|
115
|
+
drawRange: { count: 0, first: 0 },
|
|
116
|
+
drawMode: globe.gl.TRIANGLES,
|
|
117
|
+
elementBuffer: elementBuffer,
|
|
118
|
+
elementBufferIndexType: globe.gl.UNSIGNED_INT
|
|
119
|
+
},
|
|
120
|
+
drawOptionsPoint: {
|
|
121
|
+
drawRange: { count: 0, first: 0 },
|
|
122
|
+
drawMode: globe.gl.POINTS,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
this.vao = this.textureDemTriangles.createVAO(bufferInfo.pos3dBufferInfo, bufferInfo.longLatBufferInfo);
|
|
126
|
+
this.bufferInfo = bufferInfo;
|
|
127
|
+
this.setZoom(5);
|
|
128
|
+
}
|
|
129
|
+
setUniform(key, value) {
|
|
130
|
+
if (this.uboTriangleStyle) {
|
|
131
|
+
this.uboTriangleStyle.updateSingle(key, value);
|
|
132
|
+
}
|
|
133
|
+
if (this.uboStringStyle) {
|
|
134
|
+
this.uboStringStyle.updateSingle(key, value);
|
|
135
|
+
}
|
|
136
|
+
this.globe?.DrawRender();
|
|
137
|
+
}
|
|
138
|
+
setZoom(zoomLevel) {
|
|
139
|
+
this.bboxZooms = demTextureBBOX.map((bbox, index) => {
|
|
140
|
+
return {
|
|
141
|
+
bbox: {
|
|
142
|
+
min: [bbox.northWest[0], bbox.southEast[1]], max: [bbox.southEast[0], bbox.northWest[1]]
|
|
143
|
+
}, zoom: index + zoomLevel + 1
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
// all world
|
|
147
|
+
this.bboxZooms.push({
|
|
148
|
+
bbox: {
|
|
149
|
+
min: [-180, -90],
|
|
150
|
+
max: [180, 90]
|
|
151
|
+
},
|
|
152
|
+
zoom: zoomLevel
|
|
153
|
+
});
|
|
154
|
+
if (!this.globe || !this.textureDemTriangles || !this.bufferInfo)
|
|
155
|
+
return;
|
|
156
|
+
// const p1: LongLatRadian = [-20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
157
|
+
// const p2: LongLatRadian = [20 * Math.PI / 180, 50 * Math.PI / 180];
|
|
158
|
+
// const p3: LongLatRadian = [0, -10 * Math.PI / 180];
|
|
159
|
+
const p1 = [-60 * Math.PI / 180, 60 * Math.PI / 180];
|
|
160
|
+
const p2 = [60 * Math.PI / 180, 60 * Math.PI / 180];
|
|
161
|
+
const p3 = [0, -60 * Math.PI / 180];
|
|
162
|
+
// const p1_1: LongLatRadian = [-20 * Math.PI / 180, 30 * Math.PI / 180];
|
|
163
|
+
// const p2_2: LongLatRadian = [20 * Math.PI / 180, 20 * Math.PI / 180];
|
|
164
|
+
// const p3_3: LongLatRadian = [5, -20 * Math.PI / 180];
|
|
165
|
+
// const { vec3s, longLats, indices } = test1(zoomLevel, p1, p2, p3);
|
|
166
|
+
// const {vec3s, longLats, indices} = test1(5, p1_1, p2_2, p3_3);
|
|
167
|
+
const { vec3s, longLats, indices } = partialTest(this.bboxZooms, p1, p2, p3);
|
|
168
|
+
const bufferInfo = this.bufferInfo;
|
|
169
|
+
bufferInfo.drawOptions.drawRange.first = 0;
|
|
170
|
+
bufferInfo.drawOptions.drawRange.count = indices.length;
|
|
171
|
+
bufferInfo.drawOptionsPoint.drawRange.first = 0;
|
|
172
|
+
bufferInfo.drawOptionsPoint.drawRange.count = longLats.length / 2;
|
|
173
|
+
const gl = this.globe.gl;
|
|
174
|
+
// const longLatArray = createTestLongLatArray();
|
|
175
|
+
// const pos3dArray = createTestPos3dArray(longLatArray);
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.pos3dBufferInfo.buffer);
|
|
178
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vec3s), gl.STATIC_DRAW);
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.longLatBufferInfo.buffer);
|
|
181
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(longLats), gl.STATIC_DRAW);
|
|
182
|
+
// @ts-ignore
|
|
183
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferInfo.elementBufferInfo.buffer);
|
|
184
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(indices), gl.STATIC_DRAW);
|
|
185
|
+
this.globe.DrawRender();
|
|
186
|
+
console.log("DrawIInfo", this.bufferInfo);
|
|
187
|
+
}
|
|
188
|
+
setShowDemPoints(show) {
|
|
189
|
+
this.showDemPoints = show;
|
|
190
|
+
}
|
|
191
|
+
draw3D() {
|
|
192
|
+
if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo)
|
|
193
|
+
return;
|
|
194
|
+
const gl = this.globe.gl;
|
|
195
|
+
gl.frontFace(gl.CW);
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions, this.uboTriangleStyle);
|
|
198
|
+
if (this.showDemPoints) {
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptionsPoint, this.uboStringStyle);
|
|
201
|
+
}
|
|
202
|
+
gl.frontFace(gl.CCW);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -6,16 +6,16 @@ const TEST_ITEM_COUNT = 1000000;
|
|
|
6
6
|
function createTestLongLatArray() {
|
|
7
7
|
const arr = new Float32Array(TEST_ITEM_COUNT * 2);
|
|
8
8
|
for (let i = 0; i < TEST_ITEM_COUNT; i++) {
|
|
9
|
-
arr[i * 2 + 0] = Math.random() *
|
|
10
|
-
arr[i * 2 + 1] = Math.random()
|
|
9
|
+
arr[i * 2 + 0] = (Math.random() - 0.5) * Math.PI * 2; // longitude
|
|
10
|
+
arr[i * 2 + 1] = (Math.random() - 0.5) * Math.PI; // latitude
|
|
11
11
|
}
|
|
12
12
|
return arr;
|
|
13
13
|
}
|
|
14
14
|
function createTestPos3dArray(longLatArray) {
|
|
15
15
|
const arr = new Float32Array(TEST_ITEM_COUNT * 3);
|
|
16
16
|
for (let i = 0; i < TEST_ITEM_COUNT; i++) {
|
|
17
|
-
const long = longLatArray[i * 2 + 0]
|
|
18
|
-
const lat = longLatArray[i * 2 + 1]
|
|
17
|
+
const long = longLatArray[i * 2 + 0];
|
|
18
|
+
const lat = longLatArray[i * 2 + 1];
|
|
19
19
|
// Convert long/lat to 3D position (simplified)
|
|
20
20
|
arr[i * 3 + 0] = Math.cos(lat) * Math.cos(long);
|
|
21
21
|
arr[i * 3 + 1] = Math.cos(lat) * Math.sin(long);
|
|
@@ -26,10 +26,10 @@ function createTestPos3dArray(longLatArray) {
|
|
|
26
26
|
const createTestBBOXES = () => {
|
|
27
27
|
const bboxes = [];
|
|
28
28
|
for (let i = 0; i < 6; i++) {
|
|
29
|
-
const north = Math.random()
|
|
30
|
-
const west = Math.random() * -
|
|
31
|
-
const south = north -
|
|
32
|
-
const east = west +
|
|
29
|
+
const north = Math.random(); // random latitude
|
|
30
|
+
const west = Math.random() * -1; // random longitude
|
|
31
|
+
const south = north - Math.PI / 6; // random latitude
|
|
32
|
+
const east = west + Math.PI / 6; // random longitude
|
|
33
33
|
const nw = [west, north]; // random northWest
|
|
34
34
|
const se = [east, south]; // random southEast
|
|
35
35
|
bboxes.push({ northWest: nw, southEast: se });
|
|
@@ -48,12 +48,31 @@ const createTestDemTextures = () => {
|
|
|
48
48
|
}
|
|
49
49
|
return textures;
|
|
50
50
|
};
|
|
51
|
+
export function createBuffersAndFill(gl, vec3s, longLats, indices) {
|
|
52
|
+
const positionBuffer = gl.createBuffer();
|
|
53
|
+
const longLatBuffer = gl.createBuffer();
|
|
54
|
+
const indexBuffer = gl.createBuffer();
|
|
55
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
56
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vec3s), gl.STATIC_DRAW);
|
|
57
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, longLatBuffer);
|
|
58
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(longLats), gl.STATIC_DRAW);
|
|
59
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
|
|
60
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
|
61
|
+
return {
|
|
62
|
+
buffers: {
|
|
63
|
+
positionBuffer,
|
|
64
|
+
longLatBuffer,
|
|
65
|
+
indexBuffer
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
51
69
|
export class TextureDemTrianglesTestPlugin {
|
|
52
70
|
globe = null;
|
|
53
71
|
textureDemTriangles = null;
|
|
54
72
|
vao = null;
|
|
55
73
|
drawOptions = null;
|
|
56
74
|
bufferInfo = null;
|
|
75
|
+
ubo = null;
|
|
57
76
|
id;
|
|
58
77
|
constructor(id) {
|
|
59
78
|
this.id = id;
|
|
@@ -66,6 +85,8 @@ export class TextureDemTrianglesTestPlugin {
|
|
|
66
85
|
const demTextureBBOX = createTestBBOXES();
|
|
67
86
|
this.textureDemTriangles.setDemTextures(demTextures, demTextureBBOX);
|
|
68
87
|
//
|
|
88
|
+
this.ubo = this.textureDemTriangles.createUBO();
|
|
89
|
+
this.ubo.updateSingle("u_color", new Float32Array([1.0, 0.0, 0.0, 0.0]));
|
|
69
90
|
const bufferInfo = {
|
|
70
91
|
pos3dBufferInfo: {
|
|
71
92
|
buffer: globe.gl.createBuffer(),
|
|
@@ -90,8 +111,8 @@ export class TextureDemTrianglesTestPlugin {
|
|
|
90
111
|
this.bufferInfo = bufferInfo;
|
|
91
112
|
}
|
|
92
113
|
draw3D() {
|
|
93
|
-
if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo)
|
|
114
|
+
if (!this.globe || !this.textureDemTriangles || !this.vao || !this.bufferInfo || !this.ubo)
|
|
94
115
|
return;
|
|
95
|
-
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions);
|
|
116
|
+
this.textureDemTriangles.draw(this.vao, this.bufferInfo.drawOptions, this.ubo);
|
|
96
117
|
}
|
|
97
118
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
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
|
+
import { isPointInBBox } from "../../util/shaderfunctions/geometrytransformations";
|
|
4
5
|
import { drawArrays } from "../../util/gl-util/draw-options/methods";
|
|
5
6
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
7
|
import { WORLD_RADIUS_3D } from "../../Math/constants";
|
|
8
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
7
9
|
const uniformBindingPoints = {
|
|
8
10
|
camera: 0,
|
|
11
|
+
style: 1,
|
|
9
12
|
};
|
|
13
|
+
const styleBlockManager = new UniformBlockManager('Style', [
|
|
14
|
+
{ name: "u_color", type: "vec4", value: new Float32Array([0.0, 0.0, 0.0, 0.0]) },
|
|
15
|
+
{ name: "u_pointSize", type: "float", value: new Float32Array([1.0]) },
|
|
16
|
+
{ name: "u_opacity", type: "float", value: new Float32Array([1.0]) },
|
|
17
|
+
], uniformBindingPoints.style);
|
|
10
18
|
const vertexShaderSource = `#version 300 es
|
|
11
19
|
#pragma vscode_glsllint_stage : vert
|
|
12
20
|
|
|
@@ -22,6 +30,8 @@ uniform sampler2DArray u_demTexture; // <-- changed from array to single
|
|
|
22
30
|
uniform vec4 u_demTextureBBOX[6];
|
|
23
31
|
|
|
24
32
|
|
|
33
|
+
${styleBlockManager.glslCode()}
|
|
34
|
+
|
|
25
35
|
|
|
26
36
|
// TODO: light directioni
|
|
27
37
|
// out vec3 v_position;
|
|
@@ -30,9 +40,8 @@ uniform vec4 u_demTextureBBOX[6];
|
|
|
30
40
|
|
|
31
41
|
out vec4 v_color;
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
43
|
+
|
|
44
|
+
${isPointInBBox}
|
|
36
45
|
|
|
37
46
|
void main() {
|
|
38
47
|
|
|
@@ -43,16 +52,17 @@ void main() {
|
|
|
43
52
|
vec2 uv = (a_longLat - u_demTextureBBOX[i].xy) / (u_demTextureBBOX[i].zw - u_demTextureBBOX[i].xy);
|
|
44
53
|
float altitude = texture(u_demTexture, vec3(uv, float(i))).r;
|
|
45
54
|
elevation += altitude;
|
|
46
|
-
v_color = mix(vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), altitude /
|
|
47
|
-
// elevation += 1000.0 * float(i); // temporary for testing
|
|
55
|
+
v_color = mix(vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), altitude / 100.0); // color from blue to red based on altitude
|
|
48
56
|
break;
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
if (u_color.a > 0.0) {
|
|
60
|
+
v_color = u_color;
|
|
61
|
+
}
|
|
62
|
+
v_color.a *= u_opacity;
|
|
53
63
|
vec3 position = a_position * elevation;
|
|
54
64
|
gl_Position = cartesian3DToGLPosition(position);
|
|
55
|
-
gl_PointSize =
|
|
65
|
+
gl_PointSize = 5.0; //u_pointSize;
|
|
56
66
|
}
|
|
57
67
|
`;
|
|
58
68
|
const fragmentShaderSource = `#version 300 es
|
|
@@ -62,7 +72,7 @@ precision highp float;
|
|
|
62
72
|
in vec4 v_color;
|
|
63
73
|
out vec4 outColor;
|
|
64
74
|
void main() {
|
|
65
|
-
outColor = v_color;
|
|
75
|
+
outColor = v_color;
|
|
66
76
|
}
|
|
67
77
|
`;
|
|
68
78
|
export class TextureDemTriangles {
|
|
@@ -74,6 +84,7 @@ export class TextureDemTriangles {
|
|
|
74
84
|
// demTextures: WebGLTexture[] = [];
|
|
75
85
|
// demTextureBBOX: Float32Array = new Float32Array(6 * 4); // 6 bounding boxes
|
|
76
86
|
cameraUniformBlock;
|
|
87
|
+
_publishedUBOs = [];
|
|
77
88
|
locations = {
|
|
78
89
|
attributes: {
|
|
79
90
|
a_position: -1,
|
|
@@ -82,6 +93,7 @@ export class TextureDemTriangles {
|
|
|
82
93
|
uniforms: {
|
|
83
94
|
u_demTexture: -1,
|
|
84
95
|
u_demTextureBBOX: -1,
|
|
96
|
+
u_style: -1,
|
|
85
97
|
}
|
|
86
98
|
};
|
|
87
99
|
constructor(globe) {
|
|
@@ -96,6 +108,8 @@ export class TextureDemTriangles {
|
|
|
96
108
|
// get uniform locations
|
|
97
109
|
this.locations.uniforms.u_demTexture = this.gl.getUniformLocation(this.program, 'u_demTexture');
|
|
98
110
|
this.locations.uniforms.u_demTextureBBOX = this.gl.getUniformLocation(this.program, 'u_demTextureBBOX');
|
|
111
|
+
this.locations.uniforms.u_style = this.gl.getUniformBlockIndex(this.program, 'Style');
|
|
112
|
+
this.gl.uniformBlockBinding(this.program, this.locations.uniforms.u_style, uniformBindingPoints.style);
|
|
99
113
|
// create 3d texture
|
|
100
114
|
const texture = this.gl.createTexture();
|
|
101
115
|
this.gl.bindTexture(this.gl.TEXTURE_2D_ARRAY, texture);
|
|
@@ -103,6 +117,7 @@ export class TextureDemTriangles {
|
|
|
103
117
|
this.gl.texStorage3D(this.gl.TEXTURE_2D_ARRAY, 1, this.gl.R32F, 5, 5, 6);
|
|
104
118
|
// set texture parameters
|
|
105
119
|
const ext = this.gl.getExtension('OES_texture_float_linear');
|
|
120
|
+
console.log('OES_texture_float_linear extension:', ext);
|
|
106
121
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
|
|
107
122
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
|
|
108
123
|
this.gl.texParameteri(this.gl.TEXTURE_2D_ARRAY, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
|
|
@@ -147,21 +162,75 @@ export class TextureDemTriangles {
|
|
|
147
162
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, null);
|
|
148
163
|
gl.useProgram(currentProgram);
|
|
149
164
|
}
|
|
150
|
-
|
|
165
|
+
createUBO(bufferReadType = "STATIC_DRAW") {
|
|
166
|
+
const ubo = styleBlockManager.createUBO(this.gl, bufferReadType);
|
|
167
|
+
this._publishedUBOs.push(ubo);
|
|
168
|
+
return ubo;
|
|
169
|
+
}
|
|
170
|
+
free() {
|
|
171
|
+
this.gl.deleteProgram(this.program);
|
|
172
|
+
this.gl.deleteTexture(this.texture);
|
|
173
|
+
this._publishedUBOs.forEach(ubo => ubo.free());
|
|
174
|
+
this._publishedUBOs = [];
|
|
175
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
176
|
+
}
|
|
177
|
+
draw(vao, drawOptions, ubo) {
|
|
151
178
|
const gl = this.gl;
|
|
152
|
-
console.log('Drawing TextureDemTriangles drawOptions:', drawOptions);
|
|
153
179
|
gl.useProgram(this.program);
|
|
154
180
|
this.cameraUniformBlock.bind(uniformBindingPoints.camera);
|
|
155
181
|
// TURN OFF flip y for texture
|
|
182
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
183
|
+
// gl.depthMask(false);
|
|
184
|
+
// gl.depthRange(0.0, 0.01); // Use near 1% of depth range
|
|
185
|
+
// Step 3: Optionally: Set depth func to ALWAYS (to ignore previous depth)
|
|
186
|
+
// This ensures your new geometry passes depth test regardless of prior depth values
|
|
156
187
|
gl.activeTexture(gl.TEXTURE0);
|
|
157
188
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, this.texture);
|
|
158
189
|
gl.uniform1i(this.locations.uniforms.u_demTexture, 0); // texture unit 0
|
|
159
190
|
// bind VAO and draw
|
|
160
191
|
gl.bindVertexArray(vao);
|
|
192
|
+
// bind UBO for style
|
|
193
|
+
ubo.bind();
|
|
194
|
+
drawOnTopBegin(gl);
|
|
161
195
|
drawArrays(gl, gl.POINTS, drawOptions);
|
|
196
|
+
drawOnTopEnd(gl);
|
|
162
197
|
gl.bindVertexArray(null);
|
|
163
198
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, null);
|
|
164
199
|
gl.useProgram(null);
|
|
200
|
+
ubo.unbind();
|
|
165
201
|
this.cameraUniformBlock.unbind(uniformBindingPoints.camera);
|
|
166
202
|
}
|
|
203
|
+
_getUniformBlockOffset(name) {
|
|
204
|
+
// hardcoded offsets based on std140 layout rules
|
|
205
|
+
const offsets = {
|
|
206
|
+
'u_color': 0,
|
|
207
|
+
};
|
|
208
|
+
const result = offsets[name];
|
|
209
|
+
if (result === undefined) {
|
|
210
|
+
throw new Error(`Unknown uniform block member: ${name}, names are: ${Object.keys(offsets).join(", ")}`);
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function drawOnTopBegin(gl) {
|
|
216
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
217
|
+
// gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
218
|
+
// // Use an offset to "nudge" the depth value slightly closer or farther.
|
|
219
|
+
// // Common values are gl.polygonOffset(1.0, 1.0) or gl.polygonOffset(0.5, 0.5)
|
|
220
|
+
// gl.polygonOffset(1.0, 1.0);
|
|
221
|
+
// gl.depthRange(0.0, 0.0001); // Use near 0.01% of depth range
|
|
222
|
+
// gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
223
|
+
// You will need to experiment with these values!
|
|
224
|
+
// A good starting point is -1.0, -1.0.
|
|
225
|
+
// Negative values "pull" the fragments closer to the camera.
|
|
226
|
+
// gl.polygonOffset(-1.0, -1.0);
|
|
227
|
+
gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
228
|
+
gl.polygonOffset(-1.0, -2.0);
|
|
229
|
+
}
|
|
230
|
+
function drawOnTopEnd(gl) {
|
|
231
|
+
// gl.enable(gl.DEPTH_TEST);
|
|
232
|
+
// gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
233
|
+
// gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
234
|
+
// gl.depthRange(0.0, 1.0); // Restore full depth range
|
|
235
|
+
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
167
236
|
}
|
|
@@ -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;
|