@pirireis/webglobeplugins 0.9.12 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +1 -3
- package/Math/arc.js +29 -32
- package/Math/bounds/line-bbox.js +1 -3
- package/Math/constants.js +1 -6
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +32 -35
- package/Math/juction/line-sphere.js +9 -12
- package/Math/juction/plane-plane.js +15 -18
- package/Math/line.js +30 -33
- package/Math/methods.js +6 -24
- package/Math/plane.js +22 -25
- package/Math/quaternion.js +6 -9
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +5 -8
- package/algorithms/search-binary.js +1 -4
- package/altitude-locator/draw-subset-obj.js +1 -3
- package/altitude-locator/plugin.js +34 -37
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +1 -4
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +3 -6
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +62 -66
- package/circle-line-chain/chain-list-map.js +1 -5
- package/circle-line-chain/plugin.js +46 -50
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +12 -16
- package/compass-rose/compass-text-writer.js +3 -7
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +6 -9
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +7 -9
- package/heatwave/isobar/plugin.js +14 -54
- package/heatwave/isobar/quadtreecontours.js +2 -4
- package/heatwave/plugins/heatwaveglobeshell.js +9 -12
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +2 -8
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +13 -20
- package/partialrings/program.js +23 -30
- package/pin/pin-object-array.js +8 -13
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +3 -6
- package/point-heat-map/plugin-webworker.js +11 -14
- package/point-heat-map/point-to-heat-map-flow.js +9 -12
- package/point-tracks/key-methods.js +1 -4
- package/point-tracks/plugin.js +15 -19
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +7 -10
- package/programs/arrowfield/object.js +7 -13
- package/programs/data2legend/density-to-legend.js +6 -9
- package/programs/data2legend/point-to-density-texture.js +13 -16
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +3 -6
- package/programs/float2legendwithratio/object.js +5 -11
- package/programs/globe-util/is-globe-moved.js +3 -5
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +3 -6
- package/programs/globeshell/wiggle/object.js +5 -11
- package/programs/helpers/blender/program.js +3 -6
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +3 -6
- package/programs/helpers/fadeaway/object.js +5 -11
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +19 -22
- package/programs/line-on-globe/circle-accurate-3d.js +21 -24
- package/programs/line-on-globe/circle-accurate-flat.js +18 -24
- package/programs/line-on-globe/circle-accurate.js +27 -30
- package/programs/line-on-globe/circle.js +26 -29
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +23 -26
- package/programs/line-on-globe/lines-color-instanced-flat.js +20 -24
- package/programs/line-on-globe/linestrip.js +28 -31
- package/programs/line-on-globe/naive-accurate-flexible.js +29 -32
- package/programs/line-on-globe/to-the-surface.js +15 -17
- package/programs/line-on-globe/util.js +1 -4
- package/programs/picking/pickable-renderer.js +25 -28
- package/programs/point-on-globe/element-globe-surface-glow.js +22 -25
- package/programs/point-on-globe/element-point-glow.js +26 -29
- package/programs/point-on-globe/square-pixel-point.js +13 -16
- package/programs/programcache.js +1 -6
- package/programs/rings/distancering/circleflatprogram.js +20 -56
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +21 -58
- package/programs/rings/distancering/circlepaddysharedbuffer.js +1 -4
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +21 -57
- package/programs/rings/distancering/paddyflatprogram2d.js +21 -57
- package/programs/rings/distancering/paddyflatprogram3d.js +21 -57
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +23 -25
- package/programs/totems/camerauniformblock.js +7 -11
- package/programs/totems/canvas-webglobe-info.js +6 -10
- package/programs/totems/gpu-selection-uniform-block.js +7 -11
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +10 -13
- package/programs/util.js +1 -3
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +9 -12
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +10 -13
- package/programs/vectorfields/logics/ubo.js +1 -7
- package/programs/vectorfields/pingpongbuffermanager.js +1 -4
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +61 -68
- package/rangerings/rangeringangletext.js +26 -29
- package/rangerings/ring-account.js +1 -6
- package/shaders/fragment-toy/firework.js +1 -4
- package/shaders/fragment-toy/singularity.js +1 -4
- package/timetracks/adaptors-line-strip.js +3 -9
- package/timetracks/adaptors.js +3 -8
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +6 -12
- package/timetracks/plugin.js +6 -12
- package/timetracks/program-line-strip.js +9 -12
- package/timetracks/program.js +10 -13
- package/timetracks/programpoint-line-strip.js +6 -9
- package/timetracks/programpoint.js +6 -9
- package/util/account/bufferoffsetmanager.js +1 -4
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +1 -5
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +1 -5
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +1 -5
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +1 -5
- package/util/algorithms/search-binary.js +1 -4
- package/util/check/get.js +1 -5
- package/util/check/typecheck.js +7 -16
- package/util/geometry/index.js +1 -7
- package/util/gl-util/buffer/attribute-loader.js +2 -6
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +2 -6
- package/util/gl-util/uniform-block/manager.js +2 -5
- package/util/heatwavedatamanager/datamanager.js +1 -4
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +3 -9
- package/util/heatwavedatamanager/pointcoordsmeta.js +1 -4
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +1 -4
- package/util/interpolation/timetrack/timetrack-interpolator.js +6 -10
- package/util/interpolation/timetrack/web-worker-str.js +1 -4
- package/util/interpolation/timetrack/web-worker.js +2 -4
- package/util/jshelpers/data-filler.js +1 -4
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +1 -3
- package/util/picking/fence.js +1 -4
- package/util/picking/picker-displayer.js +6 -9
- package/util/programs/draw-texture-on-canvas.js +6 -9
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +9 -13
- package/util/programs/supersampletotextures.js +3 -7
- package/util/programs/texturetoglobe.js +8 -11
- package/util/shaderfunctions/geometrytransformations.js +24 -31
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +1 -4
- package/util/shaderfunctions/noisefunctions.js +1 -3
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +1 -4
- package/util/webglobjectbuilders.js +16 -34
- package/util/webglobjectbuilders1.js +16 -34
- package/waveparticles/adaptor.js +1 -3
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +9 -12
- package/wind/imagetovectorfieldandmagnitude.js +1 -4
- package/wind/index.js +5 -14
- package/wind/plugin.js +6 -45
- package/wind/vectorfieldimage.js +1 -3
- package/write-text/attached-text-writer.js +6 -10
- package/write-text/context-text.js +4 -8
- package/write-text/context-text3.js +7 -11
- package/write-text/index.js +1 -5
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const programcache_1 = require("../programcache");
|
|
7
|
-
const util_1 = require("../../util/account/util");
|
|
8
|
-
const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/camerauniformblock";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
+
import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
|
+
import { longLatRadToMercator, longLatRadToCartesian3D, cartesian3DToGLPosition, mercatorXYToGLPosition, realDistanceOnSphereR1, circleLimpFromLongLatRadCenterCartesian3D_accurate, circleLimpFromLongLatRadCenterMercatorCompass_accurate, circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
9
6
|
/**
|
|
10
7
|
* TODO:
|
|
11
8
|
* 1. integrate geometry functions for radius angle and center
|
|
@@ -17,15 +14,15 @@ const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytr
|
|
|
17
14
|
const EDGE_COUNT_ON_SPHERE = 360;
|
|
18
15
|
const vertexShaderSource = `#version 300 es
|
|
19
16
|
precision highp float;
|
|
20
|
-
${
|
|
21
|
-
${
|
|
22
|
-
${
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
17
|
+
${CameraUniformBlockString}
|
|
18
|
+
${longLatRadToMercator}
|
|
19
|
+
${longLatRadToCartesian3D}
|
|
20
|
+
${cartesian3DToGLPosition}
|
|
21
|
+
${mercatorXYToGLPosition}
|
|
22
|
+
${realDistanceOnSphereR1}
|
|
23
|
+
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
24
|
+
${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
|
|
25
|
+
${circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate}
|
|
29
26
|
|
|
30
27
|
uniform float edge_count;
|
|
31
28
|
|
|
@@ -69,7 +66,7 @@ void main() {
|
|
|
69
66
|
|
|
70
67
|
}`;
|
|
71
68
|
const fragmentShaderSource = `#version 300 es
|
|
72
|
-
${
|
|
69
|
+
${POLE}
|
|
73
70
|
precision highp float;
|
|
74
71
|
uniform float opacity;
|
|
75
72
|
in vec4 v_color;
|
|
@@ -93,7 +90,7 @@ class Logic {
|
|
|
93
90
|
this.globe = globe;
|
|
94
91
|
this.gl = globe.gl;
|
|
95
92
|
this._lastOpacity = 1.0;
|
|
96
|
-
this.program =
|
|
93
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
97
94
|
const { gl, program } = this;
|
|
98
95
|
this.program.uniforms = {
|
|
99
96
|
opacity: gl.getUniformLocation(program, "opacity")
|
|
@@ -113,7 +110,7 @@ class Logic {
|
|
|
113
110
|
gl.bindAttribLocation(program, 5, "dash_opacity");
|
|
114
111
|
}
|
|
115
112
|
this.cameraBindingPoint = 0;
|
|
116
|
-
this.cameraBlockTotem =
|
|
113
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
117
114
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
118
115
|
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
119
116
|
}
|
|
@@ -124,27 +121,27 @@ class Logic {
|
|
|
124
121
|
gl.bindVertexArray(vao);
|
|
125
122
|
{ // make this a function end import from account module.
|
|
126
123
|
const { buffer, stride = 0, offset = 0 } = centerObj;
|
|
127
|
-
|
|
124
|
+
vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
|
|
128
125
|
}
|
|
129
126
|
{ // make this a function end import from account module.
|
|
130
127
|
const { buffer, stride = 0, offset = 0 } = center3dObj;
|
|
131
|
-
|
|
128
|
+
vaoAttributeLoader(gl, buffer, 1, 3, stride, offset, divisor);
|
|
132
129
|
}
|
|
133
130
|
{
|
|
134
131
|
const { buffer, stride = 0, offset = 0 } = radiusObj;
|
|
135
|
-
|
|
132
|
+
vaoAttributeLoader(gl, buffer, 2, 1, stride, offset, divisor);
|
|
136
133
|
}
|
|
137
134
|
{
|
|
138
135
|
const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
139
|
-
|
|
136
|
+
vaoAttributeLoader(gl, buffer, 3, 4, stride, offset, divisor);
|
|
140
137
|
}
|
|
141
138
|
{
|
|
142
139
|
const { buffer, stride = 0, offset = 0 } = dashRatioObj;
|
|
143
|
-
|
|
140
|
+
vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
|
|
144
141
|
}
|
|
145
142
|
{
|
|
146
143
|
const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
|
|
147
|
-
|
|
144
|
+
vaoAttributeLoader(gl, buffer, 5, 1, stride, offset, divisor);
|
|
148
145
|
}
|
|
149
146
|
gl.bindVertexArray(null);
|
|
150
147
|
gl.bindVertexArray(null);
|
|
@@ -167,12 +164,12 @@ class Logic {
|
|
|
167
164
|
free() {
|
|
168
165
|
if (this.isFreed)
|
|
169
166
|
return;
|
|
170
|
-
|
|
167
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
171
168
|
this.gl.deleteProgram(this.program);
|
|
172
169
|
this.isFreed = true;
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
|
-
|
|
176
|
-
get: (globe) =>
|
|
177
|
-
release: (globe) =>
|
|
172
|
+
export const CircleCache = Object.freeze({
|
|
173
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
174
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
178
175
|
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const programcache_1 = require("../programcache");
|
|
7
|
-
const util_1 = require("../../util/account/util");
|
|
8
|
-
const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/camerauniformblock";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
+
import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
|
+
import { longLatRadToMercator, longLatRadToCartesian3D, cartesian3DToGLPosition, mercatorXYToGLPosition, realDistanceOnSphereR1, circleLimpFromLongLatRadCenterCartesian3D, circleLimpFromLongLatRadCenterMercatorCompass, circleLimpFromLongLatRadCenterMercatorRealDistance, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
9
6
|
/**
|
|
10
7
|
* TODO:
|
|
11
8
|
* 1. integrate geometry functions for radius angle and center
|
|
@@ -17,15 +14,15 @@ const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytr
|
|
|
17
14
|
const EDGE_COUNT_ON_SPHERE = 360;
|
|
18
15
|
const vertexShaderSource = `#version 300 es
|
|
19
16
|
precision highp float;
|
|
20
|
-
${
|
|
21
|
-
${
|
|
22
|
-
${
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
17
|
+
${CameraUniformBlockString}
|
|
18
|
+
${longLatRadToMercator}
|
|
19
|
+
${longLatRadToCartesian3D}
|
|
20
|
+
${cartesian3DToGLPosition}
|
|
21
|
+
${mercatorXYToGLPosition}
|
|
22
|
+
${realDistanceOnSphereR1}
|
|
23
|
+
${circleLimpFromLongLatRadCenterCartesian3D}
|
|
24
|
+
${circleLimpFromLongLatRadCenterMercatorCompass}
|
|
25
|
+
${circleLimpFromLongLatRadCenterMercatorRealDistance}
|
|
29
26
|
|
|
30
27
|
uniform float edge_count;
|
|
31
28
|
|
|
@@ -64,7 +61,7 @@ void main() {
|
|
|
64
61
|
|
|
65
62
|
}`;
|
|
66
63
|
const fragmentShaderSource = `#version 300 es
|
|
67
|
-
${
|
|
64
|
+
${POLE}
|
|
68
65
|
precision highp float;
|
|
69
66
|
uniform float opacity;
|
|
70
67
|
in vec4 v_color;
|
|
@@ -88,7 +85,7 @@ class Logic {
|
|
|
88
85
|
this.globe = globe;
|
|
89
86
|
this.gl = globe.gl;
|
|
90
87
|
this._lastOpacity = 1.0;
|
|
91
|
-
this.program =
|
|
88
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
92
89
|
const { gl, program } = this;
|
|
93
90
|
this.program.uniforms = {
|
|
94
91
|
opacity: gl.getUniformLocation(program, "opacity")
|
|
@@ -107,7 +104,7 @@ class Logic {
|
|
|
107
104
|
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
108
105
|
}
|
|
109
106
|
this.cameraBindingPoint = 0;
|
|
110
|
-
this.cameraBlockTotem =
|
|
107
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
111
108
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
112
109
|
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
113
110
|
}
|
|
@@ -118,23 +115,23 @@ class Logic {
|
|
|
118
115
|
gl.bindVertexArray(vao);
|
|
119
116
|
{ // make this a function end import from account module.
|
|
120
117
|
const { buffer, stride = 0, offset = 0 } = centerObj;
|
|
121
|
-
|
|
118
|
+
vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
|
|
122
119
|
}
|
|
123
120
|
{
|
|
124
121
|
const { buffer, stride = 0, offset = 0 } = radiusObj;
|
|
125
|
-
|
|
122
|
+
vaoAttributeLoader(gl, buffer, 1, 1, stride, offset, divisor);
|
|
126
123
|
}
|
|
127
124
|
{
|
|
128
125
|
const { buffer, stride = 0, offset = 0 } = colorObj;
|
|
129
|
-
|
|
126
|
+
vaoAttributeLoader(gl, buffer, 2, 4, stride, offset, divisor);
|
|
130
127
|
}
|
|
131
128
|
{
|
|
132
129
|
const { buffer, stride = 0, offset = 0 } = dashRatioObj;
|
|
133
|
-
|
|
130
|
+
vaoAttributeLoader(gl, buffer, 3, 1, stride, offset, divisor);
|
|
134
131
|
}
|
|
135
132
|
{
|
|
136
133
|
const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
|
|
137
|
-
|
|
134
|
+
vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
|
|
138
135
|
}
|
|
139
136
|
gl.bindVertexArray(null);
|
|
140
137
|
gl.bindVertexArray(null);
|
|
@@ -156,12 +153,12 @@ class Logic {
|
|
|
156
153
|
free() {
|
|
157
154
|
if (this.isFreed)
|
|
158
155
|
return;
|
|
159
|
-
|
|
156
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
160
157
|
this.gl.deleteProgram(this.program);
|
|
161
158
|
this.isFreed = true;
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
|
-
|
|
165
|
-
get: (globe) =>
|
|
166
|
-
release: (globe) =>
|
|
161
|
+
export const CircleCache = Object.freeze({
|
|
162
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
163
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
167
164
|
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const webglobjectbuilders_1 = require("../../util/webglobjectbuilders");
|
|
5
|
-
const camerauniformblock_1 = require("../totems/camerauniformblock");
|
|
6
|
-
const programcache_1 = require("../programcache");
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/camerauniformblock";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
7
4
|
// import { vaoAttributeLoader } from "../../util/account/util";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
+
import { Z_ALPHA_MODE } from "./util";
|
|
7
|
+
import { cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate, POLE, } from "../../util/shaderfunctions/geometrytransformations";
|
|
11
8
|
/**
|
|
12
9
|
* TODO:
|
|
13
10
|
* 1. integrate geometry functions for radius angle and center
|
|
@@ -19,9 +16,9 @@ const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytr
|
|
|
19
16
|
const INITIAL_EDGE_COUNT = 720;
|
|
20
17
|
const vertexShaderSource = `#version 300 es
|
|
21
18
|
precision highp float;
|
|
22
|
-
${
|
|
23
|
-
${
|
|
24
|
-
${
|
|
19
|
+
${CameraUniformBlockString}
|
|
20
|
+
${cartesian3DToGLPosition}
|
|
21
|
+
${circleLimpFromLongLatRadCenterCartesian3D_accurate}
|
|
25
22
|
|
|
26
23
|
|
|
27
24
|
in vec3 center_position3d;
|
|
@@ -59,7 +56,7 @@ void main() {
|
|
|
59
56
|
gl_PointSize = 5.0;
|
|
60
57
|
}`;
|
|
61
58
|
const fragmentShaderSource = `#version 300 es
|
|
62
|
-
${
|
|
59
|
+
${POLE}
|
|
63
60
|
precision highp float;
|
|
64
61
|
uniform float opacity;
|
|
65
62
|
in vec4 v_color;
|
|
@@ -78,8 +75,8 @@ class Logic {
|
|
|
78
75
|
this._lastOpacity = 1.0;
|
|
79
76
|
this._lastEdgeCount = INITIAL_EDGE_COUNT;
|
|
80
77
|
this._lastStepAngle = 720 / INITIAL_EDGE_COUNT;
|
|
81
|
-
this._lastZAlphaMode =
|
|
82
|
-
this.program =
|
|
78
|
+
this._lastZAlphaMode = Z_ALPHA_MODE.ON;
|
|
79
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
83
80
|
const { gl, program } = this;
|
|
84
81
|
this.program.uniforms = {
|
|
85
82
|
opacity: gl.getUniformLocation(program, "opacity"),
|
|
@@ -93,7 +90,7 @@ class Logic {
|
|
|
93
90
|
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
94
91
|
gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
|
|
95
92
|
gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
|
|
96
|
-
gl.uniform1i(program.uniforms.zAlphaMode,
|
|
93
|
+
gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
|
|
97
94
|
gl.useProgram(currentProgram);
|
|
98
95
|
}
|
|
99
96
|
{ // assign attribute locations
|
|
@@ -103,7 +100,7 @@ class Logic {
|
|
|
103
100
|
gl.bindAttribLocation(program, 3, "color");
|
|
104
101
|
}
|
|
105
102
|
this.cameraBindingPoint = 0;
|
|
106
|
-
this.cameraBlockTotem =
|
|
103
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
107
104
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
108
105
|
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
109
106
|
}
|
|
@@ -112,14 +109,14 @@ class Logic {
|
|
|
112
109
|
const vao = gl.createVertexArray();
|
|
113
110
|
const divisor = 1;
|
|
114
111
|
gl.bindVertexArray(vao);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
attributeLoader(gl, center3dObj, 0, 3, { divisor });
|
|
113
|
+
attributeLoader(gl, bigRadiusObj, 1, 1, { divisor });
|
|
114
|
+
attributeLoader(gl, smallRadiusObj, 2, 1, { divisor });
|
|
115
|
+
attributeLoader(gl, colorObj, 3, 4, { divisor });
|
|
119
116
|
gl.bindVertexArray(null);
|
|
120
117
|
return vao;
|
|
121
118
|
}
|
|
122
|
-
draw(vao, length, edgeCount, stepAngle, opacity, zAlphaMode =
|
|
119
|
+
draw(vao, length, edgeCount, stepAngle, opacity, zAlphaMode = Z_ALPHA_MODE.ON) {
|
|
123
120
|
const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
|
|
124
121
|
gl.useProgram(program);
|
|
125
122
|
if (this._lastOpacity !== opacity) {
|
|
@@ -148,12 +145,12 @@ class Logic {
|
|
|
148
145
|
free() {
|
|
149
146
|
if (this.isFreed)
|
|
150
147
|
return;
|
|
151
|
-
|
|
148
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
152
149
|
this.gl.deleteProgram(this.program);
|
|
153
150
|
this.isFreed = true;
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
|
-
|
|
157
|
-
get: (globe) =>
|
|
158
|
-
release: (globe) =>
|
|
153
|
+
export const CirclePadding3DCache = Object.freeze({
|
|
154
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
155
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
159
156
|
});
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const util_1 = require("../../util");
|
|
8
|
-
const util_2 = require("./util");
|
|
9
|
-
Object.defineProperty(exports, "Z_ALPHA_MODE", { enumerable: true, get: function () { return util_2.Z_ALPHA_MODE; } });
|
|
10
|
-
const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
|
|
1
|
+
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
2
|
+
import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
+
import { createProgram } from "../../util";
|
|
5
|
+
import { Z_ALPHA_MODE } from "./util";
|
|
6
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
11
7
|
/**
|
|
12
8
|
* This program draws line between points provided from the first and second buffer.
|
|
13
9
|
* draw method gl.drawArraysInstanced( gl.POINTS, 0,2, lineCount);
|
|
@@ -15,8 +11,8 @@ const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader")
|
|
|
15
11
|
// TODO: find better way to eleminate edge case distance(posA, posB) > 37000000.0
|
|
16
12
|
const vertexShaderSource = `#version 300 es
|
|
17
13
|
precision highp float;
|
|
18
|
-
${
|
|
19
|
-
${
|
|
14
|
+
${CameraUniformBlockString}
|
|
15
|
+
${mercatorXYToGLPosition}
|
|
20
16
|
uniform float opacity;
|
|
21
17
|
uniform int z_alpha_on;
|
|
22
18
|
|
|
@@ -54,7 +50,7 @@ void main() {
|
|
|
54
50
|
gl_PointSize = 4.0;
|
|
55
51
|
}`;
|
|
56
52
|
const fragmentShaderSource = `#version 300 es
|
|
57
|
-
${
|
|
53
|
+
${POLE}
|
|
58
54
|
precision highp float;
|
|
59
55
|
in vec4 v_color;
|
|
60
56
|
in vec2 v_frame;
|
|
@@ -67,9 +63,9 @@ class Logic {
|
|
|
67
63
|
constructor(globe) {
|
|
68
64
|
this.globe = globe;
|
|
69
65
|
this.gl = globe.gl;
|
|
70
|
-
this.program =
|
|
66
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
71
67
|
this._lastOpicity = 1.0;
|
|
72
|
-
this._lastZAlphaOn =
|
|
68
|
+
this._lastZAlphaOn = Z_ALPHA_MODE.OFF;
|
|
73
69
|
const { gl, program } = this;
|
|
74
70
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
75
71
|
gl.useProgram(program);
|
|
@@ -85,7 +81,7 @@ class Logic {
|
|
|
85
81
|
gl.uniform1f(this._opacityLocation, this._lastOpicity);
|
|
86
82
|
}
|
|
87
83
|
{ // uniform block
|
|
88
|
-
this._cameraUniformBlock =
|
|
84
|
+
this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
89
85
|
this._cameraBindingPoint = 0;
|
|
90
86
|
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
91
87
|
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
@@ -97,13 +93,13 @@ class Logic {
|
|
|
97
93
|
const vao = gl.createVertexArray();
|
|
98
94
|
const divisor = 1;
|
|
99
95
|
gl.bindVertexArray(vao);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
attributeLoader(gl, posAObj, 0, 2, { divisor });
|
|
97
|
+
attributeLoader(gl, posBObj, 1, 2, { divisor });
|
|
98
|
+
attributeLoader(gl, colorObj, 2, 4, { divisor });
|
|
103
99
|
gl.bindVertexArray(null);
|
|
104
100
|
return vao;
|
|
105
101
|
}
|
|
106
|
-
draw(vao, lineCount, opacity = 1.0, zAlphaOn =
|
|
102
|
+
draw(vao, lineCount, opacity = 1.0, zAlphaOn = Z_ALPHA_MODE.ON) {
|
|
107
103
|
const { gl, program, _cameraBindingPoint, _cameraUniformBlock } = this;
|
|
108
104
|
gl.useProgram(program);
|
|
109
105
|
_cameraUniformBlock.bind(_cameraBindingPoint);
|
|
@@ -124,13 +120,13 @@ class Logic {
|
|
|
124
120
|
if (this.isFreed)
|
|
125
121
|
return;
|
|
126
122
|
const { gl, program, globe } = this;
|
|
127
|
-
|
|
123
|
+
CameraUniformBlockTotemCache.release(globe);
|
|
128
124
|
gl.deleteProgram(program);
|
|
129
125
|
this.isFreed = true;
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
const LinesColorInstancedFlatCache = Object.freeze({
|
|
133
|
-
get: (globe) => { return
|
|
134
|
-
release: (globe) => {
|
|
129
|
+
get: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
130
|
+
release: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
135
131
|
});
|
|
136
|
-
|
|
132
|
+
export { LinesColorInstancedFlatCache, Z_ALPHA_MODE };
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require("../../util/gl-util/uniform-block/types");
|
|
13
|
-
const methods_1 = require("../../util/gl-util/draw-options/methods");
|
|
14
|
-
require("../../util/gl-util/draw-options/types");
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import "../interface";
|
|
3
|
+
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totems/index";
|
|
4
|
+
import { cartesian3DToGLPosition, mercatorXYToGLPosition, } from "../../util/shaderfunctions/geometrytransformations.js";
|
|
5
|
+
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
6
|
+
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
7
|
+
import "../../util/gl-util/buffer/attribute-loader";
|
|
8
|
+
import { UniformBlockManager } from "../../util/gl-util/uniform-block/manager";
|
|
9
|
+
import "../../util/gl-util/uniform-block/types";
|
|
10
|
+
import { drawArrays } from "../../util/gl-util/draw-options/methods";
|
|
11
|
+
import "../../util/gl-util/draw-options/types";
|
|
15
12
|
const ESCAPE_VALUE = -1;
|
|
16
13
|
const uniformBindingPoints = {
|
|
17
14
|
camera: 0,
|
|
18
15
|
flexible: 1,
|
|
19
16
|
};
|
|
20
17
|
const one = new Float32Array([1]);
|
|
21
|
-
const flexibleBlockManager = new
|
|
18
|
+
const flexibleBlockManager = new UniformBlockManager('FlexibleAttributes', [
|
|
22
19
|
{ name: "u_color", type: "vec4", value: new Float32Array([0.12, 1, 0.1, 1]) },
|
|
23
20
|
{ name: "u_dash_opacity", type: "float", value: one },
|
|
24
21
|
{ name: "u_dash_length", type: "float", value: one },
|
|
@@ -26,9 +23,9 @@ const flexibleBlockManager = new manager_1.UniformBlockManager('FlexibleAttribut
|
|
|
26
23
|
const vertexShaderSource = `#version 300 es
|
|
27
24
|
precision highp float;
|
|
28
25
|
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
${
|
|
26
|
+
${CameraUniformBlockString}
|
|
27
|
+
${cartesian3DToGLPosition}
|
|
28
|
+
${mercatorXYToGLPosition}
|
|
32
29
|
|
|
33
30
|
${flexibleBlockManager.glslCode()}
|
|
34
31
|
|
|
@@ -110,7 +107,7 @@ class Logic {
|
|
|
110
107
|
console.log("LineStripProgram globe", globe);
|
|
111
108
|
this.gl = globe.gl;
|
|
112
109
|
this.globe = globe;
|
|
113
|
-
this.program =
|
|
110
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
114
111
|
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
115
112
|
this.gl.useProgram(this.program);
|
|
116
113
|
this._opacity.location = this.gl.getUniformLocation(this.program, "opacity");
|
|
@@ -121,7 +118,7 @@ class Logic {
|
|
|
121
118
|
this.gl.bindAttribLocation(this.program, 2, "color");
|
|
122
119
|
this.gl.bindAttribLocation(this.program, 3, "dash_length");
|
|
123
120
|
this.gl.bindAttribLocation(this.program, 4, "dash_opacity");
|
|
124
|
-
this.cameraBlockTotem =
|
|
121
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
125
122
|
this.cameraBlockTotem.assignBindingPoint(this.program, uniformBindingPoints.camera);
|
|
126
123
|
flexibleBlockManager.assignBindingPoint(this.gl, this.program);
|
|
127
124
|
this._defaultFlexibleUBO = flexibleBlockManager.createUBO(this.gl);
|
|
@@ -136,11 +133,11 @@ class Logic {
|
|
|
136
133
|
const { gl } = this;
|
|
137
134
|
const vao = gl.createVertexArray();
|
|
138
135
|
gl.bindVertexArray(vao);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
attributeLoader(gl, position3D, 0, 3);
|
|
137
|
+
attributeLoader(gl, position2D, 1, 2);
|
|
138
|
+
attributeLoader(gl, color, 2, 4, { escapeValues: [ESCAPE_VALUE, ESCAPE_VALUE, ESCAPE_VALUE, ESCAPE_VALUE] });
|
|
139
|
+
attributeLoader(gl, dashLength, 3, 1, { escapeValues: [ESCAPE_VALUE] });
|
|
140
|
+
attributeLoader(gl, dashOpacity, 4, 1, { escapeValues: [ESCAPE_VALUE] });
|
|
144
141
|
gl.bindVertexArray(null);
|
|
145
142
|
return vao;
|
|
146
143
|
}
|
|
@@ -155,8 +152,8 @@ class Logic {
|
|
|
155
152
|
cameraBlockTotem.bind(uniformBindingPoints.camera);
|
|
156
153
|
ubo.bind();
|
|
157
154
|
gl.bindVertexArray(vao);
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
drawArrays(gl, gl.POINTS, drawOptions);
|
|
156
|
+
drawArrays(gl, gl.LINE_STRIP, drawOptions);
|
|
160
157
|
gl.bindVertexArray(null);
|
|
161
158
|
ubo.unbind();
|
|
162
159
|
cameraBlockTotem.unbind(uniformBindingPoints.camera);
|
|
@@ -166,11 +163,11 @@ class Logic {
|
|
|
166
163
|
this._ubosPublished.forEach((ubo) => ubo.free());
|
|
167
164
|
this.gl.deleteProgram(this.program);
|
|
168
165
|
this._defaultFlexibleUBO.free();
|
|
169
|
-
|
|
166
|
+
CameraUniformBlockTotemCache.release(this.globe);
|
|
170
167
|
this.gl.deleteProgram(this.program);
|
|
171
168
|
}
|
|
172
169
|
}
|
|
173
|
-
|
|
174
|
-
get: (globe) =>
|
|
175
|
-
release: (globe) =>
|
|
170
|
+
export const LineStripProgramCache = Object.freeze({
|
|
171
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
172
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic),
|
|
176
173
|
});
|